From 7e7fea4536ce1ac789ae0e71319cdd6e60eccb3b Mon Sep 17 00:00:00 2001 From: Asen Dimov Date: Fri, 3 Sep 2010 19:38:13 +0300 Subject: [U-Boot][PATCH] PM9263 uses DS2401 to set the MAC address of the Ethernet controller Signed-off-by: Asen Dimov --- board/ronetix/pm9263/pm9263.c | 36 ++++++++++++++++++++++++++++++++++++ include/configs/pm9263.h | 7 +++++++ 2 files changed, 43 insertions(+), 0 deletions(-) diff --git a/board/ronetix/pm9263/pm9263.c b/board/ronetix/pm9263/pm9263.c index e41c84c..5fca558 100644 --- a/board/ronetix/pm9263/pm9263.c +++ b/board/ronetix/pm9263/pm9263.c @@ -43,6 +43,7 @@ #include #endif #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -51,6 +52,30 @@ DECLARE_GLOBAL_DATA_PTR; * Miscelaneous platform dependent initialisations */ +#ifdef CONFIG_DS2401 + +static void ds2401_hw_init(void) +{ + at91_set_pio_output(CONFIG_DS2401_PIN, 1); /* output */ + at91_set_pio_multi_drive(CONFIG_DS2401_PIN, 1); /* open drain */ +} + +static void ds2401_set(int value) +{ + at91_set_pio_value(CONFIG_DS2401_PIN, value); +} + +static int ds2401_get(void) +{ + return at91_get_pio_value(CONFIG_DS2401_PIN); +} + +DS2401_FUNCS DS2401_funcs = { + .set = ds2401_set, + .get = ds2401_get +}; +#endif + #ifdef CONFIG_CMD_NAND static void pm9263_nand_hw_init(void) { @@ -362,6 +387,10 @@ int board_init(void) #ifdef CONFIG_CMD_NAND pm9263_nand_hw_init(); #endif +#ifdef CONFIG_DS2401 + ds2401_hw_init(); + ds2401_init(&DS2401_funcs); +#endif #ifdef CONFIG_HAS_DATAFLASH at91_spi0_hw_init(1 << 0); #endif @@ -394,6 +423,13 @@ int board_eth_init(bd_t *bis) { int rc = 0; #ifdef CONFIG_MACB + /* + * Setup the MAC address. If you want to setup the MAC address + * using the 'onewire' console command comment out the following + * line + */ + do_ds2401(NULL, 0, 0, NULL); + rc = macb_eth_initialize(0, (void *)AT91_EMAC_BASE, 0x01); #endif return rc; diff --git a/include/configs/pm9263.h b/include/configs/pm9263.h index 9735e6a..20fe9d7 100644 --- a/include/configs/pm9263.h +++ b/include/configs/pm9263.h @@ -174,6 +174,12 @@ #undef CONFIG_USART2 #define CONFIG_USART3 1 /* USART 3 is DBGU */ +/* + * 1-wire + */ +#define CONFIG_DS2401 +#define CONFIG_DS2401_PIN AT91_PIO_PORTB, 31 + /* LCD */ #define CONFIG_LCD 1 #define LCD_BPP LCD_COLOR8 @@ -279,6 +285,7 @@ #define CONFIG_NET_MULTI 1 #define CONFIG_NET_RETRY_COUNT 20 #define CONFIG_RESET_PHY_R 1 +#define CONFIG_MAC_OUI "02:00:00" /* Organizationally Unique Identifier*/ /* USB */ #define CONFIG_USB_ATMEL -- 1.5.5.6