tizen 2.3.1 release
[platform/kernel/u-boot.git] / board / manroland / uc100 / pcmcia.c
index db3821a..ad25678 100644 (file)
@@ -27,8 +27,8 @@ static void cfg_ports (void)
        immap = (immap_t *)CONFIG_SYS_IMMR;
 
        /*
-        * Configure Port A for MAX1602 PC-Card Power-Interface Switch
-        */
+       * Configure Port A for MAX1602 PC-Card Power-Interface Switch
+       */
        immap->im_ioport.iop_padat &= ~0x8000;  /* set port x output to low */
        immap->im_ioport.iop_padir |= 0x8000;   /* enable port x as output */
 
@@ -40,6 +40,7 @@ static void cfg_ports (void)
 int pcmcia_hardware_enable(int slot)
 {
        volatile immap_t        *immap;
+       volatile cpm8xx_t       *cp;
        volatile pcmconf8xx_t   *pcmp;
        volatile sysconf8xx_t   *sysp;
        uint reg, mask;
@@ -51,14 +52,15 @@ int pcmcia_hardware_enable(int slot)
        immap = (immap_t *)CONFIG_SYS_IMMR;
        sysp  = (sysconf8xx_t *)(&(((immap_t *)CONFIG_SYS_IMMR)->im_siu_conf));
        pcmp  = (pcmconf8xx_t *)(&(((immap_t *)CONFIG_SYS_IMMR)->im_pcmcia));
+       cp    = (cpm8xx_t *)(&(((immap_t *)CONFIG_SYS_IMMR)->im_cpm));
 
        /* Configure Ports for TPS2211A PC-Card Power-Interface Switch */
        cfg_ports ();
 
        /*
-        * Configure SIUMCR to enable PCMCIA port B
-        * (VFLS[0:1] are not used for debugging, we connect FRZ# instead)
-        */
+       * Configure SIUMCR to enable PCMCIA port B
+       * (VFLS[0:1] are not used for debugging, we connect FRZ# instead)
+       */
        sysp->sc_siumcr &= ~SIUMCR_DBGC11;      /* set DBGC to 00 */
 
        /* clear interrupt state, and disable interrupts */
@@ -66,9 +68,9 @@ int pcmcia_hardware_enable(int slot)
        pcmp->pcmc_per &= ~PCMCIA_MASK(_slot_);
 
        /*
-        * Disable interrupts, DMA, and PCMCIA buffers
-        * (isolate the interface) and assert RESET signal
-        */
+       * Disable interrupts, DMA, and PCMCIA buffers
+       * (isolate the interface) and assert RESET signal
+       */
        debug ("Disable PCMCIA buffers and assert RESET\n");
        reg  = 0;
        reg |= __MY_PCMCIA_GCRX_CXRESET;        /* active high */
@@ -76,8 +78,8 @@ int pcmcia_hardware_enable(int slot)
        udelay(500);
 
        /*
-        * Make sure there is a card in the slot, then configure the interface.
-        */
+       * Make sure there is a card in the slot, then configure the interface.
+       */
        udelay(10000);
        debug ("[%d] %s: PIPR(%p)=0x%x\n",
               __LINE__,__FUNCTION__,
@@ -88,19 +90,19 @@ int pcmcia_hardware_enable(int slot)
        }
 
        /*
-        * Power On.
-        */
+       * Power On.
+       */
        mask = PCMCIA_VS1(slot) | PCMCIA_VS2(slot);
        reg  = pcmp->pcmc_pipr;
        debug ("PIPR: 0x%x ==> VS1=o%s, VS2=o%s\n",
               reg,
               (reg&PCMCIA_VS1(slot))?"n":"ff",
               (reg&PCMCIA_VS2(slot))?"n":"ff");
-
-       if ((reg & mask) == mask)
+       if ((reg & mask) == mask) {
                puts (" 5.0V card found: ");
-       else
+       } else {
                puts (" 3.3V card found: ");
+       }
 
        /*  switch VCC on */
        immap->im_ioport.iop_padat |= 0x8000; /* power enable 3.3V */
@@ -152,6 +154,8 @@ int pcmcia_hardware_disable(int slot)
 
 int pcmcia_voltage_set(int slot, int vcc, int vpp)
 {
+       volatile immap_t        *immap;
+       volatile pcmconf8xx_t   *pcmp;
        u_long reg;
 
        debug ("voltage_set: "
@@ -159,10 +163,12 @@ int pcmcia_voltage_set(int slot, int vcc, int vpp)
                        " Slot %c, Vcc=%d.%d, Vpp=%d.%d\n",
        'A'+slot, vcc/10, vcc%10, vpp/10, vcc%10);
 
+       immap = (immap_t *)CONFIG_SYS_IMMR;
+       pcmp  = (pcmconf8xx_t *)(&(((immap_t *)CONFIG_SYS_IMMR)->im_pcmcia));
        /*
-        * Disable PCMCIA buffers (isolate the interface)
-        * and assert RESET signal
-        */
+       * Disable PCMCIA buffers (isolate the interface)
+       * and assert RESET signal
+       */
        debug ("Disable PCMCIA buffers and assert RESET\n");
        reg  = PCMCIA_PGCRX(_slot_);
        reg |= __MY_PCMCIA_GCRX_CXRESET;        /* active high */
@@ -170,10 +176,10 @@ int pcmcia_voltage_set(int slot, int vcc, int vpp)
        udelay(500);
 
        /*
-        * Configure Port C pins for
-        * 5 Volts Enable and 3 Volts enable,
-        * Turn all power pins to Hi-Z
-        */
+       * Configure Port C pins for
+       * 5 Volts Enable and 3 Volts enable,
+       * Turn all power pins to Hi-Z
+       */
        debug ("PCMCIA power OFF\n");
        cfg_ports ();   /* Enables switch, but all in Hi-Z */