From 6ee779b74439d1e3eda498a67fa031bde92e3a39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Igor=20Pe=C4=8Dovnik?= Date: Sat, 23 Jun 2018 13:28:27 +0000 Subject: [PATCH] Enable ramlog only if it was enabled before. This fixes possible troubles on OMV installs. Adjusted Odroid NEXT kernel configuration, fixes eMMC/SD card u-boot updating if not on the first place /dev/mmcblk0 ... checks also 1 and 2, move nanopik1plus to supported list --- .../{nanopik1plus.csc => nanopik1plus.conf} | 4 +- config/kernel/linux-odroidc2-next.config | 37 +- lib/compilation.sh | 7 +- lib/makeboarddeb.sh | 31 +- .../sunxi-next/board-nanopi-k1-add.patch | 396 ++++++++++++++++++ .../add-xx-nanopi-k1-plus-emmc.patch | 144 +++++++ 6 files changed, 603 insertions(+), 16 deletions(-) rename config/boards/{nanopik1plus.csc => nanopik1plus.conf} (83%) create mode 100644 patch/kernel/sunxi-next/board-nanopi-k1-add.patch create mode 100644 patch/u-boot/u-boot-sunxi/add-xx-nanopi-k1-plus-emmc.patch diff --git a/config/boards/nanopik1plus.csc b/config/boards/nanopik1plus.conf similarity index 83% rename from config/boards/nanopik1plus.csc rename to config/boards/nanopik1plus.conf index 125a0e53a5..9ebc3e5369 100644 --- a/config/boards/nanopik1plus.csc +++ b/config/boards/nanopik1plus.conf @@ -7,9 +7,9 @@ MODULES_NEXT="" CPUMIN="408000" CPUMAX="1296000" # -KERNEL_TARGET="dev" +KERNEL_TARGET="next,dev" CLI_TARGET="" DESKTOP_TARGET="" # CLI_BETA_TARGET="" -DESKTOP_BETA_TARGET="" \ No newline at end of file +DESKTOP_BETA_TARGET="" diff --git a/config/kernel/linux-odroidc2-next.config b/config/kernel/linux-odroidc2-next.config index cbe7389c75..22132363b9 100644 --- a/config/kernel/linux-odroidc2-next.config +++ b/config/kernel/linux-odroidc2-next.config @@ -1,6 +1,6 @@ # # Automatically generated file; DO NOT EDIT. -# Linux/arm64 4.14.39 Kernel Configuration +# Linux/arm64 4.14.51 Kernel Configuration # CONFIG_ARM64=y CONFIG_64BIT=y @@ -426,6 +426,7 @@ CONFIG_ARM64_ERRATUM_832075=y CONFIG_ARM64_ERRATUM_834220=y CONFIG_ARM64_ERRATUM_845719=y CONFIG_ARM64_ERRATUM_843419=y +CONFIG_ARM64_ERRATUM_1024718=y CONFIG_CAVIUM_ERRATUM_22375=y CONFIG_CAVIUM_ERRATUM_23154=y CONFIG_CAVIUM_ERRATUM_27456=y @@ -1041,6 +1042,9 @@ CONFIG_NF_CONNTRACK_IPV6=m CONFIG_NF_SOCKET_IPV6=y CONFIG_NF_TABLES_IPV6=m CONFIG_NFT_CHAIN_ROUTE_IPV6=m +CONFIG_NFT_CHAIN_NAT_IPV6=m +CONFIG_NFT_MASQ_IPV6=m +CONFIG_NFT_REDIR_IPV6=m CONFIG_NFT_REJECT_IPV6=m CONFIG_NFT_DUP_IPV6=m CONFIG_NFT_FIB_IPV6=m @@ -1048,10 +1052,7 @@ CONFIG_NF_DUP_IPV6=m CONFIG_NF_REJECT_IPV6=m CONFIG_NF_LOG_IPV6=m CONFIG_NF_NAT_IPV6=m -CONFIG_NFT_CHAIN_NAT_IPV6=m CONFIG_NF_NAT_MASQUERADE_IPV6=m -CONFIG_NFT_MASQ_IPV6=m -CONFIG_NFT_REDIR_IPV6=m CONFIG_IP6_NF_IPTABLES=m CONFIG_IP6_NF_MATCH_AH=m CONFIG_IP6_NF_MATCH_EUI64=m @@ -1274,6 +1275,7 @@ CONFIG_6PACK=m CONFIG_BPQETHER=m CONFIG_BAYCOM_SER_FDX=m CONFIG_BAYCOM_SER_HDX=m +CONFIG_BAYCOM_PAR=m CONFIG_YAM=m CONFIG_CAN=m CONFIG_CAN_RAW=m @@ -1562,8 +1564,12 @@ CONFIG_OF_IRQ=y CONFIG_OF_NET=y CONFIG_OF_MDIO=y CONFIG_OF_RESERVED_MEM=y -CONFIG_OF_OVERLAY=m +# CONFIG_OF_OVERLAY is not set CONFIG_PARPORT=m +# CONFIG_PARPORT_GSC is not set +CONFIG_PARPORT_AX88796=m +# CONFIG_PARPORT_1284 is not set +CONFIG_PARPORT_NOT_PC=y CONFIG_BLK_DEV=y CONFIG_BLK_DEV_NULL_BLK=m CONFIG_ZRAM=m @@ -1974,6 +1980,7 @@ CONFIG_ROCKCHIP_PHY=y # CONFIG_VITESSE_PHY is not set # CONFIG_XILINX_GMII2RGMII is not set # CONFIG_MICREL_KS8995MA is not set +CONFIG_PLIP=m CONFIG_PPP=m CONFIG_PPP_BSDCOMP=m CONFIG_PPP_DEFLATE=m @@ -2274,6 +2281,7 @@ CONFIG_INPUT_XEN_KBDDEV_FRONTEND=y # CONFIG_SERIO=y # CONFIG_SERIO_SERPORT is not set +CONFIG_SERIO_PARKBD=m CONFIG_SERIO_AMBAKMI=y CONFIG_SERIO_LIBPS2=y # CONFIG_SERIO_RAW is not set @@ -2351,6 +2359,9 @@ CONFIG_SERIAL_XILINX_PS_UART_CONSOLE=y # CONFIG_SERIAL_CONEXANT_DIGICOLOR is not set CONFIG_SERIAL_DEV_BUS=m CONFIG_TTY_PRINTK=m +CONFIG_PRINTER=m +# CONFIG_LP_CONSOLE is not set +CONFIG_PPDEV=m CONFIG_HVC_DRIVER=y CONFIG_HVC_IRQ=y CONFIG_HVC_XEN=y @@ -2394,6 +2405,7 @@ CONFIG_I2C_MUX_PCA954x=y # CONFIG_I2C_DEMUX_PINCTRL is not set # CONFIG_I2C_MUX_MLXCPLD is not set CONFIG_I2C_HELPER_AUTO=y +CONFIG_I2C_SMBUS=m CONFIG_I2C_ALGOBIT=m # @@ -2423,6 +2435,7 @@ CONFIG_I2C_RK3X=y # External I2C/SMBus adapter drivers # # CONFIG_I2C_DIOLAN_U2C is not set +CONFIG_I2C_PARPORT=m # CONFIG_I2C_PARPORT_LIGHT is not set # CONFIG_I2C_ROBOTFUZZ_OSIF is not set # CONFIG_I2C_TAOS_EVM is not set @@ -2447,10 +2460,12 @@ CONFIG_SPI_MASTER=y # # CONFIG_SPI_ALTERA is not set # CONFIG_SPI_AXI_SPI_ENGINE is not set -# CONFIG_SPI_BITBANG is not set +CONFIG_SPI_BITBANG=m +CONFIG_SPI_BUTTERFLY=m # CONFIG_SPI_CADENCE is not set # CONFIG_SPI_DESIGNWARE is not set # CONFIG_SPI_GPIO is not set +CONFIG_SPI_LM70_LLP=m # CONFIG_SPI_FSL_SPI is not set CONFIG_SPI_MESON_SPICC=m CONFIG_SPI_MESON_SPIFC=m @@ -2480,6 +2495,7 @@ CONFIG_PPS=y # # CONFIG_PPS_CLIENT_KTIMER is not set # CONFIG_PPS_CLIENT_LDISC is not set +CONFIG_PPS_CLIENT_PARPORT=m # CONFIG_PPS_CLIENT_GPIO is not set # @@ -3655,8 +3671,10 @@ CONFIG_SND_DRIVERS=y # CONFIG_SND_DUMMY is not set # CONFIG_SND_ALOOP is not set # CONFIG_SND_MTPAV is not set +CONFIG_SND_MTS64=m # CONFIG_SND_SERIAL_U16550 is not set # CONFIG_SND_MPU401 is not set +CONFIG_SND_PORTMAN2X4=m # # HD-Audio @@ -4056,6 +4074,7 @@ CONFIG_USB_ISP1760_DUAL_ROLE=y # # USB port drivers # +CONFIG_USB_USS720=m CONFIG_USB_SERIAL=m CONFIG_USB_SERIAL_GENERIC=y CONFIG_USB_SERIAL_SIMPLE=m @@ -4098,6 +4117,7 @@ CONFIG_USB_SERIAL_KOBIL_SCT=m CONFIG_USB_SERIAL_MCT_U232=m CONFIG_USB_SERIAL_METRO=m CONFIG_USB_SERIAL_MOS7720=m +# CONFIG_USB_SERIAL_MOS7715_PARPORT is not set CONFIG_USB_SERIAL_MOS7840=m CONFIG_USB_SERIAL_MXUPORT=m CONFIG_USB_SERIAL_NAVMAN=m @@ -4503,6 +4523,11 @@ CONFIG_DMA_ENGINE_RAID=y CONFIG_SYNC_FILE=y # CONFIG_SW_SYNC is not set # CONFIG_AUXDISPLAY is not set +CONFIG_CHARLCD=m +CONFIG_PANEL=m +CONFIG_PANEL_PARPORT=0 +CONFIG_PANEL_PROFILE=5 +# CONFIG_PANEL_CHANGE_MESSAGE is not set # CONFIG_UIO is not set CONFIG_VFIO_IOMMU_TYPE1=y # CONFIG_VFIO_VIRQFD is not set diff --git a/lib/compilation.sh b/lib/compilation.sh index 7b85ff8e1d..693bcc509a 100644 --- a/lib/compilation.sh +++ b/lib/compilation.sh @@ -191,7 +191,12 @@ compile_uboot() #!/bin/bash source /usr/lib/u-boot/platform_install.sh [[ \$DEVICE == /dev/null ]] && exit 0 - [[ -z \$DEVICE ]] && DEVICE="/dev/mmcblk0" + if [[ -z \$DEVICE ]]; then + DEVICE="/dev/mmcblk0" + # proceed to other options. + [ ! -b \$DEVICE ] && DEVICE="/dev/mmcblk1" + [ ! -b \$DEVICE ] && DEVICE="/dev/mmcblk2" + fi [[ \$(type -t setup_write_uboot_platform) == function ]] && setup_write_uboot_platform if [[ -b \$DEVICE ]]; then echo "Updating u-boot on \$DEVICE" >&2 diff --git a/lib/makeboarddeb.sh b/lib/makeboarddeb.sh index 88ee422312..52ce90bc65 100644 --- a/lib/makeboarddeb.sh +++ b/lib/makeboarddeb.sh @@ -53,7 +53,7 @@ create_board_package() mv /etc/network/interfaces.tmp /etc/network/interfaces fi # disable deprecated services - systemctl disable armhwinfo.service log2ram.service >/dev/null 2>&1 + systemctl disable armhwinfo.service >/dev/null 2>&1 # [ -f "/etc/profile.d/activate_psd_user.sh" ] && rm /etc/profile.d/activate_psd_user.sh [ -f "/etc/profile.d/check_first_login.sh" ] && rm /etc/profile.d/check_first_login.sh @@ -76,20 +76,15 @@ create_board_package() [ -f "/etc/apt/apt.conf.d/02compress-indexes" ] && rm /etc/apt/apt.conf.d/02compress-indexes [ -f "/etc/apt/apt.conf.d/02periodic" ] && rm /etc/apt/apt.conf.d/02periodic [ -f "/etc/apt/apt.conf.d/no-languages" ] && rm /etc/apt/apt.conf.d/no-languages - [ -f "/etc/cron.daily/log2ram" ] && rm /etc/cron.daily/log2ram - [ -f "/etc/default/log2ram.dpkg-dist" ] && rm /etc/default/log2ram.dpkg-dist [ -f "/etc/init.d/armhwinfo" ] && rm /etc/init.d/armhwinfo [ -f "/etc/logrotate.d/armhwinfo" ] && rm /etc/logrotate.d/armhwinfo [ -f "/etc/init.d/firstrun" ] && rm /etc/init.d/firstrun [ -f "/etc/init.d/resize2fs" ] && rm /etc/init.d/resize2fs [ -f "/lib/systemd/system/firstrun-config.service" ] && rm /lib/systemd/system/firstrun-config.service [ -f "/lib/systemd/system/firstrun.service" ] && rm /lib/systemd/system/firstrun.service - [ -f "/lib/systemd/system/log2ram.service" ] && rm /lib/systemd/system/log2ram.service [ -f "/lib/systemd/system/resize2fs.service" ] && rm /lib/systemd/system/resize2fs.service [ -f "/usr/lib/armbian/apt-updates" ] && rm /usr/lib/armbian/apt-updates [ -f "/usr/lib/armbian/firstrun-config.sh" ] && rm /usr/lib/armbian/firstrun-config.sh - [ -f "/usr/sbin/log2ram" ] && rm /usr/sbin/log2ram - [ -f "/usr/share/log2ram/LICENSE" ] && rm -r /usr/share/log2ram # make a backup since we are unconditionally overwriting this on update [ -f "/etc/default/cpufrequtils" ] && cp /etc/default/cpufrequtils /etc/default/cpufrequtils.dpkg-old dpkg-divert --package linux-${RELEASE}-root-${DEB_BRANCH}${BOARD} --add --rename \ @@ -115,6 +110,28 @@ create_board_package() # set up post install script cat <<-EOF > $destination/DEBIAN/postinst #!/bin/sh + # + # ${BOARD} BSP post installation script + # + + # enable ramlog only if it was enabled before + if [ -n "\$(service log2ram status 2> /dev/null)" ]; then + systemctl --no-reload enable armbian-ramlog.service + fi + + # check if it was disabled in config and disable in new service + if [ -n "\$(grep -w '^ENABLED=false' /etc/default/log2ram 2> /dev/null)" ]; then + sed -i "s/^ENABLED=.*/ENABLED=false/" /etc/default/armbian-ramlog + fi + + # now cleanup and remove old ramlog service + systemctl disable log2ram.service >/dev/null 2>&1 + [ -f "/usr/sbin/log2ram" ] && rm /usr/sbin/log2ram + [ -f "/usr/share/log2ram/LICENSE" ] && rm -r /usr/share/log2ram + [ -f "/lib/systemd/system/log2ram.service" ] && rm /lib/systemd/system/log2ram.service + [ -f "/etc/cron.daily/log2ram" ] && rm /etc/cron.daily/log2ram + [ -f "/etc/default/log2ram.dpkg-dist" ] && rm /etc/default/log2ram.dpkg-dist + [ ! -f "/etc/network/interfaces" ] && cp /etc/network/interfaces.default /etc/network/interfaces ln -sf /var/run/motd /etc/motd rm -f /etc/update-motd.d/00-header /etc/update-motd.d/10-help-text @@ -130,7 +147,7 @@ create_board_package() mv /etc/default/armbian-zram-config.dpkg-dist /etc/default/armbian-zram-config fi - systemctl --no-reload enable armbian-hardware-monitor.service armbian-hardware-optimize.service armbian-zram-config.service armbian-ramlog.service >/dev/null 2>&1 + systemctl --no-reload enable armbian-hardware-monitor.service armbian-hardware-optimize.service armbian-zram-config.service >/dev/null 2>&1 exit 0 EOF diff --git a/patch/kernel/sunxi-next/board-nanopi-k1-add.patch b/patch/kernel/sunxi-next/board-nanopi-k1-add.patch new file mode 100644 index 0000000000..46b65e6a52 --- /dev/null +++ b/patch/kernel/sunxi-next/board-nanopi-k1-add.patch @@ -0,0 +1,396 @@ +From ba9ba2949e86b5a00b0ae89b5e298b4cd46118ee Mon Sep 17 00:00:00 2001 +From: wuweidong <625769020@qq.com> +Date: Mon, 27 Nov 2017 10:23:51 +0800 +Subject: [PATCH] arm64: dts: sun50i-h5-nanopi: Add a new board NanoPi K1 Plus + +--- + arch/arm64/boot/dts/allwinner/Makefile | 1 + + .../allwinner/sun50i-h5-nanopi-k1-plus.dts | 555 ++++++++++++++++++ + 2 files changed, 556 insertions(+) + create mode 100644 arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-k1-plus.dts + +diff --git a/arch/arm64/boot/dts/allwinner/Makefile b/arch/arm64/boot/dts/allwinner/Makefile +index c03224962034..eb4494332002 100644 +--- a/arch/arm64/boot/dts/allwinner/Makefile ++++ b/arch/arm64/boot/dts/allwinner/Makefile +@@ -10,6 +10,7 @@ dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-pinebook.dtb + dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-sopine-baseboard.dtb + dtb-$(CONFIG_ARCH_SUNXI) += sun50i-a64-teres-i.dtb + dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-orangepi-pc2.dtb ++dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-nanopi-k1-plus.dtb + dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-orangepi-prime.dtb + dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-orangepi-zero-plus.dtb + dtb-$(CONFIG_ARCH_SUNXI) += sun50i-h5-orangepi-zero-plus2.dtb +diff --git a/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-k1-plus.dts b/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-k1-plus.dts +new file mode 100644 +index 000000000000..52337a18721f +--- /dev/null ++++ b/arch/arm64/boot/dts/allwinner/sun50i-h5-nanopi-k1-plus.dts +@@ -0,0 +1,366 @@ ++/* ++ * Copyright (C) 2016 ARM Ltd. ++ * ++ * 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. ++ * ++ * 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 "sun50i-h5.dtsi" ++ ++#include ++#include ++#include ++ ++/ { ++ model = "FriendlyElec NanoPi K1 Plus"; ++ compatible = "friendlyelec,nanopi-k1-plus", "allwinner,sun50i-h5"; ++ ++ reg_vcc3v3: vcc3v3 { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc3v3"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ }; ++ ++ aliases { ++ ethernet0 = &emac; ++ serial0 = &uart0; ++ }; ++ ++ chosen { ++ stdout-path = "serial0:115200n8"; ++ }; ++ ++ connector { ++ compatible = "hdmi-connector"; ++ type = "a"; ++ ++ port { ++ hdmi_con_in: endpoint { ++ remote-endpoint = <&hdmi_out_con>; ++ }; ++ }; ++ }; ++ ++ leds { ++ compatible = "gpio-leds"; ++ ++ status { ++ label = "nanopi:blue:status"; ++ gpios = <&pio 0 10 GPIO_ACTIVE_HIGH>; ++ }; ++ pwr { ++ label = "nanopi:green:pwr"; ++ gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>; ++ default-state = "on"; ++ }; ++ ++ }; ++ ++ r-gpio-keys { ++ compatible = "gpio-keys"; ++ ++ sw4 { ++ label = "sw4"; ++ linux,code = ; ++ gpios = <&r_pio 0 3 GPIO_ACTIVE_LOW>; ++ }; ++ }; ++ ++ reg_gmac_3v3: gmac-3v3 { ++ compatible = "regulator-fixed"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&gmac_power_pin_nanopi>; ++ regulator-name = "gmac-3v3"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ startup-delay-us = <100000>; ++ enable-active-high; ++ gpio = <&pio 3 6 GPIO_ACTIVE_HIGH>; ++ }; ++ ++ reg_usb0_vbus: usb0-vbus { ++ compatible = "regulator-fixed"; ++ regulator-name = "usb0-vbus"; ++ regulator-min-microvolt = <5000000>; ++ regulator-max-microvolt = <5000000>; ++ enable-active-high; ++ gpio = <&r_pio 0 2 GPIO_ACTIVE_HIGH>; /* PL2 */ ++ status = "okay"; ++ }; ++ ++ wifi_pwrseq: wifi_pwrseq { ++ compatible = "mmc-pwrseq-simple"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&wifi_en_npi>; ++ reset-gpios = <&r_pio 0 7 GPIO_ACTIVE_LOW>; /* PL7 */ ++ post-power-on-delay-ms = <200>; ++ }; ++ ++ rfkill_bt { ++ compatible = "rfkill-gpio"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&bt_pwr_pin>; ++ reset-gpios = <&pio 6 13 GPIO_ACTIVE_HIGH>; /* PG13 */ ++ clocks = <&osc32k>; ++ clock-frequency = <32768>; ++ rfkill-name = "sunxi-bt"; ++ rfkill-type = "bluetooth"; ++ }; ++ ++ pcm5102a: pcm5102a-codec { ++ #sound-dai-cells = <0>; ++ compatible = "ti,pcm5102a"; ++ status = "disabled"; ++ }; ++}; ++ ++&codec { ++ allwinner,audio-routing = ++ "Line Out", "LINEOUT", ++ "MIC1", "Mic", ++ "Mic", "MBIAS"; ++ status = "okay"; ++}; ++ ++&de { ++ status = "okay"; ++}; ++ ++&ehci0 { ++ status = "okay"; ++}; ++ ++&ehci1 { ++ status = "okay"; ++}; ++ ++&ehci2 { ++ status = "okay"; ++}; ++ ++&ehci3 { ++ status = "okay"; ++}; ++ ++&external_mdio { ++ ext_rgmii_phy: ethernet-phy@1 { ++ compatible = "ethernet-phy-ieee802.3-c22"; ++ reg = <0>; ++ }; ++}; ++ ++&emac { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&emac_rgmii_pins>; ++ phy-supply = <®_gmac_3v3>; ++ phy-handle = <&ext_rgmii_phy>; ++ phy-mode = "rgmii"; ++ local-mac-address = [ 00 00 00 00 00 00 ]; ++ allwinner,leds-active-low; ++ status = "okay"; ++}; ++ ++&ir { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&ir_pins_a>; ++ status = "okay"; ++}; ++ ++&mmc0 { ++ vmmc-supply = <®_vcc3v3>; ++ bus-width = <4>; ++ cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */ ++ status = "okay"; ++}; ++ ++&mmc1 { ++ 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"; ++ }; ++}; ++ ++&mmc2 { ++ vmmc-supply = <®_vcc3v3>; ++ bus-width = <8>; ++ non-removable; ++ cap-mmc-hw-reset; ++ boot_device = <0>; ++ status = "okay"; ++}; ++ ++&mmc2_8bit_pins { ++ /* Increase drive strength for DDR modes */ ++ drive-strength = <40>; ++ /* eMMC is missing pull-ups */ ++ bias-pull-up; ++}; ++ ++&hdmi { ++ status = "okay"; ++}; ++ ++&hdmi_out { ++ hdmi_out_con: endpoint { ++ remote-endpoint = <&hdmi_con_in>; ++ }; ++}; ++ ++ ++&pio { ++ leds_npi: led_pins@0 { ++ pins = "PA10"; ++ function = "gpio_out"; ++ }; ++ gmac_power_pin_nanopi: gmac_power_pin@0 { ++ pins = "PD6"; ++ function = "gpio_out"; ++ }; ++ bt_pwr_pin: bt_pwr_pin@0 { ++ pins = "PG13"; ++ function = "gpio_out"; ++ }; ++ spi0_cs_pins: spi0_cs_pins { ++ pins = "PC3", "PA6"; ++ function = "gpio_out"; ++ }; ++}; ++&r_pio { ++ leds_r_npi: led_pins@0 { ++ pins = "PL10"; ++ function = "gpio_out"; ++ }; ++ vdd_cpux_r_npi: regulator_pins@0 { ++ allwinner,pins = "PL6"; ++ allwinner,function = "gpio_out"; ++ allwinner,drive = ; ++ allwinner,pull = ; ++ }; ++ wifi_en_npi: wifi_en_pin { ++ pins = "PL7"; ++ function = "gpio_out"; ++ }; ++}; ++&ohci0 { ++ status = "okay"; ++}; ++ ++&ohci1 { ++ status = "okay"; ++}; ++ ++&ohci2 { ++ status = "okay"; ++}; ++ ++&ohci3 { ++ status = "okay"; ++}; ++ ++&spi0 { ++ status = "okay"; ++ spi-flash@0 { ++ #address-cells = <1>; ++ #size-cells = <0>; ++ compatible = "jedec,spi-nor"; ++ reg = <0>; /* Chip select 0 */ ++ spi-max-frequency = <10000000>; ++ status = "okay"; ++ partitions { ++ compatible = "fixed-partitions"; ++ #address-cells = <1>; ++ #size-cells = <1>; ++ partition@0 { ++ label = "uboot"; ++ reg = <0x0 0x100000>; ++ }; ++ partition@100000 { ++ label = "env"; ++ reg = <0x100000 0x100000>; ++ }; ++ }; ++ }; ++}; ++ ++&uart0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_pins_a>; ++ status = "okay"; ++}; ++ ++&uart1 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart1_pins>; ++ status = "disabled"; ++}; ++ ++&uart2 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart2_pins>; ++ status = "disabled"; ++}; ++ ++&uart3 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart3_pins>, <&uart3_rts_cts_pins>; ++ status = "okay"; ++}; ++&usb_otg { ++ dr_mode = "otg"; ++ status = "okay"; ++}; ++ ++&usbphy { ++ /* USB Type-A ports' VBUS is always on */ ++ usb0_id_det-gpios = <&pio 6 12 GPIO_ACTIVE_HIGH>; /* PG12 */ ++ usb0_vbus-supply = <®_usb0_vbus>; ++ status = "okay"; ++}; ++ ++&i2s0 { ++ sound-dai = <&pcm5102a>; ++ status = "disabled"; ++}; +\ No newline at end of file diff --git a/patch/u-boot/u-boot-sunxi/add-xx-nanopi-k1-plus-emmc.patch b/patch/u-boot/u-boot-sunxi/add-xx-nanopi-k1-plus-emmc.patch new file mode 100644 index 0000000000..2a7db358e1 --- /dev/null +++ b/patch/u-boot/u-boot-sunxi/add-xx-nanopi-k1-plus-emmc.patch @@ -0,0 +1,144 @@ +diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile +index b6eebe8..a6eb75b 100644 +--- a/arch/arm/dts/Makefile ++++ b/arch/arm/dts/Makefile +@@ -371,6 +371,7 @@ dtb-$(CONFIG_MACH_SUN50I_H5) += \ + sun50i-h5-orangepi-zero-plus.dtb \ + sun50i-h5-nanopi-m1-plus2.dts \ + sun50i-h5-orangepi-pc2.dtb \ ++ sun50i-h5-nanopi-k1-plus.dtb \ + sun50i-h5-orangepi-prime.dtb \ + sun50i-h5-orangepi-zero-plus2.dtb + dtb-$(CONFIG_MACH_SUN50I) += \ +diff --git a/arch/arm/dts/sun50i-h5-nanopi-k1-plus.dts b/arch/arm/dts/sun50i-h5-nanopi-k1-plus.dts +new file mode 100644 +index 0000000..c08af78 +--- /dev/null ++++ b/arch/arm/dts/sun50i-h5-nanopi-k1-plus.dts +@@ -0,0 +1,96 @@ ++/* ++ * Copyright (C) 2017 Icenowy Zheng ++ * Copyright (C) 2017 Jagan Teki ++ * ++ * 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 library 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 library 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. ++ * ++ * 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 "sun50i-h5.dtsi" ++ ++#include ++ ++/ { ++ model = "FriendlyARM NanoPi K1 plus"; ++ compatible = "friendlyarm,nanopi-neo2", "allwinner,sun50i-h5"; ++ ++ aliases { ++ serial0 = &uart0; ++ }; ++ ++ chosen { ++ stdout-path = "serial0:115200n8"; ++ }; ++ ++ reg_vcc3v3: vcc3v3 { ++ compatible = "regulator-fixed"; ++ regulator-name = "vcc3v3"; ++ regulator-min-microvolt = <3300000>; ++ regulator-max-microvolt = <3300000>; ++ }; ++}; ++ ++&mmc0 { ++ compatible = "allwinner,sun50i-h5-mmc", ++ "allwinner,sun50i-a64-mmc", ++ "allwinner,sun5i-a13-mmc"; ++ pinctrl-names = "default"; ++ pinctrl-0 = <&mmc0_pins_a>, <&mmc0_cd_pin>; ++ vmmc-supply = <®_vcc3v3>; ++ bus-width = <4>; ++ cd-gpios = <&pio 5 6 GPIO_ACTIVE_LOW>; /* PF6 */ ++ status = "okay"; ++}; ++ ++&mmc2 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&mmc2_8bit_pins>; ++ vmmc-supply = <®_vcc3v3>; ++ bus-width = <8>; ++ non-removable; ++ cap-mmc-hw-reset; ++ status = "okay"; ++}; ++ ++&uart0 { ++ pinctrl-names = "default"; ++ pinctrl-0 = <&uart0_pins_a>; ++ status = "okay"; ++}; +diff --git a/configs/nanopi_k1_plus_defconfig b/configs/nanopi_k1_plus_defconfig +new file mode 100644 +index 0000000..670c3c7 +--- /dev/null ++++ b/configs/nanopi_k1_plus_defconfig +@@ -0,0 +1,24 @@ ++CONFIG_ARM=y ++CONFIG_ARCH_SUNXI=y ++CONFIG_SYS_TEXT_BASE=0x4a000000 ++CONFIG_SPL_SPI_FLASH_SUPPORT=y ++CONFIG_MACH_SUN50I_H5=y ++CONFIG_DRAM_CLK=504 ++CONFIG_DRAM_ZQ=3881977 ++CONFIG_MACPWR="PD6" ++CONFIG_DRAM_ODT_EN=y ++CONFIG_MMC_SUNXI_SLOT_EXTRA=2 ++CONFIG_DEFAULT_DEVICE_TREE="sun50i-h5-nanopi-k1-plus" ++# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set ++CONFIG_SPL=y ++# CONFIG_CMD_IMLS is not set ++# CONFIG_CMD_FLASH is not set ++# CONFIG_CMD_FPGA is not set ++# CONFIG_SPL_DOS_PARTITION is not set ++# CONFIG_SPL_ISO_PARTITION is not set ++# CONFIG_SPL_EFI_PARTITION is not set ++# CONFIG_ENV_IS_IN_FAT is not set ++CONFIG_SPL_SPI_SUNXI=y ++CONFIG_SUN8I_EMAC=y ++CONFIG_USB_EHCI_HCD=y ++CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE=y