From patchwork Sat Mar 29 22:34:41 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Troy Kisky X-Patchwork-Id: 335069 X-Patchwork-Delegate: sbabic@denx.de 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 87C1D1400B5 for ; Sun, 30 Mar 2014 09:34:52 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id A0A804B5F1; Sat, 29 Mar 2014 23:34:48 +0100 (CET) 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 uBTo3x871WRO; Sat, 29 Mar 2014 23:34:48 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 2EA9B4B58F; Sat, 29 Mar 2014 23:34:46 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 89C374B58F for ; Sat, 29 Mar 2014 23:34:41 +0100 (CET) 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 uOa9L92Kp8Gp for ; Sat, 29 Mar 2014 23:34:38 +0100 (CET) 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-pd0-f174.google.com (mail-pd0-f174.google.com [209.85.192.174]) by theia.denx.de (Postfix) with ESMTPS id 37A344B579 for ; Sat, 29 Mar 2014 23:34:34 +0100 (CET) Received: by mail-pd0-f174.google.com with SMTP id y13so6323714pdi.19 for ; Sat, 29 Mar 2014 15:34:32 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=AVAQ/pGBQ+V8pr0zP++F+l1MGOAzbBk9ZFxpl/AKUhA=; b=GUIsC1gufP7ZPezezTJ3PcCSIofRf00N8w8bNRc5OJwSTLgOIjkqPamUgw2+T/MGPu klvHrt1urM7ahV6UD+lXcr3k5YFxTdwKBE6eBODVVMQZNcVxyc3UhgVWSxVG+CjkXEQr dj2iGQGQg5bvQiV+4o1gzi5VEol0KWhMYD15PuyTd5RBIMLICHHDZJDCuhpLjR8TqGoM /vfQHwpROJdykmvItD4KZkOyRH2UXePCTWlFrz5Mi0sNKj+wbCfT1Uer0V4XfRF5a4Jx 0hzzjC93ZOXLnsJFH1og8n49pth2csgsDApCK+AmZWYKwJkKq4mHCJwnxTGqzmtElxie d97g== X-Gm-Message-State: ALoCoQmBs7gYTTyVO2Oxc8Kn6Z72oI2zwI1JHi8VSS7W+ye6RFVzGYy+mpCDwl5ONMFYMu8wfwoQ X-Received: by 10.68.135.195 with SMTP id pu3mr16537275pbb.70.1396132472412; Sat, 29 Mar 2014 15:34:32 -0700 (PDT) Received: from officeserver-2 ([63.226.49.26]) by mx.google.com with ESMTPSA id sy2sm33624185pbc.28.2014.03.29.15.34.30 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Sat, 29 Mar 2014 15:34:31 -0700 (PDT) Received: from tkisky by officeserver-2 with local (Exim 4.80) (envelope-from ) id 1WU1pu-0002Sy-Tj; Sat, 29 Mar 2014 15:34:46 -0700 From: Troy Kisky To: sbabic@denx.de Date: Sat, 29 Mar 2014 15:34:41 -0700 Message-Id: <1396132481-9446-1-git-send-email-troy.kisky@boundarydevices.com> X-Mailer: git-send-email 1.8.1.2 Cc: fabio.estevam@freescale.com, marex@denx.de, otavio@ossystems.com.br, u-boot@lists.denx.de Subject: [U-Boot] [PATCH 1/1] imx-common: cpu: add fdt_file environment variable 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: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de This removes one block in the move toward 1 u-boot for both a mx6q (quad) and mx6dl (duallite) processor. Now fdt_file hardcoded value can be removed. Signed-off-by: Troy Kisky --- arch/arm/imx-common/cpu.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ arch/arm/lib/board.c | 7 +++++++ 2 files changed, 51 insertions(+) diff --git a/arch/arm/imx-common/cpu.c b/arch/arm/imx-common/cpu.c index a77c4de..5d48011 100644 --- a/arch/arm/imx-common/cpu.c +++ b/arch/arm/imx-common/cpu.c @@ -180,3 +180,47 @@ void arch_preboot_os(void) ipuv3_fb_shutdown(); } #endif + +const char *get_dtb_prefix(u32 imxtype) +{ + switch (imxtype) { + case MXC_CPU_MX6Q: + case MXC_CPU_MX6D: + return "imx6q"; /* Quad/Dual-core version of the mx6 */ + case MXC_CPU_MX6DL: + case MXC_CPU_MX6SOLO: + return "imx6dl"; /* Dual Lite/Solo version of the mx6 */ + case MXC_CPU_MX6SL: + return "imx6sl"; /* Solo-Lite version of the mx6 */ + case MXC_CPU_MX51: + return "imx51"; + case MXC_CPU_MX53: + return "imx53"; + } + return "??"; +} + +int cpu_late_init(void) +{ + char buf[128]; + const char *board; + u32 imxtype = (get_cpu_rev() >> 12) & 0xff; + + if (getenv("fdt_file")) + return 0; + board = getenv("board"); + if (!board) { + board = CONFIG_SYS_BOARD; + if ((board[0] == 'm') && (board[1] == 'x')) { + if (board[2] == '6') { + board += 3; + } else if (board[2] == '5') { + if ((board[3] == '1') || (board[3] == '3')) + board += 4; + } + } + } + sprintf(buf, "%s-%s.dtb", get_dtb_prefix(imxtype), board); + setenv("fdt_file", buf); + return 0; +} diff --git a/arch/arm/lib/board.c b/arch/arm/lib/board.c index e9a7708..61cee98 100644 --- a/arch/arm/lib/board.c +++ b/arch/arm/lib/board.c @@ -496,6 +496,11 @@ static void display_fdt_model(const void *blob) } #endif +int __weak cpu_late_init(void) +{ + return 0; +} + /************************************************************************ * * This is the next part if the initialization sequence: we are now @@ -649,6 +654,8 @@ void board_init_r(gd_t *id, ulong dest_addr) board_late_init(); #endif + cpu_late_init(); + #ifdef CONFIG_BITBANGMII bb_miiphy_init(); #endif