From b4717141f7e08b797e0eaa79a93fa2d91a945315 Mon Sep 17 00:00:00 2001 From: John Klug Date: Fri, 5 May 2017 17:45:17 -0500 Subject: Add the board functions for at91 MTCDT --- .../u-boot/u-boot-2016.09.01/mtcdt/mtcdt.patch | 131 +++++++++++++++++++-- 1 file changed, 124 insertions(+), 7 deletions(-) (limited to 'recipes-bsp/u-boot') diff --git a/recipes-bsp/u-boot/u-boot-2016.09.01/mtcdt/mtcdt.patch b/recipes-bsp/u-boot/u-boot-2016.09.01/mtcdt/mtcdt.patch index c33e422..800bdc7 100644 --- a/recipes-bsp/u-boot/u-boot-2016.09.01/mtcdt/mtcdt.patch +++ b/recipes-bsp/u-boot/u-boot-2016.09.01/mtcdt/mtcdt.patch @@ -1,6 +1,6 @@ diff -raNu old/include/configs/at91sam9x5ek.h new/include/configs/at91sam9x5ek.h --- old/include/configs/at91sam9x5ek.h 2017-05-04 13:59:37.381346896 -0500 -+++ new/include/configs/at91sam9x5ek.h 2017-05-04 18:11:04.366618638 -0500 ++++ new/include/configs/at91sam9x5ek.h 2017-05-05 08:32:35.950118228 -0500 @@ -9,9 +9,12 @@ #ifndef __CONFIG_H__ #define __CONFIG_H__ @@ -50,12 +50,15 @@ diff -raNu old/include/configs/at91sam9x5ek.h new/include/configs/at91sam9x5ek.h /* * BOOTP options */ -@@ -59,10 +74,13 @@ +@@ -59,10 +74,16 @@ /* no NOR flash */ #define CONFIG_SYS_NO_FLASH -/* - * Command line configuration. ++/* Needed to build the core directory */ ++#define CONFIG_DM ++ +/* Compat needed or i2c read/write/init is not defined */ +#define CONFIG_DM_I2C_COMPAT + @@ -67,7 +70,7 @@ diff -raNu old/include/configs/at91sam9x5ek.h new/include/configs/at91sam9x5ek.h /* * define CONFIG_USB_EHCI to enable USB Hi-Speed (aka 2.0) -@@ -72,7 +90,7 @@ +@@ -72,7 +93,7 @@ /* SDRAM */ #define CONFIG_NR_DRAM_BANKS 1 #define CONFIG_SYS_SDRAM_BASE 0x20000000 @@ -76,7 +79,7 @@ diff -raNu old/include/configs/at91sam9x5ek.h new/include/configs/at91sam9x5ek.h #define CONFIG_SYS_INIT_SP_ADDR \ (CONFIG_SYS_SDRAM_BASE + 4 * 1024 - GENERATED_GBL_DATA_SIZE) -@@ -94,13 +112,30 @@ +@@ -94,13 +115,30 @@ /* our CLE is AD22 */ #define CONFIG_SYS_NAND_MASK_CLE (1 << 22) #define CONFIG_SYS_NAND_ENABLE_PIN AT91_PIN_PD4 @@ -109,7 +112,7 @@ diff -raNu old/include/configs/at91sam9x5ek.h new/include/configs/at91sam9x5ek.h #define CONFIG_CMD_NAND_TRIMFFS -@@ -147,20 +182,36 @@ +@@ -147,20 +185,36 @@ #endif #endif @@ -151,7 +154,7 @@ diff -raNu old/include/configs/at91sam9x5ek.h new/include/configs/at91sam9x5ek.h #elif defined(CONFIG_SYS_USE_SPIFLASH) /* bootstrap + u-boot + env + linux in spi flash */ #define CONFIG_ENV_IS_IN_SPI_FLASH -@@ -197,6 +248,9 @@ +@@ -197,6 +251,9 @@ "8M(bootstrap/uboot/kernel)ro,-(rootfs) " \ "root=/dev/mmcblk0p2 " \ "rw rootfstype=ext4 rootwait" @@ -161,7 +164,7 @@ diff -raNu old/include/configs/at91sam9x5ek.h new/include/configs/at91sam9x5ek.h #else #define CONFIG_BOOTARGS \ "console=ttyS0,115200 earlyprintk " \ -@@ -274,4 +328,20 @@ +@@ -274,4 +331,20 @@ #endif @@ -182,3 +185,117 @@ diff -raNu old/include/configs/at91sam9x5ek.h new/include/configs/at91sam9x5ek.h + "" + #endif +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 +@@ -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; ++} ++ -- cgit v1.2.3