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

Giulio Benetti giulio.benetti at benettiengineering.com
Fri Feb 19 11:12:08 CET 2021


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 at benettiengineering.com> wrote:
> 
> Hi Giulio,
> 
>> From: Giulio Benetti <giulio.benetti at 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 at micronovasrl.com>
>> Signed-off-by: Giulio Benetti <giulio.benetti at 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
Benetti Engineering sas

> 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 at 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 at 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 at 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 at 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 at 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 at 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
> 



More information about the U-Boot mailing list