[U-Boot] [PATCH 00/30] Keymile boards mainlining, part 2 (resend)

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/{mgcoge => km82xx}/Makefile | 3 +- 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/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/{ => km}/keymile-common.h | 175 +------ include/configs/{ => km}/km-powerpc.h | 12 +- include/configs/{ => km}/km82xx-common.h | 29 +- include/configs/{ => km}/km8321-common.h | 0 include/configs/{ => km}/km83xx-common.h | 0 include/configs/{ => km}/km_arm.h | 25 +- include/configs/kmeter1.h | 2 +- include/configs/kmsupx5.h | 2 +- include/configs/mgcoge.h | 35 ++- include/configs/{mgcoge2ne.h => mgcoge3ne.h} | 57 ++- include/configs/{mgcoge2un.h => mgcoge3un.h} | 37 ++- 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 ++ 45 files changed, 1531 insertions(+), 1499 deletions(-) delete mode 100644 board/keymile/common/keymile_hdlc_enet.c rename board/keymile/{mgcoge => km82xx}/Makefile (94%) 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/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 rename include/configs/{ => km}/keymile-common.h (63%) rename include/configs/{ => km}/km-powerpc.h (91%) rename include/configs/{ => km}/km82xx-common.h (93%) rename include/configs/{ => km}/km8321-common.h (100%) rename include/configs/{ => km}/km83xx-common.h (100%) rename include/configs/{ => km}/km_arm.h (93%) rename include/configs/{mgcoge2ne.h => mgcoge3ne.h} (57%) rename include/configs/{mgcoge2un.h => mgcoge3un.h} (65%)

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.1302272395.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.
Same comment as prvious version: please provide full reference / attribution.
Best regards,
Wolfgang Denk

as checkpatch proposes to use strict_strtoul instead of simple_strtoul, introduce it.
Ported this function from Linux 2.6.38 commit ID: 521cb40b0c44418a4fd36dc633f575813d59a43d
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 --- changes for v2: - added origin source for this new function, as Wolfgang Denk suggested. - Patch no longer in the patchserie, as it is an independent change.
include/_exports.h | 1 + include/common.h | 1 + include/exports.h | 1 + lib/vsprintf.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 54 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 00e266e..1e4a6a5 100644 --- a/include/common.h +++ b/include/common.h @@ -650,6 +650,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 ddd1bf4..e14d727 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..3b924ec 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,56 @@ 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. + * + * Copied this function from Linux 2.6.38 commit ID: + * 521cb40b0c44418a4fd36dc633f575813d59a43d + * + */ +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 Heiko Schocher,
In message 1304408029-16785-1-git-send-email-hs@denx.de you wrote:
as checkpatch proposes to use strict_strtoul instead of simple_strtoul, introduce it.
Ported this function from Linux 2.6.38 commit ID: 521cb40b0c44418a4fd36dc633f575813d59a43d
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
changes for v2:
- added origin source for this new function, as Wolfgang Denk suggested.
- Patch no longer in the patchserie, as it is an independent change.
include/_exports.h | 1 + include/common.h | 1 + include/exports.h | 1 + lib/vsprintf.c | 51 +++++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 54 insertions(+), 0 deletions(-)
Appplied, thanks.
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/{mgcoge => km82xx}/Makefile | 0 board/keymile/{mgcoge/mgcoge.c => km82xx/km82xx.c} | 0 boards.cfg | 4 ++-- 3 files changed, 2 insertions(+), 2 deletions(-) rename board/keymile/{mgcoge => km82xx}/Makefile (100%) rename board/keymile/{mgcoge/mgcoge.c => km82xx/km82xx.c} (100%)
diff --git a/board/keymile/mgcoge/Makefile b/board/keymile/km82xx/Makefile similarity index 100% rename from board/keymile/mgcoge/Makefile rename to board/keymile/km82xx/Makefile diff --git a/board/keymile/mgcoge/mgcoge.c b/board/keymile/km82xx/km82xx.c similarity index 100% rename from board/keymile/mgcoge/mgcoge.c rename to board/keymile/km82xx/km82xx.c 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"

Dear Valentin Longchamp,
In message 08249e40b548fff1e636cecf980e11adabda14ac.1302272395.git.valentin.longchamp@keymile.com you wrote:
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(-)
If I'm understanding this right, we now duplicate the definitions into two files, because two boards happen to use the same SDRAM. Would it not make more sense to move this into a single copy of a SDRAM specific header, which then gets included by all boards that use this SDRAM type? This way we can avoid multiple copied of the same stuff (which always is a maintenance nightmare) for popular RAM types.
Best regards,
Wolfgang Denk

Hello,
On 04/30/2011 09:56 AM, Wolfgang Denk wrote:
Dear Valentin Longchamp,
In message 08249e40b548fff1e636cecf980e11adabda14ac.1302272395.git.valentin.longchamp@keymile.com you wrote:
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(-)
If I'm understanding this right, we now duplicate the definitions into two files, because two boards happen to use the same SDRAM. Would it
Yes.
not make more sense to move this into a single copy of a SDRAM specific header, which then gets included by all boards that use this SDRAM type? This way we can avoid multiple copied of the same stuff (which always is a maintenance nightmare) for popular RAM types.
Yes this sounds reasonable. But later on in the patch serie we replace the mgcoge2ne support with the support for mgcoge3ne which has a different SDRAM. And therefore this common file would become obsolete. I try to rebase these patches that the mgcoge3ne support is also part of this patch.
BTW: What would your proposal for a filename for a SDRAM specific header?
Best regards Holger Brunck

Dear Holger Brunck,
In message 4DBE659D.3040208@keymile.com you wrote:
BTW: What would your proposal for a filename for a SDRAM specific header?
Name it after the SDRAM chip type?
I think we should create a directory hierarchy for this:
chips/sdram/ chips/ddr/ chips/ddr2/ chips/ddr3/
We already have a few of such files - but this shows also how it should NOT be done (because we have here lots of duplicated files again):
-> find * -name 'mt4*' board/canmb/mt48lc16m32s2-75.h board/esd/cpci5200/mt46v16m16-75.h board/esd/pf5200/mt46v16m16-75.h board/esd/mecp5200/mt46v16m16-75.h board/a4m072/mt46v32m16.h board/icecube/mt46v16m16-75.h board/icecube/mt46v32m16.h board/icecube/mt48lc16m16a2-75.h board/inka4x0/mt46v16m16-75.h board/inka4x0/mt46v32m16-75.h board/inka4x0/mt48lc16m16a2-75.h board/bc3450/mt48lc16m16a2-75.h board/pm520/mt46v16m16-75.h board/pm520/mt48lc16m16a2-75.h board/total5200/mt48lc16m16a2-75.h board/total5200/mt48lc32m16a2-75.h board/mcc200/mt48lc8m32b2-6-7.h board/mcc200/mt46v16m16-75.h board/mcc200/mt48lc16m16a2-75.h board/mcc200/mt48lc16m32s2-75.h board/munices/mt48lc16m16a2-75.h board/phytec/pcm030/mt46v32m16-75.h board/tqc/tqm5200/mt48lc16m16a2-75.h
Eventually this is the start of a bigger cleanup action then :-)
Best regards,
Wolfgang Denk

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 => mgcoge3ne.h} | 58 +++++++++++++++----------- 7 files changed, 67 insertions(+), 30 deletions(-) rename include/configs/{mgcoge2ne.h => mgcoge3ne.h} (65%)
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/mgcoge3ne.h similarity index 65% rename from include/configs/mgcoge2ne.h rename to include/configs/mgcoge3ne.h index 2b09b42..3df7ef1 100644 --- a/include/configs/mgcoge2ne.h +++ b/include/configs/mgcoge3ne.h @@ -1,5 +1,5 @@ /* - * (C) Copyright 2007-2010 + * (C) Copyright 2011 * Heiko Schocher, DENX Software Engineering, hs@denx.de. * * See file CREDITS for list of people who contributed to this @@ -21,16 +21,18 @@ * MA 02111-1307 USA */
-#ifndef __MGCOGE2NE -#define __MGCOGE2NE +#ifndef __MGCOGE3NE +#define __MGCOGE3NE
/* * High Level Configuration Options * (easy to change) */ + #define CONFIG_MPC8247 -#define CONFIG_MGCOGE -#define CONFIG_HOSTNAME mgcoge2ne +#define CONFIG_MGCOGE3NE +#define CONFIG_HOSTNAME mgcoge3ne +#define CONFIG_KM_82XX
#define CONFIG_SYS_TEXT_BASE 0xFE000000
@@ -43,15 +45,20 @@ #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 /* +#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 -#define CONFIG_SYS_FLASH_SIZE_2 0 +#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 } @@ -60,28 +67,29 @@
/* * Bank 1 - 60x bus SDRAM - * mgcoge2ne has 128M RAM + * mgcoge3ne has 256M. */ -#define SDRAM_MAX_SIZE 0x08000000 /* max. 128 MB */ -#define CONFIG_SYS_GLOBAL_SDRAM_LIMIT (256 << 20) /* less than 256 MB */ +#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_8 |\ - ORxS_ROWST_PBI0_A7 |\ - ORxS_NUMR_13) + ORxS_SDAM_MSK) |\ + ORxS_BPD_4 |\ + ORxS_ROWST_PBI1_A4 |\ + 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) +#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 /* __MGCOGE2NE */ +#endif /* __MGCOGE3NE */

Dear Valentin Longchamp,
In message c5ba4fd44d7260d169b924ddda97c4a4c7460dd5.1302272395.git.valentin.longchamp@keymile.com you wrote:
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.
I understand this is just a rename, but I want to ask anyway: if flash type and RAM size are the only differences, then why do we need two separate board definitions here?
Would not even the same U-Boot binary image run on both boards? These flashes are CFI compatible, so the CFI driver would work on both, and RAM size autodetection has been available in U-Boot forever.
In worst case, we coul differentiate boards by an additional #define, which means we only need a single line entry in boards.cfg.
Why do we need to support two board entries?
Best regards,
Wolfgang Denk

Hello,
On 04/30/2011 10:05 AM, Wolfgang Denk wrote:
Dear Valentin Longchamp,
In message c5ba4fd44d7260d169b924ddda97c4a4c7460dd5.1302272395.git.valentin.longchamp@keymile.com you wrote:
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.
I understand this is just a rename, but I want to ask anyway: if flash type and RAM size are the only differences, then why do we need two separate board definitions here?
Would not even the same U-Boot binary image run on both boards? These flashes are CFI compatible, so the CFI driver would work on both, and RAM size autodetection has been available in U-Boot forever.
In worst case, we coul differentiate boards by an additional #define, which means we only need a single line entry in boards.cfg.
Why do we need to support two board entries?
the SDRAM configuration is different to mgcoge. And the CFI flash on mgcoge has a dual die in a single chip and therefore e.g.CONFIG_SYS_MAX_FLASH_BANKS is different to mgcoge3ne.
Additionaly some functional differences are part of the board support, this is added later on. E.g. mgcoge3ne is part of mgcoge3 which has two processors deployed and there are some connections between the processors via GPIOs which are not present on mgcoge. So in my opinion an additional board suport is reasonable in this case.
Best regards Holger Brunck

Dear Holger Brunck,
In message 4DBE6962.1010609@keymile.com you wrote:
the SDRAM configuration is different to mgcoge. And the CFI flash on mgcoge has a dual die in a single chip and therefore e.g.CONFIG_SYS_MAX_FLASH_BANKS is different to mgcoge3ne.
OK, but these can trivially be handled within one set of board files.
Additionaly some functional differences are part of the board support, this is added later on. E.g. mgcoge3ne is part of mgcoge3 which has two processors deployed and there are some connections between the processors via GPIOs which are not present on mgcoge. So in my opinion an additional board suport is reasonable in this case.
Well, it's your board and you have to maintain it in the long run, but I'm not convinced that this is a wise decision.
Best regards,
Wolfgang Denk

On 05/02/2011 10:42 AM, Wolfgang Denk wrote:
Dear Holger Brunck,
In message 4DBE6962.1010609@keymile.com you wrote:
the SDRAM configuration is different to mgcoge. And the CFI flash on mgcoge has a dual die in a single chip and therefore e.g.CONFIG_SYS_MAX_FLASH_BANKS is different to mgcoge3ne.
OK, but these can trivially be handled within one set of board files.
with a lot of #ifdef MGCOGE3NE in one config file or do I misunderstand something?
Additionaly some functional differences are part of the board support, this is added later on. E.g. mgcoge3ne is part of mgcoge3 which has two processors deployed and there are some connections between the processors via GPIOs which are not present on mgcoge. So in my opinion an additional board suport is reasonable in this case.
Well, it's your board and you have to maintain it in the long run, but I'm not convinced that this is a wise decision.
So your proposal would be to do something like mgcoge powerpc mpc8260 km82xx keymile - mgcoge3ne:MGCOGE3NE,... in boards.cfg and only one config file for both boards?
Best regards Holger Brunck

Dear Holger Brunck,
In message 4DBE77C1.7020806@keymile.com you wrote:
the SDRAM configuration is different to mgcoge. And the CFI flash on mgcoge has a dual die in a single chip and therefore e.g.CONFIG_SYS_MAX_FLASH_BANKS is different to mgcoge3ne.
OK, but these can trivially be handled within one set of board files.
with a lot of #ifdef MGCOGE3NE in one config file or do I misunderstand something?
Well, I would expect to have one #ifdef for the SDRAM configuration, and another one for CONFIG_SYS_MAX_FLASH_BANKS - both in the common board config file.
So your proposal would be to do something like mgcoge powerpc mpc8260 km82xx keymile - mgcoge3ne:MGCOGE3NE,... in boards.cfg and only one config file for both boards?
Yes.
Best regards,
Wolfgang Denk

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" \

Dear Valentin Longchamp,
In message ab89ca576a2ad8bcde3b08039a71a9a7695a7eef.1302272395.git.valentin.longchamp@keymile.com you wrote:
From: Holger Brunck holger.brunck@keymile.com
This environment variable is used to set the bootcount address for the kernel.
"addbootcount" reads to me as "add something to the boot counter". I do not expect that this has anything to do with an address. Please use something like "bootcount_addr" (or "bootcnt_addr" or similar) instead.
@@ -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
NAK. We don't allow declarations in the middle of the code.
}
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" \
Argh. Not I see what you mean. Please fix the description,it is completely misleading.
Best regards,
Wolfgang Denk

Hello,
On 04/30/2011 10:09 AM, Wolfgang Denk wrote:
Dear Valentin Longchamp,
In message ab89ca576a2ad8bcde3b08039a71a9a7695a7eef.1302272395.git.valentin.longchamp@keymile.com you wrote:
From: Holger Brunck holger.brunck@keymile.com
This environment variable is used to set the bootcount address for the kernel.
"addbootcount" reads to me as "add something to the boot counter". I do not expect that this has anything to do with an address. Please use something like "bootcount_addr" (or "bootcnt_addr" or similar) instead.
@@ -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
NAK. We don't allow declarations in the middle of the code.
Ok.
}
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" \
Argh. Not I see what you mean. Please fix the description,it is completely misleading.
Ok, I will adapt this. Thanks for reviewing.
Best regards Holger Brunck

From: Holger Brunck holger.brunck@keymile.com
last_stage_init is not available for arm platforms. So move the call to set_km_var to misc_init_r and remove this function. Additionally some unneeded printouts 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: Prafulla Wadaskar prafulla@marvell.com cc: Valentin Longchamp valentin.longchamp@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com --- board/keymile/km_arm/km_arm.c | 13 +------------ 1 files changed, 1 insertions(+), 12 deletions(-)
diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c index c772ee2..a64cdd8 100644 --- a/board/keymile/km_arm/km_arm.c +++ b/board/keymile/km_arm/km_arm.c @@ -150,11 +150,6 @@ int misc_init_r(void) char *str; int mach_type;
- puts("Piggy:"); - if (ethernet_present() == 0) - puts (" not"); - puts(" present\n"); - str = getenv("mach_type"); if (str != NULL) { mach_type = simple_strtoul(str, NULL, 10); @@ -163,6 +158,7 @@ int misc_init_r(void) }
initialize_unit_leds(); + set_km_env();
return 0; } @@ -182,7 +178,6 @@ int board_early_init_f(void) writel(tmp | FLASH_GPIO_PIN , KW_GPIO0_BASE); tmp = readl(KW_GPIO0_BASE + 4); writel(tmp & (~FLASH_GPIO_PIN) , KW_GPIO0_BASE + 4); - printf("KM: setting NAND mode\n");
#if defined(CONFIG_SOFT_I2C) /* init the GPIO for I2C Bitbang driver */ @@ -212,12 +207,6 @@ int board_init(void) return 0; }
-int last_stage_init(void) -{ - set_km_env(); - return 0; -} - #if defined(CONFIG_CMD_SF) int do_spi_toggle(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[]) {

From: Heiko Schocher hs@denx.de
Signed-off-by: Heiko Schocher hs@denx.de Signed-off-by: Holger Brunck holger.brunck@keymile.com cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de cc: Prafulla Wadaskar prafulla@marvell.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com --- include/configs/keymile-common.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
diff --git a/include/configs/keymile-common.h b/include/configs/keymile-common.h index cb6d0fb..6329a1c 100644 --- a/include/configs/keymile-common.h +++ b/include/configs/keymile-common.h @@ -136,6 +136,8 @@ #define CONFIG_MTD_PARTITIONS #define CONFIG_MTD_DEVICE #define CONFIG_MTD_CONCAT +#define CONFIG_CMD_CRAMFS +#define CONFIG_CRAMFS_CMDLINE
/* common powerpc specific env settings */ #ifndef CONFIG_KM_DEF_ENV_BOOTPARAMS

Signed-off-by: Valentin Longchamp valentin.longchamp@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: Prafulla Wadaskar prafulla@marvell.com --- board/keymile/km_arm/kwbimage-uart.cfg | 179 ++++++++++++++++++++++++++++++++ 1 files changed, 179 insertions(+), 0 deletions(-) create mode 100644 board/keymile/km_arm/kwbimage-uart.cfg
diff --git a/board/keymile/km_arm/kwbimage-uart.cfg b/board/keymile/km_arm/kwbimage-uart.cfg new file mode 100644 index 0000000..d8c517c --- /dev/null +++ b/board/keymile/km_arm/kwbimage-uart.cfg @@ -0,0 +1,179 @@ +# +# (C) Copyright 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., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301 USA +# +# Refer docs/README.kwimage for more details about how-to configure +# and create kirkwood boot image +# + +# Boot Media configurations +BOOT_FROM uart # Boot from SPI flash + +DATA 0xFFD10000 0x01112222 # MPP Control 0 Register +# bit 3-0: MPPSel0 2, NF_IO[2] +# bit 7-4: MPPSel1 2, NF_IO[3] +# bit 12-8: MPPSel2 2, NF_IO[4] +# bit 15-12: MPPSel3 2, NF_IO[5] +# bit 19-16: MPPSel4 1, NF_IO[6] +# bit 23-20: MPPSel5 1, NF_IO[7] +# bit 27-24: MPPSel6 1, SYSRST_O +# bit 31-28: MPPSel7 0, GPO[7] + +DATA 0xFFD10004 0x03303300 + +DATA 0xFFD10008 0x00001100 # MPP Control 2 Register +# bit 3-0: MPPSel16 0, GPIO[16] +# bit 7-4: MPPSel17 0, GPIO[17] +# bit 12-8: MPPSel18 1, NF_IO[0] +# bit 15-12: MPPSel19 1, NF_IO[1] +# bit 19-16: MPPSel20 0, GPIO[20] +# bit 23-20: MPPSel21 0, GPIO[21] +# bit 27-24: MPPSel22 0, GPIO[22] +# bit 31-28: MPPSel23 0, GPIO[23] + +DATA 0xFFD100E0 0x1B1B1B1B # IO Configuration 0 Register +DATA 0xFFD20134 0x66666666 # L2 RAM Timing 0 Register +DATA 0xFFD20138 0x66666666 # L2 RAM Timing 1 Register +DATA 0xFFD20154 0x00000200 # CPU RAM Management Control3 Register +DATA 0xFFD2014C 0x00001C00 # CPU RAM Management Control1 Register +DATA 0xFFD20148 0x00000001 # CPU RAM Management Control0 Register + +# Dram initalization +DATA 0xFFD01400 0x43000400 # SDRAM Configuration Register +# bit13-0: 0x400 (DDR2 clks refresh rate) +# bit23-14: zero +# bit24: 1= enable exit self refresh mode on DDR access +# bit25: 1 required +# bit29-26: zero +# bit31-30: 01 + +DATA 0xFFD01404 0x39543000 # DDR Controller Control Low +# bit 3-0: 0 reserved +# bit 4: 0=addr/cmd in smame cycle +# bit 5: 0=clk is driven during self refresh, we don't care for APX +# bit 6: 0=use recommended falling edge of clk for addr/cmd +# bit14: 0=input buffer always powered up +# bit18: 1=cpu lock transaction enabled +# bit23-20: 3=recommended value for CL=3 and STARTBURST_DEL disabled bit31=0 +# bit27-24: 6= CL+3, STARTBURST sample stages, for freqs 400MHz, unbuffered DIMM +# bit30-28: 3 required +# bit31: 0=no additional STARTBURST delay + +DATA 0xFFD01408 0x34136552 # DDR Timing (Low) (active cycles value +1) +# bit3-0: TRAS lsbs +# bit7-4: TRCD +# bit11- 8: TRP +# bit15-12: TWR +# bit19-16: TWTR +# bit20: TRAS msb +# bit23-21: 0x0 +# bit27-24: TRRD +# bit31-28: TRTP + +DATA 0xFFD0140C 0x00000033 # DDR Timing (High) +# bit6-0: TRFC +# bit8-7: TR2R +# bit10-9: TR2W +# bit12-11: TW2W +# bit31-13: zero required + +DATA 0xFFD01410 0x0000000D # DDR Address Control +# bit1-0: 01, Cs0width=x16 +# bit3-2: 11, Cs0size=1Gb +# bit5-4: 00, Cs2width=nonexistent +# bit7-6: 00, Cs1size =nonexistent +# bit9-8: 00, Cs2width=nonexistent +# bit11-10: 00, Cs2size =nonexistent +# bit13-12: 00, Cs3width=nonexistent +# bit15-14: 00, Cs3size =nonexistent +# bit16: 0, Cs0AddrSel +# bit17: 0, Cs1AddrSel +# bit18: 0, Cs2AddrSel +# bit19: 0, Cs3AddrSel +# bit31-20: 0 required + +DATA 0xFFD01414 0x00000000 # DDR Open Pages Control +# bit0: 0, OpenPage enabled +# bit31-1: 0 required + +DATA 0xFFD01418 0x00000000 # DDR Operation +# bit3-0: 0x0, DDR cmd +# bit31-4: 0 required + +DATA 0xFFD0141C 0x00000652 # DDR Mode +DATA 0xFFD01420 0x00000044 # DDR Extended Mode +# bit0: 0, DDR DLL enabled +# bit1: 0, DDR drive strenght normal +# bit2: 1, DDR ODT control lsd disabled +# bit5-3: 000, required +# bit6: 1, DDR ODT control msb, enabled +# bit9-7: 000, required +# bit10: 0, differential DQS enabled +# bit11: 0, required +# bit12: 0, DDR output buffer enabled +# bit31-13: 0 required + +DATA 0xFFD01424 0x0000F07F # DDR Controller Control High +# bit2-0: 111, required +# bit3 : 1 , MBUS Burst Chop disabled +# bit6-4: 111, required +# bit7 : 0 +# bit8 : 0 , no sample stage +# bit9 : 0 , no half clock cycle addition to dataout +# bit10 : 0 , 1/4 clock cycle skew enabled for addr/ctl signals +# bit11 : 0 , 1/4 clock cycle skew disabled for write mesh +# bit15-12: 1111 required +# bit31-16: 0 required +DATA 0xFFD01428 0x00074510 +DATA 0xFFD0147c 0x00007451 + +DATA 0xFFD01500 0x00000000 # CS[0]n Base address to 0x0 +DATA 0xFFD01504 0x07FFFFF1 # CS[0]n Size +# bit0: 1, Window enabled +# bit1: 0, Write Protect disabled +# bit3-2: 00, CS0 hit selected +# bit23-4: ones, required +# bit31-24: 0x07, Size (i.e. 128MB) + +DATA 0xFFD0150C 0x00000000 # CS[1]n Size, window disabled +DATA 0xFFD01514 0x00000000 # CS[2]n Size, window disabled +DATA 0xFFD0151C 0x00000000 # CS[3]n Size, window disabled + +DATA 0xFFD01494 0x00010001 # DDR ODT Control (Low) +# bit3-0: 0, ODT0Rd, MODT[0] asserted during read from DRAM CS0 +# bit19-16:0, ODT0Wr, MODT[0] asserted during write to DRAM CS0 + +DATA 0xFFD01498 0x00000000 # DDR ODT Control (High) +# bit1-0: 00, ODT0 controlled by ODT Control (low) register above +# bit3-2: 00, ODT1 controlled by register +# bit31-4: zero, required + +DATA 0xFFD0149C 0x0000FC11 # CPU ODT Control +# bit3-0: F, ODT0Rd, Internal ODT asserted during read from DRAM bank0 +# bit7-4: 0, ODT0Wr, Internal ODT asserted during write to DRAM bank0 +# bit9-8: 1, ODTEn, never active +# bit11-10:2, DQ_ODTSel. ODT select turned on, 75 ohm + +DATA 0xFFD01480 0x00000001 # DDR Initialization Control +# bit0=1, enable DDR init upon this register write + +# End of Header extension +DATA 0x0 0x0

This RAM is used on mgcoge3un and needs other initialization values for the SDRAM controller.
Signed-off-by: Valentin Longchamp valentin.longchamp@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: Prafulla Wadaskar prafulla@marvell.com --- board/keymile/km_arm/kwbimage-memphis-uart.cfg | 197 ++++++++++++++++++++++++ board/keymile/km_arm/kwbimage-memphis.cfg | 197 ++++++++++++++++++++++++ 2 files changed, 394 insertions(+), 0 deletions(-) create mode 100644 board/keymile/km_arm/kwbimage-memphis-uart.cfg create mode 100644 board/keymile/km_arm/kwbimage-memphis.cfg
diff --git a/board/keymile/km_arm/kwbimage-memphis-uart.cfg b/board/keymile/km_arm/kwbimage-memphis-uart.cfg new file mode 100644 index 0000000..214f6b6 --- /dev/null +++ b/board/keymile/km_arm/kwbimage-memphis-uart.cfg @@ -0,0 +1,197 @@ +# +# (C) Copyright 2010 +# Heiko Schocher, DENX Software Engineering, hs@denx.de. +# +# (C) Copyright 2011 +# Valentin Longchamp, Keymile AG, valentin.longchamp@keymile.com +# +# 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., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301 USA +# +# Refer docs/README.kwimage for more details about how-to configure +# and create kirkwood boot image +# + +# Boot Media configurations +BOOT_FROM uart # Boot from SPI flash + +DATA 0xFFD10000 0x01112222 # MPP Control 0 Register +# bit 3-0: MPPSel0 2, NF_IO[2] +# bit 7-4: MPPSel1 2, NF_IO[3] +# bit 12-8: MPPSel2 2, NF_IO[4] +# bit 15-12: MPPSel3 2, NF_IO[5] +# bit 19-16: MPPSel4 1, NF_IO[6] +# bit 23-20: MPPSel5 1, NF_IO[7] +# bit 27-24: MPPSel6 1, SYSRST_O +# bit 31-28: MPPSel7 0, GPO[7] + +DATA 0xFFD10004 0x03303300 + +DATA 0xFFD10008 0x00001100 # MPP Control 2 Register +# bit 3-0: MPPSel16 0, GPIO[16] +# bit 7-4: MPPSel17 0, GPIO[17] +# bit 12-8: MPPSel18 1, NF_IO[0] +# bit 15-12: MPPSel19 1, NF_IO[1] +# bit 19-16: MPPSel20 0, GPIO[20] +# bit 23-20: MPPSel21 0, GPIO[21] +# bit 27-24: MPPSel22 0, GPIO[22] +# bit 31-28: MPPSel23 0, GPIO[23] + +DATA 0xFFD100E0 0x1B1B1B1B # IO Configuration 0 Register +DATA 0xFFD20134 0x66666666 # L2 RAM Timing 0 Register +DATA 0xFFD20138 0x66666666 # L2 RAM Timing 1 Register +DATA 0xFFD20154 0x00000200 # CPU RAM Management Control3 Register +DATA 0xFFD2014C 0x00001C00 # CPU RAM Management Control1 Register +DATA 0xFFD20148 0x00000001 # CPU RAM Management Control0 Register + +#Dram initalization +DATA 0xFFD01400 0x430004E0 # SDRAM Configuration Register +# bit13-0: 0x4E0 (DDR2 clks refresh rate) +# bit23-14: zero +# bit24: 1= enable exit self refresh mode on DDR access +# bit25: 1 required +# bit29-26: zero +# bit31-30: 01 + +DATA 0xFFD01404 0x38543000 # DDR Controller Control Low +# bit 3-0: 0 reserved +# bit 4: 0=addr/cmd in smame cycle +# bit 5: 0=clk is driven during self refresh, we don't care for APX +# bit 6: 0=use recommended falling edge of clk for addr/cmd +# bit14: 0=input buffer always powered up +# bit18: 1=cpu lock transaction enabled +# bit23-20: 5=recommended value for CL=4 and STARTBURST_DEL disabled bit31=0 +# bit27-24: 8= CL+4, STARTBURST sample stages, for freqs 400MHz, unbuffered DIMM +# bit30-28: 3 required +# bit31: 0=no additional STARTBURST delay + +DATA 0xFFD01408 0x2302433E # DDR Timing (Low) (active cycles value +1) +# bit3-0: TRAS lsbs +# bit7-4: TRCD +# bit11- 8: TRP +# bit15-12: TWR +# bit19-16: TWTR +# bit20: TRAS msb +# bit23-21: 0x0 +# bit27-24: TRRD +# bit31-28: TRTP + +DATA 0xFFD0140C 0x00000A3E # DDR Timing (High) +# bit6-0: TRFC +# bit8-7: TR2R +# bit10-9: TR2W +# bit12-11: TW2W +# bit31-13: zero required + +DATA 0xFFD01410 0x00000001 # DDR Address Control +# bit1-0: 01, Cs0width=x16 +# bit3-2: 00, Cs0size=2Gb +# bit5-4: 00, Cs2width=nonexistent +# bit7-6: 00, Cs1size =nonexistent +# bit9-8: 00, Cs2width=nonexistent +# bit11-10: 00, Cs2size =nonexistent +# bit13-12: 00, Cs3width=nonexistent +# bit15-14: 00, Cs3size =nonexistent +# bit16: 0, Cs0AddrSel +# bit17: 0, Cs1AddrSel +# bit18: 0, Cs2AddrSel +# bit19: 0, Cs3AddrSel +# bit31-20: 0 required + +DATA 0xFFD01414 0x00000000 # DDR Open Pages Control +# bit0: 0, OpenPage enabled +# bit31-1: 0 required + +DATA 0xFFD01418 0x00000000 # DDR Operation +# bit3-0: 0x0, DDR cmd +# bit31-4: 0 required + +DATA 0xFFD0141C 0x00000652 # DDR Mode +DATA 0xFFD01420 0x00000006 # DDR Extended Mode +# bit0: 0, DDR DLL enabled +# bit1: 1, DDR drive strenght reduced +# bit2: 1, DDR ODT control lsd disabled +# bit5-3: 000, required +# bit6: 0, DDR ODT control msb disabled +# bit9-7: 000, required +# bit10: 0, differential DQS enabled +# bit11: 0, required +# bit12: 0, DDR output buffer enabled +# bit31-13: 0 required + +DATA 0xFFD01424 0x0000F17F # DDR Controller Control High +# bit2-0: 111, required +# bit3 : 1 , MBUS Burst Chop disabled +# bit6-4: 111, required +# bit7 : 0 +# bit8 : 1 , add a sample stage +# bit9 : 0 , no half clock cycle addition to dataout +# bit10 : 0 , 1/4 clock cycle skew enabled for addr/ctl signals +# bit11 : 0 , 1/4 clock cycle skew disabled for write mesh +# bit15-12: 1111 required +# bit31-16: 0 required + +DATA 0xFFD01428 0x00084520 # DDR2 SDRAM Timing Low +# bit3-0 : 0000, required +# bit7-4 : 0010, M_ODT assertion 2 cycles after read +# bit11-8 : 1001, M_ODT de-assertion 5 cycles after read +# bit15-12: 0100, internal ODT assertion 4 cycles after read +# bit19-16: 1000, internal ODT de-assertion 8 cycles after read +# bit31-20: 0 , required + +DATA 0xFFD0147c 0x00008451 # DDR2 SDRAM Timing High +# bit3-0 : 0001, M_ODT assertion same cycle as write +# bit7-4 : 0101, M_ODT de-assertion x cycles after write +# bit11-8 : 0100, internal ODT assertion x cycles after write +# bit15-12: 1000, internal ODT de-assertion x cycles after write + +DATA 0xFFD01500 0x00000000 # CS[0]n Base address to 0x0 +DATA 0xFFD01504 0x0FFFFFF1 # CS[0]n Size +# bit0: 1, Window enabled +# bit1: 0, Write Protect disabled +# bit3-2: 00, CS0 hit selected +# bit23-4: ones, required +# bit31-24: 0x0F, Size (i.e. 256MB) + +DATA 0xFFD0150C 0x00000000 # CS[1]n Size, window disabled +DATA 0xFFD01514 0x00000000 # CS[2]n Size, window disabled +DATA 0xFFD0151C 0x00000000 # CS[3]n Size, window disabled + +DATA 0xFFD01494 0x00010000 # DDR ODT Control (Low) +# bit3-0: 0, ODT0Rd, MODT[0] not asserted during read from DRAM CS0 +# bit19-16:1, ODT0Wr, MODT[0] asserted during write to DRAM CS0 + +DATA 0xFFD01498 0x00000000 # DDR ODT Control (High) +# bit1-0: 00, ODT0 controlled by ODT Control (low) register above +# bit3-2: 00, ODT1 controlled by register +# bit31-4: zero, required + +DATA 0xFFD0149C 0x0000F801 # CPU ODT Control +# bit3-0: 1, ODT0Rd, Internal ODT asserted during read from DRAM bank0 +# bit7-4: 0, ODT0Wr, Internal ODT not asserted during write to DRAM bank0 +# bit9-8: 0, ODTEn, controlled by ODT0Rd and ODT0Wr +# bit11-10:2, DQ_ODTSel. ODT select turned on, 75 ohm +# bit13-12:3, STARTBURST ODT buffer selected, 50 ohm +# bit14 :1, STARTBURST ODT enabled +# bit15 :1, Use ODT Block + +DATA 0xFFD01480 0x00000001 # DDR Initialization Control +# bit0=1, enable DDR init upon this register write + +# End of Header extension +DATA 0x0 0x0 diff --git a/board/keymile/km_arm/kwbimage-memphis.cfg b/board/keymile/km_arm/kwbimage-memphis.cfg new file mode 100644 index 0000000..2faaf2b --- /dev/null +++ b/board/keymile/km_arm/kwbimage-memphis.cfg @@ -0,0 +1,197 @@ +# +# (C) Copyright 2010 +# Heiko Schocher, DENX Software Engineering, hs@denx.de. +# +# (C) Copyright 2011 +# Valentin Longchamp, Keymile AG, valentin.longchamp@keymile.com +# +# 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., 51 Franklin Street, Fifth Floor, Boston, +# MA 02110-1301 USA +# +# Refer docs/README.kwimage for more details about how-to configure +# and create kirkwood boot image +# + +# Boot Media configurations +BOOT_FROM spi # Boot from SPI flash + +DATA 0xFFD10000 0x01112222 # MPP Control 0 Register +# bit 3-0: MPPSel0 2, NF_IO[2] +# bit 7-4: MPPSel1 2, NF_IO[3] +# bit 12-8: MPPSel2 2, NF_IO[4] +# bit 15-12: MPPSel3 2, NF_IO[5] +# bit 19-16: MPPSel4 1, NF_IO[6] +# bit 23-20: MPPSel5 1, NF_IO[7] +# bit 27-24: MPPSel6 1, SYSRST_O +# bit 31-28: MPPSel7 0, GPO[7] + +DATA 0xFFD10004 0x03303300 + +DATA 0xFFD10008 0x00001100 # MPP Control 2 Register +# bit 3-0: MPPSel16 0, GPIO[16] +# bit 7-4: MPPSel17 0, GPIO[17] +# bit 12-8: MPPSel18 1, NF_IO[0] +# bit 15-12: MPPSel19 1, NF_IO[1] +# bit 19-16: MPPSel20 0, GPIO[20] +# bit 23-20: MPPSel21 0, GPIO[21] +# bit 27-24: MPPSel22 0, GPIO[22] +# bit 31-28: MPPSel23 0, GPIO[23] + +DATA 0xFFD100E0 0x1B1B1B1B # IO Configuration 0 Register +DATA 0xFFD20134 0x66666666 # L2 RAM Timing 0 Register +DATA 0xFFD20138 0x66666666 # L2 RAM Timing 1 Register +DATA 0xFFD20154 0x00000200 # CPU RAM Management Control3 Register +DATA 0xFFD2014C 0x00001C00 # CPU RAM Management Control1 Register +DATA 0xFFD20148 0x00000001 # CPU RAM Management Control0 Register + +#Dram initalization +DATA 0xFFD01400 0x430004E0 # SDRAM Configuration Register +# bit13-0: 0x4E0 (DDR2 clks refresh rate) +# bit23-14: zero +# bit24: 1= enable exit self refresh mode on DDR access +# bit25: 1 required +# bit29-26: zero +# bit31-30: 01 + +DATA 0xFFD01404 0x38543000 # DDR Controller Control Low +# bit 3-0: 0 reserved +# bit 4: 0=addr/cmd in smame cycle +# bit 5: 0=clk is driven during self refresh, we don't care for APX +# bit 6: 0=use recommended falling edge of clk for addr/cmd +# bit14: 0=input buffer always powered up +# bit18: 1=cpu lock transaction enabled +# bit23-20: 5=recommended value for CL=4 and STARTBURST_DEL disabled bit31=0 +# bit27-24: 8= CL+4, STARTBURST sample stages, for freqs 400MHz, unbuffered DIMM +# bit30-28: 3 required +# bit31: 0=no additional STARTBURST delay + +DATA 0xFFD01408 0x2302433E # DDR Timing (Low) (active cycles value +1) +# bit3-0: TRAS lsbs +# bit7-4: TRCD +# bit11- 8: TRP +# bit15-12: TWR +# bit19-16: TWTR +# bit20: TRAS msb +# bit23-21: 0x0 +# bit27-24: TRRD +# bit31-28: TRTP + +DATA 0xFFD0140C 0x00000A3E # DDR Timing (High) +# bit6-0: TRFC +# bit8-7: TR2R +# bit10-9: TR2W +# bit12-11: TW2W +# bit31-13: zero required + +DATA 0xFFD01410 0x00000001 # DDR Address Control +# bit1-0: 01, Cs0width=x16 +# bit3-2: 00, Cs0size=2Gb +# bit5-4: 00, Cs2width=nonexistent +# bit7-6: 00, Cs1size =nonexistent +# bit9-8: 00, Cs2width=nonexistent +# bit11-10: 00, Cs2size =nonexistent +# bit13-12: 00, Cs3width=nonexistent +# bit15-14: 00, Cs3size =nonexistent +# bit16: 0, Cs0AddrSel +# bit17: 0, Cs1AddrSel +# bit18: 0, Cs2AddrSel +# bit19: 0, Cs3AddrSel +# bit31-20: 0 required + +DATA 0xFFD01414 0x00000000 # DDR Open Pages Control +# bit0: 0, OpenPage enabled +# bit31-1: 0 required + +DATA 0xFFD01418 0x00000000 # DDR Operation +# bit3-0: 0x0, DDR cmd +# bit31-4: 0 required + +DATA 0xFFD0141C 0x00000652 # DDR Mode +DATA 0xFFD01420 0x00000006 # DDR Extended Mode +# bit0: 0, DDR DLL enabled +# bit1: 1, DDR drive strenght reduced +# bit2: 1, DDR ODT control lsd disabled +# bit5-3: 000, required +# bit6: 0, DDR ODT control msb disabled +# bit9-7: 000, required +# bit10: 0, differential DQS enabled +# bit11: 0, required +# bit12: 0, DDR output buffer enabled +# bit31-13: 0 required + +DATA 0xFFD01424 0x0000F17F # DDR Controller Control High +# bit2-0: 111, required +# bit3 : 1 , MBUS Burst Chop disabled +# bit6-4: 111, required +# bit7 : 0 +# bit8 : 1 , add a sample stage +# bit9 : 0 , no half clock cycle addition to dataout +# bit10 : 0 , 1/4 clock cycle skew enabled for addr/ctl signals +# bit11 : 0 , 1/4 clock cycle skew disabled for write mesh +# bit15-12: 1111 required +# bit31-16: 0 required + +DATA 0xFFD01428 0x00084520 # DDR2 SDRAM Timing Low +# bit3-0 : 0000, required +# bit7-4 : 0010, M_ODT assertion 2 cycles after read +# bit11-8 : 1001, M_ODT de-assertion 5 cycles after read +# bit15-12: 0100, internal ODT assertion 4 cycles after read +# bit19-16: 1000, internal ODT de-assertion 8 cycles after read +# bit31-20: 0 , required + +DATA 0xFFD0147c 0x00008451 # DDR2 SDRAM Timing High +# bit3-0 : 0001, M_ODT assertion same cycle as write +# bit7-4 : 0101, M_ODT de-assertion x cycles after write +# bit11-8 : 0100, internal ODT assertion x cycles after write +# bit15-12: 1000, internal ODT de-assertion x cycles after write + +DATA 0xFFD01500 0x00000000 # CS[0]n Base address to 0x0 +DATA 0xFFD01504 0x0FFFFFF1 # CS[0]n Size +# bit0: 1, Window enabled +# bit1: 0, Write Protect disabled +# bit3-2: 00, CS0 hit selected +# bit23-4: ones, required +# bit31-24: 0x0F, Size (i.e. 256MB) + +DATA 0xFFD0150C 0x00000000 # CS[1]n Size, window disabled +DATA 0xFFD01514 0x00000000 # CS[2]n Size, window disabled +DATA 0xFFD0151C 0x00000000 # CS[3]n Size, window disabled + +DATA 0xFFD01494 0x00010000 # DDR ODT Control (Low) +# bit3-0: 0, ODT0Rd, MODT[0] not asserted during read from DRAM CS0 +# bit19-16:1, ODT0Wr, MODT[0] asserted during write to DRAM CS0 + +DATA 0xFFD01498 0x00000000 # DDR ODT Control (High) +# bit1-0: 00, ODT0 controlled by ODT Control (low) register above +# bit3-2: 00, ODT1 controlled by register +# bit31-4: zero, required + +DATA 0xFFD0149C 0x0000F801 # CPU ODT Control +# bit3-0: 1, ODT0Rd, Internal ODT asserted during read from DRAM bank0 +# bit7-4: 0, ODT0Wr, Internal ODT not asserted during write to DRAM bank0 +# bit9-8: 0, ODTEn, controlled by ODT0Rd and ODT0Wr +# bit11-10:2, DQ_ODTSel. ODT select turned on, 75 ohm +# bit13-12:3, STARTBURST ODT buffer selected, 50 ohm +# bit14 :1, STARTBURST ODT enabled +# bit15 :1, Use ODT Block + +DATA 0xFFD01480 0x00000001 # DDR Initialization Control +# bit0=1, enable DDR init upon this register write + +# End of Header extension +DATA 0x0 0x0

This is not supported on our km-arm boards since we have defined CONFIG_SYS_NO_FLASH for our NAND Flash chip.
With CONFIG_CMD_JFFS2, the ls command is present and works very badly on our km-arm boards.
Signed-off-by: Valentin Longchamp valentin.longchamp@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: Prafulla Wadaskar prafulla@marvell.com --- include/configs/km_arm.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/include/configs/km_arm.h b/include/configs/km_arm.h index 89f9d35..a8a4d77 100644 --- a/include/configs/km_arm.h +++ b/include/configs/km_arm.h @@ -248,6 +248,7 @@ int get_scl (void); #if defined(CONFIG_SYS_NO_FLASH) #define CONFIG_KM_UBI_PARTITION_NAME "ubi0" #undef CONFIG_FLASH_CFI_MTD +#undef CONFIG_CMD_JFFS2 #undef CONFIG_JFFS2_CMDLINE #endif

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: Prafulla Wadaskar prafulla@marvell.com cc: Valentin Longchamp valentin.longchamp@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com --- include/configs/km_arm.h | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
diff --git a/include/configs/km_arm.h b/include/configs/km_arm.h index a8a4d77..06f91fe 100644 --- a/include/configs/km_arm.h +++ b/include/configs/km_arm.h @@ -92,6 +92,7 @@ #define CONFIG_SYS_NS16550_REG_SIZE (-4) #define CONFIG_SYS_NS16550_CLK CONFIG_SYS_TCLK #define CONFIG_SYS_NS16550_COM1 KW_UART0_BASE +#define CONFIG_SYS_NS16550_COM2 KW_UART1_BASE
/* * Serial Port configuration @@ -136,7 +137,12 @@
#define BOOTFLASH_START 0x0
+/* Kirkwood has two serial IF */ +#if (CONFIG_CONS_INDEX == 2) +#define CONFIG_KM_CONSOLE_TTY "ttyS1" +#else #define CONFIG_KM_CONSOLE_TTY "ttyS0" +#endif
/* size in bytes reserved for initial data */

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) {

Dear Valentin Longchamp,
In message e0cad960c27371170bf2d2d4be3362d6665fbbfa.1302272395.git.valentin.longchamp@keymile.com you wrote:
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
Do we need the #ifndef here? I don;t thik it hurts if we unconditionally #include <flash.h> ?
But note: there was no "extern" in this declaration of flash_info[], i. e. we _did_ allocate storage here. Is the new code really equivalent? How extensively has it been tested?
#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
Sequences like this repeat a number of times. How about
#ifdef CONFIG_SYS_NO_FLASH # define OFFSET_ADJUSTMENT(x) 0 #else # define OFFSET_ADJUSTMENT(x) (flash_info[id.num].start[x]) #endif ... dev.id = &id; part.dev = &dev; /* fake the address offset */ part.offset = addr - OFFSET_ADJUSTMENT(0);
+#if !defined(CONFIG_SYS_NO_FLASH) part.offset = addr - flash_info[id.num].start[0]; +#else
- part.offset = addr;
+#endif
part.offset = addr - OFFSET_ADJUSTMENT(0);
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)
#define PART_OFFSET(x) (x->offset + OFFSET_ADJUSTMENT(0))
[If we always refer to start[0] only, we can even omit the argument.]
Best regards,
Wolfgang Denk

Hello Wolfgang,
Wolfgang Denk wrote:
Dear Valentin Longchamp,
In message e0cad960c27371170bf2d2d4be3362d6665fbbfa.1302272395.git.valentin.longchamp@keymile.com you wrote:
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
Do we need the #ifndef here? I don;t thik it hurts if we unconditionally #include <flash.h> ?
Yep, you are right.
But note: there was no "extern" in this declaration of flash_info[], i. e. we _did_ allocate storage here. Is the new code really equivalent? How extensively has it been tested?
flash_info is defined in the flash driver, so this is OK. It is tested on the keymile boards, and a MAKEALL runs clean.
#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
Sequences like this repeat a number of times. How about
#ifdef CONFIG_SYS_NO_FLASH # define OFFSET_ADJUSTMENT(x) 0 #else # define OFFSET_ADJUSTMENT(x) (flash_info[id.num].start[x]) #endif ... dev.id = &id; part.dev = &dev; /* fake the address offset */ part.offset = addr - OFFSET_ADJUSTMENT(0);
Yep, that looks better, I change this.
+#if !defined(CONFIG_SYS_NO_FLASH) part.offset = addr - flash_info[id.num].start[0]; +#else
- part.offset = addr;
+#endif
part.offset = addr - OFFSET_ADJUSTMENT(0);
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)
#define PART_OFFSET(x) (x->offset + OFFSET_ADJUSTMENT(0))
[If we always refer to start[0] only, we can even omit the argument.]
Yep.
Wolfgang? Is it OK, to send a v2 which is not in this patchseries, as I think this is an independent patch?
bye, Heiko

Dear Heiko Schocher,
In message 4DBF9760.5030607@denx.de you wrote:
--- 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
Do we need the #ifndef here? I don;t thik it hurts if we unconditionally #include <flash.h> ?
Yep, you are right.
But note: there was no "extern" in this declaration of flash_info[], i. e. we _did_ allocate storage here. Is the new code really equivalent? How extensively has it been tested?
flash_info is defined in the flash driver, so this is OK. It is tested on the keymile boards, and a MAKEALL runs clean.
You are probably right that the code with your patch is correct, i. e. that this one-line deletion fixes an actual bug in the existing code. But you don't mention this in the commit message.
These are two unrelated changes, that belon into separate commits.
Best regards,
Wolfgang Denk

do not define own flash_info variable, instead use the flash_info variable defined in your flash driver.
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 --- changes for v2: - added comments from Wolfgang Denk: - new patch in this version - no ifndef around include <flash.h> needed
common/cmd_cramfs.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/common/cmd_cramfs.c b/common/cmd_cramfs.c index 8c86dc5..9060ecc 100644 --- a/common/cmd_cramfs.c +++ b/common/cmd_cramfs.c @@ -43,7 +43,7 @@ #endif
#ifdef CONFIG_CRAMFS_CMDLINE -flash_info_t flash_info[1]; +#include <flash.h>
#ifndef CONFIG_CMD_JFFS2 #include <linux/stat.h>

Dear Heiko Schocher,
In message 1304424901-17089-1-git-send-email-hs@denx.de you wrote:
do not define own flash_info variable, instead use the flash_info variable defined in your flash driver.
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
changes for v2:
- added comments from Wolfgang Denk:
- new patch in this version
- no ifndef around include <flash.h> needed
common/cmd_cramfs.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

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 --- changes for v2: - added comments from Wolfgang Denk: - introduce define OFFSET_ADJUSTMENT, so command can be used without a NOR flash.
common/cmd_cramfs.c | 10 ++++++++-- fs/cramfs/cramfs.c | 4 ++++ 2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/common/cmd_cramfs.c b/common/cmd_cramfs.c index 9060ecc..e7f496e 100644 --- a/common/cmd_cramfs.c +++ b/common/cmd_cramfs.c @@ -45,6 +45,12 @@ #ifdef CONFIG_CRAMFS_CMDLINE #include <flash.h>
+#ifdef CONFIG_SYS_NO_FLASH +# define OFFSET_ADJUSTMENT 0 +#else +# define OFFSET_ADJUSTMENT (flash_info[id.num].start[0]) +#endif + #ifndef CONFIG_CMD_JFFS2 #include <linux/stat.h> char *mkmodestr(unsigned long mode, char *str) @@ -119,7 +125,7 @@ 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 */ - part.offset = addr - flash_info[id.num].start[0]; + part.offset = addr - OFFSET_ADJUSTMENT;
/* pre-set Boot file name */ if ((filename = getenv("bootfile")) == NULL) { @@ -182,7 +188,7 @@ 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 */ - part.offset = addr - flash_info[id.num].start[0]; + part.offset = addr - OFFSET_ADJUSTMENT;
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) {

Dear Heiko Schocher,
In message 1304424915-17137-1-git-send-email-hs@denx.de you wrote:
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
changes for v2:
- added comments from Wolfgang Denk:
- introduce define OFFSET_ADJUSTMENT, so command can be used without a NOR flash.
common/cmd_cramfs.c | 10 ++++++++-- fs/cramfs/cramfs.c | 4 ++++ 2 files changed, 12 insertions(+), 2 deletions(-)
Applied, thanks.
Best regards,
Wolfgang Denk

From: Stefan Bigler stefan.bigler@keymile.com
To make sure that the mux can be configured a deblocking sequence is done before the mux configuration. After the mux switch the new leaf of, the i2c tree must be again deblocked.
Signed-off-by: Stefan Bigler stefan.bigler@keymile.com Acked-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de cc: Prafulla Wadaskar prafulla@marvell.com 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_i2c.c | 12 ++++++++++++ include/i2c.h | 2 -- 2 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c index c272b0d..d913e13 100644 --- a/common/cmd_i2c.c +++ b/common/cmd_i2c.c @@ -132,6 +132,14 @@ DECLARE_GLOBAL_DATA_PTR;
#define DISP_LINE_LEN 16
+/* implement possible board specific board init */ +void __def_i2c_init_board(void) +{ + return; +} +void i2c_init_board(void) + __attribute__((weak, alias("__def_i2c_init_board"))); + /* TODO: Implement architecture-specific get/set functions */ unsigned int __def_i2c_get_bus_speed(void) { @@ -1541,6 +1549,8 @@ int i2x_mux_select_mux(int bus)
mux = dev->mux; while (mux != NULL) { + /* do deblocking on each level of mux, before mux config */ + i2c_init_board(); if (i2c_write(mux->chip, 0, 0, &mux->channel, 1) != 0) { printf ("Error setting Mux: chip:%x channel: \ %x\n", mux->chip, mux->channel); @@ -1548,6 +1558,8 @@ int i2x_mux_select_mux(int bus) } mux = mux->next; } + /* do deblocking on each level of mux and after mux config */ + i2c_init_board(); return 0; } #endif /* CONFIG_I2C_MUX */ diff --git a/include/i2c.h b/include/i2c.h index cd23c8a..8ceb4c8 100644 --- a/include/i2c.h +++ b/include/i2c.h @@ -108,9 +108,7 @@ * repeatedly to change the speed and slave addresses. */ void i2c_init(int speed, int slaveaddr); -#ifdef CONFIG_SYS_I2C_INIT_BOARD void i2c_init_board(void); -#endif #ifdef CONFIG_SYS_I2C_BOARD_LATE_INIT void i2c_board_late_init(void); #endif

Hello Valentin,
Valentin Longchamp wrote:
From: Stefan Bigler stefan.bigler@keymile.com
To make sure that the mux can be configured a deblocking sequence is done before the mux configuration. After the mux switch the new leaf of, the i2c tree must be again deblocked.
Signed-off-by: Stefan Bigler stefan.bigler@keymile.com Acked-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de cc: Prafulla Wadaskar prafulla@marvell.com 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_i2c.c | 12 ++++++++++++ include/i2c.h | 2 -- 2 files changed, 12 insertions(+), 2 deletions(-)
Thanks! Applied to u-boot-i2c. As this patch is independent, it must not be in a patchseries, so I applied it directly to the i2c-tree.
bye, Heiko

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

Hello Valentin,
Valentin Longchamp wrote:
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(-)
Thanks! Applied to u-boot-i2c. As this patch is independent, it must not be in a patchseries, so I applied it directly to the i2c-tree.
bye, Heiko

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);

Dear Valentin Longchamp,
In message bcd3f91d4c8a00436c4eafa44b9cc3fa77e09063.1302272395.git.valentin.longchamp@keymile.com you wrote:
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
What is the rationale for this change?
Best regards,
Wolfgang Denk

Hello Wolfgang,
Wolfgang Denk wrote:
Dear Valentin Longchamp,
In message bcd3f91d4c8a00436c4eafa44b9cc3fa77e09063.1302272395.git.valentin.longchamp@keymile.com you wrote:
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
What is the rationale for this change?
We can actually only set from c-code local hush shell variables, with this patch we can also read them from c-code.
bye, Heiko

Dear Heiko Schocher,
In message 4DBE3FE6.8010009@denx.de you wrote:
What is the rationale for this change?
We can actually only set from c-code local hush shell variables, with this patch we can also read them from c-code.
I see, thanks.
Best regards,
Wolfgang Denk

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"); +

Dear Valentin Longchamp,
In message 30d7413306aba80ca4540c3353d884bdffe9a643.1302272395.git.valentin.longchamp@keymile.com you wrote:
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.
This begs to ask: and how has it been done so far? Should this patch not remove some old code, then?
+{
- 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);
get_local_var() will return NULL in some cases. Error handling missing.
- return 0;
As is, the return 0 makes no sense, but I guess this will change when you add error handling.
Best regards,
Wolfgang Denk

Hi,
On 04/30/2011 10:25 AM, Wolfgang Denk wrote:
Dear Valentin Longchamp,
In message 30d7413306aba80ca4540c3353d884bdffe9a643.1302272395.git.valentin.longchamp@keymile.com you wrote:
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.
This begs to ask: and how has it been done so far? Should this patch not remove some old code, then?
Yes it does, we did it previously in the default environment. But this was an out of tree patch so far. Maybe I should adapt the commit message.
+{
- 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);
get_local_var() will return NULL in some cases. Error handling missing.
Ok.
- return 0;
As is, the return 0 makes no sense, but I guess this will change when you add error handling.
Yes.
Thanks.
Best regards Holger Brunck

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

Dear Valentin Longchamp,
In message e341fcb668eb67e1eb44ea638e96f9bb514c8bfb.1302272395.git.valentin.longchamp@keymile.com you wrote:
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.
...
- p = get_local_var("IVM_BoardId");
- strict_strtoul(p, 16, &ivmbid);
- p = get_local_var("IVM_HWKey");
- strict_strtoul(p, 16, &ivmhwkey);
Error handling missing.
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();
}
How well has this code been tested? I may not understand it correctly (which might be an indication that some comments are missing that actually explain what you are doing), or there might be some unhandled error cases.
Best regards,
Wolfgang Denk

Hello,
On 04/30/2011 10:29 AM, Wolfgang Denk wrote:
Dear Valentin Longchamp,
In message e341fcb668eb67e1eb44ea638e96f9bb514c8bfb.1302272395.git.valentin.longchamp@keymile.com you wrote:
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.
...
- p = get_local_var("IVM_BoardId");
- strict_strtoul(p, 16, &ivmbid);
- p = get_local_var("IVM_HWKey");
- strict_strtoul(p, 16, &ivmhwkey);
Error handling missing.
Ok.
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();
}
How well has this code been tested? I may not understand it correctly (which might be an indication that some comments are missing that actually explain what you are doing), or there might be some unhandled error cases.
It is tested on our boards. But indeed the commit message should be better to be able to understand the functionality. Additionaly we check if additionaly some error cases are not handled.
Best regards Holger Brunck

Dear Holger Brunck,
In message 4DBE6B91.7090008@keymile.com you wrote:
How well has this code been tested? I may not understand it correctly (which might be an indication that some comments are missing that actually explain what you are doing), or there might be some unhandled error cases.
It is tested on our boards. But indeed the commit message should be better to be able to understand the functionality. Additionaly we check if additionaly some error cases are not handled.
And please comment the _code_!
Best regards,
Wolfgang Denk

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);

Dear Valentin Longchamp,
In message ba20e078a0b5ac55510f321b282dbff192ffba15.1302272395.git.valentin.longchamp@keymile.com you wrote:
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.
How does this work? A plain setenv() here just adds an entry to the hash table where U-Boot stores the variables. This data is not accessable in Linux ("start scripts in linux" being init scripts?)
Best regards,
Wolfgang Denk

Hi Mr. Denk,
On 04/30/2011 10:32 AM, Wolfgang Denk wrote:
Dear Valentin Longchamp,
In message ba20e078a0b5ac55510f321b282dbff192ffba15.1302272395.git.valentin.longchamp@keymile.com you wrote:
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.
How does this work? A plain setenv() here just adds an entry to the hash table where U-Boot stores the variables. This data is not accessable in Linux ("start scripts in linux" being init scripts?)
Argh. Good catch. It actually works because we do initially one time a saveenv when we start a boot with the "release environment". But it isn't good to be dependent to a previously saveenv. I will remove it there and add this variable to the default environment.
Best regards Holger Brunck

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: Heiko Schocher hs@denx.de
Collect all keymile specific common headers in include/configs/km.
Signed-off-by: Heiko Schocher hs@denx.de cc: Wolfgang Denk wd@denx.de cc: Detlev Zundel dzu@denx.de cc: Prafulla Wadaskar prafulla@marvell.com cc: Kim Phillips kim.phillips@freescale.com cc: Valentin Longchamp valentin.longchamp@keymile.com cc: Holger Brunck holger.brunck@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com --- include/configs/{ => km}/keymile-common.h | 0 include/configs/{ => km}/km-powerpc.h | 0 include/configs/{ => km}/km82xx-common.h | 0 include/configs/{ => km}/km8321-common.h | 0 include/configs/{ => km}/km83xx-common.h | 0 include/configs/{ => km}/km_arm.h | 0 include/configs/kmeter1.h | 2 +- include/configs/kmsupx5.h | 2 +- include/configs/mgcoge.h | 6 +++--- include/configs/mgcoge2un.h | 2 +- include/configs/mgcoge3ne.h | 6 +++--- 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 +- 16 files changed, 14 insertions(+), 14 deletions(-) rename include/configs/{ => km}/keymile-common.h (100%) rename include/configs/{ => km}/km-powerpc.h (100%) rename include/configs/{ => km}/km82xx-common.h (100%) rename include/configs/{ => km}/km8321-common.h (100%) rename include/configs/{ => km}/km83xx-common.h (100%) rename include/configs/{ => km}/km_arm.h (100%)
diff --git a/include/configs/keymile-common.h b/include/configs/km/keymile-common.h similarity index 100% rename from include/configs/keymile-common.h rename to include/configs/km/keymile-common.h diff --git a/include/configs/km-powerpc.h b/include/configs/km/km-powerpc.h similarity index 100% rename from include/configs/km-powerpc.h rename to include/configs/km/km-powerpc.h diff --git a/include/configs/km82xx-common.h b/include/configs/km/km82xx-common.h similarity index 100% rename from include/configs/km82xx-common.h rename to include/configs/km/km82xx-common.h diff --git a/include/configs/km8321-common.h b/include/configs/km/km8321-common.h similarity index 100% rename from include/configs/km8321-common.h rename to include/configs/km/km8321-common.h diff --git a/include/configs/km83xx-common.h b/include/configs/km/km83xx-common.h similarity index 100% rename from include/configs/km83xx-common.h rename to include/configs/km/km83xx-common.h diff --git a/include/configs/km_arm.h b/include/configs/km/km_arm.h similarity index 100% rename from include/configs/km_arm.h rename to include/configs/km/km_arm.h diff --git a/include/configs/kmeter1.h b/include/configs/kmeter1.h index 2fcecaf..8639ddd 100644 --- a/include/configs/kmeter1.h +++ b/include/configs/kmeter1.h @@ -34,7 +34,7 @@ "netdev=eth2\0" \
/* include common defines/options for all 83xx Keymile boards */ -#include "km83xx-common.h" +#include "km/km83xx-common.h"
#define CONFIG_MISC_INIT_R /* diff --git a/include/configs/kmsupx5.h b/include/configs/kmsupx5.h index 55ed3f6..f8cd8e0 100644 --- a/include/configs/kmsupx5.h +++ b/include/configs/kmsupx5.h @@ -36,7 +36,7 @@ #define CONFIG_SYS_TEXT_BASE 0xF0000000
/* include common defines/options for all 8321 Keymile boards */ -#include "km8321-common.h" +#include "km/km8321-common.h"
/* * Init Local Bus Memory Controller: diff --git a/include/configs/mgcoge.h b/include/configs/mgcoge.h index 0745855..b736c56 100644 --- a/include/configs/mgcoge.h +++ b/include/configs/mgcoge.h @@ -37,8 +37,8 @@ #define CONFIG_SYS_TEXT_BASE 0xFE000000
/* include common defines/options for all Keymile boards */ -#include "keymile-common.h" -#include "km-powerpc.h" +#include "km/keymile-common.h" +#include "km/km-powerpc.h"
#define CONFIG_SYS_SDRAM_BASE 0x00000000 #define CONFIG_SYS_FLASH_BASE 0xFE000000 @@ -88,6 +88,6 @@ #define CONFIG_KM_BOARD_EXTRA_ENV ""
/* include further common stuff for all keymile 82xx boards */ -#include "km82xx-common.h" +#include "km/km82xx-common.h"
#endif /* __CONFIG_H */ diff --git a/include/configs/mgcoge2un.h b/include/configs/mgcoge2un.h index d3c7bdc..6256035 100644 --- a/include/configs/mgcoge2un.h +++ b/include/configs/mgcoge2un.h @@ -35,7 +35,7 @@ #define _CONFIG_MGCOGE2UN_H
/* include common defines/options for all arm based Keymile boards */ -#include "km_arm.h" +#include "km/km_arm.h"
/* * Version number information diff --git a/include/configs/mgcoge3ne.h b/include/configs/mgcoge3ne.h index 78ce468..027754a 100644 --- a/include/configs/mgcoge3ne.h +++ b/include/configs/mgcoge3ne.h @@ -37,8 +37,8 @@ #define CONFIG_SYS_TEXT_BASE 0xFE000000
/* include common defines/options for all Keymile boards */ -#include "keymile-common.h" -#include "km-powerpc.h" +#include "km/keymile-common.h" +#include "km/km-powerpc.h"
#define CONFIG_SYS_SDRAM_BASE 0x00000000 #define CONFIG_SYS_FLASH_BASE 0xFE000000 @@ -92,6 +92,6 @@ #define CONFIG_KM_BOARD_EXTRA_ENV "bobcatreset=true\0"
/* include further common stuff for all keymile 82xx boards */ -#include "km82xx-common.h" +#include "km/km82xx-common.h"
#endif /* __MGCOGE3NE */ diff --git a/include/configs/suen3.h b/include/configs/suen3.h index 2b6f19e..aa4d778 100644 --- a/include/configs/suen3.h +++ b/include/configs/suen3.h @@ -34,7 +34,7 @@ #define _CONFIG_SUEN3_H
/* include common defines/options for all arm based Keymile boards */ -#include "km_arm.h" +#include "km/km_arm.h"
/* * Version number information diff --git a/include/configs/suen8.h b/include/configs/suen8.h index 3f60bc3..b680dfb 100644 --- a/include/configs/suen8.h +++ b/include/configs/suen8.h @@ -35,7 +35,7 @@ #define _CONFIG_SUEN8_H
/* include common defines/options for all arm based Keymile boards */ -#include "km_arm.h" +#include "km/km_arm.h"
/* * Version number information diff --git a/include/configs/suvd3.h b/include/configs/suvd3.h index d9eb201..0b59d51 100644 --- a/include/configs/suvd3.h +++ b/include/configs/suvd3.h @@ -30,7 +30,7 @@ #define CONFIG_SYS_TEXT_BASE 0xF0000000
/* include common defines/options for all 8321 Keymile boards */ -#include "km8321-common.h" +#include "km/km8321-common.h"
#define CONFIG_SYS_APP1_BASE 0xA0000000 #define CONFIG_SYS_APP1_SIZE 256 /* Megabytes */ diff --git a/include/configs/tuda1.h b/include/configs/tuda1.h index 1c0b3e0..853c00a 100644 --- a/include/configs/tuda1.h +++ b/include/configs/tuda1.h @@ -33,7 +33,7 @@ #define CONFIG_SYS_TEXT_BASE 0xF0000000
/* include common defines/options for all 8321 Keymile boards */ -#include "km8321-common.h" +#include "km/km8321-common.h"
#define CONFIG_SYS_APP1_BASE 0xA0000000 /* PAXG */ #define CONFIG_SYS_APP1_SIZE 256 /* Megabytes */ diff --git a/include/configs/tuxa1.h b/include/configs/tuxa1.h index 012db96..ceeb5a3 100644 --- a/include/configs/tuxa1.h +++ b/include/configs/tuxa1.h @@ -33,7 +33,7 @@ #define CONFIG_SYS_TEXT_BASE 0xF0000000
/* include common defines/options for all 8321 Keymile boards */ -#include "km8321-common.h" +#include "km/km8321-common.h"
#define CONFIG_SYS_LPXF_BASE 0xA0000000 /* LPXF */ #define CONFIG_SYS_LPXF_SIZE 256 /* Megabytes */

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 */

From: Holger Brunck holger.brunck@keymile.com
The mgcoge2un target was only an intermediate step to mgcoge3un. For this reason the mgcoge2un support was moved to mgcoge3un, because it isn't needed to support both targets.
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: Prafulla Wadaskar prafulla@marvell.com cc: Valentin Longchamp valentin.longchamp@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com --- MAINTAINERS | 2 +- boards.cfg | 2 +- include/configs/{mgcoge2un.h => mgcoge3un.h} | 10 +++++----- 3 files changed, 7 insertions(+), 7 deletions(-) rename include/configs/{mgcoge2un.h => mgcoge3un.h} (92%)
diff --git a/MAINTAINERS b/MAINTAINERS index 37e03c9..7fb778f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -430,7 +430,7 @@ Heiko Schocher hs@denx.de kmsupx5 MPC8321 mgcoge MPC8247 mgcoge3ne MPC8247 - mgcoge2un ARM926EJS (Kirkwood SoC) + mgcoge3un ARM926EJS (Kirkwood SoC) mucmc52 MPC5200 muas3001 MPC8270 municse MPC5200 diff --git a/boards.cfg b/boards.cfg index f6105be..6c5400e 100644 --- a/boards.cfg +++ b/boards.cfg @@ -95,7 +95,7 @@ davinci_sffsdr arm arm926ejs sffsdr davinci davinci_sonata arm arm926ejs sonata davinci davinci suen3 arm arm926ejs km_arm keymile kirkwood suen8 arm arm926ejs km_arm keymile kirkwood -mgcoge2un arm arm926ejs km_arm keymile kirkwood +mgcoge3un arm arm926ejs km_arm keymile kirkwood guruplug arm arm926ejs - Marvell kirkwood mv88f6281gtw_ge arm arm926ejs - Marvell kirkwood openrd_base arm arm926ejs - Marvell kirkwood diff --git a/include/configs/mgcoge2un.h b/include/configs/mgcoge3un.h similarity index 92% rename from include/configs/mgcoge2un.h rename to include/configs/mgcoge3un.h index 6256035..da5935b 100644 --- a/include/configs/mgcoge2un.h +++ b/include/configs/mgcoge3un.h @@ -31,8 +31,8 @@ /* for linking errors see * http://lists.denx.de/pipermail/u-boot/2009-July/057350.html */
-#ifndef _CONFIG_MGCOGE2UN_H -#define _CONFIG_MGCOGE2UN_H +#ifndef _CONFIG_MGCOGE3UN_H +#define _CONFIG_MGCOGE3UN_H
/* include common defines/options for all arm based Keymile boards */ #include "km/km_arm.h" @@ -40,9 +40,9 @@ /* * Version number information */ -#define CONFIG_IDENT_STRING "\nKeymile MGCOGE2UN" - -#define CONFIG_HOSTNAME mgcoge2un +#define CONFIG_IDENT_STRING "\nKeymile MGCOGE3UN" +#define CONFIG_HOSTNAME mgcoge3un +#define CONFIG_MGCOGE3UN
#define KM_IVM_BUS "pca9547:70:9" /* I2C2 (Mux-Port 1)*/ #define KM_ENV_BUS "pca9547:70:d" /* I2C2 (Mux-Port 5)*/

From: Holger Brunck holger.brunck@keymile.com
The reason we need this is that we have the gig port on mgcoge3un connected using a back-to-back pair of PHYs. There are no magnetics and because of that the port has to be run with a fixd configuration and auto-negotiation must be disabled. In the default mode the egiga driver uses autoneg to determine port speed - which defaults to 1G (we need 100M full duplex).
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: Prafulla Wadaskar prafulla@marvell.com cc: Valentin Longchamp valentin.longchamp@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com --- drivers/net/mvgbe.h | 2 ++ include/configs/mgcoge3un.h | 25 +++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 0 deletions(-)
diff --git a/drivers/net/mvgbe.h b/drivers/net/mvgbe.h index 3de98d0..d8a5429 100644 --- a/drivers/net/mvgbe.h +++ b/drivers/net/mvgbe.h @@ -84,6 +84,7 @@ MVGBE_TX_BURST_SIZE_16_64BIT)
/* Default port serial control value */ +#ifndef PORT_SERIAL_CONTROL_VALUE #define PORT_SERIAL_CONTROL_VALUE ( \ MVGBE_FORCE_LINK_PASS | \ MVGBE_DIS_AUTO_NEG_FOR_DUPLX | \ @@ -101,6 +102,7 @@ MVGBE_CLR_EXT_LOOPBACK | \ MVGBE_SET_FULL_DUPLEX_MODE | \ MVGBE_DIS_FLOW_CTRL_TX_RX_IN_FULL_DUPLEX) +#endif
/* Tx WRR confoguration macros */ #define PORT_MAX_TRAN_UNIT 0x24 /* MTU register (default) 9KByte */ diff --git a/include/configs/mgcoge3un.h b/include/configs/mgcoge3un.h index da5935b..c7f9056 100644 --- a/include/configs/mgcoge3un.h +++ b/include/configs/mgcoge3un.h @@ -48,6 +48,31 @@ #define KM_ENV_BUS "pca9547:70:d" /* I2C2 (Mux-Port 5)*/
/* + * mgcoge3un has a fixed link to the marvell switch + * with 100MB full duplex and autoneg off, for this + * reason we have to change the default settings + */ +#define PORT_SERIAL_CONTROL_VALUE ( \ + MVGBE_FORCE_LINK_PASS | \ + MVGBE_DIS_AUTO_NEG_FOR_DUPLX | \ + MVGBE_DIS_AUTO_NEG_FOR_FLOW_CTRL | \ + MVGBE_ADV_NO_FLOW_CTRL | \ + MVGBE_FORCE_FC_MODE_NO_PAUSE_DIS_TX | \ + MVGBE_FORCE_BP_MODE_NO_JAM | \ + (1 << 9) /* Reserved bit has to be 1 */ | \ + MVGBE_DO_NOT_FORCE_LINK_FAIL | \ + MVGBE_DIS_AUTO_NEG_SPEED_GMII | \ + MVGBE_DTE_ADV_0 | \ + MVGBE_MIIPHY_MAC_MODE | \ + MVGBE_AUTO_NEG_NO_CHANGE | \ + MVGBE_MAX_RX_PACKET_1552BYTE | \ + MVGBE_CLR_EXT_LOOPBACK | \ + MVGBE_SET_FULL_DUPLEX_MODE | \ + MVGBE_DIS_FLOW_CTRL_TX_RX_IN_FULL_DUPLEX |\ + MVGBE_SET_GMII_SPEED_TO_10_100 |\ + MVGBE_SET_MII_SPEED_TO_100) + +/* * Default environment variables */ #define CONFIG_EXTRA_ENV_SETTINGS \

From: Holger Brunck holger.brunck@keymile.com
Add wait for the GPIO line connected to mgcoge3ne before starting mgcoge3un. A board specific ethernet present function was added, because on this board ethernet is always present. The BOCO FPGA access was enhanced and changed to use register definitions.
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: Prafulla Wadaskar prafulla@marvell.com cc: Valentin Longchamp valentin.longchamp@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com --- board/keymile/km_arm/km_arm.c | 80 +++++++++++++++++++++++++++++++++------- 1 files changed, 66 insertions(+), 14 deletions(-)
diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c index a64cdd8..0b4d75b 100644 --- a/board/keymile/km_arm/km_arm.c +++ b/board/keymile/km_arm/km_arm.c @@ -41,6 +41,16 @@
DECLARE_GLOBAL_DATA_PTR;
+/* + * BOCO FPGA definitions + */ +#define BOCO 0x10 +#define REG_CTRL_H 0x02 +#define MASK_WRL_UNITRUN 0x01 +#define MASK_RBX_PGY_PRESENT 0x40 +#define REG_IRQ_CIRQ2 0x2d +#define MASK_RBI_DEFECT_16 0x01 + /* Multi-Purpose Pins Functionality configuration */ u32 kwmpp_config[] = { MPP0_NF_IO2, @@ -102,43 +112,64 @@ u32 kwmpp_config[] = { 0 };
+#if defined(CONFIG_MGCOGE3UN) +/* + * Wait for startup OK from mgcoge3ne + */ +int startup_allowed(void) +{ + unsigned char buf; + + /* + * Read CIRQ16 bit (bit 0) + */ + if (i2c_read(BOCO, REG_IRQ_CIRQ2, 1, &buf, 1) != 0) + printf("%s: Error reading Boco\n", __func__); + else + if ((buf & MASK_RBI_DEFECT_16) == MASK_RBI_DEFECT_16) + return 1; + return 0; +} + +/* + * mgcoge3un has always ethernet present. Its connected to the 6061 switch + * and provides ICNev and piggy4 connections. + */ +int ethernet_present(void) +{ + return 1; +} +#else int ethernet_present(void) { uchar buf; int ret = 0;
- if (i2c_read(0x10, 2, 1, &buf, 1) != 0) { + if (i2c_read(BOCO, REG_CTRL_H, 1, &buf, 1) != 0) { printf("%s: Error reading Boco\n", __func__); return -1; } - if ((buf & 0x40) == 0x40) + if ((buf & MASK_RBX_PGY_PRESENT) == MASK_RBX_PGY_PRESENT) ret = 1;
return ret; } +#endif
int initialize_unit_leds(void) { /* - * init the unit LEDs - * per default they all are + * Init the unit LEDs per default they all are * ok apart from bootstat - * LED connected through BOCO - * BOCO lies at the address 0x10 - * LEDs are in the block CTRL_H (addr 0x02) - * BOOTSTAT LED is the first 0x01 */ - #define BOCO 0x10 - #define CTRL_H 0x02 - #define APPLEDMASK 0x01 uchar buf;
- if (i2c_read(BOCO, CTRL_H, 1, &buf, 1) != 0) { + if (i2c_read(BOCO, REG_CTRL_H, 1, &buf, 1) != 0) { printf("%s: Error reading Boco\n", __func__); return -1; } - buf |= APPLEDMASK; - if (i2c_write(BOCO, CTRL_H, 1, &buf, 1) != 0) { + buf |= MASK_WRL_UNITRUN; + if (i2c_write(BOCO, REG_CTRL_H, 1, &buf, 1) != 0) { printf("%s: Error writing Boco\n", __func__); return -1; } @@ -156,6 +187,27 @@ int misc_init_r(void) printf("Overwriting MACH_TYPE with %d!!!\n", mach_type); gd->bd->bi_arch_number = mach_type; } +#if defined(CONFIG_MGCOGE3UN) + char *wait_for_ne; + wait_for_ne = getenv("waitforne"); + if (wait_for_ne != NULL) { + if (strcmp(wait_for_ne, "true") == 0) { + int cnt = 0; + puts("NE go: "); + while (startup_allowed() == 0) { + udelay(200000); + cnt++; + if (cnt == 5) + puts("wait\b\b\b\b"); + if (cnt == 10) { + cnt = 0; + puts(" \b\b\b\b"); + } + } + puts("OK\n"); + } + } +#endif
initialize_unit_leds(); set_km_env();

Hello,
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.
We have split the whole series so that it gets easier to apply through the various trees:
1) the i2c patches were sent by Heiko and already applied 2) lib, vsprintf: introduce strict_strtoul and cramfs: make cramfs usable without a NOR flash are (or already have been) resent as standalone patches 3) Holger is going to send a series for km82xx changes 4) Holger is going to send a series with the keymile changes 5) I will send a series with the ARM/marvell changes
I hope this will simplify the review and merging of these patches into mainline.
Best Regards
Valentin
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/{mgcoge => km82xx}/Makefile | 3 +- 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/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/{ => km}/keymile-common.h | 175 +------ include/configs/{ => km}/km-powerpc.h | 12 +- include/configs/{ => km}/km82xx-common.h | 29 +- include/configs/{ => km}/km8321-common.h | 0 include/configs/{ => km}/km83xx-common.h | 0 include/configs/{ => km}/km_arm.h | 25 +- include/configs/kmeter1.h | 2 +- include/configs/kmsupx5.h | 2 +- include/configs/mgcoge.h | 35 ++- include/configs/{mgcoge2ne.h => mgcoge3ne.h} | 57 ++- include/configs/{mgcoge2un.h => mgcoge3un.h} | 37 ++- 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 ++ 45 files changed, 1531 insertions(+), 1499 deletions(-) delete mode 100644 board/keymile/common/keymile_hdlc_enet.c rename board/keymile/{mgcoge => km82xx}/Makefile (94%) 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/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 rename include/configs/{ => km}/keymile-common.h (63%) rename include/configs/{ => km}/km-powerpc.h (91%) rename include/configs/{ => km}/km82xx-common.h (93%) rename include/configs/{ => km}/km8321-common.h (100%) rename include/configs/{ => km}/km83xx-common.h (100%) rename include/configs/{ => km}/km_arm.h (93%) rename include/configs/{mgcoge2ne.h => mgcoge3ne.h} (57%) rename include/configs/{mgcoge2un.h => mgcoge3un.h} (65%)
participants (4)
-
Heiko Schocher
-
Holger Brunck
-
Valentin Longchamp
-
Wolfgang Denk