瀏覽代碼

ARM: k2g: add SD card and eMMC support

Add MMC support for k2g

Signed-off-by: Roger Quadros <rogerq@ti.com>
Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
Tested-by: Mugunthan V N <mugunthanvnm@ti.com>
Roger Quadros 9 年之前
父節點
當前提交
3b68939fa0
共有 3 個文件被更改,包括 43 次插入2 次删除
  1. 22 0
      arch/arm/mach-keystone/include/mach/mmc_host_def.h
  2. 16 0
      board/ti/ks2_evm/board_k2g.c
  3. 5 2
      drivers/mmc/omap_hsmmc.c

+ 22 - 0
arch/arm/mach-keystone/include/mach/mmc_host_def.h

@@ -0,0 +1,22 @@
+/*
+ * K2G: MMC
+ *
+ * (C) Copyright 2015
+ *     Texas Instruments Incorporated, <www.ti.com>
+ *
+ * SPDX-License-Identifier:     GPL-2.0+
+ */
+
+#ifndef K2G_MMC_HOST_DEF_H
+#define K2G_MMC_HOST_DEF_H
+
+#include <asm/omap_mmc.h>
+
+/*
+ * OMAP HSMMC register definitions
+ */
+
+#define OMAP_HSMMC1_BASE	0x23000100
+#define OMAP_HSMMC2_BASE	0x23100100
+
+#endif /* K2G_MMC_HOST_DEF_H */

+ 16 - 0
board/ti/ks2_evm/board_k2g.c

@@ -9,6 +9,8 @@
 #include <common.h>
 #include <common.h>
 #include <asm/arch/clock.h>
 #include <asm/arch/clock.h>
 #include <asm/ti-common/keystone_net.h>
 #include <asm/ti-common/keystone_net.h>
+#include <asm/arch/psc_defs.h>
+#include <asm/arch/mmc_host_def.h>
 #include "mux-k2g.h"
 #include "mux-k2g.h"
 
 
 #define SYS_CLK		24000000
 #define SYS_CLK		24000000
@@ -58,6 +60,20 @@ s16 divn_val[16] = {
 	-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
 	-1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1
 };
 };
 
 
+#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_GENERIC_MMC)
+int board_mmc_init(bd_t *bis)
+{
+	if (psc_enable_module(KS2_LPSC_MMC)) {
+		printf("%s module enabled failed\n", __func__);
+		return -1;
+	}
+
+	omap_mmc_init(0, 0, 0, -1, -1);
+	omap_mmc_init(1, 0, 0, -1, -1);
+	return 0;
+}
+#endif
+
 #ifdef CONFIG_BOARD_EARLY_INIT_F
 #ifdef CONFIG_BOARD_EARLY_INIT_F
 int board_early_init_f(void)
 int board_early_init_f(void)
 {
 {

+ 5 - 2
drivers/mmc/omap_hsmmc.c

@@ -31,10 +31,12 @@
 #include <twl4030.h>
 #include <twl4030.h>
 #include <twl6030.h>
 #include <twl6030.h>
 #include <palmas.h>
 #include <palmas.h>
-#include <asm/gpio.h>
 #include <asm/io.h>
 #include <asm/io.h>
 #include <asm/arch/mmc_host_def.h>
 #include <asm/arch/mmc_host_def.h>
+#if !defined(CONFIG_SOC_KEYSTONE)
+#include <asm/gpio.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/sys_proto.h>
+#endif
 
 
 /* simplify defines to OMAP_HSMMC_USE_GPIO */
 /* simplify defines to OMAP_HSMMC_USE_GPIO */
 #if (defined(CONFIG_OMAP_GPIO) && !defined(CONFIG_SPL_BUILD)) || \
 #if (defined(CONFIG_OMAP_GPIO) && !defined(CONFIG_SPL_BUILD)) || \
@@ -662,7 +664,8 @@ int omap_mmc_init(int dev_index, uint host_caps_mask, uint f_max, int cd_gpio,
 		priv_data->base_addr = (struct hsmmc *)OMAP_HSMMC2_BASE;
 		priv_data->base_addr = (struct hsmmc *)OMAP_HSMMC2_BASE;
 #if (defined(CONFIG_OMAP44XX) || defined(CONFIG_OMAP54XX) || \
 #if (defined(CONFIG_OMAP44XX) || defined(CONFIG_OMAP54XX) || \
 	defined(CONFIG_DRA7XX) || defined(CONFIG_AM57XX) || \
 	defined(CONFIG_DRA7XX) || defined(CONFIG_AM57XX) || \
-	defined(CONFIG_AM43XX)) && defined(CONFIG_HSMMC2_8BIT)
+	defined(CONFIG_AM43XX) || defined(CONFIG_SOC_KEYSTONE)) && \
+		defined(CONFIG_HSMMC2_8BIT)
 		/* Enable 8-bit interface for eMMC on OMAP4/5 or DRA7XX */
 		/* Enable 8-bit interface for eMMC on OMAP4/5 or DRA7XX */
 		host_caps_val |= MMC_MODE_8BIT;
 		host_caps_val |= MMC_MODE_8BIT;
 #endif
 #endif