diff options
| author | John Klug <john.klug@multitech.com> | 2018-06-04 10:21:29 -0500 |
|---|---|---|
| committer | John Klug <john.klug@multitech.com> | 2018-06-04 10:21:29 -0500 |
| commit | 90f57378fbfacd0ed0e6e11f02b1e60fab784518 (patch) | |
| tree | 6d2ae69fc1f4cab3def2575707aba7f2b7fd36ae | |
| parent | 7ce8011fb9ef377090fa047a3b75f2e91cd354a2 (diff) | |
| download | meta-multitech-90f57378fbfacd0ed0e6e11f02b1e60fab784518.tar.gz meta-multitech-90f57378fbfacd0ed0e6e11f02b1e60fab784518.tar.bz2 meta-multitech-90f57378fbfacd0ed0e6e11f02b1e60fab784518.zip | |
Add mtr stuff to mLinux
25 files changed, 8164 insertions, 2 deletions
diff --git a/conf/machine/mtr.conf b/conf/machine/mtr.conf new file mode 100644 index 0000000..eeb016b --- /dev/null +++ b/conf/machine/mtr.conf @@ -0,0 +1,46 @@ +#@TYPE: Machine +#@Name: Multi-Tech MTCDT +#@DESCRIPTION: Machine configuration for the MTR hardware + +require conf/machine/include/tune-arm926ejs.inc + +MACHINE_FEATURES = "ext2 ext3 usbhost usbgadget ppp" +PREFERRED_PROVIDER_virtual/kernel = "linux" +PREFERRED_VERSION_linux = "3.12.%" + +MACHINE_ESSENTIAL_EXTRA_RDEPENDS = "kernel-module-vizzini" +PREFERRED_VERSION_kernel-module-vizzini ?= "1.1" + +DEFAULTTUNE = "arm926ejs" +TUNE_CCARGS = " -march=armv5te -marm -mthumb-interwork -mtune=arm926ej-s" +TUNE_FEATURES = "arm armv5 thumb dsp arm926ejs" +ARMPKGSFX_THUMB="t" + +# used by sysvinit_2 +SERIAL_CONSOLES = "115200;ttyS0" +#don't try to access tty1 +USE_VT = "0" + +UBOOT_MACHINE = "at91sam9x5ek_nandflash_config" +PREFERRED_VERSION_u-boot = "2016.09.01" + +AT91BOOTSTRAP_BOARD = "at91sam9x5eknf_uboot" +PREFERRED_VERSION_at91bootstrap = "3.5.3" + +KERNEL_IMAGETYPE = "uImage" +# remove kernel-image from rootfs by overriding kernel-base DEPS +RDEPENDS_kernel-base = "" + +EXTRA_IMAGEDEPENDS += "at91bootstrap u-boot" + +IMAGE_FSTYPES =+ "jffs2 tar.gz" +EXTRA_IMAGECMD_jffs2 = "--little-endian --eraseblock=0x20000 --pagesize=0x800 -n" + +UBOOT_ENTRYPOINT = "0x20008000" +UBOOT_LOADADDRESS = "0x20008000" + +PREFERRED_VERSION_rs9113 = '1.5.5' + +PRINC ?= "0" + +PACKAGECONFIG_append_pn-boost = " python" diff --git a/conf/machine/mtrv1.conf b/conf/machine/mtrv1.conf new file mode 100644 index 0000000..6098699 --- /dev/null +++ b/conf/machine/mtrv1.conf @@ -0,0 +1,46 @@ +#@TYPE: Machine +#@Name: Multi-Tech MTCDT +#@DESCRIPTION: Machine configuration for the MTRv1 hardware + +require conf/machine/include/tune-arm926ejs.inc + +MACHINE_FEATURES = "ext2 ext3 usbhost usbgadget ppp" +PREFERRED_PROVIDER_virtual/kernel = "linux" +PREFERRED_VERSION_linux = "3.12.%" + +MACHINE_ESSENTIAL_EXTRA_RDEPENDS = "kernel-module-vizzini" +PREFERRED_VERSION_kernel-module-vizzini ?= "1.1" + +DEFAULTTUNE = "arm926ejs" +TUNE_CCARGS = " -march=armv5te -marm -mthumb-interwork -mtune=arm926ej-s" +TUNE_FEATURES = "arm armv5 thumb dsp arm926ejs" +ARMPKGSFX_THUMB="t" + +# used by sysvinit_2 +SERIAL_CONSOLES = "115200;ttyS0" +#don't try to access tty1 +USE_VT = "0" + +UBOOT_MACHINE = "at91sam9x5ek_nandflash_config" +PREFERRED_VERSION_u-boot = "2016.09.01" + +AT91BOOTSTRAP_BOARD = "at91sam9x5eknf_uboot" +PREFERRED_VERSION_at91bootstrap = "3.5.3" + +KERNEL_IMAGETYPE = "uImage" +# remove kernel-image from rootfs by overriding kernel-base DEPS +RDEPENDS_kernel-base = "" + +EXTRA_IMAGEDEPENDS += "at91bootstrap u-boot" + +IMAGE_FSTYPES =+ "jffs2 tar.gz" +EXTRA_IMAGECMD_jffs2 = "--little-endian --eraseblock=0x20000 --pagesize=0x800 -n" + +UBOOT_ENTRYPOINT = "0x20008000" +UBOOT_LOADADDRESS = "0x20008000" + +PREFERRED_VERSION_rs9113 = '1.5.5' + +PRINC ?= "0" + +PACKAGECONFIG_append_pn-boost = " python" diff --git a/contrib/uboot-setenv-mtr.minicom b/contrib/uboot-setenv-mtr.minicom new file mode 100644 index 0000000..bc53396 --- /dev/null +++ b/contrib/uboot-setenv-mtr.minicom @@ -0,0 +1,60 @@ +print setting U-Boot variables... +send setenv bootargs \'mem=128M console=ttyS0,115200 root=/dev/mtdblock8 ro rootfstype=jffs2\' +send setenv bootcmd \'nboot.jffs2 ${loadaddr} 0 ${kernel_addr}; bootm ${loadaddr}\' +send setenv bootdelay 1 +send setenv serverip 192.168.2.2 +send setenv ipaddr 192.168.2.1 +send setenv netmask 255.255.255.0 +send setenv loadaddr 0x22000000 +send setenv stdin serial +send setenv stdout serial +send setenv stderr serial +send setenv ethact macb0 +send setenv ethaddr 00:08:00:87:00:02 +send setenv mtdids nand0=nand0 +send setenv mtdparts mtdparts=nand0:256k(bootstrap),512k(u-boot),640k(u-boot-env1),640k(u-boot-env2),6M(kernel),8M(config),8M(oem),-(rootfs) +send setenv bootstrap_file oe_bootstrap_pmecc_padded.bin +send setenv uboot_file oe_u-boot.bin +send setenv uboot_env1_file oe_uboot_env1.bin +send setenv uboot_env2_file oe_uboot_env2.bin +send setenv kernel_file oe_uImage.bin +send setenv config_file oe_config.tar.gz +send setenv oem_file oe_oem.tar.gz +send setenv rootfs_file oe_rootfs.jffs2 +send setenv bootstrap_addr 0x00000000 +send setenv uboot_addr 0x00040000 +send setenv uboot_env1_addr 0x000C0000 +send setenv uboot_env2_addr 0x00160000 +send setenv kernel_addr 0x00200000 +send setenv config_addr 0x00800000 +send setenv oem_addr 0x01000000 +send setenv rootfs_addr 0x01800000 +send setenv bootstrap_size 0x00040000 +send setenv uboot_size 0x00080000 +send setenv uboot_env1_size 0x000A0000 +send setenv uboot_env2_size 0x000A0000 +send setenv kernel_size 0x00600000 +send setenv config_size 0x00800000 +send setenv oem_size 0x00800000 +send setenv erase_bootstrap \'nand erase.part bootstrap\' +send setenv erase_uboot \'nand erase.part u-boot\' +send setenv erase_uboot_env1 \'nand erase.part u-boot-env1\' +send setenv erase_uboot_env2 \'nand erase.part u-boot-env2\' +send setenv erase_kernel \'nand erase.part kernel\' +send setenv erase_config \'nand erase.part config\' +send setenv erase_oem \'nand erase.part oem\' +send setenv erase_rootfs \'nand erase.part rootfs\' +send setenv tftp_bootstrap \'tftpboot ${loadaddr} ${bootstrap_file} && run erase_bootstrap && nand write.jffs2 ${fileaddr} bootstrap ${filesize}\' +send setenv tftp_uboot \'tftpboot ${loadaddr} ${uboot_file} && run erase_uboot && nand write.jffs2 ${fileaddr} u-boot ${filesize}\' +send setenv tftp_uboot_env1 \'tftpboot ${loadaddr} ${uboot_env1_file} && run erase_uboot_env1 && nand write.jffs2 ${fileaddr} u-boot-env1 ${filesize}\' +send setenv tftp_uboot_env2 \'tftpboot ${loadaddr} ${uboot_env2_file} && run erase_uboot_env2 && nand write.jffs2 ${fileaddr} u-boot-env2 ${filesize}\' +send setenv tftp_kernel \'tftpboot ${loadaddr} ${kernel_file} && run erase_kernel && nand write.jffs2 ${fileaddr} kernel ${filesize}\' +send setenv tftp_config \'tftpboot ${loadaddr} ${config_file} && run erase_config && nand write.jffs2 ${fileaddr} config ${filesize}\' +send setenv tftp_oem \'tftpboot ${loadaddr} ${oem_file} && run erase_oem && nand write.jffs2 ${fileaddr} oem ${filesize}\' +send setenv tftp_rootfs \'tftpboot ${loadaddr} ${rootfs_file} && run erase_rootfs && nand write.jffs2 ${fileaddr} rootfs ${filesize}\' +send setenv krb \'run tftp_kernel && run tftp_rootfs && boot\' +send setenv rb \'run tftp_rootfs && boot\' +print saving... +send saveenv +send saveenv +send printenv diff --git a/contrib/uboot-setenv-mtrv1.minicom b/contrib/uboot-setenv-mtrv1.minicom new file mode 100644 index 0000000..bc53396 --- /dev/null +++ b/contrib/uboot-setenv-mtrv1.minicom @@ -0,0 +1,60 @@ +print setting U-Boot variables... +send setenv bootargs \'mem=128M console=ttyS0,115200 root=/dev/mtdblock8 ro rootfstype=jffs2\' +send setenv bootcmd \'nboot.jffs2 ${loadaddr} 0 ${kernel_addr}; bootm ${loadaddr}\' +send setenv bootdelay 1 +send setenv serverip 192.168.2.2 +send setenv ipaddr 192.168.2.1 +send setenv netmask 255.255.255.0 +send setenv loadaddr 0x22000000 +send setenv stdin serial +send setenv stdout serial +send setenv stderr serial +send setenv ethact macb0 +send setenv ethaddr 00:08:00:87:00:02 +send setenv mtdids nand0=nand0 +send setenv mtdparts mtdparts=nand0:256k(bootstrap),512k(u-boot),640k(u-boot-env1),640k(u-boot-env2),6M(kernel),8M(config),8M(oem),-(rootfs) +send setenv bootstrap_file oe_bootstrap_pmecc_padded.bin +send setenv uboot_file oe_u-boot.bin +send setenv uboot_env1_file oe_uboot_env1.bin +send setenv uboot_env2_file oe_uboot_env2.bin +send setenv kernel_file oe_uImage.bin +send setenv config_file oe_config.tar.gz +send setenv oem_file oe_oem.tar.gz +send setenv rootfs_file oe_rootfs.jffs2 +send setenv bootstrap_addr 0x00000000 +send setenv uboot_addr 0x00040000 +send setenv uboot_env1_addr 0x000C0000 +send setenv uboot_env2_addr 0x00160000 +send setenv kernel_addr 0x00200000 +send setenv config_addr 0x00800000 +send setenv oem_addr 0x01000000 +send setenv rootfs_addr 0x01800000 +send setenv bootstrap_size 0x00040000 +send setenv uboot_size 0x00080000 +send setenv uboot_env1_size 0x000A0000 +send setenv uboot_env2_size 0x000A0000 +send setenv kernel_size 0x00600000 +send setenv config_size 0x00800000 +send setenv oem_size 0x00800000 +send setenv erase_bootstrap \'nand erase.part bootstrap\' +send setenv erase_uboot \'nand erase.part u-boot\' +send setenv erase_uboot_env1 \'nand erase.part u-boot-env1\' +send setenv erase_uboot_env2 \'nand erase.part u-boot-env2\' +send setenv erase_kernel \'nand erase.part kernel\' +send setenv erase_config \'nand erase.part config\' +send setenv erase_oem \'nand erase.part oem\' +send setenv erase_rootfs \'nand erase.part rootfs\' +send setenv tftp_bootstrap \'tftpboot ${loadaddr} ${bootstrap_file} && run erase_bootstrap && nand write.jffs2 ${fileaddr} bootstrap ${filesize}\' +send setenv tftp_uboot \'tftpboot ${loadaddr} ${uboot_file} && run erase_uboot && nand write.jffs2 ${fileaddr} u-boot ${filesize}\' +send setenv tftp_uboot_env1 \'tftpboot ${loadaddr} ${uboot_env1_file} && run erase_uboot_env1 && nand write.jffs2 ${fileaddr} u-boot-env1 ${filesize}\' +send setenv tftp_uboot_env2 \'tftpboot ${loadaddr} ${uboot_env2_file} && run erase_uboot_env2 && nand write.jffs2 ${fileaddr} u-boot-env2 ${filesize}\' +send setenv tftp_kernel \'tftpboot ${loadaddr} ${kernel_file} && run erase_kernel && nand write.jffs2 ${fileaddr} kernel ${filesize}\' +send setenv tftp_config \'tftpboot ${loadaddr} ${config_file} && run erase_config && nand write.jffs2 ${fileaddr} config ${filesize}\' +send setenv tftp_oem \'tftpboot ${loadaddr} ${oem_file} && run erase_oem && nand write.jffs2 ${fileaddr} oem ${filesize}\' +send setenv tftp_rootfs \'tftpboot ${loadaddr} ${rootfs_file} && run erase_rootfs && nand write.jffs2 ${fileaddr} rootfs ${filesize}\' +send setenv krb \'run tftp_kernel && run tftp_rootfs && boot\' +send setenv rb \'run tftp_rootfs && boot\' +print saving... +send saveenv +send saveenv +send printenv diff --git a/recipes-bsp/at91bootstrap/at91bootstrap-3.5.3/at91bootstrap-3.5.3-mtr.patch b/recipes-bsp/at91bootstrap/at91bootstrap-3.5.3/at91bootstrap-3.5.3-mtr.patch new file mode 100644 index 0000000..313bd91 --- /dev/null +++ b/recipes-bsp/at91bootstrap/at91bootstrap-3.5.3/at91bootstrap-3.5.3-mtr.patch @@ -0,0 +1,60 @@ +Index: at91bootstrap-3.5.3/board/at91sam9x5ek/at91sam9x5eknf_uboot_defconfig +=================================================================== +--- at91bootstrap-3.5.3.orig/board/at91sam9x5ek/at91sam9x5eknf_uboot_defconfig 2013-04-11 05:07:35.000000000 -0500 ++++ at91bootstrap-3.5.3/board/at91sam9x5ek/at91sam9x5eknf_uboot_defconfig 2013-04-29 15:13:01.390913836 -0500 +@@ -42,7 +42,8 @@ + ALLOW_PIO3=y + CONFIG_HAS_PIO3=y + CPU_HAS_PMECC=y +-CONFIG_LOAD_ONE_WIRE=y ++# MTS: don't load one wire ++# CONFIG_LOAD_ONE_WIRE is not set + # CONFIG_MMC_SUPPORT is not set + + # +@@ -81,8 +82,8 @@ + # + # PMECC Configuration + # +-CONFIG_PMECC_CORRECT_BITS_2=y +-# CONFIG_PMECC_CORRECT_BITS_4 is not set ++# CONFIG_PMECC_CORRECT_BITS_2 is not set ++CONFIG_PMECC_CORRECT_BITS_4=y + # CONFIG_PMECC_CORRECT_BITS_8 is not set + # CONFIG_PMECC_CORRECT_BITS_12 is not set + # CONFIG_PMECC_CORRECT_BITS_24 is not set +@@ -116,4 +117,5 @@ + # CONFIG_USER_HW_INIT is not set + CONFIG_THUMB=y + CONFIG_SCLK=y +-CONFIG_DISABLE_WATCHDOG=y ++# MTS: don't disable watchdog ++# CONFIG_DISABLE_WATCHDOG is not set +Index: at91bootstrap-3.5.3/board/at91sam9x5ek/at91sam9x5ek.c +=================================================================== +--- at91bootstrap-3.5.3.orig/board/at91sam9x5ek/at91sam9x5ek.c 2013-04-11 05:07:35.000000000 -0500 ++++ at91bootstrap-3.5.3/board/at91sam9x5ek/at91sam9x5ek.c 2013-04-29 15:14:44.578915819 -0500 +@@ -312,10 +312,8 @@ + + reg = readl(AT91C_BASE_CCFG + CCFG_EBICSA); + reg |= AT91C_EBI_CS3A_SM; +- if (get_cm_rev() == 'A') +- reg &= ~AT91C_EBI_NFD0_ON_D16; +- else +- reg |= (AT91C_EBI_DDR_MP_EN | AT91C_EBI_NFD0_ON_D16); ++ /* MTR */ ++ reg |= (AT91C_EBI_DDR_MP_EN | AT91C_EBI_NFD0_ON_D16); + + reg &= ~AT91C_EBI_DRV; + writel(reg, AT91C_BASE_CCFG + CCFG_EBICSA); +@@ -345,9 +343,7 @@ + AT91C_BASE_SMC + SMC_CTRL3); + + /* Configure the PIO controller */ +- if (get_cm_rev() == 'A') +- pio_configure(nand_pins_lo); +- else ++ /* MTR2 */ + pio_configure(nand_pins_hi); + + writel((1 << AT91C_ID_PIOC_D), (PMC_PCER + AT91C_BASE_PMC)); diff --git a/recipes-bsp/at91bootstrap/at91bootstrap-3.5.3/at91bootstrap-3.5.3-mtrv1-DDRlowDriveStrength.patch b/recipes-bsp/at91bootstrap/at91bootstrap-3.5.3/at91bootstrap-3.5.3-mtrv1-DDRlowDriveStrength.patch new file mode 100644 index 0000000..912a891 --- /dev/null +++ b/recipes-bsp/at91bootstrap/at91bootstrap-3.5.3/at91bootstrap-3.5.3-mtrv1-DDRlowDriveStrength.patch @@ -0,0 +1,34 @@ +Index: at91bootstrap-3.5.3/board/at91sam9x5ek/at91sam9x5ek.c +=================================================================== +--- at91bootstrap-3.5.3.orig/board/at91sam9x5ek/at91sam9x5ek.c 2015-09-29 09:55:07.335113881 -0500 ++++ at91bootstrap-3.5.3/board/at91sam9x5ek/at91sam9x5ek.c 2015-09-29 10:13:19.397489104 -0500 +@@ -81,7 +81,8 @@ + | AT91C_DDRC2_CAS_3 /* CAS Latency 3 */ + | AT91C_DDRC2_NB_BANKS_8 /* 8 banks */ + | AT91C_DDRC2_DLL_RESET_DISABLED /* DLL not reset */ +- | AT91C_DDRC2_DECOD_INTERLEAVED);/*Interleaved decode*/ ++ | AT91C_DDRC2_DIC_DS /* Low DDR Drive Strength */ ++ | AT91C_DDRC2_DECOD_INTERLEAVED);/* Interleaved decode*/ + + /* + * Make sure to uncomment the following line if the DDR controller +Index: at91bootstrap-3.5.3/main.c +=================================================================== +--- at91bootstrap-3.5.3.orig/main.c 2013-04-11 05:07:35.000000000 -0500 ++++ at91bootstrap-3.5.3/main.c 2015-09-29 10:10:21.354971492 -0500 +@@ -68,12 +68,15 @@ + { + char *version = "AT91Bootstrap"; + char *ver_num = " "AT91BOOTSTRAP_VERSION" ("COMPILE_TIME")"; ++ char *feature = "DDR Drive Strength: low"; + + dbgu_print("\n\r"); + dbgu_print("\n\r"); + dbgu_print(version); + dbgu_print(ver_num); + dbgu_print("\n\r"); ++ dbgu_print(feature); ++ dbgu_print("\n\r"); + dbgu_print("\n\r"); + } + diff --git a/recipes-bsp/at91bootstrap/at91bootstrap_3.5.3.bb b/recipes-bsp/at91bootstrap/at91bootstrap_3.5.3.bb index 2e5f086..66d28cb 100644 --- a/recipes-bsp/at91bootstrap/at91bootstrap_3.5.3.bb +++ b/recipes-bsp/at91bootstrap/at91bootstrap_3.5.3.bb @@ -16,6 +16,10 @@ S = "${WORKDIR}/git" SRC_URI_append_mtcdt = " file://at91bootstrap-3.5.3-mtcdt.patch " SRC_URI_append_mtcap = " file://at91bootstrap-3.5.3-mtcdt.patch " +SRC_URI_append_mtr = " file://at91bootstrap-3.5.3-mtr.patch" +SRC_URI_append_mtrv1 = " file://at91bootstrap-3.5.3-mtr.patch \ + file://at91bootstrap-3.5.3-mtrv1-DDRlowDriveStrength.patch \ +" # generate a bootstrap file padded with the header needed for 4-bit PMECC # The padded file can be flashed via u-boot without any need to set the PMECC header using SAM-BA diff --git a/recipes-bsp/multitech/mts-io/mts-io.init b/recipes-bsp/multitech/mts-io/mts-io.init index aaf4cd4..ee127a5 100644 --- a/recipes-bsp/multitech/mts-io/mts-io.init +++ b/recipes-bsp/multitech/mts-io/mts-io.init @@ -196,7 +196,7 @@ set_gpslink() { return fi - if [[ ${hw_name} == MTR ]] || [[ ${hw_name} == MTRV1 ]] ; then + if [[ ${hw_name} == MTR ]] || [[ ${hw_name} == MTRV1 ]] || [[ ${hw_name} == MTHS ]] ; then ln -sf /dev/ttyS1 /dev/gps0 return fi diff --git a/recipes-bsp/u-boot/u-boot-2016.09.01/mtr.patch b/recipes-bsp/u-boot/u-boot-2016.09.01/mtr.patch new file mode 100644 index 0000000..3ef68f2 --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-2016.09.01/mtr.patch @@ -0,0 +1,270 @@ +diff --git a/board/atmel/at91sam9x5ek/at91sam9x5ek.c b/board/atmel/at91sam9x5ek/at91sam9x5ek.c +index b0d440d..13cc9a3 100644 +--- a/board/atmel/at91sam9x5ek/at91sam9x5ek.c ++++ b/board/atmel/at91sam9x5ek/at91sam9x5ek.c +@@ -44,7 +44,8 @@ static void at91sam9x5ek_nand_hw_init(void) + csa = readl(&matrix->ebicsa); + csa |= AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA; + /* NAND flash on D16 */ +- csa |= AT91_MATRIX_NFD0_ON_D16; ++ /* MTR: 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_early_init_f(void) + + 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; + +@@ -363,3 +367,60 @@ void mem_init(void) + 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; ++} ++ +diff --git a/configs/at91sam9x5ek_nandflash_defconfig b/configs/at91sam9x5ek_nandflash_defconfig +index c276795..9ba415d 100644 +--- a/configs/at91sam9x5ek_nandflash_defconfig ++++ b/configs/at91sam9x5ek_nandflash_defconfig +@@ -31,4 +31,3 @@ CONFIG_CMD_USB=y + CONFIG_CMD_NAND=y + CONFIG_CMD_BOOTZ=y + CONFIG_CMD_MII=y +-CONFIG_CMD_I2C=y +diff --git a/include/configs/at91sam9x5ek.h b/include/configs/at91sam9x5ek.h +index 637c403..693feee 100644 +--- a/include/configs/at91sam9x5ek.h ++++ b/include/configs/at91sam9x5ek.h +@@ -9,8 +9,10 @@ + #ifndef __CONFIG_H__ + #define __CONFIG_H__ + ++#include <linux/kconfig.h> + #include <asm/hardware.h> + ++#define USE_MTR + #define CONFIG_SYS_TEXT_BASE 0x26f00000 + + /* ARM asynchronous clock */ +@@ -26,6 +28,8 @@ + #define CONFIG_BOARD_EARLY_INIT_F + #define CONFIG_DISPLAY_CPUINFO + ++#define CONFIG_MISC_INIT_R /* enable platform-dependent misc_init_r() */ ++ + /* general purpose I/O */ + #define CONFIG_ATMEL_LEGACY /* required until (g)pio is fixed */ + #define CONFIG_AT91_GPIO +@@ -36,6 +40,8 @@ + #define CONFIG_USART_ID ATMEL_ID_SYS + + /* LCD */ ++/* MTR has no LCD */ ++#if !defined(MTR) + #define CONFIG_LCD + #define LCD_BPP LCD_COLOR16 + #define LCD_OUTPUT_BPP 24 +@@ -46,7 +52,13 @@ + #define CONFIG_ATMEL_HLCD + #define CONFIG_ATMEL_LCD_RGB565 + #define CONFIG_SYS_CONSOLE_IS_IN_ENV ++#endif /* !defined(MTR) */ ++ ++/* check for keypress even if bootdelay is 0 */ ++#define CONFIG_ZERO_BOOTDELAY_CHECK + ++/*STATUS LED*/ ++#define BOOT_STATUS_LED AT91_PIN_PC21 + + /* + * BOOTP options +@@ -59,10 +71,7 @@ + /* no NOR flash */ + #define CONFIG_SYS_NO_FLASH + +-/* +- * Command line configuration. +- */ +-#define CONFIG_CMD_NAND ++#define CONFIG_SYS_I2C + + /* + * define CONFIG_USB_EHCI to enable USB Hi-Speed (aka 2.0) +@@ -94,13 +103,30 @@ + /* our CLE is AD22 */ + #define CONFIG_SYS_NAND_MASK_CLE (1 << 22) + #define CONFIG_SYS_NAND_ENABLE_PIN AT91_PIN_PD4 +-#define CONFIG_SYS_NAND_READY_PIN AT91_PIN_PD5 ++/* MTR nand ready is PC31 */ ++#define CONFIG_SYS_NAND_READY_PIN AT91_PIN_PC31 + + /* PMECC & PMERRLOC */ + #define CONFIG_ATMEL_NAND_HWECC 1 + #define CONFIG_ATMEL_NAND_HW_PMECC 1 +-#define CONFIG_PMECC_CAP 2 ++ ++/* MTR: 4-bit PMECC */ ++#define CONFIG_PMECC_CAP 4 + #define CONFIG_PMECC_SECTOR_SIZE 512 ++/* ++ * CONFIG_PMECC_INDEX_TABLE_OFFSET has been replaced by: ++ * ATMEL_PMECC_INDEX_OFFSET_512 and ++ * ATMEL_PMECC_INDEX_OFFSET_1024 ++ * ++ * Which as used depends on: ++ * host->pmecc_sector_size == 512 ++ * ++ * 2012.10: ++ * #define CONFIG_PMECC_INDEX_TABLE_OFFSET 0x8000 ++ * 2016.03 (at91sam9x5.h): ++ * 182:#define ATMEL_PMECC_INDEX_OFFSET_512 0x8000 ++ */ ++ + + #define CONFIG_CMD_NAND_TRIMFFS + +@@ -127,9 +153,11 @@ + + /* Ethernet */ + #define CONFIG_MACB +-#define CONFIG_RMII ++#undef CONFIG_RMII + #define CONFIG_NET_RETRY_COUNT 20 + #define CONFIG_MACB_SEARCH_PHY ++/* enable MII command */ ++#define CONFIG_CMD_MII 1 + + /* USB */ + #ifdef CONFIG_CMD_USB +@@ -147,6 +175,22 @@ + #endif + #endif + ++#define CONFIG_SYS_I2C_SOFT ++#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_SOFT_SPEED 50000 ++#define CONFIG_SYS_I2C_SPEED CONFIG_SYS_I2C_SOFT_SPEED ++/* Values from previous levels of Conduit U-Boot */ ++#define CONFIG_SYS_I2C_SLAVE 0xfe ++#define I2C_RXTX_LEN 128 ++ ++/* 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 ++ + #define CONFIG_SYS_LOAD_ADDR 0x22000000 /* load address */ + + #define CONFIG_SYS_MEMTEST_START CONFIG_SYS_SDRAM_BASE +@@ -156,11 +200,11 @@ + /* bootstrap + u-boot + env + linux in nandflash */ + #define CONFIG_ENV_IS_IN_NAND + #define CONFIG_ENV_OFFSET 0xc0000 +-#define CONFIG_ENV_OFFSET_REDUND 0x100000 ++#define CONFIG_ENV_OFFSET_REDUND 0x160000 + #define CONFIG_ENV_SIZE 0x20000 /* 1 sector = 128 kB */ +-#define CONFIG_BOOTCOMMAND "nand read " \ +- "0x22000000 0x200000 0x300000; " \ +- "bootm 0x22000000" ++/* MTR: read from env variables for boot */ ++#define CONFIG_BOOTCOMMAND "nboot.jffs2 ${loadaddr} 0 ${kernel_addr}; bootm ${loadaddr}" ++ + #elif defined(CONFIG_SYS_USE_SPIFLASH) + /* bootstrap + u-boot + env + linux in spi flash */ + #define CONFIG_ENV_IS_IN_SPI_FLASH +@@ -197,6 +241,9 @@ + "8M(bootstrap/uboot/kernel)ro,-(rootfs) " \ + "root=/dev/mmcblk0p2 " \ + "rw rootfstype=ext4 rootwait" ++#elif defined(USE_MTR) ++/* MTR uses jffs2 */ ++#define CONFIG_BOOTARGS "mem=128M console=ttyS0,115200 root=/dev/mtdblock8 ro rootfstype=jffs2" + #else + #define CONFIG_BOOTARGS \ + "console=ttyS0,115200 earlyprintk " \ +@@ -274,4 +321,21 @@ + + #endif + ++/* MTR defaults */ ++#define CONFIG_ENV_OVERWRITE 1 /* Allow Overwrite of serial# & ethaddr */ ++#define CONFIG_ETHADDR 00:08:00:87:00:02 ++#define CONFIG_IPADDR 192.168.2.1 ++#define CONFIG_NETMASK 255.255.255.0 ++#define CONFIG_SERVERIP 192.168.2.2 ++#define CONFIG_HOSTNAME AT91SAM9G25 ++#define CONFIG_LOADADDR 0x22000000 ++ ++/* MTR - enable watchdog */ ++#define CONFIG_AT91SAM9_WATCHDOG 1 ++#define CONFIG_HW_WATCHDOG 1 ++#define CONFIG_AT91_HW_WDT_TIMEOUT 16 ++#define CONFIG_EXTRA_ENV_SETTINGS \ ++ "kernel_addr=0x200000\0" \ ++ "" ++ + #endif diff --git a/recipes-bsp/u-boot/u-boot-2016.09.01/mtrv1.patch b/recipes-bsp/u-boot/u-boot-2016.09.01/mtrv1.patch new file mode 100644 index 0000000..53b4995 --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-2016.09.01/mtrv1.patch @@ -0,0 +1,259 @@ +diff --git a/board/atmel/at91sam9x5ek/at91sam9x5ek.c b/board/atmel/at91sam9x5ek/at91sam9x5ek.c +index b0d440d..5640cef 100644 +--- a/board/atmel/at91sam9x5ek/at91sam9x5ek.c ++++ b/board/atmel/at91sam9x5ek/at91sam9x5ek.c +@@ -44,7 +44,8 @@ static void at91sam9x5ek_nand_hw_init(void) + csa = readl(&matrix->ebicsa); + csa |= AT91_MATRIX_EBI_CS3A_SMC_SMARTMEDIA; + /* NAND flash on D16 */ +- csa |= AT91_MATRIX_NFD0_ON_D16; ++ /* MTR: 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_early_init_f(void) + + 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; + +@@ -362,4 +366,61 @@ void mem_init(void) + /* 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; ++} +diff --git a/configs/at91sam9x5ek_nandflash_defconfig b/configs/at91sam9x5ek_nandflash_defconfig +index c276795..9ba415d 100644 +--- a/configs/at91sam9x5ek_nandflash_defconfig ++++ b/configs/at91sam9x5ek_nandflash_defconfig +@@ -31,4 +31,3 @@ CONFIG_CMD_USB=y + CONFIG_CMD_NAND=y + CONFIG_CMD_BOOTZ=y + CONFIG_CMD_MII=y +-CONFIG_CMD_I2C=y +diff --git a/include/configs/at91sam9x5ek.h b/include/configs/at91sam9x5ek.h +index 637c403..eff48d6 100644 +--- a/include/configs/at91sam9x5ek.h ++++ b/include/configs/at91sam9x5ek.h +@@ -9,8 +9,10 @@ + #ifndef __CONFIG_H__ + #define __CONFIG_H__ + ++#include <linux/kconfig.h> + #include <asm/hardware.h> + ++#define USE_MTR + #define CONFIG_SYS_TEXT_BASE 0x26f00000 + + /* ARM asynchronous clock */ +@@ |
