ARM: imx: dh-imx6: Convert SD/MMC support to DM
Enable DM block and DM MMC support on DHCOM iMX6 PDK2. Convert board code to match the DM support. Signed-off-by: Marek Vasut <marex@denx.de> Cc: Fabio Estevam <fabio.estevam@nxp.com> Cc: Ludwig Zenz <lzenz@dh-electronics.com> Cc: Stefano Babic <sbabic@denx.de>
This commit is contained in:
		
							parent
							
								
									3a05eb8fee
								
							
						
					
					
						commit
						198fee844b
					
				|  | @ -6,6 +6,8 @@ | ||||||
|  */ |  */ | ||||||
| 
 | 
 | ||||||
| #include <common.h> | #include <common.h> | ||||||
|  | #include <dm.h> | ||||||
|  | #include <dm/device-internal.h> | ||||||
| #include <asm/arch/clock.h> | #include <asm/arch/clock.h> | ||||||
| #include <asm/arch/crm_regs.h> | #include <asm/arch/crm_regs.h> | ||||||
| #include <asm/arch/imx-regs.h> | #include <asm/arch/imx-regs.h> | ||||||
|  | @ -189,63 +191,6 @@ int board_eth_init(bd_t *bis) | ||||||
| } | } | ||||||
| #endif | #endif | ||||||
| 
 | 
 | ||||||
| #ifdef CONFIG_FSL_ESDHC |  | ||||||
| 
 |  | ||||||
| #define USDHC2_CD_GPIO	IMX_GPIO_NR(6, 16) |  | ||||||
| #define USDHC3_CD_GPIO	IMX_GPIO_NR(7, 8) |  | ||||||
| 
 |  | ||||||
| static struct fsl_esdhc_cfg usdhc_cfg[3] = { |  | ||||||
| 	{ USDHC2_BASE_ADDR }, |  | ||||||
| 	{ USDHC3_BASE_ADDR }, |  | ||||||
| 	{ USDHC4_BASE_ADDR }, |  | ||||||
| }; |  | ||||||
| 
 |  | ||||||
| int board_mmc_getcd(struct mmc *mmc) |  | ||||||
| { |  | ||||||
| 	struct fsl_esdhc_cfg *cfg = (struct fsl_esdhc_cfg *)mmc->priv; |  | ||||||
| 
 |  | ||||||
| 	switch (cfg->esdhc_base) { |  | ||||||
| 	case USDHC2_BASE_ADDR: |  | ||||||
| 		return gpio_get_value(USDHC2_CD_GPIO); |  | ||||||
| 	case USDHC3_BASE_ADDR: |  | ||||||
| 		return !gpio_get_value(USDHC3_CD_GPIO); |  | ||||||
| 	case USDHC4_BASE_ADDR: |  | ||||||
| 		return 1; /* eMMC/uSDHC4 is always present */ |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	return 0; |  | ||||||
| } |  | ||||||
| 
 |  | ||||||
| int board_mmc_init(bd_t *bis) |  | ||||||
| { |  | ||||||
| 	int i, ret; |  | ||||||
| 
 |  | ||||||
| 	/*
 |  | ||||||
| 	 * According to the board_mmc_init() the following map is done: |  | ||||||
| 	 * (U-Boot device node)    (Physical Port) |  | ||||||
| 	 * mmc0                    SD interface |  | ||||||
| 	 * mmc1                    micro SD |  | ||||||
| 	 * mmc2                    eMMC |  | ||||||
| 	 */ |  | ||||||
| 	gpio_request(USDHC2_CD_GPIO, "SD2-CD"); |  | ||||||
| 	gpio_request(USDHC3_CD_GPIO, "SD3-CD"); |  | ||||||
| 	gpio_direction_input(USDHC2_CD_GPIO); |  | ||||||
| 	gpio_direction_input(USDHC3_CD_GPIO); |  | ||||||
| 
 |  | ||||||
| 	usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK); |  | ||||||
| 	usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK); |  | ||||||
| 	usdhc_cfg[2].sdhc_clk = mxc_get_clock(MXC_ESDHC4_CLK); |  | ||||||
| 
 |  | ||||||
| 	for (i = 0; i < CONFIG_SYS_FSL_USDHC_NUM; i++) { |  | ||||||
| 		ret = fsl_esdhc_initialize(bis, &usdhc_cfg[i]); |  | ||||||
| 		if (ret) |  | ||||||
| 			return ret; |  | ||||||
| 	} |  | ||||||
| 
 |  | ||||||
| 	return 0; |  | ||||||
| } |  | ||||||
| #endif |  | ||||||
| 
 |  | ||||||
| #ifdef CONFIG_USB_EHCI_MX6 | #ifdef CONFIG_USB_EHCI_MX6 | ||||||
| static void setup_usb(void) | static void setup_usb(void) | ||||||
| { | { | ||||||
|  |  | ||||||
|  | @ -11,6 +11,7 @@ CONFIG_NR_DRAM_BANKS=1 | ||||||
| CONFIG_SPL=y | CONFIG_SPL=y | ||||||
| CONFIG_SYS_BOOTCOUNT_ADDR=0x00900000 | CONFIG_SYS_BOOTCOUNT_ADDR=0x00900000 | ||||||
| CONFIG_DM_GPIO=y | CONFIG_DM_GPIO=y | ||||||
|  | CONFIG_DM_MMC=y | ||||||
| CONFIG_SPL_SPI_FLASH_SUPPORT=y | CONFIG_SPL_SPI_FLASH_SUPPORT=y | ||||||
| CONFIG_SPL_SPI_SUPPORT=y | CONFIG_SPL_SPI_SUPPORT=y | ||||||
| CONFIG_DISTRO_DEFAULTS=y | CONFIG_DISTRO_DEFAULTS=y | ||||||
|  |  | ||||||
		Loading…
	
		Reference in New Issue