From bbfd509da6b5ada3c60d31debf13f30a809e98e8 Mon Sep 17 00:00:00 2001 From: Holger Brunck Date: Mon, 27 Jan 2014 16:58:22 +0100 Subject: arm/km: drop unneeded define CONFIG_BOOTCOUNT_LIMIT is used on all boards from this board series. So remove this unneeded define. Signed-off-by: Holger Brunck Acked-by: Valentin Longchamp --- board/keymile/km_arm/km_arm.c | 4 ---- 1 file changed, 4 deletions(-) (limited to 'board/keymile') diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c index 5620737..946cbed 100644 --- a/board/keymile/km_arm/km_arm.c +++ b/board/keymile/km_arm/km_arm.c @@ -164,7 +164,6 @@ static int initialize_unit_leds(void) return 0; } -#if defined(CONFIG_BOOTCOUNT_LIMIT) static void set_bootcount_addr(void) { uchar buf[32]; @@ -173,7 +172,6 @@ static void set_bootcount_addr(void) sprintf((char *)buf, "0x%x", bootcountaddr); setenv("bootcountaddr", (char *)buf); } -#endif int misc_init_r(void) { @@ -210,9 +208,7 @@ int misc_init_r(void) initialize_unit_leds(); set_km_env(); -#if defined(CONFIG_BOOTCOUNT_LIMIT) set_bootcount_addr(); -#endif return 0; } -- cgit v1.1 From aef0bdc0c0aa737ff2c03974bf29bde29d6a619a Mon Sep 17 00:00:00 2001 From: Holger Brunck Date: Mon, 27 Jan 2014 16:58:23 +0100 Subject: arm/km: make local function startup_allowed static Signed-off-by: Holger Brunck Acked-by: Valentin Longchamp --- board/keymile/km_arm/km_arm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'board/keymile') diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c index 946cbed..c104896 100644 --- a/board/keymile/km_arm/km_arm.c +++ b/board/keymile/km_arm/km_arm.c @@ -102,7 +102,7 @@ static const u32 kwmpp_config[] = { /* * Wait for startup OK from mgcoge3ne */ -int startup_allowed(void) +static int startup_allowed(void) { unsigned char buf; -- cgit v1.1 From fa6e0ecb8aeedbc2138c162dc0319920b7e8e34b Mon Sep 17 00:00:00 2001 From: Holger Brunck Date: Mon, 27 Jan 2014 16:58:26 +0100 Subject: arm/km: fix wrong error handling miiphy_read and miiphy_write are returning 0 on success. Signed-off-by: Holger Brunck Acked-by: Valentin Longchamp --- board/keymile/km_arm/km_arm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'board/keymile') diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c index c104896..5f32e70 100644 --- a/board/keymile/km_arm/km_arm.c +++ b/board/keymile/km_arm/km_arm.c @@ -318,15 +318,15 @@ void reset_phy(void) return; /* RGMII clk transition on data stable */ - if (!miiphy_read(name, CONFIG_PHY_BASE_ADR, PHY_SPEC_CTRL_REG, ®)) + 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, - reg | PHY_RGMII_CLK_STABLE | PHY_CLSA)) + 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_REG, - PHY_LED0_LINK | PHY_LED1_ACT | PHY_LED2_INT)) + 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 */ -- cgit v1.1 From 7b2268b88fb9a67b13563fa61b8ae282b9aa6e00 Mon Sep 17 00:00:00 2001 From: Gerlando Falauto Date: Mon, 27 Jan 2014 16:58:27 +0100 Subject: arm/km: enable FDT for km_kirwkood This consists of: a) Defining the addresses, enabling fdtsupport [arm] b) Defining "cramfsloadfdt" [arm,powerpc => common] c) Adding the FDT address to bootm [arm,powerpc => common] d) Defining "tftpfdt" in ramfs-,develop- [arm,powerpc >= common] This should work with 3.10 kernels, whether loaded through TFTP (with rootfs either through NFS or TFTP-ramfs) or from the NAND. The machid was left unchanged, this should keep compatibility with both older and newer kernels. Signed-off-by: Valentin Longchamp Signed-off-by: Gerlando Falauto Signed-off-by: Holger Brunck Acked-by: Valentin Longchamp --- board/keymile/scripts/develop-arm.txt | 1 - board/keymile/scripts/develop-common.txt | 1 + board/keymile/scripts/develop-ppc_82xx.txt | 1 - board/keymile/scripts/develop-ppc_8xx.txt | 1 - board/keymile/scripts/ramfs-arm.txt | 1 - board/keymile/scripts/ramfs-common.txt | 1 + board/keymile/scripts/ramfs-ppc_82xx.txt | 1 - board/keymile/scripts/ramfs-ppc_8xx.txt | 1 - 8 files changed, 2 insertions(+), 6 deletions(-) (limited to 'board/keymile') diff --git a/board/keymile/scripts/develop-arm.txt b/board/keymile/scripts/develop-arm.txt index 922afea..d3c974f 100644 --- a/board/keymile/scripts/develop-arm.txt +++ b/board/keymile/scripts/develop-arm.txt @@ -1,2 +1 @@ setup_debug_env=tftpboot 0x200000 scripts/develop-common.txt && env import -t 0x200000 ${filesize} && run configure -tftpfdt=true diff --git a/board/keymile/scripts/develop-common.txt b/board/keymile/scripts/develop-common.txt index a6bb1b1..f49b26a 100644 --- a/board/keymile/scripts/develop-common.txt +++ b/board/keymile/scripts/develop-common.txt @@ -3,6 +3,7 @@ bootcmd=run ${subbootcmds} configure=run set_uimage; km_setboardid && saveenv && reset subbootcmds=tftpfdt tftpkernel nfsargs add_default boot nfsargs=setenv bootargs root=/dev/nfs rw nfsroot=${serverip}:${toolchain}/${arch} +tftpfdt=tftpboot ${fdt_addr_r} ${hostname}/${hostname}.dtb tftpkernel=tftpboot ${load_addr_r} ${hostname}/${uimage} toolchain=/opt/eldk rootfssize=0 diff --git a/board/keymile/scripts/develop-ppc_82xx.txt b/board/keymile/scripts/develop-ppc_82xx.txt index 909f6a3..d3c974f 100644 --- a/board/keymile/scripts/develop-ppc_82xx.txt +++ b/board/keymile/scripts/develop-ppc_82xx.txt @@ -1,2 +1 @@ setup_debug_env=tftpboot 0x200000 scripts/develop-common.txt && env import -t 0x200000 ${filesize} && run configure -tftpfdt=tftpboot ${fdt_addr_r} ${hostname}/${hostname}.dtb diff --git a/board/keymile/scripts/develop-ppc_8xx.txt b/board/keymile/scripts/develop-ppc_8xx.txt index 909f6a3..d3c974f 100644 --- a/board/keymile/scripts/develop-ppc_8xx.txt +++ b/board/keymile/scripts/develop-ppc_8xx.txt @@ -1,2 +1 @@ setup_debug_env=tftpboot 0x200000 scripts/develop-common.txt && env import -t 0x200000 ${filesize} && run configure -tftpfdt=tftpboot ${fdt_addr_r} ${hostname}/${hostname}.dtb diff --git a/board/keymile/scripts/ramfs-arm.txt b/board/keymile/scripts/ramfs-arm.txt index 79974f1..87e984e 100644 --- a/board/keymile/scripts/ramfs-arm.txt +++ b/board/keymile/scripts/ramfs-arm.txt @@ -1,2 +1 @@ setup_debug_env=tftpboot 0x200000 scripts/ramfs-common.txt && env import -t 0x200000 ${filesize} && run configure -tftpfdt=true diff --git a/board/keymile/scripts/ramfs-common.txt b/board/keymile/scripts/ramfs-common.txt index 502c863..0cfb36f 100644 --- a/board/keymile/scripts/ramfs-common.txt +++ b/board/keymile/scripts/ramfs-common.txt @@ -7,6 +7,7 @@ nfsargs=setenv bootargs root=/dev/nfs rw nfsroot=${serverip}:${rootpath} configure=run set_uimage; km_setboardid && saveenv && reset rootfsfile=${hostname}/rootfsImage setrootfsaddr=setexpr value ${pnvramaddr} - ${rootfssize} && setenv rootfsaddr 0x${value} +tftpfdt=tftpboot ${fdt_addr_r} ${hostname}/${hostname}.dtb tftpkernel=tftpboot ${load_addr_r} ${hostname}/${uimage} tftpramfs=tftpboot ${rootfsaddr} ${hostname}/rootfsImage set_uimage=printenv uimage || setenv uimage uImage diff --git a/board/keymile/scripts/ramfs-ppc_82xx.txt b/board/keymile/scripts/ramfs-ppc_82xx.txt index 970927a..87e984e 100644 --- a/board/keymile/scripts/ramfs-ppc_82xx.txt +++ b/board/keymile/scripts/ramfs-ppc_82xx.txt @@ -1,2 +1 @@ setup_debug_env=tftpboot 0x200000 scripts/ramfs-common.txt && env import -t 0x200000 ${filesize} && run configure -tftpfdt=tftpboot ${fdt_addr_r} ${hostname}/${hostname}.dtb diff --git a/board/keymile/scripts/ramfs-ppc_8xx.txt b/board/keymile/scripts/ramfs-ppc_8xx.txt index 970927a..87e984e 100644 --- a/board/keymile/scripts/ramfs-ppc_8xx.txt +++ b/board/keymile/scripts/ramfs-ppc_8xx.txt @@ -1,2 +1 @@ setup_debug_env=tftpboot 0x200000 scripts/ramfs-common.txt && env import -t 0x200000 ${filesize} && run configure -tftpfdt=tftpboot ${fdt_addr_r} ${hostname}/${hostname}.dtb -- cgit v1.1 From b1c2a7ae32b6c5dd1dcb7cb29c862af01523ba36 Mon Sep 17 00:00:00 2001 From: Gerlando Falauto Date: Mon, 27 Jan 2014 16:58:28 +0100 Subject: arm/km: define fdt_high env variable and allow backwards compatibility Add set_fdthigh subcommand to "subbootcmds" (release) so to set "fdt_high" This is necessary on Kirkwood so that the FDT does not get relocated above the memory limit that the kernel cannot access (that is the memory part reserved for the switch). This was tested on NUSA1, where it is necessary, and on ETER1, where it doesn't seem to hurt. We want the scripts to also work with older versions of u-boot, where: a) set_fdthigh is not defined (will be default env for newer u-boots) b) the fdt will not be available For this reason, we use "set_fdthigh" to tell whether we are running a newer (FDT-aware) u-boot or not. So if "set_fdthigh" runs successfully or arch != arm we try loading the fdt; otherwise we proceed normally. Notice how, contrary to release mode, set_fdthigh will _not_ be part of subbootcmds for develop and ramfs, but will be executed as part of "tftpfdt". Since this is only needed for kirkwood cards, and it prevents the kernel from booting on QorIQ (though it seemed to work on ETER1), we change its definition in the default env for powerpc so that the value is only set on ARM. Signed-off-by: Valentin Longchamp Signed-off-by: Gerlando Falauto Signed-off-by: Holger Brunck Acked-by: Valentin Longchamp --- board/keymile/scripts/develop-common.txt | 2 +- board/keymile/scripts/ramfs-common.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'board/keymile') diff --git a/board/keymile/scripts/develop-common.txt b/board/keymile/scripts/develop-common.txt index f49b26a..a80812a 100644 --- a/board/keymile/scripts/develop-common.txt +++ b/board/keymile/scripts/develop-common.txt @@ -3,7 +3,7 @@ bootcmd=run ${subbootcmds} configure=run set_uimage; km_setboardid && saveenv && reset subbootcmds=tftpfdt tftpkernel nfsargs add_default boot nfsargs=setenv bootargs root=/dev/nfs rw nfsroot=${serverip}:${toolchain}/${arch} -tftpfdt=tftpboot ${fdt_addr_r} ${hostname}/${hostname}.dtb +tftpfdt=if run set_fdthigh || test ${arch} != arm; then tftpboot ${fdt_addr_r} ${hostname}/${hostname}.dtb; else true; fi tftpkernel=tftpboot ${load_addr_r} ${hostname}/${uimage} toolchain=/opt/eldk rootfssize=0 diff --git a/board/keymile/scripts/ramfs-common.txt b/board/keymile/scripts/ramfs-common.txt index 0cfb36f..d79ad2e 100644 --- a/board/keymile/scripts/ramfs-common.txt +++ b/board/keymile/scripts/ramfs-common.txt @@ -7,7 +7,7 @@ nfsargs=setenv bootargs root=/dev/nfs rw nfsroot=${serverip}:${rootpath} configure=run set_uimage; km_setboardid && saveenv && reset rootfsfile=${hostname}/rootfsImage setrootfsaddr=setexpr value ${pnvramaddr} - ${rootfssize} && setenv rootfsaddr 0x${value} -tftpfdt=tftpboot ${fdt_addr_r} ${hostname}/${hostname}.dtb +tftpfdt=if run set_fdthigh || test ${arch} != arm; then tftpboot ${fdt_addr_r} ${hostname}/${hostname}.dtb; else true; fi tftpkernel=tftpboot ${load_addr_r} ${hostname}/${uimage} tftpramfs=tftpboot ${rootfsaddr} ${hostname}/rootfsImage set_uimage=printenv uimage || setenv uimage uImage -- cgit v1.1 From 9c134e189a95c976dab94d4f28444a5398627188 Mon Sep 17 00:00:00 2001 From: Gerlando Falauto Date: Thu, 13 Feb 2014 16:43:00 +0100 Subject: arm/km: introduce kmsugp1 target KMSUGP1 is from a u-boot perspective (almost) identical to KMNUSA. The only difference is that the PCIe reset is connected to Kirkwood pin MPP7_PEX_RST_OUTn, we use a dedicated config flag KM_PCIE_RESET_MPP7. Such pin should theoretically be handled by the PCIe subsystem automatically, but this turned out not to be the case. So simply configure this PIN as a GPIO and issue a pulse manually. Signed-off-by: Gerlando Falauto Cc: Karlheinz Jerg Cc: Valentin Longchamp Cc: Holger Brunck Acked-by: Valentin Longchamp --- board/keymile/km_arm/fpga_config.c | 26 ++++++++++++++++++++++++++ board/keymile/km_arm/km_arm.c | 4 ++++ 2 files changed, 30 insertions(+) (limited to 'board/keymile') diff --git a/board/keymile/km_arm/fpga_config.c b/board/keymile/km_arm/fpga_config.c index cbfc7d2..51a3cfe 100644 --- a/board/keymile/km_arm/fpga_config.c +++ b/board/keymile/km_arm/fpga_config.c @@ -189,6 +189,31 @@ int wait_for_fpga_config(void) return 0; } +#if defined(KM_PCIE_RESET_MPP7) + +#define KM_PEX_RST_GPIO_PIN 7 +int fpga_reset(void) +{ + if (!check_boco2()) { + /* we do not have BOCO2, this is not really used */ + return 0; + } + + printf("PCIe reset through GPIO7: "); + /* apply PCIe reset via GPIO */ + kw_gpio_set_valid(KM_PEX_RST_GPIO_PIN, 1); + kw_gpio_direction_output(KM_PEX_RST_GPIO_PIN, 1); + kw_gpio_set_value(KM_PEX_RST_GPIO_PIN, 0); + udelay(1000*10); + kw_gpio_set_value(KM_PEX_RST_GPIO_PIN, 1); + + printf(" done\n"); + + return 0; +} + +#else + #define PRST1 0x4 #define PCIE_RST 0x10 #define TRAFFIC_RST 0x04 @@ -219,6 +244,7 @@ int fpga_reset(void) return 0; } +#endif /* the FPGA was configured, we configure the BOCO2 so that the EEPROM * is available from the Bobcat SPI bus */ diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c index 5f32e70..35402c8 100644 --- a/board/keymile/km_arm/km_arm.c +++ b/board/keymile/km_arm/km_arm.c @@ -46,7 +46,11 @@ static const u32 kwmpp_config[] = { MPP4_NF_IO6, MPP5_NF_IO7, MPP6_SYSRST_OUTn, +#if defined(KM_PCIE_RESET_MPP7) + MPP7_GPO, +#else MPP7_PEX_RST_OUTn, +#endif #if defined(CONFIG_SYS_I2C_SOFT) MPP8_GPIO, /* SDA */ MPP9_GPIO, /* SCL */ -- cgit v1.1