From 812befa503067ad2bae5de58962ff38321c369ca Mon Sep 17 00:00:00 2001 From: Jesse Gilles Date: Tue, 4 Nov 2014 11:23:21 -0600 Subject: initial commit with MTCDT support --- COPYING.MIT | 17 + README | 8 + classes/linux-append-dtb.bbclass | 8 + conf/layer.conf | 10 + conf/machine/mtcdt.conf | 39 + contrib/uboot-setenv-mtcdt.minicom | 60 + .../at91bootstrap-3.5.2-add-install.patch | 20 + ...bootstrap-3.5.2-onetime-slow-clock-switch.patch | 91 + .../at91bootstrap-3.5.3-mtcdt.patch | 60 + .../at91sam9x5_4bit_pmecc_header.bin | 1 + .../create_4bit_pmecc_header.rb | 5 + recipes-bsp/at91bootstrap/at91bootstrap_3.5.3.bb | 28 + recipes-bsp/at91bootstrap/at91bootstrap_3.5.inc | 27 + recipes-bsp/multitech/mts-id-eeprom.inc | 15 + recipes-bsp/multitech/mts-id-eeprom_0.2.4.bb | 3 + recipes-bsp/multitech/mts-io.inc | 76 + .../multitech/mts-io/led-a_heartbeat_trigger | 6 + recipes-bsp/multitech/mts-io/mts-io.init | 20 + recipes-bsp/multitech/mts-io_0.9.1.bb | 3 + recipes-bsp/multitech/u-boot-linux-utils_0.0.1.bb | 19 + .../u-boot-2010.06-macb-autoneg-timeout.patch | 53 + .../u-boot-2012.10/u-boot-2012.10-mtcdt.patch | 143 + .../u-boot-2012.10-sam9x5-eth-mii-fix.patch | 27 + recipes-bsp/u-boot/u-boot.inc | 89 + recipes-bsp/u-boot/u-boot_2012.10.bb | 38 + recipes-devtools/mtd/mtd-utils_git.bbappend | 5 + ....12-add-num_accessory_ports-config-option.patch | 22 + .../linux-3.12-at91-gpio-pullup.patch | 42 + .../linux-3.12-at91sam9_wdt-10second-timeout.patch | 14 + .../linux-3.12-atmel-mci-force-detect.patch | 29 + .../linux-3.12-atmel-pmecc-debug-bitflips.patch | 22 + .../linux/linux-3.12.27/linux-3.12-atmel-spi.patch | 37 + .../linux-3.12-cdc-acm-ignore-exar-devices.patch | 35 + .../linux-3.12-gpio-expose-deglitch.patch | 165 ++ .../linux-3.12-gpio-expose-pullups.patch | 301 ++ .../linux-3.12-release-rfcomm-port-fix.patch | 78 + .../linux-3.12.27/linux-3.12.27-option-telit.patch | 39 + recipes-kernel/linux/linux-3.12.27/mtcdt/defconfig | 2876 ++++++++++++++++++++ .../mtcdt/linux-3.12-eeprom-setup-mtcdt.patch | 164 ++ .../mtcdt/linux-3.12-mtcdt-device-tree.patch | 448 +++ recipes-kernel/linux/linux_3.12.27.bb | 40 + recipes-kernel/vizzini/files/vizzini.init | 22 + .../vizzini-1.1-enable-cts.patch | 32 + .../vizzini-1.1-rs485.patch | 102 + .../xr21v141x-lnx3.10-3.11.tar.gz | Bin 0 -> 16958 bytes .../vizzini/kernel-module-vizzini_1.1.bb | 10 + recipes-kernel/vizzini/vizzini.inc | 48 + 47 files changed, 5397 insertions(+) create mode 100644 COPYING.MIT create mode 100644 README create mode 100644 classes/linux-append-dtb.bbclass create mode 100644 conf/layer.conf create mode 100644 conf/machine/mtcdt.conf create mode 100644 contrib/uboot-setenv-mtcdt.minicom create mode 100644 recipes-bsp/at91bootstrap/at91bootstrap-3.5.3/at91bootstrap-3.5.2-add-install.patch create mode 100644 recipes-bsp/at91bootstrap/at91bootstrap-3.5.3/at91bootstrap-3.5.2-onetime-slow-clock-switch.patch create mode 100644 recipes-bsp/at91bootstrap/at91bootstrap-3.5.3/at91bootstrap-3.5.3-mtcdt.patch create mode 100644 recipes-bsp/at91bootstrap/at91bootstrap-3.5.3/at91sam9x5_4bit_pmecc_header.bin create mode 100755 recipes-bsp/at91bootstrap/at91bootstrap-3.5.3/create_4bit_pmecc_header.rb create mode 100644 recipes-bsp/at91bootstrap/at91bootstrap_3.5.3.bb create mode 100644 recipes-bsp/at91bootstrap/at91bootstrap_3.5.inc create mode 100644 recipes-bsp/multitech/mts-id-eeprom.inc create mode 100644 recipes-bsp/multitech/mts-id-eeprom_0.2.4.bb create mode 100644 recipes-bsp/multitech/mts-io.inc create mode 100755 recipes-bsp/multitech/mts-io/led-a_heartbeat_trigger create mode 100644 recipes-bsp/multitech/mts-io/mts-io.init create mode 100644 recipes-bsp/multitech/mts-io_0.9.1.bb create mode 100644 recipes-bsp/multitech/u-boot-linux-utils_0.0.1.bb create mode 100644 recipes-bsp/u-boot/u-boot-2012.10/u-boot-2010.06-macb-autoneg-timeout.patch create mode 100644 recipes-bsp/u-boot/u-boot-2012.10/u-boot-2012.10-mtcdt.patch create mode 100644 recipes-bsp/u-boot/u-boot-2012.10/u-boot-2012.10-sam9x5-eth-mii-fix.patch create mode 100644 recipes-bsp/u-boot/u-boot.inc create mode 100644 recipes-bsp/u-boot/u-boot_2012.10.bb create mode 100644 recipes-devtools/mtd/mtd-utils_git.bbappend create mode 100644 recipes-kernel/linux/linux-3.12.27/linux-3.12-add-num_accessory_ports-config-option.patch create mode 100644 recipes-kernel/linux/linux-3.12.27/linux-3.12-at91-gpio-pullup.patch create mode 100644 recipes-kernel/linux/linux-3.12.27/linux-3.12-at91sam9_wdt-10second-timeout.patch create mode 100644 recipes-kernel/linux/linux-3.12.27/linux-3.12-atmel-mci-force-detect.patch create mode 100644 recipes-kernel/linux/linux-3.12.27/linux-3.12-atmel-pmecc-debug-bitflips.patch create mode 100644 recipes-kernel/linux/linux-3.12.27/linux-3.12-atmel-spi.patch create mode 100644 recipes-kernel/linux/linux-3.12.27/linux-3.12-cdc-acm-ignore-exar-devices.patch create mode 100644 recipes-kernel/linux/linux-3.12.27/linux-3.12-gpio-expose-deglitch.patch create mode 100644 recipes-kernel/linux/linux-3.12.27/linux-3.12-gpio-expose-pullups.patch create mode 100644 recipes-kernel/linux/linux-3.12.27/linux-3.12-release-rfcomm-port-fix.patch create mode 100644 recipes-kernel/linux/linux-3.12.27/linux-3.12.27-option-telit.patch create mode 100644 recipes-kernel/linux/linux-3.12.27/mtcdt/defconfig create mode 100644 recipes-kernel/linux/linux-3.12.27/mtcdt/linux-3.12-eeprom-setup-mtcdt.patch create mode 100644 recipes-kernel/linux/linux-3.12.27/mtcdt/linux-3.12-mtcdt-device-tree.patch create mode 100644 recipes-kernel/linux/linux_3.12.27.bb create mode 100644 recipes-kernel/vizzini/files/vizzini.init create mode 100644 recipes-kernel/vizzini/kernel-module-vizzini-1.1/vizzini-1.1-enable-cts.patch create mode 100644 recipes-kernel/vizzini/kernel-module-vizzini-1.1/vizzini-1.1-rs485.patch create mode 100644 recipes-kernel/vizzini/kernel-module-vizzini-1.1/xr21v141x-lnx3.10-3.11.tar.gz create mode 100644 recipes-kernel/vizzini/kernel-module-vizzini_1.1.bb create mode 100644 recipes-kernel/vizzini/vizzini.inc diff --git a/COPYING.MIT b/COPYING.MIT new file mode 100644 index 0000000..fb950dc --- /dev/null +++ b/COPYING.MIT @@ -0,0 +1,17 @@ +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. diff --git a/README b/README new file mode 100644 index 0000000..c473bb3 --- /dev/null +++ b/README @@ -0,0 +1,8 @@ +MultiTech hardware support OpenEmbedded layer + +This layer depends on: + +URI: git://git.openembedded.org/openembedded-core +branch: daisy +revision: HEAD + diff --git a/classes/linux-append-dtb.bbclass b/classes/linux-append-dtb.bbclass new file mode 100644 index 0000000..6d3e52d --- /dev/null +++ b/classes/linux-append-dtb.bbclass @@ -0,0 +1,8 @@ +# build devicetree blob, append to kernel, and create uImage +do_compile_append() { + if [ -n "${DTB_APPEND}" ]; then + oe_runmake ${DTB_APPEND}.dtb + cat arch/${ARCH}/boot/zImage arch/${ARCH}/boot/dts/${DTB_APPEND}.dtb > arch/${ARCH}/boot/zImage.dtb + uboot-mkimage -A ${UBOOT_ARCH} -O linux -T kernel -C none -a ${UBOOT_LOADADDRESS} -e ${UBOOT_ENTRYPOINT} -n "${DISTRO_NAME}/${PV}/${MACHINE}" -d arch/${ARCH}/boot/zImage.dtb arch/${ARCH}/boot/uImage + fi +} diff --git a/conf/layer.conf b/conf/layer.conf new file mode 100644 index 0000000..f33c49f --- /dev/null +++ b/conf/layer.conf @@ -0,0 +1,10 @@ +# We have a conf and classes directory, add to BBPATH +BBPATH .= ":${LAYERDIR}" + +# We have a recipes-* directories, add to BBFILES +BBFILES += "${LAYERDIR}/recipes-*/*/*.bb \ + ${LAYERDIR}/recipes-*/*/*.bbappend" + +BBFILE_COLLECTIONS += "multitech" +BBFILE_PATTERN_multitech = "^${LAYERDIR}/" +BBFILE_PRIORITY_multitech = "6" diff --git a/conf/machine/mtcdt.conf b/conf/machine/mtcdt.conf new file mode 100644 index 0000000..59aac2b --- /dev/null +++ b/conf/machine/mtcdt.conf @@ -0,0 +1,39 @@ +#@TYPE: Machine +#@Name: Multi-Tech MTCDT +#@DESCRIPTION: Machine configuration for the MultiConnect Conduit MTCDT 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.27" +PREFERRED_VERSION_mts-io ?= "0.9.1" +PREFERRED_VERSION_mts-id-eeprom ?= "0.2.4" + +MACHINE_ESSENTIAL_EXTRA_RDEPENDS = "kernel-module-vizzini" +PREFERRED_VERSION_kernel-module-vizzini ?= "1.1" + +DEFAULTTUNE = "arm926ejs" + +# 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 = "2012.10" + +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" diff --git a/contrib/uboot-setenv-mtcdt.minicom b/contrib/uboot-setenv-mtcdt.minicom new file mode 100644 index 0000000..200a7a4 --- /dev/null +++ b/contrib/uboot-setenv-mtcdt.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 tftpaddr 0x20000000 +send setenv stdin serial +send setenv stdout serial +send setenv stderr serial +send setenv ethact macb0 +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 \'tftp ${tftpaddr} ${bootstrap_file} && run erase_bootstrap && nand write.jffs2 ${fileaddr} bootstrap ${filesize}\' +send setenv tftp_uboot \'tftp ${tftpaddr} ${uboot_file} && run erase_uboot && nand write.jffs2 ${fileaddr} u-boot ${filesize}\' +send setenv tftp_uboot_env1 \'tftp ${tftpaddr} ${uboot_env1_file} && run erase_uboot_env1 && nand write.jffs2 ${fileaddr} u-boot-env1 ${filesize}\' +send setenv tftp_uboot_env2 \'tftp ${tftpaddr} ${uboot_env2_file} && run erase_uboot_env2 && nand write.jffs2 ${fileaddr} u-boot-env2 ${filesize}\' +send setenv tftp_kernel \'tftp ${tftpaddr} ${kernel_file} && run erase_kernel && nand write.jffs2 ${fileaddr} kernel ${filesize}\' +send setenv tftp_config \'tftp ${tftpaddr} ${config_file} && run erase_config && nand write.jffs2 ${fileaddr} config ${filesize}\' +send setenv tftp_oem \'tftp ${tftpaddr} ${oem_file} && run erase_oem && nand write.jffs2 ${fileaddr} oem ${filesize}\' +send setenv tftp_rootfs \'tftp ${tftpaddr} ${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.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 +} + diff --git a/recipes-devtools/mtd/mtd-utils_git.bbappend b/recipes-devtools/mtd/mtd-utils_git.bbappend new file mode 100644 index 0000000..83fb1a0 --- /dev/null +++ b/recipes-devtools/mtd/mtd-utils_git.bbappend @@ -0,0 +1,5 @@ +# install jffs-user.h which was removed from linux-headers +do_install_append() { + install -d ${D}${includedir}/mtd + install -m 644 include/mtd/jffs2-user.h ${D}${includedir}/mtd/ +} diff --git a/recipes-kernel/linux/linux-3.12.27/linux-3.12-add-num_accessory_ports-config-option.patch b/recipes-kernel/linux/linux-3.12.27/linux-3.12-add-num_accessory_ports-config-option.patch new file mode 100644 index 0000000..d1bd7cd --- /dev/null +++ b/recipes-kernel/linux/linux-3.12.27/linux-3.12-add-num_accessory_ports-config-option.patch @@ -0,0 +1,22 @@ +Index: linux-3.12.13/arch/arm/Kconfig +=================================================================== +--- linux-3.12.13.orig/arch/arm/Kconfig 2014-02-22 15:32:50.000000000 -0600 ++++ linux-3.12.13/arch/arm/Kconfig 2014-09-11 14:57:00.908030666 -0500 +@@ -276,6 +276,17 @@ + + source "kernel/Kconfig.freezer" + ++menu "MTS" ++ ++config MTS_NUM_ACCESSORY_PORTS ++ int "Number of accessory ports in the MTS product" ++ default 0 ++ help ++ Enter the number of accessory ports on your MTS device. ++ If unsure, say '0'. ++ ++endmenu ++ + menu "System Type" + + config MMU diff --git a/recipes-kernel/linux/linux-3.12.27/linux-3.12-at91-gpio-pullup.patch b/recipes-kernel/linux/linux-3.12.27/linux-3.12-at91-gpio-pullup.patch new file mode 100644 index 0000000..583a205 --- /dev/null +++ b/recipes-kernel/linux/linux-3.12.27/linux-3.12-at91-gpio-pullup.patch @@ -0,0 +1,42 @@ +Index: linux-3.12.13/arch/arm/mach-at91/gpio.c +=================================================================== +--- linux-3.12.13.orig/arch/arm/mach-at91/gpio.c 2014-02-22 15:32:50.000000000 -0600 ++++ linux-3.12.13/arch/arm/mach-at91/gpio.c 2014-03-07 09:13:09.931501303 -0600 +@@ -294,6 +294,25 @@ + } + EXPORT_SYMBOL(at91_set_gpio_output); + ++/* ++ * configure pin for output and enable/disable pullup ++ */ ++int __init_or_module at91_set_gpio_output_with_pullup(unsigned pin, int value, int use_pullup) ++{ ++ void __iomem *pio = pin_to_controller(pin); ++ unsigned mask = pin_to_mask(pin); ++ ++ if (!pio) ++ return -EINVAL; ++ ++ __raw_writel(mask, pio + PIO_IDR); ++ __raw_writel(mask, pio + (use_pullup ? PIO_PUER : PIO_PUDR)); ++ __raw_writel(mask, pio + (value ? PIO_SODR : PIO_CODR)); ++ __raw_writel(mask, pio + PIO_OER); ++ __raw_writel(mask, pio + PIO_PER); ++ return 0; ++} ++EXPORT_SYMBOL(at91_set_gpio_output_with_pullup); + + /* + * enable/disable the glitch filter; mostly used with IRQ handling. +Index: linux-3.12.13/arch/arm/mach-at91/include/mach/gpio.h +=================================================================== +--- linux-3.12.13.orig/arch/arm/mach-at91/include/mach/gpio.h 2014-02-22 15:32:50.000000000 -0600 ++++ linux-3.12.13/arch/arm/mach-at91/include/mach/gpio.h 2014-03-07 09:13:39.331501866 -0600 +@@ -195,6 +195,7 @@ + extern int __init_or_module at91_set_D_periph(unsigned pin, int use_pullup); + extern int __init_or_module at91_set_gpio_input(unsigned pin, int use_pullup); + extern int __init_or_module at91_set_gpio_output(unsigned pin, int value); ++extern int __init_or_module at91_set_gpio_output_with_pullup(unsigned pin, int value, int use_pullup); + extern int __init_or_module at91_set_deglitch(unsigned pin, int is_on); + extern int __init_or_module at91_set_debounce(unsigned pin, int is_on, int div); + extern int __init_or_module at91_set_multi_drive(unsigned pin, int is_on); diff --git a/recipes-kernel/linux/linux-3.12.27/linux-3.12-at91sam9_wdt-10second-timeout.patch b/recipes-kernel/linux/linux-3.12.27/linux-3.12-at91sam9_wdt-10second-timeout.patch new file mode 100644 index 0000000..7f4b38c --- /dev/null +++ b/recipes-kernel/linux/linux-3.12.27/linux-3.12-at91sam9_wdt-10second-timeout.patch @@ -0,0 +1,14 @@ +Index: linux-3.12.13/drivers/watchdog/at91sam9_wdt.c +=================================================================== +--- linux-3.12.13.orig/drivers/watchdog/at91sam9_wdt.c 2014-02-22 15:32:50.000000000 -0600 ++++ linux-3.12.13/drivers/watchdog/at91sam9_wdt.c 2014-04-10 16:50:56.032692627 -0500 +@@ -49,7 +49,8 @@ + #define ticks_to_ms(t) (((t + 1) * 1000) >> 8) + + /* Hardware timeout in seconds */ +-#define WDT_HW_TIMEOUT 2 ++/* MTCDT: use longer timeout */ ++#define WDT_HW_TIMEOUT 10 + + /* Timer heartbeat (500ms) */ + #define WDT_TIMEOUT (HZ/2) diff --git a/recipes-kernel/linux/linux-3.12.27/linux-3.12-atmel-mci-force-detect.patch b/recipes-kernel/linux/linux-3.12.27/linux-3.12-atmel-mci-force-detect.patch new file mode 100644 index 0000000..2efdf51 --- /dev/null +++ b/recipes-kernel/linux/linux-3.12.27/linux-3.12-atmel-mci-force-detect.patch @@ -0,0 +1,29 @@ +Index: linux-3.12.13/drivers/mmc/host/atmel-mci.c +=================================================================== +--- linux-3.12.13.orig/drivers/mmc/host/atmel-mci.c 2014-04-10 13:32:40.012723945 -0500 ++++ linux-3.12.13/drivers/mmc/host/atmel-mci.c 2014-04-10 13:36:46.088723297 -0500 +@@ -1447,6 +1447,9 @@ + slot->detect_is_active_high); + dev_dbg(&mmc->class_dev, "card is %spresent\n", + present ? "" : "not "); ++ } else { ++ // jjg - assume card is present if detect pin is unset ++ present = 1; + } + + return present; +@@ -2205,8 +2208,12 @@ + } + } + +- if (!gpio_is_valid(slot->detect_pin)) +- mmc->caps |= MMC_CAP_NEEDS_POLL; ++ // jjg - if detect pin isn't set, don't poll -- just assume device ++ // is there and mark it non-removable ++ if (!gpio_is_valid(slot->detect_pin)) { ++ dev_info(&host->pdev->dev,"No detect pin, marking non-removable and assuming device is present\n"); ++ mmc->caps |= MMC_CAP_NONREMOVABLE; ++ } + + if (gpio_is_valid(slot->wp_pin)) { + if (gpio_request(slot->wp_pin, "mmc_wp")) { diff --git a/recipes-kernel/linux/linux-3.12.27/linux-3.12-atmel-pmecc-debug-bitflips.patch b/recipes-kernel/linux/linux-3.12.27/linux-3.12-atmel-pmecc-debug-bitflips.patch new file mode 100644 index 0000000..391cb4c --- /dev/null +++ b/recipes-kernel/linux/linux-3.12.27/linux-3.12-atmel-pmecc-debug-bitflips.patch @@ -0,0 +1,22 @@ +Index: linux-3.12.27/drivers/mtd/nand/atmel_nand.c +=================================================================== +--- linux-3.12.27.orig/drivers/mtd/nand/atmel_nand.c 2014-10-01 17:01:10.339848160 -0500 ++++ linux-3.12.27/drivers/mtd/nand/atmel_nand.c 2014-10-01 17:04:33.872624626 -0500 +@@ -836,7 +836,7 @@ + *(buf + byte_pos) ^= (1 << bit_pos); + + pos = sector_num * host->pmecc_sector_size + byte_pos; +- dev_info(host->dev, "Bit flip in data area, byte_pos: %d, bit_pos: %d, 0x%02x -> 0x%02x\n", ++ printk(KERN_DEBUG, "atmel_nand: Bit flip in data area, byte_pos: %d, bit_pos: %d, 0x%02x -> 0x%02x\n", + pos, bit_pos, err_byte, *(buf + byte_pos)); + } else { + /* Bit flip in OOB area */ +@@ -846,7 +846,7 @@ + ecc[tmp] ^= (1 << bit_pos); + + pos = tmp + nand_chip->ecc.layout->eccpos[0]; +- dev_info(host->dev, "Bit flip in OOB, oob_byte_pos: %d, bit_pos: %d, 0x%02x -> 0x%02x\n", ++ printk(KERN_DEBUG, "atmel_nand: Bit flip in OOB, oob_byte_pos: %d, bit_pos: %d, 0x%02x -> 0x%02x\n", + pos, bit_pos, err_byte, ecc[tmp]); + } + diff --git a/recipes-kernel/linux/linux-3.12.27/linux-3.12-atmel-spi.patch b/recipes-kernel/linux/linux-3.12.27/linux-3.12-atmel-spi.patch new file mode 100644 index 0000000..898bf74 --- /dev/null +++ b/recipes-kernel/linux/linux-3.12.27/linux-3.12-atmel-spi.patch @@ -0,0 +1,37 @@ +Index: linux-3.12.13/drivers/spi/spi-atmel.c +=================================================================== +--- linux-3.12.13.orig/drivers/spi/spi-atmel.c 2014-04-04 15:00:11.677055454 -0500 ++++ linux-3.12.13/drivers/spi/spi-atmel.c 2014-04-04 15:36:28.973123089 -0500 +@@ -291,26 +291,15 @@ + unsigned active = spi->mode & SPI_CS_HIGH; + u32 mr; + ++ mr = spi_readl(as, MR); + if (atmel_spi_is_v2(as)) { +- spi_writel(as, CSR0 + 4 * spi->chip_select, asd->csr); +- /* For the low SPI version, there is a issue that PDC transfer +- * on CS1,2,3 needs SPI_CSR0.BITS config as SPI_CSR1,2,3.BITS ++ /* mtcdt: always use CSR0 ++ * old 2.6.39 kernel did this and it worked for supporting more than 4 slaves + */ + spi_writel(as, CSR0, asd->csr); +- if (as->caps.has_wdrbt) { +- spi_writel(as, MR, +- SPI_BF(PCS, ~(0x01 << spi->chip_select)) +- | SPI_BIT(WDRBT) +- | SPI_BIT(MODFDIS) +- | SPI_BIT(MSTR)); +- } else { +- spi_writel(as, MR, +- SPI_BF(PCS, ~(0x01 << spi->chip_select)) +- | SPI_BIT(MODFDIS) +- | SPI_BIT(MSTR)); +- } +- +- mr = spi_readl(as, MR); ++ mr &= (SPI_BIT(MODFDIS) | SPI_BIT(MSTR) | (as->caps.has_wdrbt ? SPI_BIT(WDRBT) : 0)); ++ mr |= SPI_BF(PCS, 0x0e); ++ spi_writel(as, MR, mr); + gpio_set_value(asd->npcs_pin, active); + } else { + u32 cpol = (spi->mode & SPI_CPOL) ? SPI_BIT(CPOL) : 0; diff --git a/recipes-kernel/linux/linux-3.12.27/linux-3.12-cdc-acm-ignore-exar-devices.patch b/recipes-kernel/linux/linux-3.12.27/linux-3.12-cdc-acm-ignore-exar-devices.patch new file mode 100644 index 0000000..1a90899 --- /dev/null +++ b/recipes-kernel/linux/linux-3.12.27/linux-3.12-cdc-acm-ignore-exar-devices.patch @@ -0,0 +1,35 @@ +Index: linux-3.12.13/drivers/usb/class/cdc-acm.c +=================================================================== +--- linux-3.12.13.orig/drivers/usb/class/cdc-acm.c 2014-02-22 15:32:50.000000000 -0600 ++++ linux-3.12.13/drivers/usb/class/cdc-acm.c 2014-04-14 11:30:29.486386713 -0500 +@@ -949,8 +949,10 @@ + /* normal quirks */ + quirks = (unsigned long)id->driver_info; + +- if (quirks == IGNORE_DEVICE) ++ if (quirks == IGNORE_DEVICE) { ++ dev_dbg(&intf->dev, "Ignoring device\n"); + return -ENODEV; ++ } + + num_rx_buf = (quirks == SINGLE_RX_URB) ? 1 : ACM_NR; + +@@ -1676,6 +1678,18 @@ + }, + #endif + ++ /* Ignore Exar XR21V141X usb serial chips ++ * This elminates conflicting with the Exar vizzini driver */ ++ {USB_DEVICE(0x04e2, 0x1410), ++ .driver_info = IGNORE_DEVICE, ++ }, ++ {USB_DEVICE(0x04e2, 0x1412), ++ .driver_info = IGNORE_DEVICE, ++ }, ++ {USB_DEVICE(0x04e2, 0x1414), ++ .driver_info = IGNORE_DEVICE, ++ }, ++ + /* control interfaces without any protocol set */ + { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, + USB_CDC_PROTO_NONE) }, diff --git a/recipes-kernel/linux/linux-3.12.27/linux-3.12-gpio-expose-deglitch.patch b/recipes-kernel/linux/linux-3.12.27/linux-3.12-gpio-expose-deglitch.patch new file mode 100644 index 0000000..b868a36 --- /dev/null +++ b/recipes-kernel/linux/linux-3.12.27/linux-3.12-gpio-expose-deglitch.patch @@ -0,0 +1,165 @@ +Index: linux-3.12.13/drivers/gpio/gpiolib.c +=================================================================== +--- linux-3.12.13.orig/drivers/gpio/gpiolib.c 2014-04-18 09:55:28.325372866 -0500 ++++ linux-3.12.13/drivers/gpio/gpiolib.c 2014-04-18 10:01:46.221371869 -0500 +@@ -90,6 +90,7 @@ + static int gpiod_direction_input_pullup(struct gpio_desc *desc, bool pullup); + static int gpiod_direction_output(struct gpio_desc *desc, int value); + static int gpiod_direction_output_pullup(struct gpio_desc *desc, int value, bool pullup); ++static int gpiod_deglitch(struct gpio_desc *desc, bool enable); + static int gpiod_get_direction(const struct gpio_desc *desc); + static int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce); + static int gpiod_get_value_cansleep(const struct gpio_desc *desc); +@@ -1539,6 +1540,9 @@ + (flags & GPIOF_INIT_HIGH) ? 1 : 0); + } + ++ if (flags & GPIOF_DEGLITCH) ++ err = gpiod_deglitch(desc, (flags & GPIOF_DEGLITCH) ? true : false); ++ + if (err) + goto free_gpio; + +@@ -1909,6 +1913,67 @@ + } + EXPORT_SYMBOL_GPL(gpio_direction_output); + ++static int gpiod_deglitch(struct gpio_desc *desc, bool enable) ++{ ++ unsigned long flags; ++ struct gpio_chip *chip; ++ int status = -EINVAL; ++ int offset; ++ ++ if (!desc || !desc->chip) { ++ pr_warn("%s: invalid GPIO\n", __func__); ++ return -EINVAL; ++ } ++ ++ chip = desc->chip; ++ if (!chip->deglitch) { ++ pr_warn("%s: missing deglitch() operation\n", ++ __func__); ++ return -EIO; ++ } ++ ++ spin_lock_irqsave(&gpio_lock, flags); ++ ++ status = gpio_ensure_requested(desc); ++ if (status < 0) ++ goto fail; ++ ++ /* now we know the gpio is valid and chip won't vanish */ ++ ++ spin_unlock_irqrestore(&gpio_lock, flags); ++ ++ might_sleep_if(chip->can_sleep); ++ ++ offset = gpio_chip_hwgpio(desc); ++ if (status) { ++ status = chip->request(chip, offset); ++ if (status < 0) { ++ pr_debug("GPIO-%d: chip request fail, %d\n", ++ desc_to_gpio(desc), status); ++ /* and it's not available to anyone else ... ++ * gpio_request() is the fully clean solution. ++ */ ++ goto lose; ++ } ++ } ++ ++ status = chip->deglitch(chip, offset, enable); ++lose: ++ return status; ++fail: ++ spin_unlock_irqrestore(&gpio_lock, flags); ++ if (status) ++ pr_debug("%s: gpio-%d status %d\n", __func__, ++ desc_to_gpio(desc), status); ++ return status; ++} ++ ++int gpio_deglitch(unsigned gpio, bool enable) ++{ ++ return gpiod_deglitch(gpio_to_desc(gpio), enable); ++} ++EXPORT_SYMBOL_GPL(gpio_deglitch); ++ + /** + * gpio_set_debounce - sets @debounce time for a @gpio + * @gpio: the gpio to set debounce time +Index: linux-3.12.13/drivers/pinctrl/pinctrl-at91.c +=================================================================== +--- linux-3.12.13.orig/drivers/pinctrl/pinctrl-at91.c 2014-04-18 09:55:28.325372866 -0500 ++++ linux-3.12.13/drivers/pinctrl/pinctrl-at91.c 2014-04-18 10:02:45.041371714 -0500 +@@ -1171,6 +1171,17 @@ + return 0; + } + ++static int at91_gpio_set_deglitch(struct gpio_chip *chip, unsigned offset, bool enable) ++{ ++ struct at91_gpio_chip *at91_gpio = to_at91_gpio_chip(chip); ++ void __iomem *pio = at91_gpio->regbase; ++ unsigned mask = 1 << offset; ++ ++ at91_mux_pio3_set_deglitch(pio, mask, enable); ++ ++ return 0; ++} ++ + static int at91_gpio_to_irq(struct gpio_chip *chip, unsigned offset) + { + struct at91_gpio_chip *at91_gpio = to_at91_gpio_chip(chip); +@@ -1542,6 +1553,7 @@ + .get = at91_gpio_get, + .direction_output = at91_gpio_direction_output, + .direction_output_pullup = at91_gpio_direction_output_pullup, ++ .deglitch = at91_gpio_set_deglitch, + .set = at91_gpio_set, + .to_irq = at91_gpio_to_irq, + .dbg_show = at91_gpio_dbg_show, +Index: linux-3.12.13/include/asm-generic/gpio.h +=================================================================== +--- linux-3.12.13.orig/include/asm-generic/gpio.h 2014-04-18 09:55:28.325372866 -0500 ++++ linux-3.12.13/include/asm-generic/gpio.h 2014-04-18 09:58:13.081372430 -0500 +@@ -67,6 +67,7 @@ + * returns either the value actually sensed, or zero + * @direction_output: configures signal "offset" as output, or returns error + * @direction_output_pullup: configures signal "offset" as output with pullup enabled, or returns error ++ * @deglitch: enables deglitch on signal "offset" + * @set_debounce: optional hook for setting debounce time for specified gpio in + * interrupt triggered gpio chips + * @set: assigns output value for signal "offset" +@@ -121,6 +122,8 @@ + unsigned offset, int value); + int (*direction_output_pullup)(struct gpio_chip *chip, + unsigned offset, int value, bool pullup); ++ int (*deglitch)(struct gpio_chip *chip, ++ unsigned offset, bool enable); + int (*set_debounce)(struct gpio_chip *chip, + unsigned offset, unsigned debounce); + +@@ -182,6 +185,7 @@ + extern int gpio_direction_input_pullup(unsigned gpio, bool pullup); + extern int gpio_direction_output(unsigned gpio, int value); + extern int gpio_direction_output_pullup(unsigned gpio, int value, bool pullup); ++extern int gpio_deglitch(unsigned gpio, bool enable); + + extern int gpio_set_debounce(unsigned gpio, unsigned debounce); + +Index: linux-3.12.13/include/linux/gpio.h +=================================================================== +--- linux-3.12.13.orig/include/linux/gpio.h 2014-04-18 09:55:28.325372866 -0500 ++++ linux-3.12.13/include/linux/gpio.h 2014-04-18 09:57:56.305372474 -0500 +@@ -13,9 +13,11 @@ + #define GPIOF_INIT_HIGH (1 << 1) + + #define GPIOF_PULLUP (2 << 0) ++#define GPIOF_DEGLITCH (2 << 1) + + #define GPIOF_IN (GPIOF_DIR_IN) + #define GPIOF_IN_PULLUP (GPIOF_DIR_IN | GPIOF_PULLUP) ++#define GPIOF_IN_DEGLITCH (GPIOF_DIR_IN | GPIOF_DEGLITCH) + #define GPIOF_OUT_INIT_LOW (GPIOF_DIR_OUT | GPIOF_INIT_LOW) + #define GPIOF_OUT_INIT_HIGH (GPIOF_DIR_OUT | GPIOF_INIT_HIGH) + diff --git a/recipes-kernel/linux/linux-3.12.27/linux-3.12-gpio-expose-pullups.patch b/recipes-kernel/linux/linux-3.12.27/linux-3.12-gpio-expose-pullups.patch new file mode 100644 index 0000000..4e1d482 --- /dev/null +++ b/recipes-kernel/linux/linux-3.12.27/linux-3.12-gpio-expose-pullups.patch @@ -0,0 +1,301 @@ +Index: linux-3.12.13/drivers/gpio/gpiolib.c +=================================================================== +--- linux-3.12.13.orig/drivers/gpio/gpiolib.c 2014-02-22 15:32:50.000000000 -0600 ++++ linux-3.12.13/drivers/gpio/gpiolib.c 2014-04-18 09:25:31.977377592 -0500 +@@ -87,7 +87,9 @@ + static int gpiod_request(struct gpio_desc *desc, const char *label); + static void gpiod_free(struct gpio_desc *desc); + static int gpiod_direction_input(struct gpio_desc *desc); ++static int gpiod_direction_input_pullup(struct gpio_desc *desc, bool pullup); + static int gpiod_direction_output(struct gpio_desc *desc, int value); ++static int gpiod_direction_output_pullup(struct gpio_desc *desc, int value, bool pullup); + static int gpiod_get_direction(const struct gpio_desc *desc); + static int gpiod_set_debounce(struct gpio_desc *desc, unsigned debounce); + static int gpiod_get_value_cansleep(const struct gpio_desc *desc); +@@ -1523,11 +1525,19 @@ + if (flags & GPIOF_OPEN_SOURCE) + set_bit(FLAG_OPEN_SOURCE, &desc->flags); + +- if (flags & GPIOF_DIR_IN) +- err = gpiod_direction_input(desc); +- else +- err = gpiod_direction_output(desc, +- (flags & GPIOF_INIT_HIGH) ? 1 : 0); ++ if (flags & GPIOF_DIR_IN) { ++ if (flags & GPIOF_PULLUP) ++ err = gpiod_direction_input_pullup(desc, (flags & GPIOF_PULLUP) ? true : false); ++ else ++ err = gpiod_direction_input(desc); ++ } else { ++ if (flags & GPIOF_PULLUP) ++ err = gpiod_direction_output_pullup(desc, ++ (flags & GPIOF_INIT_HIGH) ? 1 : 0, (flags & GPIOF_PULLUP) ? true : false); ++ else ++ err = gpiod_direction_output(desc, ++ (flags & GPIOF_INIT_HIGH) ? 1 : 0); ++ } + + if (err) + goto free_gpio; +@@ -1613,6 +1623,71 @@ + } + EXPORT_SYMBOL_GPL(gpiochip_is_requested); + ++static int gpiod_direction_input_pullup(struct gpio_desc *desc, bool pullup) ++{ ++ unsigned long flags; ++ struct gpio_chip *chip; ++ int status = -EINVAL; ++ int offset; ++ ++ if (!desc || !desc->chip) { ++ pr_warn("%s: invalid GPIO\n", __func__); ++ return -EINVAL; ++ } ++ ++ chip = desc->chip; ++ if (!chip->get || !chip->direction_input_pullup) { ++ pr_warn("%s: missing get() or direction_input_pullup() operations\n", ++ __func__); ++ return -EIO; ++ } ++ ++ spin_lock_irqsave(&gpio_lock, flags); ++ ++ status = gpio_ensure_requested(desc); ++ if (status < 0) ++ goto fail; ++ ++ /* now we know the gpio is valid and chip won't vanish */ ++ ++ spin_unlock_irqrestore(&gpio_lock, flags); ++ ++ might_sleep_if(chip->can_sleep); ++ ++ offset = gpio_chip_hwgpio(desc); ++ if (status) { ++ status = chip->request(chip, offset); ++ if (status < 0) { ++ pr_debug("GPIO-%d: chip request fail, %d\n", ++ desc_to_gpio(desc), status); ++ /* and it's not available to anyone else ... ++ * gpio_request() is the fully clean solution. ++ */ ++ goto lose; ++ } ++ } ++ ++ status = chip->direction_input_pullup(chip, offset, pullup); ++ if (status == 0) ++ clear_bit(FLAG_IS_OUT, &desc->flags); ++ ++ trace_gpio_direction(desc_to_gpio(desc), 1, status); ++lose: ++ return status; ++fail: ++ spin_unlock_irqrestore(&gpio_lock, flags); ++ if (status) ++ pr_debug("%s: gpio-%d status %d\n", __func__, ++ desc_to_gpio(desc), status); ++ return status; ++} ++ ++int gpio_direction_input_pullup(unsigned gpio, bool pullup) ++{ ++ return gpiod_direction_input_pullup(gpio_to_desc(gpio), pullup); ++} ++EXPORT_SYMBOL_GPL(gpio_direction_input_pullup); ++ + + /* Drivers MUST set GPIO direction before making get/set calls. In + * some cases this is done in early boot, before IRQs are enabled. +@@ -1688,6 +1763,79 @@ + } + EXPORT_SYMBOL_GPL(gpio_direction_input); + ++static int gpiod_direction_output_pullup(struct gpio_desc *desc, int value, bool pullup) ++{ ++ unsigned long flags; ++ struct gpio_chip *chip; ++ int status = -EINVAL; ++ int offset; ++ ++ if (!desc || !desc->chip) { ++ pr_warn("%s: invalid GPIO\n", __func__); ++ return -EINVAL; ++ } ++ ++ /* Open drain pin should not be driven to 1 */ ++ if (value && test_bit(FLAG_OPEN_DRAIN, &desc->flags)) ++ return gpiod_direction_input(desc); ++ ++ /* Open source pin should not be driven to 0 */ ++ if (!value && test_bit(FLAG_OPEN_SOURCE, &desc->flags)) ++ return gpiod_direction_input(desc); ++ ++ chip = desc->chip; ++ if (!chip->set || !chip->direction_output_pullup) { ++ pr_warn("%s: missing set() or direction_output_pullup() operations\n", ++ __func__); ++ return -EIO; ++ } ++ ++ spin_lock_irqsave(&gpio_lock, flags); ++ ++ status = gpio_ensure_requested(desc); ++ if (status < 0) ++ goto fail; ++ ++ /* now we know the gpio is valid and chip won't vanish */ ++ ++ spin_unlock_irqrestore(&gpio_lock, flags); ++ ++ might_sleep_if(chip->can_sleep); ++ ++ offset = gpio_chip_hwgpio(desc); ++ if (status) { ++ status = chip->request(chip, offset); ++ if (status < 0) { ++ pr_debug("GPIO-%d: chip request fail, %d\n", ++ desc_to_gpio(desc), status); ++ /* and it's not available to anyone else ... ++ * gpio_request() is the fully clean solution. ++ */ ++ goto lose; ++ } ++ } ++ ++ status = chip->direction_output_pullup(chip, offset, value, pullup); ++ if (status == 0) ++ set_bit(FLAG_IS_OUT, &desc->flags); ++ trace_gpio_value(desc_to_gpio(desc), 0, value); ++ trace_gpio_direction(desc_to_gpio(desc), 0, status); ++lose: ++ return status; ++fail: ++ spin_unlock_irqrestore(&gpio_lock, flags); ++ if (status) ++ pr_debug("%s: gpio-%d status %d\n", __func__, ++ desc_to_gpio(desc), status); ++ return status; ++} ++ ++int gpio_direction_output_pullup(unsigned gpio, int value, bool pullup) ++{ ++ return gpiod_direction_output_pullup(gpio_to_desc(gpio), value, pullup); ++} ++EXPORT_SYMBOL_GPL(gpio_direction_output_pullup); ++ + static int gpiod_direction_output(struct gpio_desc *desc, int value) + { + unsigned long flags; +Index: linux-3.12.13/drivers/pinctrl/pinctrl-at91.c +=================================================================== +--- linux-3.12.13.orig/driv