Tegra114: MMC: Add MMC driver for T114/Dalmore
Subsystems (2)
v2 cover Tegra114: MMC: Add MMC driver for T114/Dalmore
This patchset adds SDMMC device-tree support to the Tegra114 dts files, and enables the Tegra MMC driver on Tegra114 Dalmore.
Tested on my Dalmore E1611 board, eMMC and SD-Card work fine, can load a kernel off of a SD card OK, card detect works, and the env is now stored in eMMC (end of the 2nd 'boot' sector, same as Tegra20/30).
Changes in v2:
- Remove SDIOCFG_HSM define, unused
- Remove I2C retries
- Change CONFIG_ENV_OFFSET to match Dalmore's eMMC chip boot part size
Tom Warren (4):
Tegra114: fdt: Add SDMMC (sdhci) nodes for T114 boards (Dalmore for
now)
Tegra114: Dalmore: Add SDIO3 pad config to pinctrl_config table
Tegra114: MMC: Add SD bus power-rail init routine
Tegra114: MMC: Enable DT MMC driver support for Tegra114 Dalmore
boards
arch/arm/dts/tegra114.dtsi | 32 ++++++++++++ arch/arm/include/asm/arch-tegra114/gp_padctrl.h | 6 +++ board/nvidia/dalmore/dalmore.c | 67 +++++++++++++++++++++++++ board/nvidia/dalmore/pinmux-config-dalmore.h | 6 +++ board/nvidia/dts/tegra114-dalmore.dts | 13 +++++ include/configs/dalmore.h | 12 ++++- 6 files changed, 135 insertions(+), 1 deletion(-)
Signature · 1 line
1.8.1.5
PATCH v2 1/4 Tegra114: fdt: Add SDMMC (sdhci) nodes for T114 boards (Dalmore for now)
Took these values directly from the kernel dts files.
---
v2: No change
arch/arm/dts/tegra114.dtsi | 32 ++++++++++++++++++++++++++++++++ board/nvidia/dts/tegra114-dalmore.dts | 13 +++++++++++++ 2 files changed, 45 insertions(+)
arch/arm/dts/tegra114.dtsi +32 -0
@@ -184,4 +184,36 @@ /* PERIPH_ID_SBC6, PLLP_OUT0 */ clocks = <&tegra_car 105>; }; + + sdhci at 78000000 { + compatible = "nvidia,tegra114-sdhci", "nvidia,tegra30-sdhci"; + reg = <0x78000000 0x200>; + interrupts = <0 14 0x04>; + clocks = <&tegra_car 14>; + status = "disable"; + }; + + sdhci at 78000200 { + compatible = "nvidia,tegra114-sdhci", "nvidia,tegra30-sdhci"; + reg = <0x78000200 0x200>; + interrupts = <0 15 0x04>; + clocks = <&tegra_car 9>; + status = "disable"; + }; + + sdhci at 78000400 { + compatible = "nvidia,tegra114-sdhci", "nvidia,tegra30-sdhci"; + reg = <0x78000400 0x200>; + interrupts = <0 19 0x04>; + clocks = <&tegra_car 69>; + status = "disable"; + }; + + sdhci at 78000600 { + compatible = "nvidia,tegra114-sdhci", "nvidia,tegra30-sdhci"; + reg = <0x78000600 0x200>; + interrupts = <0 31 0x04>; + clocks = <&tegra_car 15>; + status = "disable"; + }; };
board/nvidia/dts/tegra114-dalmore.dts +13 -0
@@ -12,6 +12,8 @@ i2c2 = "/i2c at 7000c400"; i2c3 = "/i2c at 7000c500"; i2c4 = "/i2c at 7000c700"; + sdhci0 = "/sdhci at 78000600"; + sdhci1 = "/sdhci at 78000400"; }; memory {
@@ -48,4 +50,15 @@ status = "okay"; spi-max-frequency = <25000000>; }; + + sdhci at 78000400 { + cd-gpios = <&gpio 170 1>; /* gpio PV2 */ + bus-width = <4>; + status = "okay"; + }; + + sdhci at 78000600 { + bus-width = <8>; + status = "okay"; + }; };
Signature · 1 line
1.8.1.5
PATCH v2 2/4 Tegra114: Dalmore: Add SDIO3 pad config to pinctrl_config table
In reply to Tom WarrenSDIO1 (the SD-card slot on Dalmore) needs to have its pads setup before the MMC driver is added.
---
v2: Remove SDIOCFG_HSM define, unused.
arch/arm/include/asm/arch-tegra114/gp_padctrl.h | 6 ++++++ board/nvidia/dalmore/dalmore.c | 4 ++++ board/nvidia/dalmore/pinmux-config-dalmore.h | 6 ++++++ 3 files changed, 16 insertions(+)
arch/arm/include/asm/arch-tegra114/gp_padctrl.h +6 -0
@@ -74,4 +74,10 @@ struct apb_misc_gp_ctlr { u32 aocfg0; /* 0x1AC: APB_MISC_GP_AOCFG0PADCTRL */ }; +/* SDMMC1/3 settings from section 27.5 of T114 TRM */ +#define SDIOCFG_DRVUP_SLWF 0 +#define SDIOCFG_DRVDN_SLWR 0 +#define SDIOCFG_DRVUP 0x24 +#define SDIOCFG_DRVDN 0x14 +#endif /* _TEGRA114_GP_PADCTRL_H_ */
board/nvidia/dalmore/dalmore.c +4 -0
@@ -16,6 +16,7 @@#include <common.h> #include <asm/arch/pinmux.h> +#include <asm/arch/gp_padctrl.h> #include "pinmux-config-dalmore.h" /*
@@ -32,4 +33,7 @@ void pinmux_init(void)pinmux_config_table (unused_pins_lowpower,ARRAY_SIZE (unused_pins_lowpower)); + +/* Initialize any non-default pad configs (APB_MISC_GP regs) */ +padgrp_config_table (dalmore_padctrl,ARRAY_SIZE (dalmore_padctrl)); }
board/nvidia/dalmore/pinmux-config-dalmore.h +6 -0
@@ -361,4 +361,10 @@ static struct pingroup_config tegra114_pinmux_set_nontristate[] = { DEFAULT_PINMUX(SDMMC3_CD_N, SDMMC3, UP, NORMAL, INPUT), }; + +static struct padctrl_config dalmore_padctrl[] = { +/* (_padgrp, _slwf, _slwr, _drvup, _drvdn, _lpmd, _schmt, _hsm) */ +DEFAULT_PADCFG (SDIO3 ,SDIOCFG_DRVUP_SLWF ,SDIOCFG_DRVDN_SLWR , \ +SDIOCFG_DRVUP ,SDIOCFG_DRVDN ,NONE ,NONE ,NONE ), +};#endif /* PINMUX_CONFIG_COMMON_H */
Signature · 1 line
1.8.1.5
PATCH v2 3/4 Tegra114: MMC: Add SD bus power-rail init routine
In reply to Tom WarrenT114 requires SD bus power-rail bringup for the SDIO card on SDMMC3.
---
v2: Remove I2C retries
board/nvidia/dalmore/dalmore.c | 62 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 62 insertions(+)
board/nvidia/dalmore/dalmore.c +62 -0
@@ -18,6 +18,10 @@#include <asm/arch/pinmux.h> #include <asm/arch/gp_padctrl.h> #include "pinmux-config-dalmore.h" +#include <i2c.h> + +#define BAT_I2C_ADDRESS 0x48/* TPS65090 charger */ +#define PMU_I2C_ADDRESS 0x58/* TPS65913 PMU */ /* * Routine: pinmux_init
@@ -37,3 +41,61 @@ void pinmux_init(void)/* Initialize any non-default pad configs (APB_MISC_GP regs) */ padgrp_config_table (dalmore_padctrl,ARRAY_SIZE (dalmore_padctrl)); } + +#if defined(CONFIG_TEGRA_MMC ) +/* +* Do I2C/PMU writes to bring up SD card bus power +* +*/ +void board_sdmmc_voltage_init (void ) +{ +uchar reg, data_buffer[1 ]; +int ret; + + ret =i2c_set_bus_num (0 );/* PMU is on bus 0 */ +if (ret) +printf ("%s: i2c_set_bus_num returned %d\n" , __func__, ret); + +/* TPS65913: LDO9_VOLTAGE = 3.3V */ + data_buffer[0 ] =0x31 ; + reg =0x61 ; + + ret =i2c_write (PMU_I2C_ADDRESS , reg,1 , data_buffer,1 ); +if (ret) +printf ("%s: PMU i2c_write %02X<-%02X returned %d\n" , + __func__, reg, data_buffer[0 ], ret); + +/* TPS65913: LDO9_CTRL = Active */ + data_buffer[0 ] =0x01 ; + reg =0x60 ; + + ret =i2c_write (PMU_I2C_ADDRESS , reg,1 , data_buffer,1 ); +if (ret) +printf ("%s: PMU i2c_write %02X<-%02X returned %d\n" , + __func__, reg, data_buffer[0 ], ret); + +/* TPS65090: FET6_CTRL = enable output auto discharge, enable FET6 */ + data_buffer[0 ] =0x03 ; + reg =0x14 ; + + ret =i2c_write (BAT_I2C_ADDRESS , reg,1 , data_buffer,1 ); +if (ret) +printf ("%s: BAT i2c_write %02X<-%02X returned %d\n" , + __func__, reg, data_buffer[0 ], ret); +} + +/* +* Routine: pin_mux_mmc +* Description: setup the MMC muxes, power rails, etc. +*/ +void pin_mux_mmc (void ) +{ +/* +* NOTE: We don't do mmc-specific pin muxes here. +* They were done globally in pinmux_init(). +*/ + +/* Bring up the SDIO3 power rail */ +board_sdmmc_voltage_init (); +} +#endif /* MMC */
Signature · 1 line
1.8.1.5
PATCH v2 4/4 Tegra114: MMC: Enable DT MMC driver support for Tegra114 Dalmore boards
In reply to Tom WarrenTested on my Dalmore E1611 board, eMMC and SD-Card work fine, can load a kernel off of an SD card OK, card detect works, and the env is now stored in eMMC (end of the 2nd 'boot' sector, same as Tegra20/30).
---
v2: Change CONFIG_ENV_OFFSET to match the size of Dalmore's eMMC chip
include/configs/dalmore.h | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
include/configs/dalmore.h +11 -1
@@ -50,7 +50,17 @@#define CONFIG_SYS_I2C_SPEED 100000#define CONFIG_CMD_I2C -#define CONFIG_ENV_IS_NOWHERE +/* SD/MMC */ +#define CONFIG_MMC +#define CONFIG_GENERIC_MMC +#define CONFIG_TEGRA_MMC +#define CONFIG_CMD_MMC + +/* Environment in eMMC, at the end of 2nd "boot sector" */ +#define CONFIG_ENV_IS_IN_MMC +#define CONFIG_SYS_MMC_ENV_DEV 0 +#define CONFIG_SYS_MMC_ENV_PART 2 +#define CONFIG_ENV_OFFSET (((4096 - 512) * 1024) - CONFIG_ENV_SIZE)#define MACH_TYPE_DALMORE 4304/* not yet in mach-types.h */
Signature · 1 line
1.8.1.5
PATCH v2 4/4 Tegra114: MMC: Enable DT MMC driver support for Tegra114 Dalmore boards
include/configs/dalmore.h line 63
Quoted 7 lines · Tom Warren
Tested on my Dalmore E1611 board, eMMC and SD-Card work fine, can load a kernel off of an SD card OK, card detect works, and the env is now stored in eMMC (end of the 2nd 'boot' sector, same as Tegra20/30).
include/configs/dalmore.h +1
-0+#define CONFIG_ENV_OFFSET (((4096 - 512) * 1024) - CONFIG_ENV_SIZE)
Sorry, I don't know what I was thinking when I wrote that expression in response to the last time you posted this patch. I think it should be simply:
#define CONFIG_ENV_OFFSET ((4096 * 1024) - CONFIG_ENV_SIZE)
Feel free to fix this up when applying; no need to repost.