diff options
Diffstat (limited to 'drivers/scsi/pcmcia/nsp_cs.c')
-rw-r--r-- | drivers/scsi/pcmcia/nsp_cs.c | 102 |
1 files changed, 55 insertions, 47 deletions
diff --git a/drivers/scsi/pcmcia/nsp_cs.c b/drivers/scsi/pcmcia/nsp_cs.c index 050ea13ff80b..870e87180d12 100644 --- a/drivers/scsi/pcmcia/nsp_cs.c +++ b/drivers/scsi/pcmcia/nsp_cs.c | |||
@@ -2021,6 +2021,59 @@ static void nsp_cs_release(dev_link_t *link) | |||
2021 | #endif | 2021 | #endif |
2022 | } /* nsp_cs_release */ | 2022 | } /* nsp_cs_release */ |
2023 | 2023 | ||
2024 | static int nsp_cs_suspend(struct pcmcia_device *dev) | ||
2025 | { | ||
2026 | dev_link_t *link = dev_to_instance(dev); | ||
2027 | scsi_info_t *info = link->priv; | ||
2028 | nsp_hw_data *data; | ||
2029 | |||
2030 | link->state |= DEV_SUSPEND; | ||
2031 | |||
2032 | nsp_dbg(NSP_DEBUG_INIT, "event: suspend"); | ||
2033 | |||
2034 | if (info->host != NULL) { | ||
2035 | nsp_msg(KERN_INFO, "clear SDTR status"); | ||
2036 | |||
2037 | data = (nsp_hw_data *)info->host->hostdata; | ||
2038 | |||
2039 | nsphw_init_sync(data); | ||
2040 | } | ||
2041 | |||
2042 | info->stop = 1; | ||
2043 | |||
2044 | if (link->state & DEV_CONFIG) | ||
2045 | pcmcia_release_configuration(link->handle); | ||
2046 | |||
2047 | return 0; | ||
2048 | } | ||
2049 | |||
2050 | static int nsp_cs_resume(struct pcmcia_device *dev) | ||
2051 | { | ||
2052 | dev_link_t *link = dev_to_instance(dev); | ||
2053 | scsi_info_t *info = link->priv; | ||
2054 | nsp_hw_data *data; | ||
2055 | |||
2056 | nsp_dbg(NSP_DEBUG_INIT, "event: resume"); | ||
2057 | |||
2058 | link->state &= ~DEV_SUSPEND; | ||
2059 | |||
2060 | if (link->state & DEV_CONFIG) | ||
2061 | pcmcia_request_configuration(link->handle, &link->conf); | ||
2062 | |||
2063 | info->stop = 0; | ||
2064 | |||
2065 | if (info->host != NULL) { | ||
2066 | nsp_msg(KERN_INFO, "reset host and bus"); | ||
2067 | |||
2068 | data = (nsp_hw_data *)info->host->hostdata; | ||
2069 | |||
2070 | nsphw_init (data); | ||
2071 | nsp_bus_reset(data); | ||
2072 | } | ||
2073 | |||
2074 | return 0; | ||
2075 | } | ||
2076 | |||
2024 | /*====================================================================== | 2077 | /*====================================================================== |
2025 | 2078 | ||
2026 | The card status event handler. Mostly, this schedules other | 2079 | The card status event handler. Mostly, this schedules other |
@@ -2039,8 +2092,6 @@ static int nsp_cs_event(event_t event, | |||
2039 | event_callback_args_t *args) | 2092 | event_callback_args_t *args) |
2040 | { | 2093 | { |
2041 | dev_link_t *link = args->client_data; | 2094 | dev_link_t *link = args->client_data; |
2042 | scsi_info_t *info = link->priv; | ||
2043 | nsp_hw_data *data; | ||
2044 | 2095 | ||
2045 | nsp_dbg(NSP_DEBUG_INIT, "in, event=0x%08x", event); | 2096 | nsp_dbg(NSP_DEBUG_INIT, "in, event=0x%08x", event); |
2046 | 2097 | ||
@@ -2062,51 +2113,6 @@ static int nsp_cs_event(event_t event, | |||
2062 | #endif | 2113 | #endif |
2063 | nsp_cs_config(link); | 2114 | nsp_cs_config(link); |
2064 | break; | 2115 | break; |
2065 | |||
2066 | case CS_EVENT_PM_SUSPEND: | ||
2067 | nsp_dbg(NSP_DEBUG_INIT, "event: suspend"); | ||
2068 | link->state |= DEV_SUSPEND; | ||
2069 | /* Fall through... */ | ||
2070 | case CS_EVENT_RESET_PHYSICAL: | ||
2071 | /* Mark the device as stopped, to block IO until later */ | ||
2072 | nsp_dbg(NSP_DEBUG_INIT, "event: reset physical"); | ||
2073 | |||
2074 | if (info->host != NULL) { | ||
2075 | nsp_msg(KERN_INFO, "clear SDTR status"); | ||
2076 | |||
2077 | data = (nsp_hw_data *)info->host->hostdata; | ||
2078 | |||
2079 | nsphw_init_sync(data); | ||
2080 | } | ||
2081 | |||
2082 | info->stop = 1; | ||
2083 | if (link->state & DEV_CONFIG) { | ||
2084 | pcmcia_release_configuration(link->handle); | ||
2085 | } | ||
2086 | break; | ||
2087 | |||
2088 | case CS_EVENT_PM_RESUME: | ||
2089 | nsp_dbg(NSP_DEBUG_INIT, "event: resume"); | ||
2090 | link->state &= ~DEV_SUSPEND; | ||
2091 | /* Fall through... */ | ||
2092 | case CS_EVENT_CARD_RESET: | ||
2093 | nsp_dbg(NSP_DEBUG_INIT, "event: reset"); | ||
2094 | if (link->state & DEV_CONFIG) { | ||
2095 | pcmcia_request_configuration(link->handle, &link->conf); | ||
2096 | } | ||
2097 | info->stop = 0; | ||
2098 | |||
2099 | if (info->host != NULL) { | ||
2100 | nsp_msg(KERN_INFO, "reset host and bus"); | ||
2101 | |||
2102 | data = (nsp_hw_data *)info->host->hostdata; | ||
2103 | |||
2104 | nsphw_init (data); | ||
2105 | nsp_bus_reset(data); | ||
2106 | } | ||
2107 | |||
2108 | break; | ||
2109 | |||
2110 | default: | 2116 | default: |
2111 | nsp_dbg(NSP_DEBUG_INIT, "event: unknown"); | 2117 | nsp_dbg(NSP_DEBUG_INIT, "event: unknown"); |
2112 | break; | 2118 | break; |
@@ -2140,6 +2146,8 @@ static struct pcmcia_driver nsp_driver = { | |||
2140 | .event = nsp_cs_event, | 2146 | .event = nsp_cs_event, |
2141 | .detach = nsp_cs_detach, | 2147 | .detach = nsp_cs_detach, |
2142 | .id_table = nsp_cs_ids, | 2148 | .id_table = nsp_cs_ids, |
2149 | .suspend = nsp_cs_suspend, | ||
2150 | .resume = nsp_cs_resume, | ||
2143 | }; | 2151 | }; |
2144 | #endif | 2152 | #endif |
2145 | 2153 | ||