From patchwork Tue Mar 15 09:03:59 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiko Schocher X-Patchwork-Id: 86918 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 A9AF3B6F93 for ; Tue, 15 Mar 2011 20:16:59 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id D19C72810A; Tue, 15 Mar 2011 10:15:19 +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 LCVWWv3MGP0Y; Tue, 15 Mar 2011 10:15:19 +0100 (CET) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 41D2A2810C; Tue, 15 Mar 2011 10:13:47 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id CD5212808F for ; Tue, 15 Mar 2011 10:13:17 +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 XhP+beg0VGYE for ; Tue, 15 Mar 2011 10:13:17 +0100 (CET) X-policyd-weight: IN_SBL_XBL_SPAMHAUS=4.35 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from pollux.denx.de (p4FF07062.dip.t-dialin.net [79.240.112.98]) by theia.denx.de (Postfix) with ESMTP id 144302809D for ; Tue, 15 Mar 2011 10:13:10 +0100 (CET) Received: by pollux.denx.de (Postfix, from userid 515) id 0C9551865EB51; Tue, 15 Mar 2011 10:04:17 +0100 (CET) From: Heiko Schocher To: u-boot@lists.denx.de Date: Tue, 15 Mar 2011 10:03:59 +0100 Message-Id: <1300179844-8951-17-git-send-email-hs@denx.de> X-Mailer: git-send-email 1.7.4 In-Reply-To: <1300179844-8951-1-git-send-email-hs@denx.de> References: <1299591018-8944-1-git-send-email-hs@denx.de> <1300179844-8951-1-git-send-email-hs@denx.de> In-Reply-To: <1299591018-8944-1-git-send-email-hs@denx.de> References: <1299591018-8944-1-git-send-email-hs@denx.de> Cc: Valentin Longchamp , Holger Brunck , Heiko Schocher , Luca Haab Subject: [U-Boot] [PATCH v2 16/21] arm, keymile: updates for the arm based boards from keymile X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.9 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 define KM_IVM_BUS and KM_ENV_BUS macros KM_IVM_BUS is used to define the EEprom_ivm environment variable. These macros allow the reuse of these I2C addresses in other code locations. remove unneeded code On first HW versions the BOCO FPGA was behind a MUX device. These HW versions are not supported anymore. And therefore this code can be removed. added LED initialization for SUEN3 The bootstat LED required to be initialized so to have a green colour after start-up. define CONFIG_SYS_TEXT_BASE This is needed by the relocation code and is not the same for our ARM BEC and thus needs to be defined. remove memsize variable An environment variable for memsize is not needed. this can be get via the board info struct. remove unneeded double access to bi_dram[i].size field Signed-off-by: Valentin Longchamp Signed-off-by: Holger Brunck Signed-off-by: Luca Haab Signed-off-by: Heiko Schocher cc: Prafulla Wadaskar --- Changes for v2: - fix checkpatch.pl errors and warnings board/keymile/km_arm/km_arm.c | 39 ++++++++++++++++++++++++++++++--------- include/configs/km_arm.h | 1 + include/configs/mgcoge2un.h | 6 ++++-- include/configs/suen3.h | 6 ++++-- include/configs/suen8.h | 6 ++++-- 5 files changed, 43 insertions(+), 15 deletions(-) diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c index 2ba1cbe..ba8f833 100644 --- a/board/keymile/km_arm/km_arm.c +++ b/board/keymile/km_arm/km_arm.c @@ -41,9 +41,6 @@ DECLARE_GLOBAL_DATA_PTR; -static int io_dev; -extern I2C_MUX_DEVICE *i2c_mux_ident_muxstring (uchar *buf); - /* Multi-Purpose Pins Functionality configuration */ u32 kwmpp_config[] = { MPP0_NF_IO2, @@ -111,7 +108,7 @@ int ethernet_present(void) int ret = 0; if (i2c_read(0x10, 2, 1, &buf, 1) != 0) { - printf ("%s: Error reading Boco\n", __FUNCTION__); + printf("%s: Error reading Boco\n", __func__); return -1; } if ((buf & 0x40) == 0x40) { @@ -120,15 +117,37 @@ int ethernet_present(void) return ret; } +int initialize_unit_leds(void) +{ + /* init the unit LEDs */ + /* per default they all are */ + /* ok apart from bootstat */ + /* LED connected through BOCO */ + /* BOCO lies at the address 0x10 */ + /* LEDs are in the block CTRL_H (addr 0x02) */ + /* BOOTSTAT LED is the first 0x01 */ + #define BOCO 0x10 + #define CTRL_H 0x02 + #define APPLEDMASK 0x01 + uchar buf; + + if (i2c_read(BOCO, CTRL_H, 1, &buf, 1) != 0) { + printf("%s: Error reading Boco\n", __func__); + return -1; + } + buf |= APPLEDMASK; + if (i2c_write(BOCO, CTRL_H, 1, &buf, 1) != 0) { + printf("%s: Error writing Boco\n", __func__); + return -1; + } + return 0; +} + int misc_init_r(void) { - I2C_MUX_DEVICE *i2cdev; char *str; int mach_type; - /* add I2C Bus for I/O Expander */ - i2cdev = i2c_mux_ident_muxstring((uchar *)"pca9554a:70:a"); - io_dev = i2cdev->busid; puts("Piggy:"); if (ethernet_present() == 0) puts (" not"); @@ -140,6 +159,9 @@ int misc_init_r(void) printf("Overwriting MACH_TYPE with %d!!!\n", mach_type); gd->bd->bi_arch_number = mach_type; } + + initialize_unit_leds(); + return 0; } @@ -246,7 +268,6 @@ void dram_init_banksize(void) for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) { gd->bd->bi_dram[i].start = kw_sdram_bar(i); - gd->bd->bi_dram[i].size = kw_sdram_bs(i); gd->bd->bi_dram[i].size = get_ram_size((long *)kw_sdram_bar(i), kw_sdram_bs(i)); } diff --git a/include/configs/km_arm.h b/include/configs/km_arm.h index 8b429a1..762f0cf 100644 --- a/include/configs/km_arm.h +++ b/include/configs/km_arm.h @@ -47,6 +47,7 @@ /* include common defines/options for all Keymile boards */ #include "keymile-common.h" +#define CONFIG_SYS_TEXT_BASE 0x04000000 /* code address after reloc */ #define CONFIG_ENV_SIZE (128 << 10) /* NAND chip block size */ #define CONFIG_SYS_MEMTEST_START 0x00400000 /* 4M */ #define CONFIG_SYS_MEMTEST_END 0x007fffff /*(_8M -1) */ diff --git a/include/configs/mgcoge2un.h b/include/configs/mgcoge2un.h index 9f5464b..d3c7bdc 100644 --- a/include/configs/mgcoge2un.h +++ b/include/configs/mgcoge2un.h @@ -44,12 +44,14 @@ #define CONFIG_HOSTNAME mgcoge2un +#define KM_IVM_BUS "pca9547:70:9" /* I2C2 (Mux-Port 1)*/ +#define KM_ENV_BUS "pca9547:70:d" /* I2C2 (Mux-Port 5)*/ + /* * Default environment variables */ #define CONFIG_EXTRA_ENV_SETTINGS \ CONFIG_KM_DEF_ENV \ - "memsize=0x8000000\0" \ "newenv=setenv addr 0x100000 && " \ "i2c dev 1; mw.b ${addr} 0 4 && " \ "eeprom write " xstr(CONFIG_SYS_DEF_EEPROM_ADDR) \ @@ -57,7 +59,7 @@ "eeprom write " xstr(CONFIG_SYS_DEF_EEPROM_ADDR) \ " ${addr} " xstr(CONFIG_ENV_OFFSET_REDUND) " 4\0" \ "rootpath=/opt/eldk/arm\0" \ - "EEprom_ivm=pca9547:70:9\0" \ + "EEprom_ivm=" KM_IVM_BUS "\0" \ "" #endif /* _CONFIG_MGCOGE2UN_H */ diff --git a/include/configs/suen3.h b/include/configs/suen3.h index 87f524a..2b6f19e 100644 --- a/include/configs/suen3.h +++ b/include/configs/suen3.h @@ -43,12 +43,14 @@ #define CONFIG_HOSTNAME suen3 +#define KM_IVM_BUS "pca9544a:70:9" /* I2C2 (Mux-Port 1)*/ +#define KM_ENV_BUS "pca9544a:70:d" /* I2C2 (Mux-Port 5)*/ + /* * Default environment variables */ #define CONFIG_EXTRA_ENV_SETTINGS \ CONFIG_KM_DEF_ENV \ - "memsize=0x8000000\0" \ "newenv=setenv addr 0x100000 && " \ "i2c dev 1; mw.b ${addr} 0 4 && " \ "eeprom write " xstr(CONFIG_SYS_DEF_EEPROM_ADDR) \ @@ -56,7 +58,7 @@ "eeprom write " xstr(CONFIG_SYS_DEF_EEPROM_ADDR) \ " ${addr} " xstr(CONFIG_ENV_OFFSET_REDUND) " 4\0" \ "rootpath=/opt/eldk/arm\0" \ - "EEprom_ivm=pca9544a:70:9\0" \ + "EEprom_ivm=" KM_IVM_BUS "\0" \ "" #endif /* _CONFIG_SUEN3_H */ diff --git a/include/configs/suen8.h b/include/configs/suen8.h index cdda4af..3f60bc3 100644 --- a/include/configs/suen8.h +++ b/include/configs/suen8.h @@ -44,12 +44,14 @@ #define CONFIG_HOSTNAME suen8 +#define KM_IVM_BUS "pca9544a:70:9" /* I2C2 (Mux-Port 1)*/ +#define KM_ENV_BUS "pca9544a:70:d" /* I2C2 (Mux-Port 5)*/ + /* * Default environment variables */ #define CONFIG_EXTRA_ENV_SETTINGS \ CONFIG_KM_DEF_ENV \ - "memsize=0x8000000\0" \ "newenv=setenv addr 0x100000 && " \ "i2c dev 1; mw.b ${addr} 0 4 && " \ "eeprom write " xstr(CONFIG_SYS_DEF_EEPROM_ADDR) \ @@ -57,7 +59,7 @@ "eeprom write " xstr(CONFIG_SYS_DEF_EEPROM_ADDR) \ " ${addr} " xstr(CONFIG_ENV_OFFSET_REDUND) " 4\0" \ "rootpath=/opt/eldk/arm\0" \ - "EEprom_ivm=pca9544a:70:9\0" \ + "EEprom_ivm=" KM_IVM_BUS "\0" \ "" #endif /* _CONFIG_SUEN8_H */