diff mbox series

[6/7] ARM: k2g: setup PRU ethernet MAC addresses

Message ID 1485436049-19754-7-git-send-email-rogerq@ti.com
State New
Headers show
Series am57xx-idk LCD and am571x-idk 6 port ethernet pinmux | expand

Commit Message

Roger Quadros Jan. 26, 2017, 1:07 p.m. UTC
PRU ethernet MAC address range is present in the
board EEPROM. Parse it and setup eth?addr
environment variables.

Signed-off-by: Roger Quadros <rogerq@ti.com>

---
 board/ti/ks2_evm/board_k2g.c | 19 +++++++++++++++++++
 include/configs/k2g_evm.h    |  4 ++++
 2 files changed, 23 insertions(+)

-- 
2.7.4

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Comments

Tom Rini Jan. 26, 2017, 5:41 p.m. UTC | #1
On Thu, Jan 26, 2017 at 03:07:28PM +0200, Roger Quadros wrote:

> PRU ethernet MAC address range is present in the

> board EEPROM. Parse it and setup eth?addr

> environment variables.

[snip]
> +#ifdef CONFIG_BOARD_LATE_INIT

> +int board_late_init(void)

> +{

> +	__maybe_unused int rc;

> +

> +#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_TI_I2C_BOARD_DETECT)


Just move the #if up to include 'int rc' and we don't need to declare it
__maybe_unused then.

[snip]
> +/* Board Detection EEPROM */

> +#define CONFIG_EEPROM_BUS_ADDRESS	0

> +#define CONFIG_EEPROM_CHIP_ADDRESS	0x50


Only dra7xx and am57xx use these CONFIG options currently, please
migrate them to Kconfig instead of adding another board, thanks!

-- 
Tom
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
Roger Quadros Jan. 27, 2017, 8:58 a.m. UTC | #2
On 26/01/17 19:41, Tom Rini wrote:
> On Thu, Jan 26, 2017 at 03:07:28PM +0200, Roger Quadros wrote:

> 

>> PRU ethernet MAC address range is present in the

>> board EEPROM. Parse it and setup eth?addr

>> environment variables.

> [snip]

>> +#ifdef CONFIG_BOARD_LATE_INIT

>> +int board_late_init(void)

>> +{

>> +	__maybe_unused int rc;

>> +

>> +#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_TI_I2C_BOARD_DETECT)

> 

> Just move the #if up to include 'int rc' and we don't need to declare it

> __maybe_unused then.


OK.
> 

> [snip]

>> +/* Board Detection EEPROM */

>> +#define CONFIG_EEPROM_BUS_ADDRESS	0

>> +#define CONFIG_EEPROM_CHIP_ADDRESS	0x50

> 

> Only dra7xx and am57xx use these CONFIG options currently, please

> migrate them to Kconfig instead of adding another board, thanks!

> 


I didn't get this part. In this patch board_k2g.c is using those macros.
Are you suggesting to move this to Kconfig instead of putting them
in the board headers?

cheers,
-roger
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
Tom Rini Jan. 27, 2017, 2:54 p.m. UTC | #3
On Fri, Jan 27, 2017 at 10:58:41AM +0200, Roger Quadros wrote:
> 

> On 26/01/17 19:41, Tom Rini wrote:

> > On Thu, Jan 26, 2017 at 03:07:28PM +0200, Roger Quadros wrote:

> > 

> >> PRU ethernet MAC address range is present in the

> >> board EEPROM. Parse it and setup eth?addr

> >> environment variables.

> > [snip]

> >> +#ifdef CONFIG_BOARD_LATE_INIT

> >> +int board_late_init(void)

> >> +{

> >> +	__maybe_unused int rc;

> >> +

> >> +#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_TI_I2C_BOARD_DETECT)

> > 

> > Just move the #if up to include 'int rc' and we don't need to declare it

> > __maybe_unused then.

> 

> OK.

> > 

> > [snip]

> >> +/* Board Detection EEPROM */

> >> +#define CONFIG_EEPROM_BUS_ADDRESS	0

> >> +#define CONFIG_EEPROM_CHIP_ADDRESS	0x50

> > 

> > Only dra7xx and am57xx use these CONFIG options currently, please

> > migrate them to Kconfig instead of adding another board, thanks!

> > 

> 

> I didn't get this part. In this patch board_k2g.c is using those macros.

> Are you suggesting to move this to Kconfig instead of putting them

> in the board headers?


Correct, move them to Kconfig (and migrate the other two boards).
Thanks!

-- 
Tom
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot
diff mbox series

Patch

diff --git a/board/ti/ks2_evm/board_k2g.c b/board/ti/ks2_evm/board_k2g.c
index 40edbaa..64a62e0 100644
--- a/board/ti/ks2_evm/board_k2g.c
+++ b/board/ti/ks2_evm/board_k2g.c
@@ -12,6 +12,7 @@ 
 #include <asm/arch/psc_defs.h>
 #include <asm/arch/mmc_host_def.h>
 #include "mux-k2g.h"
+#include "../common/board_detect.h"
 
 #define SYS_CLK		24000000
 
@@ -149,6 +150,24 @@  int board_early_init_f(void)
 }
 #endif
 
+#ifdef CONFIG_BOARD_LATE_INIT
+int board_late_init(void)
+{
+	__maybe_unused int rc;
+
+#if !defined(CONFIG_SPL_BUILD) && defined(CONFIG_TI_I2C_BOARD_DETECT)
+	rc = ti_i2c_eeprom_am_get(CONFIG_EEPROM_BUS_ADDRESS,
+			CONFIG_EEPROM_CHIP_ADDRESS);
+	if (rc)
+		printf("ti_i2c_eeprom_init failed %d\n", rc);
+
+	board_ti_set_ethaddr(1);
+#endif
+
+	return 0;
+}
+#endif
+
 #ifdef CONFIG_SPL_BUILD
 void spl_init_keystone_plls(void)
 {
diff --git a/include/configs/k2g_evm.h b/include/configs/k2g_evm.h
index 81da8ff..f37dbfd 100644
--- a/include/configs/k2g_evm.h
+++ b/include/configs/k2g_evm.h
@@ -53,6 +53,10 @@ 
 /* NAND Configuration */
 #define CONFIG_SYS_NAND_PAGE_2K
 
+/* Board Detection EEPROM */
+#define CONFIG_EEPROM_BUS_ADDRESS	0
+#define CONFIG_EEPROM_CHIP_ADDRESS	0x50
+
 /* Network */
 #define CONFIG_KSNET_NETCP_V1_5
 #define CONFIG_KSNET_CPSW_NUM_PORTS	2