All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/5] keymile: enhance IVM reading
@ 2014-12-23 13:08 Valentin Longchamp
  2014-12-23 13:08 ` [U-Boot] [PATCH 1/5] kirkwood/km_arm: read the IVM eeprom earlier Valentin Longchamp
                   ` (4 more replies)
  0 siblings, 5 replies; 9+ messages in thread
From: Valentin Longchamp @ 2014-12-23 13:08 UTC (permalink / raw)
  To: u-boot

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(-)

-- 
1.8.0.1

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 1/5] kirkwood/km_arm: read the IVM eeprom earlier
  2014-12-23 13:08 [U-Boot] [PATCH 0/5] keymile: enhance IVM reading Valentin Longchamp
@ 2014-12-23 13:08 ` Valentin Longchamp
  2014-12-23 13:08 ` [U-Boot] [PATCH 2/5] 85xx/kmp204x: " Valentin Longchamp
                   ` (3 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Valentin Longchamp @ 2014-12-23 13:08 UTC (permalink / raw)
  To: u-boot

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 <valentin.longchamp@keymile.com>
---

 board/keymile/km_arm/km_arm.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c
index 1c7c108..6eb6712 100644
--- a/board/keymile/km_arm/km_arm.c
+++ b/board/keymile/km_arm/km_arm.c
@@ -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
-- 
1.8.0.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 2/5] 85xx/kmp204x: read the IVM eeprom earlier
  2014-12-23 13:08 [U-Boot] [PATCH 0/5] keymile: enhance IVM reading Valentin Longchamp
  2014-12-23 13:08 ` [U-Boot] [PATCH 1/5] kirkwood/km_arm: read the IVM eeprom earlier Valentin Longchamp
@ 2014-12-23 13:08 ` Valentin Longchamp
  2014-12-23 13:08 ` [U-Boot] [PATCH 3/5] 83xx/km83xx: " Valentin Longchamp
                   ` (2 subsequent siblings)
  4 siblings, 0 replies; 9+ messages in thread
From: Valentin Longchamp @ 2014-12-23 13:08 UTC (permalink / raw)
  To: u-boot

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 <valentin.longchamp@keymile.com>
---

 board/keymile/kmp204x/kmp204x.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/board/keymile/kmp204x/kmp204x.c b/board/keymile/kmp204x/kmp204x.c
index a74f75b..0f544fb 100644
--- a/board/keymile/kmp204x/kmp204x.c
+++ b/board/keymile/kmp204x/kmp204x.c
@@ -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
-- 
1.8.0.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 3/5] 83xx/km83xx: read the IVM eeprom earlier
  2014-12-23 13:08 [U-Boot] [PATCH 0/5] keymile: enhance IVM reading Valentin Longchamp
  2014-12-23 13:08 ` [U-Boot] [PATCH 1/5] kirkwood/km_arm: read the IVM eeprom earlier Valentin Longchamp
  2014-12-23 13:08 ` [U-Boot] [PATCH 2/5] 85xx/kmp204x: " Valentin Longchamp
@ 2014-12-23 13:08 ` Valentin Longchamp
  2014-12-23 13:08 ` [U-Boot] [PATCH 4/5] 82xx/km82xx: " Valentin Longchamp
  2014-12-23 13:08 ` [U-Boot] [PATCH 5/5] KM/IVM: remove ivm_read_eeprom(void) Valentin Longchamp
  4 siblings, 0 replies; 9+ messages in thread
From: Valentin Longchamp @ 2014-12-23 13:08 UTC (permalink / raw)
  To: u-boot

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 <valentin.longchamp@keymile.com>
---

 board/keymile/km83xx/km83xx.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c
index 1da0dcb..fc68a2f 100644
--- a/board/keymile/km83xx/km83xx.c
+++ b/board/keymile/km83xx/km83xx.c
@@ -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
-- 
1.8.0.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 4/5] 82xx/km82xx: read the IVM eeprom earlier
  2014-12-23 13:08 [U-Boot] [PATCH 0/5] keymile: enhance IVM reading Valentin Longchamp
                   ` (2 preceding siblings ...)
  2014-12-23 13:08 ` [U-Boot] [PATCH 3/5] 83xx/km83xx: " Valentin Longchamp
@ 2014-12-23 13:08 ` Valentin Longchamp
  2014-12-23 13:08 ` [U-Boot] [PATCH 5/5] KM/IVM: remove ivm_read_eeprom(void) Valentin Longchamp
  4 siblings, 0 replies; 9+ messages in thread
From: Valentin Longchamp @ 2014-12-23 13:08 UTC (permalink / raw)
  To: u-boot

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 <valentin.longchamp@keymile.com>
---

 board/keymile/km82xx/km82xx.c | 10 +++++++++-
 include/configs/km82xx.h      |  2 ++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c
index bf84676..c3a1131 100644
--- a/board/keymile/km82xx/km82xx.c
+++ b/board/keymile/km82xx/km82xx.c
@@ -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;
 }
 
diff --git a/include/configs/km82xx.h b/include/configs/km82xx.h
index 14fd290..12f9d42 100644
--- a/include/configs/km82xx.h
+++ b/include/configs/km82xx.h
@@ -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"
-- 
1.8.0.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 5/5] KM/IVM: remove ivm_read_eeprom(void)
  2014-12-23 13:08 [U-Boot] [PATCH 0/5] keymile: enhance IVM reading Valentin Longchamp
                   ` (3 preceding siblings ...)
  2014-12-23 13:08 ` [U-Boot] [PATCH 4/5] 82xx/km82xx: " Valentin Longchamp
@ 2014-12-23 13:08 ` Valentin Longchamp
  2015-01-05 18:47   ` Tom Rini
  4 siblings, 1 reply; 9+ messages in thread
From: Valentin Longchamp @ 2014-12-23 13:08 UTC (permalink / raw)
  To: u-boot

This 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.

Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>

---

 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(-)

diff --git a/board/keymile/common/common.h b/board/keymile/common/common.h
index 7e16d25..dcfefc4 100644
--- a/board/keymile/common/common.h
+++ b/board/keymile/common/common.h
@@ -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);
diff --git a/board/keymile/common/ivm.c b/board/keymile/common/ivm.c
index 932459a..0a3a2bf 100644
--- a/board/keymile/common/ivm.c
+++ b/board/keymile/common/ivm.c
@@ -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);
-}
diff --git a/board/keymile/km82xx/km82xx.c b/board/keymile/km82xx/km82xx.c
index c3a1131..c599b40 100644
--- a/board/keymile/km82xx/km82xx.c
+++ b/board/keymile/km82xx/km82xx.c
@@ -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;
 }
 
diff --git a/board/keymile/km83xx/km83xx.c b/board/keymile/km83xx/km83xx.c
index fc68a2f..89e9e1e 100644
--- a/board/keymile/km83xx/km83xx.c
+++ b/board/keymile/km83xx/km83xx.c
@@ -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;
 }
 
diff --git a/board/keymile/km_arm/km_arm.c b/board/keymile/km_arm/km_arm.c
index 6eb6712..2938861 100644
--- a/board/keymile/km_arm/km_arm.c
+++ b/board/keymile/km_arm/km_arm.c
@@ -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();
diff --git a/board/keymile/kmp204x/kmp204x.c b/board/keymile/kmp204x/kmp204x.c
index 0f544fb..eebb47f 100644
--- a/board/keymile/kmp204x/kmp204x.c
+++ b/board/keymile/kmp204x/kmp204x.c
@@ -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;
 }
 
-- 
1.8.0.1

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 5/5] KM/IVM: remove ivm_read_eeprom(void)
  2014-12-23 13:08 ` [U-Boot] [PATCH 5/5] KM/IVM: remove ivm_read_eeprom(void) Valentin Longchamp
@ 2015-01-05 18:47   ` Tom Rini
  2015-01-06  8:19     ` Holger Brunck
  0 siblings, 1 reply; 9+ messages in thread
From: Tom Rini @ 2015-01-05 18:47 UTC (permalink / raw)
  To: u-boot

On Tue, Dec 23, 2014 at 02:08:57PM +0100, Valentin Longchamp wrote:

> This 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.
> 
> Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>

This doesn't apply (but 1-4 does) because there's no
ivm_simple_read_eeprom today.  Or have I gone crazy?  Thanks!

-- 
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>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 5/5] KM/IVM: remove ivm_read_eeprom(void)
  2015-01-05 18:47   ` Tom Rini
@ 2015-01-06  8:19     ` Holger Brunck
  2015-02-02 15:55       ` Valentin Longchamp
  0 siblings, 1 reply; 9+ messages in thread
From: Holger Brunck @ 2015-01-06  8:19 UTC (permalink / raw)
  To: u-boot

On 01/05/2015 07:47 PM, Tom Rini wrote:
> On Tue, Dec 23, 2014 at 02:08:57PM +0100, Valentin Longchamp wrote:
> 
>> This 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.
>>
>> Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>
> 
> This doesn't apply (but 1-4 does) because there's no
> ivm_simple_read_eeprom today.  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

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [U-Boot] [PATCH 5/5] KM/IVM: remove ivm_read_eeprom(void)
  2015-01-06  8:19     ` Holger Brunck
@ 2015-02-02 15:55       ` Valentin Longchamp
  0 siblings, 0 replies; 9+ messages in thread
From: Valentin Longchamp @ 2015-02-02 15:55 UTC (permalink / raw)
  To: u-boot

Hello Tom and Holger,

On 01/06/2015 09:19 AM, Brunck, Holger wrote:
> On 01/05/2015 07:47 PM, Tom Rini wrote:
>> On Tue, Dec 23, 2014 at 02:08:57PM +0100, Valentin Longchamp wrote:
>>
>>> This 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.
>>>
>>> Signed-off-by: Valentin Longchamp <valentin.longchamp@keymile.com>
>>
>> This doesn't apply (but 1-4 does) because there's no
>> ivm_simple_read_eeprom today.  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

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2015-02-02 15:55 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-23 13:08 [U-Boot] [PATCH 0/5] keymile: enhance IVM reading Valentin Longchamp
2014-12-23 13:08 ` [U-Boot] [PATCH 1/5] kirkwood/km_arm: read the IVM eeprom earlier Valentin Longchamp
2014-12-23 13:08 ` [U-Boot] [PATCH 2/5] 85xx/kmp204x: " Valentin Longchamp
2014-12-23 13:08 ` [U-Boot] [PATCH 3/5] 83xx/km83xx: " Valentin Longchamp
2014-12-23 13:08 ` [U-Boot] [PATCH 4/5] 82xx/km82xx: " Valentin Longchamp
2014-12-23 13:08 ` [U-Boot] [PATCH 5/5] KM/IVM: remove ivm_read_eeprom(void) Valentin Longchamp
2015-01-05 18:47   ` Tom Rini
2015-01-06  8:19     ` Holger Brunck
2015-02-02 15:55       ` Valentin Longchamp

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.