uboot-tools/mx6-Initial-Hummingboard-2-support.patch
2017-03-06 12:24:40 +00:00

241 lines
6.7 KiB
Diff

From f349c5dc5ca2af90e026135b807668444ff23d84 Mon Sep 17 00:00:00 2001
From: Peter Robinson <pbrobinson@gmail.com>
Date: Mon, 6 Mar 2017 09:28:37 +0000
Subject: [PATCH 1/2] Initial Hummingboard 2 support
Signed-off-by: Peter Robinson <pbrobinson@gmail.com>
---
board/solidrun/mx6cuboxi/mx6cuboxi.c | 118 +++++++++++++++++++++++++++--------
1 file changed, 92 insertions(+), 26 deletions(-)
diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c b/board/solidrun/mx6cuboxi/mx6cuboxi.c
index 285588d..5b187ff 100644
--- a/board/solidrun/mx6cuboxi/mx6cuboxi.c
+++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c
@@ -37,6 +37,15 @@
DECLARE_GLOBAL_DATA_PTR;
+enum {
+ CUBOX,
+ HB1,
+ HB2,
+ HB2r15,
+};
+
+static int board_type;
+
#define UART_PAD_CTRL (PAD_CTL_PUS_100K_UP | \
PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | \
PAD_CTL_SRE_FAST | PAD_CTL_HYS)
@@ -48,6 +57,9 @@ DECLARE_GLOBAL_DATA_PTR;
#define ENET_PAD_CTRL (PAD_CTL_PUS_100K_UP | \
PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS)
+#define ENET_PAD_CTRL_OD (PAD_CTL_PUS_100K_UP | \
+ PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS | PAD_CTL_ODE)
+
#define ENET_PAD_CTRL_PD (PAD_CTL_PUS_100K_DOWN | \
PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS)
@@ -79,8 +91,11 @@ static iomux_v3_cfg_t const usdhc2_pads[] = {
static iomux_v3_cfg_t const hb_cbi_sense[] = {
/* These pins are for sensing if it is a CuBox-i or a HummingBoard */
- IOMUX_PADS(PAD_KEY_ROW1__GPIO4_IO09 | MUX_PAD_CTRL(UART_PAD_CTRL)),
- IOMUX_PADS(PAD_EIM_DA4__GPIO3_IO04 | MUX_PAD_CTRL(UART_PAD_CTRL)),
+ IOMUX_PADS(PAD_KEY_ROW1__GPIO4_IO09 | MUX_PAD_CTRL(UART_PAD_CTRL)),
+ IOMUX_PADS(PAD_EIM_DA4__GPIO3_IO04 | MUX_PAD_CTRL(UART_PAD_CTRL)),
+ IOMUX_PADS(PAD_SD4_DAT0__GPIO2_IO08 | MUX_PAD_CTRL(UART_PAD_CTRL)),
+ IOMUX_PADS(PAD_CSI0_DAT14__GPIO6_IO00 | MUX_PAD_CTRL(UART_PAD_CTRL)),
+ IOMUX_PADS(PAD_CSI0_DAT18__GPIO6_IO04 | MUX_PAD_CTRL(UART_PAD_CTRL)),
};
static iomux_v3_cfg_t const usb_pads[] = {
@@ -92,8 +107,9 @@ static void setup_iomux_uart(void)
SETUP_IOMUX_PADS(uart1_pads);
}
-static struct fsl_esdhc_cfg usdhc_cfg[1] = {
+static struct fsl_esdhc_cfg usdhc_cfg[2] = {
{USDHC2_BASE_ADDR},
+ {USDHC3_BASE_ADDR},
};
int board_mmc_getcd(struct mmc *mmc)
@@ -103,16 +119,40 @@ int board_mmc_getcd(struct mmc *mmc)
int board_mmc_init(bd_t *bis)
{
- SETUP_IOMUX_PADS(usdhc2_pads);
- usdhc_cfg[0].esdhc_base = USDHC2_BASE_ADDR;
- usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
- gd->arch.sdhc_clk = usdhc_cfg[0].sdhc_clk;
+ int ret;
+ u32 index = 0;
+
+ for (index = 0; index < CONFIG_SYS_FSL_USDHC_NUM; ++index) {
+ switch (index) {
+ case 0:
+ SETUP_IOMUX_PADS(usdhc2_pads);
+ usdhc_cfg[0].esdhc_base = USDHC2_BASE_ADDR;
+ usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
+ gd->arch.sdhc_clk = usdhc_cfg[0].sdhc_clk;
+ break;
+ case 1:
+ SETUP_IOMUX_PADS(usdhc3_pads);
+ usdhc_cfg[1].esdhc_base = USDHC3_BASE_ADDR;
+ usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
+ gd->arch.sdhc_clk = usdhc_cfg[1].sdhc_clk;
+ break;
+ default:
+ printf("Warning: you configured more USDHC controllers"
+ "(%d) then supported by the board (%d)\n",
+ index + 1, CONFIG_SYS_FSL_USDHC_NUM);
+ return -EINVAL;
+ }
- return fsl_esdhc_initialize(bis, &usdhc_cfg[0]);
+ ret = fsl_esdhc_initialize(bis, &usdhc_cfg[index]);
+ if (ret)
+ return ret;
+ }
+
+ return 0;
}
static iomux_v3_cfg_t const enet_pads[] = {
- IOMUX_PADS(PAD_ENET_MDIO__ENET_MDIO | MUX_PAD_CTRL(ENET_PAD_CTRL)),
+ IOMUX_PADS(PAD_ENET_MDIO__ENET_MDIO | MUX_PAD_CTRL(ENET_PAD_CTRL_OD)),
IOMUX_PADS(PAD_ENET_MDC__ENET_MDC | MUX_PAD_CTRL(ENET_PAD_CTRL)),
/* AR8035 reset */
IOMUX_PADS(PAD_KEY_ROW4__GPIO4_IO15 | MUX_PAD_CTRL(ENET_PAD_CTRL_PD)),
@@ -328,41 +368,62 @@ int board_init(void)
return 0;
}
-static bool is_hummingboard(void)
+static int is_hummingboard(void)
{
- int val1, val2;
+ int val1, val2, val3, val4, val5;
SETUP_IOMUX_PADS(hb_cbi_sense);
gpio_direction_input(IMX_GPIO_NR(4, 9));
gpio_direction_input(IMX_GPIO_NR(3, 4));
+ gpio_direction_input(IMX_GPIO_NR(2, 8));
+ gpio_direction_input(IMX_GPIO_NR(6, 0));
+ gpio_direction_input(IMX_GPIO_NR(6, 4));
val1 = gpio_get_value(IMX_GPIO_NR(4, 9));
val2 = gpio_get_value(IMX_GPIO_NR(3, 4));
+ val3 = gpio_get_value(IMX_GPIO_NR(2, 8));
+ val4 = gpio_get_value(IMX_GPIO_NR(6, 0));
+ val5 = gpio_get_value(IMX_GPIO_NR(6, 4));
/*
* Machine selection -
- * Machine val1, val2
- * -------------------------
- * HB rev 3.x x 0
- * CBi 0 1
- * HB 1 1
+ * Machine val1, val2, val3
+ * -------------------------------
+ * HB2 x x 0
+ * HB rev 3.x x 0 x
+ * CBi 0 1 x
+ * HB 1 1 x
*/
- if (val2 == 0)
- return true;
- else if (val1 == 0)
- return false;
- else
- return true;
+ if (val3 == 0) {
+ board_type = HB2;
+ } else if (val2 == 0) {
+ board_type = HB1;
+ } else if (val1 == 0) {
+ board_type = CUBOX;
+ } else {
+ board_type = HB1;
+ }
+
+ if (val4 == 1 && val5 == 0)
+ board_type = HB2r15;
+
+ return board_type;
+
}
int checkboard(void)
{
- if (is_hummingboard())
+ switch (board_type) {
+ case HB2:
+ case HB2r15:
+ puts("Board: MX6 Hummingboard 2\n");
+ case HB1:
puts("Board: MX6 Hummingboard\n");
- else
+ case CUBOX:
puts("Board: MX6 Cubox-i\n");
+ }
return 0;
}
@@ -370,10 +431,15 @@ int checkboard(void)
int board_late_init(void)
{
#ifdef CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
- if (is_hummingboard())
+ switch (board_type) {
+ case HB2:
+ case HB2r15:
+ setenv("board_name", "HUMMINGBOARD2");
+ case HB1:
setenv("board_name", "HUMMINGBOARD");
- else
+ case CUBOX:
setenv("board_name", "CUBOXI");
+ }
if (is_mx6dq())
setenv("board_rev", "MX6Q");
--
2.9.3
From 039d4ce71df224d36f857519cc7a7f56568a75c3 Mon Sep 17 00:00:00 2001
From: Peter Robinson <pbrobinson@gmail.com>
Date: Mon, 6 Mar 2017 11:26:21 +0000
Subject: [PATCH 2/2] drop mmc init for the moment
---
board/solidrun/mx6cuboxi/mx6cuboxi.c | 6 ------
1 file changed, 6 deletions(-)
diff --git a/board/solidrun/mx6cuboxi/mx6cuboxi.c b/board/solidrun/mx6cuboxi/mx6cuboxi.c
index 5b187ff..50dcc09 100644
--- a/board/solidrun/mx6cuboxi/mx6cuboxi.c
+++ b/board/solidrun/mx6cuboxi/mx6cuboxi.c
@@ -130,12 +130,6 @@ int board_mmc_init(bd_t *bis)
usdhc_cfg[0].sdhc_clk = mxc_get_clock(MXC_ESDHC2_CLK);
gd->arch.sdhc_clk = usdhc_cfg[0].sdhc_clk;
break;
- case 1:
- SETUP_IOMUX_PADS(usdhc3_pads);
- usdhc_cfg[1].esdhc_base = USDHC3_BASE_ADDR;
- usdhc_cfg[1].sdhc_clk = mxc_get_clock(MXC_ESDHC3_CLK);
- gd->arch.sdhc_clk = usdhc_cfg[1].sdhc_clk;
- break;
default:
printf("Warning: you configured more USDHC controllers"
"(%d) then supported by the board (%d)\n",
--
2.9.3