From 58ce101c68e62e4dfcfadad4d970db22c30c4349 Mon Sep 17 00:00:00 2001 From: Hauke Mehrtens Date: Sun, 14 Jan 2018 12:44:11 +0100 Subject: [PATCH] sunxi: Orange Pi R1 SPI: add spi flash board This adds support for booting the Orange Pi R1 from SPI flash instead of SD card. Signed-off-by: Hauke Mehrtens --- package/boot/uboot-sunxi/Makefile | 7 ++++ ...0-sunxi-Add-support-for-Orange-Pi-R1.patch | 41 +++++++++++++++++++ target/linux/sunxi/image/cortex-a7.mk | 22 ++++++++++ 3 files changed, 70 insertions(+) diff --git a/package/boot/uboot-sunxi/Makefile b/package/boot/uboot-sunxi/Makefile index 9a783b8dc9..6279dfd139 100644 --- a/package/boot/uboot-sunxi/Makefile +++ b/package/boot/uboot-sunxi/Makefile @@ -156,6 +156,12 @@ define U-Boot/orangepi_pc BUILD_DEVICES:=sun8i-h3-orangepi-pc endef +define U-Boot/orangepi_r1_spi + BUILD_SUBTARGET:=cortexa7 + NAME:=Orange Pi R1 (H2+) (boot from SPI) + BUILD_DEVICES:=sun8i-h2-plus-orangepi-r1-spi +endef + define U-Boot/orangepi_plus BUILD_SUBTARGET:=cortexa7 NAME:=Orange Pi Plus (H3) @@ -222,6 +228,7 @@ UBOOT_TARGETS := \ nanopi_neo_plus2 \ orangepi_r1 \ orangepi_pc \ + orangepi_r1_spi \ orangepi_plus \ orangepi_2 \ pangolin \ diff --git a/package/boot/uboot-sunxi/patches/320-sunxi-Add-support-for-Orange-Pi-R1.patch b/package/boot/uboot-sunxi/patches/320-sunxi-Add-support-for-Orange-Pi-R1.patch index af459823ee..82a1c891ba 100644 --- a/package/boot/uboot-sunxi/patches/320-sunxi-Add-support-for-Orange-Pi-R1.patch +++ b/package/boot/uboot-sunxi/patches/320-sunxi-Add-support-for-Orange-Pi-R1.patch @@ -155,3 +155,44 @@ Signed-off-by: Hauke Mehrtens +CONFIG_SPL_SPI_SUNXI=y +CONFIG_SUN8I_EMAC=y +CONFIG_USB_EHCI_HCD=y +--- /dev/null ++++ b/configs/orangepi_r1_spi_defconfig +@@ -0,0 +1,38 @@ ++CONFIG_ARM=y ++CONFIG_ARCH_SUNXI=y ++CONFIG_MACH_SUN8I_H3=y ++CONFIG_DRAM_CLK=624 ++CONFIG_DRAM_ZQ=3881979 ++CONFIG_DRAM_ODT_EN=y ++# CONFIG_VIDEO_DE2 is not set ++CONFIG_DEFAULT_DEVICE_TREE="sun8i-h2-plus-orangepi-r1" ++# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set ++CONFIG_SPI_BOOT=y ++CONFIG_ENV_IS_IN_SPI_FLASH=y ++CONFIG_ENV_OFFSET=0x80000 ++CONFIG_ENV_SIZE=0x10000 ++CONFIG_USE_BOOTARGS=y ++CONFIG_BOOTARGS="console=ttyS0,115200 root=/dev/mtdblock5 rootfstype=squashfs mtdparts=spi0.0:512k(uboot),64k(uboot-env)ro,64k(dtb),-(firmware)" ++CONFIG_CONSOLE_MUX=y ++CONFIG_SPL=y ++# CONFIG_CMD_IMLS is not set ++CONFIG_CMD_SF=y ++CONFIG_CMD_SPI=y ++# CONFIG_CMD_FPGA is not set ++CONFIG_CMD_MTDPARTS=y ++CONFIG_MTDIDS_DEFAULT="spi0.0" ++CONFIG_MTDPARTS_DEFAULT="mtdparts=spi0.0:512k(uboot),64k(uboot-env)ro,64k(dtb),-(firmware)" ++CONFIG_MTD=y ++CONFIG_DM_SPI_FLASH=y ++CONFIG_SPI_FLASH=y ++CONFIG_SPI_FLASH_MACRONIX=y ++CONFIG_SPI_FLASH_MTD=y ++CONFIG_SPL_SPI_SUNXI=y ++CONFIG_SUN8I_EMAC=y ++CONFIG_DM_SPI=y ++CONFIG_SUNXI_SPI=y ++CONFIG_USB_EHCI_HCD=y ++CONFIG_LZMA=y ++CONFIG_OF_LIBFDT_OVERLAY=y ++CONFIG_FDT_FIXUP_PARTITIONS=y ++# CONFIG_EFI_LOADER is not set diff --git a/target/linux/sunxi/image/cortex-a7.mk b/target/linux/sunxi/image/cortex-a7.mk index 986b6395c4..6cc87d49c1 100644 --- a/target/linux/sunxi/image/cortex-a7.mk +++ b/target/linux/sunxi/image/cortex-a7.mk @@ -8,6 +8,15 @@ ifeq ($(SUBTARGET),cortexa7) +define Build/append-uboot + dd if=$(STAGING_DIR_IMAGE)/$(DEVICE_NAME)-u-boot-with-spl.bin >> $@ +endef + +define Build/add-dtb + dd if=$(DTS_DIR)/$(SUNXI_DTS).dtb >> $@ +endef + + define Device/sun7i-a20-olinuxino-lime DEVICE_TITLE:=Olimex A20-OLinuXino-LIME DEVICE_PACKAGES:=kmod-ata-core kmod-ata-sunxi kmod-rtc-sunxi @@ -118,6 +127,19 @@ endef TARGET_DEVICES += sun8i-h2-plus-orangepi-r1 +define Device/sun8i-h2-plus-orangepi-r1-spi + FILESYSTEMS := squashfs + IMAGES := spi-factory.img + IMAGE/spi-factory.img := append-uboot | check-size 512k | pad-to 576k | add-dtb | pad-to 640k | append-kernel | append-rootfs | pad-rootfs | append-metadata + DEVICE_TITLE:=Xunlong Orange Pi R1 boot from SPI + DEVICE_PACKAGES:=kmod-rtc-sunxi kmod-usb-net kmod-usb-net-rtl8152 + SUPPORTED_DEVICES:=xunlong,orangepi-r1-spi + SUNXI_DTS:=sun8i-h2-plus-orangepi-r1 +endef + +TARGET_DEVICES += sun8i-h2-plus-orangepi-r1-spi + + define Device/sun8i-h3-nanopi-m1-plus DEVICE_TITLE:=FriendlyArm NanoPi M1 Plus DEVICE_PACKAGES:=kmod-rtc-sunxi \ -- 2.30.2