From 09506a9c18982327219c98032b42fa903a11dabf Mon Sep 17 00:00:00 2001 From: Asen Dimov Date: Fri, 3 Sep 2010 19:55:00 +0300 Subject: [U-Boot][PATCH] PM9261 uses DS2401 to set the MAC address of the Ethernet controller Signed-off-by: Asen Dimov --- board/ronetix/pm9261/pm9261.c | 36 ++++++++++++++++++++++++++++++++++++ include/configs/pm9261.h | 7 +++++++ 2 files changed, 43 insertions(+), 0 deletions(-) diff --git a/board/ronetix/pm9261/pm9261.c b/board/ronetix/pm9261/pm9261.c index 53d8c48..7328134 100644 --- a/board/ronetix/pm9261/pm9261.c +++ b/board/ronetix/pm9261/pm9261.c @@ -44,6 +44,7 @@ #include #endif #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -52,6 +53,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 pm9261_nand_hw_init(void) { @@ -260,6 +285,10 @@ int board_init(void) #ifdef CONFIG_CMD_NAND pm9261_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 @@ -291,6 +320,13 @@ void reset_phy(void) { #ifdef CONFIG_DRIVER_DM9000 /* + * 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); + + /* * Initialize ethernet HW addr prior to starting Linux, * needed for nfsroot */ diff --git a/include/configs/pm9261.h b/include/configs/pm9261.h index a0b00e9..b1afbb8 100644 --- a/include/configs/pm9261.h +++ b/include/configs/pm9261.h @@ -164,6 +164,12 @@ #undef CONFIG_USART2 #define CONFIG_USART3 1 /* USART 3 is DBGU */ +/* + * 1-wire + */ +#define CONFIG_DS2401 +#define CONFIG_DS2401_PIN AT91_PIO_PORTA, 7 + /* LCD */ #define CONFIG_LCD 1 #define LCD_BPP LCD_COLOR8 @@ -253,6 +259,7 @@ #define CONFIG_NET_RETRY_COUNT 20 #define CONFIG_RESET_PHY_R 1 #define CONFIG_NET_MULTI +#define CONFIG_MAC_OUI "02:00:00" /* Organizationally Unique Identifier*/ /* USB */ #define CONFIG_USB_ATMEL -- 1.5.5.6