keymile: enhance IVM reading
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.
Valentin Longchamp (5):
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 | 21 +-------------------- 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, 26 insertions(+), 26 deletions(-)
Signature · 1 line
1.8.0.1
PATCH 1/5 kirkwood/km_arm: read the IVM eeprom earlier
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.
---
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 2/5 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.
---
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 3/5 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.
---
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 4/5 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.
---
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 5/5 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.
---
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_bufer, -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 5/5 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]>
This doesn't apply (but 1-4 does) because there's no ivm_simple_read_eeprom today. Or have I gone crazy? 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/20150105/bb73233c/attachment.pgp>
PATCH 5/5 KM/IVM: remove ivm_read_eeprom(void)
Quoted 5 lines · Tom Rini
Quoted 3 lines · Valentin Longchamp
This is not used anymore since the procedure was split into a simple read function and a later alaysis.
Quoted 8 lines
Quoted 4 lines
The
ivm_read_eepromname is now used for the previousivm_simple_read_eepromfunction.Signed-off-by Valentin Longchamp <[email protected]>This doesn't apply (but 1-4 does) because there's no
ivm_simple_read_eepromtoday. Or have I gone crazy? Thanks!
you are right this is missing. I assume that there is a patch missing in his serie. Unfortunately Valentin is not in until the end of january, so I propose to skip this patch series for this merge window.
Regards
Holger
PATCH 5/5 KM/IVM: remove ivm_read_eeprom(void)
Hello Tom and Holger,
Quoted 11 lines · Holger
Quoted 10 lines · Tom Rini
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]>
Quoted 8 lines
Quoted 3 lines
This doesn't apply (but 1-4 does) because there's no
ivm_simple_read_eepromtoday. Or have I gone crazy? Thanks!you are right this is missing. I assume that there is a patch missing in his serie. Unfortunately Valentin is not in until the end of january, so I propose to skip this patch series for this merge window.
Yes the first patch was missing. I have unfortunately not included it in my first submission just before leaving for holiday. I am sending a V2 that fixes this right now.
Sorry for the noise
Valentin