Patchwork [U-Boot,3/3] nitrogen6x: initialize WL12XX pads, use to determine board type

login
register
mail settings
Submitter Eric Nelson
Date Oct. 4, 2012, 7:49 p.m.
Message ID <1349380149-8693-4-git-send-email-eric.nelson@boundarydevices.com>
Download mbox | patch
Permalink /patch/189274/
State Changes Requested
Delegated to: Stefano Babic
Headers show

Comments

Eric Nelson - Oct. 4, 2012, 7:49 p.m.
Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com>
---
 board/boundary/nitrogen6x/nitrogen6x.c |   34 +++++++++++++++++++++++++++++++-
 1 files changed, 33 insertions(+), 1 deletions(-)
Stefano Babic - Oct. 8, 2012, 12:32 p.m.
On 04/10/2012 21:49, Eric Nelson wrote:
> Signed-off-by: Eric Nelson <eric.nelson@boundarydevices.com>
> ---
>  board/boundary/nitrogen6x/nitrogen6x.c |   34 +++++++++++++++++++++++++++++++-
>  1 files changed, 33 insertions(+), 1 deletions(-)
> 
> diff --git a/board/boundary/nitrogen6x/nitrogen6x.c b/board/boundary/nitrogen6x/nitrogen6x.c
> index 469a044..16469b7 100644
> --- a/board/boundary/nitrogen6x/nitrogen6x.c
> +++ b/board/boundary/nitrogen6x/nitrogen6x.c
> @@ -69,6 +69,18 @@ DECLARE_GLOBAL_DATA_PTR;
>  	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);
> @@ -186,6 +198,16 @@ iomux_v3_cfg_t const enet_pads2[] = {
>  	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 */
> @@ -695,6 +717,13 @@ static void setup_display(void)
>  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)
> @@ -733,7 +762,10 @@ int board_init(void)
>  
>  int checkboard(void)
>  {
> -       puts("Board: Nitrogen6X or MX6Q-Sabre Lite\n");
> +	if (gpio_get_value(WL12XX_WL_IRQ_GP)) {
> +		puts("Board: Nitrogen6X\n");
> +	} else
> +		puts("Board: SABRE Lite\n");

This answer a comment of mine for PATCH1/3. Anyway, I think it is better
to squash the three patches together. This avoid you push in the same
patchset new code in one patch and you modify in the next one.

Best regards,
Stefano Babic

Patch

diff --git a/board/boundary/nitrogen6x/nitrogen6x.c b/board/boundary/nitrogen6x/nitrogen6x.c
index 469a044..16469b7 100644
--- a/board/boundary/nitrogen6x/nitrogen6x.c
+++ b/board/boundary/nitrogen6x/nitrogen6x.c
@@ -69,6 +69,18 @@  DECLARE_GLOBAL_DATA_PTR;
 	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);
@@ -186,6 +198,16 @@  iomux_v3_cfg_t const enet_pads2[] = {
 	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 */
@@ -695,6 +717,13 @@  static void setup_display(void)
 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)
@@ -733,7 +762,10 @@  int board_init(void)
 
 int checkboard(void)
 {
-       puts("Board: Nitrogen6X or MX6Q-Sabre Lite\n");
+	if (gpio_get_value(WL12XX_WL_IRQ_GP)) {
+		puts("Board: Nitrogen6X\n");
+	} else
+		puts("Board: SABRE Lite\n");
 
        return 0;
 }