From patchwork Fri Oct 5 20:03:10 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Nelson X-Patchwork-Id: 189588 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 4121B2C008A for ; Sat, 6 Oct 2012 06:03:28 +1000 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id AD86C280D3; Fri, 5 Oct 2012 22:03:25 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 8zYEpW85neqd; Fri, 5 Oct 2012 22:03:25 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 8002D28099; Fri, 5 Oct 2012 22:03:22 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 3495828099 for ; Fri, 5 Oct 2012 22:03:20 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 7IRo4UQ8Ki6d for ; Fri, 5 Oct 2012 22:03:19 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-pb0-f44.google.com (mail-pb0-f44.google.com [209.85.160.44]) by theia.denx.de (Postfix) with ESMTPS id 9905A28094 for ; Fri, 5 Oct 2012 22:03:16 +0200 (CEST) Received: by mail-pb0-f44.google.com with SMTP id ro8so2277858pbb.3 for ; Fri, 05 Oct 2012 13:03:13 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:x-gm-message-state; bh=yd9b0ueSWd4XUqsC2PXIVCVzXbNf0pJ11ZtbTzE5y+c=; b=UrnnKS/JxvQFZ5aFgWv0PygsWjP/ODQpHkMjBl0HGQP7kjbtoCO8t4WQbEO476JLsj f2/llA6lXyyW8C0oM3TOCLIutCVUSXbNEh90fqJXJjTD3u4j2HV2N5UPJTjO34er+SWz wJQdIyIRoucMuE2HINgnYzEpEHX1UPsMJl3GoqiX7ClXMh6qZG0wVtuShLF/PIRb+l5f HH0MqXiNfB4vl3Ua5vOEnaeSXCOXNuK+klUnT2ZFrVSSKwq+gTc/qyQdWpUwN7ZpWGDq +uemukez1blvv5A8ZYd6vCvXXv27t1nipAsq+Zh/x6ghG1w/7nt1yqB+8wPD/jIGGqbC OtXw== Received: by 10.68.204.2 with SMTP id ku2mr33818961pbc.59.1349467393828; Fri, 05 Oct 2012 13:03:13 -0700 (PDT) Received: from [192.168.0.162] ([70.96.116.236]) by mx.google.com with ESMTPS id st6sm6505212pbc.58.2012.10.05.13.03.11 (version=SSLv3 cipher=OTHER); Fri, 05 Oct 2012 13:03:12 -0700 (PDT) Message-ID: <506F3CFE.8020305@boundarydevices.com> Date: Fri, 05 Oct 2012 13:03:10 -0700 From: Eric Nelson User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.28) Gecko/20120313 Thunderbird/3.1.20 MIME-Version: 1.0 To: Tom Rini References: <1349380149-8693-1-git-send-email-eric.nelson@boundarydevices.com> <1349380149-8693-2-git-send-email-eric.nelson@boundarydevices.com> <20121005192422.383b1b9e@lilith> <506F2A0B.4040004@boundarydevices.com> <20121005190027.GA9014@bill-the-cat> In-Reply-To: <20121005190027.GA9014@bill-the-cat> X-Gm-Message-State: ALoCoQmKSLsS4gkLeRNSlMJ+5FMSoZJoDG3MG4FO5okr+ITSxf5EsSEF2du2PJfnkoQlrYDEzRjL Cc: u-boot@lists.denx.de Subject: Re: [U-Boot] [PATCH 1/3] Add nitrogen6x board X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de 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 >>> wrote: >>> >>>> Signed-off-by: Eric Nelson >>>> --- >>>> 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 --- 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; }