From cd5d151f93421eb5d7345e6a99862a1374bfc0a6 Mon Sep 17 00:00:00 2001 From: ThomasKaiser Date: Sun, 13 Mar 2016 22:03:14 +0100 Subject: [PATCH] Adopted Jernej's changes to switch LED definitions on Orange Pis --- boards.sh | 3 +- config/orangepi2.fex | 4 +- config/orangepilite.fex | 4 +- config/orangepione.fex | 4 +- config/orangepipc.fex | 4 +- config/orangepiplus.fex | 4 +- .../sun8i-default/0014-no_dev_console.patch | 21 +++++ .../u-boot-03-add-R_PIO-support.patch | 90 +++++++++++++++++++ 8 files changed, 123 insertions(+), 11 deletions(-) create mode 100644 patch/kernel/sun8i-default/0014-no_dev_console.patch create mode 100644 patch/u-boot/u-boot-default/u-boot-03-add-R_PIO-support.patch diff --git a/boards.sh b/boards.sh index 04c41756d6..5f1fd701bf 100644 --- a/boards.sh +++ b/boards.sh @@ -134,7 +134,8 @@ install_board_specific (){ else cp $SRC/lib/config/boot.cmd $DEST/cache/sdcard/boot/boot.cmd # orangepi h3 temp exceptions - [[ $LINUXFAMILY == "sun8i" ]] && sed -i -e '1s/^/gpio set PA15\ngpio set PG11\nsetenv machid 1029\nsetenv bootm_boot_mode sec\n/' -e 's/\ disp.screen0_output_mode=1920x1080p60//' $DEST/cache/sdcard/boot/boot.cmd + [[ $LINUXFAMILY == "sun8i" ]] && sed -i -e '1s/^/gpio set PL10\ngpio set PG11\nsetenv machid 1029\nsetenv bootm_boot_mode sec\n/' \ + -e 's/\ disp.screen0_output_mode=1920x1080p60//' -e 's/\ hdmi.audio=EDID:0//' $DEST/cache/sdcard/boot/boot.cmd # let's prepare for old kernel too chroot $DEST/cache/sdcard /bin/bash -c \ "ln -s /boot/bin/$BOARD.bin /boot/script.bin >/dev/null 2>&1 || cp /boot/bin/$BOARD.bin /boot/script.bin" diff --git a/config/orangepi2.fex b/config/orangepi2.fex index 7f522166ab..3a8b935790 100644 --- a/config/orangepi2.fex +++ b/config/orangepi2.fex @@ -352,9 +352,9 @@ gpio_pin_19 = port:PG07<1><0> [leds_para] leds_used = 1 green_led = port:PL10<1><0> -green_led_active_low = 0 +green_led_active_low = 1 red_led = port:PA15<1><0> -red_led_active_low = 1 +red_led_active_low = 0 ;---------------------------------------------------------------------------------- ;thermal configuration diff --git a/config/orangepilite.fex b/config/orangepilite.fex index fd89ab84cc..23999558a8 100644 --- a/config/orangepilite.fex +++ b/config/orangepilite.fex @@ -248,9 +248,9 @@ gpio_pin_19 = port:PG07<1><0> [leds_para] leds_used = 1 green_led = port:PL10<1><0> -green_led_active_low = 0 +green_led_active_low = 1 red_led = port:PA15<1><0> -red_led_active_low = 1 +red_led_active_low = 0 [ths_para] ths_used = 1 diff --git a/config/orangepione.fex b/config/orangepione.fex index 94c2c488c8..24684db33e 100644 --- a/config/orangepione.fex +++ b/config/orangepione.fex @@ -248,9 +248,9 @@ gpio_pin_19 = port:PG07<1><0> [leds_para] leds_used = 1 green_led = port:PL10<1><0> -green_led_active_low = 0 +green_led_active_low = 1 red_led = port:PA15<1><0> -red_led_active_low = 1 +red_led_active_low = 0 [ths_para] ths_used = 1 diff --git a/config/orangepipc.fex b/config/orangepipc.fex index 2b2f75f0db..9352cc653d 100644 --- a/config/orangepipc.fex +++ b/config/orangepipc.fex @@ -248,9 +248,9 @@ gpio_pin_19 = port:PG07<1><0> [leds_para] leds_used = 1 green_led = port:PL10<1><0> -green_led_active_low = 0 +green_led_active_low = 1 red_led = port:PA15<1><0> -red_led_active_low = 1 +red_led_active_low = 0 [ths_para] ths_used = 1 diff --git a/config/orangepiplus.fex b/config/orangepiplus.fex index 275c1606f1..31279e1b89 100644 --- a/config/orangepiplus.fex +++ b/config/orangepiplus.fex @@ -355,9 +355,9 @@ gpio_pin_19 = port:PG07<1><0> [leds_para] leds_used = 1 green_led = port:PL10<1><0> -green_led_active_low = 0 +green_led_active_low = 1 red_led = port:PA15<1><0> -red_led_active_low = 1 +red_led_active_low = 0 ;---------------------------------------------------------------------------------- ;thermal configuration diff --git a/patch/kernel/sun8i-default/0014-no_dev_console.patch b/patch/kernel/sun8i-default/0014-no_dev_console.patch new file mode 100644 index 0000000000..b2d72cf862 --- /dev/null +++ b/patch/kernel/sun8i-default/0014-no_dev_console.patch @@ -0,0 +1,21 @@ +diff --git a/init/main.c b/init/main.c +index 9484f4b..db55edd 100644 +--- a/init/main.c ++++ b/init/main.c +@@ -880,8 +880,14 @@ static noinline void __init kernel_init_freeable(void) + do_basic_setup(); + + /* Open the /dev/console on the rootfs, this should never fail */ +- if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) +- printk(KERN_WARNING "Warning: unable to open an initial console.\n"); ++ char *console = "/dev_console"; ++ ++ if (sys_open((const char __user *) "/dev/console", O_RDWR, 0) < 0) { ++ sys_mknod(console, S_IFCHR|0600, (TTYAUX_MAJOR<<8)|1); ++ if (sys_open(console, O_RDWR, 0) < 0) ++ printk(KERN_WARNING "Warning: unable to open an initial console.\n"); ++ sys_unlink(console); ++ } + + (void) sys_dup(0); + (void) sys_dup(0); diff --git a/patch/u-boot/u-boot-default/u-boot-03-add-R_PIO-support.patch b/patch/u-boot/u-boot-default/u-boot-03-add-R_PIO-support.patch new file mode 100644 index 0000000000..40db6ac03f --- /dev/null +++ b/patch/u-boot/u-boot-default/u-boot-03-add-R_PIO-support.patch @@ -0,0 +1,90 @@ +diff -Nur a/arch/arm/cpu/armv7/sunxi/clock_sun6i.c b/arch/arm/cpu/armv7/sunxi/clock_sun6i.c +--- a/arch/arm/cpu/armv7/sunxi/clock_sun6i.c 2016-02-15 22:44:30.000000000 +0100 ++++ b/arch/arm/cpu/armv7/sunxi/clock_sun6i.c 2016-03-07 22:29:38.603830589 +0100 +@@ -42,6 +42,9 @@ + + writel(MBUS_CLK_DEFAULT, &ccm->mbus0_clk_cfg); + writel(MBUS_CLK_DEFAULT, &ccm->mbus1_clk_cfg); ++ ++ /* enable R_PIO and de-assert resets */ ++ prcm_apb0_enable(PRCM_APB0_GATE_PIO); + } + #endif + +diff -Nur a/arch/arm/dts/sun8i-h3.dtsi b/arch/arm/dts/sun8i-h3.dtsi +--- a/arch/arm/dts/sun8i-h3.dtsi 2016-02-15 22:44:30.000000000 +0100 ++++ b/arch/arm/dts/sun8i-h3.dtsi 2016-03-07 22:27:45.575183986 +0100 +@@ -285,6 +285,25 @@ + clocks = <&osc24M>, <&pll6 1>, <&pll5>; + clock-output-names = "mbus"; + }; ++ ++ apb0: apb0_clk { ++ compatible = "fixed-factor-clock"; ++ #clock-cells = <0>; ++ clock-div = <1>; ++ clock-mult = <1>; ++ clocks = <&osc24M>; ++ clock-output-names = "apb0"; ++ }; ++ ++ apb0_gates: clk@01f01428 { ++ compatible = "allwinner,sun8i-h3-apb0-gates-clk", ++ "allwinner,sun4i-a10-gates-clk"; ++ reg = <0x01f01428 0x4>; ++ #clock-cells = <1>; ++ clocks = <&apb0>; ++ clock-indices = <0>, <1>; ++ clock-output-names = "apb0_pio", "apb0_ir"; ++ }; + }; + + soc { +@@ -591,5 +610,23 @@ + interrupts = , + ; + }; ++ ++ apb0_reset: reset@01f014b0 { ++ reg = <0x01f014b0 0x4>; ++ compatible = "allwinner,sun6i-a31-clock-reset"; ++ #reset-cells = <1>; ++ }; ++ ++ r_pio: pinctrl@01f02c00 { ++ compatible = "allwinner,sun8i-h3-r-pinctrl"; ++ reg = <0x01f02c00 0x400>; ++ interrupts = ; ++ clocks = <&apb0_gates 0>; ++ resets = <&apb0_reset 0>; ++ gpio-controller; ++ #gpio-cells = <3>; ++ interrupt-controller; ++ #interrupt-cells = <3>; ++ }; + }; + }; +diff -Nur a/drivers/gpio/sunxi_gpio.c b/drivers/gpio/sunxi_gpio.c +--- a/drivers/gpio/sunxi_gpio.c 2016-03-07 22:19:30.000000000 +0100 ++++ b/drivers/gpio/sunxi_gpio.c 2016-03-07 22:24:28.194532112 +0100 +@@ -276,8 +276,10 @@ + "allwinner,sun6i-a31-r-pinctrl") == 0) { + start = 'L' - 'A'; + no_banks = 2; /* L & M */ +- } else if (fdt_node_check_compatible(gd->fdt_blob, parent->of_offset, +- "allwinner,sun8i-a23-r-pinctrl") == 0) { ++ } else if ((fdt_node_check_compatible(gd->fdt_blob, parent->of_offset, ++ "allwinner,sun8i-a23-r-pinctrl") == 0) || ++ (fdt_node_check_compatible(gd->fdt_blob, parent->of_offset, ++ "allwinner,sun8i-h3-r-pinctrl") == 0)) { + start = 'L' - 'A'; + no_banks = 1; /* L only */ + } else { +@@ -320,6 +322,7 @@ + { .compatible = "allwinner,sun9i-a80-pinctrl" }, + { .compatible = "allwinner,sun6i-a31-r-pinctrl" }, + { .compatible = "allwinner,sun8i-a23-r-pinctrl" }, ++ { .compatible = "allwinner,sun8i-h3-r-pinctrl" }, + { } + }; +