diff mbox series

[4/5] sun7i: add support for Micronova srl s027_3 board

Message ID 20210218232622.883509-5-giulio.benetti@benettiengineering.com
State Rejected
Delegated to: Andre Przywara
Headers show
Series Add Micronova srl S027_3 board support | expand

Commit Message

Giulio Benetti Feb. 18, 2021, 11:26 p.m. UTC
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

Comments

Andre Przywara Feb. 19, 2021, 1:44 a.m. UTC | #1
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 = <&reg_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 = <&reg_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 = <&reg_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 = <&reg_vcc3v0>;
> +	status = "okay";
> +};
> +
> +&mmc0 {
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&mmc0_pins>;
> +	vmmc-supply = <&reg_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 = <&reg_vcc3v3>;
> +	vcc-pc-supply = <&reg_vcc3v3>;
> +	vcc-pe-supply = <&reg_ldo3>;
> +	vcc-pf-supply = <&reg_vcc3v3>;
> +	vcc-pg-supply = <&reg_ldo4>;
> +};
> +
> +&pwm {
> +	pinctrl-names = "default";
> +	pinctrl-0 = <&pwm0_pin>, <&pwm1_pin>;
> +	status = "okay";
> +};
> +
> +#include "axp209.dtsi"
> +
> +&ac_power_supply {
> +	status = "okay";
> +};
> +
> +&reg_dcdc2 {
> +	regulator-always-on;
> +	regulator-min-microvolt = <1000000>;
> +	regulator-max-microvolt = <1400000>;
> +	regulator-name = "cpu_vdd";
> +};
> +
> +&reg_dcdc3 {
> +	regulator-always-on;
> +	regulator-min-microvolt = <1000000>;
> +	regulator-max-microvolt = <1400000>;
> +	regulator-name = "int_vdd";
> +};
> +
> +&reg_ldo1 {
> +	regulator-always-on;
> +	regulator-name = "vdd_rtc";
> +};
> +
> +&reg_ldo2 {
> +	regulator-always-on;
> +	regulator-min-microvolt = <3000000>;
> +	regulator-max-microvolt = <3000000>;
> +	regulator-name = "+3v0";
> +};
> +
> +&reg_ldo3 {
> +	regulator-always-on;
> +	regulator-min-microvolt = <2800000>;
> +	regulator-max-microvolt = <2800000>;
> +	regulator-name = "ldo3_2v8";
> +	regulator-soft-start;
> +	regulator-ramp-delay = <1600>;
> +};
> +
> +&reg_ldo4 {
> +	regulator-always-on;
> +	regulator-min-microvolt = <2800000>;
> +	regulator-max-microvolt = <2800000>;
> +	regulator-name = "ldo4_2v8";
> +};
> +
> +&reg_usb0_vbus {
> +	vin-supply = <&reg_vusb>;
> +	gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
> +	status = "okay";
> +};
> +
> +&reg_usb1_vbus {
> +	vin-supply = <&reg_vusb>;
> +	gpio = <&pio 7 5 GPIO_ACTIVE_HIGH>; /* PH5 */
> +	status = "okay";
> +};
> +
> +&reg_usb2_vbus {
> +	vin-supply = <&reg_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 = <&reg_usb0_vbus>;
> +	usb1_vbus-supply = <&reg_usb1_vbus>;
> +	usb2_vbus-supply = <&reg_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
Giulio Benetti Feb. 19, 2021, 10:12 a.m. UTC | #2
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
Giulio Benetti Feb. 19, 2021, 10:18 a.m. UTC | #3
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
gianluca Feb. 19, 2021, 10:38 a.m. UTC | #4
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
Giulio Benetti Feb. 19, 2021, 11:10 a.m. UTC | #5
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
Andre Przywara Feb. 19, 2021, 11:37 a.m. UTC | #6
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.przywara@arm.com/
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
Giulio Benetti Feb. 19, 2021, 3:27 p.m. UTC | #7
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.przywara@arm.com/
> 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!
Andre Przywara Feb. 20, 2021, 1:57 a.m. UTC | #8
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.przywara@arm.com/
> > 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
diff mbox series

Patch

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 = <&reg_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 = <&reg_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 = <&reg_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 = <&reg_vcc3v0>;
+	status = "okay";
+};
+
+&mmc0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&mmc0_pins>;
+	vmmc-supply = <&reg_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 = <&reg_vcc3v3>;
+	vcc-pc-supply = <&reg_vcc3v3>;
+	vcc-pe-supply = <&reg_ldo3>;
+	vcc-pf-supply = <&reg_vcc3v3>;
+	vcc-pg-supply = <&reg_ldo4>;
+};
+
+&pwm {
+	pinctrl-names = "default";
+	pinctrl-0 = <&pwm0_pin>, <&pwm1_pin>;
+	status = "okay";
+};
+
+#include "axp209.dtsi"
+
+&ac_power_supply {
+	status = "okay";
+};
+
+&reg_dcdc2 {
+	regulator-always-on;
+	regulator-min-microvolt = <1000000>;
+	regulator-max-microvolt = <1400000>;
+	regulator-name = "cpu_vdd";
+};
+
+&reg_dcdc3 {
+	regulator-always-on;
+	regulator-min-microvolt = <1000000>;
+	regulator-max-microvolt = <1400000>;
+	regulator-name = "int_vdd";
+};
+
+&reg_ldo1 {
+	regulator-always-on;
+	regulator-name = "vdd_rtc";
+};
+
+&reg_ldo2 {
+	regulator-always-on;
+	regulator-min-microvolt = <3000000>;
+	regulator-max-microvolt = <3000000>;
+	regulator-name = "+3v0";
+};
+
+&reg_ldo3 {
+	regulator-always-on;
+	regulator-min-microvolt = <2800000>;
+	regulator-max-microvolt = <2800000>;
+	regulator-name = "ldo3_2v8";
+	regulator-soft-start;
+	regulator-ramp-delay = <1600>;
+};
+
+&reg_ldo4 {
+	regulator-always-on;
+	regulator-min-microvolt = <2800000>;
+	regulator-max-microvolt = <2800000>;
+	regulator-name = "ldo4_2v8";
+};
+
+&reg_usb0_vbus {
+	vin-supply = <&reg_vusb>;
+	gpio = <&pio 7 4 GPIO_ACTIVE_HIGH>; /* PH4 */
+	status = "okay";
+};
+
+&reg_usb1_vbus {
+	vin-supply = <&reg_vusb>;
+	gpio = <&pio 7 5 GPIO_ACTIVE_HIGH>; /* PH5 */
+	status = "okay";
+};
+
+&reg_usb2_vbus {
+	vin-supply = <&reg_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 = <&reg_usb0_vbus>;
+	usb1_vbus-supply = <&reg_usb1_vbus>;
+	usb2_vbus-supply = <&reg_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