]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
ARMV7: OMAP: Overo: Autodetect presence/absence of transceiver on mmc2
authorSteve Sakoman <steve@sakoman.com>
Tue, 24 Aug 2010 17:37:29 +0000 (10:37 -0700)
committerSandeep Paulraj <s-paulraj@ti.com>
Wed, 8 Sep 2010 18:51:45 +0000 (14:51 -0400)
An upcoming version of Overo uses a Wifi/BT module with 1.8V signaling,
eliminating the need for an external transceiver to handle the level
shifting.  This patch detects whether an external transceiver is present
and adjusts the pinmux settings as appropriate.

Signed-off-by: Steve Sakoman <steve@sakoman.com>
Signed-off-by: Sandeep Paulraj <s-paulraj@ti.com>
board/overo/overo.c
board/overo/overo.h

index 4a6091720119be076bac6572ae4484489704c160..1b67f1f5024293749c52926ee47498a5ac1a093d 100644 (file)
@@ -102,6 +102,39 @@ int get_board_revision(void)
        return revision;
 }
 
+/*
+ * Routine: get_sdio2_config
+ * Description: Return information about the wifi module connection
+ *              Returns 0 if the module connects though a level translator
+ *              Returns 1 if the module connects directly
+ */
+int get_sdio2_config(void)
+{
+       int sdio_direct;
+
+       if (!omap_request_gpio(130) && !omap_request_gpio(139)) {
+
+               omap_set_gpio_direction(130, 0);
+               omap_set_gpio_direction(139, 1);
+
+               sdio_direct = 1;
+               omap_set_gpio_dataout(130, 0);
+               if (omap_get_gpio_datain(139) == 0) {
+                       omap_set_gpio_dataout(130, 1);
+                       if (omap_get_gpio_datain(139) == 1)
+                               sdio_direct = 0;
+               }
+
+               omap_free_gpio(130);
+               omap_free_gpio(139);
+       } else {
+               printf("Error: unable to acquire sdio2 clk GPIOs\n");
+               sdio_direct = -1;
+       }
+
+       return sdio_direct;
+}
+
 /*
  * Routine: misc_init_r
  * Description: Configure board specific parts
@@ -116,6 +149,20 @@ int misc_init_r(void)
 #endif
 
        printf("Board revision: %d\n", get_board_revision());
+
+       switch (get_sdio2_config()) {
+       case 0:
+               printf("Tranceiver detected on mmc2\n");
+               MUX_OVERO_SDIO2_TRANSCEIVER();
+               break;
+       case 1:
+               printf("Direct connection on mmc2\n");
+               MUX_OVERO_SDIO2_DIRECT();
+               break;
+       default:
+               printf("Unable to detect mmc2 connection type\n");
+       }
+
        dieid_num_r();
 
        return 0;
index 2744ffee6986861dedd472b5adc7c083d1036787..33a92e4e126849abbfeed4e8197cacc6b40e6440 100644 (file)
@@ -211,7 +211,7 @@ const omap3_sysinfo sysinfo = {
        MUX_VAL(CP(MMC1_DAT6),          (IEN  | PTU | EN  | M0)) /*MMC1_DAT6*/\
        MUX_VAL(CP(MMC1_DAT7),          (IEN  | PTU | EN  | M0)) /*MMC1_DAT7*/\
  /*Wireless LAN */\
-       MUX_VAL(CP(MMC2_CLK),           (IEN  | PTU | EN  | M0)) /*MMC2_CLK*/\
+       MUX_VAL(CP(MMC2_CLK),           (IEN  | PTU | EN  | M4)) /*GPIO_130*/\
        MUX_VAL(CP(MMC2_CMD),           (IEN  | PTU | EN  | M0)) /*MMC2_CMD*/\
        MUX_VAL(CP(MMC2_DAT0),          (IEN  | PTU | EN  | M0)) /*MMC2_DAT0*/\
        MUX_VAL(CP(MMC2_DAT1),          (IEN  | PTU | EN  | M0)) /*MMC2_DAT1*/\
@@ -220,7 +220,7 @@ const omap3_sysinfo sysinfo = {
        MUX_VAL(CP(MMC2_DAT4),          (IEN  | PTU | EN  | M1)) /*MMC2_DIR_DAT0*/\
        MUX_VAL(CP(MMC2_DAT5),          (IEN  | PTU | EN  | M1)) /*MMC2_DIR_DAT1*/\
        MUX_VAL(CP(MMC2_DAT6),          (IEN  | PTU | EN  | M1)) /*MMC2_DIR_CMD*/\
-       MUX_VAL(CP(MMC2_DAT7),          (IEN  | PTU | EN  | M1)) /*MMC2_CLKIN*/\
+       MUX_VAL(CP(MMC2_DAT7),          (IEN  | PTU | EN  | M4)) /*GPIO_139*/\
  /*Bluetooth*/\
        MUX_VAL(CP(MCBSP3_DX),          (IEN  | PTD | DIS | M1)) /*UART2_CTS*/\
        MUX_VAL(CP(MCBSP3_DR),          (IDIS | PTD | DIS | M1)) /*UART2_RTS*/\
@@ -387,5 +387,36 @@ const omap3_sysinfo sysinfo = {
        MUX_VAL(CP(SDRC_CKE0),          (IDIS | PTU | EN  | M0)) /*sdrc_cke0*/\
        MUX_VAL(CP(SDRC_CKE1),          (IDIS | PTU | EN  | M0)) /*sdrc_cke1*/
 
+#define MUX_OVERO_SDIO2_DIRECT() \
+       MUX_VAL(CP(MMC2_CLK),           (IEN  | PTU | EN  | M0)) /*MMC2_CLK*/\
+       MUX_VAL(CP(MMC2_CMD),           (IEN  | PTU | EN  | M0)) /*MMC2_CMD*/\
+       MUX_VAL(CP(MMC2_DAT0),          (IEN  | PTU | EN  | M0)) /*MMC2_DAT0*/\
+       MUX_VAL(CP(MMC2_DAT1),          (IEN  | PTU | EN  | M0)) /*MMC2_DAT1*/\
+       MUX_VAL(CP(MMC2_DAT2),          (IEN  | PTU | EN  | M0)) /*MMC2_DAT2*/\
+       MUX_VAL(CP(MMC2_DAT3),          (IEN  | PTU | EN  | M0)) /*MMC2_DAT3*/\
+       MUX_VAL(CP(MMC2_DAT4),          (IEN  | PTU | EN  | M0)) /*MMC2_DAT4*/\
+       MUX_VAL(CP(MMC2_DAT5),          (IEN  | PTU | EN  | M0)) /*MMC2_DAT5*/\
+       MUX_VAL(CP(MMC2_DAT6),          (IEN  | PTU | EN  | M0)) /*MMC2_DAT6*/\
+       MUX_VAL(CP(MMC2_DAT7),          (IEN  | PTU | EN  | M0)) /*MMC2_DAT7*/\
+       MUX_VAL(CP(MMC1_DAT4),          (IEN  | PTD | EN  | M4)) /*GPIO_126*/\
+       MUX_VAL(CP(MMC1_DAT5),          (IEN  | PTU | EN  | M4)) /*GPIO_127*/\
+       MUX_VAL(CP(MMC1_DAT6),          (IEN  | PTU | EN  | M4)) /*GPIO_128*/\
+       MUX_VAL(CP(MMC1_DAT7),          (IEN  | PTU | EN  | M4)) /*GPIO_129*/
+
+#define MUX_OVERO_SDIO2_TRANSCEIVER() \
+       MUX_VAL(CP(MMC2_CLK),           (IEN  | PTU | EN  | M0)) /*MMC2_CLK*/\
+       MUX_VAL(CP(MMC2_CMD),           (IEN  | PTU | EN  | M0)) /*MMC2_CMD*/\
+       MUX_VAL(CP(MMC2_DAT0),          (IEN  | PTU | EN  | M0)) /*MMC2_DAT0*/\
+       MUX_VAL(CP(MMC2_DAT1),          (IEN  | PTU | EN  | M0)) /*MMC2_DAT1*/\
+       MUX_VAL(CP(MMC2_DAT2),          (IEN  | PTU | EN  | M0)) /*MMC2_DAT2*/\
+       MUX_VAL(CP(MMC2_DAT3),          (IEN  | PTU | EN  | M0)) /*MMC2_DAT3*/\
+       MUX_VAL(CP(MMC2_DAT4),          (IEN  | PTU | EN  | M1)) /*MMC2_DIR_DAT0*/\
+       MUX_VAL(CP(MMC2_DAT5),          (IEN  | PTU | EN  | M1)) /*MMC2_DIR_DAT1*/\
+       MUX_VAL(CP(MMC2_DAT6),          (IEN  | PTU | EN  | M1)) /*MMC2_DIR_CMD*/\
+       MUX_VAL(CP(MMC2_DAT7),          (IEN  | PTU | EN  | M1)) /*MMC2_CLKIN*/\
+       MUX_VAL(CP(MMC1_DAT4),          (IEN  | PTU | EN  | M4)) /*GPIO_126*/\
+       MUX_VAL(CP(MMC1_DAT5),          (IEN  | PTU | EN  | M4)) /*GPIO_127*/\
+       MUX_VAL(CP(MMC1_DAT6),          (IEN  | PTU | EN  | M4)) /*GPIO_128*/\
+       MUX_VAL(CP(MMC1_DAT7),          (IEN  | PTU | EN  | M4)) /*GPIO_129*/
 
 #endif