public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH v2 0/4] Tegra114: MMC: Add MMC driver for T114/Dalmore
@ 2013-03-18 23:25 Tom Warren
  2013-03-18 23:25 ` [U-Boot] [PATCH v2 1/4] Tegra114: fdt: Add SDMMC (sdhci) nodes for T114 boards (Dalmore for now) Tom Warren
                   ` (3 more replies)
  0 siblings, 4 replies; 7+ messages in thread
From: Tom Warren @ 2013-03-18 23:25 UTC (permalink / raw)
  To: u-boot

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(-)

-- 
1.8.1.5

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH v2 1/4] Tegra114: fdt: Add SDMMC (sdhci) nodes for T114 boards (Dalmore for now)
  2013-03-18 23:25 [U-Boot] [PATCH v2 0/4] Tegra114: MMC: Add MMC driver for T114/Dalmore Tom Warren
@ 2013-03-18 23:25 ` Tom Warren
  2013-03-18 23:25 ` [U-Boot] [PATCH v2 2/4] Tegra114: Dalmore: Add SDIO3 pad config to pinctrl_config table Tom Warren
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 7+ messages in thread
From: Tom Warren @ 2013-03-18 23:25 UTC (permalink / raw)
  To: u-boot

Took these values directly from the kernel dts files.

Signed-off-by: Tom Warren <twarren@nvidia.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
---
v2: No change

 arch/arm/dts/tegra114.dtsi            | 32 ++++++++++++++++++++++++++++++++
 board/nvidia/dts/tegra114-dalmore.dts | 13 +++++++++++++
 2 files changed, 45 insertions(+)

diff --git a/arch/arm/dts/tegra114.dtsi b/arch/arm/dts/tegra114.dtsi
index 3b1ca35..f86d18d 100644
--- a/arch/arm/dts/tegra114.dtsi
+++ b/arch/arm/dts/tegra114.dtsi
@@ -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";
+	};
 };
diff --git a/board/nvidia/dts/tegra114-dalmore.dts b/board/nvidia/dts/tegra114-dalmore.dts
index 87cb0ba..86e9459 100644
--- a/board/nvidia/dts/tegra114-dalmore.dts
+++ b/board/nvidia/dts/tegra114-dalmore.dts
@@ -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";
+	};
 };
-- 
1.8.1.5

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH v2 2/4] Tegra114: Dalmore: Add SDIO3 pad config to pinctrl_config table
  2013-03-18 23:25 [U-Boot] [PATCH v2 0/4] Tegra114: MMC: Add MMC driver for T114/Dalmore Tom Warren
  2013-03-18 23:25 ` [U-Boot] [PATCH v2 1/4] Tegra114: fdt: Add SDMMC (sdhci) nodes for T114 boards (Dalmore for now) Tom Warren
@ 2013-03-18 23:25 ` Tom Warren
  2013-03-18 23:25 ` [U-Boot] [PATCH v2 3/4] Tegra114: MMC: Add SD bus power-rail init routine Tom Warren
  2013-03-18 23:25 ` [U-Boot] [PATCH v2 4/4] Tegra114: MMC: Enable DT MMC driver support for Tegra114 Dalmore boards Tom Warren
  3 siblings, 0 replies; 7+ messages in thread
From: Tom Warren @ 2013-03-18 23:25 UTC (permalink / raw)
  To: u-boot

SDIO1 (the SD-card slot on Dalmore) needs to have its pads setup
before the MMC driver is added.

Signed-off-by: Tom Warren <twarren@nvidia.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
---
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(+)

diff --git a/arch/arm/include/asm/arch-tegra114/gp_padctrl.h b/arch/arm/include/asm/arch-tegra114/gp_padctrl.h
index 1ef1a14..41ce677 100644
--- a/arch/arm/include/asm/arch-tegra114/gp_padctrl.h
+++ b/arch/arm/include/asm/arch-tegra114/gp_padctrl.h
@@ -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_ */
diff --git a/board/nvidia/dalmore/dalmore.c b/board/nvidia/dalmore/dalmore.c
index 2020a5f..7449b5b 100644
--- a/board/nvidia/dalmore/dalmore.c
+++ b/board/nvidia/dalmore/dalmore.c
@@ -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));
 }
diff --git a/board/nvidia/dalmore/pinmux-config-dalmore.h b/board/nvidia/dalmore/pinmux-config-dalmore.h
index 3ef6f4e..8c05a15 100644
--- a/board/nvidia/dalmore/pinmux-config-dalmore.h
+++ b/board/nvidia/dalmore/pinmux-config-dalmore.h
@@ -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 */
-- 
1.8.1.5

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH v2 3/4] Tegra114: MMC: Add SD bus power-rail init routine
  2013-03-18 23:25 [U-Boot] [PATCH v2 0/4] Tegra114: MMC: Add MMC driver for T114/Dalmore Tom Warren
  2013-03-18 23:25 ` [U-Boot] [PATCH v2 1/4] Tegra114: fdt: Add SDMMC (sdhci) nodes for T114 boards (Dalmore for now) Tom Warren
  2013-03-18 23:25 ` [U-Boot] [PATCH v2 2/4] Tegra114: Dalmore: Add SDIO3 pad config to pinctrl_config table Tom Warren
@ 2013-03-18 23:25 ` Tom Warren
  2013-03-18 23:25 ` [U-Boot] [PATCH v2 4/4] Tegra114: MMC: Enable DT MMC driver support for Tegra114 Dalmore boards Tom Warren
  3 siblings, 0 replies; 7+ messages in thread
From: Tom Warren @ 2013-03-18 23:25 UTC (permalink / raw)
  To: u-boot

T114 requires SD bus power-rail bringup for the SDIO card on SDMMC3.

Signed-off-by: Tom Warren <twarren@nvidia.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
---
v2: Remove I2C retries

 board/nvidia/dalmore/dalmore.c | 62 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 62 insertions(+)

diff --git a/board/nvidia/dalmore/dalmore.c b/board/nvidia/dalmore/dalmore.c
index 7449b5b..2c23a29 100644
--- a/board/nvidia/dalmore/dalmore.c
+++ b/board/nvidia/dalmore/dalmore.c
@@ -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 */
-- 
1.8.1.5

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH v2 4/4] Tegra114: MMC: Enable DT MMC driver support for Tegra114 Dalmore boards
  2013-03-18 23:25 [U-Boot] [PATCH v2 0/4] Tegra114: MMC: Add MMC driver for T114/Dalmore Tom Warren
                   ` (2 preceding siblings ...)
  2013-03-18 23:25 ` [U-Boot] [PATCH v2 3/4] Tegra114: MMC: Add SD bus power-rail init routine Tom Warren
@ 2013-03-18 23:25 ` Tom Warren
  2013-03-19 18:32   ` Stephen Warren
  3 siblings, 1 reply; 7+ messages in thread
From: Tom Warren @ 2013-03-18 23:25 UTC (permalink / raw)
  To: u-boot

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).

Signed-off-by: Tom Warren <twarren@nvidia.com>
Reviewed-by: Stephen Warren <swarren@nvidia.com>
---
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(-)

diff --git a/include/configs/dalmore.h b/include/configs/dalmore.h
index c7deea5..3f4b70e 100644
--- a/include/configs/dalmore.h
+++ b/include/configs/dalmore.h
@@ -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 */
 
-- 
1.8.1.5

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH v2 4/4] Tegra114: MMC: Enable DT MMC driver support for Tegra114 Dalmore boards
  2013-03-18 23:25 ` [U-Boot] [PATCH v2 4/4] Tegra114: MMC: Enable DT MMC driver support for Tegra114 Dalmore boards Tom Warren
@ 2013-03-19 18:32   ` Stephen Warren
  0 siblings, 0 replies; 7+ messages in thread
From: Stephen Warren @ 2013-03-19 18:32 UTC (permalink / raw)
  To: u-boot

On 03/18/2013 05:25 PM, Tom Warren wrote:
> 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).

> diff --git a/include/configs/dalmore.h b/include/configs/dalmore.h

> +#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.

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [U-Boot] [PATCH v2 4/4] Tegra114: MMC: Enable DT MMC driver support for Tegra114 Dalmore boards
@ 2013-03-20 15:41 Tom Warren
  0 siblings, 0 replies; 7+ messages in thread
From: Tom Warren @ 2013-03-20 15:41 UTC (permalink / raw)
  To: u-boot

Stephen,

> -----Original Message-----
> From: Stephen Warren [mailto:swarren at wwwdotorg.org]
> Sent: Tuesday, March 19, 2013 11:33 AM
> To: Tom Warren
> Cc: u-boot at lists.denx.de; Stephen Warren; afleming at freescale.com; Tom
> Warren
> Subject: Re: [U-Boot] [PATCH v2 4/4] Tegra114: MMC: Enable DT MMC driver
> support for Tegra114 Dalmore boards
> 
> On 03/18/2013 05:25 PM, Tom Warren wrote:
> > 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).
> 
> > diff --git a/include/configs/dalmore.h b/include/configs/dalmore.h
> 
> > +#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.
Thanks, will do.

--
nvpublic

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2013-03-20 15:41 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-03-18 23:25 [U-Boot] [PATCH v2 0/4] Tegra114: MMC: Add MMC driver for T114/Dalmore Tom Warren
2013-03-18 23:25 ` [U-Boot] [PATCH v2 1/4] Tegra114: fdt: Add SDMMC (sdhci) nodes for T114 boards (Dalmore for now) Tom Warren
2013-03-18 23:25 ` [U-Boot] [PATCH v2 2/4] Tegra114: Dalmore: Add SDIO3 pad config to pinctrl_config table Tom Warren
2013-03-18 23:25 ` [U-Boot] [PATCH v2 3/4] Tegra114: MMC: Add SD bus power-rail init routine Tom Warren
2013-03-18 23:25 ` [U-Boot] [PATCH v2 4/4] Tegra114: MMC: Enable DT MMC driver support for Tegra114 Dalmore boards Tom Warren
2013-03-19 18:32   ` Stephen Warren
  -- strict thread matches above, loose matches on Subject: below --
2013-03-20 15:41 Tom Warren

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox