]> pilppa.com Git - linux-2.6-omap-h63xx.git/commitdiff
[ARM] 3230/1: Sharp Scoop: Fix Shared Power Control Issues
authorRichard Purdie <rpurdie@rpsys.net>
Thu, 5 Jan 2006 20:44:57 +0000 (20:44 +0000)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Thu, 5 Jan 2006 20:44:57 +0000 (20:44 +0000)
Patch from Richard Purdie

The SL-Cxx00 devices have a power control register in SCOOP that is
shared by both CF and MMC/SD card slots. The CF reset code was resetting
this register leading to various lockups as the MMC power was suddenly
lost. This patch handles the CPR register in a more sensitive manner.

It also removes some unneeded collie specific calls as the reset code
handles this.

Signed-off-by: Richard Purdie <rpurdie@rpsys.net>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/common/scoop.c
arch/arm/mach-pxa/spitz.c
drivers/pcmcia/pxa2xx_sharpsl.c

index 0c3cbd9a388b90d085f0e7b98113f375a2bfd512..b6de43e736998b05c2d598ccf530d0ece0dcec2e 100644 (file)
@@ -33,7 +33,6 @@ void reset_scoop(struct device *dev)
 
        SCOOP_REG(sdev->base,SCOOP_MCR) = 0x0100;  // 00
        SCOOP_REG(sdev->base,SCOOP_CDR) = 0x0000;  // 04
-       SCOOP_REG(sdev->base,SCOOP_CPR) = 0x0000;  // 0C
        SCOOP_REG(sdev->base,SCOOP_CCR) = 0x0000;  // 10
        SCOOP_REG(sdev->base,SCOOP_IMR) = 0x0000;  // 18
        SCOOP_REG(sdev->base,SCOOP_IRM) = 0x00FF;  // 14
@@ -154,6 +153,7 @@ int __init scoop_probe(struct platform_device *pdev)
 
        SCOOP_REG(devptr->base, SCOOP_MCR) = 0x0140;
        reset_scoop(&pdev->dev);
+       SCOOP_REG(devptr->base, SCOOP_CPR) = 0x0000;
        SCOOP_REG(devptr->base, SCOOP_GPCR) = inf->io_dir & 0xffff;
        SCOOP_REG(devptr->base, SCOOP_GPWR) = inf->io_out & 0xffff;
 
index 5d34abc64af7780902018bf9be18c67ddde3ac7f..f2007db0cda5aebe5ad398a3909f8ddecd1f688f 100644 (file)
@@ -127,10 +127,12 @@ static void spitz_card_pwr_ctrl(int device, unsigned short new_cpr)
                        cpr &= ~0x0002;
                if (device == SPITZ_PWR_SD)
                        cpr &= ~0x0004;
-               write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr);
                if (!(cpr & 0x0002) && !(cpr & 0x0004)) {
+                       write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, 0x0000);
                        mdelay(1);
                        reset_scoop_gpio(&spitzscoop_device.dev, SPITZ_SCP_CF_POWER);
+               } else {
+                       write_scoop_reg(&spitzscoop_device.dev, SCOOP_CPR, cpr | new_cpr);
                }
        }
 }
index 56c58831e80e593eae62c2e33744fcd508ad7cd2..4fbd995360b0867b65d995b2c459ae13a39ecde5 100644 (file)
 struct scoop_pcmcia_config *platform_scoop_config;
 #define SCOOP_DEV platform_scoop_config->devs
 
-static void sharpsl_pcmcia_init_reset(struct scoop_pcmcia_dev *scoopdev)
+static void sharpsl_pcmcia_init_reset(struct soc_pcmcia_socket *skt)
 {
+       struct scoop_pcmcia_dev *scoopdev = &SCOOP_DEV[skt->nr];
+
        reset_scoop(scoopdev->dev);
+
+       /* Shared power controls need to be handled carefully */
+       if (platform_scoop_config->power_ctrl)
+               platform_scoop_config->power_ctrl(scoopdev->dev, 0x0000, skt->nr);
+       else
+               write_scoop_reg(scoopdev->dev, SCOOP_CPR, 0x0000);
+
        scoopdev->keep_vs = NO_KEEP_VS;
        scoopdev->keep_rd = 0;
 }
@@ -208,26 +217,17 @@ static int sharpsl_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
 
 static void sharpsl_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
 {
-       sharpsl_pcmcia_init_reset(&SCOOP_DEV[skt->nr]);
+       sharpsl_pcmcia_init_reset(skt);
 
        /* Enable interrupt */
        write_scoop_reg(SCOOP_DEV[skt->nr].dev, SCOOP_IMR, 0x00C0);
        write_scoop_reg(SCOOP_DEV[skt->nr].dev, SCOOP_MCR, 0x0101);
        SCOOP_DEV[skt->nr].keep_vs = NO_KEEP_VS;
-
-       if (machine_is_collie())
-               /* We need to disable SS_OUTPUT_ENA here. */
-               write_scoop_reg(SCOOP_DEV[skt->nr].dev, SCOOP_CPR, read_scoop_reg(SCOOP_DEV[skt->nr].dev, SCOOP_CPR) & ~0x0080);
 }
 
 static void sharpsl_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
 {
-       /* CF_BUS_OFF */
-       sharpsl_pcmcia_init_reset(&SCOOP_DEV[skt->nr]);
-
-       if (machine_is_collie())
-               /* We need to disable SS_OUTPUT_ENA here. */
-               write_scoop_reg(SCOOP_DEV[skt->nr].dev, SCOOP_CPR, read_scoop_reg(SCOOP_DEV[skt->nr].dev, SCOOP_CPR) & ~0x0080);
+       sharpsl_pcmcia_init_reset(skt);
 }
 
 static struct pcmcia_low_level sharpsl_pcmcia_ops = {