From 716ca530e1c4515d8683c9d5be3d56b301758b66 Mon Sep 17 00:00:00 2001 From: James <> Date: Wed, 4 Nov 2015 11:49:21 +0000 Subject: trunk-47381 --- package/boot/uboot-sunxi/Makefile | 166 ++++++++++++ .../patches/001-use-dtc-in-kernel.patch | 12 + .../uboot-sunxi/patches/002-add-lamobo-r1.diff | 277 +++++++++++++++++++++ .../patches/003-add-olimex-a13-som.diff | 19 ++ ...et-transfer-timeout-according-to-byte_cnt.patch | 42 ++++ package/boot/uboot-sunxi/uEnv.txt | 6 + 6 files changed, 522 insertions(+) create mode 100644 package/boot/uboot-sunxi/Makefile create mode 100644 package/boot/uboot-sunxi/patches/001-use-dtc-in-kernel.patch create mode 100644 package/boot/uboot-sunxi/patches/002-add-lamobo-r1.diff create mode 100644 package/boot/uboot-sunxi/patches/003-add-olimex-a13-som.diff create mode 100644 package/boot/uboot-sunxi/patches/004-sunxi-mmc-set-transfer-timeout-according-to-byte_cnt.patch create mode 100644 package/boot/uboot-sunxi/uEnv.txt (limited to 'package/boot/uboot-sunxi') diff --git a/package/boot/uboot-sunxi/Makefile b/package/boot/uboot-sunxi/Makefile new file mode 100644 index 0000000..b08f9ed --- /dev/null +++ b/package/boot/uboot-sunxi/Makefile @@ -0,0 +1,166 @@ +# +# Copyright (C) 2013-2014 OpenWrt.org +# +# This is free software, licensed under the GNU General Public License v2. +# See /LICENSE for more information. +# + +include $(TOPDIR)/rules.mk +include $(INCLUDE_DIR)/kernel.mk + +PKG_NAME:=u-boot +PKG_VERSION:=2015.07 +PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.bz2 +PKG_SOURCE_URL:= \ + http://mirror2.openwrt.org/sources \ + ftp://ftp.denx.de/pub/u-boot + +PKG_MD5SUM:=3dac9a0b46fed77fc768ad3bd2d68c05 + +PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(BUILD_VARIANT)/$(PKG_NAME)-$(PKG_VERSION) + +PKG_LICENSE:=GPL-2.0 GPL-2.0+ +PKG_LICENSE_FILES:=Licenses/README + +include $(INCLUDE_DIR)/package.mk + +define uboot/Default + TITLE:= + CONFIG:= + IMAGE:= +endef + +define uboot/A10-OLinuXino-Lime + TITLE:=U-Boot for the A10 OLinuXino LIME +endef + +define uboot/A13-OLinuXino + TITLE:=U-Boot for the A13 OlinuXino +endef + +define uboot/A20-OLinuXino-Lime + TITLE:=U-Boot for the A20 OLinuXino LIME +endef + +define uboot/A20-OLinuXino_MICRO + TITLE:=U-Boot for A20 OLinuXino MICRO +endef + +define uboot/Bananapi + TITLE:=U-Boot for Bananapi +endef + +define uboot/Bananapro + TITLE:=U-Boot for Bananapro +endef + +define uboot/Cubieboard + TITLE:=U-Boot for Cubieboard +endef + +define uboot/Cubieboard2 + TITLE:=U-Boot for Cubieboard2 +endef + +define uboot/Cubietruck + TITLE:=U-Boot for Cubietruck +endef + +define uboot/Mele_M9 + TITLE:=U-Boot for the Mele M9 (A31) +endef + +define uboot/OLIMEX_A13_SOM + TITLE:=U-Boot for the Olimex A13 SOM +endef + +define uboot/Linksprite_pcDuino + TITLE:=U-Boot for Linksprite pcDuino +endef + +define uboot/Linksprite_pcDuino3 + TITLE:=U-Boot for Linksprite pcDuino3 +endef + +define uboot/Lamobo_R1 + TITLE:=U-Boot for Lamobo R1 +endef + +UBOOTS:= \ + A10-OLinuXino-Lime \ + A13-OLinuXino \ + A20-OLinuXino-Lime \ + A20-OLinuXino_MICRO \ + Bananapi \ + Bananapro \ + Cubieboard \ + Cubieboard2 \ + Cubietruck \ + Mele_M9 \ + OLIMEX_A13_SOM \ + Linksprite_pcDuino \ + Linksprite_pcDuino3 \ + Lamobo_R1 \ + +define Package/uboot/template +define Package/uboot-sunxi-$(1) + SECTION:=boot + CATEGORY:=Boot Loaders + DEPENDS:=@TARGET_sunxi + TITLE:=$(2) + URL:=http://www.denx.de/wiki/U-Boot + VARIANT:=$(1) + MAINTAINER:=Zoltan HERPAI +endef +endef + +define BuildUBootPackage + $(eval $(uboot/Default)) + $(eval $(uboot/$(1))) + $(call Package/uboot/template,$(1),$(TITLE)) +endef + +ifdef BUILD_VARIANT +$(eval $(call uboot/$(BUILD_VARIANT))) +UBOOT_CONFIG:=$(if $(CONFIG),$(CONFIG),$(BUILD_VARIANT)) +UBOOT_IMAGE:=$(if $(IMAGE),$(IMAGE),openwrt-$(BOARD)-$(BUILD_VARIANT)-u-boot.bin) +endif + +define Build/Configure + $(MAKE) -C $(PKG_BUILD_DIR) \ + USE_PRIVATE_LIBGCC=yes $(UBOOT_CONFIG)_defconfig +endef + +define Build/Compile + $(MAKE) -C $(PKG_BUILD_DIR) \ + CROSS_COMPILE=$(TARGET_CROSS) \ + DTCDIR=$(LINUX_DIR)/scripts/dtc/ +endef + +define Package/uboot/install/default + $(CP) $(PKG_BUILD_DIR)/u-boot.bin \ + $(KERNEL_BUILD_DIR)/uboot-$(BOARD)-$(1)-u-boot.bin + $(CP) $(PKG_BUILD_DIR)/spl/sunxi-spl.bin \ + $(KERNEL_BUILD_DIR)/uboot-$(BOARD)-$(1)-spl.bin + $(CP) $(PKG_BUILD_DIR)/u-boot-sunxi-with-spl.bin \ + $(KERNEL_BUILD_DIR)/uboot-$(BOARD)-$(1)-u-boot-with-spl.bin + $(CP) uEnv.txt \ + $(KERNEL_BUILD_DIR)/uboot-$(BOARD)-$(1)-uEnv.txt + mkimage -C none -A arm -T script -d $(KERNEL_BUILD_DIR)/uboot-$(BOARD)-$(1)-uEnv.txt \ + $(KERNEL_BUILD_DIR)/uboot-$(BOARD)-$(1)-boot.scr +endef + +define Package/uboot/install/template +define Package/uboot-sunxi-$(1)/install + $(call Package/uboot/install/default,$(2)) +endef +endef + +$(foreach u,$(UBOOTS), \ + $(eval $(call Package/uboot/install/template,$(u),$(u))) \ +) + +$(foreach u,$(UBOOTS), \ + $(eval $(call BuildUBootPackage,$(u))) \ + $(eval $(call BuildPackage,uboot-sunxi-$(u))) \ +) diff --git a/package/boot/uboot-sunxi/patches/001-use-dtc-in-kernel.patch b/package/boot/uboot-sunxi/patches/001-use-dtc-in-kernel.patch new file mode 100644 index 0000000..afcb37c --- /dev/null +++ b/package/boot/uboot-sunxi/patches/001-use-dtc-in-kernel.patch @@ -0,0 +1,12 @@ +diff -ruN old/Makefile new/Makefile +--- old/Makefile 2015-04-13 16:53:03.000000000 +0200 ++++ new/Makefile 2015-07-31 15:52:08.920097812 +0200 +@@ -346,7 +346,7 @@ + AWK = awk + PERL = perl + PYTHON = python +-DTC = dtc ++DTC = $(DTCDIR)dtc + CHECK = sparse + + CHECKFLAGS := -D__linux__ -Dlinux -D__STDC__ -Dunix -D__unix__ \ diff --git a/package/boot/uboot-sunxi/patches/002-add-lamobo-r1.diff b/package/boot/uboot-sunxi/patches/002-add-lamobo-r1.diff new file mode 100644 index 0000000..5dd816c --- /dev/null +++ b/package/boot/uboot-sunxi/patches/002-add-lamobo-r1.diff @@ -0,0 +1,277 @@ +diff -ruN old/arch/arm/dts/Makefile new/arch/arm/dts/Makefile +--- old/arch/arm/dts/Makefile 2015-07-14 19:32:21.000000000 +0200 ++++ new/arch/arm/dts/Makefile 2015-07-31 23:23:33.518767858 +0200 +@@ -107,6 +107,7 @@ + sun7i-a20-cubietruck.dtb \ + sun7i-a20-hummingbird.dtb \ + sun7i-a20-i12-tvbox.dtb \ ++ sun7i-a20-lamobo-r1.dtb \ + sun7i-a20-m3.dtb \ + sun7i-a20-m5.dtb \ + sun7i-a20-mk808c.dtb \ +diff -ruN old/arch/arm/dts/sun7i-a20-lamobo-r1.dts new/arch/arm/dts/sun7i-a20-lamobo-r1.dts +--- old/arch/arm/dts/sun7i-a20-lamobo-r1.dts 1970-01-01 01:00:00.000000000 +0100 ++++ new/arch/arm/dts/sun7i-a20-lamobo-r1.dts 2015-07-31 23:19:30.811206714 +0200 +@@ -0,0 +1,239 @@ ++/* ++ * Copyright 2014 Hans de Goede ++ * ++ * Hans de Goede ++ * ++ * This file is dual-licensed: you can use it either under the terms ++ * of the GPL or the X11 license, at your option. Note that this dual ++ * licensing only applies to this file, and not this project as a ++ * whole. ++ * ++ * a) This file is free software; you can redistribute it and/or ++ * modify it under the terms of the GNU General Public License as ++ * published by the Free Software Foundation; either version 2 of the ++ * License, or (at your option) any later version. ++ * ++ * This file is distributed in the hope that it will be useful, ++ * but WITHOUT ANY WARRANTY; without even the implied warranty of ++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ++ * GNU General Public License for more details. ++ * ++ * You should have received a copy of the GNU General Public ++ * License along with this file; if not, write to the Free ++ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, ++ * MA 02110-1301 USA ++ * ++ * Or, alternatively, ++ * ++ * b) 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. ++ */ ++ ++/dts-v1/; ++#include "sun7i-a20.dtsi" ++#include "sunxi-common-regulators.dtsi" ++ ++#include ++#include ++#include ++ ++/ { ++ model = "Lamobo R1"; ++ compatible = "lamobo,lamobo-r1", "allwinner,sun7i-a20"; ++ ++ aliases { ++ serial0 = &uart0; ++ serial1 = &uart3; ++ serial2 = &uart7; ++ }; ++ ++ soc@01c00000 { ++ spi0: spi@01c05000 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&spi0_pins_a>; ++ status = "okay"; ++ }; ++ ++ mmc0: mmc@01c0f000 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin_bananapi>; ++ vmmc-supply = <®_vcc3v3>; ++ bus-width = <4>; ++ cd-gpios = <&pio 7 10 0>; /* PH10 */ ++ cd-inverted; ++ status = "okay"; ++ }; ++ ++ usbphy: phy@01c13400 { ++ usb1_vbus-supply = <®_usb1_vbus>; ++ usb2_vbus-supply = <®_usb2_vbus>; ++ status = "okay"; ++ }; ++ ++ ehci0: usb@01c14000 { ++ status = "okay"; ++ }; ++ ++ ohci0: usb@01c14400 { ++ status = "okay"; ++ }; ++ ++ ahci: sata@01c18000 { ++ status = "okay"; ++ }; ++ ++ ehci1: usb@01c1c000 { ++ status = "okay"; ++ }; ++ ++ ohci1: usb@01c1c400 { ++ status = "okay"; ++ }; ++ ++ pinctrl@01c20800 { ++ mmc0_cd_pin_bananapi: mmc0_cd_pin@0 { ++ allwinner,pins = "PH10"; ++ allwinner,function = "gpio_in"; ++ allwinner,drive = <0>; ++ allwinner,pull = <1>; ++ }; ++ ++ gmac_power_pin_bananapi: gmac_power_pin@0 { ++ allwinner,pins = "PH23"; ++ allwinner,function = "gpio_out"; ++ allwinner,drive = <0>; ++ allwinner,pull = <0>; ++ }; ++ ++ led_pins_bananapi: led_pins@0 { ++ allwinner,pins = "PH24"; ++ allwinner,function = "gpio_out"; ++ allwinner,drive = <0>; ++ allwinner,pull = <0>; ++ }; ++ ++ ahci_pwr_pin_a: ahci_pwr_pin@0 { ++ allwinner,pins = "PB3"; ++ allwinner,function = "gpio_out"; ++ allwinner,drive = <0>; ++ allwinner,pull = <0>; ++ }; ++ ++ }; ++ ++ ++ uart0: serial@01c28000 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_pins_a>; ++ status = "okay"; ++ }; ++ ++ uart3: serial@01c28c00 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart3_pins_b>; ++ status = "okay"; ++ }; ++ ++ uart7: serial@01c29c00 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart7_pins_a>; ++ status = "okay"; ++ }; ++ ++ i2c0: i2c@01c2ac00 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c0_pins_a>; ++ status = "okay"; ++ ++ axp209: pmic@34 { ++ compatible = "x-powers,axp209"; ++ reg = <0x34>; ++ interrupt-parent = <&nmi_intc>; ++ interrupts = <0 8>; ++ ++ interrupt-controller; ++ #interrupt-cells = <1>; ++ }; ++ }; ++ ++ i2c2: i2c@01c2b400 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&i2c2_pins_a>; ++ status = "okay"; ++ }; ++ ++ gmac: ethernet@01c50000 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&gmac_pins_rgmii_a>; ++ phy = <&phy1>; ++ phy-mode = "rgmii"; ++ phy-supply = <®_gmac_3v3>; ++ status = "okay"; ++ ++ phy1: ethernet-phy@1 { ++ reg = <1>; ++ }; ++ }; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&led_pins_bananapi>; ++ ++ green { ++ label = "bananapi:green:usr"; ++ gpios = <&pio 7 24 0>; ++ }; ++ }; ++ ++ reg_usb1_vbus: usb1-vbus { ++ status = "okay"; ++ }; ++ ++ reg_usb2_vbus: usb2-vbus { ++ status = "okay"; ++ }; ++ ++ reg_gmac_3v3: gmac-3v3 { ++ compatible = "regulator-fixed"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&gmac_power_pin_bananapi>; ++ regulator-name = "gmac-3v3"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ startup-delay-us = <100000>; ++ enable-active-high; ++ gpio = <&pio 7 23 0>; ++ }; ++ ++ reg_ahci_5v: ahci-5v { ++ compatible = "regulator-fixed"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&ahci_pwr_pin_a>; ++ regulator-name = "ahci-5v"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ enable-active-high; ++ gpio = <&pio 1 3 0>; ++ status = "okay"; ++ }; ++}; +diff -ruN old/configs/Lamobo_R1_defconfig new/configs/Lamobo_R1_defconfig +--- old/configs/Lamobo_R1_defconfig 1970-01-01 01:00:00.000000000 +0100 ++++ new/configs/Lamobo_R1_defconfig 2015-07-31 23:02:06.000000000 +0200 +@@ -0,0 +1,19 @@ ++CONFIG_SPL=y ++CONFIG_SYS_EXTRA_OPTIONS="AXP209_POWER,SUNXI_GMAC,RGMII,MACPWR=SUNXI_GPH(23),AHCI,USB_EHCI,SATAPWR=SUNXI_GPB(3)" ++CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-lamobo-r1" ++CONFIG_GMAC_TX_DELAY=4 ++CONFIG_ARM=y ++CONFIG_ARCH_SUNXI=y ++CONFIG_MACH_SUN7I=y ++CONFIG_DRAM_CLK=432 ++CONFIG_DRAM_ZQ=127 ++CONFIG_DRAM_EMR1=4 ++CONFIG_ETH_DESIGNWARE=y ++CONFIG_NETDEVICES=y ++CONFIG_NET=y ++# CONFIG_CMD_IMLS is not set ++# CONFIG_CMD_FLASH is not set ++# CONFIG_CMD_FPGA is not set ++CONFIG_DM_SERIAL=y ++CONFIG_USB=y ++CONFIG_DM_USB=y diff --git a/package/boot/uboot-sunxi/patches/003-add-olimex-a13-som.diff b/package/boot/uboot-sunxi/patches/003-add-olimex-a13-som.diff new file mode 100644 index 0000000..e160b3d --- /dev/null +++ b/package/boot/uboot-sunxi/patches/003-add-olimex-a13-som.diff @@ -0,0 +1,19 @@ +diff -ruN u-boot-2015.01.old/configs/OLIMEX_A13_SOM_defconfig u-boot-2015.01/configs/OLIMEX_A13_SOM_defconfig +--- u-boot-2015.01.old/configs/OLIMEX_A13_SOM_defconfig 1970-01-01 01:00:00.000000000 +0100 ++++ u-boot-2015.01/configs/OLIMEX_A13_SOM_defconfig 2015-01-18 16:25:11.908986082 +0100 +@@ -0,0 +1,15 @@ ++CONFIG_SPL=y ++CONFIG_SYS_EXTRA_OPTIONS="CONS_INDEX=2,NO_AXP,USB_EHCI" ++CONFIG_DEFAULT_DEVICE_TREE="sun5i-a13-olinuxino" ++CONFIG_ARM=y ++CONFIG_ARCH_SUNXI=y ++CONFIG_MACH_SUN5I=y ++CONFIG_DRAM_CLK=408 ++CONFIG_DRAM_ZQ=123 ++CONFIG_DRAM_EMR1=0 ++# CONFIG_CMD_IMLS is not set ++# CONFIG_CMD_FLASH is not set ++# CONFIG_CMD_FPGA is not set ++CONFIG_DM_SERIAL=y ++CONFIG_USB=y ++CONFIG_DM_USB=y diff --git a/package/boot/uboot-sunxi/patches/004-sunxi-mmc-set-transfer-timeout-according-to-byte_cnt.patch b/package/boot/uboot-sunxi/patches/004-sunxi-mmc-set-transfer-timeout-according-to-byte_cnt.patch new file mode 100644 index 0000000..964aa57 --- /dev/null +++ b/package/boot/uboot-sunxi/patches/004-sunxi-mmc-set-transfer-timeout-according-to-byte_cnt.patch @@ -0,0 +1,42 @@ +diff --git a/package/boot/uboot-sunxi/patches/004-sunxi-mmc-set-transfer-timeout-according-to-byte_cnt.patch b/package/boot/uboot-sunxi/patches/004-sunxi-mmc-set-transfer-timeout-according-to-byte_cnt.patch +new file mode 100644 +index 0000000..180b60b +--- /dev/null ++++ b/package/boot/uboot-sunxi/patches/004-sunxi-mmc-set-transfer-timeout-according-to-byte_cnt.patch +@@ -0,0 +1,36 @@ ++From 8a5481e2e51a86e858c4f1481729421f26cc240c Mon Sep 17 00:00:00 2001 ++From: Yousong Zhou ++Date: Sat, 29 Aug 2015 21:26:11 +0800 ++Subject: [PATCH] sunxi: mmc: set transfer timeout according to byte_cnt. ++ ++Originally a timeout value of 2 seconds was used regardless of the size ++of data to be transfered. This prevented slow devices from working ++correctly while there was no much gain for faster devices, e.g. it takes ++3708ms for a transfer of uImage of size 1899008 bytes. ++ ++Signed-off-by: Yousong Zhou ++--- ++ drivers/mmc/sunxi_mmc.c | 6 ++++-- ++ 1 file changed, 4 insertions(+), 2 deletions(-) ++ ++diff --git a/drivers/mmc/sunxi_mmc.c b/drivers/mmc/sunxi_mmc.c ++index e7ab828..7a990f7 100644 ++--- a/drivers/mmc/sunxi_mmc.c +++++ b/drivers/mmc/sunxi_mmc.c ++@@ -257,9 +257,11 @@ static int mmc_trans_data_by_cpu(struct mmc *mmc, struct mmc_data *data) ++ const uint32_t status_bit = reading ? SUNXI_MMC_STATUS_FIFO_EMPTY : ++ SUNXI_MMC_STATUS_FIFO_FULL; ++ unsigned i; ++- unsigned byte_cnt = data->blocksize * data->blocks; ++- unsigned timeout_msecs = 2000; ++ unsigned *buff = (unsigned int *)(reading ? data->dest : data->src); +++ unsigned byte_cnt = data->blocksize * data->blocks; +++ unsigned timeout_msecs = byte_cnt >> 8; +++ if (timeout_msecs < 2000) +++ timeout_msecs = 2000; ++ ++ /* Always read / write data through the CPU */ ++ setbits_le32(&mmchost->reg->gctrl, SUNXI_MMC_GCTRL_ACCESS_BY_AHB); ++-- ++1.7.10.4 ++ diff --git a/package/boot/uboot-sunxi/uEnv.txt b/package/boot/uboot-sunxi/uEnv.txt new file mode 100644 index 0000000..e024954 --- /dev/null +++ b/package/boot/uboot-sunxi/uEnv.txt @@ -0,0 +1,6 @@ +setenv fdt_high ffffffff +setenv loadkernel fatload mmc 0 \$kernel_addr_r uImage +setenv loaddtb fatload mmc 0 \$fdt_addr_r dtb +setenv bootargs console=ttyS0,115200 earlyprintk root=/dev/mmcblk0p2 rootwait +setenv uenvcmd run loadkernel \&\& run loaddtb \&\& bootm \$kernel_addr_r - \$fdt_addr_r +run uenvcmd -- cgit v1.2.3