[PATCH 0/5] Add Micronova srl S027_3 board support

Add Micronova srl S027_3 board support
Giulio Benetti (5): arm: allwinner: dts: a20: add uart2_pa_pins sunxi: allow SYS_BOARD to be set sunxi: add SYS_VENDOR to Kconfig sun7i: add support for Micronova srl s027_3 board pwm: sunxi: enable pwm0 support on sun7i
arch/arm/dts/Makefile | 1 + arch/arm/dts/sun7i-a20-s027_3.dts | 272 ++++++++++++++++++++++++++ arch/arm/dts/sun7i-a20.dtsi | 5 + arch/arm/include/asm/arch-sunxi/pwm.h | 3 +- arch/arm/mach-sunxi/Kconfig | 5 + board/micronovasrl/s027_3/MAINTAINERS | 5 + board/micronovasrl/s027_3/Makefile | 8 + board/micronovasrl/s027_3/s027_3.c | 29 +++ configs/micronovasrl-s027_3_defconfig | 37 ++++ 9 files changed, 364 insertions(+), 1 deletion(-) create mode 100644 arch/arm/dts/sun7i-a20-s027_3.dts create mode 100644 board/micronovasrl/s027_3/MAINTAINERS create mode 100644 board/micronovasrl/s027_3/Makefile create mode 100644 board/micronovasrl/s027_3/s027_3.c create mode 100644 configs/micronovasrl-s027_3_defconfig

From: Giulio Benetti giulio.benetti@micronovasrl.com
Signed-off-by: Giulio Benetti giulio.benetti@micronovasrl.com Signed-off-by: Giulio Benetti giulio.benetti@benettiengineering.com --- arch/arm/dts/sun7i-a20.dtsi | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/arch/arm/dts/sun7i-a20.dtsi b/arch/arm/dts/sun7i-a20.dtsi index a013805831..8bf1921500 100644 --- a/arch/arm/dts/sun7i-a20.dtsi +++ b/arch/arm/dts/sun7i-a20.dtsi @@ -943,6 +943,11 @@ function = "uart1"; };
+ uart2_pa_pins: uart2-pa-pins { + pins = "PA2", "PA3"; + function = "uart2"; + }; + uart2_pi_pins: uart2-pi-pins { pins = "PI18", "PI19"; function = "uart2";

On Fri, 19 Feb 2021 00:26:16 +0100 Giulio Benetti giulio.benetti@benettiengineering.com wrote:
Hi,
From: Giulio Benetti giulio.benetti@micronovasrl.com
Signed-off-by: Giulio Benetti giulio.benetti@micronovasrl.com Signed-off-by: Giulio Benetti giulio.benetti@benettiengineering.com
arch/arm/dts/sun7i-a20.dtsi | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/arch/arm/dts/sun7i-a20.dtsi b/arch/arm/dts/sun7i-a20.dtsi index a013805831..8bf1921500 100644 --- a/arch/arm/dts/sun7i-a20.dtsi +++ b/arch/arm/dts/sun7i-a20.dtsi @@ -943,6 +943,11 @@ function = "uart1"; };
uart2_pa_pins: uart2-pa-pins {
pins = "PA2", "PA3";
function = "uart2";
};
This is already in the Linux .dtsi, so we just need to sync that (and probably all the sun7i-a20 .dts files) to U-Boot. There are some changes around the PHY nodes, so we need to check if that affects the operation of the U-Boot GMAC driver.
Cheers, Andre
uart2_pi_pins: uart2-pi-pins { pins = "PI18", "PI19"; function = "uart2";

Hi Andre,
On 2/19/21 12:04 PM, Andre Przywara wrote:
On Fri, 19 Feb 2021 00:26:16 +0100 Giulio Benetti giulio.benetti@benettiengineering.com wrote:
Hi,
From: Giulio Benetti giulio.benetti@micronovasrl.com
Signed-off-by: Giulio Benetti giulio.benetti@micronovasrl.com Signed-off-by: Giulio Benetti giulio.benetti@benettiengineering.com
arch/arm/dts/sun7i-a20.dtsi | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/arch/arm/dts/sun7i-a20.dtsi b/arch/arm/dts/sun7i-a20.dtsi index a013805831..8bf1921500 100644 --- a/arch/arm/dts/sun7i-a20.dtsi +++ b/arch/arm/dts/sun7i-a20.dtsi @@ -943,6 +943,11 @@ function = "uart1"; };
uart2_pa_pins: uart2-pa-pins {
pins = "PA2", "PA3";
function = "uart2";
};
This is already in the Linux .dtsi, so we just need to sync that (and probably all the sun7i-a20 .dts files) to U-Boot. There are some changes around the PHY nodes, so we need to check if that affects the operation of the U-Boot GMAC driver.
You're right, instead of only reset-delay-us also other properties have been introduced like: - reset-assert-us - reset-deassert-us
https://elixir.bootlin.com/linux/latest/source/Documentation/devicetree/bind...
So basically I could add a patch for it where I add those 2 delays to already present reset_delays array like: (pseudocode): reset_delays[1] = "reset-assert-us"
reset_delays[2] = "reset-deassert-us"
That way we both accept reset delays array and new mdio properties. I need some time for that and possibly someone to test if possible/available.
Kind regards

From: Giulio Benetti giulio.benetti@micronovasrl.com
At the moment SYS_BOARD is always defaulted to "sunxi" but we need it to be set, so let's add string field to it allowing to be setup.
Signed-off-by: Giulio Benetti giulio.benetti@micronovasrl.com Signed-off-by: Giulio Benetti giulio.benetti@benettiengineering.com --- arch/arm/mach-sunxi/Kconfig | 1 + 1 file changed, 1 insertion(+)
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig index 0135575ca1..71b7a21176 100644 --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig @@ -612,6 +612,7 @@ config SYS_CONFIG_NAME default "sun50i" if MACH_SUN50I_H616
config SYS_BOARD + string "Board name" default "sunxi"
config SYS_SOC

From: Giulio Benetti giulio.benetti@micronovasrl.com
After allowing SYS_BOARD to be set we also need SYS_VENDOR to be set, so let's add it to Kconfig.
Signed-off-by: Giulio Benetti giulio.benetti@micronovasrl.com Signed-off-by: Giulio Benetti giulio.benetti@benettiengineering.com --- arch/arm/mach-sunxi/Kconfig | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/arch/arm/mach-sunxi/Kconfig b/arch/arm/mach-sunxi/Kconfig index 71b7a21176..9a6908a52e 100644 --- a/arch/arm/mach-sunxi/Kconfig +++ b/arch/arm/mach-sunxi/Kconfig @@ -615,6 +615,10 @@ config SYS_BOARD string "Board name" default "sunxi"
+config SYS_VENDOR + string "Vendor name" + default "" + config SYS_SOC default "sunxi"

From: Giulio Benetti giulio.benetti@micronovasrl.com
Add support for Micronova srl s027_3 board by adding new vendor/board folders and using in local Makefile the already present board/sunxi/Makefile. The reason is that s027_3 needs a pin to be asserted to enable lcd before setting controller up and sunxi board doesn't provide a way to do this customization.
Signed-off-by: Giulio Benetti giulio.benetti@micronovasrl.com Signed-off-by: Giulio Benetti giulio.benetti@benettiengineering.com --- arch/arm/dts/Makefile | 1 + arch/arm/dts/sun7i-a20-s027_3.dts | 272 ++++++++++++++++++++++++++ board/micronovasrl/s027_3/MAINTAINERS | 5 + board/micronovasrl/s027_3/Makefile | 8 + board/micronovasrl/s027_3/s027_3.c | 29 +++ configs/micronovasrl-s027_3_defconfig | 37 ++++ 6 files changed, 352 insertions(+) create mode 100644 arch/arm/dts/sun7i-a20-s027_3.dts create mode 100644 board/micronovasrl/s027_3/MAINTAINERS create mode 100644 board/micronovasrl/s027_3/Makefile create mode 100644 board/micronovasrl/s027_3/s027_3.c create mode 100644 configs/micronovasrl-s027_3_defconfig
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 33e483f4fb..658a8c95a1 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -543,6 +543,7 @@ dtb-$(CONFIG_MACH_SUN7I) += \ sun7i-a20-pcduino3.dtb \ sun7i-a20-pcduino3-nano.dtb \ sun7i-a20-primo73.dtb \ + sun7i-a20-s027_3.dtb \ sun7i-a20-wexler-tab7200.dtb \ sun7i-a20-wits-pro-a20-dkt.dtb \ sun7i-a20-yones-toptech-bd1078.dtb diff --git a/arch/arm/dts/sun7i-a20-s027_3.dts b/arch/arm/dts/sun7i-a20-s027_3.dts new file mode 100644 index 0000000000..4642c304a8 --- /dev/null +++ b/arch/arm/dts/sun7i-a20-s027_3.dts @@ -0,0 +1,272 @@ +/* + * Copyright 2021 - Giulio Benetti giulio.benetti@micronovasrl.com + * + * 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 "sun7i-a20.dtsi" +#include "sunxi-common-regulators.dtsi" + +#include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/interrupt-controller/irq.h> +#include <dt-bindings/pwm/pwm.h> + +/ { + model = "Micronova srl S027_3"; + compatible = "micronova,a20-s027_3", "allwinner,sun7i-a20"; + + aliases { + serial0 = &uart0; + }; + + backlight: backlight { + compatible = "pwm-backlight"; + power-supply = <®_axp_ipsout>; + pwms = <&pwm 0 50000 0>; + brightness-levels = <0 73 76 79 82 85 88 91 94 97 100>; + default-brightness-level = <8>; + }; + + chosen { + stdout-path = "serial0:115200n8"; + }; + + reg_axp_ipsout: axp-ipsout { + compatible = "regulator-fixed"; + regulator-name = "axp-ipsout"; + regulator-min-microvolt = <4200000>; + regulator-max-microvolt = <4200000>; + regulator-always-on; + vin-supply = <®_vcc5v0>; + }; + + reg_vusb: vusb { + compatible = "regulator-fixed"; + regulator-name = "vusb"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + gpio = <&pio 1 13 GPIO_ACTIVE_HIGH>; + enable-active-high; + status = "okay"; + vin-supply = <®_axp_ipsout>; + }; +}; + +&codec { + status = "okay"; +}; + +&ehci0 { + status = "okay"; +}; + +&ehci1 { + status = "okay"; +}; + +&i2c0 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c0_pins>; + status = "okay"; + + axp209: pmic@34 { + compatible = "x-powers,axp209"; + reg = <0x34>; + interrupt-parent = <&nmi_intc>; + interrupts = <0 IRQ_TYPE_LEVEL_LOW>; + + interrupt-controller; + #interrupt-cells = <1>; + }; +}; + +&i2c1 { + pinctrl-names = "default"; + pinctrl-0 = <&i2c1_pins>; + status = "okay"; + + ext_rtc: ext_rtc@68 { + compatible = "st,m41t11"; + reg = <0x68>; + }; +}; + +&lradc { + vref-supply = <®_vcc3v0>; + status = "okay"; +}; + +&mmc0 { + pinctrl-names = "default"; + pinctrl-0 = <&mmc0_pins>; + vmmc-supply = <®_vcc3v3>; + bus-width = <4>; + cd-gpios = <&pio 7 1 GPIO_ACTIVE_HIGH>; /* PH1 */ + cd-inverted; + status = "okay"; +}; + +&ohci0 { + status = "okay"; +}; + +&ohci1 { + status = "okay"; +}; + +&otg_sram { + status = "okay"; +}; + +&pio { + vcc-pa-supply = <®_vcc3v3>; + vcc-pc-supply = <®_vcc3v3>; + vcc-pe-supply = <®_ldo3>; + vcc-pf-supply = <®_vcc3v3>; + vcc-pg-supply = <®_ldo4>; +}; + +&pwm { + pinctrl-names = "default"; + pinctrl-0 = <&pwm0_pin>, <&pwm1_pin>; + status = "okay"; +}; + +#include "axp209.dtsi" + +&ac_power_supply { + status = "okay"; +}; + +®_dcdc2 { + regulator-always-on; + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <1400000>; + regulator-name = "cpu_vdd"; +}; + +®_dcdc3 { + regulator-always-on; + regulator-min-microvolt = <1000000>; + regulator-max-microvolt = <1400000>; + regulator-name = "int_vdd"; +}; + +®_ldo1 { + regulator-always-on; + regulator-name = "vdd_rtc"; +}; + +®_ldo2 { + regulator-always-on; + regulator-min-microvolt = <3000000>; + regulator-max-microvolt = <3000000>; + regulator-name = "+3v0"; +}; + +®_ldo3 { + regulator-always-on; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; + regulator-name = "ldo3_2v8"; + regulator-soft-start; + regulator-ramp-delay = <1600>; +}; + +®_ldo4 { + regulator-always-on; + regulator-min-microvolt = <2800000>; + regulator-max-microvolt = <2800000>; + regulator-name = "ldo4_2v8"; +}; + +®_usb0_vbus { + vin-supply = <®_vusb>; + gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */ + status = "okay"; +}; + +®_usb1_vbus { + vin-supply = <®_vusb>; + gpio = <&pio 7 5 GPIO_ACTIVE_HIGH>; /* PH5 */ + status = "okay"; +}; + +®_usb2_vbus { + vin-supply = <®_vusb>; + gpio = <&pio 7 11 GPIO_ACTIVE_LOW>; /* PH11 */ + enable-active-low; + status = "okay"; +}; + +&uart0 { + pinctrl-names = "default"; + pinctrl-0 = <&uart0_pb_pins>; + status = "okay"; +}; + +&uart1 { + pinctrl-names = "default"; + pinctrl-0 = <&uart1_pa_pins>; + status = "okay"; + linux,rs485-enabled-at-boot-time; + rts-gpios = <&pio 0 12 GPIO_ACTIVE_HIGH>; /* PA12 */ +}; + +&uart2 { + pinctrl-names = "default"; + pinctrl-0 = <&uart2_pa_pins>; + status = "okay"; + linux,rs485-enabled-at-boot-time; + rts-gpios = <&pio 0 0 GPIO_ACTIVE_HIGH>; /* PA0 */ +}; + +&usb_otg { + dr_mode = "otg"; + status = "okay"; +}; + +&usbphy { + pinctrl-names = "default"; + usb0_vbus-supply = <®_usb0_vbus>; + usb1_vbus-supply = <®_usb1_vbus>; + usb2_vbus-supply = <®_usb2_vbus>; + status = "okay"; +}; diff --git a/board/micronovasrl/s027_3/MAINTAINERS b/board/micronovasrl/s027_3/MAINTAINERS new file mode 100644 index 0000000000..1ecff4e357 --- /dev/null +++ b/board/micronovasrl/s027_3/MAINTAINERS @@ -0,0 +1,5 @@ +MICRONOVA S.R.L. S027_3 +M: Giulio Benetti giulio.benetti@micronovasrl.com +S: Maintained +F: board/micronovasrl/s027_3/ +F: configs/micronovasrl_s027_3_defconfig diff --git a/board/micronovasrl/s027_3/Makefile b/board/micronovasrl/s027_3/Makefile new file mode 100644 index 0000000000..f7452abfc7 --- /dev/null +++ b/board/micronovasrl/s027_3/Makefile @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# (C) Copyright 2021 Giulio Benetti giulio.benetti@micronovasrl.com + +obj-y += ../../sunxi/board.o +# sun7i is compatible with sun5i +obj-y += ../../sunxi/dram_sun5i_auto.o +obj-y += s027_3.o diff --git a/board/micronovasrl/s027_3/s027_3.c b/board/micronovasrl/s027_3/s027_3.c new file mode 100644 index 0000000000..69e1baecbf --- /dev/null +++ b/board/micronovasrl/s027_3/s027_3.c @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * Copyright (C) 2019 + * Author(s): Giulio Benetti giulio.benetti@benettiengineering.com + * + * Some specific init for s027_3 board. + */ + +#include <asm/gpio.h> + +int board_early_init_r(void) +{ + int lcd_pwr_gpio; + int ret; + + lcd_pwr_gpio = sunxi_name_to_gpio("PH18"); + if (lcd_pwr_gpio < 0) + return lcd_pwr_gpio; + + ret = gpio_request(lcd_pwr_gpio, "lcd-pwr"); + if (ret) + return ret; + + /* Enable LCD_PWR, it's active low */ + gpio_direction_output(lcd_pwr_gpio, 1); + gpio_set_value(lcd_pwr_gpio, 0); + + return 0; +} diff --git a/configs/micronovasrl-s027_3_defconfig b/configs/micronovasrl-s027_3_defconfig new file mode 100644 index 0000000000..068af94bd7 --- /dev/null +++ b/configs/micronovasrl-s027_3_defconfig @@ -0,0 +1,37 @@ +CONFIG_ARM=y +CONFIG_SYS_VENDOR="micronovasrl" +CONFIG_SYS_BOARD="s027_3" +CONFIG_ARCH_SUNXI=y +CONFIG_SPL=y +CONFIG_IDENT_STRING=" Micronova srl S027_3" +CONFIG_MACH_SUN7I=y +CONFIG_DRAM_CLK=384 +CONFIG_MMC0_CD_PIN="PH1" +CONFIG_USB0_VBUS_PIN="PH4" +CONFIG_USB1_VBUS_PIN="PH5" +CONFIG_USB2_VBUS_PIN="PH11" +# CONFIG_VIDEO_HDMI is not set +CONFIG_VIDEO_LCD_MODE="video" +CONFIG_VIDEO_LCD_POWER="PH0" +CONFIG_VIDEO_LCD_BL_PWM="PB2" +# CONFIG_VIDEO_LCD_BL_PWM_ACTIVE_LOW is not set +CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-s027_3" +# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +CONFIG_BOOTDELAY=1 +# CONFIG_DISPLAY_CPUINFO is not set +# CONFIG_DISPLAY_BOARDINFO is not set +CONFIG_BOARD_EARLY_INIT_R=y +# CONFIG_BOARD_LATE_INIT is not set +CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x50 +CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET=0x0 +CONFIG_SPL_I2C_SUPPORT=y +CONFIG_CMD_BMP=y +# CONFIG_NETDEVICES is not set +CONFIG_AXP_ALDO3_VOLT=2800 +CONFIG_AXP_ALDO4_VOLT=2800 +CONFIG_USB_EHCI_HCD=y +# CONFIG_USB_GADGET is not set +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASHIMAGE_GUARD=y +CONFIG_SPLASH_SCREEN_ALIGN=y +CONFIG_SPLASH_SOURCE=y

On Fri, 19 Feb 2021 00:26:19 +0100 Giulio Benetti giulio.benetti@benettiengineering.com wrote:
Hi Giulio,
From: Giulio Benetti giulio.benetti@micronovasrl.com
Add support for Micronova srl s027_3 board by adding new vendor/board folders and using in local Makefile the already present board/sunxi/Makefile. The reason is that s027_3 needs a pin to be asserted to enable lcd before setting controller up and sunxi board doesn't provide a way to do this customization.
Have you tried CONFIG_VIDEO_LCD_POWER?
I am strongly against introducing per-board code files, and we definitely won't introduce them just for one GPIO.
Signed-off-by: Giulio Benetti giulio.benetti@micronovasrl.com Signed-off-by: Giulio Benetti giulio.benetti@benettiengineering.com
Please choose one email address, there is no point in having two S-o-b's from the same person.
Cheers, Andre
arch/arm/dts/Makefile | 1 + arch/arm/dts/sun7i-a20-s027_3.dts | 272 ++++++++++++++++++++++++++ board/micronovasrl/s027_3/MAINTAINERS | 5 + board/micronovasrl/s027_3/Makefile | 8 + board/micronovasrl/s027_3/s027_3.c | 29 +++ configs/micronovasrl-s027_3_defconfig | 37 ++++ 6 files changed, 352 insertions(+) create mode 100644 arch/arm/dts/sun7i-a20-s027_3.dts create mode 100644 board/micronovasrl/s027_3/MAINTAINERS create mode 100644 board/micronovasrl/s027_3/Makefile create mode 100644 board/micronovasrl/s027_3/s027_3.c create mode 100644 configs/micronovasrl-s027_3_defconfig
diff --git a/arch/arm/dts/Makefile b/arch/arm/dts/Makefile index 33e483f4fb..658a8c95a1 100644 --- a/arch/arm/dts/Makefile +++ b/arch/arm/dts/Makefile @@ -543,6 +543,7 @@ dtb-$(CONFIG_MACH_SUN7I) += \ sun7i-a20-pcduino3.dtb \ sun7i-a20-pcduino3-nano.dtb \ sun7i-a20-primo73.dtb \
- sun7i-a20-s027_3.dtb \ sun7i-a20-wexler-tab7200.dtb \ sun7i-a20-wits-pro-a20-dkt.dtb \ sun7i-a20-yones-toptech-bd1078.dtb
diff --git a/arch/arm/dts/sun7i-a20-s027_3.dts b/arch/arm/dts/sun7i-a20-s027_3.dts new file mode 100644 index 0000000000..4642c304a8 --- /dev/null +++ b/arch/arm/dts/sun7i-a20-s027_3.dts @@ -0,0 +1,272 @@ +/*
- Copyright 2021 - Giulio Benetti giulio.benetti@micronovasrl.com
- 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 "sun7i-a20.dtsi" +#include "sunxi-common-regulators.dtsi"
+#include <dt-bindings/gpio/gpio.h> +#include <dt-bindings/interrupt-controller/irq.h> +#include <dt-bindings/pwm/pwm.h>
+/ {
- model = "Micronova srl S027_3";
- compatible = "micronova,a20-s027_3", "allwinner,sun7i-a20";
- aliases {
serial0 = &uart0;
- };
- backlight: backlight {
compatible = "pwm-backlight";
power-supply = <®_axp_ipsout>;
pwms = <&pwm 0 50000 0>;
brightness-levels = <0 73 76 79 82 85 88 91 94 97 100>;
default-brightness-level = <8>;
- };
- chosen {
stdout-path = "serial0:115200n8";
- };
- reg_axp_ipsout: axp-ipsout {
compatible = "regulator-fixed";
regulator-name = "axp-ipsout";
regulator-min-microvolt = <4200000>;
regulator-max-microvolt = <4200000>;
regulator-always-on;
vin-supply = <®_vcc5v0>;
- };
- reg_vusb: vusb {
compatible = "regulator-fixed";
regulator-name = "vusb";
regulator-min-microvolt = <5000000>;
regulator-max-microvolt = <5000000>;
gpio = <&pio 1 13 GPIO_ACTIVE_HIGH>;
enable-active-high;
status = "okay";
vin-supply = <®_axp_ipsout>;
- };
+};
+&codec {
- status = "okay";
+};
+&ehci0 {
- status = "okay";
+};
+&ehci1 {
- status = "okay";
+};
+&i2c0 {
- pinctrl-names = "default";
- pinctrl-0 = <&i2c0_pins>;
- status = "okay";
- axp209: pmic@34 {
compatible = "x-powers,axp209";
reg = <0x34>;
interrupt-parent = <&nmi_intc>;
interrupts = <0 IRQ_TYPE_LEVEL_LOW>;
interrupt-controller;
#interrupt-cells = <1>;
- };
+};
+&i2c1 {
- pinctrl-names = "default";
- pinctrl-0 = <&i2c1_pins>;
- status = "okay";
- ext_rtc: ext_rtc@68 {
compatible = "st,m41t11";
reg = <0x68>;
- };
+};
+&lradc {
- vref-supply = <®_vcc3v0>;
- status = "okay";
+};
+&mmc0 {
- pinctrl-names = "default";
- pinctrl-0 = <&mmc0_pins>;
- vmmc-supply = <®_vcc3v3>;
- bus-width = <4>;
- cd-gpios = <&pio 7 1 GPIO_ACTIVE_HIGH>; /* PH1 */
- cd-inverted;
- status = "okay";
+};
+&ohci0 {
- status = "okay";
+};
+&ohci1 {
- status = "okay";
+};
+&otg_sram {
- status = "okay";
+};
+&pio {
- vcc-pa-supply = <®_vcc3v3>;
- vcc-pc-supply = <®_vcc3v3>;
- vcc-pe-supply = <®_ldo3>;
- vcc-pf-supply = <®_vcc3v3>;
- vcc-pg-supply = <®_ldo4>;
+};
+&pwm {
- pinctrl-names = "default";
- pinctrl-0 = <&pwm0_pin>, <&pwm1_pin>;
- status = "okay";
+};
+#include "axp209.dtsi"
+&ac_power_supply {
- status = "okay";
+};
+®_dcdc2 {
- regulator-always-on;
- regulator-min-microvolt = <1000000>;
- regulator-max-microvolt = <1400000>;
- regulator-name = "cpu_vdd";
+};
+®_dcdc3 {
- regulator-always-on;
- regulator-min-microvolt = <1000000>;
- regulator-max-microvolt = <1400000>;
- regulator-name = "int_vdd";
+};
+®_ldo1 {
- regulator-always-on;
- regulator-name = "vdd_rtc";
+};
+®_ldo2 {
- regulator-always-on;
- regulator-min-microvolt = <3000000>;
- regulator-max-microvolt = <3000000>;
- regulator-name = "+3v0";
+};
+®_ldo3 {
- regulator-always-on;
- regulator-min-microvolt = <2800000>;
- regulator-max-microvolt = <2800000>;
- regulator-name = "ldo3_2v8";
- regulator-soft-start;
- regulator-ramp-delay = <1600>;
+};
+®_ldo4 {
- regulator-always-on;
- regulator-min-microvolt = <2800000>;
- regulator-max-microvolt = <2800000>;
- regulator-name = "ldo4_2v8";
+};
+®_usb0_vbus {
- vin-supply = <®_vusb>;
- gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
- status = "okay";
+};
+®_usb1_vbus {
- vin-supply = <®_vusb>;
- gpio = <&pio 7 5 GPIO_ACTIVE_HIGH>; /* PH5 */
- status = "okay";
+};
+®_usb2_vbus {
- vin-supply = <®_vusb>;
- gpio = <&pio 7 11 GPIO_ACTIVE_LOW>; /* PH11 */
- enable-active-low;
- status = "okay";
+};
+&uart0 {
- pinctrl-names = "default";
- pinctrl-0 = <&uart0_pb_pins>;
- status = "okay";
+};
+&uart1 {
- pinctrl-names = "default";
- pinctrl-0 = <&uart1_pa_pins>;
- status = "okay";
- linux,rs485-enabled-at-boot-time;
- rts-gpios = <&pio 0 12 GPIO_ACTIVE_HIGH>; /* PA12 */
+};
+&uart2 {
- pinctrl-names = "default";
- pinctrl-0 = <&uart2_pa_pins>;
- status = "okay";
- linux,rs485-enabled-at-boot-time;
- rts-gpios = <&pio 0 0 GPIO_ACTIVE_HIGH>; /* PA0 */
+};
+&usb_otg {
- dr_mode = "otg";
- status = "okay";
+};
+&usbphy {
- pinctrl-names = "default";
- usb0_vbus-supply = <®_usb0_vbus>;
- usb1_vbus-supply = <®_usb1_vbus>;
- usb2_vbus-supply = <®_usb2_vbus>;
- status = "okay";
+}; diff --git a/board/micronovasrl/s027_3/MAINTAINERS b/board/micronovasrl/s027_3/MAINTAINERS new file mode 100644 index 0000000000..1ecff4e357 --- /dev/null +++ b/board/micronovasrl/s027_3/MAINTAINERS @@ -0,0 +1,5 @@ +MICRONOVA S.R.L. S027_3 +M: Giulio Benetti giulio.benetti@micronovasrl.com +S: Maintained +F: board/micronovasrl/s027_3/ +F: configs/micronovasrl_s027_3_defconfig diff --git a/board/micronovasrl/s027_3/Makefile b/board/micronovasrl/s027_3/Makefile new file mode 100644 index 0000000000..f7452abfc7 --- /dev/null +++ b/board/micronovasrl/s027_3/Makefile @@ -0,0 +1,8 @@ +# SPDX-License-Identifier: GPL-2.0+ +# +# (C) Copyright 2021 Giulio Benetti giulio.benetti@micronovasrl.com
+obj-y += ../../sunxi/board.o +# sun7i is compatible with sun5i +obj-y += ../../sunxi/dram_sun5i_auto.o +obj-y += s027_3.o diff --git a/board/micronovasrl/s027_3/s027_3.c b/board/micronovasrl/s027_3/s027_3.c new file mode 100644 index 0000000000..69e1baecbf --- /dev/null +++ b/board/micronovasrl/s027_3/s027_3.c @@ -0,0 +1,29 @@ +// SPDX-License-Identifier: GPL-2.0+ +/*
- Copyright (C) 2019
- Author(s): Giulio Benetti giulio.benetti@benettiengineering.com
- Some specific init for s027_3 board.
- */
+#include <asm/gpio.h>
+int board_early_init_r(void) +{
- int lcd_pwr_gpio;
- int ret;
- lcd_pwr_gpio = sunxi_name_to_gpio("PH18");
- if (lcd_pwr_gpio < 0)
return lcd_pwr_gpio;
- ret = gpio_request(lcd_pwr_gpio, "lcd-pwr");
- if (ret)
return ret;
- /* Enable LCD_PWR, it's active low */
- gpio_direction_output(lcd_pwr_gpio, 1);
- gpio_set_value(lcd_pwr_gpio, 0);
- return 0;
+} diff --git a/configs/micronovasrl-s027_3_defconfig b/configs/micronovasrl-s027_3_defconfig new file mode 100644 index 0000000000..068af94bd7 --- /dev/null +++ b/configs/micronovasrl-s027_3_defconfig @@ -0,0 +1,37 @@ +CONFIG_ARM=y +CONFIG_SYS_VENDOR="micronovasrl" +CONFIG_SYS_BOARD="s027_3" +CONFIG_ARCH_SUNXI=y +CONFIG_SPL=y +CONFIG_IDENT_STRING=" Micronova srl S027_3" +CONFIG_MACH_SUN7I=y +CONFIG_DRAM_CLK=384 +CONFIG_MMC0_CD_PIN="PH1" +CONFIG_USB0_VBUS_PIN="PH4" +CONFIG_USB1_VBUS_PIN="PH5" +CONFIG_USB2_VBUS_PIN="PH11" +# CONFIG_VIDEO_HDMI is not set +CONFIG_VIDEO_LCD_MODE="video" +CONFIG_VIDEO_LCD_POWER="PH0" +CONFIG_VIDEO_LCD_BL_PWM="PB2" +# CONFIG_VIDEO_LCD_BL_PWM_ACTIVE_LOW is not set +CONFIG_DEFAULT_DEVICE_TREE="sun7i-a20-s027_3" +# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set +CONFIG_BOOTDELAY=1 +# CONFIG_DISPLAY_CPUINFO is not set +# CONFIG_DISPLAY_BOARDINFO is not set +CONFIG_BOARD_EARLY_INIT_R=y +# CONFIG_BOARD_LATE_INIT is not set +CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR=0x50 +CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_DATA_PART_OFFSET=0x0 +CONFIG_SPL_I2C_SUPPORT=y +CONFIG_CMD_BMP=y +# CONFIG_NETDEVICES is not set +CONFIG_AXP_ALDO3_VOLT=2800 +CONFIG_AXP_ALDO4_VOLT=2800 +CONFIG_USB_EHCI_HCD=y +# CONFIG_USB_GADGET is not set +CONFIG_SPLASH_SCREEN=y +CONFIG_SPLASHIMAGE_GUARD=y +CONFIG_SPLASH_SCREEN_ALIGN=y +CONFIG_SPLASH_SOURCE=y

Hi Andre,
On 2/19/21 2:44 AM, Andre Przywara wrote:
On Fri, 19 Feb 2021 00:26:19 +0100 Giulio Benetti giulio.benetti@benettiengineering.com wrote:
Hi Giulio,
From: Giulio Benetti giulio.benetti@micronovasrl.com
Add support for Micronova srl s027_3 board by adding new vendor/board folders and using in local Makefile the already present board/sunxi/Makefile. The reason is that s027_3 needs a pin to be asserted to enable lcd before setting controller up and sunxi board doesn't provide a way to do this customization.
Have you tried CONFIG_VIDEO_LCD_POWER?
Yes, I already use that for DISPONOFF.
I am strongly against introducing per-board code files, and we definitely won't introduce them just for one GPIO.
I knew it was a strange hack, but I have 2 different pins to be set high before init video controller. Another idea that comes into my mind is to handle CONFIG_VIDEO_LCD_POWER as a gpio list and iterate/enable, what about that?
Signed-off-by: Giulio Benetti giulio.benetti@micronovasrl.com Signed-off-by: Giulio Benetti giulio.benetti@benettiengineering.com
Please choose one email address, there is no point in having two S-o-b's from the same person.
I missed this as well as the repeated patch in patchset.
Thank you Best regards

On 2/19/21 11:12 AM, Giulio Benetti wrote:
Hi Andre,
On 2/19/21 2:44 AM, Andre Przywara wrote:
On Fri, 19 Feb 2021 00:26:19 +0100 Giulio Benetti giulio.benetti@benettiengineering.com wrote:
Hi Giulio,
From: Giulio Benetti giulio.benetti@micronovasrl.com
Add support for Micronova srl s027_3 board by adding new vendor/board folders and using in local Makefile the already present board/sunxi/Makefile. The reason is that s027_3 needs a pin to be asserted to enable lcd before setting controller up and sunxi board doesn't provide a way to do this customization.
Have you tried CONFIG_VIDEO_LCD_POWER?
Yes, I already use that for DISPONOFF.
I am strongly against introducing per-board code files, and we definitely won't introduce them just for one GPIO.
I knew it was a strange hack, but I have 2 different pins to be set high before init video controller. Another idea that comes into my mind is to handle CONFIG_VIDEO_LCD_POWER as a gpio list and iterate/enable, what about that?
Or introduce CONFIG_VIDEO_LCD_ENABLE, that would be easier. Here is the schematic of my lcd connector to understand: https://pasteboard.co/JP3PiYo.png
I have net LCD_PWR that should be CONFIG_VIDEO_LCD_POWER, while net LCD0_DISPONOFF should be CONFIG_VIDEO_LCD_ENABLE.
At least this is my idea. Do you have any suggestion to make it work?
Thanks in advance

On 2/19/21 11:18 AM, Giulio Benetti wrote:
On 2/19/21 11:12 AM, Giulio Benetti wrote:
Hi Andre,
On 2/19/21 2:44 AM, Andre Przywara wrote:
On Fri, 19 Feb 2021 00:26:19 +0100 Giulio Benetti giulio.benetti@benettiengineering.com wrote:
Hi Giulio,
From: Giulio Benetti giulio.benetti@micronovasrl.com
Add support for Micronova srl s027_3 board by adding new vendor/board folders and using in local Makefile the already present board/sunxi/Makefile. The reason is that s027_3 needs a pin to be asserted to enable lcd before setting controller up and sunxi board doesn't provide a way to do this customization.
Have you tried CONFIG_VIDEO_LCD_POWER?
Yes, I already use that for DISPONOFF.
I am strongly against introducing per-board code files, and we definitely won't introduce them just for one GPIO.
I knew it was a strange hack, but I have 2 different pins to be set high before init video controller. Another idea that comes into my mind is to handle CONFIG_VIDEO_LCD_POWER as a gpio list and iterate/enable, what about that?
Or introduce CONFIG_VIDEO_LCD_ENABLE, that would be easier. Here is the schematic of my lcd connector to understand: https://pasteboard.co/JP3PiYo.png
I have net LCD_PWR that should be CONFIG_VIDEO_LCD_POWER, while net LCD0_DISPONOFF should be CONFIG_VIDEO_LCD_ENABLE.
At least this is my idea. Do you have any suggestion to make it work?
May I say a word?
Is it possible to wire the LCD0_DISPONOFF (I suppose it is high active) with the same pin routed to a SN74LVC1G04 to the pullup thru the Q6 Transistor?
Supposed there is no such timing restritctions
Regards, Gianluca

Hi Gianluca,
On 2/19/21 11:38 AM, gianluca wrote:
On 2/19/21 11:18 AM, Giulio Benetti wrote:
On 2/19/21 11:12 AM, Giulio Benetti wrote:
Hi Andre,
On 2/19/21 2:44 AM, Andre Przywara wrote:
On Fri, 19 Feb 2021 00:26:19 +0100 Giulio Benetti giulio.benetti@benettiengineering.com wrote:
Hi Giulio,
From: Giulio Benetti giulio.benetti@micronovasrl.com
Add support for Micronova srl s027_3 board by adding new vendor/board folders and using in local Makefile the already present board/sunxi/Makefile. The reason is that s027_3 needs a pin to be asserted to enable lcd before setting controller up and sunxi board doesn't provide a way to do this customization.
Have you tried CONFIG_VIDEO_LCD_POWER?
Yes, I already use that for DISPONOFF.
I am strongly against introducing per-board code files, and we definitely won't introduce them just for one GPIO.
I knew it was a strange hack, but I have 2 different pins to be set high before init video controller. Another idea that comes into my mind is to handle CONFIG_VIDEO_LCD_POWER as a gpio list and iterate/enable, what about that?
Or introduce CONFIG_VIDEO_LCD_ENABLE, that would be easier. Here is the schematic of my lcd connector to understand: https://pasteboard.co/JP3PiYo.png
I have net LCD_PWR that should be CONFIG_VIDEO_LCD_POWER, while net LCD0_DISPONOFF should be CONFIG_VIDEO_LCD_ENABLE.
At least this is my idea. Do you have any suggestion to make it work?
May I say a word?
Of course!
Is it possible to wire the LCD0_DISPONOFF (I suppose it is high active) with the same pin routed to a SN74LVC1G04 to the pullup thru the Q6 Transistor?
Supposed there is no such timing restritctions
Unfortunately board can't be changed, thanks though.
Best regards

On Fri, 19 Feb 2021 11:12:08 +0100 Giulio Benetti giulio.benetti@benettiengineering.com wrote:
Hi,
On 2/19/21 2:44 AM, Andre Przywara wrote:
On Fri, 19 Feb 2021 00:26:19 +0100 Giulio Benetti giulio.benetti@benettiengineering.com wrote:
Hi Giulio,
From: Giulio Benetti giulio.benetti@micronovasrl.com
Add support for Micronova srl s027_3 board by adding new vendor/board folders and using in local Makefile the already present board/sunxi/Makefile. The reason is that s027_3 needs a pin to be asserted to enable lcd before setting controller up and sunxi board doesn't provide a way to do this customization.
Have you tried CONFIG_VIDEO_LCD_POWER?
Yes, I already use that for DISPONOFF.
So what are these pins for, exactly? Backlight? A regulator to provide power to the LCD? If you grep for "gpio.CONFIG" in sunxi_display.c, there are more GPIOs that we set, for various reasons. Can you pick some from there, and set them in your defconfig?
I am strongly against introducing per-board code files, and we definitely won't introduce them just for one GPIO.
I knew it was a strange hack, but I have 2 different pins to be set high before init video controller. Another idea that comes into my mind is to handle CONFIG_VIDEO_LCD_POWER as a gpio list and iterate/enable, what about that?
Do you really need *two* pins to switch the LCD power supply? If yes, this might be an option. But I guess at this point we want to go more a DT route. Speaking of which, I don't see any video output device in the DT, I guess you just rely on simplefb. But given that there is no bridge or it seems to be transparent, at least, you might be able to describe this in the DT as well, so Linux can use its own display driver? Then we might be able to find a more sustainable solution, based on pins in the DT.
Cheers, Andre
P.S. Can you please try to apply https://patchwork.ozlabs.org/project/uboot/patch/20210205010748.2646-1-andre... This would be merged around the same time, and I am curious if this still works with an LCD.
Signed-off-by: Giulio Benetti giulio.benetti@micronovasrl.com Signed-off-by: Giulio Benetti giulio.benetti@benettiengineering.com
Please choose one email address, there is no point in having two S-o-b's from the same person.
I missed this as well as the repeated patch in patchset.
Thank you Best regards

Hi Andre,
On 2/19/21 12:37 PM, Andre Przywara wrote:
On Fri, 19 Feb 2021 11:12:08 +0100 Giulio Benetti giulio.benetti@benettiengineering.com wrote:
Hi,
On 2/19/21 2:44 AM, Andre Przywara wrote:
On Fri, 19 Feb 2021 00:26:19 +0100 Giulio Benetti giulio.benetti@benettiengineering.com wrote:
Hi Giulio,
From: Giulio Benetti giulio.benetti@micronovasrl.com
Add support for Micronova srl s027_3 board by adding new vendor/board folders and using in local Makefile the already present board/sunxi/Makefile. The reason is that s027_3 needs a pin to be asserted to enable lcd before setting controller up and sunxi board doesn't provide a way to do this customization.
Have you tried CONFIG_VIDEO_LCD_POWER?
Yes, I already use that for DISPONOFF.
So what are these pins for, exactly? Backlight? A regulator to provide power to the LCD?
It's the power rail for LCD.
If you grep for "gpio.CONFIG" in sunxi_display.c, there are more GPIOs that we set, for various reasons. Can you pick some from there, and set them in your defconfig?
Unfortunately my LCD_PWR drives a P-MOS so it must be inverted, while LCD0_DISPONOFF can be meant as a lcd reset.
So I introduce CONFIG_VIDEO_LCD_POWER_ACTIVE_LOW for my board to work locally.
Would it make sense to send a patch for this for supporting my board? Or do I wait for you patchset [1] to be applied?
I am strongly against introducing per-board code files, and we definitely won't introduce them just for one GPIO.
I knew it was a strange hack, but I have 2 different pins to be set high before init video controller. Another idea that comes into my mind is to handle CONFIG_VIDEO_LCD_POWER as a gpio list and iterate/enable, what about that?
Do you really need *two* pins to switch the LCD power supply?
I've messed up names, I need only one pin for LCD power supply(the on with P-MOS) but another to enable it(DISPONOFF). But here the problem was that LCD power supply is active low.
If yes, this might be an option. But I guess at this point we want to go more a DT route.
Yes, agree.
Speaking of which, I don't see any video output device in the DT, I guess you just rely on simplefb.
Yes, simplefb for u-boot while...
But given that there is no bridge or it seems to be transparent, at least, you might be able to describe this in the DT as well, so Linux can use its own display driver?
for Linux I use 4 different fdt overlays using fe,be,tcon and simple-panel.
Then we might be able to find a more sustainable solution, based on pins in the DT.
Yes
Cheers, Andre
P.S. Can you please try to apply
[1]:
https://patchwork.ozlabs.org/project/uboot/patch/20210205010748.2646-1-andre... This would be merged around the same time, and I am curious if this still works with an LCD.
For sure I will, I was waiting for this and I've also started to port it a bit but I have not much time and then you added a patch. I'm going to test it and report. If it doesn't work I'll try to fix it for having s027_3 board added using DT then.
Best regards!

On Fri, 19 Feb 2021 16:27:41 +0100 Giulio Benetti giulio.benetti@benettiengineering.com wrote:
Hi Giulio,
On 2/19/21 12:37 PM, Andre Przywara wrote:
On Fri, 19 Feb 2021 11:12:08 +0100 Giulio Benetti giulio.benetti@benettiengineering.com wrote:
Hi,
On 2/19/21 2:44 AM, Andre Przywara wrote:
On Fri, 19 Feb 2021 00:26:19 +0100 Giulio Benetti giulio.benetti@benettiengineering.com wrote:
Hi Giulio,
From: Giulio Benetti giulio.benetti@micronovasrl.com
Add support for Micronova srl s027_3 board by adding new vendor/board folders and using in local Makefile the already present board/sunxi/Makefile. The reason is that s027_3 needs a pin to be asserted to enable lcd before setting controller up and sunxi board doesn't provide a way to do this customization.
Have you tried CONFIG_VIDEO_LCD_POWER?
Yes, I already use that for DISPONOFF.
So what are these pins for, exactly? Backlight? A regulator to provide power to the LCD?
It's the power rail for LCD.
If you grep for "gpio.CONFIG" in sunxi_display.c, there are more GPIOs that we set, for various reasons. Can you pick some from there, and set them in your defconfig?
Unfortunately my LCD_PWR drives a P-MOS so it must be inverted, while LCD0_DISPONOFF can be meant as a lcd reset.
So I introduce CONFIG_VIDEO_LCD_POWER_ACTIVE_LOW for my board to work locally.
Would it make sense to send a patch for this for supporting my board? Or do I wait for you patchset [1] to be applied?
I am strongly against introducing per-board code files, and we definitely won't introduce them just for one GPIO.
I knew it was a strange hack, but I have 2 different pins to be set high before init video controller. Another idea that comes into my mind is to handle CONFIG_VIDEO_LCD_POWER as a gpio list and iterate/enable, what about that?
Do you really need *two* pins to switch the LCD power supply?
I've messed up names, I need only one pin for LCD power supply(the on with P-MOS) but another to enable it(DISPONOFF). But here the problem was that LCD power supply is active low.
If yes, this might be an option. But I guess at this point we want to go more a DT route.
Yes, agree.
Speaking of which, I don't see any video output device in the DT, I guess you just rely on simplefb.
Yes, simplefb for u-boot while...
But given that there is no bridge or it seems to be transparent, at least, you might be able to describe this in the DT as well, so Linux can use its own display driver?
for Linux I use 4 different fdt overlays using fe,be,tcon and simple-panel.
I see that the simple-panel binding has a generic enable-gpios property, so that sounds fine. Can you share the DT snippets? Just to get an idea what is what and how we can shortcut it, if needed? There is also drivers/video/simple_panel.c in U-Boot, which would handle the power-supply *and* enable-gpios properties already, can you check if we can use that? I am a bit reluctant to add just another set of CONFIG_GPIO_... options, if everything is in the DT already.
How do you plan to handle the overlays? Is the LCD an option, or is it always connected? You want to always enable it in the U-Boot defconfig, don't you?
Then we might be able to find a more sustainable solution, based on pins in the DT.
Yes
Cheers, Andre
P.S. Can you please try to apply
[1]:
https://patchwork.ozlabs.org/project/uboot/patch/20210205010748.2646-1-andre... This would be merged around the same time, and I am curious if this still works with an LCD.
For sure I will, I was waiting for this and I've also started to port it a bit but I have not much time and then you added a patch. I'm going to test it and report. If it doesn't work I'll try to fix it for having s027_3 board added using DT then.
As you have surely noticed, we currently see a warning when compiling boards with the old display engine, so this patch is needed to stop that and to avoid removal of video support. I will send a slightly fixed version soonish and then queue this for the next merge window, opening in April. So it would be wise if you base any work on that patch.
Cheers, Andre

From: Giulio Benetti giulio.benetti@micronovasrl.com
sun7i pwm is equal to sun4i and sun5i so enable pwm0 the same way for sun7i.
Signed-off-by: Giulio Benetti giulio.benetti@micronovasrl.com Signed-off-by: Giulio Benetti giulio.benetti@benettiengineering.com --- arch/arm/include/asm/arch-sunxi/pwm.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/include/asm/arch-sunxi/pwm.h b/arch/arm/include/asm/arch-sunxi/pwm.h index b89bddd2e8..1a1c6e0c54 100644 --- a/arch/arm/include/asm/arch-sunxi/pwm.h +++ b/arch/arm/include/asm/arch-sunxi/pwm.h @@ -26,7 +26,8 @@
#define SUNXI_PWM_PERIOD_80PCT 0x04af03c0
-#if defined CONFIG_MACH_SUN4I || defined CONFIG_MACH_SUN5I +#if defined CONFIG_MACH_SUN4I || defined CONFIG_MACH_SUN5I || \ + defined CONFIG_MACH_SUN7I #define SUNXI_PWM_PIN0 SUNXI_GPB(2) #define SUNXI_PWM_MUX SUN4I_GPB_PWM #endif

On Fri, 19 Feb 2021 00:26:20 +0100 Giulio Benetti giulio.benetti@benettiengineering.com wrote:
From: Giulio Benetti giulio.benetti@micronovasrl.com
sun7i pwm is equal to sun4i and sun5i so enable pwm0 the same way for sun7i.
Signed-off-by: Giulio Benetti giulio.benetti@micronovasrl.com Signed-off-by: Giulio Benetti giulio.benetti@benettiengineering.com
Looks alright, though I feel the pwm driver should look into the DT to find the pin, like we do for sun8i_emac.c. But that's probably another patch, so:
Reviewed-by: Andre Przywara andre.przywara@arm.com
Cheers, Andre
arch/arm/include/asm/arch-sunxi/pwm.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/arch/arm/include/asm/arch-sunxi/pwm.h b/arch/arm/include/asm/arch-sunxi/pwm.h index b89bddd2e8..1a1c6e0c54 100644 --- a/arch/arm/include/asm/arch-sunxi/pwm.h +++ b/arch/arm/include/asm/arch-sunxi/pwm.h @@ -26,7 +26,8 @@
#define SUNXI_PWM_PERIOD_80PCT 0x04af03c0
-#if defined CONFIG_MACH_SUN4I || defined CONFIG_MACH_SUN5I +#if defined CONFIG_MACH_SUN4I || defined CONFIG_MACH_SUN5I || \
- defined CONFIG_MACH_SUN7I
#define SUNXI_PWM_PIN0 SUNXI_GPB(2) #define SUNXI_PWM_MUX SUN4I_GPB_PWM #endif

Sorry I've forgotten to send patch for adding dts uart1_pa_pins. I wait for some comment before sending v2.
On 2/19/21 12:26 AM, Giulio Benetti wrote:
Add Micronova srl S027_3 board support
Giulio Benetti (5): arm: allwinner: dts: a20: add uart2_pa_pins sunxi: allow SYS_BOARD to be set sunxi: add SYS_VENDOR to Kconfig sun7i: add support for Micronova srl s027_3 board pwm: sunxi: enable pwm0 support on sun7i
arch/arm/dts/Makefile | 1 + arch/arm/dts/sun7i-a20-s027_3.dts | 272 ++++++++++++++++++++++++++ arch/arm/dts/sun7i-a20.dtsi | 5 + arch/arm/include/asm/arch-sunxi/pwm.h | 3 +- arch/arm/mach-sunxi/Kconfig | 5 + board/micronovasrl/s027_3/MAINTAINERS | 5 + board/micronovasrl/s027_3/Makefile | 8 + board/micronovasrl/s027_3/s027_3.c | 29 +++ configs/micronovasrl-s027_3_defconfig | 37 ++++ 9 files changed, 364 insertions(+), 1 deletion(-) create mode 100644 arch/arm/dts/sun7i-a20-s027_3.dts create mode 100644 board/micronovasrl/s027_3/MAINTAINERS create mode 100644 board/micronovasrl/s027_3/Makefile create mode 100644 board/micronovasrl/s027_3/s027_3.c create mode 100644 configs/micronovasrl-s027_3_defconfig
participants (3)
-
Andre Przywara
-
gianluca
-
Giulio Benetti