keymile: enhance IVM reading
v3 cover keymile: enhance IVM reading
All Keymile boards have an EEPROM that is called IVM that contain information about the board that is progammed at production time. One piece of information is the MAC addresses assigned to the board.
u-boot requires the MAC address of the ethernet interfaces it uses to be defined when the interface is intialized. This is most of the time read from the environment but in the case where only the default environment is available, this must be read from somewhere else, in our case the IVM.
This patch series splits the reading and analysis of the IVM content in 2, so that the IVM content and MAC addresses can be read prior to ethernet initialization. The analysis of the rest of the IVM content still happens at a later second stage.
Changes in v3:
- Fix typo that prevented patch 1/6 from compiling
Changes in v2:
- Include the first patch, which was forgotten in the first submission
Valentin Longchamp (6):
KM/IVM: split the IVM reading and parsing in 2 parts kirkwood/km_arm: read the IVM eeprom earlier 85xx/kmp204x: read the IVM eeprom earlier 83xx/km83xx: read the IVM eeprom earlier 82xx/km82xx: read the IVM eeprom earlier KM/IVM: remove ivm_read_eeprom(void)
board/keymile/common/common.h | 3 +- board/keymile/common/ivm.c | 77 +++++++++++++++++++++++++---------------- board/keymile/km82xx/km82xx.c | 10 +++++- board/keymile/km83xx/km83xx.c | 5 ++- board/keymile/km_arm/km_arm.c | 6 +++- board/keymile/kmp204x/kmp204x.c | 5 ++- include/configs/km82xx.h | 2 ++ 7 files changed, 73 insertions(+), 35 deletions(-)
Signature · 1 line
1.8.0.1
PATCH v3 1/6 KM/IVM: split the IVM reading and parsing in 2 parts
This allows to first read the IVM content (earlier in the boot sequence) and define the ethaddr env variable thanks to the ivm_read_eepromi(). Later, the IVM content can be parsed and used to define some hush variables, when the hush subsystem is available thanks to ivm_analyze_eeprom().
To avoid the HW read to happen twice, the buffer passed to ivm_read_eeprom() has to be reused by ivm_analyze_eeprom (and thus allocated before calling ivm_read_eeprom()).
---
Changes in v3:
- Fix typo that prevented patch 1/6 from compiling
Changes in v2:
- Include the first patch, which was forgotten in the first submission
board/keymile/common/common.h | 2 + board/keymile/common/ivm.c | 86 ++++++++++++++++++++++++++++++------------- 2 files changed, 63 insertions(+), 25 deletions(-)
board/keymile/common/common.h +2 -0
@@ -127,6 +127,8 @@ struct bfticu_iomap {int ethernet_present (void );int ivm_read_eeprom (void ); +int ivm_simple_read_eeprom (unsigned char *buf,int len); +int ivm_analyze_eeprom (unsigned char *buf,int len);int trigger_fpga_config (void );int wait_for_fpga_config (void );
board/keymile/common/ivm.c +61 -25
125 lines not on this page · raw message
Signature · 1 line
1.8.0.1
PATCH v3 1/6 KM/IVM: split the IVM reading and parsing in 2 parts
Quoted 11 lines · Valentin Longchamp
This allows to first read the IVM content (earlier in the boot sequence) and define the ethaddr env variable thanks to the
ivm_read_eepromi(). Later, the IVM content can be parsed and used to define some hush variables, when the hush subsystem is available thanks toivm_analyze_eeprom().To avoid the HW read to happen twice, the buffer passed to
ivm_read_eeprom()has to be reused byivm_analyze_eeprom(and thus allocated before callingivm_read_eeprom()).Signed-off-by Valentin Longchamp <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150217/481fd119/attachment.sig>
PATCH v3 2/6 kirkwood/km_arm: read the IVM eeprom earlier
In reply to Valentin LongchampThis allows to define the ethaddr env variable according to the the IVM content by reading the IVM in misc_init_r.
Later, when HUSH is available the content read earlier is analyzed to populate some non env variables.
---
Changes in v3: None
Changes in v2: None
board/keymile/km_arm/km_arm.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
board/keymile/km_arm/km_arm.c +5 -1
@@ -102,6 +102,8 @@ static const u32 kwmpp_config[] = { 0 }; +static uchar ivm_content[CONFIG_SYS_IVM_EEPROM_MAX_LEN ]; +#if defined(CONFIG_KM_MGCOGE3UN )/* * Wait for startup OK from mgcoge3ne
@@ -210,6 +212,8 @@ int misc_init_r(void) }#endif +ivm_simple_read_eeprom (ivm_content,CONFIG_SYS_IVM_EEPROM_MAX_LEN ); +initialize_unit_leds ();set_km_env ();set_bootcount_addr ();
@@ -419,7 +423,7 @@ void reset_phy(void)#if defined(CONFIG_HUSH_INIT_VAR )int hush_init_var (void ) { -ivm_read_eeprom (); +ivm_analyze_eeprom (ivm_content,CONFIG_SYS_IVM_EEPROM_MAX_LEN );return 0 ; }#endif
Signature · 1 line
1.8.0.1
PATCH v3 2/6 kirkwood/km_arm: read the IVM eeprom earlier
Quoted 7 lines · Valentin Longchamp
This allows to define the ethaddr env variable according to the the IVM content by reading the IVM in
misc_init_r.Later, when HUSH is available the content read earlier is analyzed to populate some non env variables.
Signed-off-by Valentin Longchamp <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150217/2cd86d1e/attachment.sig>
PATCH v3 3/6 85xx/kmp204x: read the IVM eeprom earlier
In reply to Valentin LongchampThis allows to define the ethaddr env variable according to the the IVM content by reading the IVM in misc_init_r.
Later, when HUSH is available the content read earlier is analyzed to populate some non env variables.
---
Changes in v3: None
Changes in v2: None
board/keymile/kmp204x/kmp204x.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
board/keymile/kmp204x/kmp204x.c +4 -1
@@ -26,6 +26,8 @@DECLARE_GLOBAL_DATA_PTR ; +static uchar ivm_content[CONFIG_SYS_IVM_EEPROM_MAX_LEN ]; +int checkboard (void ) {printf ("Board: Keymile %s\n" ,CONFIG_KM_BOARD_NAME );
@@ -195,13 +197,14 @@ int misc_init_r(void) } } +ivm_simple_read_eeprom (ivm_content,CONFIG_SYS_IVM_EEPROM_MAX_LEN );return 0 ; }#if defined(CONFIG_HUSH_INIT_VAR )int hush_init_var (void ) { -ivm_read_eeprom (); +ivm_analyze_eeprom (ivm_content,CONFIG_SYS_IVM_EEPROM_MAX_LEN );return 0 ; }#endif
Signature · 1 line
1.8.0.1
PATCH v3 3/6 85xx/kmp204x: read the IVM eeprom earlier
Quoted 7 lines · Valentin Longchamp
This allows to define the ethaddr env variable according to the the IVM content by reading the IVM in
misc_init_r.Later, when HUSH is available the content read earlier is analyzed to populate some non env variables.
Signed-off-by Valentin Longchamp <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150217/b3835eea/attachment.sig>
PATCH v3 3/6 85xx/kmp204x: read the IVM eeprom earlier
In reply to Valentin LongchampQuoted 7 lines · Valentin Longchamp
This allows to define the ethaddr env variable according to the the IVM content by reading the IVM in
misc_init_r.Later, when HUSH is available the content read earlier is analyzed to populate some non env variables.
Signed-off-by Valentin Longchamp <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150217/4b157d02/attachment.sig>
PATCH v3 4/6 83xx/km83xx: read the IVM eeprom earlier
In reply to Valentin LongchampThis allows to define the ethaddr env variable according to the the IVM content by reading the IVM in misc_init_r.
Later, when HUSH is available the content read earlier is analyzed to populate some non env variables.
---
Changes in v3: None
Changes in v2: None
board/keymile/km83xx/km83xx.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
board/keymile/km83xx/km83xx.c +4 -1
@@ -28,6 +28,8 @@#include "../common/common.h" +static uchar ivm_content[CONFIG_SYS_IVM_EEPROM_MAX_LEN ]; + const qe_iop_conf_t qe_iop_conf_tab[] = {/* port pin dir open_drain assign */ #if defined(CONFIG_MPC8360 )
@@ -190,6 +192,7 @@ int board_early_init_r(void)int misc_init_r (void ) { +ivm_simple_read_eeprom (ivm_content,CONFIG_SYS_IVM_EEPROM_MAX_LEN );return 0 ; }
@@ -370,7 +373,7 @@ int ft_board_setup(void *blob, bd_t *bd)#if defined(CONFIG_HUSH_INIT_VAR )int hush_init_var (void ) { -ivm_read_eeprom (); +ivm_analyze_eeprom (ivm_content,CONFIG_SYS_IVM_EEPROM_MAX_LEN );return 0 ; }#endif
Signature · 1 line
1.8.0.1
PATCH v3 4/6 83xx/km83xx: read the IVM eeprom earlier
Quoted 7 lines · Valentin Longchamp
This allows to define the ethaddr env variable according to the the IVM content by reading the IVM in
misc_init_r.Later, when HUSH is available the content read earlier is analyzed to populate some non env variables.
Signed-off-by Valentin Longchamp <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150217/7f094da1/attachment.sig>
PATCH v3 5/6 82xx/km82xx: read the IVM eeprom earlier
In reply to Valentin LongchampThis allows to define the ethaddr env variable according to the the IVM content by reading the IVM in misc_init_r.
Later, when HUSH is available the content read earlier is analyzed to populate some non env variables.
---
Changes in v3: None
Changes in v2: None
board/keymile/km82xx/km82xx.c | 10 +++++++++- include/configs/km82xx.h | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-)
board/keymile/km82xx/km82xx.c +9 -1
@@ -18,6 +18,8 @@#include <i2c.h> #include "../common/common.h" +static uchar ivm_content[CONFIG_SYS_IVM_EEPROM_MAX_LEN ]; +/* * I/O Port configuration table *
@@ -393,9 +395,15 @@ int board_early_init_r(void)return 0 ; } +int misc_init_r (void ) +{ +ivm_simple_read_eeprom (ivm_content,CONFIG_SYS_IVM_EEPROM_MAX_LEN ); +return 0 ; +} +int hush_init_var (void ) { -ivm_read_eeprom (); +ivm_analyze_eeprom (ivm_content,CONFIG_SYS_IVM_EEPROM_MAX_LEN );return 0 ; }
include/configs/km82xx.h +2 -0
@@ -34,6 +34,8 @@#define CONFIG_SYS_TEXT_BASE 0xFE000000 +#define CONFIG_MISC_INIT_R +/* include common defines/options for all Keymile boards */ #include "km/keymile-common.h" #include "km/km-powerpc.h"
Signature · 1 line
1.8.0.1
PATCH v3 5/6 82xx/km82xx: read the IVM eeprom earlier
Quoted 7 lines · Valentin Longchamp
This allows to define the ethaddr env variable according to the the IVM content by reading the IVM in
misc_init_r.Later, when HUSH is available the content read earlier is analyzed to populate some non env variables.
Signed-off-by Valentin Longchamp <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150217/235d4178/attachment.sig>
PATCH v3 6/6 KM/IVM: remove ivm_read_eeprom(void)
In reply to Valentin LongchampThis is not used anymore since the procedure was split into a simple read function and a later alaysis.
The ivm_read_eeprom name is now used for the previous ivm_simple_read_eeprom function.
---
Changes in v3: None
Changes in v2: None
board/keymile/common/common.h | 3 +-- board/keymile/common/ivm.c | 21 +-------------------- board/keymile/km82xx/km82xx.c | 2 +- board/keymile/km83xx/km83xx.c | 2 +- board/keymile/km_arm/km_arm.c | 2 +- board/keymile/kmp204x/kmp204x.c | 2 +- 6 files changed, 6 insertions(+), 26 deletions(-)
board/keymile/common/common.h +1 -2
@@ -126,8 +126,7 @@ struct bfticu_iomap {#endif int ethernet_present (void ); -int ivm_read_eeprom (void ); -int ivm_simple_read_eeprom (unsigned char *buf,int len); +int ivm_read_eeprom (unsigned char *buf,int len);int ivm_analyze_eeprom (unsigned char *buf,int len);int trigger_fpga_config (void );
board/keymile/common/ivm.c +1 -20
@@ -315,7 +315,7 @@ static int ivm_populate_env(unsigned char *buf, int len)return 0 ; } -int ivm_simple_read_eeprom (unsigned char *buf,int len) +int ivm_read_eeprom (unsigned char *buf,int len) {int ret;
@@ -331,22 +331,3 @@ int ivm_simple_read_eeprom(unsigned char *buf, int len)return ivm_populate_env (buf, len); } - -int ivm_read_eeprom (void ) -{ -uchar i2c_buffer[CONFIG_SYS_IVM_EEPROM_MAX_LEN ]; -int ret; - -i2c_set_bus_num (CONFIG_KM_IVM_BUS ); -/* add deblocking here */ -i2c_make_abort (); - - ret =i2c_read (CONFIG_SYS_IVM_EEPROM_ADR ,0 ,1 , i2c_buffer, -CONFIG_SYS_IVM_EEPROM_MAX_LEN ); -if (ret !=0 ) { -printf ("Error reading EEprom\n" ); -return -2 ; - } - -return ivm_analyze_eeprom (i2c_buffer,CONFIG_SYS_IVM_EEPROM_MAX_LEN ); -}
board/keymile/km82xx/km82xx.c +1 -1
@@ -397,7 +397,7 @@ int board_early_init_r(void)int misc_init_r (void ) { -ivm_simple_read_eeprom (ivm_content,CONFIG_SYS_IVM_EEPROM_MAX_LEN ); +ivm_read_eeprom (ivm_content,CONFIG_SYS_IVM_EEPROM_MAX_LEN );return 0 ; }
board/keymile/km83xx/km83xx.c +1 -1
@@ -192,7 +192,7 @@ int board_early_init_r(void)int misc_init_r (void ) { -ivm_simple_read_eeprom (ivm_content,CONFIG_SYS_IVM_EEPROM_MAX_LEN ); +ivm_read_eeprom (ivm_content,CONFIG_SYS_IVM_EEPROM_MAX_LEN );return 0 ; }
board/keymile/km_arm/km_arm.c +1 -1
@@ -212,7 +212,7 @@ int misc_init_r(void) }#endif -ivm_simple_read_eeprom (ivm_content,CONFIG_SYS_IVM_EEPROM_MAX_LEN ); +ivm_read_eeprom (ivm_content,CONFIG_SYS_IVM_EEPROM_MAX_LEN );initialize_unit_leds ();set_km_env ();
board/keymile/kmp204x/kmp204x.c +1 -1
@@ -197,7 +197,7 @@ int misc_init_r(void) } } -ivm_simple_read_eeprom (ivm_content,CONFIG_SYS_IVM_EEPROM_MAX_LEN ); +ivm_read_eeprom (ivm_content,CONFIG_SYS_IVM_EEPROM_MAX_LEN );return 0 ; }
Signature · 1 line
1.8.0.1
PATCH v3 6/6 KM/IVM: remove ivm_read_eeprom(void)
Quoted 7 lines · Valentin Longchamp
This is not used anymore since the procedure was split into a simple read function and a later alaysis.
The
ivm_read_eepromname is now used for the previousivm_simple_read_eepromfunction.Signed-off-by Valentin Longchamp <[email protected]>
Applied to u-boot/master, thanks!
Signature · 8 lines
Tom -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 836 bytes Desc: Digital signature URL: <http://lists.denx.de/pipermail/u-boot/attachments/20150217/61b1815a/attachment.sig>