From 54bc239a3f07109240676aba7d89cb735b405322 Mon Sep 17 00:00:00 2001 From: Diego Rondini Date: Thu, 13 Apr 2017 10:33:43 +0000 Subject: [PATCH 1/4] u-boot: add support for eMMC for OLinuXino Lime2 Add support for eMMC for Olimex A20-OLinuXino Lime2 eMMC board by adding the appropriate defconfig while waiting it is upstreamed in mainline U-Boot. Signed-off-by: Diego Rondini --- ...d-A20-OLinuXino-Lime2-eMMC-defconfig.patch | 49 +++++++++++++++++++ recipes-bsp/u-boot/u-boot_2017.03.bb | 4 +- 2 files changed, 52 insertions(+), 1 deletion(-) create mode 100644 recipes-bsp/u-boot/files/0001-sunxi-add-A20-OLinuXino-Lime2-eMMC-defconfig.patch diff --git a/recipes-bsp/u-boot/files/0001-sunxi-add-A20-OLinuXino-Lime2-eMMC-defconfig.patch b/recipes-bsp/u-boot/files/0001-sunxi-add-A20-OLinuXino-Lime2-eMMC-defconfig.patch new file mode 100644 index 0000000..b1acfff --- /dev/null +++ b/recipes-bsp/u-boot/files/0001-sunxi-add-A20-OLinuXino-Lime2-eMMC-defconfig.patch @@ -0,0 +1,49 @@ +From f50ee5d9684ddc237d86841fb57a0cc6daaa76e7 Mon Sep 17 00:00:00 2001 +From: Diego Rondini +Date: Thu, 13 Apr 2017 06:51:39 +0000 +Subject: [PATCH] sunxi: add A20-OLinuXino-Lime2-eMMC defconfig + +--- + configs/A20-OLinuXino-Lime2-eMMC_defconfig | 30 ++++++++++++++++++++++++++++++ + 1 file changed, 30 insertions(+) + create mode 100644 configs/A20-OLinuXino-Lime2-eMMC_defconfig + +diff --git a/configs/A20-OLinuXino-Lime2-eMMC_defconfig b/configs/A20-OLinuXino-Lime2-eMMC_defconfig +new file mode 100644 +index 0000000..b7be1a2 +--- /dev/null ++++ b/configs/A20-OLinuXino-Lime2-eMMC_defconfig +@@ -0,0 +1,30 @@ ++CONFIG_ARM=y ++CONFIG_ARCH_SUNXI=y ++CONFIG_MACH_SUN7I=y ++CONFIG_DRAM_CLK=384 ++CONFIG_MMC0_CD_PIN="PH1" ++CONFIG_MMC_SUNXI_SLOT_EXTRA=2 ++CONFIG_USB0_VBUS_PIN="PC17" ++CONFIG_USB0_VBUS_DET="PH5" ++CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-olinuxino-lime2-emmc" ++# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set ++CONFIG_SYS_EXTRA_OPTIONS="SUNXI_GMAC,RGMII,AHCI,SATAPWR=SUNXI_GPC(3)" ++CONFIG_SPL=y ++CONFIG_SPL_I2C_SUPPORT=y ++# CONFIG_CMD_IMLS is not set ++# CONFIG_CMD_FLASH is not set ++CONFIG_CMD_DFU=y ++CONFIG_CMD_USB_MASS_STORAGE=y ++# CONFIG_CMD_FPGA is not set ++CONFIG_DFU_RAM=y ++CONFIG_RTL8211X_PHY_FORCE_MASTER=y ++CONFIG_ETH_DESIGNWARE=y ++CONFIG_AXP_ALDO3_VOLT=2800 ++CONFIG_AXP_ALDO4_VOLT=2800 ++CONFIG_USB_EHCI_HCD=y ++CONFIG_USB_MUSB_GADGET=y ++CONFIG_USB_GADGET=y ++CONFIG_USB_GADGET_DOWNLOAD=y ++CONFIG_G_DNL_MANUFACTURER="Allwinner Technology" ++CONFIG_G_DNL_VENDOR_NUM=0x1f3a ++CONFIG_G_DNL_PRODUCT_NUM=0x1010 +-- +1.9.1 + diff --git a/recipes-bsp/u-boot/u-boot_2017.03.bb b/recipes-bsp/u-boot/u-boot_2017.03.bb index 88a86ad..86b04ce 100644 --- a/recipes-bsp/u-boot/u-boot_2017.03.bb +++ b/recipes-bsp/u-boot/u-boot_2017.03.bb @@ -27,7 +27,9 @@ DEFAULT_PREFERENCE_sun7i="1" DEFAULT_PREFERENCE_sun8i="1" SRC_URI = "git://git.denx.de/u-boot.git;branch=master \ - file://boot.cmd" + file://boot.cmd \ + file://0001-sunxi-add-A20-OLinuXino-Lime2-eMMC-defconfig.patch \ + " SRCREV = "8537ddd769f460d7fb7a62a3dcc9669049702e51" From febf35474a119ae1991d00a43d2c9d9c6ee30190 Mon Sep 17 00:00:00 2001 From: Diego Rondini Date: Thu, 13 Apr 2017 13:03:46 +0000 Subject: [PATCH 2/4] u-boot: adjust root for eMMC boot Adjust the bootscript so that if U-Boot is loaded from the eMMC, then kernel "root" parameter is set to use eMMC second partition. Signed-off-by: Diego Rondini --- recipes-bsp/u-boot/files/boot.cmd | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/recipes-bsp/u-boot/files/boot.cmd b/recipes-bsp/u-boot/files/boot.cmd index 6d798dc..7b4ad7b 100644 --- a/recipes-bsp/u-boot/files/boot.cmd +++ b/recipes-bsp/u-boot/files/boot.cmd @@ -1,4 +1,11 @@ -setenv bootargs console=${console} console=tty1 root=/dev/mmcblk0p2 rootwait panic=10 ${extra} +# Default to (primary) SD +rootdev=mmcblk0p2 +if itest.b *0x28 == 0x02 ; then + # U-Boot loaded from eMMC or secondary SD so use it for rootfs too + echo "U-boot loaded from eMMC or secondary SD" + rootdev=mmcblk1p2 +fi +setenv bootargs console=${console} console=tty1 root=/dev/${rootdev} rootwait panic=10 ${extra} load mmc 0:1 ${fdt_addr_r} ${fdtfile} || load mmc 0:1 ${fdt_addr_r} boot/${fdtfile} load mmc 0:1 ${kernel_addr_r} zImage || load mmc 0:1 ${kernel_addr_r} boot/zImage || load mmc 0:1 ${kernel_addr_r} uImage || load mmc 0:1 ${kernel_addr_r} boot/uImage bootz ${kernel_addr_r} - ${fdt_addr_r} || bootm ${kernel_addr_r} - ${fdt_addr_r} From 32aad38a1619499f1ab51e435d1721fea225cdc6 Mon Sep 17 00:00:00 2001 From: Diego Rondini Date: Wed, 26 Apr 2017 08:38:17 +0000 Subject: [PATCH 3/4] linux: backport patch for Lime2 eMMC support Backport patch from v4.10 to fix eMMC support on OLinuXino Lime2. --- ...ange-node-name-for-pwrseq-pin-on-Oli.patch | 35 +++++++++++++++++++ recipes-kernel/linux/linux_4.9.20.bb | 1 + 2 files changed, 36 insertions(+) create mode 100644 recipes-kernel/linux/linux-4.9.20/0001-ARM-dts-sunxi-Change-node-name-for-pwrseq-pin-on-Oli.patch diff --git a/recipes-kernel/linux/linux-4.9.20/0001-ARM-dts-sunxi-Change-node-name-for-pwrseq-pin-on-Oli.patch b/recipes-kernel/linux/linux-4.9.20/0001-ARM-dts-sunxi-Change-node-name-for-pwrseq-pin-on-Oli.patch new file mode 100644 index 0000000..6c826d3 --- /dev/null +++ b/recipes-kernel/linux/linux-4.9.20/0001-ARM-dts-sunxi-Change-node-name-for-pwrseq-pin-on-Oli.patch @@ -0,0 +1,35 @@ +From 3116d37651d77125bf50f81f859b1278e02ccce6 Mon Sep 17 00:00:00 2001 +From: Emmanuel Vadot +Date: Wed, 14 Dec 2016 15:57:24 +0100 +Subject: [PATCH] ARM: dts: sunxi: Change node name for pwrseq pin on + Olinuxino-lime2-emmc + +The node name for the power seq pin is mmc2@0 like the mmc2_pins_a one. +This makes the original node (mmc2_pins_a) scrapped out of the dtb and +result in a unusable eMMC if U-Boot didn't configured the pins to the +correct functions. + +Upstream-Status: Backport from v4.10 + +Signed-off-by: Emmanuel Vadot +Signed-off-by: Maxime Ripard +--- + arch/arm/boot/dts/sun7i-a20-olinuxino-lime2-emmc.dts | 2 +- + 1 file changed, 1 insertion(+), 1 deletion(-) + +diff --git a/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2-emmc.dts b/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2-emmc.dts +index 5ea4915..10d3074 100644 +--- a/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2-emmc.dts ++++ b/arch/arm/boot/dts/sun7i-a20-olinuxino-lime2-emmc.dts +@@ -56,7 +56,7 @@ + }; + + &pio { +- mmc2_pins_nrst: mmc2@0 { ++ mmc2_pins_nrst: mmc2-rst-pin { + allwinner,pins = "PC16"; + allwinner,function = "gpio_out"; + allwinner,drive = ; +-- +2.7.4 + diff --git a/recipes-kernel/linux/linux_4.9.20.bb b/recipes-kernel/linux/linux_4.9.20.bb index 55ff983..5a087cd 100644 --- a/recipes-kernel/linux/linux_4.9.20.bb +++ b/recipes-kernel/linux/linux_4.9.20.bb @@ -21,4 +21,5 @@ SRC_URI[sha256sum] = "48660806dd32fb8dcbcf5932291bf6cc7d29240070372230871e0f56fe SRC_URI = "https://www.kernel.org/pub/linux/kernel/v4.x/linux-${PV}.tar.xz \ file://defconfig \ + file://0001-ARM-dts-sunxi-Change-node-name-for-pwrseq-pin-on-Oli.patch \ " From 0ebd445fbd3b8a68f44896da962d8fb49c50b4ce Mon Sep 17 00:00:00 2001 From: Diego Rondini Date: Thu, 13 Apr 2017 13:21:13 +0000 Subject: [PATCH 4/4] olinuxino-a20lime2-emmc: add configuration Add machine configuration file for Olimex A20-OLinuXino Lime2 Board with 4GB eMMC. Signed-off-by: Diego Rondini --- conf/machine/olinuxino-a20lime2-emmc.conf | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 conf/machine/olinuxino-a20lime2-emmc.conf diff --git a/conf/machine/olinuxino-a20lime2-emmc.conf b/conf/machine/olinuxino-a20lime2-emmc.conf new file mode 100644 index 0000000..1b61c19 --- /dev/null +++ b/conf/machine/olinuxino-a20lime2-emmc.conf @@ -0,0 +1,10 @@ +#@TYPE: Machine +#@NAME: Olimex A20-OLinuXino Lime2 Board with 4GB eMMC +#@DESCRIPTION: Machine configuration for the Olimex A20-OLinuXino Lime2 Board with 4GB eMMC, based on Allwinner A20 CPU +#https://github.com/OLIMEX/OLINUXINO + +require conf/machine/include/sun7i.inc + +KERNEL_DEVICETREE = "sun7i-a20-olinuxino-lime2-emmc.dtb" +UBOOT_MACHINE = "A20-OLinuXino-Lime2-eMMC_config" +SUNXI_FEX_FILE = "sys_config/a20/a20-olinuxino_lime2.fex"