summaryrefslogtreecommitdiff
path: root/drivers/ssb/pcmcia.c
diff options
context:
space:
mode:
authorMichael Buesch <mb@bu3sch.de>2008-03-30 03:10:50 +0400
committerJohn W. Linville <linville@tuxdriver.com>2008-04-08 23:05:57 +0400
commit8fe2b65a18e49bfde56a59ed4ab3fc7aa0c2f325 (patch)
treea813fe635b7a8c248c586de847d1501c4ccaab6b /drivers/ssb/pcmcia.c
parent5100d5ac81b9330dc57e35adbe50923ba6107b8f (diff)
downloadlinux-8fe2b65a18e49bfde56a59ed4ab3fc7aa0c2f325.tar.xz
ssb: Turn suspend/resume upside down
Turn the SSB bus suspend mechanism upside down. Instead of deciding by an internal reference count when to suspend/resume, let the parent bus call us in their suspend/resume routine. Signed-off-by: Michael Buesch <mb@bu3sch.de> Signed-off-by: John W. Linville <linville@tuxdriver.com>
Diffstat (limited to 'drivers/ssb/pcmcia.c')
-rw-r--r--drivers/ssb/pcmcia.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/drivers/ssb/pcmcia.c b/drivers/ssb/pcmcia.c
index d674cef7210d..dcaf2412bea7 100644
--- a/drivers/ssb/pcmcia.c
+++ b/drivers/ssb/pcmcia.c
@@ -684,6 +684,29 @@ static int ssb_pcmcia_cor_setup(struct ssb_bus *bus, u8 cor)
return 0;
}
+/* Initialize the PCMCIA hardware. This is called on Init and Resume. */
+int ssb_pcmcia_hardware_setup(struct ssb_bus *bus)
+{
+ int err;
+
+ if (bus->bustype != SSB_BUSTYPE_PCMCIA)
+ return 0;
+
+ /* Switch segment to a known state and sync
+ * bus->mapped_pcmcia_seg with hardware state. */
+ ssb_pcmcia_switch_segment(bus, 0);
+ /* Init the COR register. */
+ err = ssb_pcmcia_cor_setup(bus, CISREG_COR);
+ if (err)
+ return err;
+ /* Some cards also need this register to get poked. */
+ err = ssb_pcmcia_cor_setup(bus, CISREG_COR + 0x80);
+ if (err)
+ return err;
+
+ return 0;
+}
+
void ssb_pcmcia_exit(struct ssb_bus *bus)
{
if (bus->bustype != SSB_BUSTYPE_PCMCIA)
@@ -699,16 +722,7 @@ int ssb_pcmcia_init(struct ssb_bus *bus)
if (bus->bustype != SSB_BUSTYPE_PCMCIA)
return 0;
- /* Switch segment to a known state and sync
- * bus->mapped_pcmcia_seg with hardware state. */
- ssb_pcmcia_switch_segment(bus, 0);
-
- /* Init the COR register. */
- err = ssb_pcmcia_cor_setup(bus, CISREG_COR);
- if (err)
- goto error;
- /* Some cards also need this register to get poked. */
- err = ssb_pcmcia_cor_setup(bus, CISREG_COR + 0x80);
+ err = ssb_pcmcia_hardware_setup(bus);
if (err)
goto error;