add newly minted patches

This commit is contained in:
Dennis Gilmore 2013-07-04 11:17:31 -05:00
parent d25871eafa
commit ccbb7a9b37
14 changed files with 667 additions and 0 deletions

View File

@ -0,0 +1,108 @@
From 1ff842e1735d07a41a0e152bca0b9076768a889a Mon Sep 17 00:00:00 2001
From: Dennis Gilmore <dennis@ausil.us>
Date: Sun, 30 Jun 2013 15:18:08 -0500
Subject: [PATCH 01/14] Add wandboard quad support
---
board/boundary/nitrogen6x/nitrogen6quad.cfg | 45 +++++++++++++++++++++++++++++
board/wandboard/README | 5 ++++
boards.cfg | 1 +
include/configs/wandboard.h | 2 ++
4 files changed, 53 insertions(+)
create mode 100644 board/boundary/nitrogen6x/nitrogen6quad.cfg
diff --git a/board/boundary/nitrogen6x/nitrogen6quad.cfg b/board/boundary/nitrogen6x/nitrogen6quad.cfg
new file mode 100644
index 0000000..dccd497
--- /dev/null
+++ b/board/boundary/nitrogen6x/nitrogen6quad.cfg
@@ -0,0 +1,45 @@
+/*
+ * Copyright (C) 2013 Boundary Devices
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not write to the Free Software
+ * Foundation Inc. 51 Franklin Street Fifth Floor Boston,
+ * MA 02110-1301 USA
+ *
+ * Refer doc/README.imximage for more details about how-to configure
+ * and create imximage boot image
+ *
+ * The syntax is taken as close as possible with the kwbimage
+ */
+
+/* image version */
+IMAGE_VERSION 2
+
+/*
+ * Boot Device : one of
+ * spi, sd (the board has no nand neither onenand)
+ */
+BOOT_FROM sd
+
+#define __ASSEMBLY__
+#include <config.h>
+#include "asm/arch/mx6-ddr.h"
+#include "asm/arch/iomux.h"
+#include "asm/arch/crm_regs.h"
+
+#include "ddr-setup.cfg"
+#include "800mhz_4x256mx16.cfg"
+#include "clocks.cfg"
diff --git a/board/wandboard/README b/board/wandboard/README
index ce83bbe..65d3d05 100644
--- a/board/wandboard/README
+++ b/board/wandboard/README
@@ -17,6 +17,11 @@ To build U-Boot for the Wandboard Dual Lite version:
$ make wandboard_dl_config
$ make
+To build U-Boot for the Wandboard Quad version:
+
+$ make wandboard_quad_config
+$ make
+
To build U-Boot for the Wandboard Solo version:
$ make wandboard_solo_config
diff --git a/boards.cfg b/boards.cfg
index c0c4282..9604bf2 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -281,6 +281,7 @@ nitrogen6q2g arm armv7 nitrogen6x boundar
nitrogen6s arm armv7 nitrogen6x boundary mx6 nitrogen6x:IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6s.cfg,MX6S,DDR_MB=512
nitrogen6s1g arm armv7 nitrogen6x boundary mx6 nitrogen6x:IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6s1g.cfg,MX6S,DDR_MB=1024
wandboard_dl arm armv7 wandboard - mx6 wandboard:IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6dl.cfg,MX6DL,DDR_MB=1024
+wandboard_quad arm armv7 wandboard - mx6 wandboard:IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6q2g.cfg,MX6Q,DDR_MB=2048
wandboard_solo arm armv7 wandboard - mx6 wandboard:IMX_CONFIG=board/boundary/nitrogen6x/nitrogen6s.cfg,MX6S,DDR_MB=512
omap3_overo arm armv7 overo - omap3
omap3_pandora arm armv7 pandora - omap3
diff --git a/include/configs/wandboard.h b/include/configs/wandboard.h
index 5593f1c..b2995d8 100644
--- a/include/configs/wandboard.h
+++ b/include/configs/wandboard.h
@@ -103,6 +103,8 @@
#if defined(CONFIG_MX6DL)
#define CONFIG_DEFAULT_FDT_FILE "imx6dl-wandboard.dtb"
+#elif defined(CONFIG_MX6Q)
+#define CONFIG_DEFAULT_FDT_FILE "imx6q-wandboard.dtb"
#elif defined(CONFIG_MX6S)
#define CONFIG_DEFAULT_FDT_FILE "imx6s-wandboard.dtb"
#endif
--
1.8.3.1

View File

@ -0,0 +1,32 @@
From a22eae1c609b807e9bc65283021b18c0f1386fe1 Mon Sep 17 00:00:00 2001
From: Koen Kooi <koen@dominion.thruhere.net>
Date: Wed, 3 Apr 2013 08:32:19 +0200
Subject: [PATCH 02/14] am335x mux: don't hang on unknown EEPROMs, assume
BeagleBone Black
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
---
board/ti/am335x/mux.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
diff --git a/board/ti/am335x/mux.c b/board/ti/am335x/mux.c
index 0283708..ab42011 100644
--- a/board/ti/am335x/mux.c
+++ b/board/ti/am335x/mux.c
@@ -305,7 +305,11 @@ void enable_board_pin_mux(struct am335x_baseboard_id *header)
configure_module_pin_mux(mmc0_pin_mux);
configure_module_pin_mux(mmc1_pin_mux);
} else {
- puts("Unknown board, cannot configure pinmux.");
- hang();
+ puts("Unknown board, assuming Beaglebone LT/Black.");
+ /* Beaglebone LT pinmux */
+ configure_module_pin_mux(i2c1_pin_mux);
+ configure_module_pin_mux(mii1_pin_mux);
+ configure_module_pin_mux(mmc0_pin_mux);
+ configure_module_pin_mux(mmc1_pin_mux);
}
}
--
1.8.3.1

View File

@ -0,0 +1,38 @@
From 899b013b6bde94d13533b2df1e986a40eb4eb038 Mon Sep 17 00:00:00 2001
From: Koen Kooi <koen@dominion.thruhere.net>
Date: Wed, 3 Apr 2013 08:33:28 +0200
Subject: [PATCH 03/14] beaglebone: HACK: always return 1 for is_bone_lt
This is to make the eMMC flasher work, the EEPROM hasn't been populated yet
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
---
board/ti/am335x/board.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c
index fdbe26c..f9e7803 100644
--- a/board/ti/am335x/board.c
+++ b/board/ti/am335x/board.c
@@ -57,7 +57,8 @@ static inline int board_is_bone(void)
static inline int board_is_bone_lt(void)
{
- return !strncmp(header.name, "A335BNLT", HDR_NAME_LEN);
+ //return !strncmp(header.name, "A335BNLT", HDR_NAME_LEN);
+ return 1;
}
static inline int board_is_evm_sk(void)
@@ -359,7 +360,7 @@ void s_init(void)
if (board_is_evm_sk())
config_ddr(303, MT41J128MJT125_IOCTRL_VALUE, &ddr3_data,
&ddr3_cmd_ctrl_data, &ddr3_emif_reg_data, 0);
- else if (board_is_bone_lt())
+ else if (board_is_bone_lt() && !board_is_bone())
config_ddr(400, MT41K256M16HA125E_IOCTRL_VALUE,
&ddr3_beagleblack_data,
&ddr3_beagleblack_cmd_ctrl_data,
--
1.8.3.1

View File

@ -0,0 +1,25 @@
From 3be081c0e46b1608d0d2e6d81de62c3c254700dd Mon Sep 17 00:00:00 2001
From: Koen Kooi <koen@dominion.thruhere.net>
Date: Wed, 3 Apr 2013 08:27:09 +0200
Subject: [PATCH 04/14] beaglebone: HACK: raise USB current limit
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
---
include/configs/am335x_evm.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index c5a6d4b..c143137 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -151,6 +151,7 @@
#endif
#define CONFIG_BOOTCOMMAND \
+ "i2c mw 0x24 1 0x3e; " \
"run findfdt; " \
"mmc dev ${mmcdev}; if mmc rescan; then " \
"echo SD/MMC found on device ${mmcdev};" \
--
1.8.3.1

View File

@ -0,0 +1,40 @@
From 4a23caa5663bfd11fc7a802339568a4dc08bfd24 Mon Sep 17 00:00:00 2001
From: Koen Kooi <koen@dominion.thruhere.net>
Date: Wed, 3 Apr 2013 08:25:04 +0200
Subject: [PATCH 05/14] beaglebone: use kloadaddr to avoid copying the kernel
around
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
---
include/configs/am335x_evm.h | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index c143137..7a9628e 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -55,6 +55,7 @@
#ifndef CONFIG_SPL_BUILD
#define CONFIG_EXTRA_ENV_SETTINGS \
"loadaddr=0x80200000\0" \
+ "kloadaddr=0x80007fc0\0" \
"fdtaddr=0x80F80000\0" \
"fdt_high=0xffffffff\0" \
"rdaddr=0x81000000\0" \
@@ -113,11 +114,11 @@
"root=${ramroot} " \
"rootfstype=${ramrootfstype}\0" \
"loadramdisk=load mmc ${mmcdev} ${rdaddr} ramdisk.gz\0" \
- "loaduimage=load mmc ${bootpart} ${loadaddr} ${bootdir}/${bootfile}\0" \
+ "loaduimage=load mmc ${bootpart} ${kloadaddr} ${bootdir}/${bootfile}\0" \
"loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile}\0" \
"mmcboot=echo Booting from mmc ...; " \
"run mmcargs; " \
- "bootm ${loadaddr} - ${fdtaddr}\0" \
+ "bootm ${kloadaddr} - ${fdtaddr}\0" \
"nandboot=echo Booting from nand ...; " \
"run nandargs; " \
"nand read ${loadaddr} ${nandsrcaddr} ${nandimgsize}; " \
--
1.8.3.1

View File

@ -0,0 +1,44 @@
From b194b3c0f3e3c3a559f09df8f80f810ca3e54248 Mon Sep 17 00:00:00 2001
From: Koen Kooi <koen@dominion.thruhere.net>
Date: Wed, 3 Apr 2013 08:44:03 +0200
Subject: [PATCH 06/14] beaglebone: try to load uEnv/uImage from eMMC first
If u-boot detects the eMMC, try to load from there, if that fails fall back to uSD. Due to linux "features" rootdev can remain mmcblk0p1.
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
---
include/configs/am335x_evm.h | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index 7a9628e..2547a87 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -154,6 +154,24 @@
#define CONFIG_BOOTCOMMAND \
"i2c mw 0x24 1 0x3e; " \
"run findfdt; " \
+ "mmc dev 1; if mmc rescan; then " \
+ "echo SD/MMC found on device ${mmcdev};" \
+ "setenv mmcdev 1;"\
+ "if run loadbootenv; then " \
+ "echo Loaded environment from ${bootenv};" \
+ "run importbootenv;" \
+ "fi;" \
+ "if test -n $uenvcmd; then " \
+ "echo Running uenvcmd ...;" \
+ "run uenvcmd;" \
+ "fi;" \
+ "if run loaduimage; then " \
+ "run loadfdt;" \
+ "run mmcboot;" \
+ "fi;" \
+ "else " \
+ "echo No SD/MMC found on device ${mmcdev};" \
+ "fi;" \
"mmc dev ${mmcdev}; if mmc rescan; then " \
"echo SD/MMC found on device ${mmcdev};" \
"if run loadbootenv; then " \
--
1.8.3.1

View File

@ -0,0 +1,53 @@
From bdd305d2ca2ab1704f8b937de6a13bf421999bac Mon Sep 17 00:00:00 2001
From: Koen Kooi <koen@dominion.thruhere.net>
Date: Wed, 3 Apr 2013 11:39:16 +0200
Subject: [PATCH 07/14] beaglebone: Don't trigger uboot variable lenght limit
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
---
include/configs/am335x_evm.h | 20 +++-----------------
1 file changed, 3 insertions(+), 17 deletions(-)
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index 2547a87..afe7348 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -154,23 +154,11 @@
#define CONFIG_BOOTCOMMAND \
"i2c mw 0x24 1 0x3e; " \
"run findfdt; " \
- "mmc dev 1; if mmc rescan; then " \
- "echo SD/MMC found on device ${mmcdev};" \
+ "if mmc dev 1; then " \
+ "echo eMMC found;" \
"setenv mmcdev 1;"\
- "if run loadbootenv; then " \
- "echo Loaded environment from ${bootenv};" \
- "run importbootenv;" \
- "fi;" \
- "if test -n $uenvcmd; then " \
- "echo Running uenvcmd ...;" \
- "run uenvcmd;" \
- "fi;" \
- "if run loaduimage; then " \
- "run loadfdt;" \
- "run mmcboot;" \
- "fi;" \
"else " \
- "echo No SD/MMC found on device ${mmcdev};" \
+ "echo No eMMC found;" \
"fi;" \
"mmc dev ${mmcdev}; if mmc rescan; then " \
"echo SD/MMC found on device ${mmcdev};" \
@@ -186,8 +174,6 @@
"run loadfdt;" \
"run mmcboot;" \
"fi;" \
- "else " \
- "run nandboot;" \
"fi;" \
/* Clock Defines */
--
1.8.3.1

View File

@ -0,0 +1,35 @@
From eb995f5314a6419f09646b6f520fd5aade42dec4 Mon Sep 17 00:00:00 2001
From: Koen Kooi <koen@dominion.thruhere.net>
Date: Wed, 3 Apr 2013 11:47:14 +0200
Subject: [PATCH 08/14] beaglebone: HACK: change mmc order to avoid u-boot
crashing
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
---
include/configs/am335x_evm.h | 9 +++++----
1 file changed, 5 insertions(+), 4 deletions(-)
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index afe7348..485f26b 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -154,11 +154,12 @@
#define CONFIG_BOOTCOMMAND \
"i2c mw 0x24 1 0x3e; " \
"run findfdt; " \
- "if mmc dev 1; then " \
- "echo eMMC found;" \
- "setenv mmcdev 1;"\
+ "mmc dev 0; if mmc rescan ; then " \
+ "echo micro SD card found;" \
+ "setenv mmcdev 0;"\
"else " \
- "echo No eMMC found;" \
+ "echo No micro SD card found, setting mmcdev to 1;" \
+ "setenv mmcdev 1;"\
"fi;" \
"mmc dev ${mmcdev}; if mmc rescan; then " \
"echo SD/MMC found on device ${mmcdev};" \
--
1.8.3.1

View File

@ -0,0 +1,25 @@
From c9241c210fc2dddf0d0966197574a3841b1e972e Mon Sep 17 00:00:00 2001
From: Koen Kooi <koen@dominion.thruhere.net>
Date: Wed, 3 Apr 2013 12:04:17 +0200
Subject: [PATCH 09/14] beaglebone: update bootpart variable after mmc scan
Signed-off-by: Koen Kooi <koen@dominion.thruhere.net>
---
include/configs/am335x_evm.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index 485f26b..941c6fb 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -161,6 +161,7 @@
"echo No micro SD card found, setting mmcdev to 1;" \
"setenv mmcdev 1;"\
"fi;" \
+ "setenv bootpart ${mmcdev}:2;" \
"mmc dev ${mmcdev}; if mmc rescan; then " \
"echo SD/MMC found on device ${mmcdev};" \
"if run loadbootenv; then " \
--
1.8.3.1

View File

@ -0,0 +1,25 @@
From 83085bea9e67cb86ad5827f35c6d831301161591 Mon Sep 17 00:00:00 2001
From: Jason Kridner <jdk@ti.com>
Date: Thu, 4 Apr 2013 05:57:00 +0000
Subject: [PATCH 10/14] am335x_evm: enable gpio command
---
include/configs/am335x_evm.h | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index 941c6fb..70ace70 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -44,7 +44,7 @@
/* commands to include */
#include <config_cmd_default.h>
-
+#define CONFIG_CMD_GPIO
#define CONFIG_CMD_ASKENV
#define CONFIG_VERSION_VARIABLE
--
1.8.3.1

View File

@ -0,0 +1,43 @@
From 8190afe7c16163db1d10670983b67f6e0bbb45f2 Mon Sep 17 00:00:00 2001
From: Jason Kridner <jdk@ti.com>
Date: Thu, 4 Apr 2013 07:16:41 +0000
Subject: [PATCH 11/14] am335x_evm: HACK to turn on BeagleBone LEDs
* This might break non-BeagleBone platforms
---
include/configs/am335x_evm.h | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index 70ace70..37c4b2b 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -152,6 +152,7 @@
#endif
#define CONFIG_BOOTCOMMAND \
+ "gpio set 53; " \
"i2c mw 0x24 1 0x3e; " \
"run findfdt; " \
"mmc dev 0; if mmc rescan ; then " \
@@ -163,6 +164,7 @@
"fi;" \
"setenv bootpart ${mmcdev}:2;" \
"mmc dev ${mmcdev}; if mmc rescan; then " \
+ "gpio set 54; " \
"echo SD/MMC found on device ${mmcdev};" \
"if run loadbootenv; then " \
"echo Loaded environment from ${bootenv};" \
@@ -172,7 +174,9 @@
"echo Running uenvcmd ...;" \
"run uenvcmd;" \
"fi;" \
+ "gpio set 55; " \
"if run loaduimage; then " \
+ "gpio set 56; " \
"run loadfdt;" \
"run mmcboot;" \
"fi;" \
--
1.8.3.1

View File

@ -0,0 +1,44 @@
From 41c71ddc1bddc26629073928af3ec2c206e7906b Mon Sep 17 00:00:00 2001
From: Darren Etheridge <detheridge@ti.com>
Date: Tue, 9 Apr 2013 16:49:38 -0500
Subject: [PATCH 12/14] Fix for screen rolling when video played back in
browser on BeagleBone Black This value might need some tweaking, but it
effectively allows the LCDC and the ARM to play fairer in memory, so the LCDC
does not get starved causing the screen to roll See Page 439 in spruh73g
(AM33xx TRM) for details
---
arch/arm/cpu/armv7/am33xx/ddr.c | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/arch/arm/cpu/armv7/am33xx/ddr.c b/arch/arm/cpu/armv7/am33xx/ddr.c
index d1e2fd3..3a93db1 100644
--- a/arch/arm/cpu/armv7/am33xx/ddr.c
+++ b/arch/arm/cpu/armv7/am33xx/ddr.c
@@ -21,6 +21,12 @@ http://www.ti.com/
#include <asm/io.h>
#include <asm/emif.h>
+/* This value might need some tweaking, but it effectively allows the LCDC */
+/* and the ARM to play fairer in memory, so the LCDC does not get starved causing */
+/* the screen to roll */
+/* See Page 439 in spruh73g (AM33xx TRM) for details */
+#define AM33XX_INT_CONFIG_COUNT 0x00303030
+
/**
* Base address for EMIF instances
*/
@@ -79,6 +85,10 @@ void set_sdram_timings(const struct emif_regs *regs, int nr)
writel(regs->sdram_tim2, &emif_reg[nr]->emif_sdram_tim_2_shdw);
writel(regs->sdram_tim3, &emif_reg[nr]->emif_sdram_tim_3);
writel(regs->sdram_tim3, &emif_reg[nr]->emif_sdram_tim_3_shdw);
+
+ /* Configure INT_CONFIG value so that LCDC does not get stalled */
+ /* for a long time if ARM is accessing memory */
+ writel(AM33XX_INT_CONFIG_COUNT, &emif_reg[nr]->emif_l3_config);
}
/**
--
1.8.3.1

View File

@ -0,0 +1,25 @@
From 8c6c1b898473226483c7c155aac22bb0bb84e832 Mon Sep 17 00:00:00 2001
From: Robert Nelson <robertcnelson@gmail.com>
Date: Thu, 25 Apr 2013 13:50:35 -0500
Subject: [PATCH 13/14] beaglebone: enable CONFIG_SUPPORT_RAW_INITRD option
Signed-off-by: Robert Nelson <robertcnelson@gmail.com>
---
include/configs/am335x_evm.h | 1 +
1 file changed, 1 insertion(+)
diff --git a/include/configs/am335x_evm.h b/include/configs/am335x_evm.h
index 37c4b2b..d6b79ca 100644
--- a/include/configs/am335x_evm.h
+++ b/include/configs/am335x_evm.h
@@ -36,6 +36,7 @@
#define CONFIG_OF_LIBFDT
#define CONFIG_CMD_BOOTZ
+#define CONFIG_SUPPORT_RAW_INITRD
#define CONFIG_CMDLINE_TAG /* enable passing of ATAGs */
#define CONFIG_SETUP_MEMORY_TAGS
#define CONFIG_INITRD_TAG
--
1.8.3.1

View File

@ -0,0 +1,130 @@
From e561e4c80077e9876d1609cb5379023d53f09b5c Mon Sep 17 00:00:00 2001
From: Dennis Gilmore <dennis@ausil.us>
Date: Thu, 4 Jul 2013 10:53:10 -0500
Subject: [PATCH 14/14] mmc: Add RSTN enable for emmc
eMMC has the capability of using an external RSTn line.
It has to be enabled via an access to the ECSD so add a command to do so.
Signed-off-by: Pantelis Antoniou <panto@antoniou-consulting.com>
---
common/cmd_mmc.c | 24 ++++++++++++++++++++++++
drivers/mmc/mmc.c | 32 ++++++++++++++++++++++++++++++++
include/mmc.h | 4 ++++
3 files changed, 60 insertions(+)
diff --git a/common/cmd_mmc.c b/common/cmd_mmc.c
index 5f1ed43..87f8577 100644
--- a/common/cmd_mmc.c
+++ b/common/cmd_mmc.c
@@ -238,6 +238,29 @@ static int do_mmcops(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
return CMD_RET_USAGE;
print_mmc_devices('\n');
return 0;
+ } else if (strncmp(argv[1], "rstn", 4) == 0) {
+ struct mmc *mmc;
+ u8 val;
+ int err;
+
+ if (argc != 3)
+ return CMD_RET_USAGE;
+
+ val = simple_strtol(argv[2], NULL, 10);
+
+ mmc = find_mmc_device(curr_device);
+ if (!mmc) {
+ printf("no mmc device at slot %x\n", curr_device);
+ return 1;
+ }
+ err = mmc_set_rst_n(mmc, val);
+ if (err != 0) {
+ printf("failed to set RST_N to 0x%02x\n",
+ (unsigned int)val & 0xff);
+ return 1;
+ }
+
+ return 0;
} else if (strcmp(argv[1], "dev") == 0) {
int dev, part = -1;
struct mmc *mmc;
@@ -431,6 +454,7 @@ U_BOOT_CMD(
"mmc part - lists available partition on current mmc device\n"
"mmc dev [dev] [part] - show or set current mmc device [partition]\n"
"mmc list - lists available devices\n"
+ "mmc rstn - enable hardware reset of emmc\n"
#ifdef CONFIG_SUPPORT_EMMC_BOOT
"mmc open <dev> <boot_partition>\n"
" - Enable boot_part for booting and enable R/W access of boot_part\n"
diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 73f7195..b866d77 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -1491,6 +1491,38 @@ static void do_preinit(void)
}
+/* enable hardware reset signal */
+int mmc_set_rst_n(struct mmc *mmc, u8 val)
+{
+ ALLOC_CACHE_ALIGN_BUFFER(u8, ext_csd, 512);
+ int err;
+
+ memset(ext_csd, 0, 512);
+ err = mmc_send_ext_csd(mmc, ext_csd);
+ if (err)
+ return err;
+
+ printf("before: RST_N=0x%02x\n",
+ (unsigned int)ext_csd[EXT_CSD_RST_N_FUNCTION] & 0xff);
+
+ printf("setting rstn to 0x%02x\n", (unsigned int)val & 0xff);
+
+ err = mmc_switch(mmc, EXT_CSD_CMD_SET_NORMAL,
+ EXT_CSD_RST_N_FUNCTION, val);
+ if (err)
+ return err;
+
+ memset(ext_csd, 0, 512);
+ err = mmc_send_ext_csd(mmc, ext_csd);
+ if (err)
+ return err;
+
+ printf("after: RST_N=0x%02x\n",
+ (unsigned int)ext_csd[EXT_CSD_RST_N_FUNCTION] & 0xff);
+
+ return 0;
+}
+
int mmc_initialize(bd_t *bis)
{
INIT_LIST_HEAD (&mmc_devices);
diff --git a/include/mmc.h b/include/mmc.h
index 583c30e..a9f68dc 100644
--- a/include/mmc.h
+++ b/include/mmc.h
@@ -165,6 +165,7 @@
*/
#define EXT_CSD_GP_SIZE_MULT 143 /* R/W */
#define EXT_CSD_PARTITIONING_SUPPORT 160 /* RO */
+#define EXT_CSD_RST_N_FUNCTION 162 /* R/W */
#define EXT_CSD_RPMB_MULT 168 /* RO */
#define EXT_CSD_ERASE_GROUP_DEF 175 /* R/W */
#define EXT_CSD_BOOT_BUS_WIDTH 177
@@ -178,6 +179,7 @@
#define EXT_CSD_HC_ERASE_GRP_SIZE 224 /* RO */
#define EXT_CSD_BOOT_MULT 226 /* RO */
+
/*
* EXT_CSD field definitions
*/
@@ -357,4 +359,6 @@ struct mmc *mmc_spi_init(uint bus, uint cs, uint speed, uint mode);
int mmc_legacy_init(int verbose);
#endif
+int mmc_set_rst_n(struct mmc *mmc, u8 val);
+
#endif /* _MMC_H_ */
--
1.8.3.1