diff --git a/layers/meta-resin b/layers/meta-resin index 7192cd2..fe3779d 160000 --- a/layers/meta-resin +++ b/layers/meta-resin @@ -1 +1 @@ -Subproject commit 7192cd27fe72ced1d26f9f6763502370c6087236 +Subproject commit fe3779d036b2535c61c10ba195738cdbfdd630c9 diff --git a/layers/meta-resin-allwinner/conf/machine/nanopi-neo-air.conf b/layers/meta-resin-allwinner/conf/machine/nanopi-neo-air.conf new file mode 100644 index 0000000..bcdf98f --- /dev/null +++ b/layers/meta-resin-allwinner/conf/machine/nanopi-neo-air.conf @@ -0,0 +1,36 @@ +#@TYPE: Machine +#@NAME: nanopi-neo-air +#@DESCRIPTION: Machine configuration for the nanopi-neo-air, base on allwinner H3 CPU + +require conf/machine/include/sun8i.inc + +PREFERRED_VERSION_linux = "4.11.0+git%" +PREFERRED_VERSION_u-boot = "v2017.03%" + +KERNEL_DEVICETREE = "sun8i-h3-nanopi-neo.dtb \ +overlay/sun8i-h3-analog-codec.dtbo \ +overlay/sun8i-h3-cir.dtbo \ +overlay/sun8i-h3-fixup.scr \ +overlay/sun8i-h3-i2c0.dtbo \ +overlay/sun8i-h3-i2c1.dtbo \ +overlay/sun8i-h3-i2c2.dtbo \ +overlay/sun8i-h3-pps-gpio.dtbo \ +overlay/sun8i-h3-pwm.dtbo \ +overlay/sun8i-h3-spdif-out.dtbo \ +overlay/sun8i-h3-spi-add-cs1.dtbo \ +overlay/sun8i-h3-spi-jedec-nor.dtbo \ +overlay/sun8i-h3-spi-spidev.dtbo \ +overlay/sun8i-h3-uart1.dtbo \ +overlay/sun8i-h3-uart2.dtbo \ +overlay/sun8i-h3-uart3.dtbo \ +overlay/sun8i-h3-usbhost0.dtbo \ +overlay/sun8i-h3-usbhost2.dtbo \ +overlay/sun8i-h3-usbhost3.dtbo \ +overlay/sun8i-h3-w1-gpio.dtbo \ +" + +MACHINE_EXTRA_RRECOMMENDS += "linux-firmware-ap6212" + +UBOOT_MACHINE = "nanopi_air_defconfig" + +DEFAULTTUNE = "cortexa7hf-neon-vfpv4" \ No newline at end of file diff --git a/layers/meta-resin-allwinner/recipes-bsp/u-boot/u-boot/add-nanopi-air.patch b/layers/meta-resin-allwinner/recipes-bsp/u-boot/u-boot/add-nanopi-air.patch new file mode 100644 index 0000000..a6e48f1 --- /dev/null +++ b/layers/meta-resin-allwinner/recipes-bsp/u-boot/u-boot/add-nanopi-air.patch @@ -0,0 +1,23 @@ +diff --git a/configs/nanopi_air_defconfig b/configs/nanopi_air_defconfig +new file mode 100644 +index 0000000..61fe8c6 +--- /dev/null ++++ b/configs/nanopi_air_defconfig +@@ -0,0 +1,17 @@ ++CONFIG_ARM=y ++CONFIG_ARCH_SUNXI=y ++CONFIG_MACH_SUN8I_H3=y ++CONFIG_DRAM_CLK=408 ++CONFIG_DRAM_ZQ=3881979 ++CONFIG_DRAM_ODT_EN=y ++CONFIG_DEFAULT_DEVICE_TREE="sun8i-h3-nanopi-neo" ++# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set ++CONFIG_CONSOLE_MUX=y ++CONFIG_SPL=y ++# CONFIG_CMD_IMLS is not set ++# CONFIG_CMD_FLASH is not set ++# CONFIG_CMD_FPGA is not set ++CONFIG_SUN8I_EMAC=y ++CONFIG_USB_EHCI_HCD=y ++CONFIG_SYS_CLK_FREQ=480000000 ++CONFIG_MMC_SUNXI_SLOT_EXTRA=2 diff --git a/layers/meta-resin-allwinner/recipes-bsp/u-boot/u-boot/addjust-nanopi-neo-cpufreq.patch b/layers/meta-resin-allwinner/recipes-bsp/u-boot/u-boot/addjust-nanopi-neo-cpufreq.patch new file mode 100644 index 0000000..5af6505 --- /dev/null +++ b/layers/meta-resin-allwinner/recipes-bsp/u-boot/u-boot/addjust-nanopi-neo-cpufreq.patch @@ -0,0 +1,9 @@ +diff --git a/configs/nanopi_neo_defconfig b/configs/nanopi_neo_defconfig +index 89f5687..25ec9bc 100644 +--- a/configs/nanopi_neo_defconfig ++++ b/configs/nanopi_neo_defconfig +@@ -16,3 +16,4 @@ CONFIG_SPL=y + # CONFIG_SPL_EFI_PARTITION is not set + CONFIG_SUN8I_EMAC=y + CONFIG_USB_EHCI_HCD=y ++CONFIG_SYS_CLK_FREQ=480000000 diff --git a/layers/meta-resin-allwinner/recipes-bsp/u-boot/u-boot_%.bbappend b/layers/meta-resin-allwinner/recipes-bsp/u-boot/u-boot_%.bbappend index 23588f3..c29b240 100644 --- a/layers/meta-resin-allwinner/recipes-bsp/u-boot/u-boot_%.bbappend +++ b/layers/meta-resin-allwinner/recipes-bsp/u-boot/u-boot_%.bbappend @@ -10,6 +10,8 @@ SRC_URI_append = " \ file://h3-set-safe-axi_apb-clock-dividers.patch \ file://h3-adjust-dram-frequency.patch \ file://enable-DT-overlays-support.patch \ + file://add-nanopi-air.patch \ + file://addjust-nanopi-neo-cpufreq.patch \ file://boot.cmd \ file://armbianEnv.txt \ " diff --git a/layers/meta-resin-allwinner/recipes-core/images/resin-image.bbappend b/layers/meta-resin-allwinner/recipes-core/images/resin-image.bbappend index 4784765..2f830f6 100644 --- a/layers/meta-resin-allwinner/recipes-core/images/resin-image.bbappend +++ b/layers/meta-resin-allwinner/recipes-core/images/resin-image.bbappend @@ -1,22 +1,3 @@ -# -# orange-pi-one -# - -IMAGE_FSTYPES_append_orange-pi-one = " resinos-img" - -# Customize resinos-img -RESIN_IMAGE_BOOTLOADER_orange-pi-one = "u-boot" -RESIN_BOOT_PARTITION_FILES_orange-pi-one = " \ - ${KERNEL_IMAGETYPE}${KERNEL_INITRAMFS}-${MACHINE}.bin:/${KERNEL_IMAGETYPE} \ - uImage-sun8i-h3-orangepi-one.dtb:/sun8i-h3-orangepi-one.dtb \ - boot.scr:/boot.scr \ - " - -IMAGE_CMD_resinos-img_append_orange-pi-one () { - # orange-pi-one needs uboot written at a specific location - dd if=${DEPLOY_DIR_IMAGE}/u-boot-sunxi-with-spl.bin of=${RESIN_RAW_IMG} conv=notrunc seek=8 bs=1024 -} - # # orange-pi-lite # @@ -57,20 +38,40 @@ IMAGE_CMD_resinos-img_append_orange-pi-lite () { } # -# orange-pi-plus2e +# nanopi-neo-air # -IMAGE_FSTYPES_append_orange-pi-plus2e = " resinos-img" +IMAGE_FSTYPES_append_nanopi-neo-air = " resinos-img" # Customize resinos-img -RESIN_IMAGE_BOOTLOADER_orange-pi-plus2e = "u-boot" -RESIN_BOOT_PARTITION_FILES_orange-pi-plus2e = " \ +RESIN_IMAGE_BOOTLOADER_nanopi-neo-air = "u-boot" +RESIN_BOOT_PARTITION_FILES_nanopi-neo-air = " \ ${KERNEL_IMAGETYPE}${KERNEL_INITRAMFS}-${MACHINE}.bin:/${KERNEL_IMAGETYPE} \ - uImage-sun8i-h3-orangepi-plus2e.dtb:/sun8i-h3-orangepi-plus2e.dtb \ + uImage-sun8i-h3-nanopi-neo.dtb:/dtb/sun8i-h3-nanopi-neo.dtb \ + uImage-sun8i-h3-fixup.scr:/dtb/overlay/sun8i-h3-fixup.scr \ + uImage-sun8i-h3-analog-codec.dtbo:/dtb/overlay/sun8i-h3-analog-codec.dtbo \ + uImage-sun8i-h3-cir.dtbo:/dtb/overlay/sun8i-h3-cir.dtbo \ + uImage-sun8i-h3-i2c0.dtbo:/dtb/overlay/sun8i-h3-i2c0.dtbo \ + uImage-sun8i-h3-i2c1.dtbo:/dtb/overlay/sun8i-h3-i2c1.dtbo \ + uImage-sun8i-h3-i2c2.dtbo:/dtb/overlay/sun8i-h3-i2c2.dtbo \ + uImage-sun8i-h3-pps-gpio.dtbo:/dtb/overlay/sun8i-h3-pps-gpio.dtbo \ + uImage-sun8i-h3-pwm.dtbo:/dtb/overlay/sun8i-h3-pwm.dtbo \ + uImage-sun8i-h3-spdif-out.dtbo:/dtb/overlay/sun8i-h3-spdif-out.dtbo \ + uImage-sun8i-h3-spi-add-cs1.dtbo:/dtb/overlay/sun8i-h3-spi-add-cs1.dtbo \ + uImage-sun8i-h3-spi-jedec-nor.dtbo:/dtb/overlay/sun8i-h3-spi-jedec-nor.dtbo \ + uImage-sun8i-h3-spi-spidev.dtbo:/dtb/overlay/sun8i-h3-spi-spidev.dtbo \ + uImage-sun8i-h3-uart1.dtbo:/dtb/overlay/sun8i-h3-uart1.dtbo \ + uImage-sun8i-h3-uart2.dtbo:/dtb/overlay/sun8i-h3-uart2.dtbo \ + uImage-sun8i-h3-uart3.dtbo:/dtb/overlay/sun8i-h3-uart3.dtbo \ + uImage-sun8i-h3-usbhost0.dtbo:/dtb/overlay/sun8i-h3-usbhost0.dtbo \ + uImage-sun8i-h3-usbhost2.dtbo:/dtb/overlay/sun8i-h3-usbhost1.dtbo \ + uImage-sun8i-h3-usbhost3.dtbo:/dtb/overlay/sun8i-h3-usbhost2.dtbo \ + uImage-sun8i-h3-w1-gpio.dtbo:/dtb/overlay/sun8i-h3-w1-gpio.dtbo \ boot.scr:/boot.scr \ + armbianEnv.txt:/ \ " -IMAGE_CMD_resinos-img_append_orange-pi-plus2e () { - # orange-pi-plus2e needs uboot written at a specific location +IMAGE_CMD_resinos-img_append_nanopi-neo-air () { + # nanopi-neo-air needs uboot written at a specific location dd if=${DEPLOY_DIR_IMAGE}/u-boot-sunxi-with-spl.bin of=${RESIN_RAW_IMG} conv=notrunc seek=8 bs=1024 -} \ No newline at end of file +} diff --git a/layers/meta-resin-allwinner/recipes-core/packagegroups/packagegroup-resin-connectivity.bbappend b/layers/meta-resin-allwinner/recipes-core/packagegroups/packagegroup-resin-connectivity.bbappend new file mode 100644 index 0000000..03518eb --- /dev/null +++ b/layers/meta-resin-allwinner/recipes-core/packagegroups/packagegroup-resin-connectivity.bbappend @@ -0,0 +1 @@ +CONNECTIVITY_FIRMWARES_append = " linux-firmware-ap6212" diff --git a/layers/meta-resin-allwinner/recipes-kernel/linux-firmware/files/fw_bcm43438a0.bin b/layers/meta-resin-allwinner/recipes-kernel/linux-firmware/files/fw_bcm43438a0.bin new file mode 100644 index 0000000..59972d5 Binary files /dev/null and b/layers/meta-resin-allwinner/recipes-kernel/linux-firmware/files/fw_bcm43438a0.bin differ diff --git a/layers/meta-resin-allwinner/recipes-kernel/linux-firmware/files/fw_bcm43438a1.bin b/layers/meta-resin-allwinner/recipes-kernel/linux-firmware/files/fw_bcm43438a1.bin new file mode 100644 index 0000000..e815f44 Binary files /dev/null and b/layers/meta-resin-allwinner/recipes-kernel/linux-firmware/files/fw_bcm43438a1.bin differ diff --git a/layers/meta-resin-allwinner/recipes-kernel/linux-firmware/files/nvram_ap6212.txt b/layers/meta-resin-allwinner/recipes-kernel/linux-firmware/files/nvram_ap6212.txt new file mode 100644 index 0000000..578376c --- /dev/null +++ b/layers/meta-resin-allwinner/recipes-kernel/linux-firmware/files/nvram_ap6212.txt @@ -0,0 +1,54 @@ +#AP6212_NVRAM_V1.0_20140603 +# 2.4 GHz, 20 MHz BW mode + +# The following parameter values are just placeholders, need to be updated. +manfid=0x2d0 +prodid=0x0726 +vendid=0x14e4 +devid=0x43e2 +boardtype=0x0726 +boardrev=0x1101 +boardnum=22 +macaddr=00:90:4c:c5:12:38 +sromrev=11 +boardflags=0x00404201 +xtalfreq=26000 +nocrc=1 +ag0=255 +aa2g=1 +ccode=ALL + +pa0itssit=0x20 +extpagain2g=0 + +#PA parameters for 2.4GHz, measured at CHIP OUTPUT +pa2ga0=-168,7161,-820 +AvVmid_c0=0x0,0xc8 +cckpwroffset0=5 + +# PPR params +maxp2ga0=90 +txpwrbckof=6 +cckbw202gpo=0x5555 +legofdmbw202gpo=0x77777777 +mcsbw202gpo=0xaaaaaaaa + +# OFDM IIR : +ofdmdigfilttype=7 +# PAPD mode: +papdmode=2 + +il0macaddr=00:90:4c:c5:12:38 +wl0id=0x431b + +#OOB parameters +hostwake=0x40 +hostrdy=0x41 +usbrdy=0x03 +usbrdydelay=100 +deadman_to=0xffffffff +# muxenab: 0x1 for UART enable, 0x10 for Host awake +muxenab=0x10 +# CLDO PWM voltage settings - 0x4 - 1.1 volt +#cldo_pwm=0x4 + diff --git a/layers/meta-resin-allwinner/recipes-kernel/linux-firmware/linux-firmware_%.bbappend b/layers/meta-resin-allwinner/recipes-kernel/linux-firmware/linux-firmware_%.bbappend new file mode 100644 index 0000000..33ac901 --- /dev/null +++ b/layers/meta-resin-allwinner/recipes-kernel/linux-firmware/linux-firmware_%.bbappend @@ -0,0 +1,18 @@ +FILESEXTRAPATHS_prepend := "${THISDIR}/files:" + +SRC_URI_append = " \ + file://nvram_ap6212.txt \ + file://fw_bcm43438a0.bin \ + " + +do_install_append() { + cp ${WORKDIR}/nvram_ap6212.txt ${D}/lib/firmware/brcm/brcmfmac43430-sdio.txt + cp ${WORKDIR}/fw_bcm43438a0.bin ${D}/lib/firmware/brcm/brcmfmac43430-sdio.bin +} + +PACKAGES =+ "${PN}-ap6212" + +FILES_${PN}-ap6212 = " \ + /lib/firmware/brcm/brcmfmac43430-sdio.txt \ + /lib/firmware/brcm/brcmfmac43430-sdio.bin \ +" \ No newline at end of file diff --git a/layers/meta-resin-allwinner/recipes-kernel/linux/linux/411-add-dvfs-emac-nanopi.patch b/layers/meta-resin-allwinner/recipes-kernel/linux/linux/411-add-dvfs-emac-nanopi.patch new file mode 100644 index 0000000..35294bb --- /dev/null +++ b/layers/meta-resin-allwinner/recipes-kernel/linux/linux/411-add-dvfs-emac-nanopi.patch @@ -0,0 +1,103 @@ +diff --git a/arch/arm/boot/dts/sun8i-h3-nanopi.dtsi b/arch/arm/boot/dts/sun8i-h3-nanopi.dtsi +index 2216e68d..143ebc06 100644 +--- a/arch/arm/boot/dts/sun8i-h3-nanopi.dtsi ++++ b/arch/arm/boot/dts/sun8i-h3-nanopi.dtsi +@@ -48,6 +48,7 @@ + #include + #include + #include ++#include + + / { + aliases { +@@ -88,12 +89,90 @@ + gpios = <&r_pio 0 3 GPIO_ACTIVE_LOW>; + }; + }; ++ ++ vdd_cpux: gpio-regulator { ++ compatible = "regulator-gpio"; ++ regulator-name = "vdd-cpux"; ++ regulator-type = "voltage"; ++ regulator-boot-on; ++ regulator-always-on; ++ regulator-min-microvolt = <1100000>; ++ regulator-max-microvolt = <1300000>; ++ regulator-ramp-delay = <50>; /* 4ms */ ++ gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; ++ gpios-states = <0x1>; ++ states = <1100000 0x0 ++ 1300000 0x1>; ++ }; ++}; ++ ++&cpu0 { ++ operating-points = < ++ 1008000 1300000 ++ 816000 1100000 ++ 624000 1100000 ++ 480000 1100000 ++ 312000 1100000 ++ 240000 1100000 ++ 120000 1100000 ++ >; ++ #cooling-cells = <2>; ++ cooling-min-level = <0>; ++ cooling-max-level = <6>; ++ cpu0-supply = <&vdd_cpux>; ++}; ++ ++&cpu_thermal { ++ trips { ++ cpu_warm: cpu_warm { ++ temperature = <65000>; ++ hysteresis = <2000>; ++ type = "passive"; ++ }; ++ cpu_hot: cpu_hot { ++ temperature = <75000>; ++ hysteresis = <2000>; ++ type = "passive"; ++ }; ++ cpu_very_hot: cpu_very_hot { ++ temperature = <90000>; ++ hysteresis = <2000>; ++ type = "passive"; ++ }; ++ cpu_crit: cpu_crit { ++ temperature = <105000>; ++ hysteresis = <2000>; ++ type = "critical"; ++ }; ++ }; ++ ++ cooling-maps { ++ cpu_warm_limit_cpu { ++ trip = <&cpu_warm>; ++ cooling-device = <&cpu0 THERMAL_NO_LIMIT 1>; ++ }; ++ cpu_hot_limit_cpu { ++ trip = <&cpu_hot>; ++ cooling-device = <&cpu0 2 3>; ++ }; ++ cpu_very_hot_limit_cpu { ++ trip = <&cpu_very_hot>; ++ cooling-device = <&cpu0 5 THERMAL_NO_LIMIT>; ++ }; ++ }; + }; + + &ehci3 { + status = "okay"; + }; + ++&emac { ++ phy-handle = <&int_mii_phy>; ++ phy-mode = "mii"; ++ allwinner,leds-active-low; ++ status = "okay"; ++}; ++ + &mmc0 { + bus-width = <4>; + cd-gpios = <&pio 5 6 GPIO_ACTIVE_HIGH>; diff --git a/layers/meta-resin-allwinner/recipes-kernel/linux/linux/411-add-nanopi-neoair.patch b/layers/meta-resin-allwinner/recipes-kernel/linux/linux/411-add-nanopi-neoair.patch new file mode 100644 index 0000000..3b780fd --- /dev/null +++ b/layers/meta-resin-allwinner/recipes-kernel/linux/linux/411-add-nanopi-neoair.patch @@ -0,0 +1,53 @@ +diff --git a/arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts b/arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts +index 8d2cc6e9..9160d42e 100644 +--- a/arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts ++++ b/arch/arm/boot/dts/sun8i-h3-nanopi-neo.dts +@@ -45,4 +45,48 @@ + / { + model = "FriendlyARM NanoPi NEO"; + compatible = "friendlyarm,nanopi-neo", "allwinner,sun8i-h3"; ++ ++ aliases { ++ serial3 = &uart3; ++ }; ++ ++ wifi_pwrseq: wifi_pwrseq { ++ compatible = "mmc-pwrseq-simple"; ++ reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>; /* PL7 */ ++ }; ++}; ++ ++&mmc1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&mmc1_pins_a>; ++ vmmc-supply = <®_vcc3v3>; ++ vqmmc-supply = <®_vcc3v3>; ++ mmc-pwrseq = <&wifi_pwrseq>; ++ bus-width = <4>; ++ non-removable; ++ status = "okay"; ++ ++ brcmf: bcrmf@1 { ++ reg = <1>; ++ compatible = "brcm,bcm4329-fmac"; ++ interrupt-parent = <&pio>; ++ interrupts = <6 10 IRQ_TYPE_LEVEL_LOW>; /* PG10 / EINT10 */ ++ interrupt-names = "host-wake"; ++ }; ++}; ++ ++&mmc2 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&mmc2_8bit_pins>; ++ vmmc-supply = <®_vcc3v3>; ++ vqmmc-supply = <®_vcc3v3>; ++ bus-width = <8>; ++ non-removable; ++ status = "okay"; ++}; ++ ++&uart3 { /* Connected to AP6212 on Neo Air */ ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart3_pins>; ++ status = "okay"; + }; diff --git a/layers/meta-resin-allwinner/recipes-kernel/linux/linux_%.bbappend b/layers/meta-resin-allwinner/recipes-kernel/linux/linux_%.bbappend index 517579d..b91750c 100644 --- a/layers/meta-resin-allwinner/recipes-kernel/linux/linux_%.bbappend +++ b/layers/meta-resin-allwinner/recipes-kernel/linux/linux_%.bbappend @@ -17,6 +17,8 @@ SRC_URI_append = "git://github.com/megous/linux.git;protocol=git;branch=orange-p file://411-add-overlay-compilation-support.patch \ file://411-scripts-dtc-import-updates.patch \ file://411-add-ad9834-dt-bindings.patch \ + file://411-add-nanopi-neoair.patch \ + file://411-add-dvfs-emac-nanopi.patch \ " SRC_URI_append_orange-pi-lite = " \ @@ -91,6 +93,10 @@ RESIN_CONFIGS[sunxi] ?= " \ CONFIG_PHY_SUN4I_USB=y \ CONFIG_PHY_SUN9I_USB=y \ CONFIG_CRYPTO_DEV_SUN4I_SS=m \ + CONFIG_BRCMUTIL=m \ + CONFIG_BRCMFMAC=m \ + CONFIG_BRCMFMAC_PROTO_BCDC=y \ + CONFIG_BRCMFMAC_SDIO=y \ " RESIN_CONFIGS[audio] ?= " \ diff --git a/orange-pi-one.coffee b/nanopi-neo-air.coffee similarity index 80% rename from orange-pi-one.coffee rename to nanopi-neo-air.coffee index 6de0db9..2a9c12c 100644 --- a/orange-pi-one.coffee +++ b/nanopi-neo-air.coffee @@ -4,8 +4,8 @@ deviceTypesCommon = require '@resin.io/device-types/common' module.exports = version: 1 - slug: 'orange-pi-one' - name: 'orange pi one' + slug: 'nanopi-neo-air' + name: 'Nanopi Neo Air' arch: 'armv7hf' state: 'experimental' @@ -19,11 +19,11 @@ module.exports = options: [ networkOptions.group ] yocto: - machine: 'orange-pi-one' + machine: 'nanopi-neo-air' image: 'resin-image' fstype: 'resinos-img' version: 'yocto-morty' - deployArtifact: 'resin-image-orange-pi-one.resinos-img' + deployArtifact: 'resin-image-nanopi-neo-air.resinos-img' compressed: true configuration: @@ -32,4 +32,4 @@ module.exports = primary: 1 path: '/config.json' - initialization: commonImg.initialization + initialization: commonImg.initialization \ No newline at end of file