updates for Keymile ARM boards
v4 cover updates for Keymile ARM boards
This patch series updates keymile boards with Kirkwood CPU and adds two new boards. This new boards are kmnusa and kmcoge5un. Also the existing boards with own config files were migrated to the common header km_kirkwood.h. Some small adaption in generic kirkwood code was needed due to two new features on the new board. First one is that the u-boot environment is in the SPI NOR flash and the second one is the direct MAC/MAC connection from the mvgbe interface to an simple switch.
Changes for v2:
- removed the two patches "spi/kirkwood: add weak functions board_spi_bus_claim/release" and "mvgbe: remove warning for unused methods" from the series as they are were independent from it. The series is however dependent of these two patches.
Changes for v3:
- updated some RAM timings for the knusa and kmcoge4 boards
Changes for v4:
- based on the new kirkwood spi_claim_bus implemenatation
- merged with the second series of updates for the keymile arm board posted by Holger Brunck: "further updates for Keymile ARM boards'
- addition of the patch 'use filesize for erase in update command'
Holger Brunck (13):
arm/km: add board type to boards.cfg
arm/km: add piggy mac adress offset for mgcoge3un arm/km: rename CONFIG option CONFIG_KM_DEF_ENV_UPDATE arm/km: use ARRAY_SIZE macro
arm/km: fix wrong comment in SDRAM config for mgcoge3un arm/km: change maintainer for mgcoge3un arm/km: remove CONFIG_RESET_PHY_R
arm/km: add kmnusa board support
arm/km: add kmcoge5un board support
arm/km: convert mgcoge3un target to km_kirkwood arm/km: remove portl2.h and use km_kirkwood instead arm/km: cleanup km_kirkwood boards
km/arm: remove spi toggle command
Thomas Herzmann (2):
arm/km: add implementation for read_dip_switch
arm/km: fix testpin detection for kmcoge5un
Valentin Longchamp (12):
arm/km: enable mii cmd
arm/km: use correct kw_gpio function for NAND/SPI switching arm/kirkwood: protect the ENV_SPI #defines
arm/km: correct init of 88e6352 switch in the reset_phy function arm/km: enable BOCO2 FPGA download support
km_arm: redefine piggy 4 reg names to avoid conflicts arm/km: add support for external switch configuration arm/km: enable external switch configuration for kmnusa arm/km: skip FPGA config when already configured arm/km: support the 2 PCIe fpga resets
arm/km: implement weak function board_spi_clam_bus/release
km_arm: use filesize for erase in update command
MAINTAINERS | 4 +- arch/arm/include/asm/arch-kirkwood/config.h | 12 +- board/keymile/common/common.h | 5 + board/keymile/km_arm/128M16-1.cfg | 294 +++++++++++++++++++++++++ board/keymile/km_arm/256M8-1.cfg | 296 +++++++++++++++++++++++++ board/keymile/km_arm/Makefile | 8 + board/keymile/km_arm/fpga_config.c | 256 ++++++++++++++++++++++ board/keymile/km_arm/km_arm.c | 149 +++++++------ board/keymile/km_arm/kwbimage-memphis.cfg | 2 +- board/keymile/km_arm/managed_switch.c | 316 +++++++++++++++++++++++++++ board/keymile/km_arm/managed_switch.h | 106 +++++++++ boards.cfg | 10 +- include/configs/km/km_arm.h | 60 ++++-- include/configs/km_kirkwood.h | 154 ++++++++++++- include/configs/mgcoge3un.h | 86 -------- include/configs/portl2.h | 85 ------- 16 files changed, 1566 insertions(+), 277 deletions(-) create mode 100644 board/keymile/km_arm/128M16-1.cfg create mode 100644 board/keymile/km_arm/256M8-1.cfg create mode 100644 board/keymile/km_arm/fpga_config.c create mode 100644 board/keymile/km_arm/managed_switch.c create mode 100644 board/keymile/km_arm/managed_switch.h delete mode 100644 include/configs/mgcoge3un.h delete mode 100644 include/configs/portl2.h
PATCH v4 1/27 arm/km: add board type to boards.cfg
From: Holger Brunck <[email protected]>
Some other kirkwood boards from keymile will follow. They will have some small differences, but we want to use the km_kirkwood.h for all to distinguish them. This patch a preparation for this.
--- boards.cfg | 4 ++-- include/configs/km_kirkwood.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-)
boards.cfg +2 -2
@@ -137,8 +137,8 @@ hawkboard_uart arm arm926ejs da8xxevm davinci enbw_cmc arm arm926ejs enbw_cmc enbw davinci calimain arm arm926ejs calimain omicron davinci dns325 arm arm926ejs - d-link kirkwood -km_kirkwood arm arm926ejs km_arm keymile kirkwood km_kirkwood:KM_DISABLE_PCI -km_kirkwood_pci arm arm926ejs km_arm keymile kirkwood km_kirkwood:KM_RECONFIG_XLX +km_kirkwood arm arm926ejs km_arm keymile kirkwood km_kirkwood:KM_KIRKWOOD,KM_DISABLE_PCI +km_kirkwood_pci arm arm926ejs km_arm keymile kirkwood km_kirkwood:KM_KIRKWOOD_PCI,KM_RECONFIG_XLX mgcoge3un arm arm926ejs km_arm keymile kirkwood portl2 arm arm926ejs km_arm keymile kirkwood inetspace_v2 arm arm926ejs netspace_v2 LaCie kirkwood lacie_kw:INETSPACE_V2
include/configs/km_kirkwood.h +2 -2
@@ -42,10 +42,10 @@/* * Version number information */ -#ifdef CONFIG_KM_DISABLE_PCI +#if defined(CONFIG_KM_KIRKWOOD )#define CONFIG_IDENT_STRING "\nKeymile Kirkwood"#undef CONFIG_KIRKWOOD_PCIE_INIT -#else +#elif defined(CONFIG_KM_KIRKWOOD_PCI )#define CONFIG_IDENT_STRING "\nKeymile Kirkwood PCI"#endif
Signature · 1 line
1.7.1
PATCH v4 2/27 arm/km: add piggy mac adress offset for mgcoge3un
In reply to Valentin LongchampFrom: Holger Brunck <[email protected]>
On mgcoge3un the piggy mac adress is at offset 3.
--- include/configs/mgcoge3un.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
include/configs/mgcoge3un.h +1 -0
@@ -77,6 +77,7 @@ MVGBE_SET_MII_SPEED_TO_100)#define CONFIG_KM_BOARD_EXTRA_ENV "waitforne=true\0" +#define CONFIG_PIGGY_MAC_ADRESS_OFFSET 3/* * PCIe port not used on mgcoge3un
Signature · 1 line
1.7.1
PATCH v4 3/27 arm/km: rename CONFIG option CONFIG_KM_DEF_ENV_UPDATE
In reply to Valentin LongchampFrom: Holger Brunck <[email protected]>
This config option sounds like the it is responsible for the update of the environment, but it is the u-boot update handling. Therefore we adapt it to a more apropriate naming.
--- include/configs/km/km_arm.h | 4 ++-- 1 files changed, 2 insertions(+), 2 deletions(-)
include/configs/km/km_arm.h +2 -2
@@ -81,7 +81,7 @@"boot=bootm ${load_addr_r} - -\0" \"cramfsloadfdt=true\0" \ "u-boot="xstr(CONFIG_HOSTNAME) "/u-boot.kwb\0" \ -CONFIG_KM_DEF_ENV_UPDATE \ +CONFIG_KM_UPDATE_UBOOT \"" #define CONFIG_SKIP_LOWLEVEL_INIT /* disable board lowlevel_init */
@@ -235,7 +235,7 @@ int get_scl(void);"orion_nand:" \"-(" CONFIG_KM_UBI_PARTITION_NAME ")" -#define CONFIG_KM_DEF_ENV_UPDATE \ +#define CONFIG_KM_UPDATE_UBOOT \"update=" \"spi on;sf probe 0;sf erase 0 50000;" \"sf write ${load_addr_r} 0 ${filesize};" \
Signature · 1 line
1.7.1
PATCH v4 4/27 arm/km: use ARRAY_SIZE macro
In reply to Valentin LongchampFrom: Holger Brunck <[email protected]>
--- board/keymile/km_arm/km_arm.c | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
board/keymile/km_arm/km_arm.c +1 -1
@@ -410,7 +410,7 @@ const ulong patterns[] = { 0x00000000,0xFF00FF00 ,0x0F0F0F0F , 0xF0F0F0F0}; -const ulong NBR_OF_PATTERNS =sizeof (patterns)/sizeof (*patterns); +const ulong NBR_OF_PATTERNS =ARRAY_SIZE (patterns);const ulong OFFS_PATTERN =3 ;const ulong REPEAT_PATTERN =1000 ;
Signature · 1 line
1.7.1
PATCH v4 5/27 arm/km: fix wrong comment in SDRAM config for mgcoge3un
In reply to Valentin LongchampFrom: Holger Brunck <[email protected]>
--- board/keymile/km_arm/kwbimage-memphis.cfg | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
board/keymile/km_arm/kwbimage-memphis.cfg +1 -1
@@ -149,7 +149,7 @@ DATA 0xFFD01424 0x0000F17F # DDR Controller Control High 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 +# bit11-8 : 0101, 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
Signature · 1 line
1.7.1
PATCH v4 6/27 arm/km: change maintainer for mgcoge3un
In reply to Valentin LongchampFrom: Holger Brunck <[email protected]>
--- MAINTAINERS | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
MAINTAINERS +1 -1
@@ -738,6 +738,7 @@ Sergey Lapin <[email protected]> Valentin Longchamp <[email protected]> km_kirkwood ARM926EJS (Kirkwood SoC) + mgcoge3un ARM926EJS (Kirkwood SoC) portl2 ARM926EJS (Kirkwood SoC) Nishanth Menon <[email protected]>
@@ -834,7 +835,6 @@ Heiko Schocher <[email protected]> enbw_cmc ARM926EJS (AM1808 SoC) magnesium i.MX27 - mgcoge3un ARM926EJS (Kirkwood SoC) Michael Schwingen <[email protected]>
Signature · 1 line
1.7.1
PATCH v4 6/27 arm/km: change maintainer for mgcoge3un
Hello Valentin,
Quoted 10 lines · Valentin Longchamp
From: Holger Brunck <[email protected]>
Signed-off-by Holger Brunck <[email protected]>Signed-off-by Valentin Longchamp <[email protected]>cc Heiko Schocher <[email protected]>cc Prafulla Wadaskar <[email protected]>cc Gerlando Falauto <[email protected]>--- MAINTAINERS | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
bye,
Heiko
Signature · 3 lines
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
PATCH v4 7/27 arm/km: remove CONFIG_RESET_PHY_R
In reply to Valentin LongchampFrom: Holger Brunck <[email protected]>
This is already defined in the generic kirkwood header.
--- include/configs/km/km_arm.h | 1 - 1 files changed, 0 insertions(+), 1 deletions(-)
include/configs/km/km_arm.h +0 -1
@@ -164,7 +164,6 @@#define CONFIG_MVGBE_PORTS {1, 0}/* enable port 0 only */ #define CONFIG_PHY_BASE_ADR 0#define CONFIG_ENV_OVERWRITE /* ethaddr can be reprogrammed */ -#define CONFIG_RESET_PHY_R /* use reset_phy() to init 88E1118 PHY */ /* * UBI related stuff
Signature · 1 line
1.7.1
PATCH v4 8/27 arm/km: enable mii cmd
In reply to Valentin LongchampThis is useful to debug the switch initialization
--- include/configs/km/km_arm.h | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
include/configs/km/km_arm.h +1 -0
@@ -159,6 +159,7 @@*/ #define CONFIG_NETCONSOLE /* include NetConsole support */ #define CONFIG_MII /* expose smi ove miiphy interface */ +#define CONFIG_CMD_MII /* to debug mdio phy config */ #define CONFIG_MVGBE /* Enable Marvell Gbe Controller Driver */ #define CONFIG_SYS_FAULT_ECHO_LINK_DOWN /* detect link using phy */ #define CONFIG_MVGBE_PORTS {1, 0}/* enable port 0 only */
Signature · 1 line
1.7.1
PATCH v4 9/27 arm/km: use correct kw_gpio function for NAND/SPI switching
In reply to Valentin LongchampThis used to be done with registers direct access, which is not clear and optimal.
--- board/keymile/km_arm/km_arm.c | 55 +++++++++++++++++++++-------------------- include/configs/km/km_arm.h | 2 +- 2 files changed, 29 insertions(+), 28 deletions(-)
board/keymile/km_arm/km_arm.c +28 -27
@@ -242,20 +242,15 @@ int misc_init_r(void)int board_early_init_f (void ) { -u32 tmp; -kirkwood_mpp_conf (kwmpp_config);/* -* The FLASH_GPIO_PIN switches between using a +* The KM_FLASH_GPIO_PIN switches between using a * NAND or a SPI FLASH. Set this pin on start * to NAND mode. */ - tmp =readl (KW_GPIO0_BASE ); -writel (tmp |FLASH_GPIO_PIN ,KW_GPIO0_BASE ); - tmp =readl (KW_GPIO0_BASE +4 ); -writel (tmp & (~FLASH_GPIO_PIN ) ,KW_GPIO0_BASE +4 ); - +kw_gpio_set_valid (KM_FLASH_GPIO_PIN ,1 ); +kw_gpio_direction_output (KM_FLASH_GPIO_PIN ,1 );#if defined(CONFIG_SOFT_I2C )/* init the GPIO for I2C Bitbang driver */ kw_gpio_set_valid (KM_KIRKWOOD_SDA_PIN ,1 );
@@ -284,35 +279,41 @@ int board_init(void)return 0 ; } +int km_hw_spi_bus_claim (int on) +{ +int gpio_value = !on; + +if (on) { + kwmpp_config[0 ] = MPP0_SPI_SCn; + kwmpp_config[1 ] =MPP1_SPI_MOSI ; + kwmpp_config[2 ] =MPP2_SPI_SCK ; + kwmpp_config[3 ] =MPP3_SPI_MISO ; + }else { + kwmpp_config[0 ] =MPP0_NF_IO2 ; + kwmpp_config[1 ] =MPP1_NF_IO3 ; + kwmpp_config[2 ] =MPP2_NF_IO4 ; + kwmpp_config[3 ] =MPP3_NF_IO5 ; + } + +/* Multi-Purpose Pins Functionality configuration */ +kirkwood_mpp_conf (kwmpp_config); +kw_gpio_set_value (KM_FLASH_GPIO_PIN , gpio_value); + +return 0 ; +} +#if defined(CONFIG_CMD_SF )int do_spi_toggle (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) { -u32 tmp;if (argc <2 )return cmd_usage (cmdtp);if ((strcmp (argv[1 ],"off" ) ==0 )) {printf ("SPI FLASH disabled, NAND enabled\n" ); -/* Multi-Purpose Pins Functionality configuration */ - kwmpp_config[0 ] =MPP0_NF_IO2 ; - kwmpp_config[1 ] =MPP1_NF_IO3 ; - kwmpp_config[2 ] =MPP2_NF_IO4 ; - kwmpp_config[3 ] =MPP3_NF_IO5 ; - -kirkwood_mpp_conf (kwmpp_config); - tmp =readl (KW_GPIO0_BASE ); -writel (tmp |FLASH_GPIO_PIN ,KW_GPIO0_BASE ); +km_hw_spi_bus_claim (0 ); }else if ((strcmp (argv[1 ],"on" ) ==0 )) {printf ("SPI FLASH enabled, NAND disabled\n" ); -/* Multi-Purpose Pins Functionality configuration */ - kwmpp_config[0 ] = MPP0_SPI_SCn; - kwmpp_config[1 ] =MPP1_SPI_MOSI ; - kwmpp_config[2 ] =MPP2_SPI_SCK ; - kwmpp_config[3 ] =MPP3_SPI_MISO ; - -kirkwood_mpp_conf (kwmpp_config); - tmp =readl (KW_GPIO0_BASE ); -writel (tmp & (~FLASH_GPIO_PIN ) ,KW_GPIO0_BASE ); +km_hw_spi_bus_claim (1 ); }else {return cmd_usage (cmdtp); }
include/configs/km/km_arm.h +1 -1
@@ -227,7 +227,7 @@ int get_scl(void);#define CONFIG_SPI_FLASH #define CONFIG_SPI_FLASH_STMICRO -#define FLASH_GPIO_PIN 0x00010000 +#define KM_FLASH_GPIO_PIN 16#define MTDIDS_DEFAULT "nand0=orion_nand"/* test-only: partitioning needs some tuning, this is just for tests */
Signature · 1 line
1.7.1
PATCH v4 10/27 arm/kirkwood: protect the ENV_SPI #defines
In reply to Valentin LongchampSo that they can be redefined by some boards specific values.
--- arch/arm/include/asm/arch-kirkwood/config.h | 12 +++++++++--- 1 files changed, 9 insertions(+), 3 deletions(-)
arch/arm/include/asm/arch-kirkwood/config.h +9 -3
@@ -82,9 +82,15 @@#ifdef CONFIG_CMD_SF #define CONFIG_HARD_SPI 1#define CONFIG_KIRKWOOD_SPI 1 -#define CONFIG_ENV_SPI_BUS 0 -#define CONFIG_ENV_SPI_CS 0 -#define CONFIG_ENV_SPI_MAX_HZ 50000000/*50Mhz */ +#ifndef CONFIG_ENV_SPI_BUS +# define CONFIG_ENV_SPI_BUS 0 +#endif +#ifndef CONFIG_ENV_SPI_CS +# define CONFIG_ENV_SPI_CS 0 +#endif +#ifndef CONFIG_ENV_SPI_MAX_HZ +# define CONFIG_ENV_SPI_MAX_HZ 50000000 +#endif #endif /*
Signature · 1 line
1.7.1
PATCH v4 11/27 arm/km: add kmnusa board support
In reply to Valentin LongchampFrom: Holger Brunck <[email protected]>
This board is similar to portl2, but it has the u-boot environment in a SPI NOR flash and not in an i2c eeprom like portl2 have.
Some other details:
- IVM EEPROM is at adress: pca9547:70:9
- PCI is enabled
- PIGGY4 is connected via MV88E6352 simple switch. There is no phy between the simple switch and the kirkwood.
--- MAINTAINERS | 1 + board/keymile/km_arm/128M16-1.cfg | 294 +++++++++++++++++++++++++++++++++++++ board/keymile/km_arm/km_arm.c | 9 +- boards.cfg | 1 + include/configs/km/km_arm.h | 44 +++++- include/configs/km_kirkwood.h | 67 +++++++-- 6 files changed, 392 insertions(+), 24 deletions(-) create mode 100644 board/keymile/km_arm/128M16-1.cfg
MAINTAINERS +1 -0
@@ -738,6 +738,7 @@ Sergey Lapin <[email protected]> Valentin Longchamp <[email protected]> km_kirkwood ARM926EJS (Kirkwood SoC) + kmnusa ARM926EJS (Kirkwood SoC) mgcoge3un ARM926EJS (Kirkwood SoC) portl2 ARM926EJS (Kirkwood SoC)
board/keymile/km_arm/128M16-1.cfg new file +294 -0
294 lines not on this page · raw message
board/keymile/km_arm/km_arm.c +5 -4
@@ -133,10 +133,11 @@ int startup_allowed(void) }#endif -#if (defined(CONFIG_MGCOGE3UN )|defined(CONFIG_PORTL2 )) +#if (defined(CONFIG_MGCOGE3UN )|defined(CONFIG_PORTL2 )| \ + defined(CONFIG_KM_PIGGY4_88E6352 ))/* -* These two boards have always ethernet present. Its connected to the mv -* switch. +* All boards with PIGGY4 connected via a simple switch have ethernet always +* present. */ int ethernet_present (void ) {
@@ -382,7 +383,7 @@ void reset_phy(void)/* reset the phy */ miiphy_reset(name, CONFIG_PHY_BASE_ADR); } -#else +#elif !defined(CONFIG_KM_PIGGY4_88E6352)/* Configure and enable MV88E1118 PHY on the piggy*/ void reset_phy (void ) {
boards.cfg +1 -0
@@ -139,6 +139,7 @@ calimain arm arm926ejs calimain omicron dns325 arm arm926ejs - d-link kirkwood km_kirkwood arm arm926ejs km_arm keymile kirkwood km_kirkwood:KM_KIRKWOOD,KM_DISABLE_PCI km_kirkwood_pci arm arm926ejs km_arm keymile kirkwood km_kirkwood:KM_KIRKWOOD_PCI,KM_RECONFIG_XLX +kmnusa arm arm926ejs km_arm keymile kirkwood km_kirkwood:KM_NUSA mgcoge3un arm arm926ejs km_arm keymile kirkwood portl2 arm arm926ejs km_arm keymile kirkwood inetspace_v2 arm arm926ejs netspace_v2 LaCie kirkwood lacie_kw:INETSPACE_V2
include/configs/km/km_arm.h +35 -9
75 lines not on this page · raw message
include/configs/km_kirkwood.h +56 -11
87 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v4 12/27 arm/km: add kmcoge5un board support
In reply to Valentin LongchampFrom: Holger Brunck <[email protected]>
For u-boot this board is similar to mgcoge3un. But some differences are present. We have a different SDRAM on it and therefore a new SDRAM config file. Additionaly this board has a direct MAC/MAC connection from the kirkwood to a marvell simple switch without a phy inbetween, this needs a new configuration for the mvgbe driver.
--- MAINTAINERS | 1 + board/keymile/km_arm/256M8-1.cfg | 296 ++++++++++++++++++++++++++++++++++++++ boards.cfg | 1 + include/configs/km_kirkwood.h | 16 ++- 4 files changed, 312 insertions(+), 2 deletions(-) create mode 100644 board/keymile/km_arm/256M8-1.cfg
MAINTAINERS +1 -0
@@ -740,6 +740,7 @@ Valentin Longchamp <[email protected]> km_kirkwood ARM926EJS (Kirkwood SoC) kmnusa ARM926EJS (Kirkwood SoC) mgcoge3un ARM926EJS (Kirkwood SoC) + kmcoge5un ARM926EJS (Kirkwood SoC) portl2 ARM926EJS (Kirkwood SoC) Nishanth Menon <[email protected]>
board/keymile/km_arm/256M8-1.cfg new file +296 -0
296 lines not on this page · raw message
boards.cfg +1 -0
@@ -141,6 +141,7 @@ km_kirkwood arm arm926ejs km_arm keymile km_kirkwood_pci arm arm926ejs km_arm keymile kirkwood km_kirkwood:KM_KIRKWOOD_PCI,KM_RECONFIG_XLX kmnusa arm arm926ejs km_arm keymile kirkwood km_kirkwood:KM_NUSA mgcoge3un arm arm926ejs km_arm keymile kirkwood +kmcoge5un arm arm926ejs km_arm keymile kirkwood km_kirkwood:KMCOGE5UN portl2 arm arm926ejs km_arm keymile kirkwood inetspace_v2 arm arm926ejs netspace_v2 LaCie kirkwood lacie_kw:INETSPACE_V2 net2big_v2 arm arm926ejs net2big_v2 LaCie kirkwood lacie_kw:NET2BIG_V2
include/configs/km_kirkwood.h +14 -2
@@ -39,15 +39,18 @@#if defined(CONFIG_KM_KIRKWOOD )#define CONFIG_IDENT_STRING "\nKeymile Kirkwood" +#define CONFIG_HOSTNAME km_kirkwood#undef CONFIG_KIRKWOOD_PCIE_INIT#define KM_IVM_BUS "pca9544a:70:9"/* I2C2 (Mux-Port 1)*/ #elif defined(CONFIG_KM_KIRKWOOD_PCI )#define CONFIG_IDENT_STRING "\nKeymile Kirkwood PCI" +#define CONFIG_HOSTNAME km_kirkwood_pci#define KM_IVM_BUS "pca9544a:70:9"/* I2C2 (Mux-Port 1)*/ /* KM_NUSA */ #elif defined(CONFIG_KM_NUSA )#define KM_IVM_BUS "pca9547:70:9"/* I2C2 (Mux-Port 1)*/ #define CONFIG_IDENT_STRING "\nKeymile NUSA" +#define CONFIG_HOSTNAME kmnusa#undef CONFIG_SYS_KWD_CONFIG#define CONFIG_SYS_KWD_CONFIG \ $(SRCTREE)/$(CONFIG_BOARDDIR)/128M16-1.cfg
@@ -55,6 +58,17 @@#define CONFIG_KM_FPGA_CONFIG #define CONFIG_KM_PIGGY4_88E6352 +#elif defined(CONFIG_KMCOGE5UN ) +#define CONFIG_IDENT_STRING "\nKeymile COGE5UN" +#define KM_IVM_BUS "pca9547:70:9"/* I2C2 (Mux-Port 1)*/ +#undef CONFIG_SYS_KWD_CONFIG +#define CONFIG_SYS_KWD_CONFIG \ + $(SRCTREE)/$(CONFIG_BOARDDIR)/256M8-1.cfg +#define CONFIG_KM_ENV_IS_IN_SPI_NOR +#define CONFIG_PIGGY_MAC_ADRESS_OFFSET 3 +#define CONFIG_HOSTNAME kmcoge5un +#define CONFIG_KM_DISABLE_PCIE +#define CONFIG_KM_PIGGY4_88E6352 #else #error ("Board unsupported")#endif
@@ -62,8 +76,6 @@/* include common defines/options for all arm based Keymile boards */ #include "km/km_arm.h" -#define CONFIG_HOSTNAME km_kirkwood -#ifndef CONFIG_KM_ENV_IS_IN_SPI_NOR #define KM_ENV_BUS "pca9544a:70:d"/* I2C2 (Mux-Port 5)*/ #endif
Signature · 1 line
1.7.1
PATCH v4 13/27 arm/km: convert mgcoge3un target to km_kirkwood
In reply to Valentin LongchampFrom: Holger Brunck <[email protected]>
Use the generic header km_kirkwood.h and get rid of the board specific header.
--- board/keymile/km_arm/km_arm.c | 9 ++-- boards.cfg | 2 +- include/configs/km_kirkwood.h | 46 +++++++++++++++++++++ include/configs/mgcoge3un.h | 87 ----------------------------------------- 4 files changed, 51 insertions(+), 93 deletions(-) delete mode 100644 include/configs/mgcoge3un.h
board/keymile/km_arm/km_arm.c +4 -5
@@ -113,7 +113,7 @@ u32 kwmpp_config[] = { 0 }; -#if defined(CONFIG_MGCOGE3UN ) +#if defined(CONFIG_KM_MGCOGE3UN )/* * Wait for startup OK from mgcoge3ne */
@@ -133,8 +133,7 @@ int startup_allowed(void) }#endif -#if (defined(CONFIG_MGCOGE3UN )|defined(CONFIG_PORTL2 )| \ - defined(CONFIG_KM_PIGGY4_88E6352 )) +#if (defined(CONFIG_KM_PIGGY4_88E6061 )|defined(CONFIG_KM_PIGGY4_88E6352 ))/* * All boards with PIGGY4 connected via a simple switch have ethernet always * present.
@@ -202,7 +201,7 @@ 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 ) +#if defined(CONFIG_KM_MGCOGE3UN )char *wait_for_ne; wait_for_ne =getenv ("waitforne" );if (wait_for_ne !=NULL ) {
@@ -349,7 +348,7 @@ void dram_init_banksize(void) } } -#if (defined(CONFIG_MGCOGE3UN )|defined(CONFIG_PORTL2 )) +#if (defined(CONFIG_KM_MGCOGE3UN )|defined(CONFIG_PORTL2 ))#define PHY_LED_SEL 0x18#define PHY_LED0_LINK (0x5)
boards.cfg +1 -1
@@ -140,7 +140,7 @@ dns325 arm arm926ejs - d-link km_kirkwood arm arm926ejs km_arm keymile kirkwood km_kirkwood:KM_KIRKWOOD,KM_DISABLE_PCI km_kirkwood_pci arm arm926ejs km_arm keymile kirkwood km_kirkwood:KM_KIRKWOOD_PCI,KM_RECONFIG_XLX kmnusa arm arm926ejs km_arm keymile kirkwood km_kirkwood:KM_NUSA -mgcoge3un arm arm926ejs km_arm keymile kirkwood +mgcoge3un arm arm926ejs km_arm keymile kirkwood km_kirkwood:KM_MGCOGE3UN kmcoge5un arm arm926ejs km_arm keymile kirkwood km_kirkwood:KMCOGE5UN portl2 arm arm926ejs km_arm keymile kirkwood inetspace_v2 arm arm926ejs netspace_v2 LaCie kirkwood lacie_kw:INETSPACE_V2
include/configs/km_kirkwood.h +46 -0
59 lines not on this page · raw message
include/configs/mgcoge3un.h deleted +0 -87
87 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v4 14/27 arm/km: remove portl2.h and use km_kirkwood instead
In reply to Valentin LongchampFrom: Holger Brunck <[email protected]>
The additional headerfile is unneeded here, we can use the generic km_kirkwood.h instead. And we can use the better config option KM_PIGGY4_88E6061 for the specific features for boards with this design in km_arm.c.
--- board/keymile/km_arm/km_arm.c | 2 +- boards.cfg | 2 +- include/configs/km_kirkwood.h | 8 ++++ include/configs/portl2.h | 85 ----------------------------------------- 4 files changed, 10 insertions(+), 87 deletions(-) delete mode 100644 include/configs/portl2.h
board/keymile/km_arm/km_arm.c +1 -1
@@ -348,7 +348,7 @@ void dram_init_banksize(void) } } -#if (defined(CONFIG_KM_MGCOGE3UN )|defined(CONFIG_PORTL2 )) +#if (defined(CONFIG_KM_PIGGY4_88E6061 ))#define PHY_LED_SEL 0x18#define PHY_LED0_LINK (0x5)
boards.cfg +1 -1
@@ -142,7 +142,7 @@ km_kirkwood_pci arm arm926ejs km_arm keymile kmnusa arm arm926ejs km_arm keymile kirkwood km_kirkwood:KM_NUSA mgcoge3un arm arm926ejs km_arm keymile kirkwood km_kirkwood:KM_MGCOGE3UN kmcoge5un arm arm926ejs km_arm keymile kirkwood km_kirkwood:KMCOGE5UN -portl2 arm arm926ejs km_arm keymile kirkwood +portl2 arm arm926ejs km_arm keymile kirkwood km_kirkwood:KM_PORTL2 inetspace_v2 arm arm926ejs netspace_v2 LaCie kirkwood lacie_kw:INETSPACE_V2 net2big_v2 arm arm926ejs net2big_v2 LaCie kirkwood lacie_kw:NET2BIG_V2 netspace_max_v2 arm arm926ejs netspace_v2 LaCie kirkwood lacie_kw:NETSPACE_MAX_V2
include/configs/km_kirkwood.h +8 -0
@@ -83,6 +83,14 @@#define CONFIG_HOSTNAME kmcoge5un#define CONFIG_KM_DISABLE_PCIE #define CONFIG_KM_PIGGY4_88E6352 + +/* KM_PORTL2 */ +#elif defined(CONFIG_KM_PORTL2 ) +#define CONFIG_IDENT_STRING "\nKeymile Port-L2" +#define CONFIG_HOSTNAME portl2 +#define KM_IVM_BUS "pca9544a:70:9"/* I2C2 (Mux-Port 1)*/ +#define CONFIG_KM_PIGGY4_88E6061 +#else #error ("Board unsupported")#endif
include/configs/portl2.h deleted +0 -85
85 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v4 15/27 arm/km: correct init of 88e6352 switch in the reset_phy function
In reply to Valentin LongchampThis is achieved thanks to the support read/write regs for the external 88e6352 switch. The functions for this are added into an own file managed_switch.c. This is compiled if the define CONFIG_KM_MANAGED_SW_ADDR was set in the board setup. This define specifies the phy address.
--- board/keymile/common/common.h | 6 + board/keymile/km_arm/Makefile | 4 + board/keymile/km_arm/km_arm.c | 26 +++++- board/keymile/km_arm/managed_switch.c | 166 +++++++++++++++++++++++++++++++++ include/configs/km_kirkwood.h | 13 +++ 5 files changed, 214 insertions(+), 1 deletions(-) create mode 100644 board/keymile/km_arm/managed_switch.c
board/keymile/common/common.h +6 -0
@@ -125,6 +125,12 @@ struct bfticu_iomap {int ethernet_present (void );int ivm_read_eeprom (void ); + +int ext_switch_reg_write (const char *devname,u8 phy_addr,u8 port, +u8 reg,u16 data); +int ext_switch_reg_read (const char *devname,u8 phy_addr,u8 port, +u8 reg,u16 *data); +int set_km_env (void ); int fdt_set_node_and_value(void *blob, char *nodename,
board/keymile/km_arm/Makefile +4 -0
@@ -31,6 +31,10 @@ LIB = $(obj)lib$(BOARD).o COBJS := $(BOARD).o ../common/common.o ../common/ivm.o +ifdef CONFIG_KM_MANAGED_SW_ADDR +COBJS += managed_switch.o +endif + SRCS := $(SOBJS:.o=.S) $(COBJS:.o=.c) OBJS := $(addprefix $(obj),$(COBJS)) SOBJS := $(addprefix $(obj),$(SOBJS))
board/keymile/km_arm/km_arm.c +25 -1
@@ -9,6 +9,9 @@* (C) Copyright 2010 * Heiko Schocher, DENX Software Engineering, hs at denx.de. * +* (C) Copyright 2011, 2012 +* Valentin Lontgchamp, Keymile AG, valentin.longchamp at keymile.com +* * See file CREDITS for list of people who contributed to this * project. *
@@ -35,6 +38,7 @@#include <miiphy.h> #include <asm/io.h> #include <asm/arch/cpu.h> +#include <asm/errno.h> #include <asm/arch/kirkwood.h> #include <asm/arch/mpp.h>
@@ -382,7 +386,27 @@ void reset_phy(void)/* reset the phy */ miiphy_reset(name, CONFIG_PHY_BASE_ADR); } -#elif !defined(CONFIG_KM_PIGGY4_88E6352) +#elif defined(CONFIG_KM_PIGGY4_88E6352) + +#if defined(CONFIG_KM_MANAGED_SW_ADDR ) +void reset_phy (void ) +{ +char *name ="egiga0" ; + +if (miiphy_set_current_dev (name)) +return ; + +/* enable autoneg on port 0 phy */ +ext_switch_reg_write (name,CONFIG_KM_MANAGED_SW_ADDR ,0 ,0 ,0x3300 ); + +/* egress broadcast franes on all macs, with forwarding */ +ext_switch_reg_write (name,CONFIG_KM_MANAGED_SW_ADDR ,16 ,4 ,0x000f ); +ext_switch_reg_write (name,CONFIG_KM_MANAGED_SW_ADDR ,20 ,4 ,0x000f ); +ext_switch_reg_write (name,CONFIG_KM_MANAGED_SW_ADDR ,21 ,4 ,0x000f ); +} +#endif + +#else /* Configure and enable MV88E1118 PHY on the piggy*/ void reset_phy (void ) {
board/keymile/km_arm/managed_switch.c new file +166 -0
166 lines not on this page · raw message
include/configs/km_kirkwood.h +13 -0
@@ -58,6 +58,7 @@#define CONFIG_KM_FPGA_CONFIG #define CONFIG_KM_PIGGY4_88E6352 +#define CONFIG_KM_MANAGED_SW_ADDR 0x10/* KM_MGCOGE3UN */ #elif defined(CONFIG_KM_MGCOGE3UN )#define CONFIG_IDENT_STRING "\nKeymile COGE3UN"
@@ -131,6 +132,18 @@ MVGBE_SET_GMII_SPEED_TO_1000 |\ MVGBE_SET_MII_SPEED_TO_100) +/* +* There is no phy on the eth interface, but an external switch +* For kmcoge5un it is completely unmanaged, so we disable an access to it +* For km_nusa, we an MDIO(MII) interface that can configure the switch trough +* an indirect access, so we do not disable the MII +*/ +#ifndef CONFIG_KM_MANAGED_SW_ADDR +#undef CONFIG_MII +#undef CONFIG_CMD_MII +#undef CONFIG_RESET_PHY_R +#endif +#endif #ifdef CONFIG_KM_PIGGY4_88E6061
Signature · 1 line
1.7.1
PATCH v4 16/27 arm/km: enable BOCO2 FPGA download support
In reply to Valentin LongchampThis adds a first support of the FPGA download for a PCIe FPGA based on the BOCO2 CPLD.
This takes place in 3 steps, all done accessing the SPICTRL reg of the BOCO2:
1) start the FPGA config with an access to the FPGA_PROG bit
2) later in the boot sequence, wait for the FPGA_DONE bit to toggle to 1 for the end of the FPGA configuration (with a timeout)
3) reset the FPGA
4) finally remove the access to its config EEPROM from the FPGA so that the CPU can update the FPGA configuration when the kernel is running
The boards with a PCIe FPGA but without BOCO2 still are supported.
The config option name is CONFIG_KM_FPGA_CONFIG
--- board/keymile/common/common.h | 6 + board/keymile/km_arm/Makefile | 4 + board/keymile/km_arm/fpga_config.c | 212 ++++++++++++++++++++++++++++++++++++ board/keymile/km_arm/km_arm.c | 21 +++- boards.cfg | 2 +- include/configs/km/km_arm.h | 3 + include/configs/km_kirkwood.h | 8 +- 7 files changed, 246 insertions(+), 10 deletions(-) create mode 100644 board/keymile/km_arm/fpga_config.c
board/keymile/common/common.h +6 -0
@@ -131,6 +131,12 @@ int ext_switch_reg_write(const char *devname, u8 phy_addr, u8 port,int ext_switch_reg_read (const char *devname,u8 phy_addr,u8 port,u8 reg,u16 *data); + +int trigger_fpga_config (void ); +int wait_for_fpga_config (void ); +int fpga_reset (void ); +int toggle_eeprom_spi_bus (void ); +int set_km_env (void ); int fdt_set_node_and_value(void *blob, char *nodename,
board/keymile/km_arm/Makefile +4 -0
@@ -31,6 +31,10 @@ LIB = $(obj)lib$(BOARD).o COBJS := $(BOARD).o ../common/common.o ../common/ivm.o +ifdef CONFIG_KM_FPGA_CONFIG +COBJS += fpga_config.o +endif + ifdef CONFIG_KM_MANAGED_SW_ADDR COBJS += managed_switch.o endif
board/keymile/km_arm/fpga_config.c new file +212 -0
212 lines not on this page · raw message
board/keymile/km_arm/km_arm.c +15 -6
@@ -266,12 +266,6 @@ int board_early_init_f(void)kw_gpio_set_valid (KM_KIRKWOOD_ENV_WP ,38 );kw_gpio_direction_output (KM_KIRKWOOD_ENV_WP ,1 );#endif -#if defined(CONFIG_KM_RECONFIG_XLX ) -/* trigger the reconfiguration of the xilinx fpga */ -kw_gpio_set_valid (KM_XLX_PROGRAM_B_PIN ,1 ); -kw_gpio_direction_output (KM_XLX_PROGRAM_B_PIN ,0 ); -kw_gpio_direction_input (KM_XLX_PROGRAM_B_PIN ); -#endif return 0 ; }
@@ -280,6 +274,21 @@ int board_init(void)/* address of boot parameters */ gd->bd->bi_boot_params =kw_sdram_bar (0 ) +0x100 ; +#if defined(CONFIG_KM_FPGA_CONFIG ) +trigger_fpga_config (); +#endif + +return 0 ; +} + +int board_late_init (void ) +{ +#if defined(CONFIG_KM_FPGA_CONFIG ) +wait_for_fpga_config (); +fpga_reset (); +toggle_eeprom_spi_bus (); +#endif +return 0 ; }
boards.cfg +1 -1
@@ -138,7 +138,7 @@ enbw_cmc arm arm926ejs enbw_cmc enbw calimain arm arm926ejs calimain omicron davinci dns325 arm arm926ejs - d-link kirkwood km_kirkwood arm arm926ejs km_arm keymile kirkwood km_kirkwood:KM_KIRKWOOD,KM_DISABLE_PCI -km_kirkwood_pci arm arm926ejs km_arm keymile kirkwood km_kirkwood:KM_KIRKWOOD_PCI,KM_RECONFIG_XLX +km_kirkwood_pci arm arm926ejs km_arm keymile kirkwood km_kirkwood:KM_KIRKWOOD_PCI,KM_FPGA_CONFIG kmnusa arm arm926ejs km_arm keymile kirkwood km_kirkwood:KM_NUSA mgcoge3un arm arm926ejs km_arm keymile kirkwood km_kirkwood:KM_MGCOGE3UN kmcoge5un arm arm926ejs km_arm keymile kirkwood km_kirkwood:KMCOGE5UN
include/configs/km/km_arm.h +3 -0
@@ -307,4 +307,7 @@ int get_scl(void);#define CONFIG_POST_EXTERNAL_WORD_FUNCS #define CONFIG_CMD_DIAG +/* we do the whole PCIe FPGA config stuff here */ +#define BOARD_LATE_INIT +#endif /* _CONFIG_KM_ARM_H */
include/configs/km_kirkwood.h +5 -3
@@ -175,10 +175,12 @@ MVGBE_SET_MII_SPEED_TO_100)#endif -/* GPIO Pin from kirkwood connected to PROGRAM_B pin of the xilinx FPGA */ -#define KM_XLX_PROGRAM_B_PIN 39 -#ifdef CONFIG_KM_DISABLE_PCI #undef CONFIG_KIRKWOOD_PCIE_INIT#endif + +#ifndef CONFIG_KM_FPGA_CONFIG +#undef BOARD_LATE_INIT +#endif +#endif /* _CONFIG_KM_KIRKWOOD */
Signature · 1 line
1.7.1
PATCH v4 17/27 arm/km: cleanup km_kirkwood boards
In reply to Valentin LongchampFrom: Holger Brunck <[email protected]>
Remove config options from boards.cfg and simply add one switch per board and differ afterwards in km_kirkwood.h between the features. More boards are upcoming and therefore it's easier to have this at one place.
--- boards.cfg | 4 ++-- include/configs/km_kirkwood.h | 7 ++++++- 2 files changed, 8 insertions(+), 3 deletions(-)
boards.cfg +2 -2
@@ -137,8 +137,8 @@ hawkboard_uart arm arm926ejs da8xxevm davinci enbw_cmc arm arm926ejs enbw_cmc enbw davinci calimain arm arm926ejs calimain omicron davinci dns325 arm arm926ejs - d-link kirkwood -km_kirkwood arm arm926ejs km_arm keymile kirkwood km_kirkwood:KM_KIRKWOOD,KM_DISABLE_PCI -km_kirkwood_pci arm arm926ejs km_arm keymile kirkwood km_kirkwood:KM_KIRKWOOD_PCI,KM_FPGA_CONFIG +km_kirkwood arm arm926ejs km_arm keymile kirkwood km_kirkwood:KM_KIRKWOOD +km_kirkwood_pci arm arm926ejs km_arm keymile kirkwood km_kirkwood:KM_KIRKWOOD_PCI kmnusa arm arm926ejs km_arm keymile kirkwood km_kirkwood:KM_NUSA mgcoge3un arm arm926ejs km_arm keymile kirkwood km_kirkwood:KM_MGCOGE3UN kmcoge5un arm arm926ejs km_arm keymile kirkwood km_kirkwood:KMCOGE5UN
include/configs/km_kirkwood.h +6 -1
@@ -37,15 +37,20 @@#ifndef _CONFIG_KM_KIRKWOOD_H#define _CONFIG_KM_KIRKWOOD_H +/* KM_KIRKWOOD */ #if defined(CONFIG_KM_KIRKWOOD )#define CONFIG_IDENT_STRING "\nKeymile Kirkwood"#define CONFIG_HOSTNAME km_kirkwood -#undef CONFIG_KIRKWOOD_PCIE_INIT +#define CONFIG_KM_DISABLE_PCIE #define KM_IVM_BUS "pca9544a:70:9"/* I2C2 (Mux-Port 1)*/ + +/* KM_KIRKWOOD_PCI */ #elif defined(CONFIG_KM_KIRKWOOD_PCI )#define CONFIG_IDENT_STRING "\nKeymile Kirkwood PCI"#define CONFIG_HOSTNAME km_kirkwood_pci#define KM_IVM_BUS "pca9544a:70:9"/* I2C2 (Mux-Port 1)*/ +#define CONFIG_KM_FPGA_CONFIG +/* KM_NUSA */ #elif defined(CONFIG_KM_NUSA )#define KM_IVM_BUS "pca9547:70:9"/* I2C2 (Mux-Port 1)*/
Signature · 1 line
1.7.1
PATCH v4 18/27 km_arm: redefine piggy 4 reg names to avoid conflicts
In reply to Valentin LongchampSome very similar #defines for reg addresses are used in a later patch (managed_switch support for km_arm).
--- board/keymile/km_arm/km_arm.c | 22 +++++++++++----------- 1 files changed, 11 insertions(+), 11 deletions(-)
board/keymile/km_arm/km_arm.c +11 -11
@@ -363,13 +363,13 @@ void dram_init_banksize(void)#if (defined(CONFIG_KM_PIGGY4_88E6061 )) -#define PHY_LED_SEL 0x18 -#define PHY_LED0_LINK (0x5) -#define PHY_LED1_ACT (0x8<<4) -#define PHY_LED2_INT (0xe<<8) -#define PHY_SPEC_CTRL 0x1c +#define PHY_LED_SEL_REG 0x18 +#define PHY_LED0_LINK (0x5) +#define PHY_LED1_ACT (0x8<<4) +#define PHY_LED2_INT (0xe<<8) +#define PHY_SPEC_CTRL_REG 0x1c#define PHY_RGMII_CLK_STABLE (0x1<<10) -#define PHY_CLSA (0x1<<1) +#define PHY_CLSA (0x1<<1)/* Configure and enable MV88E3018 PHY */ void reset_phy (void )
@@ -381,15 +381,15 @@ void reset_phy(void)return ;/* RGMII clk transition on data stable */ -if (miiphy_read (name,CONFIG_PHY_BASE_ADR ,PHY_SPEC_CTRL , ®) !=0 ) +if (!miiphy_read (name,CONFIG_PHY_BASE_ADR ,PHY_SPEC_CTRL_REG , ®))printf ("Error reading PHY spec ctrl reg\n" ); -if (miiphy_write (name,CONFIG_PHY_BASE_ADR ,PHY_SPEC_CTRL , - reg |PHY_RGMII_CLK_STABLE |PHY_CLSA ) !=0 ) +if (!miiphy_write (name,CONFIG_PHY_BASE_ADR ,PHY_SPEC_CTRL_REG , + reg |PHY_RGMII_CLK_STABLE |PHY_CLSA ))printf ("Error writing PHY spec ctrl reg\n" );/* leds setup */ -if (miiphy_write (name,CONFIG_PHY_BASE_ADR ,PHY_LED_SEL , -PHY_LED0_LINK |PHY_LED1_ACT |PHY_LED2_INT ) !=0 ) +if (!miiphy_write (name,CONFIG_PHY_BASE_ADR ,PHY_LED_SEL_REG , +PHY_LED0_LINK |PHY_LED1_ACT |PHY_LED2_INT ))printf ("Error writing PHY LED reg\n" );/* reset the phy */
Signature · 1 line
1.7.1
PATCH v4 19/27 arm/km: add support for external switch configuration
In reply to Valentin LongchampThis can be used if we do not want to use an EEPROM for the configuration.
--- board/keymile/common/common.h | 7 -- board/keymile/km_arm/managed_switch.c | 169 +++++++++++++++++++++++++++++++-- board/keymile/km_arm/managed_switch.h | 99 +++++++++++++++++++ 3 files changed, 258 insertions(+), 17 deletions(-) create mode 100644 board/keymile/km_arm/managed_switch.h
board/keymile/common/common.h +0 -7
@@ -125,13 +125,6 @@ struct bfticu_iomap {int ethernet_present (void );int ivm_read_eeprom (void ); - -int ext_switch_reg_write (const char *devname,u8 phy_addr,u8 port, -u8 reg,u16 data); -int ext_switch_reg_read (const char *devname,u8 phy_addr,u8 port, -u8 reg,u16 *data); - -int trigger_fpga_config (void );int wait_for_fpga_config (void );int fpga_reset (void );
board/keymile/km_arm/managed_switch.c +159 -10
194 lines not on this page · raw message
board/keymile/km_arm/managed_switch.h new file +99 -0
99 lines not on this page · raw message
Signature · 1 line
1.7.1
PATCH v4 20/27 arm/km: enable external switch configuration for kmnusa
In reply to Valentin LongchampThe configuration EEPROM should be removed for P1B.
--- board/keymile/km_arm/km_arm.c | 11 +++++------ board/keymile/km_arm/managed_switch.c | 3 ++- board/keymile/km_arm/managed_switch.h | 7 +++++++ 3 files changed, 14 insertions(+), 7 deletions(-)
board/keymile/km_arm/km_arm.c +5 -6
@@ -43,6 +43,7 @@#include <asm/arch/mpp.h> #include "../common/common.h" +#include "managed_switch.h" DECLARE_GLOBAL_DATA_PTR ;
@@ -405,13 +406,11 @@ void reset_phy(void)if (miiphy_set_current_dev (name))return ; -/* enable autoneg on port 0 phy */ -ext_switch_reg_write (name,CONFIG_KM_MANAGED_SW_ADDR ,0 ,0 ,0x3300 ); +#if defined(CONFIG_KM_NUSA ) +ext_switch_program (name,CONFIG_KM_MANAGED_SW_ADDR ); +#endif -/* egress broadcast franes on all macs, with forwarding */ -ext_switch_reg_write (name,CONFIG_KM_MANAGED_SW_ADDR ,16 ,4 ,0x000f ); -ext_switch_reg_write (name,CONFIG_KM_MANAGED_SW_ADDR ,20 ,4 ,0x000f ); - ext_switch_reg_write(name, CONFIG_KM_MANAGED_SW_ADDR, 21, 4, 0x000f); + ext_switch_reset(name, CONFIG_KM_MANAGED_SW_ADDR); }#endif
board/keymile/km_arm/managed_switch.c +2 -1
@@ -32,9 +32,10 @@ struct switch_reg sw_conf[] = {/* port 0, PIGY4, autoneg */ { PORT(0), PORT_PHY, NO_SPEED_FOR }, { PORT(0), PORT_CTRL, FORWARDING | EGRS_FLD_ALL }, + { PHY(0), PHY_1000_CTRL, NO_ADV }, + { PHY(0), PHY_SPEC_CTRL, AUTO_MDIX_EN }, { PHY(0), PHY_CTRL, PHY_100_MBPS | AUTONEG_EN | AUTONEG_RST | FULL_DUPLEX }, - { PHY(0), PHY_SPEC_CTRL, AUTO_MDIX_EN },/* port 1, unused */ { PORT(1), PORT_CTRL, PORT_DIS }, { PHY(1), PHY_CTRL, PHY_PWR_DOWN },
board/keymile/km_arm/managed_switch.h +7 -0
@@ -51,6 +51,7 @@#define PHY_CTRL 0x00#define PHY_100_MBPS 0x2000 +#define PHY_1_GBPS 0x0040#define AUTONEG_EN 0x1000#define AUTONEG_RST 0x0200#define FULL_DUPLEX 0x0100
@@ -62,6 +63,12 @@#define SPEC_PWR_DOWN 0x0004#define AUTO_MDIX_EN 0x0060 +#define PHY_1000_CTRL 0x9 + +#define NO_ADV 0x0000 +#define ADV_1000_FDPX 0x0200 +#define ADV_1000_HDPX 0x0100 +/* PORT or MAC registers */ #define PORT (itf) (itf+0x10)
Signature · 1 line
1.7.1
PATCH v4 21/27 arm/km: skip FPGA config when already configured
In reply to Valentin LongchampIn order to be able to perform board resets without interrupting the traffic, the configuration of an already properly configured FPGA is skipped.
This is because some PCIe FPGAs embed some other function that must continue to work over reset.
It is then the responsibility of the application to trigger a reconfiguration when needed. This is done by lowering the FPGA_INIT_B pin for delaying the configuration to u-boot @ next reboot, and then lower the FPGA_PROGRAM_B signal.
--- board/keymile/km_arm/fpga_config.c | 41 +++++++++++++++++++++++++++++++++++- 1 files changed, 40 insertions(+), 1 deletions(-)
board/keymile/km_arm/fpga_config.c +40 -1
@@ -96,12 +96,43 @@ static int boco_set_bits(u8 reg, u8 flags)#define SPI_REG 0x06#define CFG_EEPROM 0x02#define FPGA_PROG 0x04 +#define FPGA_INIT_B 0x10#define FPGA_DONE 0x20 +static int fpga_done () +{ +int ret =0 ; +u8 regval; + +/* this is only supported with the boco2 design */ +if (!check_boco2 ()) +return 0 ; + + ret =i2c_read (BOCO_ADDR ,SPI_REG ,1 , ®val,1 ); +if (ret) { +printf ("%s: error reading the BOCO @%#x !!\n" , + __func__,SPI_REG ); +return 0 ; + } + +return regval &FPGA_DONE ?1 :0 ; +} + +int skip; +int trigger_fpga_config (void ) {int ret =0 ; +/* if the FPGA is already configured, we do not want to +* reconfigure it */ + skip =0 ; +if (fpga_done ()) { +printf ("PCIe FPGA config: skipped\n" ); + skip =1 ; +return 0 ; + } +if (check_boco2 ()) {/* we have a BOCO2, this has to be triggered here */
@@ -111,7 +142,7 @@ int trigger_fpga_config(void)return ret;/* trigger the config start */ - ret =boco_clear_bits (SPI_REG ,FPGA_PROG ); + ret =boco_clear_bits (SPI_REG ,FPGA_PROG |FPGA_INIT_B );if (ret)return ret;
@@ -123,6 +154,11 @@ int trigger_fpga_config(void)if (ret)return ret; +/* finally, raise INIT_B to remove the config delay */ + ret =boco_set_bits (SPI_REG ,FPGA_INIT_B ); +if (ret) +return ret; + }else {/* we do it the old way, with the gpio pin */ kw_gpio_set_valid (KM_XLX_PROGRAM_B_PIN ,1 );
@@ -141,6 +177,9 @@ int wait_for_fpga_config(void)u8 spictrl;u32 timeout =20000 ; +if (skip) +return 0 ; +if (!check_boco2 ()) {/* we do not have BOCO2, this is not really used */ return 0 ;
Signature · 1 line
1.7.1
PATCH v4 22/27 arm/km: support the 2 PCIe fpga resets
In reply to Valentin LongchampThe PCIe FPGAs now have to support 2 resets: one for the non traffic affecting part (PCIe) and one for the traffic affecting part.
When the FPGA is not reconfigured, we only reset the PCIe part.
--- board/keymile/km_arm/fpga_config.c | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-)
board/keymile/km_arm/fpga_config.c +9 -4
@@ -99,7 +99,7 @@ static int boco_set_bits(u8 reg, u8 flags)#define FPGA_INIT_B 0x10#define FPGA_DONE 0x20 -static int fpga_done () +static int fpga_done (void ) {int ret =0 ;u8 regval;
@@ -206,25 +206,30 @@ int wait_for_fpga_config(void) }#define PRST1 0x4 -#define BRIDGE_RST 0x4 +#define PCIE_RST 0x10 +#define TRAFFIC_RST 0x04int fpga_reset (void ) {int ret =0 ; +u8 resets;if (!check_boco2 ()) {/* we do not have BOCO2, this is not really used */ return 0 ; } - ret =boco_clear_bits (PRST1 ,BRIDGE_RST ); +/* if we have skipped, we only want to reset the PCIe part */ + resets = skip ?PCIE_RST :PCIE_RST |TRAFFIC_RST ; + + ret =boco_clear_bits (PRST1 , resets);if (ret)return ret;/* small delay for the pulse */ udelay (10 ); - ret =boco_set_bits (PRST1 ,BRIDGE_RST ); + ret =boco_set_bits (PRST1 , resets);if (ret)return ret;
Signature · 1 line
1.7.1
PATCH v4 23/27 arm/km: add implementation for read_dip_switch
In reply to Valentin LongchampFrom: Thomas Herzmann <[email protected]>
Add a function to read the dip_switch on kmcoge5un. If the switch is set the actual_bank is set to 0 and this SW is booted.
--- board/keymile/km_arm/km_arm.c | 14 +++++++++++++- include/configs/km_kirkwood.h | 3 --- 2 files changed, 13 insertions(+), 4 deletions(-)
board/keymile/km_arm/km_arm.c +13 -1
@@ -284,12 +284,24 @@ int board_init(void)int board_late_init (void ) { +#if defined(CONFIG_KMCOGE5UN ) +/* I/O pin to erase flash RGPP09 = MPP43 */ +#define KM_FLASH_ERASE_ENABLE 43 +u8 dip_switch =kw_gpio_get_value (KM_FLASH_ERASE_ENABLE ); + +/* if pin 1 do full erase */ +if (dip_switch !=0 ) { +/* start bootloader */ +puts ("DIP: Enabled\n" ); +setenv ("actual_bank" ,"0" ); + } +#endif +#if defined(CONFIG_KM_FPGA_CONFIG )wait_for_fpga_config ();fpga_reset ();toggle_eeprom_spi_bus ();#endif -return 0 ; }
include/configs/km_kirkwood.h +0 -3
@@ -184,8 +184,5 @@#undef CONFIG_KIRKWOOD_PCIE_INIT#endif -#ifndef CONFIG_KM_FPGA_CONFIG -#undef BOARD_LATE_INIT -#endif #endif /* _CONFIG_KM_KIRKWOOD */
Signature · 1 line
1.7.1
PATCH v4 24/27 arm/km: fix testpin detection for kmcoge5un
In reply to Valentin LongchampFrom: Thomas Herzmann <[email protected]>
On kmcoge5un unfortunately the HW wiring is differently to other km arm boards.
--- board/keymile/km_arm/km_arm.c | 4 ++++ 1 files changed, 4 insertions(+), 0 deletions(-)
board/keymile/km_arm/km_arm.c +4 -0
@@ -531,7 +531,11 @@ int get_scl(void)int post_hotkeys_pressed (void ) { +#if defined(CONFIG_KMCOGE5UN ) +return kw_gpio_get_value (KM_POST_EN_L ); +#else return !kw_gpio_get_value (KM_POST_EN_L ); +#endif }ulong post_word_load (void )
Signature · 1 line
1.7.1
PATCH v4 25/27 arm/km: implement weak function board_spi_clam_bus/release
In reply to Valentin LongchampThey are needed on all km_arm boards where we have the environement variables in the NOR Flash. First boards using this feature are kmcoge5un and kmnusa.
--- board/keymile/km_arm/km_arm.c | 26 ++++++++------------------ 1 files changed, 8 insertions(+), 18 deletions(-)
board/keymile/km_arm/km_arm.c +8 -18
@@ -36,6 +36,7 @@#include <nand.h> #include <netdev.h> #include <miiphy.h> +#include <spi.h> #include <asm/io.h> #include <asm/arch/cpu.h> #include <asm/errno.h>
@@ -305,29 +306,18 @@ int board_late_init(void)return 0 ; } -int km_hw_spi_bus_claim (int on) +int board_spi_claim_bus (struct spi_slave *slave) { -int gpio_value = !on; - -if (on) { - kwmpp_config[0 ] = MPP0_SPI_SCn; - kwmpp_config[1 ] =MPP1_SPI_MOSI ; - kwmpp_config[2 ] =MPP2_SPI_SCK ; - kwmpp_config[3 ] =MPP3_SPI_MISO ; - }else { - kwmpp_config[0 ] =MPP0_NF_IO2 ; - kwmpp_config[1 ] =MPP1_NF_IO3 ; - kwmpp_config[2 ] =MPP2_NF_IO4 ; - kwmpp_config[3 ] =MPP3_NF_IO5 ; - } - -/* Multi-Purpose Pins Functionality configuration */ -kirkwood_mpp_conf (kwmpp_config); -kw_gpio_set_value (KM_FLASH_GPIO_PIN , gpio_value); +kw_gpio_set_value (KM_FLASH_GPIO_PIN ,0 );return 0 ; } +void board_spi_release_bus (struct spi_slave *slave) +{ +kw_gpio_set_value (KM_FLASH_GPIO_PIN ,1 ); +} +#if defined(CONFIG_CMD_SF )int do_spi_toggle (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) {
Signature · 1 line
1.7.1
PATCH v4 25/27 arm/km: implement weak function board_spi_clam_bus/release
Quoted 60 lines
-----Original Message-----
From: Valentin Longchamp [mailto:valentin.longchamp at keymile.com]
Sent: 15 May 2012 19:41
To: Prafulla Wadaskar; holger.brunck at keymile.com
Cc: Valentin Longchamp; u-boot at lists.denx.de; Holger Brunck; Gerlando Falauto; Prafulla Wadaskar
Subject: [PATCH v4 25/27] arm/km: implement weak function board_spi_clam_bus/releaseThey are needed on all
km_armboards where we have the environement variables in the NOR Flash. First boards using this feature are kmcoge5un and kmnusa.Signed-off-by Valentin Longchamp <[email protected]>Signed-off-by Holger Brunck <[email protected]>cc Gerlando Falauto <[email protected]>cc Prafulla Wadaskar <[email protected]>--- board/keymile/km_arm/km_arm.c | 26 ++++++++------------------ 1 files changed, 8 insertions(+), 18 deletions(-)board/keymile/km_arm/km_arm.c +2
-18@@ -36,6 +36,7 @@#include <nand.h> #include <netdev.h> #include <miiphy.h> +#include <spi.h> #include <asm/io.h> #include <asm/arch/cpu.h> #include <asm/errno.h> @@ -305,29 +306,18 @@ int board_late_init(void)return 0 ; } -int km_hw_spi_bus_claim (int on) +int board_spi_claim_bus (struct spi_slave *slave) { -int gpio_value = !on; - -if (on) { - kwmpp_config[0 ] = MPP0_SPI_SCn; - kwmpp_config[1 ] =MPP1_SPI_MOSI ; - kwmpp_config[2 ] =MPP2_SPI_SCK ; - kwmpp_config[3 ] =MPP3_SPI_MISO ; - }else { - kwmpp_config[0 ] =MPP0_NF_IO2 ; - kwmpp_config[1 ] =MPP1_NF_IO3 ; - kwmpp_config[2 ] =MPP2_NF_IO4 ; - kwmpp_config[3 ] =MPP3_NF_IO5 ; - } - -/* Multi-Purpose Pins Functionality configuration */ -kirkwood_mpp_conf (kwmpp_config); -kw_gpio_set_value (KM_FLASH_GPIO_PIN , gpio_value);
board/keymile/km_arm/km_arm.c int board_late_init(void) · line 320
Quoted 10 lines
board/keymile/km_arm/km_arm.c +6
-0+kw_gpio_set_value (KM_FLASH_GPIO_PIN ,0 );return 0 ; } +void board_spi_release_bus (struct spi_slave *slave) +{ +kw_gpio_set_value (KM_FLASH_GPIO_PIN ,1 ); +} +
Sorry, I didn't understand.
BTW: Why this is needed from SPI context?
Please let's converge on SPI patches first and then send the rest of the dependent patch series, or exclude the SPI related changes for this patch series
I will suggest to post smaller patch series targeting -
1. bug fixes to the current supported boards, that will go fast in.
2. SPI clam/release mpp patches
3. New board supports
Regards..
Prafulla . . .
PATCH v4 25/27 arm/km: implement weak function board_spi_clam_bus/release
Hi Prafulla,
Quoted 21 lines · Prafulla Wadaskar
Quoted 7 lines
board/keymile/km_arm/km_arm.c +0
-7- kwmpp_config[2 ] =MPP2_NF_IO4 ; - kwmpp_config[3 ] =MPP3_NF_IO5 ; - } - -/* Multi-Purpose Pins Functionality configuration */ -kirkwood_mpp_conf (kwmpp_config); -kw_gpio_set_value (KM_FLASH_GPIO_PIN , gpio_value);board/keymile/km_arm/km_arm.c int board_late_init(void) · line 320
Quoted 10 lines
board/keymile/km_arm/km_arm.c +6
-0+kw_gpio_set_value (KM_FLASH_GPIO_PIN ,0 );return 0 ; } +void board_spi_release_bus (struct spi_slave *slave) +{ +kw_gpio_set_value (KM_FLASH_GPIO_PIN ,1 ); +} +Sorry, I didn't understand.
BTW: Why this is needed from SPI context?
Quoted 7 lines
Please let's converge on SPI patches first and then send the rest of the dependent patch series, or exclude the SPI related changes for this patch series
I will suggest to post smaller patch series targeting -
1. bug fixes to the current supported boards, that will go fast in.
2. SPI clam/release mpp patches
3. New board supports
the whole SPI stuff will be answered from Valentin when he is back next week.
What I could do to proceed with this patch series is to extract the bugfixes and small reworks which are preparations for the new boards in a single patch serie tomorrow that we can go ahead here.
This would be patches 01-09 from this serie. Ok?
Regards
Holger
PATCH v4 25/27 arm/km: implement weak function board_spi_clam_bus/release
Quoted 47 lines
-----Original Message-----
From: Holger Brunck [mailto:holger.brunck at keymile.com]
Sent: 24 May 2012 21:24
To: Prafulla Wadaskar
Cc: Valentin Longchamp; u-boot at lists.denx.de; Gerlando Falauto
Subject: Re: [PATCH v4 25/27] arm/km: implement weak function board_spi_clam_bus/releaseHi Prafulla,
Quoted 21 lines · Prafulla Wadaskar
Quoted 7 lines
board/keymile/km_arm/km_arm.c +0
-7- kwmpp_config[2 ] =MPP2_NF_IO4 ; - kwmpp_config[3 ] =MPP3_NF_IO5 ; - } - -/* Multi-Purpose Pins Functionality configuration */ -kirkwood_mpp_conf (kwmpp_config); -kw_gpio_set_value (KM_FLASH_GPIO_PIN , gpio_value);board/keymile/km_arm/km_arm.c int board_late_init(void) · line 320
Quoted 10 lines
board/keymile/km_arm/km_arm.c +6
-0+kw_gpio_set_value (KM_FLASH_GPIO_PIN ,0 );return 0 ; } +void board_spi_release_bus (struct spi_slave *slave) +{ +kw_gpio_set_value (KM_FLASH_GPIO_PIN ,1 ); +} +Sorry, I didn't understand.
BTW: Why this is needed from SPI context?Quoted 1 line
Please let's converge on SPI patches first and then send the rest of
the dependent patch series, or exclude the SPI related changes for this patch series
Quoted 6 lines
I will suggest to post smaller patch series targeting -
1. bug fixes to the current supported boards, that will go fast in.
2. SPI clam/release mpp patches
3. New board supportsthe whole SPI stuff will be answered from Valentin when he is back next week.
Quoted 8 lines
What I could do to proceed with this patch series is to extract the bugfixes and
small reworks which are preparations for the new boards in a single patch serie
tomorrow that we can go ahead here.This would be patches 01-09 from this serie. Ok?
This sounds good, at least let's get in the bugfixes and updates.
Regards..
Prafulla . . .
PATCH v4 26/27 km/arm: remove spi toggle command
In reply to Valentin LongchampFrom: Holger Brunck <[email protected]>
Now we toggle between SPI and NAND flash automatically if we claim the SPI bus. So we can get rid of this command.
--- board/keymile/km_arm/km_arm.c | 26 -------------------------- include/configs/km/km_arm.h | 5 ++--- 2 files changed, 2 insertions(+), 29 deletions(-)
board/keymile/km_arm/km_arm.c +0 -26
@@ -318,32 +318,6 @@ void board_spi_release_bus(struct spi_slave *slave)kw_gpio_set_value (KM_FLASH_GPIO_PIN ,1 ); } -#if defined(CONFIG_CMD_SF ) -int do_spi_toggle (cmd_tbl_t *cmdtp,int flag,int argc,char *const argv[]) -{ -if (argc <2 ) -return cmd_usage (cmdtp); - -if ((strcmp (argv[1 ],"off" ) ==0 )) { -printf ("SPI FLASH disabled, NAND enabled\n" ); -km_hw_spi_bus_claim (0 ); - }else if ((strcmp (argv[1 ],"on" ) ==0 )) { -printf ("SPI FLASH enabled, NAND disabled\n" ); -km_hw_spi_bus_claim (1 ); - }else { -return cmd_usage (cmdtp); - } - -return 0 ; -} - -U_BOOT_CMD ( - spitoggle,2 ,0 , do_spi_toggle, -"En-/disable SPI FLASH access" , -"<on|off> - Enable (on) or disable (off) SPI FLASH access\n" - ); -#endif -int dram_init (void ) {/* dram_init must store complete ramsize in gd->ram_size */
include/configs/km/km_arm.h +2 -3
@@ -253,9 +253,8 @@ int get_scl(void);#define CONFIG_KM_UPDATE_UBOOT \ "update=" \ - "spi on;sf probe 0;sf erase 0 50000;" \ - "sf write ${load_addr_r} 0 ${filesize};" \ - "spi off\0" + "sf probe 0;sf erase 0 50000;" \ + "sf write ${load_addr_r} 0 ${filesize};\0"#if definedCONFIG_KM_ENV_IS_IN_SPI_NOR #define CONFIG_KM_NEW_ENV \
Signature · 1 line
1.7.1
PATCH v4 27/27 km_arm: use filesize for erase in update command
In reply to Valentin LongchampWe used to have an arbitrary value, which can be a problem if we have a u-boot image that is bigger than this value.
This patch is dependant on the whole km/arm series and will be included in the v3 of the series if there is one.
--- include/configs/km/km_arm.h | 2 +- 1 files changed, 1 insertions(+), 1 deletions(-)
include/configs/km/km_arm.h +1 -1
@@ -253,7 +253,7 @@ int get_scl(void);#define CONFIG_KM_UPDATE_UBOOT \ "update=" \ - "sf probe 0;sf erase 0 50000;" \ + "sf probe 0;sf erase 0 +${filesize};" \ "sf write ${load_addr_r} 0 ${filesize};\0"#if definedCONFIG_KM_ENV_IS_IN_SPI_NOR
Signature · 1 line
1.7.1