From 5f01bff25052c00ea0ed5b8509b369d7392a0e77 Mon Sep 17 00:00:00 2001 From: Asen Dimov Date: Thu, 26 Aug 2010 11:33:32 +0300 Subject: [U-Boot][PATCH] PM9G45 uses DS2401 to set the MAC address of the Ethernet controller. Signed-off-by: Asen Dimov --- board/ronetix/pm9g45/pm9g45.c | 37 +++++++++++++++++++++++++++++++++++++ include/configs/pm9g45.h | 7 +++++++ 2 files changed, 44 insertions(+), 0 deletions(-) diff --git a/board/ronetix/pm9g45/pm9g45.c b/board/ronetix/pm9g45/pm9g45.c index 3b4d9a3..de0b866 100644 --- a/board/ronetix/pm9g45/pm9g45.c +++ b/board/ronetix/pm9g45/pm9g45.c @@ -43,6 +43,7 @@ #include #endif #include +#include DECLARE_GLOBAL_DATA_PTR; @@ -50,6 +51,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 pm9g45_nand_hw_init(void) { @@ -152,6 +177,11 @@ int board_init(void) pm9g45_nand_hw_init(); #endif +#ifdef CONFIG_DS2401 + ds2401_hw_init(); + ds2401_init(&DS2401_funcs); +#endif + #ifdef CONFIG_MACB pm9g45_macb_hw_init(); #endif @@ -182,6 +212,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/pm9g45.h b/include/configs/pm9g45.h index 690f119..7cfffe5 100644 --- a/include/configs/pm9g45.h +++ b/include/configs/pm9g45.h @@ -56,6 +56,12 @@ #define CONFIG_ATMEL_USART 1 #define CONFIG_USART3 1 /* USART 3 is DBGU */ +/* + * 1-wire + */ +#define CONFIG_DS2401 +#define CONFIG_DS2401_PIN AT91_PIO_PORTA, 31 + #define CONFIG_SYS_USE_NANDFLASH 1 /* LED */ @@ -96,6 +102,7 @@ #define CONFIG_NR_DRAM_BANKS 1 #define PHYS_SDRAM 0x70000000 #define PHYS_SDRAM_SIZE 0x08000000 /* 128 megs */ +#define CONFIG_MAC_OUI "02:00:00" /* Organizationally Unique Identifier*/ /* NOR flash, not available */ #define CONFIG_SYS_NO_FLASH 1 -- 1.5.5.6