www.usr.com/support/gpl/USR9107_release.1.4.tar.gz
[bcm963xx.git] / kernel / linux / arch / mips / brcm-boards / bcm963xx / setup.c
index c304817..5eca144 100755 (executable)
@@ -168,50 +168,51 @@ static int cardtype_vcc_detect(void)
     int cardtype;
 
     cardtype = MPI_CARDTYPE_NONE;
-    mpi->pcmcia_cntl1 = 0x0000A000; // Turn on the output enables and drive
+    mpi->pcmcia_cntl1 = (CARDBUS_ENABLE|PCMCIA_GPIO_ENABLE); // Turn on the output enables and drive
                                         // the CVS pins to 0.
     data32 = mpi->pcmcia_cntl1;
-    switch (data32 & 0x00000003)  // Test CD1# and CD2#, see if card is plugged in.
+    switch (data32 & (CD2_IN|CD1_IN))  // Test CD1# and CD2#, see if card is plugged in.
     {
-    case 0x00000003:  // No Card is in the slot.
+    case (CD2_IN|CD1_IN):  // No Card is in the slot.
         printk("mpi: No Card is in the PCMCIA slot\n");
         break;
 
-    case 0x00000002:  // Partial insertion, No CD2#.
+    case CD2_IN:  // Partial insertion, No CD2#.
         printk("mpi: Card in the PCMCIA slot partial insertion, no CD2 signal\n");
         break;
 
-    case 0x00000001:  // Partial insertion, No CD1#.
+    case CD1_IN:  // Partial insertion, No CD1#.
         printk("mpi: Card in the PCMCIA slot partial insertion, no CD1 signal\n");
         break;
 
     case 0x00000000:
-        mpi->pcmcia_cntl1 = 0x0000A0C0; // Turn off the CVS output enables and
+        mpi->pcmcia_cntl1 = (CARDBUS_ENABLE|PCMCIA_GPIO_ENABLE|VS2_OEN|VS1_OEN); 
+                                        // Turn off the CVS output enables and
                                         // float the CVS pins.
         mdelay(1);
         data32 = mpi->pcmcia_cntl1;
         // Read the Register.
-        switch (data32 & 0x0000000C)  // See what is on the CVS pins.
+        switch (data32 & (VS2_IN|VS1_IN))  // See what is on the CVS pins.
         {
         case 0x00000000: // CVS1 and CVS2 are tied to ground, only 1 option.
             printk("mpi: Detected 3.3 & x.x 16-bit PCMCIA card\n");
             cardtype = MPI_CARDTYPE_PCMCIA;
             break;
           
-        case 0x00000004: // CVS1 is open or tied to CCD1/CCD2 and CVS2 is tied to ground.
+        case VS1_IN: // CVS1 is open or tied to CCD1/CCD2 and CVS2 is tied to ground.
                          // 2 valid voltage options.
-        switch (data32 & 0x00000003)  // Test the values of CCD1 and CCD2.
+        switch (data32 & (CD2_IN|CD1_IN))  // Test the values of CCD1 and CCD2.
         {
-            case 0x00000003:  // CCD1 and CCD2 are tied to 1 of the CVS pins.
+            case (CD2_IN|CD1_IN):  // CCD1 and CCD2 are tied to 1 of the CVS pins.
                               // This is not a valid combination.
                 printk("mpi: Unknown card plugged into slot\n"); 
                 break;
       
-            case 0x00000002:  // CCD2 is tied to either CVS1 or CVS2. 
-                mpi->pcmcia_cntl1 = 0x0000A080; // Drive CVS1 to a 0.
+            case CD2_IN:  // CCD2 is tied to either CVS1 or CVS2. 
+                mpi->pcmcia_cntl1 = (CARDBUS_ENABLE|PCMCIA_GPIO_ENABLE|VS2_OEN); // Drive CVS1 to a 0.
                 mdelay(1);
                 data32 = mpi->pcmcia_cntl1;
-                if (data32 & 0x00000002) { // CCD2 is tied to CVS2, not valid.
+                if (data32 & CD2_IN) { // CCD2 is tied to CVS2, not valid.
                     printk("mpi: Unknown card plugged into slot\n"); 
                 } else {                   // CCD2 is tied to CVS1.
                     printk("mpi: Detected 3.3, x.x and y.y Cardbus card\n");
@@ -219,7 +220,7 @@ static int cardtype_vcc_detect(void)
                 }
                 break;
                 
-            case 0x00000001: // CCD1 is tied to either CVS1 or CVS2.
+            case CD1_IN: // CCD1 is tied to either CVS1 or CVS2.
                              // This is not a valid combination.
                 printk("mpi: Unknown card plugged into slot\n"); 
                 break;
@@ -231,20 +232,20 @@ static int cardtype_vcc_detect(void)
             }
             break;
           
-        case 0x00000008: // CVS2 is open or tied to CCD1/CCD2 and CVS1 is tied to ground.
+        case VS2_IN: // CVS2 is open or tied to CCD1/CCD2 and CVS1 is tied to ground.
                          // 2 valid voltage options.
-            switch (data32 & 0x00000003)  // Test the values of CCD1 and CCD2.
+            switch (data32 & (CD2_IN|CD1_IN))  // Test the values of CCD1 and CCD2.
             {
-            case 0x00000003:  // CCD1 and CCD2 are tied to 1 of the CVS pins.
+            case (CD2_IN|CD1_IN):  // CCD1 and CCD2 are tied to 1 of the CVS pins.
                               // This is not a valid combination.
                 printk("mpi: Unknown card plugged into slot\n"); 
                 break;
       
-            case 0x00000002:  // CCD2 is tied to either CVS1 or CVS2.
-                mpi->pcmcia_cntl1 = 0x0000A040; // Drive CVS2 to a 0.
+            case CD2_IN:  // CCD2 is tied to either CVS1 or CVS2.
+                mpi->pcmcia_cntl1 = (CARDBUS_ENABLE|PCMCIA_GPIO_ENABLE|VS1_OEN);// Drive CVS2 to a 0.
                 mdelay(1);
                 data32 = mpi->pcmcia_cntl1;
-                if (data32 & 0x00000002) { // CCD2 is tied to CVS1, not valid.
+                if (data32 & CD2_IN) { // CCD2 is tied to CVS1, not valid.
                     printk("mpi: Unknown card plugged into slot\n"); 
                 } else {// CCD2 is tied to CVS2.
                     printk("mpi: Detected 3.3 and x.x Cardbus card\n");
@@ -252,7 +253,7 @@ static int cardtype_vcc_detect(void)
                 }
                 break;
 
-            case 0x00000001: // CCD1 is tied to either CVS1 or CVS2.
+            case CD1_IN: // CCD1 is tied to either CVS1 or CVS2.
                              // This is not a valid combination.
                 printk("mpi: Unknown card plugged into slot\n"); 
                 break;
@@ -264,22 +265,22 @@ static int cardtype_vcc_detect(void)
             }
             break;
           
-        case 0x0000000C:  // CVS1 and CVS2 are open or tied to CCD1/CCD2.
+        case (VS2_IN|VS1_IN):  // CVS1 and CVS2 are open or tied to CCD1/CCD2.
                           // 5 valid voltage options.
       
-            switch (data32 & 0x00000003)  // Test the values of CCD1 and CCD2.
+            switch (data32 & (CD2_IN|CD1_IN))  // Test the values of CCD1 and CCD2.
             {
-            case 0x00000003:  // CCD1 and CCD2 are tied to 1 of the CVS pins.
+            case (CD2_IN|CD1_IN):  // CCD1 and CCD2 are tied to 1 of the CVS pins.
                               // This is not a valid combination.
                 printk("mpi: Unknown card plugged into slot\n"); 
                 break;
       
-            case 0x00000002:  // CCD2 is tied to either CVS1 or CVS2.
+            case CD2_IN:  // CCD2 is tied to either CVS1 or CVS2.
                               // CCD1 is tied to ground.
-                mpi->pcmcia_cntl1 = 0x0000A040; // Drive CVS2 to a 0.
+                mpi->pcmcia_cntl1 = (CARDBUS_ENABLE|PCMCIA_GPIO_ENABLE|VS1_OEN);// Drive CVS2 to a 0.
                 mdelay(1);
                 data32 = mpi->pcmcia_cntl1;
-                if (data32 & 0x00000002) {  // CCD2 is tied to CVS1.
+                if (data32 & CD2_IN) {  // CCD2 is tied to CVS1.
                     printk("mpi: Detected y.y vdc Cardbus card\n");
                 } else {                    // CCD2 is tied to CVS2.
                     printk("mpi: Detected x.x vdc Cardbus card\n");
@@ -287,13 +288,13 @@ static int cardtype_vcc_detect(void)
                 cardtype = MPI_CARDTYPE_CARDBUS;
                 break;
       
-            case 0x00000001: // CCD1 is tied to either CVS1 or CVS2.
+            case CD1_IN: // CCD1 is tied to either CVS1 or CVS2.
                              // CCD2 is tied to ground.
       
-                mpi->pcmcia_cntl1 = 0x0000A040; // Drive CVS2 to a 0.
+                mpi->pcmcia_cntl1 = (CARDBUS_ENABLE|PCMCIA_GPIO_ENABLE|VS1_OEN);// Drive CVS2 to a 0.
                 mdelay(1);
                 data32 = mpi->pcmcia_cntl1;
-                if (data32 & 0x00000001) {// CCD1 is tied to CVS1.
+                if (data32 & CD1_IN) {// CCD1 is tied to CVS1.
                     printk("mpi: Detected 3.3 vdc Cardbus card\n");
                 } else {                    // CCD1 is tied to CVS2.
                     printk("mpi: Detected x.x and y.y Cardbus card\n");
@@ -331,8 +332,7 @@ static int mpi_DetectPcCard(void)
     cardtype = cardtype_vcc_detect();
     switch(cardtype) {
         case MPI_CARDTYPE_PCMCIA:
-            mpi->pcmcia_cntl1 &= ~0x0000e000; // disable enable bits
-            //mpi->pcmcia_cntl1 = (mpi->pcmcia_cntl1 & ~PCCARD_CARD_RESET);
+            mpi->pcmcia_cntl1 &= ~(CARDBUS_ENABLE|PCMCIA_ENABLE|PCMCIA_GPIO_ENABLE); // disable enable bits
             mpi->pcmcia_cntl1 |= (PCMCIA_ENABLE | PCMCIA_GPIO_ENABLE);
             mpi_InitPcmciaSpace();
             mpi_ResetPcCard(cardtype, FALSE);
@@ -418,12 +418,12 @@ static int mpi_init(void)
     mpi_SetLocalPciConfigReg(PCI_BASE_ADDRESS_3, BCM_HOST_MEM_SPACE1);
     mpi->sp0remap = 0x0;
 
-    /* Accesses to the SDRAM from PCI bus will not be "byte swapped" for this region */
+    /* Accesses to the SDRAM from PCI bus will be "byte swapped" for this region */
     mpi_SetLocalPciConfigReg(PCI_BASE_ADDRESS_4, BCM_HOST_MEM_SPACE2);
     mpi->sp1remap = 0x0;
-    mpi->pcimodesel |= (PCI_BAR2_NOSWAP | 0x40);
+    mpi->pcimodesel |= 0x40;
 
-    if ((chipid == 0x6348) && (chiprev == 0xb0)) {
+    if ((chipid == 0x6348) && ((chiprev & 0xF0) != 0xa0)) {
         mpi->sp0range = ~(sdramsize-1);
         mpi->sp1range = ~(sdramsize-1);
     }
@@ -465,7 +465,7 @@ static int __init brcm63xx_setup(void)
 
     board_timer_setup = brcm_timer_setup;
 
-    panic_timeout = 180;
+    panic_timeout = 1;
 
 #if defined(CONFIG_BCM96348) && defined(CONFIG_PCI)
     /* mpi initialization */