Re: [U-Boot] [PATCH 2/2] MarSBoard: add new board

2014-03-26 Thread Eric Bénard
Hi Wolfgang,

Le Wed, 26 Mar 2014 20:02:57 +0100,
Wolfgang Denk  a écrit :
> In message <1395858363-21054-2-git-send-email-e...@eukrea.com> you wrote:
> > 
> > this board is produced by Embest/Element 14 and is based on i.MX6 Dual
> 
> Comparing this patch agains the earlier one for the  RiOTboard, it
> turns out that the differences between these two boards are really
> minimal.
> 
> Would it not make sense to combine all the common code?  Actually I
> think you should be able to use all common code with just two
> different target names.
> 
that seems possible : the main differences at u-boot level are the
eSDHC (3 on the RiOT vs 2 on the MarS) and the SPI flash which is
populated in the MarSBoard (and used for boot when the RiOT boots on
the eMMC). I'll check how to factorize the code.

Eric
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] MarSBoard: add new board

2014-03-26 Thread Wolfgang Denk
Dear Eric,

In message <1395858363-21054-2-git-send-email-e...@eukrea.com> you wrote:
> 
> this board is produced by Embest/Element 14 and is based on i.MX6 Dual

Comparing this patch agains the earlier one for the  RiOTboard, it
turns out that the differences between these two boards are really
minimal.

Would it not make sense to combine all the common code?  Actually I
think you should be able to use all common code with just two
different target names.

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
To be awake is to be alive.- Henry David Thoreau, in "Walden"
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 2/2] MarSBoard: add new board

2014-03-26 Thread Eric Bénard
this board is produced by Embest/Element 14 and is based on i.MX6 Dual
The following features are tested :
- UART2 (console)
- eMMC
- uSDCard
- Ethernet
- USB Host (through 2 ports hub)
- HDMI output
- I2C 1/2
- SPI NOR Flash

Boot on SPI NOR and through USB loader are tested.

For more informations on this board :
http://www.embest-tech.com/shop/star/marsboard.html

Signed-off-by: Eric Bénard 
---
 board/embest/marsboard/Makefile|   9 +
 board/embest/marsboard/marsboard.c | 489 +
 boards.cfg |   1 +
 include/configs/marsboard.h| 304 +++
 4 files changed, 803 insertions(+)
 create mode 100644 board/embest/marsboard/Makefile
 create mode 100644 board/embest/marsboard/marsboard.c
 create mode 100644 include/configs/marsboard.h

diff --git a/board/embest/marsboard/Makefile b/board/embest/marsboard/Makefile
new file mode 100644
index 000..e87cc87
--- /dev/null
+++ b/board/embest/marsboard/Makefile
@@ -0,0 +1,9 @@
+#
+# Copyright (C) 2007, Guennadi Liakhovetski 
+#
+# (C) Copyright 2011 Freescale Semiconductor, Inc.
+#
+# SPDX-License-Identifier: GPL-2.0+
+#
+
+obj-y  := marsboard.o
diff --git a/board/embest/marsboard/marsboard.c 
b/board/embest/marsboard/marsboard.c
new file mode 100644
index 000..3735462
--- /dev/null
+++ b/board/embest/marsboard/marsboard.c
@@ -0,0 +1,489 @@
+/*
+ * Copyright (C) 2014 Eukréa Electromatique
+ * Author: Eric Bénard 
+ * Fabio Estevam 
+ * Jon Nettleton 
+ *
+ * based on sabresd.c which is :
+ * Copyright (C) 2012 Freescale Semiconductor, Inc.
+ * and on hummingboard.c which is :
+ * Copyright (C) 2013 SolidRun ltd.
+ * Copyright (C) 2013 Jon Nettleton .
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+DECLARE_GLOBAL_DATA_PTR;
+
+#define UART_PAD_CTRL  (PAD_CTL_PUS_100K_UP |  \
+   PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | \
+   PAD_CTL_SRE_FAST  | PAD_CTL_HYS)
+
+#define USDHC_PAD_CTRL (PAD_CTL_PUS_47K_UP |   \
+   PAD_CTL_SPEED_LOW | PAD_CTL_DSE_80ohm | \
+   PAD_CTL_SRE_FAST  | PAD_CTL_HYS)
+
+#define USDHC_PAD_CLK_CTRL (PAD_CTL_SPEED_LOW |\
+   PAD_CTL_DSE_80ohm | PAD_CTL_SRE_FAST |  \
+   PAD_CTL_HYS)
+
+#define ENET_PAD_CTRL  (PAD_CTL_PUS_100K_UP |  \
+   PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS)
+
+#define ENET_PAD_CTRL_PD  (PAD_CTL_PUS_100K_DOWN | \
+   PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS)
+
+#define ENET_PAD_CTRL_CLK  ((PAD_CTL_PUS_100K_UP & ~PAD_CTL_PKE) | \
+   PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST)
+
+#define I2C_PAD_CTRL   (PAD_CTL_PUS_100K_UP |  \
+   PAD_CTL_SPEED_MED | PAD_CTL_DSE_40ohm | PAD_CTL_HYS |   \
+   PAD_CTL_ODE | PAD_CTL_SRE_FAST)
+
+#define SPI_PAD_CTRL (PAD_CTL_HYS | PAD_CTL_SPEED_MED | \
+ PAD_CTL_DSE_40ohm | PAD_CTL_SRE_FAST)
+
+int dram_init(void)
+{
+   gd->ram_size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE);
+
+   return 0;
+}
+
+static iomux_v3_cfg_t const uart2_pads[] = {
+   MX6_PAD_EIM_D26__UART2_TX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL),
+   MX6_PAD_EIM_D27__UART2_RX_DATA | MUX_PAD_CTRL(UART_PAD_CTRL),
+};
+
+static void setup_iomux_uart(void)
+{
+   imx_iomux_v3_setup_multiple_pads(uart2_pads, ARRAY_SIZE(uart2_pads));
+}
+
+iomux_v3_cfg_t const enet_pads[] = {
+   MX6_PAD_ENET_MDIO__ENET_MDIO | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6_PAD_ENET_MDC__ENET_MDC | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   /* GPIO16 -> AR8035 25MHz */
+   MX6_PAD_GPIO_16__ENET_REF_CLK | MUX_PAD_CTRL(NO_PAD_CTRL),
+   MX6_PAD_RGMII_TXC__RGMII_TXC  | MUX_PAD_CTRL(NO_PAD_CTRL),
+   MX6_PAD_RGMII_TD0__RGMII_TD0 | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6_PAD_RGMII_TD1__RGMII_TD1 | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6_PAD_RGMII_TD2__RGMII_TD2 | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6_PAD_RGMII_TD3__RGMII_TD3 | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6_PAD_RGMII_TX_CTL__RGMII_TX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   /* AR8035 CLK_25M --> ENET_REF_CLK (V22) */
+   MX6_PAD_ENET_REF_CLK__ENET_TX_CLK | MUX_PAD_CTRL(ENET_PAD_CTRL_CLK),
+   MX6_PAD_RGMII_RXC__RGMII_RXC | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6_PAD_RGMII_RD0__RGMII_RD0 | MUX_PAD_CTRL(ENET_PAD_CTRL_PD),
+   MX6_PAD_RGMII_RD1__RGMII_RD1 | MUX_PAD_CTRL(ENET_PAD_CTRL_PD),
+   MX6_PAD_RGMII_RD2__RGMII_RD2 | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6_PAD_RGMII_RD3__RGMII_RD3 | MUX_PAD_CTRL(ENET_PAD_CTRL),
+   MX6_PAD_RGMII_RX_CTL__RGMII_RX_CTL | MUX_PAD_CTRL(ENET_PAD_CTRL_PD),
+   /* AR8035 PHY Reset */
+   MX6_PAD_EIM_D31__GPIO3_IO31 | 
MUX_P