[U-Boot] [PATCH 0/4] km_kirkwood: various bugfixes

A few bugfixes have been done for the km_kirkwood bards in the last months and this series collects them all to be sumbitted to mainline.
Patch 1/4 was already submitted to mainline in [1] and even marked as accepted but the kirkwood maintainer but it was unfortunately never pushed to mainline, so it is here sent again.
[1] http://patchwork.ozlabs.org/patch/399411/
Holger Brunck (1): arm/mgcoge3un: check dip_switch at startup
Tobias Müller (1): arm/km: Fix LED configuration for 88E1118R PHY (PIGGY3)
Valentin Longchamp (2): arm/km_kirkwood: remove KM_ENV_BUS and use CONFIG_I2C_ENV_EEPROM_BUS arm/km_kirkwood: fix the #ifdef for KM_COGE5UN dip switch
board/keymile/km_arm/km_arm.c | 66 ++++++++++++++++++++++++++++++++++++++++--- include/configs/km/km_arm.h | 2 +- include/configs/km_kirkwood.h | 4 --- 3 files changed, 63 insertions(+), 9 deletions(-)

KM_ENV_BUS was used for nothing else than an direct assignment to CONFIG_I2C_ENV_EEPROM_BUS. To avoid this, directly use CONFIG_I2C_ENV_EEPROM_BUS instead.
Patchwork: http://patchwork.ozlabs.org/patch/399411/ Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com ---
include/configs/km/km_arm.h | 2 +- include/configs/km_kirkwood.h | 4 ---- 2 files changed, 1 insertion(+), 5 deletions(-)
diff --git a/include/configs/km/km_arm.h b/include/configs/km/km_arm.h index 15fca1a..8fff381 100644 --- a/include/configs/km/km_arm.h +++ b/include/configs/km/km_arm.h @@ -243,7 +243,7 @@ int get_scl(void); #define CONFIG_SYS_EEPROM_WREN #define CONFIG_ENV_OFFSET 0x0 /* no bracets! */ #define CONFIG_ENV_SIZE (0x2000 - CONFIG_ENV_OFFSET) -#define CONFIG_I2C_ENV_EEPROM_BUS KM_ENV_BUS +#define CONFIG_I2C_ENV_EEPROM_BUS 5 /* I2C2 (Mux-Port 5) */ #define CONFIG_ENV_OFFSET_REDUND 0x2000 /* no bracets! */ #define CONFIG_ENV_SIZE_REDUND (CONFIG_ENV_SIZE) #endif diff --git a/include/configs/km_kirkwood.h b/include/configs/km_kirkwood.h index dc26155..a445aaf 100644 --- a/include/configs/km_kirkwood.h +++ b/include/configs/km_kirkwood.h @@ -116,10 +116,6 @@ /* include common defines/options for all arm based Keymile boards */ #include "km/km_arm.h"
-#ifndef CONFIG_KM_ENV_IS_IN_SPI_NOR -#define KM_ENV_BUS 5 /* I2C2 (Mux-Port 5)*/ -#endif - #if defined(CONFIG_KM_PIGGY4_88E6352) /* * Some keymile boards like mgcoge5un & nusa1 have their PIGGY4 connected via

On Fri, Nov 13, 2015 at 03:01:14PM +0100, Valentin Longchamp wrote:
KM_ENV_BUS was used for nothing else than an direct assignment to CONFIG_I2C_ENV_EEPROM_BUS. To avoid this, directly use CONFIG_I2C_ENV_EEPROM_BUS instead.
Patchwork: http://patchwork.ozlabs.org/patch/399411/ Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com
Applied to u-boot/master, thanks!

From: Tobias Müller Tobias.Mueller@keymile.com
Configure PHY LED register for Marvell 88E1118R PHY used on PIGGY3 to match with printed descriptions on PCB
Signed-off-by: Tobias Müller Tobias.Mueller@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com ---
board/keymile/km_arm/km_arm.c | 55 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+)
diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c index 2938861..a11474c 100644 --- a/board/keymile/km_arm/km_arm.c +++ b/board/keymile/km_arm/km_arm.c @@ -37,6 +37,24 @@ DECLARE_GLOBAL_DATA_PTR; #define REG_IRQ_CIRQ2 0x2d #define MASK_RBI_DEFECT_16 0x01
+/* + * PHY registers definitions + */ +#define PHY_MARVELL_OUI 0x5043 +#define PHY_MARVELL_88E1118_MODEL 0x0022 +#define PHY_MARVELL_88E1118R_MODEL 0x0024 + +#define PHY_MARVELL_PAGE_REG 0x0016 +#define PHY_MARVELL_DEFAULT_PAGE 0x0000 + +#define PHY_MARVELL_88E1118R_LED_CRTL_PAGE 0x0003 +#define PHY_MARVELL_88E1118R_LED_CTRL_REG 0x0010 + +#define PHY_MARVELL_88E1118R_LED_CTRL_RESERVED 0x1000 +#define PHY_MARVELL_88E1118R_LED_CTRL_LED0_1000MB (0x7<<0) +#define PHY_MARVELL_88E1118R_LED_CTRL_LED1_ACT (0x3<<4) +#define PHY_MARVELL_88E1118R_LED_CTRL_LED2_LINK (0x0<<8) + /* Multi-Purpose Pins Functionality configuration */ static const u32 kwmpp_config[] = { MPP0_NF_IO2, @@ -409,6 +427,9 @@ void reset_phy(void) /* Configure and enable MV88E1118 PHY on the piggy*/ void reset_phy(void) { + unsigned int oui; + unsigned char model, rev; + char *name = "egiga0";
if (miiphy_set_current_dev(name)) @@ -416,6 +437,40 @@ void reset_phy(void)
/* reset the phy */ miiphy_reset(name, CONFIG_PHY_BASE_ADR); + + /* get PHY model */ + if (miiphy_info(name, CONFIG_PHY_BASE_ADR, &oui, &model, &rev)) + return; + + /* check for Marvell 88E1118R Gigabit PHY (PIGGY3) */ + if ((oui == PHY_MARVELL_OUI) && + (model == PHY_MARVELL_88E1118R_MODEL)) { + /* set page register to 3 */ + if (miiphy_write(name, CONFIG_PHY_BASE_ADR, + PHY_MARVELL_PAGE_REG, + PHY_MARVELL_88E1118R_LED_CTRL_PAGE)) + printf("Error writing PHY page reg\n"); + + /* + * leds setup as printed on PCB: + * LED2 (Link): 0x0 (On Link, Off No Link) + * LED1 (Activity): 0x3 (On Activity, Off No Activity) + * LED0 (Speed): 0x7 (On 1000 MBits, Off Else) + */ + if (miiphy_write(name, CONFIG_PHY_BASE_ADR, + PHY_MARVELL_88E1118R_LED_CTRL_REG, + PHY_MARVELL_88E1118R_LED_CTRL_RESERVED | + PHY_MARVELL_88E1118R_LED_CTRL_LED0_1000MB | + PHY_MARVELL_88E1118R_LED_CTRL_LED1_ACT | + PHY_MARVELL_88E1118R_LED_CTRL_LED2_LINK)) + printf("Error writing PHY LED reg\n"); + + /* set page register back to 0 */ + if (miiphy_write(name, CONFIG_PHY_BASE_ADR, + PHY_MARVELL_PAGE_REG, + PHY_MARVELL_DEFAULT_PAGE)) + printf("Error writing PHY page reg\n"); + } } #endif

On Fri, Nov 13, 2015 at 03:01:15PM +0100, Valentin Longchamp wrote:
From: Tobias Müller Tobias.Mueller@keymile.com
Configure PHY LED register for Marvell 88E1118R PHY used on PIGGY3 to match with printed descriptions on PCB
Signed-off-by: Tobias Müller Tobias.Mueller@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com
Applied to u-boot/master, thanks!

From: Holger Brunck holger.brunck@keymile.com
Similar to kmcoge5un we need to check the dip switch at startup connected to the kirkwood at MPP43. If it's set we need to set the actual_bank to zero to boot from SW bank zero. Additional to kmcoge5un we need to check also the pin in misc_init to decide wether we wait for the ne to start or not. If the dip_switch is set we don't wait and continue immediately.
Signed-off-by: Holger Brunck holger.brunck@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com ---
board/keymile/km_arm/km_arm.c | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-)
diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c index a11474c..b2ddab2 100644 --- a/board/keymile/km_arm/km_arm.c +++ b/board/keymile/km_arm/km_arm.c @@ -55,6 +55,9 @@ DECLARE_GLOBAL_DATA_PTR; #define PHY_MARVELL_88E1118R_LED_CTRL_LED1_ACT (0x3<<4) #define PHY_MARVELL_88E1118R_LED_CTRL_LED2_LINK (0x0<<8)
+/* I/O pin to erase flash RGPP09 = MPP43 */ +#define KM_FLASH_ERASE_ENABLE 43 + /* Multi-Purpose Pins Functionality configuration */ static const u32 kwmpp_config[] = { MPP0_NF_IO2, @@ -201,8 +204,10 @@ int misc_init_r(void) { #if defined(CONFIG_KM_MGCOGE3UN) char *wait_for_ne; + u8 dip_switch = kw_gpio_get_value(KM_FLASH_ERASE_ENABLE); wait_for_ne = getenv("waitforne"); - if (wait_for_ne != NULL) { + + if ((wait_for_ne != NULL) && (dip_switch == 0)) { if (strcmp(wait_for_ne, "true") == 0) { int cnt = 0; int abort = 0; @@ -291,9 +296,7 @@ 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 +#if (defined(CONFIG_KMCOGE5UN) | defined(CONFIG_KM_MGCOGE3UN)) u8 dip_switch = kw_gpio_get_value(KM_FLASH_ERASE_ENABLE);
/* if pin 1 do full erase */

On Fri, Nov 13, 2015 at 03:01:16PM +0100, Valentin Longchamp wrote:
From: Holger Brunck holger.brunck@keymile.com
Similar to kmcoge5un we need to check the dip switch at startup connected to the kirkwood at MPP43. If it's set we need to set the actual_bank to zero to boot from SW bank zero. Additional to kmcoge5un we need to check also the pin in misc_init to decide wether we wait for the ne to start or not. If the dip_switch is set we don't wait and continue immediately.
Signed-off-by: Holger Brunck holger.brunck@keymile.com Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com
Applied to u-boot/master, thanks!

There was a small typo for KM_COGE5UN that resulted in the dip switch not to behave as expected.
Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com ---
board/keymile/km_arm/km_arm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c index b2ddab2..03a1901 100644 --- a/board/keymile/km_arm/km_arm.c +++ b/board/keymile/km_arm/km_arm.c @@ -296,7 +296,7 @@ int board_init(void)
int board_late_init(void) { -#if (defined(CONFIG_KMCOGE5UN) | defined(CONFIG_KM_MGCOGE3UN)) +#if (defined(CONFIG_KM_COGE5UN) | defined(CONFIG_KM_MGCOGE3UN)) u8 dip_switch = kw_gpio_get_value(KM_FLASH_ERASE_ENABLE);
/* if pin 1 do full erase */

On Fri, Nov 13, 2015 at 03:01:17PM +0100, Valentin Longchamp wrote:
There was a small typo for KM_COGE5UN that resulted in the dip switch not to behave as expected.
Signed-off-by: Valentin Longchamp valentin.longchamp@keymile.com
Applied to u-boot/master, thanks!
participants (2)
-
Tom Rini
-
Valentin Longchamp