Browse Source

add NanoPi Neo Air support..

master
tuxd3v 4 months ago
parent
commit
3fb8b80a02
4 changed files with 8270 additions and 0 deletions
  1. +1
    -0
      docs/README.md
  2. +7811
    -0
      reference/.config/kernels/sun8i-h3-nanopi-neo-air_defconfig
  3. +174
    -0
      reference/hw/boards/neoAir.lua
  4. +284
    -0
      reference/patchs/kernel/sun8i-h3-nanopi-neo-air.patch

+ 1
- 0
docs/README.md View File

@@ -106,6 +106,7 @@ relative path | description
* 'reference/hw/boards/**RPi1.lua**'
* 'reference/hw/boards/**nPiR2S.lua**'
* 'reference/hw/boards/**m2Zero.lua**'
* 'reference/hw/boards/**neoAir.lua**'

Other Modules that we need to have in account are:
* 'reference/hw/**boards.lua**'


+ 7811
- 0
reference/.config/kernels/sun8i-h3-nanopi-neo-air_defconfig
File diff suppressed because it is too large
View File


+ 174
- 0
reference/hw/boards/neoAir.lua View File

@@ -0,0 +1,174 @@
-- Description for NanoPi Neo Air Module
local neoAir = {
-- Require OS..
os = require "os",
rootpath = "neoAir",

-- CPU Properties
cpu = require "reference.hw.cpus".AllWinner.H3,

--- Bootloader Properties
--
-- u-boot support
boot = nil,
boot_compiler = nil,
-- Trusted Execution Environment
tee = nil,
bootImage = {
"u-boot-sunxi-with-spl.bin"
},
bootdefconfig = "nanopi_neo_air_defconfig",
env = {},
cmd = {
"setenv ethaddr \"B2 54 C3 7B 35 A8\"\n",
"setenv devtype mmc\n",
"setenv devnum 0\n",
"part uuid ${devtype} ${devnum}:2 rootfsuuid\n",
"setenv bootargs \"earlyprintk earlycon=uart8250,mmio32,0x1c28000 net.ifnames=0 biosdevname=0 debug=on console=ttyS0,115200 console=tty1 cma=64M root=PARTUUID=${rootfsuuid} rw fsck.repair=yes rootwait usbstoragequirks=0x2537:0x1066:u,0x2537:0x1068:u elevator=noop\"\n",
"if ext2load ${devtype} ${devnum}:1 ${kernel_addr_r} vmlinuz; then\n",
" if ext4load ${devtype} ${devnum}:2 ${fdt_addr_r} usr/lib/linux-image-5.10.35/sun8i-h3-nanopi-neo-air.dtb; then\n",
" fdt addr ${fdt_addr_r}\n",
" fdt resize 65536\n",
" bootz ${kernel_addr_r} - ${fdt_addr_r}\n",
" fi;\n",
"fi;\n"
},
--- Kernel Properties
--
kernel = nil,
kernel_compiler = nil,
kernelvers = "lts",
arch = "arm",
dtb = "sun8i-h3-nanopi-neo-air.dtb",
kerneldefconfig = "sun8i-h3-nanopi-neo-air_defconfig",
-- applly on stable kernels..
patchs = {
kernel = {
lts = {
-- Add emmc flash, MIPI CSI,bluetooth, bluetooth-rfkill,improve WIFI,
-- support for ov5640 camera, etc
"sun8i-h3-nanopi-neo-air.patch"
}
},
bootloader = {
--uboot = {}
}
},
---- User Space Properties
---
--- Modules config
--
modules = {
"# /etc/modules: kernel modules to load at boot time.\n",
"#\n",
"# This file contains the names of kernel modules that should be loaded\n",
"# at boot time, one per line. Lines beginning with \"#\" are ignored.\n",
"zram num_devices=4\n"
},
--- ZRAM Config
--
zram_rules = {
"KERNEL==\"zram0\", SUBSYSTEM==\"block\", DRIVER==\"\", ACTION==\"add\", ATTR{initstate}==\"0\", ATTR{comp_algorithm}=\"lz4\", ATTR{disksize}=\"96M\", RUN+=\"/sbin/mkswap $env{DEVNAME}\"\n",
"KERNEL==\"zram1\", SUBSYSTEM==\"block\", DRIVER==\"\", ACTION==\"add\", ATTR{initstate}==\"0\", ATTR{comp_algorithm}=\"lz4\", ATTR{disksize}=\"96M\", RUN+=\"/sbin/mkswap $env{DEVNAME}\"\n",
"KERNEL==\"zram2\", SUBSYSTEM==\"block\", DRIVER==\"\", ACTION==\"add\", ATTR{initstate}==\"0\", ATTR{comp_algorithm}=\"lz4\", ATTR{disksize}=\"96M\", RUN+=\"/sbin/mkswap $env{DEVNAME}\"\n",
"KERNEL==\"zram3\", SUBSYSTEM==\"block\", DRIVER==\"\", ACTION==\"add\", ATTR{initstate}==\"0\", ATTR{comp_algorithm}=\"lz4\", ATTR{disksize}=\"96M\", RUN+=\"/sbin/mkswap $env{DEVNAME}\"\n"
},
--- FSTab Config
--
fstab = {
"\n# <file system> <dir> <type> <options> <dump> <pass>\n",
"/dev/mmcblk2p1 /boot ext2 defaults 0 2\n",
"/dev/mmcblk2p2 / ext4 defaults,noatime 0 1\n",
"/dev/zram0 none swap pri=1 0 0\n",
"/dev/zram1 none swap pri=2 0 0\n",
"/dev/zram2 none swap pri=4 0 0\n",
"/dev/zram3 none swap pri=3 0 0\n"
},
--- InitTab Config
--
inittab = {
"\n# Login tty Via Serial Uart..\n",
"T1:12345:respawn:/sbin/agetty -L ttyS0 115200 vt100\n"
},
--- Interfaces Config
--
interfaces = {
"\n# This file describes the network interfaces available on your system\n",
"# and how to activate them. For more information, see interfaces(5).\n",
"\n",
"source /etc/network/interfaces.d/*\n",
"\n",
"# The loopback network interface\n",
"auto lo\n",
"iface lo inet loopback\n",
"\n",
"# The primary WIFI network interface\n",
"allow-hotplug wlan0\n",
"iface wlan0 inet dhcp\n",
" pre-up wpa_supplicant -B -D wext -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant-wlan0.conf -f /var/log/wpa_supplicant.log\n",
" post-down killall -q wpa_supplicant\n",
"\n"
},
--- WPA_SUPPLICANT WIFI Support
--
--[[wpa_supplicant = {
"# Input your ISO 3166-1 alpha-2 Country Code bellow\n",
"country=pt\n",
"update_config=1\n",
"ctrl_interface=/var/run/wpa_supplicant\n",
"\n",
"network={\n",
" scan_ssid=1\n",
" ssid="MYSSID"\n",
" proto=RSN\n",
" key_mgmt=WPA-PSK\n",
" pairwise=CCMP\n",
" group=CCMP\n",
" # result bellow produced by 'wpa_passphrase MYSSID passphrase'\n",
" psk=paste_result_of_above_command_here\n",
"}\n"
},
]]
--- Assist Functions
--
-- In AllWiner, bootloader starts at 8192 bytes( 8KB) and end at 1048576 bytes ( 1MB )
disk = {
-- BootLoader Section
bootloader = {
-- Boot1 u-boot-sunxi-with-spl.bin
{
-- Sector size in bytes [ Integer ]
ssize = 512,
-- Seek number of Sectors[ Integer ]
sseek = 16,
-- Size of the bootloader Area in Sectors[ Integer ]
scount = 2033,
-- dd convert field[ String1,String2 .. ]
conv = "notrunc,fdatasync"
}
},
-- parted script includes Partition table
partitions = " --script mklabel msdos mkpart primary ext2 1MB 101MB mkpart primary ext4 101MB 1700MB set 1 lba off set 2 lba off print",
-- Partitions Fyle System Formats
formatfs = {
ext2 = 1,
ext4 = 2
}
},
-- Init Board function
init = function( self )
-- require Dependencies
-- Uboot
self.boot = require "reference.tools.bootloaders".arm
self.boot_compiler = {}
self.boot_compiler[ 1 ] = require "reference.tools.toolchains".arm.aarch32.baremetal
-- Kernel
self.kernel = require ('reference.tools.kernels').mainline
self.kernel_compiler = require "reference.tools.toolchains".arm.aarch32.linuxgnu
end,
-- Get RootPath for this Board
getRootPath = function( self )
return self.rootpath
end
}
return neoAir

+ 284
- 0
reference/patchs/kernel/sun8i-h3-nanopi-neo-air.patch View File

@@ -0,0 +1,284 @@
--- a/arch/arm/boot/dts/sun8i-h3-nanopi-neo-air.dts 2021-05-13 17:37:18.607013381 +0100
+++ b/arch/arm/boot/dts/sun8i-h3-nanopi-neo-air.dts 2021-05-19 18:50:45.670352526 +0100
@@ -52,6 +52,16 @@
aliases {
serial0 = &uart0;
+ serial1 = &uart1;
+ serial2 = &uart2;
+ serial3 = &uart3;
+ mmc0 = &mmc0;
+ mmc1 = &mmc1;
+ mmc2 = &mmc2;
+ i2c0 = &i2c0;
+ i2c2 = &i2c2;
+ spi0 = &spi0;
+ i2s0 = &i2s0;
};
chosen {
@@ -62,23 +72,109 @@
compatible = "gpio-leds";
pwr {
- label = "nanopi:green:pwr";
+ label = "nanopi:red:pwr";
gpios = <&r_pio 0 10 GPIO_ACTIVE_HIGH>; /* PL10 */
default-state = "on";
};
status {
- label = "nanopi:blue:status";
+ label = "nanopi:green:status";
gpios = <&pio 0 10 GPIO_ACTIVE_HIGH>; /* PA10 */
+ linux,default-trigger = "heartbeat";
};
};
+ vdd_cpux: gpio-regulator {
+ compatible = "regulator-gpio";
+ pinctrl-names = "default";
+ regulator-name = "vdd-cpux";
+ regulator-type = "voltage";
+ regulator-boot-on;
+ regulator-always-on;
+ regulator-min-microvolt = <1040000>;
+ regulator-max-microvolt = <1300000>;
+ regulator-ramp-delay = <50>; /* 4ms */
+ gpios = <&r_pio 0 6 GPIO_ACTIVE_HIGH>; /* PL6 */
+ gpios-states = <0x1>;
+ states = <1040000 0x0
+ 1100000 0x1
+ 1300000 0x2>;
+ };
+
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";
+ };
+
+ cam_xclk: cam-xclk {
+ #clock-cells = <0>;
+ compatible = "fixed-clock";
+ clock-frequency = <24000000>;
+ clock-output-names = "cam-xclk";
+ };
+
+ reg_cam_avdd: cam-avdd {
+ compatible = "regulator-fixed";
+ regulator-name = "cam500b-avdd";
+ regulator-min-microvolt = <2800000>;
+ regulator-max-microvolt = <2800000>;
+ vin-supply = <&reg_vcc3v3>;
+ };
+
+ reg_cam_dovdd: cam-dovdd {
+ compatible = "regulator-fixed";
+ regulator-name = "cam500b-dovdd";
+ regulator-min-microvolt = <1800000>;
+ regulator-max-microvolt = <1800000>;
+ vin-supply = <&reg_vcc3v3>;
};
+
+ reg_cam_dvdd: cam-dvdd {
+ compatible = "regulator-fixed";
+ regulator-name = "cam500b-dvdd";
+ regulator-min-microvolt = <1500000>;
+ regulator-max-microvolt = <1500000>;
+ vin-supply = <&reg_vcc3v3>;
+ };
+};
+
+&cpu0 {
+ cpu-supply = <&vdd_cpux>;
};
+&pio {
+ bt_pwr_pin: bt_pwr_pin@0 {
+ pins = "PG13";
+ function = "gpio_out";
+ };
+
+ i2s0_pins: i2s0-pins {
+ pins = "PA18", "PA19","PA20", "PA21";
+ function = "i2s0";
+ };
+};
+
+&r_pio {
+ wifi_en_npi: wifi_en_pin {
+ pins = "PL7";
+ function = "gpio_out";
+ };
+ };
+
&mmc0 {
vmmc-supply = <&reg_vcc3v3>;
bus-width = <4>;
@@ -103,12 +199,152 @@
};
};
+&mmc2 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&mmc2_8bit_pins>;
+ vmmc-supply = <&reg_vcc3v3>;
+ bus-width = <8>;
+ non-removable;
+ cap-mmc-hw-reset;
+ status = "okay";
+};
+
+&mmc2_8bit_pins {
+ /* Increase drive strength for DDR modes */
+ drive-strength = <40>;
+ /* eMMC is missing pull-ups */
+ bias-pull-up;
+};
+
+&csi {
+ status = "okay";
+
+ port {
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ /* Parallel bus endpoint */
+ csi_from_ov5640: endpoint {
+ remote-endpoint = <&ov5640_to_csi>;
+ bus-width = <8>;
+ data-shift = <2>;
+ hsync-active = <1>; /* Active high */
+ vsync-active = <0>; /* Active low */
+ data-active = <1>; /* Active high */
+ pclk-sample = <1>; /* Rising */
+ };
+ };
+};
+
+&i2c0 {
+ status = "okay";
+};
+
+/* Activate Soc Internal i2c bus pullup resistors */
+&i2c0_pins {
+ bias-pull-up;
+};
+
+&i2c2 {
+ status = "okay";
+ ov5640: camera@3c {
+ compatible = "ovti,ov5640";
+ reg = <0x3c>;
+ clocks = <&cam_xclk>;
+ clock-names = "xclk";
+
+ reset-gpios = <&pio 4 14 GPIO_ACTIVE_LOW>; /* PE14 */
+ powerdown-gpios = <&pio 4 15 GPIO_ACTIVE_HIGH>; /* PE15 */
+ AVDD-supply = <&reg_cam_avdd>;
+ DOVDD-supply = <&reg_cam_dovdd>;
+ DVDD-supply = <&reg_cam_dvdd>;
+
+ port {
+ ov5640_to_csi: endpoint {
+ remote-endpoint = <&csi_from_ov5640>;
+ bus-width = <8>;
+ data-shift = <2>;
+ hsync-active = <1>; /* Active high */
+ vsync-active = <0>; /* Active low */
+ data-active = <1>; /* Active high */
+ pclk-sample = <1>; /* Rising */
+ };
+ };
+ };
+};
+
+/* Activate Soc Internal i2c bus pullup resistors */
+&i2c2_pins {
+ bias-pull-up;
+};
+
+&ehci0 {
+ status = "okay";
+};
+
+&ohci0 {
+ status = "okay";
+};
+
&uart0 {
pinctrl-names = "default";
pinctrl-0 = <&uart0_pa_pins>;
status = "okay";
};
+&uart1 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&uart1_pins>, <&uart1_rts_cts_pins>;
+ uart-has-rtscts;
+ status = "okay";
+};
+
+&uart2 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&uart2_pins>, <&uart2_rts_cts_pins>;
+ uart-has-rtscts;
+ status = "okay";
+};
+
+&uart3 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&uart3_pins>, <&uart3_rts_cts_pins>;
+ uart-has-rtscts;
+ status = "okay";
+
+ bluetooth {
+ compatible = "brcm,bcm43438-bt";
+ clocks = <&rtc 1>;
+ clock-names = "lpo";
+ vbat-supply = <&reg_vcc3v3>;
+ vddio-supply = <&reg_vcc3v3>;
+ device-wakeup-gpios = <&pio 0 8 GPIO_ACTIVE_HIGH>; /* PA8 */
+ host-wakeup-gpios = <&pio 0 7 GPIO_ACTIVE_HIGH>; /* PA7 */
+ shutdown-gpios = <&pio 6 13 GPIO_ACTIVE_HIGH>; /* PG13 */
+ };
+
+};
+
+&i2s0 {
+ pinctrl-names = "default";
+ pinctrl-0 = <&i2s0_pins>;
+ status = "okay";
+};
+
+/* Analog Audio */
+&codec {
+ status = "okay";
+};
+
+&spi0 {
+ status = "okay";
+};
+
+&usb_otg {
+ dr_mode = "otg";
+ status = "okay";
+};
+
&usbphy {
/* USB VBUS is always on */
status = "okay";

Loading…
Cancel
Save