summaryrefslogtreecommitdiff
path: root/recipes-bsp/u-boot/u-boot-2016.09.01/mtcdtsdold.patch
diff options
context:
space:
mode:
Diffstat (limited to 'recipes-bsp/u-boot/u-boot-2016.09.01/mtcdtsdold.patch')
-rw-r--r--recipes-bsp/u-boot/u-boot-2016.09.01/mtcdtsdold.patch114
1 files changed, 114 insertions, 0 deletions
diff --git a/recipes-bsp/u-boot/u-boot-2016.09.01/mtcdtsdold.patch b/recipes-bsp/u-boot/u-boot-2016.09.01/mtcdtsdold.patch
new file mode 100644
index 0000000..165a7d0
--- /dev/null
+++ b/recipes-bsp/u-boot/u-boot-2016.09.01/mtcdtsdold.patch
@@ -0,0 +1,114 @@
+diff -raNu old/board/atmel/at91sam9x5ek/at91sam9x5ek.c new/board/atmel/at91sam9x5ek/at91sam9x5ek.c
+--- old/board/atmel/at91sam9x5ek/at91sam9x5ek.c 2017-05-05 11:09:53.668926301 -0500
++++ new/board/atmel/at91sam9x5ek/at91sam9x5ek.c 2017-05-05 17:35:53.342774065 -0500
+@@ -44,7 +44,8 @@
+ csa = readl(&matrix->ebicsa);
+ csa |= AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA;
+ /* NAND flash on D16 */
+- csa |= AT91_MATRIX_NFD0_ON_D16;
++ /* MTCDT: nand flash is set up by bootstrap, so leave it alone here */
++ /* csa |= AT91_MATRIX_NFD0_ON_D16; */
+
+ /* Configure IO drive */
+ csa &= ~AT91_MATRIX_EBI_EBI_IOSR_NORMAL;
+@@ -256,6 +257,9 @@
+
+ int board_init(void)
+ {
++ /* Set Status LED High */
++ at91_set_gpio_output(BOOT_STATUS_LED, 0);
++
+ /* arch number of AT91SAM9X5EK-Board */
+ gd->bd->bi_arch_number = MACH_TYPE_AT91SAM9X5EK;
+
+@@ -267,6 +271,7 @@
+ #endif
+
+ #ifdef CONFIG_ATMEL_SPI
++ at91_spi0_hw_init(1 << 0);
+ at91_spi0_hw_init(1 << 4);
+ #endif
+
+@@ -283,12 +288,6 @@
+ return 0;
+ }
+
+-int dram_init(void)
+-{
+- gd->ram_size = get_ram_size((void *) CONFIG_SYS_SDRAM_BASE,
+- CONFIG_SYS_SDRAM_SIZE);
+- return 0;
+-}
+
+ #if defined(CONFIG_SPL_BUILD)
+ #include <spl.h>
+@@ -362,4 +361,69 @@
+ /* DDRAM2 Controller initialize */
+ ddr2_init(ATMEL_BASE_DDRSDRC, ATMEL_BASE_CS1, &ddr2);
+ }
++
+ #endif
++
++/* 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;
++}
++
++int dram_init(void)
++{
++ gd->ram_size = get_ram_size((void *) CONFIG_SYS_SDRAM_BASE,
++ CONFIG_SYS_SDRAM_SIZE);
++ return 0;
++}
++