diff options
Diffstat (limited to 'drivers/net/pcmcia/smc91c92_cs.c')
-rw-r--r-- | drivers/net/pcmcia/smc91c92_cs.c | 109 |
1 files changed, 60 insertions, 49 deletions
diff --git a/drivers/net/pcmcia/smc91c92_cs.c b/drivers/net/pcmcia/smc91c92_cs.c index c7cca842e5ee..7c61ec90c2c3 100644 --- a/drivers/net/pcmcia/smc91c92_cs.c +++ b/drivers/net/pcmcia/smc91c92_cs.c | |||
@@ -895,6 +895,62 @@ free_cfg_mem: | |||
895 | return rc; | 895 | return rc; |
896 | } | 896 | } |
897 | 897 | ||
898 | static int smc91c92_suspend(struct pcmcia_device *p_dev) | ||
899 | { | ||
900 | dev_link_t *link = dev_to_instance(p_dev); | ||
901 | struct net_device *dev = link->priv; | ||
902 | |||
903 | link->state |= DEV_SUSPEND; | ||
904 | if (link->state & DEV_CONFIG) { | ||
905 | if (link->open) | ||
906 | netif_device_detach(dev); | ||
907 | pcmcia_release_configuration(link->handle); | ||
908 | } | ||
909 | |||
910 | return 0; | ||
911 | } | ||
912 | |||
913 | static int smc91c92_resume(struct pcmcia_device *p_dev) | ||
914 | { | ||
915 | dev_link_t *link = dev_to_instance(p_dev); | ||
916 | struct net_device *dev = link->priv; | ||
917 | struct smc_private *smc = netdev_priv(dev); | ||
918 | int i; | ||
919 | |||
920 | link->state &= ~DEV_SUSPEND; | ||
921 | if (link->state & DEV_CONFIG) { | ||
922 | if ((smc->manfid == MANFID_MEGAHERTZ) && | ||
923 | (smc->cardid == PRODID_MEGAHERTZ_EM3288)) | ||
924 | mhz_3288_power(link); | ||
925 | pcmcia_request_configuration(link->handle, &link->conf); | ||
926 | if (smc->manfid == MANFID_MOTOROLA) | ||
927 | mot_config(link); | ||
928 | if ((smc->manfid == MANFID_OSITECH) && | ||
929 | (smc->cardid != PRODID_OSITECH_SEVEN)) { | ||
930 | /* Power up the card and enable interrupts */ | ||
931 | set_bits(0x0300, dev->base_addr-0x10+OSITECH_AUI_PWR); | ||
932 | set_bits(0x0300, dev->base_addr-0x10+OSITECH_RESET_ISR); | ||
933 | } | ||
934 | if (((smc->manfid == MANFID_OSITECH) && | ||
935 | (smc->cardid == PRODID_OSITECH_SEVEN)) || | ||
936 | ((smc->manfid == MANFID_PSION) && | ||
937 | (smc->cardid == PRODID_PSION_NET100))) { | ||
938 | /* Download the Seven of Diamonds firmware */ | ||
939 | for (i = 0; i < sizeof(__Xilinx7OD); i++) { | ||
940 | outb(__Xilinx7OD[i], link->io.BasePort1+2); | ||
941 | udelay(50); | ||
942 | } | ||
943 | } | ||
944 | if (link->open) { | ||
945 | smc_reset(dev); | ||
946 | netif_device_attach(dev); | ||
947 | } | ||
948 | } | ||
949 | |||
950 | return 0; | ||
951 | } | ||
952 | |||
953 | |||
898 | /*====================================================================== | 954 | /*====================================================================== |
899 | 955 | ||
900 | This verifies that the chip is some SMC91cXX variant, and returns | 956 | This verifies that the chip is some SMC91cXX variant, and returns |
@@ -935,14 +991,12 @@ static int check_sig(dev_link_t *link) | |||
935 | } | 991 | } |
936 | 992 | ||
937 | if (width) { | 993 | if (width) { |
938 | event_callback_args_t args; | ||
939 | printk(KERN_INFO "smc91c92_cs: using 8-bit IO window.\n"); | 994 | printk(KERN_INFO "smc91c92_cs: using 8-bit IO window.\n"); |
940 | args.client_data = link; | 995 | smc91c92_suspend(link->handle); |
941 | smc91c92_event(CS_EVENT_RESET_PHYSICAL, 0, &args); | ||
942 | pcmcia_release_io(link->handle, &link->io); | 996 | pcmcia_release_io(link->handle, &link->io); |
943 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; | 997 | link->io.Attributes1 = IO_DATA_PATH_WIDTH_8; |
944 | pcmcia_request_io(link->handle, &link->io); | 998 | pcmcia_request_io(link->handle, &link->io); |
945 | smc91c92_event(CS_EVENT_CARD_RESET, 0, &args); | 999 | smc91c92_resume(link->handle); |
946 | return check_sig(link); | 1000 | return check_sig(link); |
947 | } | 1001 | } |
948 | return -ENODEV; | 1002 | return -ENODEV; |
@@ -1184,8 +1238,6 @@ static int smc91c92_event(event_t event, int priority, | |||
1184 | { | 1238 | { |
1185 | dev_link_t *link = args->client_data; | 1239 | dev_link_t *link = args->client_data; |
1186 | struct net_device *dev = link->priv; | 1240 | struct net_device *dev = link->priv; |
1187 | struct smc_private *smc = netdev_priv(dev); | ||
1188 | int i; | ||
1189 | 1241 | ||
1190 | DEBUG(1, "smc91c92_event(0x%06x)\n", event); | 1242 | DEBUG(1, "smc91c92_event(0x%06x)\n", event); |
1191 | 1243 | ||
@@ -1199,49 +1251,6 @@ static int smc91c92_event(event_t event, int priority, | |||
1199 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; | 1251 | link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; |
1200 | smc91c92_config(link); | 1252 | smc91c92_config(link); |
1201 | break; | 1253 | break; |
1202 | case CS_EVENT_PM_SUSPEND: | ||
1203 | link->state |= DEV_SUSPEND; | ||
1204 | /* Fall through... */ | ||
1205 | case CS_EVENT_RESET_PHYSICAL: | ||
1206 | if (link->state & DEV_CONFIG) { | ||
1207 | if (link->open) | ||
1208 | netif_device_detach(dev); | ||
1209 | pcmcia_release_configuration(link->handle); | ||
1210 | } | ||
1211 | break; | ||
1212 | case CS_EVENT_PM_RESUME: | ||
1213 | link->state &= ~DEV_SUSPEND; | ||
1214 | /* Fall through... */ | ||
1215 | case CS_EVENT_CARD_RESET: | ||
1216 | if (link->state & DEV_CONFIG) { | ||
1217 | if ((smc->manfid == MANFID_MEGAHERTZ) && | ||
1218 | (smc->cardid == PRODID_MEGAHERTZ_EM3288)) | ||
1219 | mhz_3288_power(link); | ||
1220 | pcmcia_request_configuration(link->handle, &link->conf); | ||
1221 | if (smc->manfid == MANFID_MOTOROLA) | ||
1222 | mot_config(link); | ||
1223 | if ((smc->manfid == MANFID_OSITECH) && | ||
1224 | (smc->cardid != PRODID_OSITECH_SEVEN)) { | ||
1225 | /* Power up the card and enable interrupts */ | ||
1226 | set_bits(0x0300, dev->base_addr-0x10+OSITECH_AUI_PWR); | ||
1227 | set_bits(0x0300, dev->base_addr-0x10+OSITECH_RESET_ISR); | ||
1228 | } | ||
1229 | if (((smc->manfid == MANFID_OSITECH) && | ||
1230 | (smc->cardid == PRODID_OSITECH_SEVEN)) || | ||
1231 | ((smc->manfid == MANFID_PSION) && | ||
1232 | (smc->cardid == PRODID_PSION_NET100))) { | ||
1233 | /* Download the Seven of Diamonds firmware */ | ||
1234 | for (i = 0; i < sizeof(__Xilinx7OD); i++) { | ||
1235 | outb(__Xilinx7OD[i], link->io.BasePort1+2); | ||
1236 | udelay(50); | ||
1237 | } | ||
1238 | } | ||
1239 | if (link->open) { | ||
1240 | smc_reset(dev); | ||
1241 | netif_device_attach(dev); | ||
1242 | } | ||
1243 | } | ||
1244 | break; | ||
1245 | } | 1254 | } |
1246 | return 0; | 1255 | return 0; |
1247 | } /* smc91c92_event */ | 1256 | } /* smc91c92_event */ |
@@ -2364,6 +2373,8 @@ static struct pcmcia_driver smc91c92_cs_driver = { | |||
2364 | .event = smc91c92_event, | 2373 | .event = smc91c92_event, |
2365 | .detach = smc91c92_detach, | 2374 | .detach = smc91c92_detach, |
2366 | .id_table = smc91c92_ids, | 2375 | .id_table = smc91c92_ids, |
2376 | .suspend = smc91c92_suspend, | ||
2377 | .resume = smc91c92_resume, | ||
2367 | }; | 2378 | }; |
2368 | 2379 | ||
2369 | static int __init init_smc91c92_cs(void) | 2380 | static int __init init_smc91c92_cs(void) |