All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/5] Add Micronova srl S027_3 board support
@ 2021-02-18 23:26 Giulio Benetti
  2021-02-18 23:26 ` [PATCH 1/5] arm: allwinner: dts: a20: add uart2_pa_pins Giulio Benetti
                   ` (5 more replies)
  0 siblings, 6 replies; 18+ messages in thread
From: Giulio Benetti @ 2021-02-18 23:26 UTC (permalink / raw)
  To: u-boot

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

-- 
2.25.1

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 1/5] arm: allwinner: dts: a20: add uart2_pa_pins
  2021-02-18 23:26 [PATCH 0/5] Add Micronova srl S027_3 board support Giulio Benetti
@ 2021-02-18 23:26 ` Giulio Benetti
  2021-02-19 11:04   ` Andre Przywara
  2021-02-18 23:26 ` [PATCH 2/5] sunxi: allow SYS_BOARD to be set Giulio Benetti
                   ` (4 subsequent siblings)
  5 siblings, 1 reply; 18+ messages in thread
From: Giulio Benetti @ 2021-02-18 23:26 UTC (permalink / raw)
  To: u-boot

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";
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 2/5] sunxi: allow SYS_BOARD to be set
  2021-02-18 23:26 [PATCH 0/5] Add Micronova srl S027_3 board support Giulio Benetti
  2021-02-18 23:26 ` [PATCH 1/5] arm: allwinner: dts: a20: add uart2_pa_pins Giulio Benetti
@ 2021-02-18 23:26 ` Giulio Benetti
  2021-02-18 23:26 ` [PATCH 3/5] sunxi: add SYS_VENDOR to Kconfig Giulio Benetti
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 18+ messages in thread
From: Giulio Benetti @ 2021-02-18 23:26 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 3/5] sunxi: add SYS_VENDOR to Kconfig
  2021-02-18 23:26 [PATCH 0/5] Add Micronova srl S027_3 board support Giulio Benetti
  2021-02-18 23:26 ` [PATCH 1/5] arm: allwinner: dts: a20: add uart2_pa_pins Giulio Benetti
  2021-02-18 23:26 ` [PATCH 2/5] sunxi: allow SYS_BOARD to be set Giulio Benetti
@ 2021-02-18 23:26 ` Giulio Benetti
  2021-02-18 23:26 ` [PATCH 4/5] sun7i: add support for Micronova srl s027_3 board Giulio Benetti
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 18+ messages in thread
From: Giulio Benetti @ 2021-02-18 23:26 UTC (permalink / raw)
  To: u-boot

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"
 
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 4/5] sun7i: add support for Micronova srl s027_3 board
  2021-02-18 23:26 [PATCH 0/5] Add Micronova srl S027_3 board support Giulio Benetti
                   ` (2 preceding siblings ...)
  2021-02-18 23:26 ` [PATCH 3/5] sunxi: add SYS_VENDOR to Kconfig Giulio Benetti
@ 2021-02-18 23:26 ` Giulio Benetti
  2021-02-19  1:44   ` Andre Przywara
  2021-02-18 23:26 ` [PATCH 5/5] pwm: sunxi: enable pwm0 support on sun7i Giulio Benetti
  2021-02-18 23:28 ` [PATCH 0/5] Add Micronova srl S027_3 board support Giulio Benetti
  5 siblings, 1 reply; 18+ messages in thread
From: Giulio Benetti @ 2021-02-18 23:26 UTC (permalink / raw)
  To: u-boot

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 = <&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@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
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 5/5] pwm: sunxi: enable pwm0 support on sun7i
  2021-02-18 23:26 [PATCH 0/5] Add Micronova srl S027_3 board support Giulio Benetti
                   ` (3 preceding siblings ...)
  2021-02-18 23:26 ` [PATCH 4/5] sun7i: add support for Micronova srl s027_3 board Giulio Benetti
@ 2021-02-18 23:26 ` Giulio Benetti
  2021-02-19 11:21   ` Andre Przywara
  2021-02-18 23:28 ` [PATCH 0/5] Add Micronova srl S027_3 board support Giulio Benetti
  5 siblings, 1 reply; 18+ messages in thread
From: Giulio Benetti @ 2021-02-18 23:26 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH 0/5] Add Micronova srl S027_3 board support
  2021-02-18 23:26 [PATCH 0/5] Add Micronova srl S027_3 board support Giulio Benetti
                   ` (4 preceding siblings ...)
  2021-02-18 23:26 ` [PATCH 5/5] pwm: sunxi: enable pwm0 support on sun7i Giulio Benetti
@ 2021-02-18 23:28 ` Giulio Benetti
  5 siblings, 0 replies; 18+ messages in thread
From: Giulio Benetti @ 2021-02-18 23:28 UTC (permalink / raw)
  To: u-boot

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
> 

-- 
Giulio Benetti
Benetti Engineering sas

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 4/5] sun7i: add support for Micronova srl s027_3 board
  2021-02-18 23:26 ` [PATCH 4/5] sun7i: add support for Micronova srl s027_3 board Giulio Benetti
@ 2021-02-19  1:44   ` Andre Przywara
  2021-02-19 10:12     ` Giulio Benetti
  0 siblings, 1 reply; 18+ messages in thread
From: Andre Przywara @ 2021-02-19  1:44 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 4/5] sun7i: add support for Micronova srl s027_3 board
  2021-02-19  1:44   ` Andre Przywara
@ 2021-02-19 10:12     ` Giulio Benetti
  2021-02-19 10:18       ` Giulio Benetti
  2021-02-19 11:37       ` Andre Przywara
  0 siblings, 2 replies; 18+ messages in thread
From: Giulio Benetti @ 2021-02-19 10:12 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 4/5] sun7i: add support for Micronova srl s027_3 board
  2021-02-19 10:12     ` Giulio Benetti
@ 2021-02-19 10:18       ` Giulio Benetti
  2021-02-19 10:38         ` gianluca
  2021-02-19 11:37       ` Andre Przywara
  1 sibling, 1 reply; 18+ messages in thread
From: Giulio Benetti @ 2021-02-19 10:18 UTC (permalink / raw)
  To: u-boot

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
-- 
Giulio Benetti
Benetti Engineering sas

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 4/5] sun7i: add support for Micronova srl s027_3 board
  2021-02-19 10:18       ` Giulio Benetti
@ 2021-02-19 10:38         ` gianluca
  2021-02-19 11:10           ` Giulio Benetti
  0 siblings, 1 reply; 18+ messages in thread
From: gianluca @ 2021-02-19 10:38 UTC (permalink / raw)
  To: u-boot

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
-- 
Eurek s.r.l.                          |
Electronic Engineering                | http://www.eurek.it
via Celletta 8/B, 40026 Imola, Italy  | Phone: +39-(0)542-609120
p.iva 00690621206 - c.f. 04020030377  | Fax:   +39-(0)542-609212

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 1/5] arm: allwinner: dts: a20: add uart2_pa_pins
  2021-02-18 23:26 ` [PATCH 1/5] arm: allwinner: dts: a20: add uart2_pa_pins Giulio Benetti
@ 2021-02-19 11:04   ` Andre Przywara
  2021-02-19 11:45     ` Giulio Benetti
  0 siblings, 1 reply; 18+ messages in thread
From: Andre Przywara @ 2021-02-19 11:04 UTC (permalink / raw)
  To: u-boot

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";

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 4/5] sun7i: add support for Micronova srl s027_3 board
  2021-02-19 10:38         ` gianluca
@ 2021-02-19 11:10           ` Giulio Benetti
  0 siblings, 0 replies; 18+ messages in thread
From: Giulio Benetti @ 2021-02-19 11:10 UTC (permalink / raw)
  To: u-boot

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
-- 
Giulio Benetti
Benetti Engineering sas

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 5/5] pwm: sunxi: enable pwm0 support on sun7i
  2021-02-18 23:26 ` [PATCH 5/5] pwm: sunxi: enable pwm0 support on sun7i Giulio Benetti
@ 2021-02-19 11:21   ` Andre Przywara
  0 siblings, 0 replies; 18+ messages in thread
From: Andre Przywara @ 2021-02-19 11:21 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 4/5] sun7i: add support for Micronova srl s027_3 board
  2021-02-19 10:12     ` Giulio Benetti
  2021-02-19 10:18       ` Giulio Benetti
@ 2021-02-19 11:37       ` Andre Przywara
  2021-02-19 15:27         ` Giulio Benetti
  1 sibling, 1 reply; 18+ messages in thread
From: Andre Przywara @ 2021-02-19 11:37 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 1/5] arm: allwinner: dts: a20: add uart2_pa_pins
  2021-02-19 11:04   ` Andre Przywara
@ 2021-02-19 11:45     ` Giulio Benetti
  0 siblings, 0 replies; 18+ messages in thread
From: Giulio Benetti @ 2021-02-19 11:45 UTC (permalink / raw)
  To: u-boot

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/bindings/net/mdio.yaml#L90

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
-- 
Giulio Benetti
Benetti Engineering sas

> Cheers,
> Andre
> 
>>   			uart2_pi_pins: uart2-pi-pins {
>>   				pins = "PI18", "PI19";
>>   				function = "uart2";

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 4/5] sun7i: add support for Micronova srl s027_3 board
  2021-02-19 11:37       ` Andre Przywara
@ 2021-02-19 15:27         ` Giulio Benetti
  2021-02-20  1:57           ` Andre Przywara
  0 siblings, 1 reply; 18+ messages in thread
From: Giulio Benetti @ 2021-02-19 15:27 UTC (permalink / raw)
  To: u-boot

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 at 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!
-- 
Giulio Benetti
Benetti Engineering sas

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH 4/5] sun7i: add support for Micronova srl s027_3 board
  2021-02-19 15:27         ` Giulio Benetti
@ 2021-02-20  1:57           ` Andre Przywara
  0 siblings, 0 replies; 18+ messages in thread
From: Andre Przywara @ 2021-02-20  1:57 UTC (permalink / raw)
  To: u-boot

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

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2021-02-20  1:57 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-02-18 23:26 [PATCH 0/5] Add Micronova srl S027_3 board support Giulio Benetti
2021-02-18 23:26 ` [PATCH 1/5] arm: allwinner: dts: a20: add uart2_pa_pins Giulio Benetti
2021-02-19 11:04   ` Andre Przywara
2021-02-19 11:45     ` Giulio Benetti
2021-02-18 23:26 ` [PATCH 2/5] sunxi: allow SYS_BOARD to be set Giulio Benetti
2021-02-18 23:26 ` [PATCH 3/5] sunxi: add SYS_VENDOR to Kconfig Giulio Benetti
2021-02-18 23:26 ` [PATCH 4/5] sun7i: add support for Micronova srl s027_3 board Giulio Benetti
2021-02-19  1:44   ` Andre Przywara
2021-02-19 10:12     ` Giulio Benetti
2021-02-19 10:18       ` Giulio Benetti
2021-02-19 10:38         ` gianluca
2021-02-19 11:10           ` Giulio Benetti
2021-02-19 11:37       ` Andre Przywara
2021-02-19 15:27         ` Giulio Benetti
2021-02-20  1:57           ` Andre Przywara
2021-02-18 23:26 ` [PATCH 5/5] pwm: sunxi: enable pwm0 support on sun7i Giulio Benetti
2021-02-19 11:21   ` Andre Przywara
2021-02-18 23:28 ` [PATCH 0/5] Add Micronova srl S027_3 board support Giulio Benetti

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.