]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
board: tx48: add MMC init code
authorLothar Waßmann <LW@KARO-electronics.de>
Thu, 26 Jun 2014 10:13:20 +0000 (12:13 +0200)
committerLothar Waßmann <LW@KARO-electronics.de>
Thu, 26 Jun 2014 10:21:31 +0000 (12:21 +0200)
Up to now we relied on cpu_mmc_init() to initialize the MMC unit for
us. This had some major drawbacks:
- the default implementation doesn't use CD gpios, so that the driver
  always assumes a card is present.
- the default implementation always initializes two MMC interfaces,
  though the TX48 supports only one.

Properly initialize the CD GPIO and implement our own version of
cpu_mmc_init().

board/karo/tx48/tx48.c

index 7c39056324bfd949bfe7180e2181192444836ee4..48cb0c83da837031681307d1882482133570609b 100644 (file)
@@ -47,6 +47,7 @@ DECLARE_GLOBAL_DATA_PTR;
 #define TX48_LCD_RST_GPIO      AM33XX_GPIO_NR(1, 19)
 #define TX48_LCD_PWR_GPIO      AM33XX_GPIO_NR(1, 22)
 #define TX48_LCD_BACKLIGHT_GPIO        AM33XX_GPIO_NR(3, 14)
+#define TX48_MMC_CD_GPIO       AM33XX_GPIO_NR(3, 15)
 
 #define GMII_SEL               (CTRL_BASE + 0x650)
 
@@ -333,10 +334,13 @@ static const struct pin_mux stk5_pads[] = {
        { OFFSET(gpmc_a6), MODE(7) | PULLUDEN, },
        /* LCD Backlight (PWM) */
        { OFFSET(mcasp0_aclkx), MODE(7) | PULLUDEN, },
+       /* MMC CD */
+       { OFFSET(mcasp0_fsx), MODE(7) | PULLUDEN | PULLUP_EN, },
 };
 
 static const struct gpio stk5_gpios[] = {
-       { AM33XX_GPIO_NR(1, 26), GPIOF_OUTPUT_INIT_LOW, "HEARTBEAT LED", },
+       { TX48_LED_GPIO, GPIOF_OUTPUT_INIT_LOW, "HEARTBEAT LED", },
+       { TX48_MMC_CD_GPIO, GPIOF_INPUT, "HEARTBEAT LED", },
 };
 
 static const struct pin_mux stk5_lcd_pads[] = {
@@ -1015,6 +1019,13 @@ int board_eth_init(bd_t *bis)
 }
 #endif /* CONFIG_DRIVER_TI_CPSW */
 
+#if defined(CONFIG_OMAP_HSMMC) && !defined(CONFIG_SPL_BUILD)
+int cpu_mmc_init(bd_t *bis)
+{
+       return omap_mmc_init(1, 0, 0, TX48_MMC_CD_GPIO, -1);
+}
+#endif
+
 void tx48_disable_watchdog(void)
 {
        struct wd_timer *wdtimer = (struct wd_timer *)WDT_BASE;