On 10/05/2012 12:00 PM, Tom Rini wrote:
On Fri, Oct 05, 2012 at 11:42:19AM -0700, Eric Nelson wrote:
On 10/05/2012 10:24 AM, Albert ARIBAUD wrote:
Hi Eric,

On Thu,  4 Oct 2012 12:49:07 -0700, Eric Nelson
<eric.nel...@boundarydevices.com>   wrote:

Signed-off-by: Eric Nelson<eric.nel...@boundarydevices.com>
---
  board/boundary/nitrogen6x/Makefile     |   41 ++
  board/boundary/nitrogen6x/README       |   77 +++
  board/boundary/nitrogen6x/nitrogen6x.c |  840 ++++++++++++++++++++++++++++++++
  boards.cfg                             |    1 +
  include/configs/nitrogen6x.h           |  242 +++++++++
  5 files changed, 1201 insertions(+), 0 deletions(-)
  create mode 100644 board/boundary/nitrogen6x/Makefile
  create mode 100644 board/boundary/nitrogen6x/README
  create mode 100644 board/boundary/nitrogen6x/nitrogen6x.c
  create mode 100644 include/configs/nitrogen6x.h

If this is essentially a copy of sabrelite, I am surprised that git
does not report any copies. Did you use -C with git format-patch ?


Hi Albert,

I didn't use '-C' (didn't know about it: thanks for the tip!).

It wouldn't have detected copies though, because I made slight
changes in each of these files, replacing the board names and
file names in board/boundary/ and altering the default environment
(policy bits) in nitrogen6x.h.

And we can't deal with this by factoring the code differently?

Hi Tom,

There are two bits to this question:
        - Can we represent the policy differences outside of a
        board structure? These differences are all inside of
        include/configs/nitrogen6x.

        I'm not certain how, but I suspect that we can get
        a different _config to work for this.

        - Can we represent the board differences without a
        board structure? This is a bit harder, since the
        boards are slightly different. The Nitrogen6X has
        a different ethernet PHY reset pin and an optional
        SDIO Wi-Fi module.

        We could add code to SABRE Lite to accommodate these,
        but it seems that sets a bad precedent. Would this
        be done for every vendor that bases a design on
        SABRE Lite?

The precise diffs for the configs and sources is attached for
reference.

I've also been pondering how to simply re-use the code within
the board setup file (mx6qsabrelite.c), but I haven't figured
anything out. Clearly a lot of the code is duplicated, but at
the same time it's board-specific.

For example, we could create a common module that sets up
the SD card pads "like SABRE Lite", and a similar one to
configure ethernet pads. Since SABRE Lite is a reference design,
perhaps that makes sense.

Does anybody have thoughts about how and where this might be
sliced?


Regards,


Eric
--- include/configs/mx6qsabrelite.h	2012-10-03 10:12:16.416131784 -0700
+++ include/configs/nitrogen6x.h	2012-10-04 12:15:26.547249408 -0700
@@ -1,7 +1,8 @@
 /*
  * Copyright (C) 2010-2011 Freescale Semiconductor, Inc.
  *
- * Configuration settings for the Freescale i.MX6Q Sabre Lite board.
+ * Configuration settings for the Boundary Devices Nitrogen6X
+ * and Freescale i.MX6Q Sabre Lite boards.
  *
  * This program is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as
@@ -118,6 +119,7 @@
 
 /* Miscellaneous commands */
 #define CONFIG_CMD_BMODE
+#define CONFIG_CMD_SETEXPR
 
 /* Framebuffer and LCD */
 #define CONFIG_VIDEO
@@ -150,50 +152,34 @@
 #define CONFIG_SYS_TEXT_BASE	       0x17800000
 
 #define CONFIG_EXTRA_ENV_SETTINGS \
-       "script=boot.scr\0" \
-       "uimage=uImage\0" \
 	"console=ttymxc1\0" \
-	"fdt_high=0xffffffff\0"	  \
-	"initrd_high=0xffffffff\0" \
-       "mmcdev=0\0" \
-       "mmcpart=2\0" \
-       "mmcroot=/dev/mmcblk0p3 rootwait rw\0" \
-       "mmcargs=setenv bootargs console=${console},${baudrate} " \
-	       "root=${mmcroot}\0" \
-       "loadbootscript=" \
-	       "fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${script};\0" \
-       "bootscript=echo Running bootscript from mmc ...; " \
-	       "source\0" \
-       "loaduimage=fatload mmc ${mmcdev}:${mmcpart} ${loadaddr} ${uimage}\0" \
-       "mmcboot=echo Booting from mmc ...; " \
-	       "run mmcargs; " \
-	       "bootm\0" \
-       "netargs=setenv bootargs console=${console},${baudrate} " \
-	       "root=/dev/nfs " \
-	       "ip=dhcp nfsroot=${serverip}:${nfsroot},v3,tcp\0" \
-       "netboot=echo Booting from net ...; " \
-	       "run netargs; " \
-	       "dhcp ${uimage}; bootm\0" \
-
-#define CONFIG_BOOTCOMMAND \
-       "mmc dev ${mmcdev};" \
-       "if mmc rescan ${mmcdev}; then " \
-	       "if run loadbootscript; then " \
-		       "run bootscript; " \
-	       "else " \
-		       "if run loaduimage; then " \
-			       "run mmcboot; " \
-		       "else run netboot; " \
-		       "fi; " \
-	       "fi; " \
-       "else run netboot; fi"
+	"clearenv=if sf probe || sf probe || sf probe 1 ; then sf erase 0xc0000 0x2000 && " \
+		"echo restored environment to factory default ; fi\0" \
+	"bootcmd=for dtype in sata mmc ; do " \
+		"for disk in 0 1 ; do ${dtype} dev ${disk} ;" \
+			"for fs in fat ext2 ; do " \
+				"${fs}load ${dtype} ${disk}:1 10008000 " \
+					"/6q_bootscript" \
+					"&& source 10008000 ; " \
+			"done ; " \
+		"done ; " \
+	"done\0" \
+	"upgradeu=for dtype in sata mmc ; do " \
+		"for disk in 0 1 ; do ${dtype} dev ${disk} ;" \
+		     "for fs in fat ext2 ; do " \
+				"${fs}load ${dtype} ${disk}:1 10008000 " \
+					"/6q_upgrade " \
+					"&& source 10008000 ; " \
+			"done ; " \
+		"done ; " \
+	"done\0" \
 
 #define CONFIG_ARP_TIMEOUT     200UL
 
 /* Miscellaneous configurable options */
 #define CONFIG_SYS_LONGHELP
 #define CONFIG_SYS_HUSH_PARSER
-#define CONFIG_SYS_PROMPT	       "MX6QSABRELITE U-Boot > "
+#define CONFIG_SYS_PROMPT	       "U-Boot > "
 #define CONFIG_AUTO_COMPLETE
 #define CONFIG_SYS_CBSIZE	       256
 
@@ -229,8 +215,8 @@
 
 #define CONFIG_ENV_SIZE			(8 * 1024)
 
-#define CONFIG_ENV_IS_IN_MMC
-/* #define CONFIG_ENV_IS_IN_SPI_FLASH */
+/* #define CONFIG_ENV_IS_IN_MMC */
+#define CONFIG_ENV_IS_IN_SPI_FLASH
 
 #if defined(CONFIG_ENV_IS_IN_MMC)
 #define CONFIG_ENV_OFFSET		(6 * 64 * 1024)
--- board/freescale/mx6qsabrelite/mx6qsabrelite.c	2012-10-03 10:12:16.416131784 -0700
+++ board/boundary/nitrogen6x/nitrogen6x.c	2012-10-04 12:28:10.798317824 -0700
@@ -69,6 +69,18 @@
 	PAD_CTL_DSE_40ohm | PAD_CTL_HYS |			\
 	PAD_CTL_ODE | PAD_CTL_SRE_FAST)
 
+#define WEAK_PULLUP	(PAD_CTL_PKE | PAD_CTL_PUE |		\
+	PAD_CTL_PUS_100K_UP | PAD_CTL_SPEED_MED |		\
+	PAD_CTL_DSE_40ohm | PAD_CTL_HYS |			\
+	PAD_CTL_SRE_SLOW)
+
+#define WEAK_PULLDOWN	(PAD_CTL_PKE | PAD_CTL_PUE |		\
+	PAD_CTL_PUS_100K_DOWN | PAD_CTL_SPEED_MED |		\
+	PAD_CTL_DSE_40ohm | PAD_CTL_HYS |			\
+	PAD_CTL_SRE_SLOW)
+
+#define OUTPUT_40OHM (PAD_CTL_SPEED_MED|PAD_CTL_DSE_40ohm)
+
 int dram_init(void)
 {
        gd->ram_size = get_ram_size((void *)PHYS_SDRAM, PHYS_SDRAM_SIZE);
@@ -174,6 +186,7 @@
 	MX6Q_PAD_RGMII_RX_CTL__GPIO_6_24	| MUX_PAD_CTRL(NO_PAD_CTRL),
 	/* pin 42 PHY nRST */
 	MX6Q_PAD_EIM_D23__GPIO_3_23		| MUX_PAD_CTRL(NO_PAD_CTRL),
+	MX6Q_PAD_ENET_RXD0__GPIO_1_27		| MUX_PAD_CTRL(NO_PAD_CTRL),
 };
 
 iomux_v3_cfg_t const enet_pads2[] = {
@@ -185,6 +198,16 @@
 	MX6Q_PAD_RGMII_RX_CTL__RGMII_RX_CTL	| MUX_PAD_CTRL(ENET_PAD_CTRL),
 };
 
+/* wl1271 pads on nitrogen6x */
+iomux_v3_cfg_t const wl12xx_pads[] = {
+	(MX6Q_PAD_NANDF_CS1__GPIO_6_14 & ~MUX_PAD_CTRL_MASK) | MUX_PAD_CTRL(WEAK_PULLDOWN),
+	(MX6Q_PAD_NANDF_CS2__GPIO_6_15 & ~MUX_PAD_CTRL_MASK) | MUX_PAD_CTRL(OUTPUT_40OHM),
+	(MX6Q_PAD_NANDF_CS3__GPIO_6_16 & ~MUX_PAD_CTRL_MASK) | MUX_PAD_CTRL(OUTPUT_40OHM),
+};
+#define WL12XX_WL_IRQ_GP	IMX_GPIO_NR(6,14)
+#define WL12XX_WL_ENABLE_GP	IMX_GPIO_NR(6,15)
+#define WL12XX_BT_ENABLE_GP	IMX_GPIO_NR(6,16)
+
 /* Button assignments for J14 */
 static iomux_v3_cfg_t const button_pads[] = {
 	/* Menu */
@@ -203,7 +226,8 @@
 
 static void setup_iomux_enet(void)
 {
-	gpio_direction_output(IMX_GPIO_NR(3, 23), 0);
+	gpio_direction_output(IMX_GPIO_NR(3, 23), 0); /* SABRE Lite PHY rst */
+	gpio_direction_output(IMX_GPIO_NR(1, 27), 0); /* Nitrogen6X PHY rst */
 	gpio_direction_output(IMX_GPIO_NR(6, 30), 1);
 	gpio_direction_output(IMX_GPIO_NR(6, 25), 1);
 	gpio_direction_output(IMX_GPIO_NR(6, 27), 1);
@@ -214,7 +238,8 @@
 
 	/* Need delay 10ms according to KSZ9021 spec */
 	udelay(1000 * 10);
-	gpio_set_value(IMX_GPIO_NR(3, 23), 1);
+	gpio_set_value(IMX_GPIO_NR(3, 23), 1); /* SABRE Lite PHY reset */
+	gpio_set_value(IMX_GPIO_NR(1, 27), 1); /* Nitrogen6X PHY reset */
 
 	imx_iomux_v3_setup_multiple_pads(enet_pads2, ARRAY_SIZE(enet_pads2));
 }
@@ -692,6 +717,13 @@
 int board_early_init_f(void)
 {
 	setup_iomux_uart();
+
+	/* Disable wl1271 For Nitrogen6w */
+	gpio_direction_input(WL12XX_WL_IRQ_GP);
+	gpio_direction_output(WL12XX_WL_ENABLE_GP,0);
+	gpio_direction_output(WL12XX_BT_ENABLE_GP,0);
+
+	imx_iomux_v3_setup_multiple_pads(wl12xx_pads, ARRAY_SIZE(wl12xx_pads));
 	setup_buttons();
 
 #if defined(CONFIG_VIDEO_IPUV3)
@@ -730,7 +762,10 @@
 
 int checkboard(void)
 {
-       puts("Board: MX6Q-Sabre Lite\n");
+	if (gpio_get_value(WL12XX_WL_IRQ_GP)) {
+		puts("Board: Nitrogen6X\n");
+	} else
+		puts("Board: SABRE Lite\n");
 
        return 0;
 }
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to