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 | |
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')
19 files changed, 724 insertions, 0 deletions
diff --git a/recipes-bsp/at91bootstrap/at91bootstrap-3.5.3/at91bootstrap-3.5.2-add-install.patch b/recipes-bsp/at91bootstrap/at91bootstrap-3.5.3/at91bootstrap-3.5.2-add-install.patch new file mode 100644 index 0000000..6f007b9 --- /dev/null +++ b/recipes-bsp/at91bootstrap/at91bootstrap-3.5.3/at91bootstrap-3.5.2-add-install.patch @@ -0,0 +1,20 @@ +Index: at91bootstrap-3.5.2/Makefile +=================================================================== +--- at91bootstrap-3.5.2.orig/Makefile 2013-02-08 14:38:40.660054339 -0600 ++++ at91bootstrap-3.5.2/Makefile 2013-02-08 14:41:30.626272862 -0600 +@@ -359,4 +359,15 @@ + + PHONY+=tarball tarballx + ++install: ++ -install -d $(DESTDIR) ++ install $(AT91BOOTSTRAP) $(DESTDIR)/$(IMAGE) ++ -rm -f $(DESTDIR)/$(SYMLINK) ++ (cd ${DESTDIR} ; \ ++ ln -sf ${IMAGE} ${SYMLINK} \ ++ ) ++ ++ ++PHONY+=install ++ + .PHONY: $(PHONY) diff --git a/recipes-bsp/at91bootstrap/at91bootstrap-3.5.3/at91bootstrap-3.5.2-onetime-slow-clock-switch.patch b/recipes-bsp/at91bootstrap/at91bootstrap-3.5.3/at91bootstrap-3.5.2-onetime-slow-clock-switch.patch new file mode 100644 index 0000000..98ccd41 --- /dev/null +++ b/recipes-bsp/at91bootstrap/at91bootstrap-3.5.3/at91bootstrap-3.5.2-onetime-slow-clock-switch.patch @@ -0,0 +1,91 @@ +Index: at91bootstrap-3.5.2/driver/at91_slowclk.c +=================================================================== +--- at91bootstrap-3.5.2.orig/driver/at91_slowclk.c 2013-01-30 04:01:20.000000000 -0600 ++++ at91bootstrap-3.5.2/driver/at91_slowclk.c 2013-04-24 11:35:44.369827054 -0500 +@@ -33,12 +33,17 @@ + { + unsigned int reg; + +- /* +- * Enable the 32768 Hz oscillator by setting the bit OSC32EN to 1 +- */ ++ + reg = readl(AT91C_BASE_SCKCR); +- reg |= AT91C_SLCKSEL_OSC32EN; +- writel(reg, AT91C_BASE_SCKCR); ++ ++ /* Only enable 32768 Hz oscillator if needed */ ++ if ( !(reg & AT91C_SLCKSEL_OSC32EN) ) { ++ /* ++ * Enable the 32768 Hz oscillator by setting the bit OSC32EN to 1 ++ */ ++ reg |= AT91C_SLCKSEL_OSC32EN; ++ writel(reg, AT91C_BASE_SCKCR); ++ } + + /* start a internal timer */ + start_interval_timer(); +@@ -50,32 +55,40 @@ + { + unsigned int reg; + +- /* +- * Wait 32768 Hz Startup Time for clock stabilization (software loop) +- * wait about 1s (1000ms) +- */ +- wait_interval_timer(1000); +- +- /* +- * Switching from internal 32kHz RC oscillator to 32768 Hz oscillator +- * by setting the bit OSCSEL to 1 +- */ + reg = readl(AT91C_BASE_SCKCR); +- reg |= AT91C_SLCKSEL_OSCSEL; +- writel(reg, AT91C_BASE_SCKCR); + +- /* +- * Waiting 5 slow clock cycles for internal resynchronization +- * 5 slow clock cycles = ~153 us (5 / 32768) +- */ +- udelay(153); +- +- /* +- * Disable the 32kHz RC oscillator by setting the bit RCEN to 0 +- */ ++ /* Only switch clock source if needed */ ++ if ( !(reg & AT91C_SLCKSEL_OSCSEL) ) { ++ dbgu_print("Switching slow clock to external oscillator...\n\r"); ++ /* ++ * Wait 32768 Hz Startup Time for clock stabilization (software loop) ++ * wait about 1s (1000ms) ++ */ ++ wait_interval_timer(1000); ++ ++ /* ++ * Switching from internal 32kHz RC oscillator to 32768 Hz oscillator ++ * by setting the bit OSCSEL to 1 ++ */ ++ reg |= AT91C_SLCKSEL_OSCSEL; ++ writel(reg, AT91C_BASE_SCKCR); ++ ++ /* ++ * Waiting 5 slow clock cycles for internal resynchronization ++ * 5 slow clock cycles = ~153 us (5 / 32768) ++ */ ++ udelay(153); ++ } ++ ++ /* Only disable internal RC oscillator if needed */ + reg = readl(AT91C_BASE_SCKCR); +- reg &= ~AT91C_SLCKSEL_RCEN; +- writel(reg, AT91C_BASE_SCKCR); ++ if (reg | AT91C_SLCKSEL_RCEN) { ++ /* ++ * Disable the 32kHz RC oscillator by setting the bit RCEN to 0 ++ */ ++ reg &= ~AT91C_SLCKSEL_RCEN; ++ writel(reg, AT91C_BASE_SCKCR); ++ } + + return 0; + } diff --git a/recipes-bsp/at91bootstrap/at91bootstrap-3.5.3/at91bootstrap-3.5.3-mtcdt.patch b/recipes-bsp/at91bootstrap/at91bootstrap-3.5.3/at91bootstrap-3.5.3-mtcdt.patch new file mode 100644 index 0000000..24c27a0 --- /dev/null +++ b/recipes-bsp/at91bootstrap/at91bootstrap-3.5.3/at91bootstrap-3.5.3-mtcdt.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); ++ /* MTCDT */ ++ 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 ++ /* MTCDT */ + 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/at91sam9x5_4bit_pmecc_header.bin b/recipes-bsp/at91bootstrap/at91bootstrap-3.5.3/at91sam9x5_4bit_pmecc_header.bin new file mode 100644 index 0000000..f8d6073 --- /dev/null +++ b/recipes-bsp/at91bootstrap/at91bootstrap-3.5.3/at91sam9x5_4bit_pmecc_header.bin @@ -0,0 +1 @@ +$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
\ No newline at end of file diff --git a/recipes-bsp/at91bootstrap/at91bootstrap-3.5.3/create_4bit_pmecc_header.rb b/recipes-bsp/at91bootstrap/at91bootstrap-3.5.3/create_4bit_pmecc_header.rb new file mode 100755 index 0000000..780d728 --- /dev/null +++ b/recipes-bsp/at91bootstrap/at91bootstrap-3.5.3/create_4bit_pmecc_header.rb @@ -0,0 +1,5 @@ +#!/usr/bin/env ruby + +52.times do + print ["052490c0"].pack('H*') +end diff --git a/recipes-bsp/at91bootstrap/at91bootstrap_3.5.3.bb b/recipes-bsp/at91bootstrap/at91bootstrap_3.5.3.bb new file mode 100644 index 0000000..447d77f --- /dev/null +++ b/recipes-bsp/at91bootstrap/at91bootstrap_3.5.3.bb @@ -0,0 +1,28 @@ +require at91bootstrap_3.5.inc + +PR = "r1" + +LICENSE = "custom-freely-distributable" +LIC_FILES_CHKSUM = "file://main.c;beginline=6;endline=26;md5=6fca71334c9e8b7d033296123c91437f" + +SRCREV = "v${PV}" +SRC_URI = "git://github.com/linux4sam/at91bootstrap \ + file://at91bootstrap-3.5.2-add-install.patch \ + file://at91bootstrap-3.5.2-onetime-slow-clock-switch.patch \ + file://at91sam9x5_4bit_pmecc_header.bin " + +S = "${WORKDIR}/git" + +SRC_URI_append_mtcdt = " file://at91bootstrap-3.5.3-mtcdt.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 +do_pad_4bit_pmecc() { + cp -f ${WORKDIR}/at91sam9x5_4bit_pmecc_header.bin ${DEPLOY_DIR_IMAGE}/at91bootstrap_pmecc_padded.bin + cat ${DEPLOY_DIR_IMAGE}/at91bootstrap.bin >> ${DEPLOY_DIR_IMAGE}/at91bootstrap_pmecc_padded.bin +} + +do_install_append() { + do_pad_4bit_pmecc +} + diff --git a/recipes-bsp/at91bootstrap/at91bootstrap_3.5.inc b/recipes-bsp/at91bootstrap/at91bootstrap_3.5.inc new file mode 100644 index 0000000..ac147c0 --- /dev/null +++ b/recipes-bsp/at91bootstrap/at91bootstrap_3.5.inc @@ -0,0 +1,27 @@ +DESCRIPTION = "at91bootstrap: loaded into internal SRAM by AT91 BootROM" +SECTION = "bootloaders" + +PARALLEL_MAKE = "" + +PACKAGE_ARCH = "${MACHINE_ARCH}" +EXTRA_OEMAKE = "CROSS_COMPILE=${TARGET_PREFIX} DESTDIR=${DEPLOY_DIR_IMAGE} REVISION=${PR}" + +do_compile () { + unset LDFLAGS + unset CFLAGS + unset CPPFLAGS + + rm -Rf ${S}/binaries + for board in ${AT91BOOTSTRAP_BOARD} ; do + oe_runmake mrproper + filename=`find board -name ${board}_defconfig` + if ! [ "x$filename" == "x" ] ; then + cp $filename .config + oe_runmake + oe_runmake install + else + echo "${board} could not be built" + exit 1 + fi + done +} diff --git a/recipes-bsp/multitech/mts-id-eeprom.inc b/recipes-bsp/multitech/mts-id-eeprom.inc new file mode 100644 index 0000000..d0510b4 --- /dev/null +++ b/recipes-bsp/multitech/mts-id-eeprom.inc @@ -0,0 +1,15 @@ +DESCRIPTION = "ID EEPROM tool for MTCDP" +HOMEPAGE = "http://www.multitech.net/" +SECTION = "console/utils" +PRIORITY = "optional" +LICENSE = "GPLv2+" +LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f" +INC_PR = "r0" +DEPENDS = "mts-io" + +SRC_URI = "git://git.multitech.net/mts-id-eeprom.git;protocol=git;tag=${PV}" +S = "${WORKDIR}/git" + +inherit autotools + +PARALLEL_MAKE = "" diff --git a/recipes-bsp/multitech/mts-id-eeprom_0.2.4.bb b/recipes-bsp/multitech/mts-id-eeprom_0.2.4.bb new file mode 100644 index 0000000..ccf3521 --- /dev/null +++ b/recipes-bsp/multitech/mts-id-eeprom_0.2.4.bb @@ -0,0 +1,3 @@ +require mts-id-eeprom.inc + +PR = "${INC_PR}.0" diff --git a/recipes-bsp/multitech/mts-io.inc b/recipes-bsp/multitech/mts-io.inc new file mode 100644 index 0000000..484124e --- /dev/null +++ b/recipes-bsp/multitech/mts-io.inc @@ -0,0 +1,76 @@ +DESCRIPTION = "mts-io controller and sysfs wrapper" +HOMEPAGE = "http://www.multitech.net/" +SECTION = "base" +PRIORITY = "optional" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://io-module/COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \ + file://io-tool/COPYING;md5=94d55d512a9ba36caa9b7df079bae19f \ +" +DEPENDS = "virtual/kernel" +INC_PR = "r5" + +SRCREV = "v${PV}" + +SRC_URI = " \ + file://mts-io.init \ + git://git.multitech.net/mts-io.git;protocol=git \ + file://led-a_heartbeat_trigger \ +" +S = "${WORKDIR}/git" + +inherit module-base +inherit update-rc.d + +# add this since we aren't using module.bbclass +addtask make_scripts after do_patch before do_compile +do_make_scripts[lockfiles] = "${TMPDIR}/kernel-scripts.lock" +do_make_scripts[deptask] = "do_populate_sysroot" + +EXTRA_OEMAKE = " -C ${STAGING_KERNEL_DIR} \ + KBUILD_VERBOSE=1 \ + M=${S}/io-module \ + modules \ + " + +do_compile () { + unset CFLAGS CPPFLAGS CXXFLAGS LDFLAGS + oe_runmake +} + +PACKAGES = "${PN}" + +FILES_${PN} = "${base_libdir}/modules/${KERNEL_VERSION}/extra/mts_io.ko" +FILES_${PN} += "${sysconfdir}/init.d/mts-io" +FILES_${PN} += "${libdir}/mts-io-sysfs*" +FILES_${PN} += "${sbindir}/mts-io-sysfs" +FILES_${PN} += "${sysconfdir}/init.d/led-a_heartbeat_trigger" +FILES_${PN} += "${sysconfdir}/rc5.d/S99led-a_heartbeat_trigger" + +INITSCRIPT_NAME = "mts-io" +INITSCRIPT_PARAMS = "start 39 S ." + +PARALLEL_MAKE = "" + +fakeroot do_install () { + install -m 0755 -d ${D}${base_libdir}/modules/${KERNEL_VERSION}/extra + # use cp instead of install so the driver doesn't get stripped + cp io-module/mts_io.ko ${D}${base_libdir}/modules/${KERNEL_VERSION}/extra + cp io-module/mts_io.h ${STAGING_KERNEL_DIR}/include/linux/ + cp io-module/mts_io.h ${STAGING_INCDIR}/linux/ + if [ -f io-module/mts_eeprom.h ]; then + cp io-module/mts_eeprom.h ${STAGING_KERNEL_DIR}/include/linux/ + cp io-module/mts_eeprom.h ${STAGING_INCDIR}/linux/ + fi + + install -d ${D}${sysconfdir}/init.d + install -m 0755 ${WORKDIR}/mts-io.init ${D}${sysconfdir}/init.d/mts-io + + install -d ${D}/${sysconfdir}/rc5.d + install -m 0755 ${WORKDIR}/led-a_heartbeat_trigger ${D}/${sysconfdir}/init.d/ + ln -sf ${sysconfdir}/init.d/led-a_heartbeat_trigger ${D}/${sysconfdir}/rc5.d/S99led-a_heartbeat_trigger + + install -m 0755 -d ${D}${sbindir} + install -d ${D}${libdir}/mts-io-sysfs + install -m 0755 io-tool/mts-io-sysfs-inc.sh ${D}${libdir}/mts-io-sysfs + install -m 0755 io-tool/mts-io-sysfs ${D}${sbindir}/mts-io-sysfs +} diff --git a/recipes-bsp/multitech/mts-io/led-a_heartbeat_trigger b/recipes-bsp/multitech/mts-io/led-a_heartbeat_trigger new file mode 100755 index 0000000..9633dcf --- /dev/null +++ b/recipes-bsp/multitech/mts-io/led-a_heartbeat_trigger @@ -0,0 +1,6 @@ +#!/bin/bash + +TRIGGER="/sys/class/leds/led-a/trigger" + +echo "setting $TRIGGER to heartbeat" +echo "heartbeat" > $TRIGGER diff --git a/recipes-bsp/multitech/mts-io/mts-io.init b/recipes-bsp/multitech/mts-io/mts-io.init new file mode 100644 index 0000000..77dd0e2 --- /dev/null +++ b/recipes-bsp/multitech/mts-io/mts-io.init @@ -0,0 +1,20 @@ +#!/bin/sh + +case $1 in + start) + echo "Loading mts-io module" + modprobe mts_io + ;; + + stop) + echo "Unloading mts-io module" + modprobe -r mts_io + ;; + + *) + echo "Usage: $0 {start|stop}" + exit 2 + ;; +esac + + diff --git a/recipes-bsp/multitech/mts-io_0.9.1.bb b/recipes-bsp/multitech/mts-io_0.9.1.bb new file mode 100644 index 0000000..6d60671 --- /dev/null +++ b/recipes-bsp/multitech/mts-io_0.9.1.bb @@ -0,0 +1,3 @@ +require mts-io.inc + +SRCREV_mtcdt = "cdf9e59ab6a793bb158c91c91aa0312a72211ad0" diff --git a/recipes-bsp/multitech/u-boot-linux-utils_0.0.1.bb b/recipes-bsp/multitech/u-boot-linux-utils_0.0.1.bb new file mode 100644 index 0000000..36510f8 --- /dev/null +++ b/recipes-bsp/multitech/u-boot-linux-utils_0.0.1.bb @@ -0,0 +1,19 @@ +DESCRIPTION = "U-Boot Linux Utilities" +HOMEPAGE = "http://www.multitech.net/" +SECTION = "console/utils" +PRIORITY = "optional" +LICENSE = "GPLv2" +LIC_FILES_CHKSUM = "file://COPYING;md5=94d55d512a9ba36caa9b7df079bae19f" +PR = "r0" + +DEPENDS = "mtd-utils" + +# tag 0.0.1 +SRCREV = "9c154405c2d01648f41c6a72bcc96f9865c4f07c" + +SRC_URI = "git://git.multitech.net/u-boot-linux-utils.git;protocol=git" +S = "${WORKDIR}/git" + +inherit autotools + +PARALLEL_MAKE = "" 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 +} + |