diff options
author | Jesse Gilles <jgilles@multitech.com> | 2014-11-04 11:23:21 -0600 |
---|---|---|
committer | Jesse Gilles <jgilles@multitech.com> | 2014-11-04 11:23:21 -0600 |
commit | 812befa503067ad2bae5de58962ff38321c369ca (patch) | |
tree | b472b5118f62e97f760a5b23f3a72130e5ce235b /recipes-bsp/u-boot | |
download | meta-multitech-812befa503067ad2bae5de58962ff38321c369ca.tar.gz meta-multitech-812befa503067ad2bae5de58962ff38321c369ca.tar.bz2 meta-multitech-812befa503067ad2bae5de58962ff38321c369ca.zip |
initial commit with MTCDT support
Diffstat (limited to 'recipes-bsp/u-boot')
5 files changed, 350 insertions, 0 deletions
diff --git a/recipes-bsp/u-boot/u-boot-2012.10/u-boot-2010.06-macb-autoneg-timeout.patch b/recipes-bsp/u-boot/u-boot-2012.10/u-boot-2010.06-macb-autoneg-timeout.patch new file mode 100644 index 0000000..5294b1a --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-2012.10/u-boot-2010.06-macb-autoneg-timeout.patch @@ -0,0 +1,53 @@ +Index: u-boot-2010.06/drivers/net/macb.c +=================================================================== +--- u-boot-2010.06.orig/drivers/net/macb.c 2013-01-04 16:57:21.460051123 -0600 ++++ u-boot-2010.06/drivers/net/macb.c 2013-01-04 17:03:28.880052058 -0600 +@@ -57,7 +57,7 @@ + #define CONFIG_SYS_MACB_RX_RING_SIZE (CONFIG_SYS_MACB_RX_BUFFER_SIZE / 128) + #define CONFIG_SYS_MACB_TX_RING_SIZE 16 + #define CONFIG_SYS_MACB_TX_TIMEOUT 1000 +-#define CONFIG_SYS_MACB_AUTONEG_TIMEOUT 5000000 ++#define CONFIG_SYS_MACB_AUTONEG_TIMEOUT 3000000 + + struct macb_dma_desc { + u32 addr; +@@ -322,11 +322,12 @@ + return 0; + } + +-static void macb_phy_reset(struct macb_device *macb) ++static u16 macb_phy_reset(struct macb_device *macb) + { + struct eth_device *netdev = &macb->netdev; + int i; +- u16 status, adv; ++ u16 status = 0; ++ u16 adv; + + adv = ADVERTISE_CSMA | ADVERTISE_ALL; + macb_mdio_write(macb, MII_ADVERTISE, adv); +@@ -346,6 +347,8 @@ + else + printf("%s: Autonegotiation timed out (status=0x%04x)\n", + netdev->name, status); ++ ++ return status; + } + + #ifdef CONFIG_MACB_SEARCH_PHY +@@ -397,14 +400,7 @@ + status = macb_mdio_read(macb, MII_BMSR); + if (!(status & BMSR_LSTATUS)) { + /* Try to re-negotiate if we don't have link already. */ +- macb_phy_reset(macb); +- +- for (i = 0; i < CONFIG_SYS_MACB_AUTONEG_TIMEOUT / 100; i++) { +- status = macb_mdio_read(macb, MII_BMSR); +- if (status & BMSR_LSTATUS) +- break; +- udelay(100); +- } ++ status = macb_phy_reset(macb); + } + + if (!(status & BMSR_LSTATUS)) { 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 new file mode 100644 index 0000000..fbc9c0f --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-2012.10/u-boot-2012.10-mtcdt.patch @@ -0,0 +1,143 @@ +Index: git/include/configs/at91sam9x5ek.h +=================================================================== +--- git.orig/include/configs/at91sam9x5ek.h 2014-10-14 16:14:47.208402129 -0500 ++++ git/include/configs/at91sam9x5ek.h 2014-10-21 11:20:03.467770688 -0500 +@@ -54,6 +54,7 @@ + #define CONFIG_USART_ID ATMEL_ID_SYS + + /* LCD */ ++/* MTCDT has no LCD + #define CONFIG_LCD + #define LCD_BPP LCD_COLOR16 + #define LCD_OUTPUT_BPP 24 +@@ -65,8 +66,14 @@ + #define CONFIG_ATMEL_HLCD + #define CONFIG_ATMEL_LCD_RGB565 + #define CONFIG_SYS_CONSOLE_IS_IN_ENV ++*/ + +-#define CONFIG_BOOTDELAY 3 ++/*STATUS LED*/ ++#define BOOT_STATUS_LED AT91_PIN_PA24 ++ ++#define CONFIG_BOOTDELAY 0 ++/* check for keypress even if bootdelay is 0 */ ++#define CONFIG_ZERO_BOOTDELAY_CHECK + + /* + * BOOTP options +@@ -120,12 +127,14 @@ + /* 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 ++/* MTCDT 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 ++/* MTCDT: 4-bit PMECC */ ++#define CONFIG_PMECC_CAP 4 + #define CONFIG_PMECC_SECTOR_SIZE 512 + #define CONFIG_PMECC_INDEX_TABLE_OFFSET 0x8000 + +@@ -143,6 +152,8 @@ + #define CONFIG_RMII + #define CONFIG_NET_RETRY_COUNT 20 + #define CONFIG_MACB_SEARCH_PHY ++/* enable MII command */ ++#define CONFIG_CMD_MII 1 + + #define CONFIG_SYS_LOAD_ADDR 0x22000000 /* load address */ + +@@ -153,11 +164,10 @@ + /* 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" ++/* MTCDT: read from env variables for boot */ ++#define CONFIG_BOOTCOMMAND "nboot.jffs2 ${loadaddr} 0 ${kernel_addr}; bootm ${loadaddr}" + #else + #ifdef CONFIG_SYS_USE_SPIFLASH + /* bootstrap + u-boot + env + linux in spi flash */ +@@ -172,11 +182,8 @@ + #endif + #endif + +-#define CONFIG_BOOTARGS "mem=128M console=ttyS0,115200 " \ +- "mtdparts=atmel_nand:" \ +- "8M(bootstrap/uboot/kernel)ro,-(rootfs) " \ +- "root=/dev/mtdblock1 rw " \ +- "rootfstype=ubifs ubi.mtd=1 root=ubi0:rootfs" ++/* MTCDT uses jffs2 */ ++#define CONFIG_BOOTARGS "mem=128M console=ttyS0,115200 root=/dev/mtdblock8 ro rootfstype=jffs2" + + #define CONFIG_BAUDRATE 115200 + +@@ -199,4 +206,22 @@ + #error CONFIG_USE_IRQ not supported + #endif + ++/* MTCDT 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 ++ ++/* MTCDT - enable watchdog */ ++#define CONFIG_AT91SAM9_WATCHDOG 1 ++#define CONFIG_HW_WATCHDOG 1 ++ ++#define CONFIG_EXTRA_ENV_SETTINGS \ ++ "kernel_addr=0x200000\0" \ ++ "" ++ ++ + #endif +Index: git/board/atmel/at91sam9x5ek/at91sam9x5ek.c +=================================================================== +--- git.orig/board/atmel/at91sam9x5ek/at91sam9x5ek.c 2014-10-14 16:14:46.920406821 -0500 ++++ git/board/atmel/at91sam9x5ek/at91sam9x5ek.c 2014-10-14 16:14:47.664394700 -0500 +@@ -61,7 +61,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; +@@ -266,6 +267,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; + +@@ -288,6 +292,7 @@ + #ifdef CONFIG_LCD + at91sam9x5ek_lcd_hw_init(); + #endif ++ + return 0; + } + +@@ -297,3 +302,4 @@ + CONFIG_SYS_SDRAM_SIZE); + return 0; + } ++ diff --git a/recipes-bsp/u-boot/u-boot-2012.10/u-boot-2012.10-sam9x5-eth-mii-fix.patch b/recipes-bsp/u-boot/u-boot-2012.10/u-boot-2012.10-sam9x5-eth-mii-fix.patch new file mode 100644 index 0000000..0f41ac4 --- /dev/null +++ b/recipes-bsp/u-boot/u-boot-2012.10/u-boot-2012.10-sam9x5-eth-mii-fix.patch @@ -0,0 +1,27 @@ +Index: git/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c +=================================================================== +--- git.orig/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c 2013-02-11 10:22:35.000000000 -0600 ++++ git/arch/arm/cpu/arm926ejs/at91/at91sam9x5_devices.c 2013-02-11 10:32:59.652182120 -0600 +@@ -206,14 +206,14 @@ + #ifndef CONFIG_RMII + /* Only emac0 support MII */ + if (has_emac0()) { +- at91_set_b_periph(AT91_PIO_PORTB, 16, 0); /* ECRS */ +- at91_set_b_periph(AT91_PIO_PORTB, 17, 0); /* ECOL */ +- at91_set_b_periph(AT91_PIO_PORTB, 13, 0); /* ERX2 */ +- at91_set_b_periph(AT91_PIO_PORTB, 14, 0); /* ERX3 */ +- at91_set_b_periph(AT91_PIO_PORTB, 15, 0); /* ERXCK */ +- at91_set_b_periph(AT91_PIO_PORTB, 11, 0); /* ETX2 */ +- at91_set_b_periph(AT91_PIO_PORTB, 12, 0); /* ETX3 */ +- at91_set_b_periph(AT91_PIO_PORTB, 8, 0); /* ETXER */ ++ at91_set_a_periph(AT91_PIO_PORTB, 16, 0); /* ECRS */ ++ at91_set_a_periph(AT91_PIO_PORTB, 17, 0); /* ECOL */ ++ at91_set_a_periph(AT91_PIO_PORTB, 13, 0); /* ERX2 */ ++ at91_set_a_periph(AT91_PIO_PORTB, 14, 0); /* ERX3 */ ++ at91_set_a_periph(AT91_PIO_PORTB, 15, 0); /* ERXCK */ ++ at91_set_a_periph(AT91_PIO_PORTB, 11, 0); /* ETX2 */ ++ at91_set_a_periph(AT91_PIO_PORTB, 12, 0); /* ETX3 */ ++ at91_set_a_periph(AT91_PIO_PORTB, 8, 0); /* ETXER */ + } + #endif + } diff --git a/recipes-bsp/u-boot/u-boot.inc b/recipes-bsp/u-boot/u-boot.inc new file mode 100644 index 0000000..38a8a79 --- /dev/null +++ b/recipes-bsp/u-boot/u-boot.inc @@ -0,0 +1,89 @@ +DESCRIPTION = "U-Boot - the Universal Boot Loader" +HOMEPAGE = "http://www.denx.de/wiki/U-Boot/WebHome" +SECTION = "bootloaders" +PROVIDES = "virtual/bootloader" + +inherit uboot-config deploy + +PACKAGE_ARCH = "${MACHINE_ARCH}" +EXTRA_OEMAKE = 'CROSS_COMPILE=${TARGET_PREFIX} CC="${TARGET_PREFIX}gcc ${TOOLCHAIN_OPTIONS}"' + +# Allow setting an additional version string that will be picked up by the +# u-boot build system and appended to the u-boot version. If the .scmversion +# file already exists it will not be overwritten. +UBOOT_LOCALVERSION ?= "" + +# Some versions of u-boot use .bin and others use .img. By default use .bin +# but enable individual recipes to change this value. +UBOOT_SUFFIX ?= "bin" +UBOOT_IMAGE ?= "u-boot-${MACHINE}-${PV}-${PR}.${UBOOT_SUFFIX}" +UBOOT_BINARY ?= "u-boot.${UBOOT_SUFFIX}" +UBOOT_SYMLINK ?= "u-boot-${MACHINE}.${UBOOT_SUFFIX}" +UBOOT_MAKE_TARGET ?= "all" + +# Some versions of u-boot build an SPL (Second Program Loader) image that +# should be packaged along with the u-boot binary as well as placed in the +# deploy directory. For those versions they can set the following variables +# to allow packaging the SPL. +SPL_BINARY ?= "" +SPL_IMAGE ?= "${SPL_BINARY}-${MACHINE}-${PV}-${PR}" +SPL_SYMLINK ?= "${SPL_BINARY}-${MACHINE}" + +do_compile () { + if [ "${@base_contains('DISTRO_FEATURES', 'ld-is-gold', 'ld-is-gold', '', d)}" = "ld-is-gold" ] ; then + sed -i 's/$(CROSS_COMPILE)ld$/$(CROSS_COMPILE)ld.bfd/g' config.mk + fi + + unset LDFLAGS + unset CFLAGS + unset CPPFLAGS + + if [ ! -e ${B}/.scmversion -a ! -e ${S}/.scmversion ] + then + echo ${UBOOT_LOCALVERSION} > ${B}/.scmversion + echo ${UBOOT_LOCALVERSION} > ${S}/.scmversion + fi + + oe_runmake ${UBOOT_MACHINE} + oe_runmake ${UBOOT_MAKE_TARGET} +} + +do_install () { + install -d ${D}/boot + install ${S}/${UBOOT_BINARY} ${D}/boot/${UBOOT_IMAGE} + ln -sf ${UBOOT_IMAGE} ${D}/boot/${UBOOT_BINARY} + + if [ -e ${WORKDIR}/fw_env.config ] ; then + install -d ${D}${sysconfdir} + install -m 644 ${WORKDIR}/fw_env.config ${D}${sysconfdir}/fw_env.config + fi + + if [ "x${SPL_BINARY}" != "x" ] + then + install ${S}/${SPL_BINARY} ${D}/boot/${SPL_IMAGE} + ln -sf ${SPL_IMAGE} ${D}/boot/${SPL_BINARY} + fi +} + +FILES_${PN} = "/boot ${sysconfdir}" +FILESPATH =. "${FILE_DIRNAME}/u-boot-git/${MACHINE}:" + +do_deploy () { + install -d ${DEPLOYDIR} + install ${S}/${UBOOT_BINARY} ${DEPLOYDIR}/${UBOOT_IMAGE} + + cd ${DEPLOYDIR} + rm -f ${UBOOT_BINARY} ${UBOOT_SYMLINK} + ln -sf ${UBOOT_IMAGE} ${UBOOT_SYMLINK} + ln -sf ${UBOOT_IMAGE} ${UBOOT_BINARY} + + if [ "x${SPL_BINARY}" != "x" ] + then + install ${S}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_IMAGE} + rm -f ${DEPLOYDIR}/${SPL_BINARY} ${DEPLOYDIR}/${SPL_SYMLINK} + ln -sf ${SPL_IMAGE} ${DEPLOYDIR}/${SPL_BINARY} + ln -sf ${SPL_IMAGE} ${DEPLOYDIR}/${SPL_SYMLINK} + fi +} + +addtask deploy before do_build after do_compile diff --git a/recipes-bsp/u-boot/u-boot_2012.10.bb b/recipes-bsp/u-boot/u-boot_2012.10.bb new file mode 100644 index 0000000..9763e0a --- /dev/null +++ b/recipes-bsp/u-boot/u-boot_2012.10.bb @@ -0,0 +1,38 @@ +PR = "r4" +require u-boot.inc + +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://COPYING;md5=1707d6db1d42237583f50183a5651ecb" + +DEFAULT_PREFERENCE = "-1" + +# U-Boot 2012.10 for AT91 +# tag: linux4sam_4.0 +SRCREV="8978bdafbad84c0c9878c9ff331930ca6edf9a76" + +SRC_URI = "git://github.com/linux4sam/u-boot-at91.git;branch=u-boot-2012.10-at91 \ + file://u-boot-2012.10-sam9x5-eth-mii-fix.patch \ + " + +# add patch to speed up boot if ethernet autonegotiation fails +SRC_URI += "file://u-boot-2010.06-macb-autoneg-timeout.patch" + +SRC_URI_append_mtcdt = " file://u-boot-2012.10-mtcdt.patch" + +TARGET_LDFLAGS = "" + +S = "${WORKDIR}/git" + +inherit base + +do_configure_prepend() { + mv -f tools/setlocalversion tools/setlocalversion.old + echo -e "#!/bin/sh\necho '-${MACHINE}-${PR}'" > tools/setlocalversion + chmod a+rx tools/setlocalversion +} + +do_compile () { + oe_runmake ${UBOOT_MACHINE} + oe_runmake all +} + |