[U-Boot] [PATCH] Keymile boards mainlining, part 2

This series is the second effort of merging the Keymile boards support back into mainline.
Most of the patches are only keymile relevant and should only affect our boards.
There are also patches for the i2c deblocking support and cramfs for ARM.
The whole series is based on current denx-master with the our first patch series posted by Heiko that was reviewed previous weeks and should still be merged during the current merge window:
http://lists.denx.de/pipermail/u-boot/2011-April/089530.html
Heiko Schocher (5): lib, vsprintf: introduce strict_strtoul arm/km: add CRAMFS support for keymile boards cramfs: make cramfs usable without a NOR flash i2c, soft_i2c: deblock bus if switching to another i2c bus arm, powerpc, keymile boards: move keymile specific header in subdir
Holger Brunck (18): km/common: remove hdlc_enet implementation powerpc/km82xx: cleanup coding style for mgcoge.c powerpc/km82xx: rename mgcoge files to km82xx powerpc/km82xx: move SDRAM config to board config powerpc/km82xx: adapt CONFIG_SYSSYPCR to manual powerpc/km82xx: rename mgcoge2ne to mgcoge3ne board support poweprc/km82xx: add board specific environment variable arm/km: add addbootcount environment variable arm/km: remove last_stage_init and unneeded printouts arm/km: add second serial interface for kirkwood common/hush: make get_local_var visible for other users km/common: implement setboardid as a command km/common: add pnvramsize to default environment km/common: fix coding style issues in generic header km/common: simplify default environment arm/km: rename mgcoge2un to mgcoge3un arm/km: change default settings for egiga on mgcoge3un arm/km: update mgcoge3un board support
Huber, Andreas (1): powerpc/km82xx: add DIP switch detection
Stefan Bigler (1): i2c: add i2c deblock sequence before and after every mux config
Thomas Herzmann (2): km/common: fix initial_boot_bank for bootpackages km/common: replace env var checkboardidlist by function
Valentin Longchamp (3): arm/km: add mkimage config file for uart download arm/km: add BootROM config files for memphis SDRAM arm/km: disable ls (through jffs2 support)
MAINTAINERS | 4 +- board/keymile/common/common.c | 156 ++++++- board/keymile/common/common.h | 84 +++- board/keymile/common/keymile_hdlc_enet.c | 620 ------------------------ board/keymile/km82xx/Makefile | 53 ++ board/keymile/km82xx/km82xx.c | 373 ++++++++++++++ board/keymile/km_arm/km_arm.c | 93 +++- board/keymile/km_arm/kwbimage-memphis-uart.cfg | 197 ++++++++ board/keymile/km_arm/kwbimage-memphis.cfg | 197 ++++++++ board/keymile/km_arm/kwbimage-uart.cfg | 179 +++++++ board/keymile/mgcoge/Makefile | 54 -- board/keymile/mgcoge/mgcoge.c | 333 ------------- board/keymile/mgcoge/mgcoge_hdlc_enet.c | 276 ----------- board/keymile/scripts/README | 25 + board/keymile/scripts/debug-arm-env.txt | 2 + board/keymile/scripts/debug-common-env.txt | 9 + board/keymile/scripts/debug-ppc-env.txt | 2 + boards.cfg | 6 +- common/cmd_cramfs.c | 12 +- common/cmd_i2c.c | 12 + common/hush.c | 3 +- drivers/i2c/soft_i2c.c | 1 + drivers/net/mvgbe.h | 2 + fs/cramfs/cramfs.c | 4 + include/_exports.h | 1 + include/common.h | 1 + include/configs/keymile-common.h | 455 ----------------- include/configs/km-powerpc.h | 92 ---- include/configs/km/keymile-common.h | 328 +++++++++++++ include/configs/km/km-powerpc.h | 88 ++++ include/configs/km/km82xx-common.h | 311 ++++++++++++ include/configs/km/km8321-common.h | 137 ++++++ include/configs/km/km83xx-common.h | 325 +++++++++++++ include/configs/km/km_arm.h | 275 +++++++++++ include/configs/km82xx-common.h | 336 ------------- include/configs/km8321-common.h | 137 ------ include/configs/km83xx-common.h | 325 ------------- include/configs/km_arm.h | 266 ---------- include/configs/kmeter1.h | 2 +- include/configs/kmsupx5.h | 2 +- include/configs/mgcoge.h | 35 ++- include/configs/mgcoge2ne.h | 64 --- include/configs/mgcoge2un.h | 65 --- include/configs/mgcoge3ne.h | 97 ++++ include/configs/mgcoge3un.h | 90 ++++ include/configs/suen3.h | 2 +- include/configs/suen8.h | 2 +- include/configs/suvd3.h | 2 +- include/configs/tuda1.h | 2 +- include/configs/tuxa1.h | 2 +- include/exports.h | 1 + include/hush.h | 1 + include/i2c.h | 2 - lib/vsprintf.c | 47 ++ 54 files changed, 3111 insertions(+), 3079 deletions(-) delete mode 100644 board/keymile/common/keymile_hdlc_enet.c create mode 100644 board/keymile/km82xx/Makefile create mode 100644 board/keymile/km82xx/km82xx.c create mode 100644 board/keymile/km_arm/kwbimage-memphis-uart.cfg create mode 100644 board/keymile/km_arm/kwbimage-memphis.cfg create mode 100644 board/keymile/km_arm/kwbimage-uart.cfg delete mode 100644 board/keymile/mgcoge/Makefile delete mode 100644 board/keymile/mgcoge/mgcoge.c delete mode 100644 board/keymile/mgcoge/mgcoge_hdlc_enet.c create mode 100644 board/keymile/scripts/README create mode 100644 board/keymile/scripts/debug-arm-env.txt create mode 100644 board/keymile/scripts/debug-common-env.txt create mode 100644 board/keymile/scripts/debug-ppc-env.txt delete mode 100644 include/configs/keymile-common.h delete mode 100644 include/configs/km-powerpc.h create mode 100644 include/configs/km/keymile-common.h create mode 100644 include/configs/km/km-powerpc.h create mode 100644 include/configs/km/km82xx-common.h create mode 100644 include/configs/km/km8321-common.h create mode 100644 include/configs/km/km83xx-common.h create mode 100644 include/configs/km/km_arm.h delete mode 100644 include/configs/km82xx-common.h delete mode 100644 include/configs/km8321-common.h delete mode 100644 include/configs/km83xx-common.h delete mode 100644 include/configs/km_arm.h delete mode 100644 include/configs/mgcoge2ne.h delete mode 100644 include/configs/mgcoge2un.h create mode 100644 include/configs/mgcoge3ne.h create mode 100644 include/configs/mgcoge3un.h

From: Heiko Schocher hs@denx.de
as checkpatch proposes to use strict_strtoul instead of simple_strtoul, introduce it.
Signed-off-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de cc: Valentin Longchamp valentin.longchamp@keymile.com cc: Holger Brunck holger.brunck@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com --- include/_exports.h | 1 + include/common.h | 1 + include/exports.h | 1 + lib/vsprintf.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 50 insertions(+), 0 deletions(-)
diff --git a/include/_exports.h b/include/_exports.h index d89b65b..349a3c5 100644 --- a/include/_exports.h +++ b/include/_exports.h @@ -19,6 +19,7 @@ EXPORT_FUNC(do_reset) EXPORT_FUNC(getenv) EXPORT_FUNC(setenv) EXPORT_FUNC(simple_strtoul) +EXPORT_FUNC(strict_strtoul) EXPORT_FUNC(simple_strtol) EXPORT_FUNC(strcmp) EXPORT_FUNC(i2c_write) diff --git a/include/common.h b/include/common.h index 49c884c..d180da2 100644 --- a/include/common.h +++ b/include/common.h @@ -648,6 +648,7 @@ void udelay (unsigned long);
/* lib/vsprintf.c */ ulong simple_strtoul(const char *cp,char **endp,unsigned int base); +int strict_strtoul(const char *cp, unsigned int base, unsigned long *res); unsigned long long simple_strtoull(const char *cp,char **endp,unsigned int base); long simple_strtol(const char *cp,char **endp,unsigned int base); void panic(const char *fmt, ...) diff --git a/include/exports.h b/include/exports.h index 6382311..2f49cea 100644 --- a/include/exports.h +++ b/include/exports.h @@ -20,6 +20,7 @@ void __udelay(unsigned long); unsigned long get_timer(unsigned long); int vprintf(const char *, va_list); unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base); +int strict_strtoul(const char *cp, unsigned int base, unsigned long *res); char *getenv (char *name); int setenv (char *varname, char *varvalue); long simple_strtol(const char *cp,char **endp,unsigned int base); diff --git a/lib/vsprintf.c b/lib/vsprintf.c index 61e6f0d..0eda799 100644 --- a/lib/vsprintf.c +++ b/lib/vsprintf.c @@ -13,6 +13,7 @@ #include <linux/types.h> #include <linux/string.h> #include <linux/ctype.h> +#include <errno.h>
#include <common.h> #if !defined (CONFIG_PANIC_HANG) @@ -61,6 +62,52 @@ unsigned long simple_strtoul(const char *cp,char **endp,unsigned int base) return result; }
+/** + * strict_strtoul - convert a string to an unsigned long strictly + * @cp: The string to be converted + * @base: The number base to use + * @res: The converted result value + * + * strict_strtoul converts a string to an unsigned long only if the + * string is really an unsigned long string, any string containing + * any invalid char at the tail will be rejected and -EINVAL is returned, + * only a newline char at the tail is acceptible because people generally + * change a module parameter in the following way: + * + * echo 1024 > /sys/module/e1000/parameters/copybreak + * + * echo will append a newline to the tail. + * + * It returns 0 if conversion is successful and *res is set to the converted + * value, otherwise it returns -EINVAL and *res is set to 0. + * + * simple_strtoul just ignores the successive invalid characters and + * return the converted value of prefix part of the string. + */ +int strict_strtoul(const char *cp, unsigned int base, unsigned long *res) +{ + char *tail; + unsigned long val; + size_t len; + + *res = 0; + len = strlen(cp); + if (len == 0) + return -EINVAL; + + val = simple_strtoul(cp, &tail, base); + if (tail == cp) + return -EINVAL; + + if ((*tail == '\0') || + ((len == (size_t)(tail - cp) + 1) && (*tail == '\n'))) { + *res = val; + return 0; + } + + return -EINVAL; +} + long simple_strtol(const char *cp,char **endp,unsigned int base) { if(*cp=='-')

Dear Valentin Longchamp,
In message e0c1c0de6c89e3723ac3d1874ce4819a4a47c8f2.1302266367.git.valentin.longchamp@keymile.com you wrote:
From: Heiko Schocher hs@denx.de
as checkpatch proposes to use strict_strtoul instead of simple_strtoul, introduce it.
Signed-off-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de cc: Valentin Longchamp valentin.longchamp@keymile.com cc: Holger Brunck holger.brunck@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com
include/_exports.h | 1 + include/common.h | 1 + include/exports.h | 1 + lib/vsprintf.c | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 50 insertions(+), 0 deletions(-)
It appears this code was copied from Linux, so please provide proper attribution and reference; please see bullet # 4 at http://www.denx.de/wiki/view/U-Boot/Patches#Attributing_Code_Copyrights_Sign
Best regards,
Wolfgang Denk

From: Huber, Andreas Andreas.Huber@keymile.com
This reads the DIP switch register in the BFTICU (0x40000089). If 'Full reset' or 'DB erase' is selected, 'actual_bank' is set to 0. This loads the Bootloader application who does the erase stuff. To access the register a struct for the bfticu I/O map was added to common.h.
Signed-off-by: Andreas Huber andreas.huber@keymile.com Signed-off-by: Holger Brunck holger.brunck@keymile.com Acked-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de cc: Valentin Longchamp valentin.longchamp@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com --- board/keymile/common/common.h | 79 +++++++++++++++++++++++++++++++++++++++++ board/keymile/mgcoge/mgcoge.c | 12 ++++++ 2 files changed, 91 insertions(+), 0 deletions(-)
diff --git a/board/keymile/common/common.h b/board/keymile/common/common.h index 099de98..cdc35b6 100644 --- a/board/keymile/common/common.h +++ b/board/keymile/common/common.h @@ -39,6 +39,85 @@ struct km_bec_fpga { unsigned char pgy_eth; };
+#define BFTICU_DIPSWITCH_MASK 0x0f + +/* + * BFTICU FPGA iomap + * BFTICU is used on mgcoge and mgocge3ne + */ +struct bfticu_iomap { + u8 xi_ena; /* General defect enable */ + u8 pack1[3]; + u8 en_csn; + u8 pack2; + u8 safe_mem; + u8 pack3; + u8 id; + u8 pack4; + u8 rev; + u8 build; + u8 p_frc; + u8 p_msk; + u8 pack5[2]; + u8 xg_int; + u8 pack6[15]; + u8 s_conf; + u8 pack7; + u8 dmx_conf12; + u8 pack8; + u8 s_clkslv; + u8 pack9[11]; + u8 d_conf; + u8 d_mask_ca; + u8 d_pll_del; + u8 pack10[16]; + u8 t_conf_ca; + u8 t_mask_ca; + u8 pack11[13]; + u8 m_def0; + u8 m_def1; + u8 m_def2; + u8 m_def3; + u8 m_def4; + u8 m_def5; + u8 m_def_trap0; + u8 m_def_trap1; + u8 m_def_trap2; + u8 m_def_trap3; + u8 m_def_trap4; + u8 m_def_trap5; + u8 m_mask_def0; + u8 m_mask_def1; + u8 m_mask_def2; + u8 m_mask_def3; + u8 m_mask_def4; + u8 m_mask_def5; + u8 m_def_mask0; + u8 m_def_mask1; + u8 m_def_mask2; + u8 m_def_mask3; + u8 m_def_mask4; + u8 m_def_mask5; + u8 m_def_pri; + u8 pack12[11]; + u8 hw_status; + u8 pack13; + u8 hw_control1; + u8 hw_control2; + u8 hw_control3; + u8 pack14[7]; + u8 led_on; /* Leds */ + u8 pack15; + u8 sfp_control; /* SFP modules */ + u8 pack16; + u8 alarm_control; /* Alarm output */ + u8 pack17; + u8 icps; /* ICN clock pulse shaping */ + u8 mswitch; /* Read mode switch */ + u8 pack18[6]; + u8 pb_dbug; +}; + #if !defined(CONFIG_PIGGY_MAC_ADRESS_OFFSET) #define CONFIG_PIGGY_MAC_ADRESS_OFFSET 0 #endif diff --git a/board/keymile/mgcoge/mgcoge.c b/board/keymile/mgcoge/mgcoge.c index 340016b..11a0f79 100644 --- a/board/keymile/mgcoge/mgcoge.c +++ b/board/keymile/mgcoge/mgcoge.c @@ -315,6 +315,18 @@ int board_early_init_r(void)
int last_stage_init(void) { + struct bfticu_iomap *base = + (struct bfticu_iomap *)CONFIG_SYS_FPGA_BASE; + u8 dip_switch; + + dip_switch = in_8(&base->mswitch); + dip_switch &= BFTICU_DIPSWITCH_MASK; + /* dip switch 'full reset' or 'db erase' */ + if (dip_switch & 0x1 || dip_switch & 0x2) { + /* start bootloader */ + puts("DIP: Enabled\n"); + setenv("actual_bank", "0"); + } set_km_env(); return 0; }

From: Holger Brunck holger.brunck@keymile.com
The hdlc implementation for mgcoge was initially developed, but later on not used. Remove the C files, the references in mgcoge.c and the Makefile to decrease maintenance effort.
Signed-off-by: Holger Brunck holger.brunck@keymile.com Acked-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de cc: Valentin Longchamp valentin.longchamp@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com --- board/keymile/common/common.c | 3 - board/keymile/common/common.h | 4 - board/keymile/common/keymile_hdlc_enet.c | 620 ------------------------------ board/keymile/mgcoge/Makefile | 3 +- board/keymile/mgcoge/mgcoge_hdlc_enet.c | 276 ------------- 5 files changed, 1 insertions(+), 905 deletions(-) delete mode 100644 board/keymile/common/keymile_hdlc_enet.c delete mode 100644 board/keymile/mgcoge/mgcoge_hdlc_enet.c
diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c index 3908e63..b113c0a 100644 --- a/board/keymile/common/common.c +++ b/board/keymile/common/common.c @@ -677,9 +677,6 @@ int ethernet_present(void)
int board_eth_init(bd_t *bis) { -#ifdef CONFIG_KEYMILE_HDLC_ENET - (void)keymile_hdlc_enet_initialize(bis); -#endif if (ethernet_present()) return cpu_eth_init(bis);
diff --git a/board/keymile/common/common.h b/board/keymile/common/common.h index cdc35b6..6ce992a 100644 --- a/board/keymile/common/common.h +++ b/board/keymile/common/common.h @@ -125,10 +125,6 @@ struct bfticu_iomap { int ethernet_present(void); int ivm_read_eeprom(void);
-#ifdef CONFIG_KEYMILE_HDLC_ENET -int keymile_hdlc_enet_initialize(bd_t *bis); -#endif - int set_km_env(void); int fdt_set_node_and_value(void *blob, char *nodename, diff --git a/board/keymile/common/keymile_hdlc_enet.c b/board/keymile/common/keymile_hdlc_enet.c deleted file mode 100644 index a545211..0000000 --- a/board/keymile/common/keymile_hdlc_enet.c +++ /dev/null @@ -1,620 +0,0 @@ -/* - * (C) Copyright 2008 - * Gary Jennejohn, DENX Software Engineering GmbH, garyj@denx.de. - * - * Based in part on arch/powerpc/cpu/mpc8260/ether_scc.c. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -#include <common.h> -#include <malloc.h> -#include <net.h> - -#ifdef CONFIG_KEYMILE_HDLC_ENET -#ifdef TEST_IT -#include <command.h> -#endif - -#include "keymile_hdlc_enet.h" - -extern char keymile_slot; /* our slot number in the backplane */ - -/* Allow up to about 50 ms for sending */ -#define TOUT_LOOP 50000 - -/* - * Since, except during initialization, ethact is always HDLC - * while we're in the driver, just use serial_printf() everywhere for - * output. This avoids possible conflicts when netconsole is being - * used. - */ -#define dprintf(fmt, args...) serial_printf(fmt, ##args) - -/* Cannot use the storage from net.c because we allocate larger buffers */ -static volatile uchar MyPktBuf[HDLC_PKTBUFSRX * PKT_MAXBLR_SIZE + PKTALIGN]; -static volatile uchar *MyRxPackets[HDLC_PKTBUFSRX]; /* Receive packet */ - -static unsigned int keymile_rxIdx; /* index of the current RX buffer */ - -static IPaddr_t cachedNumbers[CACHEDNUMBERS]; /* 4 bytes per entry */ -void initCachedNumbers(int); - -/* - * SCC Ethernet Tx and Rx buffer descriptors allocated at the - * immr->udata_bd address on Dual-Port RAM - * Provide for Double Buffering - */ -typedef volatile struct CommonBufferDescriptor { - cbd_t txbd; /* Tx BD */ - cbd_t rxbd[HDLC_PKTBUFSRX]; /* Rx BD */ -} RTXBD; - -/* - * This must be extern because it is allocated in DPRAM using CPM-sepcific - * code. - */ -static RTXBD *rtx; - -static int keymile_hdlc_enet_send(struct eth_device *, volatile void *, int); -static int keymile_hdlc_enet_recv(struct eth_device *); -void keymile_hdlc_enet_init_bds(RTXBD *); -extern int keymile_hdlc_enet_init(struct eth_device *, bd_t *); -extern void keymile_hdlc_enet_halt(struct eth_device *); - -/* flags in the buffer descriptor not defined anywhere else */ -#define BD_SC_CT BD_SC_CD -#define BD_SC_CR 0x04 -#define BD_SC_DE 0x80 -#ifndef BD_SC_TC -#define BD_SC_TC ((ushort)0x0400) /* Transmit CRC */ -#endif -#define BD_SC_FIRST BD_SC_TC -#define BD_SC_STATS (BD_SC_BR | BD_SC_FR | BD_SC_PR | BD_SC_CR | BD_SC_CD \ - | BD_SC_OV | BD_SC_DE) - -#if defined(TEST_RX) || defined(TEST_TX) || defined(TEST_IT) -static void hexdump(unsigned char *buf, int len) -{ - int i; - const int bytesPerLine = 32; - - if (len > 4 * bytesPerLine) - len = 4 * bytesPerLine; - dprintf("\t address: %08x\n", (unsigned int)buf); - for (i = 0; i < len; i++) { - if (i % bytesPerLine == 0) - dprintf("%04x: ", (unsigned short)i); - dprintf("%02x ", buf[i]); - if ((i + 1) % bytesPerLine == 0) { - dprintf("\n"); - continue; - } - if ((i + 1) % 8 == 0) - printf(" "); - } - if (len % bytesPerLine) - dprintf("\n"); -} -#endif - -int keymile_hdlc_enet_initialize(bd_t *bis) -{ - struct eth_device *dev; - - dev = (struct eth_device *) malloc(sizeof *dev); - memset(dev, 0, sizeof *dev); -#ifdef TEST_IT - seth = dev; -#endif - - sprintf(dev->name, "HDLC"); - dev->init = keymile_hdlc_enet_init; - dev->halt = keymile_hdlc_enet_halt; - dev->send = keymile_hdlc_enet_send; - dev->recv = keymile_hdlc_enet_recv; - - eth_register(dev); - - return 1; -} - -/* - * This is called from the board-specific driver after rtx is allocated. - */ -void keymile_hdlc_enet_init_bds(RTXBD *board_rtx) -{ - volatile cbd_t *bdp; - int i; - - rtx = board_rtx; - keymile_rxIdx = 0; - /* - * Initialize the buffer descriptors. - */ - bdp = &rtx->txbd; - bdp->cbd_sc = 0; - bdp->cbd_bufaddr = 0; - bdp->cbd_sc = BD_SC_WRAP; - - /* - * Setup RX packet buffers, aligned correctly. - * Borrowed from net/net.c. - */ - MyRxPackets[0] = &MyPktBuf[0] + (PKTALIGN - 1); - MyRxPackets[0] -= (ulong)MyRxPackets[0] % PKTALIGN; - for (i = 1; i < HDLC_PKTBUFSRX; i++) - MyRxPackets[i] = MyRxPackets[0] + i * PKT_MAXBLR_SIZE; - - bdp = &rtx->rxbd[0]; - for (i = 0; i < HDLC_PKTBUFSRX; i++) { - bdp->cbd_sc = BD_SC_EMPTY; - /* Leave space at the start for INET header. */ - bdp->cbd_bufaddr = (unsigned int)(MyRxPackets[i] + - INET_HDR_ALIGN); - bdp++; - } - bdp--; - bdp->cbd_sc |= BD_SC_WRAP; -} - -/* - * This returns the current port number for NETCONSOLE. If nc_port - * in netconsole.c weren't declared static we wouldn't need this. - */ -static short get_netcons_port(void) -{ - char *p; - short nc_port; - - nc_port = 6666; /* default */ - - p = getenv("ncip"); - if (p != NULL) { - p = strchr(p, ':'); - if (p != NULL) - nc_port = simple_strtoul(p + 1, NULL, 10); - } - - return htons(nc_port); -} - -/* - * Read the port numbers from the variables - */ -void initCachedNumbers(int verbose) -{ - char *str; - ushort port; - - /* already in network order */ - cachedNumbers[IP_ADDR] = getenv_IPaddr("ipaddr"); - /* already in network order */ - cachedNumbers[IP_SERVER] = getenv_IPaddr("serverip"); - str = getenv("tftpsrcp"); - if (str != NULL) { - /* avoid doing htons() again and again */ - port = htons((ushort)simple_strtol(str, NULL, 10)); - cachedNumbers[TFTP_SRC_PORT] = port; - } else - /* this can never be a valid port number */ - cachedNumbers[TFTP_SRC_PORT] = (ulong)-1; - str = getenv("tftpdstp"); - if (str != NULL) { - /* avoid doing htons() again and again */ - port = htons((ushort)simple_strtol(str, NULL, 10)); - cachedNumbers[TFTP_DST_PORT] = port; - } else - /* this is the default value */ - cachedNumbers[TFTP_DST_PORT] = htons(WELL_KNOWN_PORT); - /* already in network order */ - cachedNumbers[NETCONS_PORT] = get_netcons_port(); - if (verbose) { - dprintf("\nIP Number Initialization:\n"); - dprintf(" ip address %08lx\n", cachedNumbers[IP_ADDR]); - dprintf(" server ip address %08lx\n", - cachedNumbers[IP_SERVER]); - dprintf(" tftp client port %ld\n", - cachedNumbers[TFTP_SRC_PORT]); - dprintf(" tftp server port %ld\n", - cachedNumbers[TFTP_DST_PORT]); - dprintf(" netcons port %ld\n", - cachedNumbers[NETCONS_PORT]); - dprintf(" slot number (hex) %02x\n", keymile_slot); - } -} - -static void keymile_hdlc_enet_doarp(volatile void *packet, int len) -{ - ARP_t *arp; - IPaddr_t src_ip; /* U-Boot's IP */ - IPaddr_t dest_ip; /* the mgcoge's IP */ - unsigned char *packet_copy = malloc(len); - - /* - * Handling an ARP request means that a new transfer has started. - * Update our cached parameters now. - */ - initCachedNumbers(0); /* may reinit port numbers */ - - /* special handling required for ARP */ - arp = (ARP_t *)(packet + ETHER_HDR_SIZE); - /* - * XXXX - * This is pretty dirty! NetReceive only uses - * a few fields when handling an ARP reply, so - * we only modify those here. This could - * result in catastrophic failure at a later - * time if the handler is modified! - */ - arp->ar_op = htons(ARPOP_REPLY); - /* save his/our IP */ - src_ip = NetReadIP(&arp->ar_data[6]); - dest_ip = NetReadIP(&arp->ar_data[16]); - /* copy target IP to source IP */ - NetCopyIP(&arp->ar_data[6], &dest_ip); - /* copy our IP to the right place */ - NetCopyIP(&arp->ar_data[16], &src_ip); - /* always use 0x7f as the MAC for the coge */ - arp->ar_data[0] = HDLC_UACUA; - /* - * copy the packet - * if NetReceive wants to write to stdout, it may overwrite packet - * especially if stdout is set to nc! - * - * However, if the malloc() above fails then we can still try the - * original packet, rather than causing the transfer to fail. - */ - if (packet_copy != NULL) { - memcpy(packet_copy, (char *)packet, len); - NetReceive(packet_copy, len); - free(packet_copy); - } else - NetReceive(packet, len); -} - -/* - * NOTE all callers ignore the returned value! - * At the moment this only handles ARP Requests, TFTP and NETCONSOLE. - */ -static int keymile_hdlc_enet_send(struct eth_device *dev, volatile void *packet, - int len) -{ - int j; - uint data_addr; - int data_len; - struct icn_hdr header; - struct icn_frame *frame; - Ethernet_t *et; - ARP_t *arp; - IP_t *ip; - - if (len > (MAX_FRAME_LENGTH - sizeof(header))) - return -1; - - frame = NULL; - et = NULL; - arp = NULL; - ip = NULL; - - j = 0; - while ((rtx->txbd.cbd_sc & BD_SC_READY) && (j < TOUT_LOOP)) { - /* will also trigger Wd if needed, but maybe too often */ - udelay(1); - j++; - } - if (j >= TOUT_LOOP) { - dprintf("TX not ready sc %x\n", rtx->txbd.cbd_sc); - return -1; - } - - /* - * First check for an ARP Request since this requires special handling. - */ - if (len >= (ARP_HDR_SIZE + ETHER_HDR_SIZE)) { - et = (Ethernet_t *)packet; - arp = (ARP_t *)(((char *)et) + ETHER_HDR_SIZE); - /* ARP and REQUEST? */ - if (et->et_protlen == PROT_ARP && - arp->ar_op == htons(ARPOP_REQUEST)) { - /* just short-circuit the request on the U-Boot side */ - keymile_hdlc_enet_doarp(packet, len); - return 0; - } - } - - /* - * GJ - I suppose the assumption here that len will always be - * > INET_HDR_SIZE is alright as long as the network stack - * isn't changed. - * Do not send INET header. - */ - data_len = len + sizeof(header) - INET_HDR_SIZE; - frame = (struct icn_frame *) (((char *)packet) + INET_HDR_SIZE - - sizeof(header)); - -#ifdef TEST_TX - printf("frame: %08x, ", frame); - hexdump((unsigned char *)packet, data_len + INET_HDR_SIZE); -#endif - - data_addr = (uint)frame; - if (len >= (IP_HDR_SIZE + ETHER_HDR_SIZE)) - ip = (IP_t *)(packet + ETHER_HDR_SIZE); - /* Is it TFTP? TFTP always uses UDP and the cached dport */ - if (ip != NULL && ip->ip_p == IPPROTO_UDP && ip->udp_dst == - (ushort)cachedNumbers[TFTP_DST_PORT]) { - /* just in case the port wasn't set in the environment */ - if (cachedNumbers[TFTP_SRC_PORT] == (ulong)-1) - cachedNumbers[TFTP_SRC_PORT] = ip->udp_src; - frame->hdr.application = MGS_TFTP; - } - /* - * Is it NETCONSOLE? NETCONSOLE always uses UDP. - */ - else if (ip != NULL && ip->ip_p == IPPROTO_UDP - && ip->udp_dst == (ushort)cachedNumbers[NETCONS_PORT]) { - frame->hdr.application = MGS_NETCONS; - } else { - /* reject unknown packets */ - /* may do some check on frame->hdr.application */ - dprintf("Unknown packet type in %s, rejected\n", - __func__); - return -1; - } - /* - * Could extract the target's slot ID from its MAC here, - * but u-boot only wants to talk to the active server. - * - * avoid setting new source address when moving to another slot - */ - frame->hdr.src_addr = keymile_slot; - frame->hdr.dest_addr = HDLC_UACUA; -#ifdef TEST_TX - { - dprintf("TX: "); - hexdump((unsigned char *)data_addr, data_len); - } -#endif - - flush_cache(data_addr, data_len); - rtx->txbd.cbd_bufaddr = data_addr; - rtx->txbd.cbd_datlen = data_len; - rtx->txbd.cbd_sc |= (BD_SC_READY | BD_SC_TC | BD_SC_LAST | BD_SC_WRAP); - - while ((rtx->txbd.cbd_sc & BD_SC_READY) && (j < TOUT_LOOP)) { - /* will also trigger Wd if needed, but maybe too often */ - udelay(1); - j++; - } - if (j >= TOUT_LOOP) - dprintf("TX timeout\n"); -#ifdef ET_DEBUG - dprintf("cycles: %d status: %x\n", j, rtx->txbd.cbd_sc); -#endif - j = (rtx->txbd.cbd_sc & BD_SC_STATS); /* return only status bits */ - return j; -} - -/* - * During a receive, the RxIdx points to the current incoming buffer. - * When we update through the ring, if the next incoming buffer has - * not been given to the system, we just set the empty indicator, - * effectively tossing the packet. - */ -static int keymile_hdlc_enet_recv(struct eth_device *dev) -{ - int length; - unsigned char app; - struct icn_frame *fp; - Ethernet_t *ep; - IP_t *ip; - - for (;;) { - if (rtx->rxbd[keymile_rxIdx].cbd_sc & BD_SC_EMPTY) { - length = -1; - break; /* nothing received - leave for() loop */ - } - - length = rtx->rxbd[keymile_rxIdx].cbd_datlen; -#ifdef TEST_RX - dprintf("packet %d bytes long\n", length); -#endif - - /* - * BD_SC_BR -> LG bit - * BD_SC_FR -> NO bit - * BD_SC_PR -> AB bit - * BD_SC_NAK -> CR bit - * 0x80 -> DE bit - */ - if (rtx->rxbd[keymile_rxIdx].cbd_sc & BD_SC_STATS) { -#ifdef ET_DEBUG - dprintf("err: %x\n", rtx->rxbd[keymile_rxIdx].cbd_sc); -#endif - } else if (length > MAX_FRAME_LENGTH) { /* can't happen */ -#ifdef ET_DEBUG - dprintf("err: packet too big\n"); -#endif - } else { - fp = (struct icn_frame *)(MyRxPackets[keymile_rxIdx] + - INET_HDR_ALIGN - INET_HDR_SIZE); -#ifdef TEST_RX - dprintf("RX %d: ", keymile_rxIdx); - hexdump((unsigned char *)MyRxPackets[keymile_rxIdx], - INET_HDR_ALIGN + INET_HDR_SIZE + 4); -#endif - /* copy icn header to the beginning */ - memcpy(fp, ((char *)fp + INET_HDR_SIZE), - sizeof(struct icn_hdr)); - app = fp->hdr.application; - if (app == MGS_NETCONS || app == MGS_TFTP) { - struct icn_hdr *ih = &fp->hdr; - unsigned char icn_src_addr = ih->src_addr; - unsigned char icn_dest_addr = ih->dest_addr; - - /* - * expand header by INET_HDR_SIZE - */ - length += INET_HDR_SIZE; - /* initalize header */ - memset((char *)fp->data, 0x00, INET_HDR_SIZE); - ep = (Ethernet_t *)fp->data; - /* set MACs */ - ep->et_dest[0] = icn_dest_addr; - ep->et_src[0] = icn_src_addr; - ep->et_protlen = htons(PROT_IP); - /* set ip stuff */ - ip = (IP_t *)(fp->data + ETHER_HDR_SIZE); - /* set ip addresses */ - ip->ip_src = cachedNumbers[IP_SERVER]; - ip->ip_dst = cachedNumbers[IP_ADDR]; - /* ip length */ - ip->ip_len = htons(length - ETHER_HDR_SIZE - - REMOVE); - /* ip proto */ - ip->ip_p = IPPROTO_UDP; - switch (app) { - case MGS_TFTP: - /* swap src/dst port numbers */ - ip->udp_src = (ushort) - cachedNumbers[TFTP_DST_PORT]; - ip->udp_dst = (ushort) - cachedNumbers[TFTP_SRC_PORT]; - ip->udp_len = ip->ip_len - - IP_HDR_SIZE_NO_UDP; - ip->udp_xsum = 0; - break; - case MGS_NETCONS: - ip->udp_src = (ushort) - cachedNumbers[NETCONS_PORT]; - /* - * in drivers/net/netconsole.c src port - * equals dest port - */ - ip->udp_dst = ip->udp_src; - ip->udp_len = ip->ip_len - - IP_HDR_SIZE_NO_UDP; - ip->udp_xsum = 0; - break; - } - /* ip version */ - ip->ip_hl_v = (0x40) | (0x0f & - (IP_HDR_SIZE_NO_UDP / 4)); - ip->ip_tos = 0; - ip->ip_id = 0; - /* flags, fragment offset */ - ip->ip_off = htons(0x4000); - ip->ip_ttl = 255; /* time to live */ - /* have to fixup the checksum */ - ip->ip_sum = ~NetCksum((uchar *)ip, - IP_HDR_SIZE_NO_UDP / 2); - /* - * Pass the packet up to the protocol layers - * but remove dest_addr, src_addr, application - * and the CRC. - */ -#ifdef TEST_RX - hexdump((unsigned char *)fp->data, - INET_HDR_SIZE + 4); -#endif - NetReceive(fp->data, length - REMOVE); - } else { - /* - * the other application types are not yet - * supported by u-boot. - */ - /* normally drop it */ -#ifdef TEST_NO - /* send it anyway */ - fp = (struct icn_frame *) - (MyRxPackets[keymile_rxIdx] + - INET_HDR_ALIGN); - NetReceive(fp->data, length - REMOVE); -#endif - } - } - - /* Give the buffer back to the SCC. */ - rtx->rxbd[keymile_rxIdx].cbd_datlen = 0; - - /* wrap around buffer index when necessary */ - if ((keymile_rxIdx + 1) >= HDLC_PKTBUFSRX) { - rtx->rxbd[HDLC_PKTBUFSRX - 1].cbd_sc = - (BD_SC_WRAP | BD_SC_EMPTY); - keymile_rxIdx = 0; - } else { - rtx->rxbd[keymile_rxIdx].cbd_sc = BD_SC_EMPTY; - keymile_rxIdx++; - } - } - return length; -} - -#ifdef TEST_IT -/* simple send test routine */ -int hdlc_enet_stest(struct cmd_tbl_s *a, int b, int c, char **d) -{ - unsigned char pkt[2]; - int ret; - - dprintf("enter stest\n"); - /* may have to initialize things */ - if (seth->state != ETH_STATE_ACTIVE) { - /* the bd_t* is not used */ - if (seth->init(seth, NULL) >= 0) - seth->state = ETH_STATE_ACTIVE; - } - pkt[0] = 0xea; - pkt[1] = 0xae; - ret = keymile_hdlc_enet_send(seth, pkt, 2); - dprintf("return from send %x\n", ret); - dprintf("exit stest\n"); - return ret; -} -U_BOOT_CMD( - stest, 1, 1, hdlc_enet_stest, - "simple send test for hdlc_enet", - "" -); -/* simple receive test routine */ -int hdlc_enet_rtest(struct cmd_tbl_s *a, int b, int c, char **d) -{ - int ret; - - dprintf("enter rtest\n"); - /* may have to initialize things */ - if (seth->state != ETH_STATE_ACTIVE) { - /* the bd_t* is not used */ - if (seth->init(seth, NULL) >= 0) - seth->state = ETH_STATE_ACTIVE; - } - ret = keymile_hdlc_enet_recv(seth); - dprintf("return from recv %x\n", ret); - dprintf("exit rtest\n"); - return ret; -} -U_BOOT_CMD( - rtest, 1, 1, hdlc_enet_rtest, - "simple receive test for hdlc_enet", - "" -); -#endif - -#endif /* CONFIG_KEYMILE_HDLC_ENET */ diff --git a/board/keymile/mgcoge/Makefile b/board/keymile/mgcoge/Makefile index 3308621..a2b9da4 100644 --- a/board/keymile/mgcoge/Makefile +++ b/board/keymile/mgcoge/Makefile @@ -28,8 +28,7 @@ endif
LIB = $(obj)lib$(BOARD).o
-COBJS := $(BOARD).o ../common/common.o ../common/keymile_hdlc_enet.o \ - mgcoge_hdlc_enet.o +COBJS := $(BOARD).o ../common/common.o
SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS)) diff --git a/board/keymile/mgcoge/mgcoge_hdlc_enet.c b/board/keymile/mgcoge/mgcoge_hdlc_enet.c deleted file mode 100644 index 98f68a6..0000000 --- a/board/keymile/mgcoge/mgcoge_hdlc_enet.c +++ /dev/null @@ -1,276 +0,0 @@ -/* - * (C) Copyright 2008 - * Gary Jennejohn, DENX Software Engineering GmbH, garyj@denx.de. - * - * Based in part on arch/powerpc/cpu/mpc8260/ether_scc.c. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -#include <common.h> -#include <malloc.h> -#include <net.h> - -#ifdef CONFIG_KEYMILE_HDLC_ENET - -#include "../common/keymile_hdlc_enet.h" - -char keymile_slot; /* our slot number in the backplane */ - -/* - * Since, except during initialization, ethact is always HDLC ETHERNET - * while we're in the driver, just use serial_printf() everywhere for - * output. This avoids possible conflicts when netconsole is being - * used. - */ -#define dprintf(fmt, args...) serial_printf(fmt, ##args) - -static int already_inited; - -/* - * SCC Ethernet Tx and Rx buffer descriptors allocated at the - * immr->udata_bd address on Dual-Port RAM - * Provide for Double Buffering - */ -typedef volatile struct CommonBufferDescriptor { - cbd_t txbd; /* Tx BD */ - cbd_t rxbd[HDLC_PKTBUFSRX]; /* Rx BD */ -} RTXBD; - -static RTXBD *rtx; - -int keymile_hdlc_enet_init(struct eth_device *, bd_t *); -void keymile_hdlc_enet_halt(struct eth_device *); -extern void keymile_hdlc_enet_init_bds(RTXBD *); -extern void initCachedNumbers(int); - -/* Use SCC1 */ -#define CPM_CR_SCC_PAGE CPM_CR_SCC1_PAGE -#define CPM_CR_SCC_SBLOCK CPM_CR_SCC1_SBLOCK -#define CMXSCR_MASK (CMXSCR_GR1|CMXSCR_SC1|\ - CMXSCR_RS1CS_MSK|CMXSCR_TS1CS_MSK) -#define CMXSCR_VALUE (CMXSCR_RS1CS_CLK11|CMXSCR_TS1CS_CLK11) -#define MGC_PROFF_HDLC PROFF_SCC1 -#define MGC_SCC_HDLC 0 /* Index, not number! */ - -int keymile_hdlc_enet_init(struct eth_device *dev, bd_t *bis) -{ - /* int i; */ - uint dpr; - /* volatile cbd_t *bdp; */ - volatile immap_t *im = (immap_t *)CONFIG_SYS_IMMR; - volatile cpm8260_t *cp = &(im->im_cpm); - volatile scc_t *sccp; - volatile scc_hdlc_t *hpr; - volatile iop8260_t *iop; - - if (already_inited) - return 0; - - hpr = (scc_hdlc_t *)(&im->im_dprambase[MGC_PROFF_HDLC]); - sccp = (scc_t *)(&im->im_scc[MGC_SCC_HDLC]); - iop = &im->im_ioport; - - /* - * Disable receive and transmit just in case. - */ - sccp->scc_gsmrl &= ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT); - - /* - * Avoid exhausting DPRAM, which would cause a panic. - */ - if (rtx == NULL) { - /* dpr is an offset into dpram */ - dpr = m8260_cpm_dpalloc(sizeof(RTXBD), 8); - rtx = (RTXBD *)&im->im_dprambase[dpr]; - } - - /* We need the slot number for addressing. */ - keymile_slot = *(char *)(CONFIG_SYS_SLOT_ID_BASE + - CONFIG_SYS_SLOT_ID_OFF) & CONFIG_SYS_SLOT_ID_MASK; - /* - * Be consistent with the Linux driver and set - * only enetaddr[0]. - * - * Always add 1 to the slot number so that - * there are no problems with an ethaddr which - * is all 0s. This should be acceptable because - * a board should never have a slot number of 255, - * which is the broadcast address. The HDLC addressing - * uses only the slot number. - */ - dev->enetaddr[0] = keymile_slot + 1; -#ifdef TEST_IT - dprintf("slot %d\n", keymile_slot); -#endif - - /* use pd30, pd31 pins for TXD1, RXD1 respectively */ - iop->iop_ppard |= (0x80000000 >> 30) | (0x80000000 >> 31); - iop->iop_pdird |= (0x80000000 >> 30); - iop->iop_psord |= (0x80000000 >> 30); - - /* use pc21 as CLK11 */ - iop->iop_pparc |= (0x80000000 >> 21); - iop->iop_pdirc &= ~(0x80000000 >> 21); - iop->iop_psorc &= ~(0x80000000 >> 21); - - /* use pc15 as CTS1 */ - iop->iop_pparc |= (0x80000000 >> 15); - iop->iop_pdirc &= ~(0x80000000 >> 15); - iop->iop_psorc &= ~(0x80000000 >> 15); - - /* - * SI clock routing - * use CLK11 - * this also connects SCC1 to NMSI - */ - im->im_cpmux.cmx_scr = (im->im_cpmux.cmx_scr & ~CMXSCR_MASK) | - CMXSCR_VALUE; - - /* keymile_rxIdx = 0; */ - - /* - * Initialize function code registers for big-endian. - */ - hpr->sh_genscc.scc_rfcr = CPMFCR_EB; - hpr->sh_genscc.scc_tfcr = CPMFCR_EB; - - /* - * Set maximum bytes per receive buffer. - */ - hpr->sh_genscc.scc_mrblr = MAX_FRAME_LENGTH; - - /* Setup CRC generator values for HDLC */ - hpr->sh_cmask = 0x0000F0B8; - hpr->sh_cpres = 0x0000FFFF; - - /* Initialize all error counters to 0 */ - hpr->sh_disfc = 0; - hpr->sh_crcec = 0; - hpr->sh_abtsc = 0; - hpr->sh_nmarc = 0; - hpr->sh_retrc = 0; - - /* Set maximum frame length size */ - hpr->sh_mflr = MAX_FRAME_LENGTH; - - /* set to 1 for per frame processing change later if needed */ - hpr->sh_rfthr = 1; - - hpr->sh_hmask = 0xff; - - hpr->sh_haddr2 = SET_HDLC_UUA(keymile_slot); - hpr->sh_haddr3 = hpr->sh_haddr2; - hpr->sh_haddr4 = hpr->sh_haddr2; - /* broadcast */ - hpr->sh_haddr1 = HDLC_BCAST; - - hpr->sh_genscc.scc_rbase = (unsigned int) &rtx->rxbd[0]; - hpr->sh_genscc.scc_tbase = (unsigned int) &rtx->txbd; - -#if 0 - /* - * Initialize the buffer descriptors. - */ - bdp = &rtx->txbd; - bdp->cbd_sc = 0; - bdp->cbd_bufaddr = 0; - bdp->cbd_sc = BD_SC_WRAP; - - /* - * Setup RX packet buffers, aligned correctly. - * Borrowed from net/net.c. - */ - MyRxPackets[0] = &MyPktBuf[0] + (PKTALIGN - 1); - MyRxPackets[0] -= (ulong)MyRxPackets[0] % PKTALIGN; - for (i = 1; i < HDLC_PKTBUFSRX; i++) - MyRxPackets[i] = MyRxPackets[0] + i * PKT_MAXBLR_SIZE; - - bdp = &rtx->rxbd[0]; - for (i = 0; i < HDLC_PKTBUFSRX; i++) { - bdp->cbd_sc = BD_SC_EMPTY; - /* Leave space at the start for INET header. */ - bdp->cbd_bufaddr = (unsigned int)(MyRxPackets[i] + - INET_HDR_ALIGN); - bdp++; - } - bdp--; - bdp->cbd_sc |= BD_SC_WRAP; -#else - keymile_hdlc_enet_init_bds(rtx); -#endif - - /* Let's re-initialize the channel now. We have to do it later - * than the manual describes because we have just now finished - * the BD initialization. - */ - cp->cp_cpcr = mk_cr_cmd(CPM_CR_SCC_PAGE, CPM_CR_SCC_SBLOCK, - 0, CPM_CR_INIT_TRX) | CPM_CR_FLG; - while (cp->cp_cpcr & CPM_CR_FLG); - - sccp->scc_gsmrl = SCC_GSMRL_MODE_HDLC; - /* CTSS=1 */ - sccp->scc_gsmrh = SCC_GSMRH_CTSS; - /* NOF=0, RTE=1, DRT=0, BUS=1 */ - sccp->scc_psmr = ((0x8000 >> 6) | (0x8000 >> 10)); - -/* loopback for local testing */ -#ifdef GJTEST - dprintf("LOOPBACK!\n"); - sccp->scc_gsmrl |= SCC_GSMRL_DIAG_LOOP; -#endif - - /* - * Disable all interrupts and clear all pending - * events. - */ - sccp->scc_sccm = 0; - sccp->scc_scce = 0xffff; - - /* - * And last, enable the transmit and receive processing. - */ - sccp->scc_gsmrl |= (SCC_GSMRL_ENR | SCC_GSMRL_ENT); - - dprintf("%s: HDLC ENET Version 0.3 on SCC%d\n", dev->name, - MGC_SCC_HDLC + 1); - - /* - * We may not get an ARP packet because ARP was already done on - * a different interface, so initialize the cached values now. - */ - initCachedNumbers(1); - - already_inited = 1; - - return 0; -} - -void keymile_hdlc_enet_halt(struct eth_device *dev) -{ -#if 0 /* just return, but keep this for reference */ - volatile immap_t *immr = (immap_t *) CONFIG_SYS_IMMR; - - /* maybe should do a graceful stop here? */ - immr->im_scc[MGC_SCC_HDLC].scc_gsmrl &= - ~(SCC_GSMRL_ENR | SCC_GSMRL_ENT); -#endif -} - -#endif /* CONFIG_MGCOGE_HDLC_ENET */

From: Holger Brunck holger.brunck@keymile.com
Signed-off-by: Holger Brunck holger.brunck@keymile.com Acked-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de cc: Valentin Longchamp valentin.longchamp@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com --- board/keymile/mgcoge/mgcoge.c | 291 +++++++++++++++++++++-------------------- 1 files changed, 146 insertions(+), 145 deletions(-)
diff --git a/board/keymile/mgcoge/mgcoge.c b/board/keymile/mgcoge/mgcoge.c index 11a0f79..3db3c7b 100644 --- a/board/keymile/mgcoge/mgcoge.c +++ b/board/keymile/mgcoge/mgcoge.c @@ -45,154 +45,154 @@ */ const iop_conf_t iop_conf_tab[4][32] = {
- /* Port A */ - { /* conf ppar psor pdir podr pdat */ - /* PA31 */ { 0, 0, 0, 0, 0, 0 }, /* PA31 */ - /* PA30 */ { 0, 0, 0, 0, 0, 0 }, /* PA30 */ - /* PA29 */ { 0, 0, 0, 0, 0, 0 }, /* PA29 */ - /* PA28 */ { 0, 0, 0, 0, 0, 0 }, /* PA28 */ - /* PA27 */ { 0, 0, 0, 0, 0, 0 }, /* PA27 */ - /* PA26 */ { 0, 0, 0, 0, 0, 0 }, /* PA26 */ - /* PA25 */ { 0, 0, 0, 0, 0, 0 }, /* PA25 */ - /* PA24 */ { 0, 0, 0, 0, 0, 0 }, /* PA24 */ - /* PA23 */ { 0, 0, 0, 0, 0, 0 }, /* PA23 */ - /* PA22 */ { 0, 0, 0, 0, 0, 0 }, /* PA22 */ - /* PA21 */ { 0, 0, 0, 0, 0, 0 }, /* PA21 */ - /* PA20 */ { 0, 0, 0, 0, 0, 0 }, /* PA20 */ - /* PA19 */ { 0, 0, 0, 0, 0, 0 }, /* PA19 */ - /* PA18 */ { 0, 0, 0, 0, 0, 0 }, /* PA18 */ - /* PA17 */ { 0, 0, 0, 0, 0, 0 }, /* PA17 */ - /* PA16 */ { 0, 0, 0, 0, 0, 0 }, /* PA16 */ - /* PA15 */ { 0, 0, 0, 0, 0, 0 }, /* PA15 */ - /* PA14 */ { 0, 0, 0, 0, 0, 0 }, /* PA14 */ - /* PA13 */ { 0, 0, 0, 0, 0, 0 }, /* PA13 */ - /* PA12 */ { 0, 0, 0, 0, 0, 0 }, /* PA12 */ - /* PA11 */ { 0, 0, 0, 0, 0, 0 }, /* PA11 */ - /* PA10 */ { 0, 0, 0, 0, 0, 0 }, /* PA10 */ - /* PA9 */ { 1, 1, 0, 1, 0, 0 }, /* SMC2 TxD */ - /* PA8 */ { 1, 1, 0, 0, 0, 0 }, /* SMC2 RxD */ - /* PA7 */ { 0, 0, 0, 0, 0, 0 }, /* PA7 */ - /* PA6 */ { 0, 0, 0, 0, 0, 0 }, /* PA6 */ - /* PA5 */ { 0, 0, 0, 0, 0, 0 }, /* PA5 */ - /* PA4 */ { 0, 0, 0, 0, 0, 0 }, /* PA4 */ - /* PA3 */ { 0, 0, 0, 0, 0, 0 }, /* PA3 */ - /* PA2 */ { 0, 0, 0, 0, 0, 0 }, /* PA2 */ - /* PA1 */ { 0, 0, 0, 0, 0, 0 }, /* PA1 */ - /* PA0 */ { 0, 0, 0, 0, 0, 0 } /* PA0 */ - }, - - /* Port B */ - { /* conf ppar psor pdir podr pdat */ - /* PB31 */ { 0, 0, 0, 0, 0, 0 }, /* PB31 */ - /* PB30 */ { 0, 0, 0, 0, 0, 0 }, /* PB30 */ - /* PB29 */ { 0, 0, 0, 0, 0, 0 }, /* PB29 */ - /* PB28 */ { 0, 0, 0, 0, 0, 0 }, /* PB28 */ - /* PB27 */ { 0, 0, 0, 0, 0, 0 }, /* PB27 */ - /* PB26 */ { 0, 0, 0, 0, 0, 0 }, /* PB26 */ - /* PB25 */ { 0, 0, 0, 0, 0, 0 }, /* PB25 */ - /* PB24 */ { 0, 0, 0, 0, 0, 0 }, /* PB24 */ - /* PB23 */ { 0, 0, 0, 0, 0, 0 }, /* PB23 */ - /* PB22 */ { 0, 0, 0, 0, 0, 0 }, /* PB22 */ - /* PB21 */ { 0, 0, 0, 0, 0, 0 }, /* PB21 */ - /* PB20 */ { 0, 0, 0, 0, 0, 0 }, /* PB20 */ - /* PB19 */ { 0, 0, 0, 0, 0, 0 }, /* PB19 */ - /* PB18 */ { 0, 0, 0, 0, 0, 0 }, /* PB18 */ - /* PB17 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - /* PB16 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - /* PB15 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - /* PB14 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - /* PB13 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - /* PB12 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - /* PB11 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - /* PB10 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - /* PB9 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - /* PB8 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - /* PB7 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - /* PB6 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - /* PB5 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - /* PB4 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - /* PB3 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - /* PB2 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - /* PB1 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - /* PB0 */ { 0, 0, 0, 0, 0, 0 } /* non-existent */ - }, - - /* Port C */ - { /* conf ppar psor pdir podr pdat */ - /* PC31 */ { 0, 0, 0, 0, 0, 0 }, /* PC31 */ - /* PC30 */ { 0, 0, 0, 0, 0, 0 }, /* PC30 */ - /* PC29 */ { 0, 0, 0, 0, 0, 0 }, /* PC29 */ - /* PC28 */ { 0, 0, 0, 0, 0, 0 }, /* PC28 */ - /* PC27 */ { 0, 0, 0, 0, 0, 0 }, /* PC27 */ - /* PC26 */ { 0, 0, 0, 0, 0, 0 }, /* PC26 */ - /* PC25 */ { 1, 1, 0, 0, 0, 0 }, /* SCC4 RxClk */ - /* PC24 */ { 1, 1, 0, 0, 0, 0 }, /* SCC4 TxClk */ - /* PC23 */ { 0, 0, 0, 0, 0, 0 }, /* PC23 */ - /* PC22 */ { 0, 0, 0, 0, 0, 0 }, /* PC22 */ - /* PC21 */ { 0, 0, 0, 0, 0, 0 }, /* PC21 */ - /* PC20 */ { 0, 0, 0, 0, 0, 0 }, /* PC20 */ - /* PC19 */ { 0, 0, 0, 0, 0, 0 }, /* PC19 */ - /* PC18 */ { 0, 0, 0, 0, 0, 0 }, /* PC18 */ - /* PC17 */ { 0, 0, 0, 0, 0, 0 }, /* PC17 */ - /* PC16 */ { 0, 0, 0, 0, 0, 0 }, /* PC16 */ - /* PC15 */ { 0, 0, 0, 0, 0, 0 }, /* PC15 */ - /* PC14 */ { 0, 0, 0, 0, 0, 0 }, /* PC14 */ - /* PC13 */ { 0, 0, 0, 0, 0, 0 }, /* PC13 */ - /* PC12 */ { 0, 0, 0, 0, 0, 0 }, /* PC12 */ - /* PC11 */ { 0, 0, 0, 0, 0, 0 }, /* PC11 */ - /* PC10 */ { 0, 0, 0, 0, 0, 0 }, /* PC10 */ - /* PC9 */ { 1, 1, 0, 0, 0, 0 }, /* SCC4: CTS */ - /* PC8 */ { 1, 1, 0, 0, 0, 0 }, /* SCC4: CD */ - /* PC7 */ { 0, 0, 0, 0, 0, 0 }, /* PC7 */ - /* PC6 */ { 0, 0, 0, 0, 0, 0 }, /* PC6 */ - /* PC5 */ { 0, 0, 0, 0, 0, 0 }, /* PC5 */ - /* PC4 */ { 0, 0, 0, 0, 0, 0 }, /* PC4 */ - /* PC3 */ { 0, 0, 0, 0, 0, 0 }, /* PC3 */ - /* PC2 */ { 0, 0, 0, 0, 0, 0 }, /* PC2 */ - /* PC1 */ { 0, 0, 0, 0, 0, 0 }, /* PC1 */ - /* PC0 */ { 0, 0, 0, 0, 0, 0 }, /* PC0 */ - }, - - /* Port D */ - { /* conf ppar psor pdir podr pdat */ - /* PD31 */ { 0, 0, 0, 0, 0, 0 }, /* PD31 */ - /* PD30 */ { 0, 0, 0, 0, 0, 0 }, /* PD30 */ - /* PD29 */ { 0, 0, 0, 0, 0, 0 }, /* PD29 */ - /* PD28 */ { 0, 0, 0, 0, 0, 0 }, /* PD28 */ - /* PD27 */ { 0, 0, 0, 0, 0, 0 }, /* PD27 */ - /* PD26 */ { 0, 0, 0, 0, 0, 0 }, /* PD26 */ - /* PD25 */ { 0, 0, 0, 0, 0, 0 }, /* PD25 */ - /* PD24 */ { 0, 0, 0, 0, 0, 0 }, /* PD24 */ - /* PD23 */ { 0, 0, 0, 0, 0, 0 }, /* PD23 */ - /* PD22 */ { 1, 1, 0, 0, 0, 0 }, /* SCC4: RXD */ - /* PD21 */ { 1, 1, 0, 1, 0, 0 }, /* SCC4: TXD */ - /* PD20 */ { 1, 1, 0, 1, 0, 0 }, /* SCC4: RTS */ - /* PD19 */ { 0, 0, 0, 0, 0, 0 }, /* PD19 */ - /* PD18 */ { 0, 0, 0, 0, 0, 0 }, /* PD18 */ - /* PD17 */ { 0, 0, 0, 0, 0, 0 }, /* PD17 */ - /* PD16 */ { 0, 0, 0, 0, 0, 0 }, /* PD16 */ + /* Port A */ + { /* conf ppar psor pdir podr pdat */ + { 0, 0, 0, 0, 0, 0 }, /* PA31 */ + { 0, 0, 0, 0, 0, 0 }, /* PA30 */ + { 0, 0, 0, 0, 0, 0 }, /* PA29 */ + { 0, 0, 0, 0, 0, 0 }, /* PA28 */ + { 0, 0, 0, 0, 0, 0 }, /* PA27 */ + { 0, 0, 0, 0, 0, 0 }, /* PA26 */ + { 0, 0, 0, 0, 0, 0 }, /* PA25 */ + { 0, 0, 0, 0, 0, 0 }, /* PA24 */ + { 0, 0, 0, 0, 0, 0 }, /* PA23 */ + { 0, 0, 0, 0, 0, 0 }, /* PA22 */ + { 0, 0, 0, 0, 0, 0 }, /* PA21 */ + { 0, 0, 0, 0, 0, 0 }, /* PA20 */ + { 0, 0, 0, 0, 0, 0 }, /* PA19 */ + { 0, 0, 0, 0, 0, 0 }, /* PA18 */ + { 0, 0, 0, 0, 0, 0 }, /* PA17 */ + { 0, 0, 0, 0, 0, 0 }, /* PA16 */ + { 0, 0, 0, 0, 0, 0 }, /* PA15 */ + { 0, 0, 0, 0, 0, 0 }, /* PA14 */ + { 0, 0, 0, 0, 0, 0 }, /* PA13 */ + { 0, 0, 0, 0, 0, 0 }, /* PA12 */ + { 0, 0, 0, 0, 0, 0 }, /* PA11 */ + { 0, 0, 0, 0, 0, 0 }, /* PA10 */ + { 1, 1, 0, 1, 0, 0 }, /* PA9 SMC2 TxD */ + { 1, 1, 0, 0, 0, 0 }, /* PA8 SMC2 RxD */ + { 0, 0, 0, 0, 0, 0 }, /* PA7 */ + { 0, 0, 0, 0, 0, 0 }, /* PA6 */ + { 0, 0, 0, 0, 0, 0 }, /* PA5 */ + { 0, 0, 0, 0, 0, 0 }, /* PA4 */ + { 0, 0, 0, 0, 0, 0 }, /* PA3 */ + { 0, 0, 0, 0, 0, 0 }, /* PA2 */ + { 0, 0, 0, 0, 0, 0 }, /* PA1 */ + { 0, 0, 0, 0, 0, 0 } /* PA0 */ + }, + + /* Port B */ + { /* conf ppar psor pdir podr pdat */ + { 0, 0, 0, 0, 0, 0 }, /* PB31 */ + { 0, 0, 0, 0, 0, 0 }, /* PB30 */ + { 0, 0, 0, 0, 0, 0 }, /* PB29 */ + { 0, 0, 0, 0, 0, 0 }, /* PB28 */ + { 0, 0, 0, 0, 0, 0 }, /* PB27 */ + { 0, 0, 0, 0, 0, 0 }, /* PB26 */ + { 0, 0, 0, 0, 0, 0 }, /* PB25 */ + { 0, 0, 0, 0, 0, 0 }, /* PB24 */ + { 0, 0, 0, 0, 0, 0 }, /* PB23 */ + { 0, 0, 0, 0, 0, 0 }, /* PB22 */ + { 0, 0, 0, 0, 0, 0 }, /* PB21 */ + { 0, 0, 0, 0, 0, 0 }, /* PB20 */ + { 0, 0, 0, 0, 0, 0 }, /* PB19 */ + { 0, 0, 0, 0, 0, 0 }, /* PB18 */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 } /* non-existent */ + }, + + /* Port C */ + { /* conf ppar psor pdir podr pdat */ + { 0, 0, 0, 0, 0, 0 }, /* PC31 */ + { 0, 0, 0, 0, 0, 0 }, /* PC30 */ + { 0, 0, 0, 0, 0, 0 }, /* PC29 */ + { 0, 0, 0, 0, 0, 0 }, /* PC28 */ + { 0, 0, 0, 0, 0, 0 }, /* PC27 */ + { 0, 0, 0, 0, 0, 0 }, /* PC26 */ + { 1, 1, 0, 0, 0, 0 }, /* PC25 RxClk */ + { 1, 1, 0, 0, 0, 0 }, /* PC24 TxClk */ + { 0, 0, 0, 0, 0, 0 }, /* PC23 */ + { 0, 0, 0, 0, 0, 0 }, /* PC22 */ + { 0, 0, 0, 0, 0, 0 }, /* PC21 */ + { 0, 0, 0, 0, 0, 0 }, /* PC20 */ + { 0, 0, 0, 0, 0, 0 }, /* PC19 */ + { 0, 0, 0, 0, 0, 0 }, /* PC18 */ + { 0, 0, 0, 0, 0, 0 }, /* PC17 */ + { 0, 0, 0, 0, 0, 0 }, /* PC16 */ + { 0, 0, 0, 0, 0, 0 }, /* PC15 */ + { 0, 0, 0, 0, 0, 0 }, /* PC14 */ + { 0, 0, 0, 0, 0, 0 }, /* PC13 */ + { 0, 0, 0, 0, 0, 0 }, /* PC12 */ + { 0, 0, 0, 0, 0, 0 }, /* PC11 */ + { 0, 0, 0, 0, 0, 0 }, /* PC10 */ + { 1, 1, 0, 0, 0, 0 }, /* PC9 SCC4: CTS */ + { 1, 1, 0, 0, 0, 0 }, /* PC8 SCC4: CD */ + { 0, 0, 0, 0, 0, 0 }, /* PC7 */ + { 0, 0, 0, 0, 0, 0 }, /* PC6 */ + { 0, 0, 0, 0, 0, 0 }, /* PC5 */ + { 0, 0, 0, 0, 0, 0 }, /* PC4 */ + { 0, 0, 0, 0, 0, 0 }, /* PC3 */ + { 0, 0, 0, 0, 0, 0 }, /* PC2 */ + { 0, 0, 0, 0, 0, 0 }, /* PC1 */ + { 0, 0, 0, 0, 0, 0 }, /* PC0 */ + }, + + /* Port D */ + { /* conf ppar psor pdir podr pdat */ + { 0, 0, 0, 0, 0, 0 }, /* PD31 */ + { 0, 0, 0, 0, 0, 0 }, /* PD30 */ + { 0, 0, 0, 0, 0, 0 }, /* PD29 */ + { 0, 0, 0, 0, 0, 0 }, /* PD28 */ + { 0, 0, 0, 0, 0, 0 }, /* PD27 */ + { 0, 0, 0, 0, 0, 0 }, /* PD26 */ + { 0, 0, 0, 0, 0, 0 }, /* PD25 */ + { 0, 0, 0, 0, 0, 0 }, /* PD24 */ + { 0, 0, 0, 0, 0, 0 }, /* PD23 */ + { 1, 1, 0, 0, 0, 0 }, /* PD22 SCC4: RXD */ + { 1, 1, 0, 1, 0, 0 }, /* PD21 SCC4: TXD */ + { 1, 1, 0, 1, 0, 0 }, /* PD20 SCC4: RTS */ + { 0, 0, 0, 0, 0, 0 }, /* PD19 */ + { 0, 0, 0, 0, 0, 0 }, /* PD18 */ + { 0, 0, 0, 0, 0, 0 }, /* PD17 */ + { 0, 0, 0, 0, 0, 0 }, /* PD16 */ #if defined(CONFIG_HARD_I2C) - /* PD15 */ { 1, 1, 1, 0, 1, 0 }, /* I2C SDA */ - /* PD14 */ { 1, 1, 1, 0, 1, 0 }, /* I2C SCL */ + { 1, 1, 1, 0, 1, 0 }, /* PD15 I2C SDA */ + { 1, 1, 1, 0, 1, 0 }, /* PD14 I2C SCL */ #else - /* PD15 */ { 1, 0, 0, 0, 1, 1 }, /* PD15 */ - /* PD14 */ { 1, 0, 0, 1, 1, 1 }, /* PD14 */ + { 1, 0, 0, 0, 1, 1 }, /* PD15 */ + { 1, 0, 0, 1, 1, 1 }, /* PD14 */ #endif - /* PD13 */ { 0, 0, 0, 0, 0, 0 }, /* PD13 */ - /* PD12 */ { 0, 0, 0, 0, 0, 0 }, /* PD12 */ - /* PD11 */ { 0, 0, 0, 0, 0, 0 }, /* PD11 */ - /* PD10 */ { 0, 0, 0, 0, 0, 0 }, /* PD10 */ - /* PD9 */ { 0, 0, 0, 0, 0, 0 }, /* PD9 */ - /* PD8 */ { 0, 0, 0, 0, 0, 0 }, /* PD8 */ - /* PD7 */ { 0, 0, 0, 0, 0, 0 }, /* PD7 */ - /* PD6 */ { 0, 0, 0, 0, 0, 0 }, /* PD6 */ - /* PD5 */ { 0, 0, 0, 0, 0, 0 }, /* PD5 */ - /* PD4 */ { 0, 0, 0, 0, 0, 0 }, /* PD4 */ - /* PD3 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - /* PD2 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - /* PD1 */ { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - /* PD0 */ { 0, 0, 0, 0, 0, 0 } /* non-existent */ - } + { 0, 0, 0, 0, 0, 0 }, /* PD13 */ + { 0, 0, 0, 0, 0, 0 }, /* PD12 */ + { 0, 0, 0, 0, 0, 0 }, /* PD11 */ + { 0, 0, 0, 0, 0, 0 }, /* PD10 */ + { 0, 0, 0, 0, 0, 0 }, /* PD9 */ + { 0, 0, 0, 0, 0, 0 }, /* PD8 */ + { 0, 0, 0, 0, 0, 0 }, /* PD7 */ + { 0, 0, 0, 0, 0, 0 }, /* PD6 */ + { 0, 0, 0, 0, 0, 0 }, /* PD5 */ + { 0, 0, 0, 0, 0, 0 }, /* PD4 */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 } /* non-existent */ + } };
/* @@ -237,7 +237,8 @@ static long int try_init(memctl8260_t *memctl, ulong sdmr, * accessing the SDRAM with a single-byte transaction." * * The appropriate BRx/ORx registers have already been set when we - * get here. The SDRAM can be accessed at the address CONFIG_SYS_SDRAM_BASE. + * get here. The SDRAM can be accessed at the address + * CONFIG_SYS_SDRAM_BASE. */
out_be32(&memctl->memc_psdmr, sdmr | PSDMR_OP_PREA); @@ -257,7 +258,7 @@ static long int try_init(memctl8260_t *memctl, ulong sdmr, size = get_ram_size((long *)base, maxsize); out_be32(&memctl->memc_or1, orx | ~(size - 1));
- return (size); + return size; }
phys_size_t initdram(int board_type) @@ -279,7 +280,7 @@ phys_size_t initdram(int board_type)
icache_enable();
- return (psize); + return psize; }
int checkboard(void)

From: Holger Brunck holger.brunck@keymile.com
The directory and file mgcoge was renamed to km82xx. Because other keymile 82xx will follow and will use the same platform code.
Signed-off-by: Holger Brunck holger.brunck@keymile.com Acked-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de cc: Valentin Longchamp valentin.longchamp@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com --- board/keymile/km82xx/Makefile | 53 +++++++ board/keymile/km82xx/km82xx.c | 346 +++++++++++++++++++++++++++++++++++++++++ board/keymile/mgcoge/Makefile | 53 ------- board/keymile/mgcoge/mgcoge.c | 346 ----------------------------------------- boards.cfg | 4 +- 5 files changed, 401 insertions(+), 401 deletions(-) create mode 100644 board/keymile/km82xx/Makefile create mode 100644 board/keymile/km82xx/km82xx.c delete mode 100644 board/keymile/mgcoge/Makefile delete mode 100644 board/keymile/mgcoge/mgcoge.c
diff --git a/board/keymile/km82xx/Makefile b/board/keymile/km82xx/Makefile new file mode 100644 index 0000000..a2b9da4 --- /dev/null +++ b/board/keymile/km82xx/Makefile @@ -0,0 +1,53 @@ +# +# (C) Copyright 2001-2007 +# Wolfgang Denk, DENX Software Engineering, wd@denx.de. +# +# See file CREDITS for list of people who contributed to this +# project. +# +# This program is free software; you can redistribute it and/or +# modify it under the terms of the GNU General Public License as +# published by the Free Software Foundation; either version 2 of +# the License, or (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 59 Temple Place, Suite 330, Boston, +# MA 02111-1307 USA +# + +include $(TOPDIR)/config.mk +ifneq ($(OBJTREE),$(SRCTREE)) +$(shell mkdir -p $(obj)../common) +endif + +LIB = $(obj)lib$(BOARD).o + +COBJS := $(BOARD).o ../common/common.o + +SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) +OBJS := $(addprefix $(obj),$(COBJS)) +SOBJS := $(addprefix $(obj),$(SOBJS)) + +$(LIB): $(obj).depend $(OBJS) + $(call cmd_link_o_target, $(OBJS)) + +clean: + rm -f $(SOBJS) $(OBJS) + +distclean: clean + rm -f $(LIB) core *.bak $(obj).depend + +######################################################################### + +# defines $(obj).depend target +include $(SRCTREE)/rules.mk + +sinclude $(obj).depend + +######################################################################### diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c new file mode 100644 index 0000000..3db3c7b --- /dev/null +++ b/board/keymile/km82xx/km82xx.c @@ -0,0 +1,346 @@ +/* + * (C) Copyright 2007 - 2008 + * Heiko Schocher, DENX Software Engineering, hs@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#include <common.h> +#include <mpc8260.h> +#include <ioports.h> +#include <malloc.h> +#include <asm/io.h> + +#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) +#include <libfdt.h> +#endif + +#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) +#include <i2c.h> +#endif + +#include "../common/common.h" + +/* + * I/O Port configuration table + * + * if conf is 1, then that port pin will be configured at boot time + * according to the five values podr/pdir/ppar/psor/pdat for that entry + */ +const iop_conf_t iop_conf_tab[4][32] = { + + /* Port A */ + { /* conf ppar psor pdir podr pdat */ + { 0, 0, 0, 0, 0, 0 }, /* PA31 */ + { 0, 0, 0, 0, 0, 0 }, /* PA30 */ + { 0, 0, 0, 0, 0, 0 }, /* PA29 */ + { 0, 0, 0, 0, 0, 0 }, /* PA28 */ + { 0, 0, 0, 0, 0, 0 }, /* PA27 */ + { 0, 0, 0, 0, 0, 0 }, /* PA26 */ + { 0, 0, 0, 0, 0, 0 }, /* PA25 */ + { 0, 0, 0, 0, 0, 0 }, /* PA24 */ + { 0, 0, 0, 0, 0, 0 }, /* PA23 */ + { 0, 0, 0, 0, 0, 0 }, /* PA22 */ + { 0, 0, 0, 0, 0, 0 }, /* PA21 */ + { 0, 0, 0, 0, 0, 0 }, /* PA20 */ + { 0, 0, 0, 0, 0, 0 }, /* PA19 */ + { 0, 0, 0, 0, 0, 0 }, /* PA18 */ + { 0, 0, 0, 0, 0, 0 }, /* PA17 */ + { 0, 0, 0, 0, 0, 0 }, /* PA16 */ + { 0, 0, 0, 0, 0, 0 }, /* PA15 */ + { 0, 0, 0, 0, 0, 0 }, /* PA14 */ + { 0, 0, 0, 0, 0, 0 }, /* PA13 */ + { 0, 0, 0, 0, 0, 0 }, /* PA12 */ + { 0, 0, 0, 0, 0, 0 }, /* PA11 */ + { 0, 0, 0, 0, 0, 0 }, /* PA10 */ + { 1, 1, 0, 1, 0, 0 }, /* PA9 SMC2 TxD */ + { 1, 1, 0, 0, 0, 0 }, /* PA8 SMC2 RxD */ + { 0, 0, 0, 0, 0, 0 }, /* PA7 */ + { 0, 0, 0, 0, 0, 0 }, /* PA6 */ + { 0, 0, 0, 0, 0, 0 }, /* PA5 */ + { 0, 0, 0, 0, 0, 0 }, /* PA4 */ + { 0, 0, 0, 0, 0, 0 }, /* PA3 */ + { 0, 0, 0, 0, 0, 0 }, /* PA2 */ + { 0, 0, 0, 0, 0, 0 }, /* PA1 */ + { 0, 0, 0, 0, 0, 0 } /* PA0 */ + }, + + /* Port B */ + { /* conf ppar psor pdir podr pdat */ + { 0, 0, 0, 0, 0, 0 }, /* PB31 */ + { 0, 0, 0, 0, 0, 0 }, /* PB30 */ + { 0, 0, 0, 0, 0, 0 }, /* PB29 */ + { 0, 0, 0, 0, 0, 0 }, /* PB28 */ + { 0, 0, 0, 0, 0, 0 }, /* PB27 */ + { 0, 0, 0, 0, 0, 0 }, /* PB26 */ + { 0, 0, 0, 0, 0, 0 }, /* PB25 */ + { 0, 0, 0, 0, 0, 0 }, /* PB24 */ + { 0, 0, 0, 0, 0, 0 }, /* PB23 */ + { 0, 0, 0, 0, 0, 0 }, /* PB22 */ + { 0, 0, 0, 0, 0, 0 }, /* PB21 */ + { 0, 0, 0, 0, 0, 0 }, /* PB20 */ + { 0, 0, 0, 0, 0, 0 }, /* PB19 */ + { 0, 0, 0, 0, 0, 0 }, /* PB18 */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 } /* non-existent */ + }, + + /* Port C */ + { /* conf ppar psor pdir podr pdat */ + { 0, 0, 0, 0, 0, 0 }, /* PC31 */ + { 0, 0, 0, 0, 0, 0 }, /* PC30 */ + { 0, 0, 0, 0, 0, 0 }, /* PC29 */ + { 0, 0, 0, 0, 0, 0 }, /* PC28 */ + { 0, 0, 0, 0, 0, 0 }, /* PC27 */ + { 0, 0, 0, 0, 0, 0 }, /* PC26 */ + { 1, 1, 0, 0, 0, 0 }, /* PC25 RxClk */ + { 1, 1, 0, 0, 0, 0 }, /* PC24 TxClk */ + { 0, 0, 0, 0, 0, 0 }, /* PC23 */ + { 0, 0, 0, 0, 0, 0 }, /* PC22 */ + { 0, 0, 0, 0, 0, 0 }, /* PC21 */ + { 0, 0, 0, 0, 0, 0 }, /* PC20 */ + { 0, 0, 0, 0, 0, 0 }, /* PC19 */ + { 0, 0, 0, 0, 0, 0 }, /* PC18 */ + { 0, 0, 0, 0, 0, 0 }, /* PC17 */ + { 0, 0, 0, 0, 0, 0 }, /* PC16 */ + { 0, 0, 0, 0, 0, 0 }, /* PC15 */ + { 0, 0, 0, 0, 0, 0 }, /* PC14 */ + { 0, 0, 0, 0, 0, 0 }, /* PC13 */ + { 0, 0, 0, 0, 0, 0 }, /* PC12 */ + { 0, 0, 0, 0, 0, 0 }, /* PC11 */ + { 0, 0, 0, 0, 0, 0 }, /* PC10 */ + { 1, 1, 0, 0, 0, 0 }, /* PC9 SCC4: CTS */ + { 1, 1, 0, 0, 0, 0 }, /* PC8 SCC4: CD */ + { 0, 0, 0, 0, 0, 0 }, /* PC7 */ + { 0, 0, 0, 0, 0, 0 }, /* PC6 */ + { 0, 0, 0, 0, 0, 0 }, /* PC5 */ + { 0, 0, 0, 0, 0, 0 }, /* PC4 */ + { 0, 0, 0, 0, 0, 0 }, /* PC3 */ + { 0, 0, 0, 0, 0, 0 }, /* PC2 */ + { 0, 0, 0, 0, 0, 0 }, /* PC1 */ + { 0, 0, 0, 0, 0, 0 }, /* PC0 */ + }, + + /* Port D */ + { /* conf ppar psor pdir podr pdat */ + { 0, 0, 0, 0, 0, 0 }, /* PD31 */ + { 0, 0, 0, 0, 0, 0 }, /* PD30 */ + { 0, 0, 0, 0, 0, 0 }, /* PD29 */ + { 0, 0, 0, 0, 0, 0 }, /* PD28 */ + { 0, 0, 0, 0, 0, 0 }, /* PD27 */ + { 0, 0, 0, 0, 0, 0 }, /* PD26 */ + { 0, 0, 0, 0, 0, 0 }, /* PD25 */ + { 0, 0, 0, 0, 0, 0 }, /* PD24 */ + { 0, 0, 0, 0, 0, 0 }, /* PD23 */ + { 1, 1, 0, 0, 0, 0 }, /* PD22 SCC4: RXD */ + { 1, 1, 0, 1, 0, 0 }, /* PD21 SCC4: TXD */ + { 1, 1, 0, 1, 0, 0 }, /* PD20 SCC4: RTS */ + { 0, 0, 0, 0, 0, 0 }, /* PD19 */ + { 0, 0, 0, 0, 0, 0 }, /* PD18 */ + { 0, 0, 0, 0, 0, 0 }, /* PD17 */ + { 0, 0, 0, 0, 0, 0 }, /* PD16 */ +#if defined(CONFIG_HARD_I2C) + { 1, 1, 1, 0, 1, 0 }, /* PD15 I2C SDA */ + { 1, 1, 1, 0, 1, 0 }, /* PD14 I2C SCL */ +#else + { 1, 0, 0, 0, 1, 1 }, /* PD15 */ + { 1, 0, 0, 1, 1, 1 }, /* PD14 */ +#endif + { 0, 0, 0, 0, 0, 0 }, /* PD13 */ + { 0, 0, 0, 0, 0, 0 }, /* PD12 */ + { 0, 0, 0, 0, 0, 0 }, /* PD11 */ + { 0, 0, 0, 0, 0, 0 }, /* PD10 */ + { 0, 0, 0, 0, 0, 0 }, /* PD9 */ + { 0, 0, 0, 0, 0, 0 }, /* PD8 */ + { 0, 0, 0, 0, 0, 0 }, /* PD7 */ + { 0, 0, 0, 0, 0, 0 }, /* PD6 */ + { 0, 0, 0, 0, 0, 0 }, /* PD5 */ + { 0, 0, 0, 0, 0, 0 }, /* PD4 */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 }, /* non-existent */ + { 0, 0, 0, 0, 0, 0 } /* non-existent */ + } +}; + +/* + * Try SDRAM initialization with P/LSDMR=sdmr and ORx=orx + * + * This routine performs standard 8260 initialization sequence + * and calculates the available memory size. It may be called + * several times to try different SDRAM configurations on both + * 60x and local buses. + */ +static long int try_init(memctl8260_t *memctl, ulong sdmr, + ulong orx, uchar *base) +{ + uchar c = 0xff; + ulong maxsize, size; + int i; + + /* + * We must be able to test a location outsize the maximum legal size + * to find out THAT we are outside; but this address still has to be + * mapped by the controller. That means, that the initial mapping has + * to be (at least) twice as large as the maximum expected size. + */ + maxsize = (1 + (~orx | 0x7fff))/* / 2*/; + + out_be32(&memctl->memc_or1, orx); + + /* + * Quote from 8260 UM (10.4.2 SDRAM Power-On Initialization, 10-35): + * + * "At system reset, initialization software must set up the + * programmable parameters in the memory controller banks registers + * (ORx, BRx, P/LSDMR). After all memory parameters are configured, + * system software should execute the following initialization sequence + * for each SDRAM device. + * + * 1. Issue a PRECHARGE-ALL-BANKS command + * 2. Issue eight CBR REFRESH commands + * 3. Issue a MODE-SET command to initialize the mode register + * + * The initial commands are executed by setting P/LSDMR[OP] and + * accessing the SDRAM with a single-byte transaction." + * + * The appropriate BRx/ORx registers have already been set when we + * get here. The SDRAM can be accessed at the address + * CONFIG_SYS_SDRAM_BASE. + */ + + out_be32(&memctl->memc_psdmr, sdmr | PSDMR_OP_PREA); + out_8(base, c); + + out_be32(&memctl->memc_psdmr, sdmr | PSDMR_OP_CBRR); + for (i = 0; i < 8; i++) + out_8(base, c); + + out_be32(&memctl->memc_psdmr, sdmr | PSDMR_OP_MRW); + /* setting MR on address lines */ + out_8((uchar *)(base + CONFIG_SYS_MRS_OFFS), c); + + out_be32(&memctl->memc_psdmr, sdmr | PSDMR_OP_NORM | PSDMR_RFEN); + out_8(base, c); + + size = get_ram_size((long *)base, maxsize); + out_be32(&memctl->memc_or1, orx | ~(size - 1)); + + return size; +} + +phys_size_t initdram(int board_type) +{ + immap_t *immap = (immap_t *) CONFIG_SYS_IMMR; + memctl8260_t *memctl = &immap->im_memctl; + + long psize; + + out_8(&memctl->memc_psrt, CONFIG_SYS_PSRT); + out_be16(&memctl->memc_mptpr, CONFIG_SYS_MPTPR); + +#ifndef CONFIG_SYS_RAMBOOT + /* 60x SDRAM setup: + */ + psize = try_init(memctl, CONFIG_SYS_PSDMR, CONFIG_SYS_OR1, + (uchar *) CONFIG_SYS_SDRAM_BASE); +#endif /* CONFIG_SYS_RAMBOOT */ + + icache_enable(); + + return psize; +} + +int checkboard(void) +{ +#if defined(CONFIG_MGCOGE) + puts("Board: Keymile mgcoge"); +#else + puts("Board: Keymile mgcoge2ne"); +#endif + if (ethernet_present()) + puts(" with PIGGY."); + puts("\n"); + return 0; +} + +/* + * Early board initalization. + */ +int board_early_init_r(void) +{ + struct km_bec_fpga *base = + (struct km_bec_fpga *)CONFIG_SYS_KMBEC_FPGA_BASE; + + /* setup the UPIOx */ + /* General Unit Reset disabled, Flash Bank enabled, UnitLed on */ + out_8(&base->oprth, (WRG_RESET | H_OPORTS_14 | WRG_LED)); + /* SCC4 enable, halfduplex, FCC1 powerdown */ + out_8(&base->oprtl, (H_OPORTS_SCC4_ENA | H_OPORTS_SCC4_FD_ENA | + H_OPORTS_FCC1_PW_DWN)); + + return 0; +} + +int last_stage_init(void) +{ + struct bfticu_iomap *base = + (struct bfticu_iomap *)CONFIG_SYS_FPGA_BASE; + u8 dip_switch; + + dip_switch = in_8(&base->mswitch); + dip_switch &= BFTICU_DIPSWITCH_MASK; + /* dip switch 'full reset' or 'db erase' */ + if (dip_switch & 0x1 || dip_switch & 0x2) { + /* start bootloader */ + puts("DIP: Enabled\n"); + setenv("actual_bank", "0"); + } + set_km_env(); + return 0; +} + +int hush_init_var(void) +{ + ivm_read_eeprom(); + return 0; +} + +#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) +void ft_board_setup(void *blob, bd_t *bd) +{ + ft_cpu_setup(blob, bd); +} +#endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */ diff --git a/board/keymile/mgcoge/Makefile b/board/keymile/mgcoge/Makefile deleted file mode 100644 index a2b9da4..0000000 --- a/board/keymile/mgcoge/Makefile +++ /dev/null @@ -1,53 +0,0 @@ -# -# (C) Copyright 2001-2007 -# Wolfgang Denk, DENX Software Engineering, wd@denx.de. -# -# See file CREDITS for list of people who contributed to this -# project. -# -# This program is free software; you can redistribute it and/or -# modify it under the terms of the GNU General Public License as -# published by the Free Software Foundation; either version 2 of -# the License, or (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, -# MA 02111-1307 USA -# - -include $(TOPDIR)/config.mk -ifneq ($(OBJTREE),$(SRCTREE)) -$(shell mkdir -p $(obj)../common) -endif - -LIB = $(obj)lib$(BOARD).o - -COBJS := $(BOARD).o ../common/common.o - -SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) -OBJS := $(addprefix $(obj),$(COBJS)) -SOBJS := $(addprefix $(obj),$(SOBJS)) - -$(LIB): $(obj).depend $(OBJS) - $(call cmd_link_o_target, $(OBJS)) - -clean: - rm -f $(SOBJS) $(OBJS) - -distclean: clean - rm -f $(LIB) core *.bak $(obj).depend - -######################################################################### - -# defines $(obj).depend target -include $(SRCTREE)/rules.mk - -sinclude $(obj).depend - -######################################################################### diff --git a/board/keymile/mgcoge/mgcoge.c b/board/keymile/mgcoge/mgcoge.c deleted file mode 100644 index 3db3c7b..0000000 --- a/board/keymile/mgcoge/mgcoge.c +++ /dev/null @@ -1,346 +0,0 @@ -/* - * (C) Copyright 2007 - 2008 - * Heiko Schocher, DENX Software Engineering, hs@denx.de. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -#include <common.h> -#include <mpc8260.h> -#include <ioports.h> -#include <malloc.h> -#include <asm/io.h> - -#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) -#include <libfdt.h> -#endif - -#if defined(CONFIG_HARD_I2C) || defined(CONFIG_SOFT_I2C) -#include <i2c.h> -#endif - -#include "../common/common.h" - -/* - * I/O Port configuration table - * - * if conf is 1, then that port pin will be configured at boot time - * according to the five values podr/pdir/ppar/psor/pdat for that entry - */ -const iop_conf_t iop_conf_tab[4][32] = { - - /* Port A */ - { /* conf ppar psor pdir podr pdat */ - { 0, 0, 0, 0, 0, 0 }, /* PA31 */ - { 0, 0, 0, 0, 0, 0 }, /* PA30 */ - { 0, 0, 0, 0, 0, 0 }, /* PA29 */ - { 0, 0, 0, 0, 0, 0 }, /* PA28 */ - { 0, 0, 0, 0, 0, 0 }, /* PA27 */ - { 0, 0, 0, 0, 0, 0 }, /* PA26 */ - { 0, 0, 0, 0, 0, 0 }, /* PA25 */ - { 0, 0, 0, 0, 0, 0 }, /* PA24 */ - { 0, 0, 0, 0, 0, 0 }, /* PA23 */ - { 0, 0, 0, 0, 0, 0 }, /* PA22 */ - { 0, 0, 0, 0, 0, 0 }, /* PA21 */ - { 0, 0, 0, 0, 0, 0 }, /* PA20 */ - { 0, 0, 0, 0, 0, 0 }, /* PA19 */ - { 0, 0, 0, 0, 0, 0 }, /* PA18 */ - { 0, 0, 0, 0, 0, 0 }, /* PA17 */ - { 0, 0, 0, 0, 0, 0 }, /* PA16 */ - { 0, 0, 0, 0, 0, 0 }, /* PA15 */ - { 0, 0, 0, 0, 0, 0 }, /* PA14 */ - { 0, 0, 0, 0, 0, 0 }, /* PA13 */ - { 0, 0, 0, 0, 0, 0 }, /* PA12 */ - { 0, 0, 0, 0, 0, 0 }, /* PA11 */ - { 0, 0, 0, 0, 0, 0 }, /* PA10 */ - { 1, 1, 0, 1, 0, 0 }, /* PA9 SMC2 TxD */ - { 1, 1, 0, 0, 0, 0 }, /* PA8 SMC2 RxD */ - { 0, 0, 0, 0, 0, 0 }, /* PA7 */ - { 0, 0, 0, 0, 0, 0 }, /* PA6 */ - { 0, 0, 0, 0, 0, 0 }, /* PA5 */ - { 0, 0, 0, 0, 0, 0 }, /* PA4 */ - { 0, 0, 0, 0, 0, 0 }, /* PA3 */ - { 0, 0, 0, 0, 0, 0 }, /* PA2 */ - { 0, 0, 0, 0, 0, 0 }, /* PA1 */ - { 0, 0, 0, 0, 0, 0 } /* PA0 */ - }, - - /* Port B */ - { /* conf ppar psor pdir podr pdat */ - { 0, 0, 0, 0, 0, 0 }, /* PB31 */ - { 0, 0, 0, 0, 0, 0 }, /* PB30 */ - { 0, 0, 0, 0, 0, 0 }, /* PB29 */ - { 0, 0, 0, 0, 0, 0 }, /* PB28 */ - { 0, 0, 0, 0, 0, 0 }, /* PB27 */ - { 0, 0, 0, 0, 0, 0 }, /* PB26 */ - { 0, 0, 0, 0, 0, 0 }, /* PB25 */ - { 0, 0, 0, 0, 0, 0 }, /* PB24 */ - { 0, 0, 0, 0, 0, 0 }, /* PB23 */ - { 0, 0, 0, 0, 0, 0 }, /* PB22 */ - { 0, 0, 0, 0, 0, 0 }, /* PB21 */ - { 0, 0, 0, 0, 0, 0 }, /* PB20 */ - { 0, 0, 0, 0, 0, 0 }, /* PB19 */ - { 0, 0, 0, 0, 0, 0 }, /* PB18 */ - { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - { 0, 0, 0, 0, 0, 0 } /* non-existent */ - }, - - /* Port C */ - { /* conf ppar psor pdir podr pdat */ - { 0, 0, 0, 0, 0, 0 }, /* PC31 */ - { 0, 0, 0, 0, 0, 0 }, /* PC30 */ - { 0, 0, 0, 0, 0, 0 }, /* PC29 */ - { 0, 0, 0, 0, 0, 0 }, /* PC28 */ - { 0, 0, 0, 0, 0, 0 }, /* PC27 */ - { 0, 0, 0, 0, 0, 0 }, /* PC26 */ - { 1, 1, 0, 0, 0, 0 }, /* PC25 RxClk */ - { 1, 1, 0, 0, 0, 0 }, /* PC24 TxClk */ - { 0, 0, 0, 0, 0, 0 }, /* PC23 */ - { 0, 0, 0, 0, 0, 0 }, /* PC22 */ - { 0, 0, 0, 0, 0, 0 }, /* PC21 */ - { 0, 0, 0, 0, 0, 0 }, /* PC20 */ - { 0, 0, 0, 0, 0, 0 }, /* PC19 */ - { 0, 0, 0, 0, 0, 0 }, /* PC18 */ - { 0, 0, 0, 0, 0, 0 }, /* PC17 */ - { 0, 0, 0, 0, 0, 0 }, /* PC16 */ - { 0, 0, 0, 0, 0, 0 }, /* PC15 */ - { 0, 0, 0, 0, 0, 0 }, /* PC14 */ - { 0, 0, 0, 0, 0, 0 }, /* PC13 */ - { 0, 0, 0, 0, 0, 0 }, /* PC12 */ - { 0, 0, 0, 0, 0, 0 }, /* PC11 */ - { 0, 0, 0, 0, 0, 0 }, /* PC10 */ - { 1, 1, 0, 0, 0, 0 }, /* PC9 SCC4: CTS */ - { 1, 1, 0, 0, 0, 0 }, /* PC8 SCC4: CD */ - { 0, 0, 0, 0, 0, 0 }, /* PC7 */ - { 0, 0, 0, 0, 0, 0 }, /* PC6 */ - { 0, 0, 0, 0, 0, 0 }, /* PC5 */ - { 0, 0, 0, 0, 0, 0 }, /* PC4 */ - { 0, 0, 0, 0, 0, 0 }, /* PC3 */ - { 0, 0, 0, 0, 0, 0 }, /* PC2 */ - { 0, 0, 0, 0, 0, 0 }, /* PC1 */ - { 0, 0, 0, 0, 0, 0 }, /* PC0 */ - }, - - /* Port D */ - { /* conf ppar psor pdir podr pdat */ - { 0, 0, 0, 0, 0, 0 }, /* PD31 */ - { 0, 0, 0, 0, 0, 0 }, /* PD30 */ - { 0, 0, 0, 0, 0, 0 }, /* PD29 */ - { 0, 0, 0, 0, 0, 0 }, /* PD28 */ - { 0, 0, 0, 0, 0, 0 }, /* PD27 */ - { 0, 0, 0, 0, 0, 0 }, /* PD26 */ - { 0, 0, 0, 0, 0, 0 }, /* PD25 */ - { 0, 0, 0, 0, 0, 0 }, /* PD24 */ - { 0, 0, 0, 0, 0, 0 }, /* PD23 */ - { 1, 1, 0, 0, 0, 0 }, /* PD22 SCC4: RXD */ - { 1, 1, 0, 1, 0, 0 }, /* PD21 SCC4: TXD */ - { 1, 1, 0, 1, 0, 0 }, /* PD20 SCC4: RTS */ - { 0, 0, 0, 0, 0, 0 }, /* PD19 */ - { 0, 0, 0, 0, 0, 0 }, /* PD18 */ - { 0, 0, 0, 0, 0, 0 }, /* PD17 */ - { 0, 0, 0, 0, 0, 0 }, /* PD16 */ -#if defined(CONFIG_HARD_I2C) - { 1, 1, 1, 0, 1, 0 }, /* PD15 I2C SDA */ - { 1, 1, 1, 0, 1, 0 }, /* PD14 I2C SCL */ -#else - { 1, 0, 0, 0, 1, 1 }, /* PD15 */ - { 1, 0, 0, 1, 1, 1 }, /* PD14 */ -#endif - { 0, 0, 0, 0, 0, 0 }, /* PD13 */ - { 0, 0, 0, 0, 0, 0 }, /* PD12 */ - { 0, 0, 0, 0, 0, 0 }, /* PD11 */ - { 0, 0, 0, 0, 0, 0 }, /* PD10 */ - { 0, 0, 0, 0, 0, 0 }, /* PD9 */ - { 0, 0, 0, 0, 0, 0 }, /* PD8 */ - { 0, 0, 0, 0, 0, 0 }, /* PD7 */ - { 0, 0, 0, 0, 0, 0 }, /* PD6 */ - { 0, 0, 0, 0, 0, 0 }, /* PD5 */ - { 0, 0, 0, 0, 0, 0 }, /* PD4 */ - { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - { 0, 0, 0, 0, 0, 0 }, /* non-existent */ - { 0, 0, 0, 0, 0, 0 } /* non-existent */ - } -}; - -/* - * Try SDRAM initialization with P/LSDMR=sdmr and ORx=orx - * - * This routine performs standard 8260 initialization sequence - * and calculates the available memory size. It may be called - * several times to try different SDRAM configurations on both - * 60x and local buses. - */ -static long int try_init(memctl8260_t *memctl, ulong sdmr, - ulong orx, uchar *base) -{ - uchar c = 0xff; - ulong maxsize, size; - int i; - - /* - * We must be able to test a location outsize the maximum legal size - * to find out THAT we are outside; but this address still has to be - * mapped by the controller. That means, that the initial mapping has - * to be (at least) twice as large as the maximum expected size. - */ - maxsize = (1 + (~orx | 0x7fff))/* / 2*/; - - out_be32(&memctl->memc_or1, orx); - - /* - * Quote from 8260 UM (10.4.2 SDRAM Power-On Initialization, 10-35): - * - * "At system reset, initialization software must set up the - * programmable parameters in the memory controller banks registers - * (ORx, BRx, P/LSDMR). After all memory parameters are configured, - * system software should execute the following initialization sequence - * for each SDRAM device. - * - * 1. Issue a PRECHARGE-ALL-BANKS command - * 2. Issue eight CBR REFRESH commands - * 3. Issue a MODE-SET command to initialize the mode register - * - * The initial commands are executed by setting P/LSDMR[OP] and - * accessing the SDRAM with a single-byte transaction." - * - * The appropriate BRx/ORx registers have already been set when we - * get here. The SDRAM can be accessed at the address - * CONFIG_SYS_SDRAM_BASE. - */ - - out_be32(&memctl->memc_psdmr, sdmr | PSDMR_OP_PREA); - out_8(base, c); - - out_be32(&memctl->memc_psdmr, sdmr | PSDMR_OP_CBRR); - for (i = 0; i < 8; i++) - out_8(base, c); - - out_be32(&memctl->memc_psdmr, sdmr | PSDMR_OP_MRW); - /* setting MR on address lines */ - out_8((uchar *)(base + CONFIG_SYS_MRS_OFFS), c); - - out_be32(&memctl->memc_psdmr, sdmr | PSDMR_OP_NORM | PSDMR_RFEN); - out_8(base, c); - - size = get_ram_size((long *)base, maxsize); - out_be32(&memctl->memc_or1, orx | ~(size - 1)); - - return size; -} - -phys_size_t initdram(int board_type) -{ - immap_t *immap = (immap_t *) CONFIG_SYS_IMMR; - memctl8260_t *memctl = &immap->im_memctl; - - long psize; - - out_8(&memctl->memc_psrt, CONFIG_SYS_PSRT); - out_be16(&memctl->memc_mptpr, CONFIG_SYS_MPTPR); - -#ifndef CONFIG_SYS_RAMBOOT - /* 60x SDRAM setup: - */ - psize = try_init(memctl, CONFIG_SYS_PSDMR, CONFIG_SYS_OR1, - (uchar *) CONFIG_SYS_SDRAM_BASE); -#endif /* CONFIG_SYS_RAMBOOT */ - - icache_enable(); - - return psize; -} - -int checkboard(void) -{ -#if defined(CONFIG_MGCOGE) - puts("Board: Keymile mgcoge"); -#else - puts("Board: Keymile mgcoge2ne"); -#endif - if (ethernet_present()) - puts(" with PIGGY."); - puts("\n"); - return 0; -} - -/* - * Early board initalization. - */ -int board_early_init_r(void) -{ - struct km_bec_fpga *base = - (struct km_bec_fpga *)CONFIG_SYS_KMBEC_FPGA_BASE; - - /* setup the UPIOx */ - /* General Unit Reset disabled, Flash Bank enabled, UnitLed on */ - out_8(&base->oprth, (WRG_RESET | H_OPORTS_14 | WRG_LED)); - /* SCC4 enable, halfduplex, FCC1 powerdown */ - out_8(&base->oprtl, (H_OPORTS_SCC4_ENA | H_OPORTS_SCC4_FD_ENA | - H_OPORTS_FCC1_PW_DWN)); - - return 0; -} - -int last_stage_init(void) -{ - struct bfticu_iomap *base = - (struct bfticu_iomap *)CONFIG_SYS_FPGA_BASE; - u8 dip_switch; - - dip_switch = in_8(&base->mswitch); - dip_switch &= BFTICU_DIPSWITCH_MASK; - /* dip switch 'full reset' or 'db erase' */ - if (dip_switch & 0x1 || dip_switch & 0x2) { - /* start bootloader */ - puts("DIP: Enabled\n"); - setenv("actual_bank", "0"); - } - set_km_env(); - return 0; -} - -int hush_init_var(void) -{ - ivm_read_eeprom(); - return 0; -} - -#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) -void ft_board_setup(void *blob, bd_t *bd) -{ - ft_cpu_setup(blob, bd); -} -#endif /* defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) */ diff --git a/boards.cfg b/boards.cfg index 79266c9..4c52770 100644 --- a/boards.cfg +++ b/boards.cfg @@ -422,8 +422,8 @@ PQ2FADS-ZU_66MHz powerpc mpc8260 mpc8260ads freesca PQ2FADS-ZU_66MHz_lowboot powerpc mpc8260 mpc8260ads freescale - MPC8260ADS:ADSTYPE=CONFIG_SYS_PQ2FADS,8260_CLKIN=66000000,SYS_TEXT_BASE=0xFF800000 PQ2FADS-ZU_lowboot powerpc mpc8260 mpc8260ads freescale - MPC8260ADS:ADSTYPE=CONFIG_SYS_PQ2FADS,SYS_TEXT_BASE=0xFF800000 VoVPN-GW_66MHz powerpc mpc8260 vovpn-gw funkwerk - VoVPN-GW:CLKIN_66MHz -mgcoge powerpc mpc8260 - keymile -mgcoge2ne powerpc mpc8260 mgcoge keymile +mgcoge powerpc mpc8260 km82xx keymile +mgcoge2ne powerpc mpc8260 km82xx keymile SCM powerpc mpc8260 - siemens TQM8255_AA powerpc mpc8260 tqm8260 tqc - TQM8260:MPC8255,300MHz TQM8260_AA powerpc mpc8260 tqm8260 tqc - TQM8260:MPC8260,200MHz

From: Holger Brunck holger.brunck@keymile.com
To be prepared for mgcoge3ne which has a different SDRAM on board. The config was moved from generic code to board specific header.
Signed-off-by: Holger Brunck holger.brunck@keymile.com Acked-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de cc: Valentin Longchamp valentin.longchamp@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com --- include/configs/km82xx-common.h | 26 -------------------------- include/configs/mgcoge.h | 26 ++++++++++++++++++++++++++ include/configs/mgcoge2ne.h | 23 +++++++++++++++++++++++ 3 files changed, 49 insertions(+), 26 deletions(-)
diff --git a/include/configs/km82xx-common.h b/include/configs/km82xx-common.h index 345212c..da551c9 100644 --- a/include/configs/km82xx-common.h +++ b/include/configs/km82xx-common.h @@ -243,13 +243,6 @@ ORxG_SCY_5_CLK |\ ORxG_TRLX)
- -/* - * Bank 1 - 60x bus SDRAM - */ -#define SDRAM_MAX_SIZE 0x08000000 /* max. 128 MB */ -#define CONFIG_SYS_GLOBAL_SDRAM_LIMIT (256 << 20) /* less than 256 MB */ - #define CONFIG_SYS_MPTPR 0x1800
/* @@ -268,25 +261,6 @@ #define CONFIG_SYS_OR1_PRELIM CONFIG_SYS_OR1
/* - * SDRAM initialization values - */ - -#define CONFIG_SYS_OR1 ((~(CONFIG_SYS_GLOBAL_SDRAM_LIMIT-1) & ORxS_SDAM_MSK) |\ - ORxS_BPD_8 |\ - ORxS_ROWST_PBI0_A7 |\ - ORxS_NUMR_13) - -#define CONFIG_SYS_PSDMR (PSDMR_SDAM_A14_IS_A5 |\ - PSDMR_BSMA_A14_A16 |\ - PSDMR_SDA10_PBI0_A9 |\ - PSDMR_RFRC_5_CLK |\ - PSDMR_PRETOACT_2W |\ - PSDMR_ACTTORW_2W |\ - PSDMR_LDOTOPRE_1C |\ - PSDMR_WRC_1C |\ - PSDMR_CL_2) - -/* * UPIO FPGA (GPIO/PIGGY) on CS3 initialization values */ #define CONFIG_SYS_KMBEC_FPGA_BASE 0x30000000 diff --git a/include/configs/mgcoge.h b/include/configs/mgcoge.h index 3d2ee24..aed1526 100644 --- a/include/configs/mgcoge.h +++ b/include/configs/mgcoge.h @@ -58,6 +58,32 @@ CONFIG_SYS_FLASH_BASE_2 } #define MTDIDS_DEFAULT "nor3=app"
+/* + * Bank 1 - 60x bus SDRAM + */ +#define SDRAM_MAX_SIZE 0x08000000 /* max. 128 MB */ +#define CONFIG_SYS_GLOBAL_SDRAM_LIMIT (256 << 20) /* less than 256 MB */ + +/* SDRAM initialization values +*/ + +#define CONFIG_SYS_OR1 ((~(CONFIG_SYS_GLOBAL_SDRAM_LIMIT-1) & \ + ORxS_SDAM_MSK) |\ + ORxS_BPD_8 |\ + ORxS_ROWST_PBI0_A7 |\ + ORxS_NUMR_13) + +#define CONFIG_SYS_PSDMR (PSDMR_SDAM_A14_IS_A5 |\ + PSDMR_BSMA_A14_A16 |\ + PSDMR_SDA10_PBI0_A9 |\ + PSDMR_RFRC_5_CLK |\ + PSDMR_PRETOACT_2W |\ + PSDMR_ACTTORW_2W |\ + PSDMR_LDOTOPRE_1C |\ + PSDMR_WRC_1C |\ + PSDMR_CL_2) + + /* include further common stuff for all keymile 82xx boards */ #include "km82xx-common.h"
diff --git a/include/configs/mgcoge2ne.h b/include/configs/mgcoge2ne.h index 287b717..2b09b42 100644 --- a/include/configs/mgcoge2ne.h +++ b/include/configs/mgcoge2ne.h @@ -58,6 +58,29 @@
#define MTDIDS_DEFAULT "nor2=app"
+/* + * Bank 1 - 60x bus SDRAM + * mgcoge2ne has 128M RAM + */ +#define SDRAM_MAX_SIZE 0x08000000 /* max. 128 MB */ +#define CONFIG_SYS_GLOBAL_SDRAM_LIMIT (256 << 20) /* less than 256 MB */ + +#define CONFIG_SYS_OR1 ((~(CONFIG_SYS_GLOBAL_SDRAM_LIMIT-1) & \ + ORxS_SDAM_MSK) |\ + ORxS_BPD_8 |\ + ORxS_ROWST_PBI0_A7 |\ + ORxS_NUMR_13) + +#define CONFIG_SYS_PSDMR (PSDMR_SDAM_A14_IS_A5 |\ + PSDMR_BSMA_A14_A16 |\ + PSDMR_SDA10_PBI0_A9 |\ + PSDMR_RFRC_5_CLK |\ + PSDMR_PRETOACT_2W |\ + PSDMR_ACTTORW_2W |\ + PSDMR_LDOTOPRE_1C |\ + PSDMR_WRC_1C |\ + PSDMR_CL_2) + /* include further common stuff for all keymile 82xx boards */ #include "km82xx-common.h"

From: Holger Brunck holger.brunck@keymile.com
Reserved bit was changed according to the processors manual.
Signed-off-by: Holger Brunck holger.brunck@keymile.com Acked-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de cc: Valentin Longchamp valentin.longchamp@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com --- include/configs/km82xx-common.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/include/configs/km82xx-common.h b/include/configs/km82xx-common.h index da551c9..894e015 100644 --- a/include/configs/km82xx-common.h +++ b/include/configs/km82xx-common.h @@ -182,7 +182,7 @@ #define CONFIG_SYS_HID2 0
#define CONFIG_SYS_SIUMCR 0x4020c200 -#define CONFIG_SYS_SYPCR 0xFFFFFFC3 +#define CONFIG_SYS_SYPCR 0xFFFFFF83 #define CONFIG_SYS_BCR 0x10000000 #define CONFIG_SYS_SCCR (SCCR_PCI_MODE | SCCR_PCI_MODCK)

From: Holger Brunck holger.brunck@keymile.com
This patch rename mgcoge2ne board support to mgcoge3ne. The board is similar to mgcoge. The difference is that a NUMONYX flash is used and a larger SDRAM (256MB). Also introduce CONFIG_KM_82XX to collect ppc82xx common settings.
Signed-off-by: Holger Brunck holger.brunck@keymile.com Acked-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de cc: Valentin Longchamp valentin.longchamp@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com --- MAINTAINERS | 2 +- board/keymile/common/common.c | 6 +- board/keymile/common/common.h | 1 + board/keymile/km82xx/km82xx.c | 27 ++++++++++++ boards.cfg | 2 +- include/configs/mgcoge.h | 1 + include/configs/mgcoge2ne.h | 87 ------------------------------------- include/configs/mgcoge3ne.h | 95 +++++++++++++++++++++++++++++++++++++++++ 8 files changed, 129 insertions(+), 92 deletions(-) delete mode 100644 include/configs/mgcoge2ne.h create mode 100644 include/configs/mgcoge3ne.h
diff --git a/MAINTAINERS b/MAINTAINERS index 9586bcb..37e03c9 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -429,7 +429,7 @@ Heiko Schocher hs@denx.de kmeter1 MPC8360 kmsupx5 MPC8321 mgcoge MPC8247 - mgcoge2ne MPC8247 + mgcoge3ne MPC8247 mgcoge2un ARM926EJS (Kirkwood SoC) mucmc52 MPC5200 muas3001 MPC8270 diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c index b113c0a..3a7980d 100644 --- a/board/keymile/common/common.c +++ b/board/keymile/common/common.c @@ -22,7 +22,7 @@ */
#include <common.h> -#if defined(CONFIG_MGCOGE) || defined(CONFIG_MGCOGE2NE) +#if defined(CONFIG_KM82XX) #include <mpc8260.h> #endif #include <ioports.h> @@ -398,10 +398,10 @@ int ivm_read_eeprom(void) #define DELAY_ABORT_SEQ 62 /* @200kHz 9 clocks = 44us, 62us is ok */ #define DELAY_HALF_PERIOD (500 / (CONFIG_SYS_I2C_SPEED / 1000))
-#if defined(CONFIG_MGCOGE) || defined(CONFIG_MGCOGE2NE) +#if defined(CONFIG_KM_82XX) #define SDA_MASK 0x00010000 #define SCL_MASK 0x00020000 -static void set_pin(int state, unsigned long mask) +void set_pin(int state, unsigned long mask) { ioport_t *iop = ioport_addr((immap_t *)CONFIG_SYS_IMMR, 3);
diff --git a/board/keymile/common/common.h b/board/keymile/common/common.h index 6ce992a..cee24d4 100644 --- a/board/keymile/common/common.h +++ b/board/keymile/common/common.h @@ -124,6 +124,7 @@ struct bfticu_iomap {
int ethernet_present(void); int ivm_read_eeprom(void); +void set_pin(int state, unsigned long mask);
int set_km_env(void); int fdt_set_node_and_value(void *blob, diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c index 3db3c7b..5dc7ffa 100644 --- a/board/keymile/km82xx/km82xx.c +++ b/board/keymile/km82xx/km82xx.c @@ -287,6 +287,8 @@ int checkboard(void) { #if defined(CONFIG_MGCOGE) puts("Board: Keymile mgcoge"); +#elif defined(CONFIG_MGCOGE3NE) + puts("Board: Keymile mgcoge3ne"); #else puts("Board: Keymile mgcoge2ne"); #endif @@ -296,6 +298,28 @@ int checkboard(void) return 0; }
+#ifdef CONFIG_MGCOGE3NE +/* + * For mgcoge3ne boards, the mgcoge3un control is controlled from + * a GPIO line on the PPC CPU. If bobcatreset is set the line + * will toggle once what forces the mgocge3un part to restart + * immediately. + */ +void handle_mgcoge3un_reset(void) +{ + char *bobcatreset = getenv("bobcatreset"); + if (bobcatreset) { + if (strcmp(bobcatreset, "true") == 0) { + puts("Forcing bobcat reset\n"); + set_pin(0, 0x00000004); /* clear PD29 to reset arm */ + udelay(1000); + set_pin(1, 0x00000004); + } else + set_pin(1, 0x00000004); /* set PD29 to not reset arm */ + } +} +#endif + /* * Early board initalization. */ @@ -311,6 +335,9 @@ int board_early_init_r(void) out_8(&base->oprtl, (H_OPORTS_SCC4_ENA | H_OPORTS_SCC4_FD_ENA | H_OPORTS_FCC1_PW_DWN));
+#ifdef CONFIG_MGCOGE3NE + handle_mgcoge3un_reset(); +#endif return 0; }
diff --git a/boards.cfg b/boards.cfg index 4c52770..f6105be 100644 --- a/boards.cfg +++ b/boards.cfg @@ -423,7 +423,7 @@ PQ2FADS-ZU_66MHz_lowboot powerpc mpc8260 mpc8260ads freesca PQ2FADS-ZU_lowboot powerpc mpc8260 mpc8260ads freescale - MPC8260ADS:ADSTYPE=CONFIG_SYS_PQ2FADS,SYS_TEXT_BASE=0xFF800000 VoVPN-GW_66MHz powerpc mpc8260 vovpn-gw funkwerk - VoVPN-GW:CLKIN_66MHz mgcoge powerpc mpc8260 km82xx keymile -mgcoge2ne powerpc mpc8260 km82xx keymile +mgcoge3ne powerpc mpc8260 km82xx keymile SCM powerpc mpc8260 - siemens TQM8255_AA powerpc mpc8260 tqm8260 tqc - TQM8260:MPC8255,300MHz TQM8260_AA powerpc mpc8260 tqm8260 tqc - TQM8260:MPC8260,200MHz diff --git a/include/configs/mgcoge.h b/include/configs/mgcoge.h index aed1526..93a6f4a 100644 --- a/include/configs/mgcoge.h +++ b/include/configs/mgcoge.h @@ -32,6 +32,7 @@ #define CONFIG_MPC8247 #define CONFIG_MGCOGE #define CONFIG_HOSTNAME mgcoge +#define CONFIG_KM_82XX
#define CONFIG_SYS_TEXT_BASE 0xFE000000
diff --git a/include/configs/mgcoge2ne.h b/include/configs/mgcoge2ne.h deleted file mode 100644 index 2b09b42..0000000 --- a/include/configs/mgcoge2ne.h +++ /dev/null @@ -1,87 +0,0 @@ -/* - * (C) Copyright 2007-2010 - * Heiko Schocher, DENX Software Engineering, hs@denx.de. - * - * See file CREDITS for list of people who contributed to this - * project. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - */ - -#ifndef __MGCOGE2NE -#define __MGCOGE2NE - -/* - * High Level Configuration Options - * (easy to change) - */ -#define CONFIG_MPC8247 -#define CONFIG_MGCOGE -#define CONFIG_HOSTNAME mgcoge2ne - -#define CONFIG_SYS_TEXT_BASE 0xFE000000 - -/* include common defines/options for all Keymile boards */ -#include "keymile-common.h" -#include "km-powerpc.h" - -#define CONFIG_SYS_SDRAM_BASE 0x00000000 -#define CONFIG_SYS_FLASH_BASE 0xFE000000 -#define CONFIG_SYS_FLASH_SIZE 32 -#define CONFIG_SYS_FLASH_CFI -#define CONFIG_FLASH_CFI_DRIVER -#define CONFIG_SYS_MAX_FLASH_BANKS 3 /* max num of flash banks */ -#define CONFIG_SYS_MAX_FLASH_SECT 512 /* - * max num of sects on one - * chip - */ - -#define CONFIG_SYS_FLASH_BASE_1 0x50000000 -#define CONFIG_SYS_FLASH_SIZE_1 64 -#define CONFIG_SYS_FLASH_SIZE_2 0 - -#define CONFIG_SYS_FLASH_BANKS_LIST { CONFIG_SYS_FLASH_BASE, \ - CONFIG_SYS_FLASH_BASE_1 } - -#define MTDIDS_DEFAULT "nor2=app" - -/* - * Bank 1 - 60x bus SDRAM - * mgcoge2ne has 128M RAM - */ -#define SDRAM_MAX_SIZE 0x08000000 /* max. 128 MB */ -#define CONFIG_SYS_GLOBAL_SDRAM_LIMIT (256 << 20) /* less than 256 MB */ - -#define CONFIG_SYS_OR1 ((~(CONFIG_SYS_GLOBAL_SDRAM_LIMIT-1) & \ - ORxS_SDAM_MSK) |\ - ORxS_BPD_8 |\ - ORxS_ROWST_PBI0_A7 |\ - ORxS_NUMR_13) - -#define CONFIG_SYS_PSDMR (PSDMR_SDAM_A14_IS_A5 |\ - PSDMR_BSMA_A14_A16 |\ - PSDMR_SDA10_PBI0_A9 |\ - PSDMR_RFRC_5_CLK |\ - PSDMR_PRETOACT_2W |\ - PSDMR_ACTTORW_2W |\ - PSDMR_LDOTOPRE_1C |\ - PSDMR_WRC_1C |\ - PSDMR_CL_2) - -/* include further common stuff for all keymile 82xx boards */ -#include "km82xx-common.h" - -#endif /* __MGCOGE2NE */ diff --git a/include/configs/mgcoge3ne.h b/include/configs/mgcoge3ne.h new file mode 100644 index 0000000..3df7ef1 --- /dev/null +++ b/include/configs/mgcoge3ne.h @@ -0,0 +1,95 @@ +/* + * (C) Copyright 2011 + * Heiko Schocher, DENX Software Engineering, hs@denx.de. + * + * See file CREDITS for list of people who contributed to this + * project. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License as + * published by the Free Software Foundation; either version 2 of + * the License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, + * MA 02111-1307 USA + */ + +#ifndef __MGCOGE3NE +#define __MGCOGE3NE + +/* + * High Level Configuration Options + * (easy to change) + */ + +#define CONFIG_MPC8247 +#define CONFIG_MGCOGE3NE +#define CONFIG_HOSTNAME mgcoge3ne +#define CONFIG_KM_82XX + +#define CONFIG_SYS_TEXT_BASE 0xFE000000 + +/* include common defines/options for all Keymile boards */ +#include "keymile-common.h" +#include "km-powerpc.h" + +#define CONFIG_SYS_SDRAM_BASE 0x00000000 +#define CONFIG_SYS_FLASH_BASE 0xFE000000 +#define CONFIG_SYS_FLASH_SIZE 32 +#define CONFIG_SYS_FLASH_CFI +#define CONFIG_FLASH_CFI_DRIVER +#define CONFIG_SYS_MAX_FLASH_BANKS 2 /* max num of flash banks */ +#define CONFIG_SYS_MAX_FLASH_SECT 1024 /* + * max num of sects on one + * chip + */ + +#define CONFIG_SYS_FLASH_BASE_1 0x50000000 +#ifdef CONFIG_COGE3NE_P1X +#define CONFIG_SYS_FLASH_SIZE_1 64 +#else +#define CONFIG_SYS_FLASH_SIZE_1 128 +#endif + +#define CONFIG_SYS_FLASH_SIZE_2 0 /* dummy value to calc SYS_OR5 */ + +#define CONFIG_SYS_FLASH_BANKS_LIST { CONFIG_SYS_FLASH_BASE, \ + CONFIG_SYS_FLASH_BASE_1 } + +#define MTDIDS_DEFAULT "nor2=app" + +/* + * Bank 1 - 60x bus SDRAM + * mgcoge3ne has 256M. + */ +#define SDRAM_MAX_SIZE 0x10000000 /* max. 256 MB */ +#define CONFIG_SYS_GLOBAL_SDRAM_LIMIT (512 << 20) /* less than 512 MB */ + +#define CONFIG_SYS_OR1 ((~(CONFIG_SYS_GLOBAL_SDRAM_LIMIT-1) & \ + ORxS_SDAM_MSK) |\ + ORxS_BPD_4 |\ + ORxS_ROWST_PBI1_A4 |\ + ORxS_NUMR_13) + +#define CONFIG_SYS_PSDMR (PSDMR_PBI |\ + PSDMR_SDAM_A17_IS_A5 |\ + PSDMR_BSMA_A13_A15 |\ + PSDMR_SDA10_PBI1_A6 |\ + PSDMR_RFRC_5_CLK |\ + PSDMR_PRETOACT_2W |\ + PSDMR_ACTTORW_2W |\ + PSDMR_LDOTOPRE_1C |\ + PSDMR_WRC_2C |\ + PSDMR_CL_2) + +/* include further common stuff for all keymile 82xx boards */ +#include "km82xx-common.h" + +#endif /* __MGCOGE3NE */

From: Holger Brunck holger.brunck@keymile.com
On mgcoge3ne a new environment variable bobcatreset is used. So this patch adds a possibility to add board specific environment variables in general and this specific variable for mgcoge3ne.
Signed-off-by: Holger Brunck holger.brunck@keymile.com Acked-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de cc: Valentin Longchamp valentin.longchamp@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com --- include/configs/km82xx-common.h | 1 + include/configs/mgcoge.h | 2 ++ include/configs/mgcoge3ne.h | 2 ++ 3 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/include/configs/km82xx-common.h b/include/configs/km82xx-common.h index 894e015..446c1d0 100644 --- a/include/configs/km82xx-common.h +++ b/include/configs/km82xx-common.h @@ -80,6 +80,7 @@ * Default environment settings */ #define CONFIG_EXTRA_ENV_SETTINGS \ + CONFIG_KM_BOARD_EXTRA_ENV \ CONFIG_KM_DEF_ENV \ "EEprom_ivm=pca9544a:70:4 \0" \ "unlock=yes\0" \ diff --git a/include/configs/mgcoge.h b/include/configs/mgcoge.h index 93a6f4a..0745855 100644 --- a/include/configs/mgcoge.h +++ b/include/configs/mgcoge.h @@ -85,6 +85,8 @@ PSDMR_CL_2)
+#define CONFIG_KM_BOARD_EXTRA_ENV "" + /* include further common stuff for all keymile 82xx boards */ #include "km82xx-common.h"
diff --git a/include/configs/mgcoge3ne.h b/include/configs/mgcoge3ne.h index 3df7ef1..78ce468 100644 --- a/include/configs/mgcoge3ne.h +++ b/include/configs/mgcoge3ne.h @@ -89,6 +89,8 @@ PSDMR_WRC_2C |\ PSDMR_CL_2)
+#define CONFIG_KM_BOARD_EXTRA_ENV "bobcatreset=true\0" + /* include further common stuff for all keymile 82xx boards */ #include "km82xx-common.h"

From: Holger Brunck holger.brunck@keymile.com
This environment variable is used to set the bootcount address for the kernel.
Signed-off-by: Holger Brunck holger.brunck@keymile.com Acked-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de cc: Valentin Longchamp valentin.longchamp@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com --- board/keymile/common/common.c | 7 +++++++ include/configs/km_arm.h | 3 +++ 2 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c index 3a7980d..9ec0022 100644 --- a/board/keymile/common/common.c +++ b/board/keymile/common/common.c @@ -106,6 +106,13 @@ int set_km_env(void) varaddr = gd->ram_size - CONFIG_KM_RESERVED_PRAM - CONFIG_KM_PHRAM; sprintf((char *)buf, "0x%x", varaddr); setenv("varaddr", (char *)buf); + +#ifdef BOOTCOUNT_ADDR + unsigned int bootcountaddr; + bootcountaddr = gd->ram_size - CONFIG_KM_RESERVED_PRAM; + sprintf((char *)buf, "0x%x", bootcountaddr); + setenv("bootcountaddr", (char *)buf); +#endif return 0; }
diff --git a/include/configs/km_arm.h b/include/configs/km_arm.h index 70113d4..89f9d35 100644 --- a/include/configs/km_arm.h +++ b/include/configs/km_arm.h @@ -64,6 +64,9 @@ #define CONFIG_KM_KERNEL_ADDR 0x2000000 /* 4096KBytes */
#define CONFIG_KM_DEF_ENV_CPU \ + "addbootcount=" \ + "setenv bootargs ${bootargs} " \ + "bootcountaddr=${bootcountaddr}\0" \ "addmtdparts=setenv bootargs ${bootargs} ${mtdparts}\0" \ "boot=bootm ${actual_kernel_addr} - -\0" \ "cramfsloadfdt=echo \\c\0" \

From: Heiko Schocher hs@denx.de
Signed-off-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de cc: Valentin Longchamp valentin.longchamp@keymile.com cc: Holger Brunck holger.brunck@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com --- common/cmd_cramfs.c | 12 +++++++++++- fs/cramfs/cramfs.c | 4 ++++ 2 files changed, 15 insertions(+), 1 deletions(-)
diff --git a/common/cmd_cramfs.c b/common/cmd_cramfs.c index 8c86dc5..5e1487f 100644 --- a/common/cmd_cramfs.c +++ b/common/cmd_cramfs.c @@ -43,7 +43,9 @@ #endif
#ifdef CONFIG_CRAMFS_CMDLINE -flash_info_t flash_info[1]; +#if !defined(CONFIG_SYS_NO_FLASH) +#include <flash.h> +#endif
#ifndef CONFIG_CMD_JFFS2 #include <linux/stat.h> @@ -119,7 +121,11 @@ int do_cramfs_load(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) dev.id = &id; part.dev = &dev; /* fake the address offset */ +#if !defined(CONFIG_SYS_NO_FLASH) part.offset = addr - flash_info[id.num].start[0]; +#else + part.offset = addr; +#endif
/* pre-set Boot file name */ if ((filename = getenv("bootfile")) == NULL) { @@ -182,7 +188,11 @@ int do_cramfs_ls(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) dev.id = &id; part.dev = &dev; /* fake the address offset */ +#if !defined(CONFIG_SYS_NO_FLASH) part.offset = addr - flash_info[id.num].start[0]; +#else + part.offset = addr; +#endif
if (argc == 2) filename = argv[1]; diff --git a/fs/cramfs/cramfs.c b/fs/cramfs/cramfs.c index 2956d39..910955d 100644 --- a/fs/cramfs/cramfs.c +++ b/fs/cramfs/cramfs.c @@ -41,8 +41,12 @@ struct cramfs_super super;
/* CPU address space offset calculation macro, struct part_info offset is * device address space offset, so we need to shift it by a device start address. */ +#if !defined(CONFIG_SYS_NO_FLASH) extern flash_info_t flash_info[]; #define PART_OFFSET(x) (x->offset + flash_info[x->dev->id->num].start[0]) +#else +#define PART_OFFSET(x) (x->offset) +#endif
static int cramfs_read_super (struct part_info *info) {

From: Heiko Schocher hs@denx.de
Deblock i2c bus when switching to another i2c bus, if using i2c_set_bus_num().
Signed-off-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de cc: Valentin Longchamp valentin.longchamp@keymile.com cc: Holger Brunck holger.brunck@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com --- drivers/i2c/soft_i2c.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/drivers/i2c/soft_i2c.c b/drivers/i2c/soft_i2c.c index 69b5f42..9b02e89 100644 --- a/drivers/i2c/soft_i2c.c +++ b/drivers/i2c/soft_i2c.c @@ -286,6 +286,7 @@ int i2c_set_bus_num(unsigned int bus) int ret;
ret = i2x_mux_select_mux(bus); + i2c_init_board(); if (ret == 0) i2c_bus_num = bus; else

From: Thomas Herzmann thomas.herzmann@keymile.com
The initial_boot_bank can be set when more than one application is used in a bootpackage. But a value n <> 0 never led to booting from bank n. Instead, bank 0 was booted. This patch fixes this.
Signed-off-by: Thomas Herzmann thomas.herzmann@keymile.com Signed-off-by: Holger Brunck holger.brunck@keymile.com Acked-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de cc: Valentin Longchamp valentin.longchamp@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com --- include/configs/keymile-common.h | 15 ++++++++------- 1 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/include/configs/keymile-common.h b/include/configs/keymile-common.h index 6329a1c..5c32023 100644 --- a/include/configs/keymile-common.h +++ b/include/configs/keymile-common.h @@ -249,10 +249,10 @@ "printbootargs boot " \ "" && " \ "setenv bootcmd '" \ - "run bootrunner; reset" \ + "run actual bootrunner; reset" \ "' && " \ "setenv altbootcmd '" \ - "run actual0 bootcmd; reset" \ + "run backup bootrunner; reset" \ "' && " \ "saveenv && " \ "reset\0" \ @@ -290,7 +290,7 @@ "addramfs=" \ "setenv bootargs "" \ "${bootargs} phram.phram=" \ - "rootfs${actual_bank},${rootfsaddr},${rootfssize}"\0" \ + "rootfs${boot_bank},${rootfsaddr},${rootfssize}"\0" \ "addtty=" \ "setenv bootargs ${bootargs}" \ " console=" CONFIG_KM_CONSOLE_TTY ",${baudrate}\0" \ @@ -305,7 +305,7 @@ "flashargs=" \ "setenv bootargs " \ "ubi.mtd=" CONFIG_KM_UBI_LINUX_MTD_NAME " " \ - "root=mtdblock:rootfs${actual_bank} " \ + "root=mtdblock:rootfs${boot_bank} " \ "rootfstype=squashfs ro\0" \ ""
@@ -354,7 +354,7 @@ "cramfsload ${kernel_addr_r} uImage && " \ "setenv actual_kernel_addr ${kernel_addr_r}\0" \ "ubiattach=ubi part ${ubipartition}\0" \ - "ubicopy=ubi read ${cramfsaddr} bootfs${actual_bank}\0" \ + "ubicopy=ubi read ${cramfsaddr} bootfs${boot_bank}\0" \ "ubipartition=" CONFIG_KM_UBI_PARTITION_NAME "\0" \ ""
@@ -384,9 +384,10 @@ * - 'default': setup default environment */ #define CONFIG_KM_DEF_ENV_CONSTANTS \ - "actual=setenv actual_bank ${initial_boot_bank}\0" \ - "actual0=setenv actual_bank 0\0" \ + "actual=setenv boot_bank ${actual_bank}\0" \ + "backup=setenv boot_bank ${backup_bank}\0" \ "actual_bank=${initial_boot_bank}\0" \ + "backup_bank=0\0" \ "default=" \ "setenv default 'run newenv; reset' && " \ "run release && saveenv; reset\0" \

From: Holger Brunck holger.brunck@keymile.com
Signed-off-by: Holger Brunck holger.brunck@keymile.com Acked-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de cc: Valentin Longchamp valentin.longchamp@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com --- common/hush.c | 3 +-- include/hush.h | 1 + 2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/common/hush.c b/common/hush.c index 8021a68..85a6030 100644 --- a/common/hush.c +++ b/common/hush.c @@ -497,7 +497,6 @@ static void remove_bg_job(struct pipe *pi); /* local variable support */ static char **make_list_in(char **inp, char *name); static char *insert_var_value(char *inp); -static char *get_local_var(const char *var);
#ifndef __U_BOOT__ /* Table of built-in functions. They can be forked or not, depending on @@ -2169,7 +2168,7 @@ static char *get_dollar_var(char ch); #endif
/* This is used to get/check local shell variables */ -static char *get_local_var(const char *s) +char *get_local_var(const char *s) { struct variables *cur;
diff --git a/include/hush.h b/include/hush.h index 0805ff3..5c566cc 100644 --- a/include/hush.h +++ b/include/hush.h @@ -34,6 +34,7 @@ extern int parse_file_outer(void);
int set_local_var(const char *s, int flg_export); void unset_local_var(const char *name); +char *get_local_var(const char *s);
#if defined(CONFIG_HUSH_INIT_VAR) extern int hush_init_var (void);

From: Holger Brunck holger.brunck@keymile.com
Read out board id and HW key from the IVM eeprom and set these values as an environment variable was now done inside the code as a command.
Signed-off-by: Holger Brunck holger.brunck@keymile.com Acked-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de cc: Valentin Longchamp valentin.longchamp@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com --- board/keymile/common/common.c | 25 +++++++++++++++++++++++++ 1 files changed, 25 insertions(+), 0 deletions(-)
diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c index 9ec0022..5704b7f 100644 --- a/board/keymile/common/common.c +++ b/board/keymile/common/common.c @@ -25,6 +25,7 @@ #if defined(CONFIG_KM82XX) #include <mpc8260.h> #endif +#include <command.h> #include <ioports.h> #include <malloc.h> #include <hush.h> @@ -689,3 +690,27 @@ int board_eth_init(bd_t *bis)
return -1; } + +/* + * do_setboardid command + * read out the board id and the hw key from the intventory EEPROM and set + * this values as environment variables. + */ +static int do_setboardid(cmd_tbl_t *cmdtp, int flag, int argc, + char *const argv[]) +{ + unsigned char buf[32]; + char *p; + + p = get_local_var("IVM_BoardId"); + sprintf((char *)buf, "%s", p); + setenv("boardid", (char *)buf); + p = get_local_var("IVM_HWKey"); + sprintf((char *)buf, "%s", p); + setenv("hwkey", (char *)buf); + return 0; +} + +U_BOOT_CMD(km_setboardid, 1, 0, do_setboardid, "setboardid", "read out bid and " + "hwkey from IVM and set in environment"); +

From: Thomas Herzmann thomas.herzmann@keymile.com
The environment variable (defining a checkboardidlist function) has been replaced by a u-boot function call. This call is much faster and the environment is a leaner.
Signed-off-by: Thomas Herzmann thomas.herzmann@keymile.com Signed-off-by: Holger Brunck holger.brunck@keymile.com Acked-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de cc: Valentin Longchamp valentin.longchamp@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com --- board/keymile/common/common.c | 112 ++++++++++++++++++++++++++++++++++++++ include/configs/keymile-common.h | 30 +---------- 2 files changed, 113 insertions(+), 29 deletions(-)
diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c index 5704b7f..72278a0 100644 --- a/board/keymile/common/common.c +++ b/board/keymile/common/common.c @@ -32,6 +32,7 @@ #include <net.h> #include <netdev.h> #include <asm/io.h> +#include <linux/ctype.h>
#if defined(CONFIG_OF_BOARD_SETUP) && defined(CONFIG_OF_LIBFDT) #include <libfdt.h> @@ -714,3 +715,114 @@ static int do_setboardid(cmd_tbl_t *cmdtp, int flag, int argc, U_BOOT_CMD(km_setboardid, 1, 0, do_setboardid, "setboardid", "read out bid and " "hwkey from IVM and set in environment");
+/* + * command km_checkboardidlist + * if "boardid" and "hwkey" are not already set in the environment, do: + * if a "boardIdListHex" exists in the environment: + * - read ivm data for boardid and hwkey + * - compare each entry of the boardIdListHex with the + * IVM data: + * if match: + * set environment variables boardid, boardId, + * hwkey, hwKey to the found values + * both (boardid and boardId) are set because + * they might be used differently in the + * application and in the init scripts (?) + * return 0 in case of match, 1 if not match or error + */ +int do_checkboardidlist(cmd_tbl_t *cmdtp, int flag, int argc, + char *const argv[]) +{ + unsigned long ivmbid = 0, ivmhwkey = 0; + unsigned long envbid = 0, envhwkey = 0; + char *p; + int verbose = argc > 1 && *argv[1] == 'v'; + int rc = 1; /* default: no match */ + + p = get_local_var("IVM_BoardId"); + strict_strtoul(p, 16, &ivmbid); + p = get_local_var("IVM_HWKey"); + strict_strtoul(p, 16, &ivmhwkey); + + if (!ivmbid || !ivmhwkey) { + printf("Error: IVM_BoardId and/or IVM_HWKey not set!\n"); + return rc; + } + + /* try to read values from environment */ + p = getenv("boardid"); + if (p != NULL) + strict_strtoul(p, 16, &envbid); + p = getenv("hwkey"); + if (p != NULL) + strict_strtoul(p, 16, &envhwkey); + + if (!envbid || !envhwkey) { + /* must set environment first */ + char *bidhwklist = getenv("boardIdListHex"); + if (bidhwklist) { + int found = 0; + char *rest = bidhwklist; + char *endp; + if (verbose) { + printf("IVM_BoardId: %ld, IVM_HWKey=%ld\n", + ivmbid, ivmhwkey); + printf("boardIdHwKeyList: %s\n", + bidhwklist); + } + while (!found) { + /* loop over each bid/hwkey pair in the list */ + unsigned long bid = 0; + unsigned long hwkey = 0; + while (*rest && !isxdigit(*rest)) + rest++; + bid = simple_strtoul(rest, &endp, 16); + if (*endp == '_') { + rest = endp + 1; + hwkey = simple_strtoul(rest, &endp, 16); + rest = endp; + while (*rest && !isxdigit(*rest)) + rest++; + } + if ((!bid) || (!hwkey)) { + /* end of list */ + break; + } + if (verbose) { + printf("trying bid=0x%lX, hwkey=%ld\n", + bid, hwkey); + } + if ((bid == ivmbid) && (hwkey == ivmhwkey)) { + char buf[10]; + + found = 1; + envbid = bid; + envhwkey = hwkey; + sprintf(buf, "%lx", bid); + setenv("boardid", buf); + sprintf(buf, "%lx", hwkey); + setenv("hwkey", buf); + saveenv(); + } + } /* end while( ! found ) */ + } + } + + /* compare now the values */ + if ((ivmbid == envbid) && (ivmhwkey == envhwkey)) { + printf("boardid=0x%3lX, hwkey=%ld\n", envbid, envhwkey); + rc = 0; + } else { + printf("Error: env bId=0x%3lX, hwKey=%ld\n", envbid, envhwkey); + printf(" IVM bId=0x%3lX, hwKey=%ld\n", ivmbid, ivmhwkey); + } + return rc; +} + +U_BOOT_CMD(km_checkbidhwk, 2, 0, do_checkboardidlist, + "check boardid and hwkey", + "[v]\n - check environment parameter "\ + ""boardIdListHex" against stored boardid and hwkey "\ + "from the IVM\n v: verbose output" +); + diff --git a/include/configs/keymile-common.h b/include/configs/keymile-common.h index 5c32023..a6d3bcf 100644 --- a/include/configs/keymile-common.h +++ b/include/configs/keymile-common.h @@ -240,7 +240,6 @@ "release=" \ "setenv actual_bank ${initial_boot_bank} && " \ "setenv subbootcmds "" \ - "checkboardidlist " \ "checkboardid " \ "ubiattach ubicopy " \ "cramfsloadfdt cramfsloadkernel " \ @@ -391,36 +390,9 @@ "default=" \ "setenv default 'run newenv; reset' && " \ "run release && saveenv; reset\0" \ - "checkboardidlist=" \ - "if test "x${boardIdListHex}" != "x"; then " \ - "IVMbidhwk=${IVM_BoardId}_${IVM_HWKey}; " \ - "found=0; " \ - "for bidhwk in "${boardIdListHex}"; do " \ - "echo trying $bidhwk ...; " \ - "if test "x$bidhwk" = "x$IVMbidhwk"; then " \ - "found=1; " \ - "echo match found for $bidhwk; " \ - "if test "x$bidhwk" != "x${boardId}_${hwKey}";then "\ - "setenv boardid ${IVM_BoardId}; " \ - "setenv boardId ${IVM_BoardId}; " \ - "setenv hwkey ${IVM_HWKey}; " \ - "setenv hwKey ${IVM_HWKey}; " \ - "echo "boardId set to ${boardId}"; " \ - "echo "hwKey set to ${hwKey}"; " \ - "saveenv; " \ - "fi; " \ - "fi; " \ - "done; " \ - "else " \ - "echo "boardIdListHex not set, not checked"; "\ - "found=1; " \ - "fi; " \ - "test "$found" = 1 \0" \ - "checkboardid=" \ - "test "x${boardId}" = "x${IVM_BoardId}" && " \ - "test "x${hwKey}" = "x${IVM_HWKey}"\0" \ "printbootargs=print bootargs\0" \ "rootfsfile="xstr(CONFIG_HOSTNAME) "/rootfsImage\0" \ + "checkboardid=km_checkbidhwk\0" \ ""
#ifndef CONFIG_KM_DEF_ENV

From: Holger Brunck holger.brunck@keymile.com
The pnvram size was used later from start scripts in linux. Therefore it must be set inside u-boot.
Signed-off-by: Holger Brunck holger.brunck@keymile.com Acked-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de cc: Valentin Longchamp valentin.longchamp@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com --- board/keymile/common/common.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
diff --git a/board/keymile/common/common.c b/board/keymile/common/common.c index 72278a0..da73f66 100644 --- a/board/keymile/common/common.c +++ b/board/keymile/common/common.c @@ -100,6 +100,9 @@ int set_km_env(void) sprintf((char *)buf, "0x%x", pnvramaddr); setenv("pnvramaddr", (char *)buf);
+ sprintf((char *)buf, "0x%x", CONFIG_KM_PNVRAM); + setenv("pnvramsize", (char *)buf); + pram = (CONFIG_KM_RESERVED_PRAM + CONFIG_KM_PHRAM + CONFIG_KM_PNVRAM) / 0x400; sprintf((char *)buf, "0x%x", pram);

From: Holger Brunck holger.brunck@keymile.com
Signed-off-by: Holger Brunck holger.brunck@keymile.com Acked-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de cc: Valentin Longchamp valentin.longchamp@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com --- include/configs/keymile-common.h | 4 ++-- include/configs/km_arm.h | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/include/configs/keymile-common.h b/include/configs/keymile-common.h index a6d3bcf..b313b2e 100644 --- a/include/configs/keymile-common.h +++ b/include/configs/keymile-common.h @@ -86,7 +86,7 @@ #define CONFIG_SYS_HZ 1000 /* decr. freq: 1 ms ticks */
#define CONFIG_BAUDRATE 115200 -#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400 } +#define CONFIG_SYS_BAUDRATE_TABLE { 9600, 19200, 38400, 57600, 115200, 230400 }
#define CONFIG_LOADS_ECHO #define CONFIG_SYS_LOADS_BAUD_CHANGE @@ -425,6 +425,6 @@ "" #endif /* CONFIG_KM_DEF_ENV */
-#define CONFIG_VERSION_VARIABLE /* include version env variable */ +#define CONFIG_VERSION_VARIABLE /* include version env variable */
#endif /* __CONFIG_KEYMILE_H */ diff --git a/include/configs/km_arm.h b/include/configs/km_arm.h index 06f91fe..0148b24 100644 --- a/include/configs/km_arm.h +++ b/include/configs/km_arm.h @@ -110,7 +110,7 @@ #define CONFIG_BOOTMAPSZ (8 << 20) /* Initial Memmap for Linux */ #define CONFIG_CMDLINE_TAG /* enable passing of ATAGs */ #define CONFIG_INITRD_TAG /* enable INITRD tag */ -#define CONFIG_SETUP_MEMORY_TAGS /* enable memory tag */ +#define CONFIG_SETUP_MEMORY_TAGS /* enable memory tag */
/* * Commands configuration @@ -185,10 +185,10 @@ #ifndef __ASSEMBLY__ #include <asm/arch-kirkwood/gpio.h> extern void __set_direction(unsigned pin, int high); -void set_sda (int state); -void set_scl (int state); -int get_sda (void); -int get_scl (void); +void set_sda(int state); +void set_scl(int state); +int get_sda(void); +int get_scl(void); #define KM_KIRKWOOD_SDA_PIN 8 #define KM_KIRKWOOD_SCL_PIN 9 #define KM_KIRKWOOD_ENV_WP 38

From: Holger Brunck holger.brunck@keymile.com
This is a first step to simplify the default environment. Move all the environment variables which are only needed for debugging purpose to textfiles in the scripts directory. In case of debugging these files can be loaded via tftp into RAM and set via the env import command. Other variables are identified as obsolete and were removed.
Signed-off-by: Holger Brunck holger.brunck@keymile.com Acked-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de cc: Valentin Longchamp valentin.longchamp@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com --- board/keymile/scripts/README | 25 ++++++ board/keymile/scripts/debug-arm-env.txt | 2 + board/keymile/scripts/debug-common-env.txt | 9 ++ board/keymile/scripts/debug-ppc-env.txt | 2 + include/configs/km/keymile-common.h | 128 +++------------------------- include/configs/km/km-powerpc.h | 12 +-- include/configs/km/km_arm.h | 5 +- 7 files changed, 57 insertions(+), 126 deletions(-) create mode 100644 board/keymile/scripts/README create mode 100644 board/keymile/scripts/debug-arm-env.txt create mode 100644 board/keymile/scripts/debug-common-env.txt create mode 100644 board/keymile/scripts/debug-ppc-env.txt
diff --git a/board/keymile/scripts/README b/board/keymile/scripts/README new file mode 100644 index 0000000..ce6d79a --- /dev/null +++ b/board/keymile/scripts/README @@ -0,0 +1,25 @@ +debug-common-env.txt +============================ +This file defines environment variables which are valid for powerpc boards +and for arm boards. + +addramfs: add phram device for the rootfilesysten in ram +develop: for development, laod kernel via tftp and mount rootfs via NFS +nfsargs: default arguments for nfs boot +ramfs: load rootfilesystem in RAM kernel +rootfsfile: loacation of the rootfs file for ramfs +setramfspram: compute PRAM size for ramfs target +setrootfsaddr: compute rootfilesystem address for phram +tftpkernel: load a kernel with tftp into ram +tftpramfs: load rootfs with tftp into ram + +debug-ppc-env.txt +============================ +fdt_file: location of the dtb file on the tftp server +tftpfdt: load dtb file and set fdt address + +debug-arm-env.txt +============================ +tftpfdt: for arm only a dummy variable, because we have no fdt on arm + + diff --git a/board/keymile/scripts/debug-arm-env.txt b/board/keymile/scripts/debug-arm-env.txt new file mode 100644 index 0000000..84498af --- /dev/null +++ b/board/keymile/scripts/debug-arm-env.txt @@ -0,0 +1,2 @@ +debug_env_common=tftpboot 0x200000 scripts/debug-common-env.txt && env import -t 0x200000 ${filesize} +tftpfdt=true diff --git a/board/keymile/scripts/debug-common-env.txt b/board/keymile/scripts/debug-common-env.txt new file mode 100644 index 0000000..1fd4b0c --- /dev/null +++ b/board/keymile/scripts/debug-common-env.txt @@ -0,0 +1,9 @@ +addramfs=setenv bootargs "${bootargs} phram.phram=rootfs${boot_bank},${rootfsaddr},${rootfssize}" +develop=setenv subbootcmds "tftpfdt tftpkernel nfsargs ${commonargs} boot " && setenv bootcmd 'run bootrunner' && setenv altbootcmd 'run bootcmd' && km_setboardid && saveenv && reset +nfsargs=setenv bootargs ubi.mtd=ubi0 root=/dev/nfs rw nfsroot=${serverip}:${rootpath} +ramfs=setenv actual_bank -1 && setenv subbootcmds "tftpfdt tftpkernel setrootfsaddr tftpramfs flashargs ${commonargs} addpanic addramfs boot " && setenv bootcmd 'run bootrunner' && setenv altbootcmd 'run bootcmd' && run setboardid && run setramfspram && run setpnvramaddr && saveenv && reset +rootfsfile=${hostname}/rootfsImage +setramfspram=setexpr value 0 + ${reservedpram} && setexpr value 0x${value} + ${rootfssize} && setexpr value 0x${value} + ${varsize} && setexpr value 0x${value} + ${pnvramsize} && setexpr value 0x${value} / 0x400 && setenv pram 0x${value} +tftpkernel=tftpboot ${kernel_addr_r} ${hostname}/uImage && setenv actual_kernel_addr ${kernel_addr_r} +tftpramfs=tftpboot ${rootfsaddr} ${hostname}/rootfsImage && setenv loadaddr +setrootfsaddr=setexpr value ${pnvramsize} - ${rootfssize} && setenv rootfsaddr 0x${value} diff --git a/board/keymile/scripts/debug-ppc-env.txt b/board/keymile/scripts/debug-ppc-env.txt new file mode 100644 index 0000000..3c06ff1 --- /dev/null +++ b/board/keymile/scripts/debug-ppc-env.txt @@ -0,0 +1,2 @@ +debug_env_common=tftpboot 0x200000 scripts/debug-common-env.txt && env import -t 0x200000 ${filesize} +tftpfdt=tftpboot ${fdt_addr_r} ${hostname}/${hostname}.dtb && setenv actual_fdt_addr ${fdt_addr_r} diff --git a/include/configs/km/keymile-common.h b/include/configs/km/keymile-common.h index b313b2e..89f2d14 100644 --- a/include/configs/km/keymile-common.h +++ b/include/configs/km/keymile-common.h @@ -171,13 +171,8 @@ "break=0; " \ "for subbootcmd in ${subbootcmds}; do " \ "if test ${break} -eq 0; then; " \ - "echo "[INFO] running \c"; " \ "print ${subbootcmd}; " \ "run ${subbootcmd} || break=1; " \ - "if test ${break} -eq 1; then; " \ - "echo "[ERR] failed \c"; " \ - "print ${subbootcmd}; " \ - "fi; " \ "fi; " \ "done\0" \ "" @@ -188,8 +183,6 @@ * - set 'bootcmd' and 'altbootcmd' * available targets: * - 'release': for a standalone system kernel/rootfs from flash - * - 'develop': for development kernel(tftp)/rootfs(NFS) - * - 'ramfs': rootfilesystem in RAM kernel(tftp)/rootfs(RAM) * * - 'commonargs': bootargs common to all targets */ @@ -203,40 +196,6 @@ "addmtdparts " \ "addbootcount " \ "\0" \ - "develop=" \ - "setenv subbootcmds "" \ - "tftpfdt tftpkernel " \ - "nfsargs ${commonargs} " \ - "printbootargs boot " \ - "" && " \ - "setenv bootcmd '" \ - "run bootrunner" \ - "' && " \ - "setenv altbootcmd '" \ - "run bootcmd" \ - "' && " \ - "run setboardid && " \ - "saveenv && " \ - "reset\0" \ - "ramfs=" \ - "setenv actual_bank -1 && " \ - "setenv subbootcmds "" \ - "tftpfdt tftpkernel " \ - "setrootfsaddr tftpramfs " \ - "flashargs ${commonargs} " \ - "addpanic addramfs " \ - "printbootargs boot " \ - "" && " \ - "setenv bootcmd '" \ - "run bootrunner" \ - "' && " \ - "setenv altbootcmd '" \ - "run bootcmd" \ - "' && " \ - "run setboardid && " \ - "run setramfspram && " \ - "saveenv && " \ - "reset\0" \ "release=" \ "setenv actual_bank ${initial_boot_bank} && " \ "setenv subbootcmds "" \ @@ -244,8 +203,7 @@ "ubiattach ubicopy " \ "cramfsloadfdt cramfsloadkernel " \ "flashargs ${commonargs} " \ - "addpanic " \ - "printbootargs boot " \ + "addpanic boot " \ "" && " \ "setenv bootcmd '" \ "run actual bootrunner; reset" \ @@ -253,8 +211,12 @@ "setenv altbootcmd '" \ "run backup bootrunner; reset" \ "' && " \ - "saveenv && " \ + "saveenv && saveenv && " \ "reset\0" \ + "debug_env=" \ + "tftp 200000 " CONFIG_KM_ARCH_DBG_FILE " && " \ + "env import -t 200000 ${filesize} && " \ + "run debug_env_common\0" \ ""
/* @@ -264,10 +226,8 @@ * - 'addip': add ip configuration * - 'addmem': limit kernel memory mem= * - 'addpanic': add kernel panic options - * - 'addramfs': add phram device for the rootfilesysten in ram * - 'addtty': add console=... * - 'addvar': add phram device for /var - * - 'nfsargs': default arguments for nfs boot * - 'flashargs': defaults arguments for flash base boot * * processor specific settings @@ -282,25 +242,15 @@ "ip=${ipaddr}:${serverip}:${gatewayip}:${netmask}" \ ":${hostname}:${netdev}:off\0" \ "addmem=" \ - "setenv bootargs ${bootargs} mem=0x${pnvramaddr}\0" \ + "setenv bootargs ${bootargs} mem=${pnvramaddr}\0" \ "addpanic=" \ - "setenv bootargs ${bootargs} " \ - "panic=1 panic_on_oops=1\0" \ - "addramfs=" \ - "setenv bootargs "" \ - "${bootargs} phram.phram=" \ - "rootfs${boot_bank},${rootfsaddr},${rootfssize}"\0" \ + "setenv bootargs ${bootargs} panic=1 panic_on_oops=1\0" \ "addtty=" \ "setenv bootargs ${bootargs}" \ " console=" CONFIG_KM_CONSOLE_TTY ",${baudrate}\0" \ "addvar=" \ "setenv bootargs ${bootargs} phram.phram=phvar," \ - "${varaddr},0x" xstr(CONFIG_KM_PHRAM) "\0" \ - "nfsargs=" \ - "setenv bootargs " \ - "ubi.mtd=" CONFIG_KM_UBI_LINUX_MTD_NAME " " \ - "root=/dev/nfs rw " \ - "nfsroot=${serverip}:${rootpath}\0" \ + "${varaddr}," xstr(CONFIG_KM_PHRAM) "\0" \ "flashargs=" \ "setenv bootargs " \ "ubi.mtd=" CONFIG_KM_UBI_LINUX_MTD_NAME " " \ @@ -309,71 +259,25 @@ ""
/* - * compute_addr - * - compute addresses and sizes - * - addresses are calculated form the end of memory 'memsize' - * - * - 'setramfspram': compute PRAM size for ramfs target - * - 'setrootfsaddr': compute rootfilesystem address for phram - */ -#define CONFIG_KM_DEF_ENV_COMPUTE_ADDR \ - "setboardid=" \ - "if test "x${boardId}" = "x"; then; " \ - "setenv boardId ${IVM_BoardId} && " \ - "setenv hwKey ${IVM_HWKey}; " \ - "else; " \ - "echo \\c; " \ - "fi\0" \ - "setramfspram=" \ - "setexpr value ${rootfssize} / 0x400 && " \ - "setexpr value 0x${value} + ${pram} && " \ - "setenv pram 0x${value}\0" \ - "setrootfsaddr=" \ - "setexpr value ${pnvramaddr} - ${rootfssize} && " \ - "setenv rootfsaddr 0x${value}\0" \ - "" - -/* * flash_boot * - commands for booting from flash * - * - 'cramfsaddr': address to the cramfs (in ram) * - 'cramfsloadkernel': copy kernel from a cramfs to ram * - 'ubiattach': attach ubi partition * - 'ubicopy': copy ubi volume to ram * - volume names: bootfs0, bootfs1, bootfs2, ... - * - 'ubiparition': mtd parition name for ubi * * processor specific settings * - 'cramfsloadfdt': copy fdt from a cramfs to ram */ #define CONFIG_KM_DEF_ENV_FLASH_BOOT \ - "cramfsaddr="xstr(CONFIG_KM_CRAMFS_ADDR) "\0" \ + "cramfsaddr=" xstr(CONFIG_KM_CRAMFS_ADDR) "\0" \ "cramfsloadkernel=" \ "cramfsload ${kernel_addr_r} uImage && " \ "setenv actual_kernel_addr ${kernel_addr_r}\0" \ - "ubiattach=ubi part ${ubipartition}\0" \ - "ubicopy=ubi read ${cramfsaddr} bootfs${boot_bank}\0" \ - "ubipartition=" CONFIG_KM_UBI_PARTITION_NAME "\0" \ - "" - -/* - * net_boot - * - commands for booting over the network - * - * - 'tftpkernel': load a kernel with tftp into ram - * - 'tftpramfs': load rootfs with tftp into ram - * - * processor specific settings - * - 'tftpfdt': load fdt with tftp into ram - */ -#define CONFIG_KM_DEF_ENV_NET_BOOT \ - "tftpkernel=" \ - "tftpboot ${kernel_addr_r} ${kernel_file} && " \ - "setenv actual_kernel_addr ${kernel_addr_r}\0" \ - "tftpramfs=" \ - "tftpboot ${rootfsaddr} "\"${rootfsfile}\"" && " \ - "setenv loadaddr\0" \ + "ubiattach=ubi part " CONFIG_KM_UBI_PARTITION_NAME "\0" \ + "ubicopy=ubi read "xstr(CONFIG_KM_CRAMFS_ADDR) \ + " bootfs${boot_bank}\0" \ ""
/* @@ -390,8 +294,6 @@ "default=" \ "setenv default 'run newenv; reset' && " \ "run release && saveenv; reset\0" \ - "printbootargs=print bootargs\0" \ - "rootfsfile="xstr(CONFIG_HOSTNAME) "/rootfsImage\0" \ "checkboardid=km_checkbidhwk\0" \ ""
@@ -403,17 +305,13 @@ CONFIG_KM_DEF_ENV_BOOTRUNNER \ CONFIG_KM_DEF_ENV_BOOTTARGETS \ CONFIG_KM_DEF_ENV_BOOTARGS \ - CONFIG_KM_DEF_ENV_COMPUTE_ADDR \ CONFIG_KM_DEF_ENV_FLASH_BOOT \ - CONFIG_KM_DEF_ENV_NET_BOOT \ CONFIG_KM_DEF_ENV_CONSTANTS \ "altbootcmd=run bootcmd\0" \ "bootcmd=run default\0" \ "bootlimit=2\0" \ "init=/sbin/init-overlay.sh\0" \ "kernel_addr_r="xstr(CONFIG_KM_KERNEL_ADDR) "\0" \ - "kernel_file="xstr(CONFIG_HOSTNAME) "/uImage\0" \ - "kernel_name=uImage\0" \ "load=tftpboot ${u-boot_addr_r} ${u-boot}\0" \ "mtdids=" MTDIDS_DEFAULT "\0" \ "mtdparts=" MTDPARTS_DEFAULT "\0" \ diff --git a/include/configs/km/km-powerpc.h b/include/configs/km/km-powerpc.h index 3351609..d6db8d7 100644 --- a/include/configs/km/km-powerpc.h +++ b/include/configs/km/km-powerpc.h @@ -67,20 +67,14 @@ #define CONFIG_KM_FDT_ADDR 0x7E0000 /* 128Kbytes */
#define CONFIG_KM_DEF_ENV_CPU \ - "addbootcount=echo \\c\0" \ - "addmtdparts=echo \\c\0" \ + "addbootcount=true\0" \ + "addmtdparts=true\0" \ "boot=bootm ${actual_kernel_addr} - ${actual_fdt_addr}\0" \ "cramfsloadfdt=" \ "cramfsload ${fdt_addr_r} " \ "fdt_0x${IVM_BoardId}_0x${IVM_HWKey}.dtb && " \ "setenv actual_fdt_addr ${fdt_addr_r}\0" \ "fdt_addr_r=" xstr(CONFIG_KM_FDT_ADDR) "\0" \ - "fdt_file=" \ - xstr(CONFIG_HOSTNAME) "/" \ - xstr(CONFIG_HOSTNAME) ".dtb\0" \ - "tftpfdt=" \ - "tftpboot ${fdt_addr_r} ${fdt_file} && " \ - "setenv actual_fdt_addr ${fdt_addr_r} \0" \ "update=" \ "protect off " xstr(BOOTFLASH_START) " +${filesize} && "\ "erase " xstr(BOOTFLASH_START) " +${filesize} && " \ @@ -89,4 +83,6 @@ "protect on " xstr(BOOTFLASH_START) " +${filesize}\0" \ ""
+#define CONFIG_KM_ARCH_DBG_FILE "scripts/debug-ppc-env.txt" + #endif /* __CONFIG_KEYMILE_POWERPC_H */ diff --git a/include/configs/km/km_arm.h b/include/configs/km/km_arm.h index 0148b24..33a8678 100644 --- a/include/configs/km/km_arm.h +++ b/include/configs/km/km_arm.h @@ -69,12 +69,11 @@ "bootcountaddr=${bootcountaddr}\0" \ "addmtdparts=setenv bootargs ${bootargs} ${mtdparts}\0" \ "boot=bootm ${actual_kernel_addr} - -\0" \ - "cramfsloadfdt=echo \\c\0" \ - "tftpfdt=echo \\c\0" \ + "cramfsloadfdt=true\0" \ CONFIG_KM_DEF_ENV_UPDATE \ ""
- +#define CONFIG_KM_ARCH_DBG_FILE "scripts/debug-arm-env.txt"
#define CONFIG_MD5 /* get_random_hex on krikwood needs MD5 support */ #define CONFIG_SKIP_LOWLEVEL_INIT /* disable board lowlevel_init */

Sorry, the whole series is not numbered, -N statt -n ... it will be corrected for the very likely v2 of the series posting.
Valentin Longchamp wrote:
This series is the second effort of merging the Keymile boards support back into mainline.
Most of the patches are only keymile relevant and should only affect our boards.
There are also patches for the i2c deblocking support and cramfs for ARM.
The whole series is based on current denx-master with the our first patch series posted by Heiko that was reviewed previous weeks and should still be merged during the current merge window:
http://lists.denx.de/pipermail/u-boot/2011-April/089530.html
Heiko Schocher (5): lib, vsprintf: introduce strict_strtoul arm/km: add CRAMFS support for keymile boards cramfs: make cramfs usable without a NOR flash i2c, soft_i2c: deblock bus if switching to another i2c bus arm, powerpc, keymile boards: move keymile specific header in subdir
Holger Brunck (18): km/common: remove hdlc_enet implementation powerpc/km82xx: cleanup coding style for mgcoge.c powerpc/km82xx: rename mgcoge files to km82xx powerpc/km82xx: move SDRAM config to board config powerpc/km82xx: adapt CONFIG_SYSSYPCR to manual powerpc/km82xx: rename mgcoge2ne to mgcoge3ne board support poweprc/km82xx: add board specific environment variable arm/km: add addbootcount environment variable arm/km: remove last_stage_init and unneeded printouts arm/km: add second serial interface for kirkwood common/hush: make get_local_var visible for other users km/common: implement setboardid as a command km/common: add pnvramsize to default environment km/common: fix coding style issues in generic header km/common: simplify default environment arm/km: rename mgcoge2un to mgcoge3un arm/km: change default settings for egiga on mgcoge3un arm/km: update mgcoge3un board support
Huber, Andreas (1): powerpc/km82xx: add DIP switch detection
Stefan Bigler (1): i2c: add i2c deblock sequence before and after every mux config
Thomas Herzmann (2): km/common: fix initial_boot_bank for bootpackages km/common: replace env var checkboardidlist by function
Valentin Longchamp (3): arm/km: add mkimage config file for uart download arm/km: add BootROM config files for memphis SDRAM arm/km: disable ls (through jffs2 support)
MAINTAINERS | 4 +- board/keymile/common/common.c | 156 ++++++- board/keymile/common/common.h | 84 +++- board/keymile/common/keymile_hdlc_enet.c | 620 ------------------------ board/keymile/km82xx/Makefile | 53 ++ board/keymile/km82xx/km82xx.c | 373 ++++++++++++++ board/keymile/km_arm/km_arm.c | 93 +++- board/keymile/km_arm/kwbimage-memphis-uart.cfg | 197 ++++++++ board/keymile/km_arm/kwbimage-memphis.cfg | 197 ++++++++ board/keymile/km_arm/kwbimage-uart.cfg | 179 +++++++ board/keymile/mgcoge/Makefile | 54 -- board/keymile/mgcoge/mgcoge.c | 333 ------------- board/keymile/mgcoge/mgcoge_hdlc_enet.c | 276 ----------- board/keymile/scripts/README | 25 + board/keymile/scripts/debug-arm-env.txt | 2 + board/keymile/scripts/debug-common-env.txt | 9 + board/keymile/scripts/debug-ppc-env.txt | 2 + boards.cfg | 6 +- common/cmd_cramfs.c | 12 +- common/cmd_i2c.c | 12 + common/hush.c | 3 +- drivers/i2c/soft_i2c.c | 1 + drivers/net/mvgbe.h | 2 + fs/cramfs/cramfs.c | 4 + include/_exports.h | 1 + include/common.h | 1 + include/configs/keymile-common.h | 455 ----------------- include/configs/km-powerpc.h | 92 ---- include/configs/km/keymile-common.h | 328 +++++++++++++ include/configs/km/km-powerpc.h | 88 ++++ include/configs/km/km82xx-common.h | 311 ++++++++++++ include/configs/km/km8321-common.h | 137 ++++++ include/configs/km/km83xx-common.h | 325 +++++++++++++ include/configs/km/km_arm.h | 275 +++++++++++ include/configs/km82xx-common.h | 336 ------------- include/configs/km8321-common.h | 137 ------ include/configs/km83xx-common.h | 325 ------------- include/configs/km_arm.h | 266 ---------- include/configs/kmeter1.h | 2 +- include/configs/kmsupx5.h | 2 +- include/configs/mgcoge.h | 35 ++- include/configs/mgcoge2ne.h | 64 --- include/configs/mgcoge2un.h | 65 --- include/configs/mgcoge3ne.h | 97 ++++ include/configs/mgcoge3un.h | 90 ++++ include/configs/suen3.h | 2 +- include/configs/suen8.h | 2 +- include/configs/suvd3.h | 2 +- include/configs/tuda1.h | 2 +- include/configs/tuxa1.h | 2 +- include/exports.h | 1 + include/hush.h | 1 + include/i2c.h | 2 - lib/vsprintf.c | 47 ++ 54 files changed, 3111 insertions(+), 3079 deletions(-) delete mode 100644 board/keymile/common/keymile_hdlc_enet.c create mode 100644 board/keymile/km82xx/Makefile create mode 100644 board/keymile/km82xx/km82xx.c create mode 100644 board/keymile/km_arm/kwbimage-memphis-uart.cfg create mode 100644 board/keymile/km_arm/kwbimage-memphis.cfg create mode 100644 board/keymile/km_arm/kwbimage-uart.cfg delete mode 100644 board/keymile/mgcoge/Makefile delete mode 100644 board/keymile/mgcoge/mgcoge.c delete mode 100644 board/keymile/mgcoge/mgcoge_hdlc_enet.c create mode 100644 board/keymile/scripts/README create mode 100644 board/keymile/scripts/debug-arm-env.txt create mode 100644 board/keymile/scripts/debug-common-env.txt create mode 100644 board/keymile/scripts/debug-ppc-env.txt delete mode 100644 include/configs/keymile-common.h delete mode 100644 include/configs/km-powerpc.h create mode 100644 include/configs/km/keymile-common.h create mode 100644 include/configs/km/km-powerpc.h create mode 100644 include/configs/km/km82xx-common.h create mode 100644 include/configs/km/km8321-common.h create mode 100644 include/configs/km/km83xx-common.h create mode 100644 include/configs/km/km_arm.h delete mode 100644 include/configs/km82xx-common.h delete mode 100644 include/configs/km8321-common.h delete mode 100644 include/configs/km83xx-common.h delete mode 100644 include/configs/km_arm.h delete mode 100644 include/configs/mgcoge2ne.h delete mode 100644 include/configs/mgcoge2un.h create mode 100644 include/configs/mgcoge3ne.h create mode 100644 include/configs/mgcoge3un.h

And my coworker made me notice that the renames are not correctly handled either, so I am going to resent this whole series directly.
Please excuse me for the spam and inconvenience.
Valentin Longchamp wrote:
Sorry, the whole series is not numbered, -N statt -n ... it will be corrected for the very likely v2 of the series posting.
Valentin Longchamp wrote:
This series is the second effort of merging the Keymile boards support back into mainline.
Most of the patches are only keymile relevant and should only affect our boards.
There are also patches for the i2c deblocking support and cramfs for ARM.
The whole series is based on current denx-master with the our first patch series posted by Heiko that was reviewed previous weeks and should still be merged during the current merge window:
http://lists.denx.de/pipermail/u-boot/2011-April/089530.html
Heiko Schocher (5): lib, vsprintf: introduce strict_strtoul arm/km: add CRAMFS support for keymile boards cramfs: make cramfs usable without a NOR flash i2c, soft_i2c: deblock bus if switching to another i2c bus arm, powerpc, keymile boards: move keymile specific header in subdir
Holger Brunck (18): km/common: remove hdlc_enet implementation powerpc/km82xx: cleanup coding style for mgcoge.c powerpc/km82xx: rename mgcoge files to km82xx powerpc/km82xx: move SDRAM config to board config powerpc/km82xx: adapt CONFIG_SYSSYPCR to manual powerpc/km82xx: rename mgcoge2ne to mgcoge3ne board support poweprc/km82xx: add board specific environment variable arm/km: add addbootcount environment variable arm/km: remove last_stage_init and unneeded printouts arm/km: add second serial interface for kirkwood common/hush: make get_local_var visible for other users km/common: implement setboardid as a command km/common: add pnvramsize to default environment km/common: fix coding style issues in generic header km/common: simplify default environment arm/km: rename mgcoge2un to mgcoge3un arm/km: change default settings for egiga on mgcoge3un arm/km: update mgcoge3un board support
Huber, Andreas (1): powerpc/km82xx: add DIP switch detection
Stefan Bigler (1): i2c: add i2c deblock sequence before and after every mux config
Thomas Herzmann (2): km/common: fix initial_boot_bank for bootpackages km/common: replace env var checkboardidlist by function
Valentin Longchamp (3): arm/km: add mkimage config file for uart download arm/km: add BootROM config files for memphis SDRAM arm/km: disable ls (through jffs2 support)
MAINTAINERS | 4 +- board/keymile/common/common.c | 156 ++++++- board/keymile/common/common.h | 84 +++- board/keymile/common/keymile_hdlc_enet.c | 620
board/keymile/km82xx/Makefile | 53 ++ board/keymile/km82xx/km82xx.c | 373 ++++++++++++++ board/keymile/km_arm/km_arm.c | 93 +++- board/keymile/km_arm/kwbimage-memphis-uart.cfg | 197 ++++++++ board/keymile/km_arm/kwbimage-memphis.cfg | 197 ++++++++ board/keymile/km_arm/kwbimage-uart.cfg | 179 +++++++ board/keymile/mgcoge/Makefile | 54 -- board/keymile/mgcoge/mgcoge.c | 333 ------------- board/keymile/mgcoge/mgcoge_hdlc_enet.c | 276 ----------- board/keymile/scripts/README | 25 + board/keymile/scripts/debug-arm-env.txt | 2 + board/keymile/scripts/debug-common-env.txt | 9 + board/keymile/scripts/debug-ppc-env.txt | 2 + boards.cfg | 6 +- common/cmd_cramfs.c | 12 +- common/cmd_i2c.c | 12 + common/hush.c | 3 +- drivers/i2c/soft_i2c.c | 1 + drivers/net/mvgbe.h | 2 + fs/cramfs/cramfs.c | 4 + include/_exports.h | 1 + include/common.h | 1 + include/configs/keymile-common.h | 455 ----------------- include/configs/km-powerpc.h | 92 ---- include/configs/km/keymile-common.h | 328 +++++++++++++ include/configs/km/km-powerpc.h | 88 ++++ include/configs/km/km82xx-common.h | 311 ++++++++++++ include/configs/km/km8321-common.h | 137 ++++++ include/configs/km/km83xx-common.h | 325 +++++++++++++ include/configs/km/km_arm.h | 275 +++++++++++ include/configs/km82xx-common.h | 336 ------------- include/configs/km8321-common.h | 137 ------ include/configs/km83xx-common.h | 325 ------------- include/configs/km_arm.h | 266 ---------- include/configs/kmeter1.h | 2 +- include/configs/kmsupx5.h | 2 +- include/configs/mgcoge.h | 35 ++- include/configs/mgcoge2ne.h | 64 --- include/configs/mgcoge2un.h | 65 --- include/configs/mgcoge3ne.h | 97 ++++ include/configs/mgcoge3un.h | 90 ++++ include/configs/suen3.h | 2 +- include/configs/suen8.h | 2 +- include/configs/suvd3.h | 2 +- include/configs/tuda1.h | 2 +- include/configs/tuxa1.h | 2 +- include/exports.h | 1 + include/hush.h | 1 + include/i2c.h | 2 - lib/vsprintf.c | 47 ++ 54 files changed, 3111 insertions(+), 3079 deletions(-) delete mode 100644 board/keymile/common/keymile_hdlc_enet.c create mode 100644 board/keymile/km82xx/Makefile create mode 100644 board/keymile/km82xx/km82xx.c create mode 100644 board/keymile/km_arm/kwbimage-memphis-uart.cfg create mode 100644 board/keymile/km_arm/kwbimage-memphis.cfg create mode 100644 board/keymile/km_arm/kwbimage-uart.cfg delete mode 100644 board/keymile/mgcoge/Makefile delete mode 100644 board/keymile/mgcoge/mgcoge.c delete mode 100644 board/keymile/mgcoge/mgcoge_hdlc_enet.c create mode 100644 board/keymile/scripts/README create mode 100644 board/keymile/scripts/debug-arm-env.txt create mode 100644 board/keymile/scripts/debug-common-env.txt create mode 100644 board/keymile/scripts/debug-ppc-env.txt delete mode 100644 include/configs/keymile-common.h delete mode 100644 include/configs/km-powerpc.h create mode 100644 include/configs/km/keymile-common.h create mode 100644 include/configs/km/km-powerpc.h create mode 100644 include/configs/km/km82xx-common.h create mode 100644 include/configs/km/km8321-common.h create mode 100644 include/configs/km/km83xx-common.h create mode 100644 include/configs/km/km_arm.h delete mode 100644 include/configs/km82xx-common.h delete mode 100644 include/configs/km8321-common.h delete mode 100644 include/configs/km83xx-common.h delete mode 100644 include/configs/km_arm.h delete mode 100644 include/configs/mgcoge2ne.h delete mode 100644 include/configs/mgcoge2un.h create mode 100644 include/configs/mgcoge3ne.h create mode 100644 include/configs/mgcoge3un.h

-----Original Message----- From: u-boot-bounces@lists.denx.de [mailto:u-boot-bounces@lists.denx.de] On Behalf Of Valentin Longchamp Sent: Friday, April 08, 2011 6:23 PM To: u-boot@lists.denx.de Cc: hs@denx.de; holger.brunck@keymile.com Subject: Re: [U-Boot] [PATCH] Keymile boards mainlining, part 2
Sorry, the whole series is not numbered, -N statt -n ... it will be corrected for the very likely v2 of the series posting.
It would be good if you can split patch series in to small group as per functionality/SoC, so that it is easy to pull.
Regards.. Prafulla . .

Prafulla Wadaskar wrote:
-----Original Message----- From: u-boot-bounces@lists.denx.de [mailto:u-boot-bounces@lists.denx.de] On Behalf Of Valentin Longchamp Sent: Friday, April 08, 2011 6:23 PM To: u-boot@lists.denx.de Cc: hs@denx.de; holger.brunck@keymile.com Subject: Re: [U-Boot] [PATCH] Keymile boards mainlining, part 2
Sorry, the whole series is not numbered, -N statt -n ... it will be corrected for the very likely v2 of the series posting.
It would be good if you can split patch series in to small group as per functionality/SoC, so that it is easy to pull.
I agree with you about this point. We did it this way since even if some patches affect only one SoC/functionality, there may be some dependancies between patches that are not in the same SoC/functionality group.
I'll see what I can do.
participants (3)
-
Prafulla Wadaskar
-
Valentin Longchamp
-
Wolfgang Denk