summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJesse Gilles <jgilles@multitech.com>2015-03-31 17:18:02 -0500
committerJesse Gilles <jgilles@multitech.com>2015-03-31 17:18:02 -0500
commit54fbe1a67c118d5150af59b2ca73e0e91e2fb255 (patch)
tree6a835208674efe3c55aba45e7312f0890d5b4d7d
parent8ffce0d8733757e896e434a725913829de1b416e (diff)
downloadmeta-multitech-54fbe1a67c118d5150af59b2ca73e0e91e2fb255.tar.gz
meta-multitech-54fbe1a67c118d5150af59b2ca73e0e91e2fb255.tar.bz2
meta-multitech-54fbe1a67c118d5150af59b2ca73e0e91e2fb255.zip
u-boot-2012.10: mtcdt: read ethernet addr from EEPROM
-rw-r--r--recipes-bsp/u-boot/u-boot-2012.10/u-boot-2012.10-mtcdt.patch161
-rw-r--r--recipes-bsp/u-boot/u-boot_2012.10.bb2
2 files changed, 147 insertions, 16 deletions
diff --git a/recipes-bsp/u-boot/u-boot-2012.10/u-boot-2012.10-mtcdt.patch b/recipes-bsp/u-boot/u-boot-2012.10/u-boot-2012.10-mtcdt.patch
index dc27dbb..e97d20b 100644
--- a/recipes-bsp/u-boot/u-boot-2012.10/u-boot-2012.10-mtcdt.patch
+++ b/recipes-bsp/u-boot/u-boot-2012.10/u-boot-2012.10-mtcdt.patch
@@ -1,8 +1,16 @@
Index: git/include/configs/at91sam9x5ek.h
===================================================================
---- git.orig/include/configs/at91sam9x5ek.h 2015-01-13 13:31:45.378882027 -0600
-+++ git/include/configs/at91sam9x5ek.h 2015-01-13 13:31:45.762877122 -0600
-@@ -54,6 +54,7 @@
+--- git.orig/include/configs/at91sam9x5ek.h 2015-03-31 17:07:08.258060132 -0500
++++ git/include/configs/at91sam9x5ek.h 2015-03-31 17:07:09.086047272 -0500
+@@ -40,6 +40,7 @@
+ #define CONFIG_INITRD_TAG
+ #define CONFIG_SKIP_LOWLEVEL_INIT
+ #define CONFIG_BOARD_EARLY_INIT_F
++#define CONFIG_MISC_INIT_R /* enable platform-dependent misc_init_r() */
+ #define CONFIG_DISPLAY_CPUINFO
+
+ #define CONFIG_OF_LIBFDT
+@@ -54,6 +55,7 @@
#define CONFIG_USART_ID ATMEL_ID_SYS
/* LCD */
@@ -10,7 +18,7 @@ Index: git/include/configs/at91sam9x5ek.h
#define CONFIG_LCD
#define LCD_BPP LCD_COLOR16
#define LCD_OUTPUT_BPP 24
-@@ -65,8 +66,14 @@
+@@ -65,8 +67,14 @@
#define CONFIG_ATMEL_HLCD
#define CONFIG_ATMEL_LCD_RGB565
#define CONFIG_SYS_CONSOLE_IS_IN_ENV
@@ -26,7 +34,22 @@ Index: git/include/configs/at91sam9x5ek.h
/*
* BOOTP options
-@@ -93,7 +100,7 @@
+@@ -90,10 +98,22 @@
+ #define CONFIG_CMD_NAND
+ #define CONFIG_CMD_SF
+
++#define CONFIG_CMD_I2C
++#define CONFIG_SOFT_I2C
++#define CONFIG_SOFT_I2C_GPIO_SCL AT91_PIN_PA31
++#define CONFIG_SOFT_I2C_GPIO_SDA AT91_PIN_PA30
++#define CONFIG_SYS_I2C_SPEED 50000
++
++/* I2C eeprom support */
++#define CONFIG_CMD_EEPROM
++#define CONFIG_SYS_I2C_EEPROM_ADDR 0x56 /* at24c04 */
++#define CONFIG_SYS_I2C_EEPROM_ADDR_LEN 1 /* Bytes of address */
++#define CONFIG_SYS_EEPROM_PAGE_WRITE_BITS 3
++
/* SDRAM */
#define CONFIG_NR_DRAM_BANKS 1
#define CONFIG_SYS_SDRAM_BASE 0x20000000
@@ -35,7 +58,7 @@ Index: git/include/configs/at91sam9x5ek.h
#define CONFIG_SYS_INIT_SP_ADDR \
(CONFIG_SYS_SDRAM_BASE + 4 * 1024 - GENERATED_GBL_DATA_SIZE)
-@@ -120,12 +127,14 @@
+@@ -120,12 +140,14 @@
/* our CLE is AD22 */
#define CONFIG_SYS_NAND_MASK_CLE (1 << 22)
#define CONFIG_SYS_NAND_ENABLE_PIN AT91_PIN_PD4
@@ -52,7 +75,7 @@ Index: git/include/configs/at91sam9x5ek.h
#define CONFIG_PMECC_SECTOR_SIZE 512
#define CONFIG_PMECC_INDEX_TABLE_OFFSET 0x8000
-@@ -143,21 +152,22 @@
+@@ -143,21 +165,22 @@
#define CONFIG_RMII
#define CONFIG_NET_RETRY_COUNT 20
#define CONFIG_MACB_SEARCH_PHY
@@ -80,7 +103,7 @@ Index: git/include/configs/at91sam9x5ek.h
#else
#ifdef CONFIG_SYS_USE_SPIFLASH
/* bootstrap + u-boot + env + linux in spi flash */
-@@ -172,11 +182,8 @@
+@@ -172,11 +195,8 @@
#endif
#endif
@@ -94,7 +117,7 @@ Index: git/include/configs/at91sam9x5ek.h
#define CONFIG_BAUDRATE 115200
-@@ -199,4 +206,22 @@
+@@ -199,4 +219,22 @@
#error CONFIG_USE_IRQ not supported
#endif
@@ -119,8 +142,8 @@ Index: git/include/configs/at91sam9x5ek.h
#endif
Index: git/board/atmel/at91sam9x5ek/at91sam9x5ek.c
===================================================================
---- git.orig/board/atmel/at91sam9x5ek/at91sam9x5ek.c 2015-01-13 13:31:44.950887504 -0600
-+++ git/board/atmel/at91sam9x5ek/at91sam9x5ek.c 2015-01-13 13:31:45.762877122 -0600
+--- git.orig/board/atmel/at91sam9x5ek/at91sam9x5ek.c 2015-03-31 17:07:03.950127041 -0500
++++ git/board/atmel/at91sam9x5ek/at91sam9x5ek.c 2015-03-31 17:16:49.269015984 -0500
@@ -61,7 +61,8 @@
csa = readl(&matrix->ebicsa);
csa |= AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA;
@@ -141,23 +164,131 @@ Index: git/board/atmel/at91sam9x5ek/at91sam9x5ek.c
/* arch number of AT91SAM9X5EK-Board */
gd->bd->bi_arch_number = MACH_TYPE_AT91SAM9X5EK;
-@@ -288,6 +292,7 @@
+@@ -288,6 +292,63 @@
#ifdef CONFIG_LCD
at91sam9x5ek_lcd_hw_init();
#endif
+
++ return 0;
++}
++
++/* on-board EEPROM */
++struct mts_id_eeprom_layout {
++ char vendor_id[32];
++ char product_id[32];
++ char device_id[32];
++ char hw_version[32];
++ uint8_t mac_addr[6];
++ char imei[32];
++ uint8_t capa[32];
++ uint8_t mac_bluetooth[6];
++ uint8_t mac_wifi[6];
++ uint8_t reserved[302];
++};
++
++int board_get_enetaddr(uchar *enetaddr)
++{
++ struct mts_id_eeprom_layout eeprom_buffer = {0};
++
++ if (eeprom_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, &eeprom_buffer, sizeof(eeprom_buffer))) {
++ printf("EEPROM: read error\n");
++ return 0;
++ }
++
++ if (eeprom_buffer.vendor_id[0] == 0x00 || eeprom_buffer.vendor_id[0] == 0xFF) {
++ printf("EEPROM: uninitialized\n");
++ return 0;
++ }
++
++ printf("vendor-id: %s\n", eeprom_buffer.vendor_id);
++ printf("product-id: %s\n", eeprom_buffer.product_id);
++ printf("device-id: %s\n", eeprom_buffer.device_id);
++ printf("hw-version: %s\n", eeprom_buffer.hw_version);
++ printf("mac-addr: %02x:%02x:%02x:%02x:%02x:%02x\n", eeprom_buffer.mac_addr[0],
++ eeprom_buffer.mac_addr[1],
++ eeprom_buffer.mac_addr[2],
++ eeprom_buffer.mac_addr[3],
++ eeprom_buffer.mac_addr[4],
++ eeprom_buffer.mac_addr[5]);
++
++ memcpy(enetaddr, eeprom_buffer.mac_addr, 6);
++
++ return 1;
++}
++
++int misc_init_r(void)
++{
++ uchar enetaddr[6];
++
++ /* set MAC address from EEPROM if read successful */
++ if (board_get_enetaddr(enetaddr)) {
++ eth_setenv_enetaddr("ethaddr", enetaddr);
++ }
++
return 0;
}
-@@ -297,3 +302,4 @@
+@@ -297,3 +358,4 @@
CONFIG_SYS_SDRAM_SIZE);
return 0;
}
+
Index: git/board/atmel/at91sam9x5ek/config.mk
===================================================================
---- git.orig/board/atmel/at91sam9x5ek/config.mk 2015-01-13 13:31:44.950887504 -0600
-+++ git/board/atmel/at91sam9x5ek/config.mk 2015-01-13 13:41:46.576072758 -0600
+--- git.orig/board/atmel/at91sam9x5ek/config.mk 2015-03-31 17:07:03.950127041 -0500
++++ git/board/atmel/at91sam9x5ek/config.mk 2015-03-31 17:07:09.086047272 -0500
@@ -1 +1 @@
-CONFIG_SYS_TEXT_BASE = 0x26f00000
+CONFIG_SYS_TEXT_BASE = 0x2ef00000
+Index: git/drivers/gpio/at91_gpio.c
+===================================================================
+--- git.orig/drivers/gpio/at91_gpio.c 2015-03-31 17:07:04.822113498 -0500
++++ git/drivers/gpio/at91_gpio.c 2015-03-31 17:07:09.086047272 -0500
+@@ -40,6 +40,7 @@
+ #include <asm/sizes.h>
+ #include <asm/arch/hardware.h>
+ #include <asm/arch/at91_pio.h>
++#include <asm/arch/gpio.h>
+
+ int at91_set_pio_pullup(unsigned port, unsigned pin, int use_pullup)
+ {
+@@ -343,3 +344,39 @@
+ }
+ return pdsr != 0;
+ }
++
++int gpio_request(unsigned gpio, const char *label)
++{
++ return 0;
++}
++
++int gpio_free(unsigned gpio)
++{
++ return 0;
++}
++
++int gpio_is_valid(int number)
++{
++ return 0;
++}
++
++int gpio_direction_input(unsigned gpio)
++{
++ // input with no pullup
++ return at91_set_gpio_input(gpio, 0);
++}
++
++int gpio_direction_output(unsigned gpio, int value)
++{
++ return at91_set_gpio_output(gpio, value);
++}
++
++int gpio_get_value(unsigned gpio)
++{
++ return at91_get_gpio_value(gpio);
++}
++
++void gpio_set_value(unsigned gpio, int value)
++{
++ return at91_set_gpio_value(gpio, value);
++}
diff --git a/recipes-bsp/u-boot/u-boot_2012.10.bb b/recipes-bsp/u-boot/u-boot_2012.10.bb
index 8dfd69d..654564f 100644
--- a/recipes-bsp/u-boot/u-boot_2012.10.bb
+++ b/recipes-bsp/u-boot/u-boot_2012.10.bb
@@ -1,4 +1,4 @@
-PR = "r5"
+PR = "r6"
require u-boot.inc
LICENSE = "GPLv2"