Skip to contentSkip to conversation

Add DM support for omap PWM backlight

PATCH Superseded Dario Binacchi 3 participants 26 messages Oct 11, 2020 – Oct 16, 2020

Subsystems (8)

v3 of 8 Superseded Latest is v8 →

lore
Share & tools
lore
#0 lore raw

v3 cover Add DM support for omap PWM backlight

The series was born from the need to manage the PWM backlight of the display connected to my beaglebone board. To hit the target, I had to develop drivers for PWM management which in turn relied on drivers for managing timers and clocks, all developed according to the driver model. My intention was to use the SoC-specific API only at strictly necessary points in the code. My previous patches for migrating the AM335x display driver to the driver model had required the implementation of additional functions outside the concerns of the driver, (settings for dividing the pixel clock rate, configuring the display DPLL rate, ....) not being able to use the API of the related clock drivers. This series shouldn't have repeated the same kind of mistake. Furthermore, I also wanted to fix that kind of forced choice. Almost everything should have been accessible via the driver model API. In the series there are also some patches that could be submitted separately, but which I have however inserted to avoid applying future patches to incorporate them.
With this last consideration, I hope I have convincingly justified the large number of patches in the series.

The patch enabling address translation into a CPU physical address from device-tree even in case of crossing levels with #size-cells = <0>, is crucial for the series. The previous implementation was unable to perform the address translation required by the am33xx device tree. I tried to apply in a conservative way as few changes as possible and to verify the execution of all the tests already developed, as well as the new ones I added for the new feature.

As recommended by Grygorii Strashko I have removed some patches to upload them in new different series:
- [v2,01/30] clk: remove a redundant header
- [v2,03/30] arch: sandbox: fix typo in clk.h
- [v2,20/30] video: backlight: fix pwm's duty cycle calculation
- [v2,21/30] video: backlight: fix pwm data structure description
- [v2,22/30] dm: core: improve uclass_get_device_by_phandle_id() description
- [v2,23/30] gpio: fix gpio_request_by_name() description

Grygorii suggested to remove also other patches that I have kept in the series to allow anyone who wants to be able to test it. Moreover after the addition of a patch that has largely changed the device tree. The patches removed are the one and only ones that do not affect the series in any way. I hope that the next version of this series will require only minimal changes allowing me to split it according to Grygorii's suggestions.

Changes in v3:
- Remove doc/device-tree-bindings/clock/clock-bindings.txt.
- Remove doc/device-tree-bindings/clock/ti,mux.txt.
- Add to commit message the references to linux kernel dt binding documentation.
- Remove doc/device-tree-bindings/clock/ti,dpll.txt.
- Add to commit message the references to linux kernel dt binding documentation.
- Remove doc/device-tree-bindings/clock/ti,autoidle.txt.
- Remove doc/device-tree-bindings/clock/ti,divider.txt.
- Add to commit message the references to linux kernel dt binding documentation.
- Remove doc/device-tree-bindings/clock/gpio-gate-clock.txt.
- Remove doc/device-tree-bindings/clock/ti,clockdomain.txt.
- Remove doc/device-tree-bindings/clock/ti,gate.txt.
- Add to commit message the references to linux kernel dt binding documentation.
- Fix access to registers listed by device tree following resync of am33xx-clock.dtsi with Linux 5.9-rc7.
- Remove doc/device-tree-bindings/clock/ti,clkctrl.txt.
- Add to commit message the references to linux kernel dt binding documentation.
- doc/device-tree-bindings/arm/omap,prcm.txt.
- Add to commit message the references to linux kernel dt binding documentation.
- Add to commit message the references to linux kernel dt binding documentation.
- Comment dm_flags field in the global_data structure.
- Remove doc/device-tree-bindings/arm/omap,ctrl.txt.
- Remove doc/device-tree-bindings/pinctrl/pinctrl-single.txt.
- Add to commit message the references to linux kernel dt binding documentation.
- Adds PWM_TI_EHRPWM dependency on ARCH_OMAP2PLUS in Kconfig.
- Add error message in case of invalid address.
- Remove doc/device-tree-bindings/pwm/ti,ehrpwm.txt.
- Add to commit message the references to linux kernel dt binding documentation.
- Move Kconfig symbol from drivers/pwm to drivers/bus.
- Remove the domain clock reference from the pwmss nodes of the device tree in am33xx.dtsi. The resync of am33xx.dtsi with Linux 5.9-rc7 already contains such references.
- Remove domain clock enabling/disabling. Enabling the domain clock is performed by the sysc interconnect target module driver during the pwm device probing.
- Remove doc/device-tree-bindings/pwm/ti,pwmss.txt.
- Add to commit message the references to linux kernel dt binding documentation.
- Update the DTS lcdc node of the am335x boards because of the am33xx.dtsi resynced with Linux 5.9-rc7.
- Remove clock domain enabling/disabling.
- Update the commit message.
- Add clk.h header.
- Fix an error code returned by the probe function.

Changes in v2:
- Add the clk_ prefix to the divider functions.
- Add kernel-doc comments to the exported functions.
- Merged to patch [09/31] clk: ti: refactor mux and divider clock drivers.
- Remove the 'ti_am3_prcm_clocks' driver. Handle 'prcm_clocks' node in the 'ti_am3_prcm' driver.
- Update the commit message.
- Fix a missing line in the commit message.
- Add dm_flags to global_data structure and GD_DM_FLG_SIZE_CELLS_0 macro to test without recompiling.
- Update the OF_CHECK_COUNTS macro in order to have just one #define by bringing the GD_DM_FLG_SIZE_CELLS_0 into the expression.
- Lower-case the 0xC019 hex number.
- Remove the 'ti_am3_scm_clocks' driver. Handle 'scm_clocks' node in the 'ti_am3_scm' driver.
- Update the commit message.

Dario Binacchi (27):
clk: export generic routines
dt-bindings: bus: ti-sysc: resync with Linux 5.9-rc7
bus: ti: add minimal sysc interconnect target driver
arm: dts: sync am33xx with Linux 5.9-rc7
clk: add clk_round_rate()
clk: ti: add mux clock driver
arm: ti: am33xx: add DPLL_EN_FAST_RELOCK_BYPASS macro
clk: ti: am33xx: add DPLL clock drivers
clk: ti: add divider clock driver
clk: ti: add gate clock driver
ti: am33xx: fix do_enable_clocks() to accept NULL parameters
clk: ti: add support for clkctrl clocks
clk: ti: move drivers to 'ti' directory
clk: ti: omap4: add clock manager driver
clk: ti: am335x: add clock manager driver
fdt: translate address if #size-cells = <0>
omap: timer: fix the rate setting
misc: am33xx: add control module driver
pwm: ti: am33xx: add enhanced pwm driver
bus: ti: am33xx: add pwm subsystem driver
dm: core: add a function to decode display timings
video: omap: add panel driver
video: omap: drop domain clock enabling by SOC api
video: omap: set LCD clock rate through DM API
video: omap: split the legacy code from the DM code
video: omap: move drivers to 'ti' directory
board: ti: am335x-ice: get CDCE913 clock device

 arch/arm/Kconfig                           |    1 +
 arch/arm/dts/am335x-brppt1-mmc.dts         |   17 +-
 arch/arm/dts/am335x-brppt1-nand.dts        |   17 +-
 arch/arm/dts/am335x-brppt1-spi.dts         |   17 +-
 arch/arm/dts/am335x-brsmarc1.dts           |   20 +-
 arch/arm/dts/am335x-brxre1.dts             |   21 +-
 arch/arm/dts/am335x-draco.dtsi             |   11 +-
 arch/arm/dts/am335x-evm-u-boot.dtsi        |   15 +-
 arch/arm/dts/am335x-evm.dts                |    2 +-
 arch/arm/dts/am335x-evmsk-u-boot.dtsi      |   14 +-
 arch/arm/dts/am335x-evmsk.dts              |    2 +-
 arch/arm/dts/am335x-guardian-u-boot.dtsi   |   23 +-
 arch/arm/dts/am335x-pdu001-u-boot.dtsi     |   18 +-
 arch/arm/dts/am335x-pxm2.dtsi              |    2 +-
 arch/arm/dts/am335x-pxm50-u-boot.dtsi      |   14 +-
 arch/arm/dts/am335x-rut-u-boot.dtsi        |   14 +-
 arch/arm/dts/am335x-rut.dts                |    2 +-
 arch/arm/dts/am335x-shc.dts                |    2 +-
 arch/arm/dts/am33xx-clocks.dtsi            |  106 +-
 arch/arm/dts/am33xx-l4.dtsi                | 1963 ++++++++++++++++++++
 arch/arm/dts/am33xx.dtsi                   |  721 +++----
 arch/arm/dts/da850-evm-u-boot.dtsi         |   18 +-
 arch/arm/include/asm/arch-am33xx/clock.h   |    1 +
 arch/arm/mach-omap2/am33xx/clock.c         |   10 +-
 arch/arm/mach-omap2/am33xx/clock_am33xx.c  |    2 +-
 arch/sandbox/dts/test.dts                  |   67 +
 arch/sandbox/include/asm/clk.h             |    9 +
 board/ti/am335x/board.c                    |    2 +-
 board/ti/am43xx/board.c                    |    2 +-
 common/fdt_support.c                       |    6 +-
 drivers/bus/Kconfig                        |   13 +
 drivers/bus/Makefile                       |    2 +
 drivers/bus/ti-pwmss.c                     |   21 +
 drivers/bus/ti-sysc.c                      |  165 ++
 drivers/clk/Kconfig                        |    9 +-
 drivers/clk/Makefile                       |    2 +-
 drivers/clk/clk-divider.c                  |   24 +-
 drivers/clk/clk-uclass.c                   |   15 +
 drivers/clk/clk_sandbox.c                  |   17 +
 drivers/clk/clk_sandbox_test.c             |   10 +
 drivers/clk/ti/Kconfig                     |   42 +
 drivers/clk/ti/Makefile                    |   18 +
 drivers/clk/ti/am3-prcm.c                  |   65 +
 drivers/clk/ti/clk-am3-dpll-x2.c           |   78 +
 drivers/clk/ti/clk-am3-dpll.c              |  267 +++
 drivers/clk/ti/clk-ctrl.c                  |  153 ++
 drivers/clk/ti/clk-divider.c               |  380 ++++
 drivers/clk/ti/clk-gate.c                  |   92 +
 drivers/clk/ti/clk-mux.c                   |  252 +++
 drivers/clk/{clk-ti-sci.c => ti/clk-sci.c} |    0
 drivers/clk/ti/clk.c                       |   34 +
 drivers/clk/ti/clk.h                       |   13 +
 drivers/clk/ti/omap4-cm.c                  |   22 +
 drivers/core/Kconfig                       |   12 +
 drivers/core/fdtaddr.c                     |    2 +-
 drivers/core/of_addr.c                     |   14 +-
 drivers/core/ofnode.c                      |    7 +-
 drivers/core/read.c                        |    6 +
 drivers/core/root.c                        |    3 +
 drivers/misc/Kconfig                       |    7 +
 drivers/misc/Makefile                      |    1 +
 drivers/misc/ti-am3-scm.c                  |   81 +
 drivers/pwm/Kconfig                        |    7 +
 drivers/pwm/Makefile                       |    1 +
 drivers/pwm/pwm-ti-ehrpwm.c                |  467 +++++
 drivers/timer/omap-timer.c                 |    6 +-
 drivers/video/Kconfig                      |    5 +-
 drivers/video/Makefile                     |    2 +-
 drivers/video/ti/Kconfig                   |    8 +
 drivers/video/ti/Makefile                  |   10 +
 drivers/video/{ => ti}/am335x-fb.c         |  342 +---
 drivers/video/{ => ti}/am335x-fb.h         |    4 -
 drivers/video/ti/tilcdc-panel.c            |  171 ++
 drivers/video/ti/tilcdc-panel.h            |   14 +
 drivers/video/ti/tilcdc.c                  |  424 +++++
 drivers/video/ti/tilcdc.h                  |   38 +
 include/asm-generic/global_data.h          |    6 +
 include/clk-uclass.h                       |    8 +
 include/clk.h                              |   29 +
 include/dm/read.h                          |   24 +
 include/dt-bindings/bus/ti-sysc.h          |    6 +
 include/linux/clk-provider.h               |   57 +
 test/dm/clk.c                              |   22 +
 test/dm/test-fdt.c                         |  148 +-
 84 files changed, 5776 insertions(+), 969 deletions(-)
 create mode 100644 arch/arm/dts/am33xx-l4.dtsi
 create mode 100644 drivers/bus/ti-pwmss.c
 create mode 100644 drivers/bus/ti-sysc.c
 create mode 100644 drivers/clk/ti/Kconfig
 create mode 100644 drivers/clk/ti/Makefile
 create mode 100644 drivers/clk/ti/am3-prcm.c
 create mode 100644 drivers/clk/ti/clk-am3-dpll-x2.c
 create mode 100644 drivers/clk/ti/clk-am3-dpll.c
 create mode 100644 drivers/clk/ti/clk-ctrl.c
 create mode 100644 drivers/clk/ti/clk-divider.c
 create mode 100644 drivers/clk/ti/clk-gate.c
 create mode 100644 drivers/clk/ti/clk-mux.c
 rename drivers/clk/{clk-ti-sci.c => ti/clk-sci.c} (100%)
 create mode 100644 drivers/clk/ti/clk.c
 create mode 100644 drivers/clk/ti/clk.h
 create mode 100644 drivers/clk/ti/omap4-cm.c
 create mode 100644 drivers/misc/ti-am3-scm.c
 create mode 100644 drivers/pwm/pwm-ti-ehrpwm.c
 create mode 100644 drivers/video/ti/Kconfig
 create mode 100644 drivers/video/ti/Makefile
 rename drivers/video/{ => ti}/am335x-fb.c (54%)
 rename drivers/video/{ => ti}/am335x-fb.h (97%)
 create mode 100644 drivers/video/ti/tilcdc-panel.c
 create mode 100644 drivers/video/ti/tilcdc-panel.h
 create mode 100644 drivers/video/ti/tilcdc.c
 create mode 100644 drivers/video/ti/tilcdc.h
Signature · 1 line
2.17.1
#1 lore raw

PATCH v3 1/27 clk: export generic routines

Export routines that can be used by other drivers avoiding duplicating code.

---

(no changes since v2)

Changes in v2:
- Add the clk_ prefix to the divider functions.
- Add kernel-doc comments to the exported functions.

 drivers/clk/clk-divider.c    | 24 +++++++--------
 include/linux/clk-provider.h | 57 ++++++++++++++++++++++++++++++++++++
 2 files changed, 69 insertions(+), 12 deletions(-)
drivers/clk/clk-divider.c +12 -12
index 8f59d7fb72..9df50a5e72 100644
@@ -28,8 +28,8 @@
 
 #define UBOOT_DM_CLK_CCF_DIVIDER "ccf_clk_divider"
 
-static unsigned int _get_table_div(const struct clk_div_table *table,
-				   unsigned int val)
+unsigned int clk_divider_get_table_div(const struct clk_div_table *table,
+				       unsigned int val)
 {
 	const struct clk_div_table *clkt;
 
@@ -49,7 +49,7 @@ static unsigned int _get_div(const struct clk_div_table *table,
 	if (flags & CLK_DIVIDER_MAX_AT_ZERO)
 		return val ? val : clk_div_mask(width) + 1;
 	if (table)
-		return _get_table_div(table, val);
+		return clk_divider_get_table_div(table, val);
 	return val + 1;
 }
 
@@ -89,8 +89,8 @@ static ulong clk_divider_recalc_rate(struct clk *clk)
 				   divider->flags, divider->width);
 }
 
-static bool _is_valid_table_div(const struct clk_div_table *table,
-				unsigned int div)
+bool clk_divider_is_valid_table_div(const struct clk_div_table *table,
+				    unsigned int div)
 {
 	const struct clk_div_table *clkt;
 
@@ -100,18 +100,18 @@ static bool _is_valid_table_div(const struct clk_div_table *table,
 	return false;
 }
 
-static bool _is_valid_div(const struct clk_div_table *table, unsigned int div,
-			  unsigned long flags)
+bool clk_divider_is_valid_div(const struct clk_div_table *table,
+			      unsigned int div, unsigned long flags)
 {
 	if (flags & CLK_DIVIDER_POWER_OF_TWO)
 		return is_power_of_2(div);
 	if (table)
-		return _is_valid_table_div(table, div);
+		return clk_divider_is_valid_table_div(table, div);
 	return true;
 }
 
-static unsigned int _get_table_val(const struct clk_div_table *table,
-				   unsigned int div)
+unsigned int clk_divider_get_table_val(const struct clk_div_table *table,
+				       unsigned int div)
 {
 	const struct clk_div_table *clkt;
 
@@ -131,7 +131,7 @@ static unsigned int _get_val(const struct clk_div_table *table,
 	if (flags & CLK_DIVIDER_MAX_AT_ZERO)
 		return (div == clk_div_mask(width) + 1) ? 0 : div;
 	if (table)
-		return  _get_table_val(table, div);
+		return clk_divider_get_table_val(table, div);
 	return div - 1;
 }
 int divider_get_val(unsigned long rate, unsigned long parent_rate,
@@ -142,7 +142,7 @@ int divider_get_val(unsigned long rate, unsigned long parent_rate,
 
 	div = DIV_ROUND_UP_ULL((u64)parent_rate, rate);
 
-	if (!_is_valid_div(table, div, flags))
+	if (!clk_divider_is_valid_div(table, div, flags))
 		return -EINVAL;
 
 	value = _get_val(table, div, flags, width);
include/linux/clk-provider.h +57 -0

69 lines not on this page · raw message

Signature · 1 line
2.17.1
#2 lore raw

PATCH v3 2/27 dt-bindings: bus: ti-sysc: resync with Linux 5.9-rc7

In reply to Dario Binacchi

Add support for PRUSS SYSC type:
The PRUSS module has a SYSCFG which is unique. The SYSCFG has two additional unique fields called STANDBY_INIT and SUB_MWAIT in addition to regular IDLE_MODE and STANDBY_MODE fields. Add the bindings for this new sysc type.

Add support for MCAN on dra76x:
The dra76x MCAN generic interconnect module has a its own format for the bits in the control registers.

---

(no changes since v1)

 include/dt-bindings/bus/ti-sysc.h | 6 ++++++
 1 file changed, 6 insertions(+)
include/dt-bindings/bus/ti-sysc.h +6 -0
index 2c005376ac..eae4274543 100644
@@ -15,6 +15,12 @@
 /* SmartReflex sysc found on 36xx and later */
 #define SYSC_OMAP3_SR_ENAWAKEUP		(1 << 26)
 
+#define SYSC_DRA7_MCAN_ENAWAKEUP	(1 << 4)
+
+/* PRUSS sysc found on AM33xx/AM43xx/AM57xx */
+#define SYSC_PRUSS_SUB_MWAIT		(1 << 5)
+#define SYSC_PRUSS_STANDBY_INIT		(1 << 4)
+
 /* SYSCONFIG STANDBYMODE/MIDLEMODE/SIDLEMODE supported by hardware */
 #define SYSC_IDLE_FORCE			0
 #define SYSC_IDLE_NO			1
Signature · 1 line
2.17.1
#3 lore raw

PATCH v3 3/27 bus: ti: add minimal sysc interconnect target driver

In reply to Dario Binacchi

We can handle the sysc interconnect target module in a generic way for many TI SoCs. Initially let's just enable domain clocks before the children are probed.

The code is loosely based on the drivers/bus/ti-sysc.c of the Linux kernel version 5.9-rc7.
For DT binding details see:
- Documentation/devicetree/bindings/bus/ti-sysc.txt

---

(no changes since v1)

 arch/arm/Kconfig      |   1 +
 drivers/bus/Kconfig   |   7 ++
 drivers/bus/Makefile  |   1 +
 drivers/bus/ti-sysc.c | 165 ++++++++++++++++++++++++++++++++++++++++++
 4 files changed, 174 insertions(+)
 create mode 100644 drivers/bus/ti-sysc.c
arch/arm/Kconfig +1 -0
index a067a07676..1da101e636 100644
@@ -799,6 +799,7 @@ config ARCH_OMAP2PLUS
 	select SPL_BOARD_INIT if SPL
 	select SPL_STACK_R if SPL
 	select SUPPORT_SPL
+	select TI_SYSC
 	imply FIT
 
 config ARCH_MESON
drivers/bus/Kconfig +7 -0
index 07a33c6287..733bec5a56 100644
@@ -5,6 +5,13 @@
 
 menu "Bus devices"
 
+config TI_SYSC
+	bool "TI sysc interconnect target module driver"
+	depends on ARCH_OMAP2PLUS
+	help
+	  Generic driver for Texas Instruments interconnect target module
+	  found on many TI SoCs.
+
 config UNIPHIER_SYSTEM_BUS
 	bool "UniPhier System Bus driver"
 	depends on ARCH_UNIPHIER
drivers/bus/Makefile +1 -0
index 0b97fc1f8b..875bb4ed42 100644
@@ -3,4 +3,5 @@
 # Makefile for the bus drivers.
 #
 
+obj-$(CONFIG_TI_SYSC)	+= ti-sysc.o
 obj-$(CONFIG_UNIPHIER_SYSTEM_BUS) += uniphier-system-bus.o
drivers/bus/ti-sysc.c new file +165 -0

165 lines not on this page · raw message

Signature · 1 line
2.17.1
#4 lore raw

PATCH v3 4/27 arm: dts: sync am33xx with Linux 5.9-rc7

In reply to Dario Binacchi

There have been several changes to the am33xx.dtsi, so this patch re-syncs it with Linux.

Let's add proper interconnect hierarchy for l4 interconnect instances with the related ti-sysc interconnect module data as documented in Documentation/devicetree/bindings/bus/ti-sysc.txt of the Linux kernel. With l4 interconnect hierarchy and ti-sysc interconnect target module data in place, we can simply move all the related child devices to their proper location and enable probing using ti-sysc.

The am33xx-clock.dtsi file is the same as that of the Linux kernel, except for the reg property of the node l4-wkup-clkctrl at 0. As for the am33xx.dtsi file, all the devices with drivers not yet implemented and those I was able to test with this patch have been moved to am33xx-l4.dtsi. In case of any regressions, problem devices can be reverted by moving them back and removing the related interconnect target module node.

---

(no changes since v1)

 arch/arm/dts/am335x-draco.dtsi           |   11 +-
 arch/arm/dts/am335x-evm.dts              |    2 +-
 arch/arm/dts/am335x-evmsk.dts            |    2 +-
 arch/arm/dts/am335x-guardian-u-boot.dtsi |    5 -
 arch/arm/dts/am335x-pxm2.dtsi            |    2 +-
 arch/arm/dts/am335x-rut.dts              |    2 +-
 arch/arm/dts/am335x-shc.dts              |    2 +-
 arch/arm/dts/am33xx-clocks.dtsi          |  106 +-
 arch/arm/dts/am33xx-l4.dtsi              | 1963 ++++++++++++++++++++++
 arch/arm/dts/am33xx.dtsi                 |  721 +++-----
 10 files changed, 2274 insertions(+), 542 deletions(-)
 create mode 100644 arch/arm/dts/am33xx-l4.dtsi
arch/arm/dts/am335x-draco.dtsi +6 -5
index b38ff55e1d..2c125fcec9 100644
@@ -20,11 +20,6 @@
 	};
 
 	ocp {
-		uart0: serial at 44e09000 {
-			pinctrl-names = "default";
-			pinctrl-0 = <&uart0_pins>;
-			status = "okay";
-		};
 
 		i2c0: i2c at 44e0b000 {
 			pinctrl-names = "default";
@@ -112,6 +107,12 @@
 	status = "disabled";
 };
 
+&uart0 {
+	pinctrl-names = "default";
+	pinctrl-0 = <&uart0_pins>;
+	status = "okay";
+};
+
 &uart4 {
 	status = "disabled";
 };
arch/arm/dts/am335x-evm.dts +1 -1
index 0bda4d4429..07288fb188 100644
@@ -486,7 +486,7 @@
 &epwmss0 {
 	status = "okay";
 
-	ecap0: ecap at 48300100 {
+	ecap0: ecap at 100 {
 		status = "okay";
 		pinctrl-names = "default";
 		pinctrl-0 = <&ecap0_pins>;
arch/arm/dts/am335x-evmsk.dts +1 -1
index 5762967cf7..c94c33b595 100644
@@ -531,7 +531,7 @@
 &epwmss2 {
 	status = "okay";
 
-	ecap2: ecap at 48304100 {
+	ecap2: ecap at 100 {
 		status = "okay";
 		pinctrl-names = "default";
 		pinctrl-0 = <&ecap2_pins>;
arch/arm/dts/am335x-guardian-u-boot.dtsi +0 -5
index 705ef335bf..eae027c541 100644
@@ -26,11 +26,6 @@
 	u-boot,dm-pre-reloc;
 };
 
-&rtc {
-	clocks = <&l4_per_clkctrl AM3_CLKDIV32K_CLKCTRL 0>;
-	clock-names = "int-clk";
-};
-
 &scm {
 	u-boot,dm-pre-reloc;
 };
arch/arm/dts/am335x-pxm2.dtsi +1 -1
index 19bd7e2420..645d221507 100644
@@ -148,7 +148,7 @@
 &epwmss0 {
 	status = "okay";
 
-	ecap0: ecap at 48300100 {
+	ecap0: ecap at 100 {
 		status = "okay";
 		pinctrl-names = "default";
 		pinctrl-0 = <&ecap0_pins>;
arch/arm/dts/am335x-rut.dts +1 -1
index 145247344f..cc06f5d23a 100644
@@ -174,7 +174,7 @@
 &epwmss0 {
 	status = "okay";
 
-	ecap0: ecap at 48300100 {
+	ecap0: ecap at 100 {
 		status = "okay";
 		pinctrl-names = "default";
 		pinctrl-0 = <&ecap0_pins>;
arch/arm/dts/am335x-shc.dts +1 -1
index 8e35c439e5..a41a0606b1 100644
@@ -136,7 +136,7 @@
 &epwmss1 {
 	status = "okay";
 
-	ehrpwm1: pwm at 48302200 {
+	ehrpwm1: pwm at 200 {
 		pinctrl-names = "default";
 		pinctrl-0 = <&ehrpwm1_pins>;
 		status = "okay";
arch/arm/dts/am33xx-clocks.dtsi +80 -26

220 lines not on this page · raw message

arch/arm/dts/am33xx-l4.dtsi new file +1963 -0

1,963 lines not on this page · raw message

arch/arm/dts/am33xx.dtsi +220 -501

743 lines not on this page · raw message

The rest of this diff is not shown. View the raw message.

Signature · 1 line
2.17.1

Part of the diff is not shown here. View the raw message.

#5 lore raw

PATCH v3 5/27 clk: add clk_round_rate()

In reply to Dario Binacchi

It returns the rate which will be set if you ask clk_set_rate() to set that rate. It provides a way to query exactly what rate you'll get if you call clk_set_rate() with that same argument.
So essentially, clk_round_rate() and clk_set_rate() are equivalent except the former does not modify the clock hardware in any way.

---

(no changes since v1)

 arch/sandbox/include/asm/clk.h |  9 +++++++++
 drivers/clk/clk-uclass.c       | 15 +++++++++++++++
 drivers/clk/clk_sandbox.c      | 17 +++++++++++++++++
 drivers/clk/clk_sandbox_test.c | 10 ++++++++++
 include/clk-uclass.h           |  8 ++++++++
 include/clk.h                  | 29 +++++++++++++++++++++++++++++
 test/dm/clk.c                  | 22 ++++++++++++++++++++++
 7 files changed, 110 insertions(+)
arch/sandbox/include/asm/clk.h +9 -0
index c184c4bffc..0294baee27 100644
@@ -105,6 +105,15 @@ int sandbox_clk_test_get_bulk(struct udevice *dev);
  * @return:	The rate of the clock.
  */
 ulong sandbox_clk_test_get_rate(struct udevice *dev, int id);
+/**
+ * sandbox_clk_test_round_rate - Ask the sandbox clock test device to round a
+ * clock's rate.
+ *
+ * @dev:	The sandbox clock test (client) device.
+ * @id:		The test device's clock ID to configure.
+ * @return:	The rounded rate of the clock.
+ */
+ulong sandbox_clk_test_round_rate(struct udevice *dev, int id, ulong rate);
 /**
  * sandbox_clk_test_set_rate - Ask the sandbox clock test device to set a
  * clock's rate.
drivers/clk/clk-uclass.c +15 -0
index 31c5997aea..c16a8b120c 100644
@@ -524,6 +524,21 @@ long long clk_get_parent_rate(struct clk *clk)
 	return pclk->rate;
 }
 
+ulong clk_round_rate(struct clk *clk, ulong rate)
+{
+	const struct clk_ops *ops;
+
+	debug("%s(clk=%p, rate=%lu)\n", __func__, clk, rate);
+	if (!clk_valid(clk))
+		return 0;
+
+	ops = clk_dev_ops(clk->dev);
+	if (!ops->round_rate)
+		return -ENOSYS;
+
+	return ops->round_rate(clk, rate);
+}
+
 ulong clk_set_rate(struct clk *clk, ulong rate)
 {
 	const struct clk_ops *ops;
drivers/clk/clk_sandbox.c +17 -0
index 768fbb7c52..8361b930df 100644
@@ -30,6 +30,22 @@ static ulong sandbox_clk_get_rate(struct clk *clk)
 	return priv->rate[clk->id];
 }
 
+static ulong sandbox_clk_round_rate(struct clk *clk, ulong rate)
+{
+	struct sandbox_clk_priv *priv = dev_get_priv(clk->dev);
+
+	if (!priv->probed)
+		return -ENODEV;
+
+	if (clk->id >= SANDBOX_CLK_ID_COUNT)
+		return -EINVAL;
+
+	if (!rate)
+		return -EINVAL;
+
+	return rate;
+}
+
 static ulong sandbox_clk_set_rate(struct clk *clk, ulong rate)
 {
 	struct sandbox_clk_priv *priv = dev_get_priv(clk->dev);
@@ -103,6 +119,7 @@ static int sandbox_clk_free(struct clk *clk)
 }
 
 static struct clk_ops sandbox_clk_ops = {
+	.round_rate	= sandbox_clk_round_rate,
 	.get_rate	= sandbox_clk_get_rate,
 	.set_rate	= sandbox_clk_set_rate,
 	.enable		= sandbox_clk_enable,
drivers/clk/clk_sandbox_test.c +10 -0
index 873383856f..f7b77aa674 100644
@@ -86,6 +86,16 @@ ulong sandbox_clk_test_get_rate(struct udevice *dev, int id)
 	return clk_get_rate(sbct->clkps[id]);
 }
 
+ulong sandbox_clk_test_round_rate(struct udevice *dev, int id, ulong rate)
+{
+	struct sandbox_clk_test *sbct = dev_get_priv(dev);
+
+	if (id < 0 || id >= SANDBOX_CLK_TEST_ID_COUNT)
+		return -EINVAL;
+
+	return clk_round_rate(sbct->clkps[id], rate);
+}
+
 ulong sandbox_clk_test_set_rate(struct udevice *dev, int id, ulong rate)
 {
 	struct sandbox_clk_test *sbct = dev_get_priv(dev);
include/clk-uclass.h +8 -0
index dac42dab36..50e8681b55 100644
@@ -61,6 +61,14 @@ struct clk_ops {
 	 * @return 0 if OK, or a negative error code.
 	 */
 	int (*rfree)(struct clk *clock);
+	/**
+	 * round_rate() - Adjust a rate to the exact rate a clock can provide.
+	 *
+	 * @clk:	The clock to manipulate.
+	 * @rate:	Desidered clock rate in Hz.
+	 * @return rounded rate in Hz, or -ve error code.
+	 */
+	ulong (*round_rate)(struct clk *clk, ulong rate);
 	/**
 	 * get_rate() - Get current clock rate.
 	 *
include/clk.h +29 -0
index a62e2efa2c..cce763b05b 100644
@@ -366,6 +366,30 @@ struct clk *clk_get_parent(struct clk *clk);
  */
 long long clk_get_parent_rate(struct clk *clk);
 
+/**
+ * clk_round_rate() - Adjust a rate to the exact rate a clock can provide
+ *
+ * This answers the question "if I were to pass @rate to clk_set_rate(),
+ * what clock rate would I end up with?" without changing the hardware
+ * in any way.  In other words:
+ *
+ *   rate = clk_round_rate(clk, r);
+ *
+ * and:
+ *
+ *   clk_set_rate(clk, r);
+ *   rate = clk_get_rate(clk);
+ *
+ * are equivalent except the former does not modify the clock hardware
+ * in any way.
+ *
+ * @clk: A clock struct that was previously successfully requested by
+ *       clk_request/get_by_*().
+ * @rate: desired clock rate in Hz.
+ * @return rounded rate in Hz, or -ve error code.
+ */
+ulong clk_round_rate(struct clk *clk, ulong rate);
+
 /**
  * clk_set_rate() - Set current clock rate.
  *
@@ -482,6 +506,11 @@ static inline long long clk_get_parent_rate(struct clk *clk)
 	return -ENOSYS;
 }
 
+static inline ulong clk_round_rate(struct clk *clk, ulong rate)
+{
+	return -ENOSYS;
+}
+
 static inline ulong clk_set_rate(struct clk *clk, ulong rate)
 {
 	return -ENOSYS;
test/dm/clk.c +22 -0
index edca3b49f6..21997ed892 100644
@@ -112,6 +112,28 @@ static int dm_test_clk(struct unit_test_state *uts)
 	rate = sandbox_clk_test_set_rate(dev_test, SANDBOX_CLK_TEST_ID_I2C, 0);
 	ut_assert(IS_ERR_VALUE(rate));
 
+	ut_asserteq(10000, sandbox_clk_test_get_rate(dev_test,
+						     SANDBOX_CLK_TEST_ID_SPI));
+	ut_asserteq(20000, sandbox_clk_test_get_rate(dev_test,
+						     SANDBOX_CLK_TEST_ID_I2C));
+
+	ut_asserteq(5000, sandbox_clk_test_round_rate(dev_test,
+						      SANDBOX_CLK_TEST_ID_SPI,
+						      5000));
+	ut_asserteq(7000, sandbox_clk_test_round_rate(dev_test,
+						      SANDBOX_CLK_TEST_ID_I2C,
+						      7000));
+
+	ut_asserteq(10000, sandbox_clk_test_get_rate(dev_test,
+						     SANDBOX_CLK_TEST_ID_SPI));
+	ut_asserteq(20000, sandbox_clk_test_get_rate(dev_test,
+						     SANDBOX_CLK_TEST_ID_I2C));
+
+	rate = sandbox_clk_test_round_rate(dev_test, SANDBOX_CLK_TEST_ID_SPI, 0);
+	ut_assert(IS_ERR_VALUE(rate));
+	rate = sandbox_clk_test_round_rate(dev_test, SANDBOX_CLK_TEST_ID_I2C, 0);
+	ut_assert(IS_ERR_VALUE(rate));
+
 	ut_asserteq(10000, sandbox_clk_test_get_rate(dev_test,
 						     SANDBOX_CLK_TEST_ID_SPI));
 	ut_asserteq(20000, sandbox_clk_test_get_rate(dev_test,
Signature · 1 line
2.17.1
#6 lore raw

PATCH v3 5/27 clk: add clk_round_rate()

Quoted 154 lines · Dario Binacchi

It returns the rate which will be set if you ask clk_set_rate() to set that rate. It provides a way to query exactly what rate you'll get if you call clk_set_rate() with that same argument.
So essentially, clk_round_rate() and clk_set_rate() are equivalent except the former does not modify the clock hardware in any way.

---

(no changes since v1)

 arch/sandbox/include/asm/clk.h |  9 +++++++++
 drivers/clk/clk-uclass.c       | 15 +++++++++++++++
 drivers/clk/clk_sandbox.c      | 17 +++++++++++++++++
 drivers/clk/clk_sandbox_test.c | 10 ++++++++++
 include/clk-uclass.h           |  8 ++++++++
 include/clk.h                  | 29 +++++++++++++++++++++++++++++
 test/dm/clk.c                  | 22 ++++++++++++++++++++++
 7 files changed, 110 insertions(+)
arch/sandbox/include/asm/clk.h +9 -0
index c184c4bffc..0294baee27 100644
@@ -105,6 +105,15 @@ int sandbox_clk_test_get_bulk(struct udevice *dev);
  * @return:	The rate of the clock.
  */
 ulong sandbox_clk_test_get_rate(struct udevice *dev, int id);
+/**
+ * sandbox_clk_test_round_rate - Ask the sandbox clock test device to round a
+ * clock's rate.
+ *
+ * @dev:	The sandbox clock test (client) device.
+ * @id:		The test device's clock ID to configure.
+ * @return:	The rounded rate of the clock.
+ */
+ulong sandbox_clk_test_round_rate(struct udevice *dev, int id, ulong rate);
 /**
  * sandbox_clk_test_set_rate - Ask the sandbox clock test device to set a
  * clock's rate.
drivers/clk/clk-uclass.c +15 -0
index 31c5997aea..c16a8b120c 100644
@@ -524,6 +524,21 @@ long long clk_get_parent_rate(struct clk *clk)
 	return pclk->rate;
 }
 
+ulong clk_round_rate(struct clk *clk, ulong rate)
+{
+	const struct clk_ops *ops;
+
+	debug("%s(clk=%p, rate=%lu)\n", __func__, clk, rate);
+	if (!clk_valid(clk))
+		return 0;
+
+	ops = clk_dev_ops(clk->dev);
+	if (!ops->round_rate)
+		return -ENOSYS;
+
+	return ops->round_rate(clk, rate);
+}
+
 ulong clk_set_rate(struct clk *clk, ulong rate)
 {
 	const struct clk_ops *ops;
drivers/clk/clk_sandbox.c +17 -0
index 768fbb7c52..8361b930df 100644
@@ -30,6 +30,22 @@ static ulong sandbox_clk_get_rate(struct clk *clk)
 	return priv->rate[clk->id];
 }
 
+static ulong sandbox_clk_round_rate(struct clk *clk, ulong rate)
+{
+	struct sandbox_clk_priv *priv = dev_get_priv(clk->dev);
+
+	if (!priv->probed)
+		return -ENODEV;
+
+	if (clk->id >= SANDBOX_CLK_ID_COUNT)
+		return -EINVAL;
+
+	if (!rate)
+		return -EINVAL;
+
+	return rate;
+}
+
 static ulong sandbox_clk_set_rate(struct clk *clk, ulong rate)
 {
 	struct sandbox_clk_priv *priv = dev_get_priv(clk->dev);
@@ -103,6 +119,7 @@ static int sandbox_clk_free(struct clk *clk)
 }
 
 static struct clk_ops sandbox_clk_ops = {
+	.round_rate	= sandbox_clk_round_rate,
 	.get_rate	= sandbox_clk_get_rate,
 	.set_rate	= sandbox_clk_set_rate,
 	.enable		= sandbox_clk_enable,
drivers/clk/clk_sandbox_test.c +10 -0
index 873383856f..f7b77aa674 100644
@@ -86,6 +86,16 @@ ulong sandbox_clk_test_get_rate(struct udevice *dev, int id)
 	return clk_get_rate(sbct->clkps[id]);
 }
 
+ulong sandbox_clk_test_round_rate(struct udevice *dev, int id, ulong rate)
+{
+	struct sandbox_clk_test *sbct = dev_get_priv(dev);
+
+	if (id < 0 || id >= SANDBOX_CLK_TEST_ID_COUNT)
+		return -EINVAL;
+
+	return clk_round_rate(sbct->clkps[id], rate);
+}
+
 ulong sandbox_clk_test_set_rate(struct udevice *dev, int id, ulong rate)
 {
 	struct sandbox_clk_test *sbct = dev_get_priv(dev);
include/clk-uclass.h +8 -0
index dac42dab36..50e8681b55 100644
@@ -61,6 +61,14 @@ struct clk_ops {
 	 * @return 0 if OK, or a negative error code.
 	 */
 	int (*rfree)(struct clk *clock);
+	/**
+	 * round_rate() - Adjust a rate to the exact rate a clock can provide.
+	 *
+	 * @clk:	The clock to manipulate.
+	 * @rate:	Desidered clock rate in Hz.
+	 * @return rounded rate in Hz, or -ve error code.
+	 */
+	ulong (*round_rate)(struct clk *clk, ulong rate);
 	/**
 	 * get_rate() - Get current clock rate.
 	 *
include/clk.h +3 -0
index a62e2efa2c..cce763b05b 100644
@@ -366,6 +366,30 @@ struct clk *clk_get_parent(struct clk *clk);
  */
 long long clk_get_parent_rate(struct clk *clk);
 
+/**
+ * clk_round_rate() - Adjust a rate to the exact rate a clock can provide
+ *

include/clk.h struct clk *clk_get_parent(struct clk *clk); · line 381

Quoted 10 lines
include/clk.h +10 -0
+ * This answers the question "if I were to pass @rate to clk_set_rate(),
+ * what clock rate would I end up with?" without changing the hardware
+ * in any way.  In other words:
+ *
+ *   rate = clk_round_rate(clk, r);
+ *
+ * and:
+ *
+ *   clk_set_rate(clk, r);
+ *   rate = clk_get_rate(clk);

Note that clk_set_rate returns the new rate on success, so the above is equivalent to

rate = clk_set_rate(clk);

other than that,

Quoted 60 lines
include/clk.h +16 -0
+ *
+ * are equivalent except the former does not modify the clock hardware
+ * in any way.
+ *
+ * @clk: A clock struct that was previously successfully requested by
+ *       clk_request/get_by_*().
+ * @rate: desired clock rate in Hz.
+ * @return rounded rate in Hz, or -ve error code.
+ */
+ulong clk_round_rate(struct clk *clk, ulong rate);
+
 /**
  * clk_set_rate() - Set current clock rate.
  *
@@ -482,6 +506,11 @@ static inline long long clk_get_parent_rate(struct clk *clk)
 	return -ENOSYS;
 }
 
+static inline ulong clk_round_rate(struct clk *clk, ulong rate)
+{
+	return -ENOSYS;
+}
+
 static inline ulong clk_set_rate(struct clk *clk, ulong rate)
 {
 	return -ENOSYS;
test/dm/clk.c +22 -0
index edca3b49f6..21997ed892 100644
@@ -112,6 +112,28 @@ static int dm_test_clk(struct unit_test_state *uts)
 	rate = sandbox_clk_test_set_rate(dev_test, SANDBOX_CLK_TEST_ID_I2C, 0);
 	ut_assert(IS_ERR_VALUE(rate));
 
+	ut_asserteq(10000, sandbox_clk_test_get_rate(dev_test,
+						     SANDBOX_CLK_TEST_ID_SPI));
+	ut_asserteq(20000, sandbox_clk_test_get_rate(dev_test,
+						     SANDBOX_CLK_TEST_ID_I2C));
+
+	ut_asserteq(5000, sandbox_clk_test_round_rate(dev_test,
+						      SANDBOX_CLK_TEST_ID_SPI,
+						      5000));
+	ut_asserteq(7000, sandbox_clk_test_round_rate(dev_test,
+						      SANDBOX_CLK_TEST_ID_I2C,
+						      7000));
+
+	ut_asserteq(10000, sandbox_clk_test_get_rate(dev_test,
+						     SANDBOX_CLK_TEST_ID_SPI));
+	ut_asserteq(20000, sandbox_clk_test_get_rate(dev_test,
+						     SANDBOX_CLK_TEST_ID_I2C));
+
+	rate = sandbox_clk_test_round_rate(dev_test, SANDBOX_CLK_TEST_ID_SPI, 0);
+	ut_assert(IS_ERR_VALUE(rate));
+	rate = sandbox_clk_test_round_rate(dev_test, SANDBOX_CLK_TEST_ID_I2C, 0);
+	ut_assert(IS_ERR_VALUE(rate));
+
 	ut_asserteq(10000, sandbox_clk_test_get_rate(dev_test,
 						     SANDBOX_CLK_TEST_ID_SPI));
 	ut_asserteq(20000, sandbox_clk_test_get_rate(dev_test,
#7 lore raw

PATCH v3 6/27 clk: ti: add mux clock driver

In reply to Dario Binacchi

The driver manages a register-mapped multiplexer with multiple input clock signals or parents, one of which can be selected as output. It uses routines provided by the common clock framework (ccf).

The code is based on the drivers/clk/ti/mux.c driver of the Linux kernel version 5.9-rc7.
For DT binding details see:
- Documentation/devicetree/bindings/clock/ti/mux.txt

---

Changes in v3:
- Remove doc/device-tree-bindings/clock/clock-bindings.txt.
- Remove doc/device-tree-bindings/clock/ti,mux.txt.
- Add to commit message the references to linux kernel dt binding documentation.

 drivers/clk/Kconfig      |   6 +
 drivers/clk/Makefile     |   1 +
 drivers/clk/clk-ti-mux.c | 275 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 282 insertions(+)
 create mode 100644 drivers/clk/clk-ti-mux.c
drivers/clk/Kconfig +6 -0
index 4dfbad7986..85fb337150 100644
@@ -98,6 +98,12 @@ config CLK_STM32F
 	  This clock driver adds support for RCC clock management
 	  for STM32F4 and STM32F7 SoCs.
 
+config CLK_TI_MUX
+	bool "TI mux clock driver"
+	depends on CLK && OF_CONTROL && CLK_CCF
+	help
+	  This enables the mux clock driver support on TI's SoCs.
+
 config CLK_TI_SCI
 	bool "TI System Control Interface (TI SCI) clock driver"
 	depends on CLK && TI_SCI_PROTOCOL && OF_CONTROL
drivers/clk/Makefile +1 -0
index d1e295ac7c..5582e8df04 100644
@@ -47,6 +47,7 @@ obj-$(CONFIG_SANDBOX) += clk_sandbox.o
 obj-$(CONFIG_SANDBOX) += clk_sandbox_test.o
 obj-$(CONFIG_SANDBOX_CLK_CCF) += clk_sandbox_ccf.o
 obj-$(CONFIG_STM32H7) += clk_stm32h7.o
+obj-$(CONFIG_CLK_TI_MUX) += clk-ti-mux.o
 obj-$(CONFIG_CLK_TI_SCI) += clk-ti-sci.o
 obj-$(CONFIG_CLK_VERSAL) += clk_versal.o
 obj-$(CONFIG_CLK_CDCE9XX) += clk-cdce9xx.o
drivers/clk/clk-ti-mux.c new file +275 -0

275 lines not on this page · raw message

Signature · 1 line
2.17.1
#8 lore raw

PATCH v3 7/27 arm: ti: am33xx: add DPLL_EN_FAST_RELOCK_BYPASS macro

In reply to Dario Binacchi

Add missing DPLL_EN_FAST_RELOCK_BYPASS macro. Used to put the DPLL in idle bypass fast relock mode.

---

(no changes since v1)

 arch/arm/include/asm/arch-am33xx/clock.h | 1 +
 1 file changed, 1 insertion(+)
arch/arm/include/asm/arch-am33xx/clock.h +1 -0
index dc7a9b188d..5d775902bb 100644
@@ -66,6 +66,7 @@
 #define DPLL_EN_STOP			1
 #define DPLL_EN_MN_BYPASS		4
 #define DPLL_EN_LOW_POWER_BYPASS	5
+#define DPLL_EN_FAST_RELOCK_BYPASS	6
 #define DPLL_EN_LOCK			7
 
 /* CM_IDLEST_DPLL fields */
Signature · 1 line
2.17.1
#9 lore raw

PATCH v3 8/27 clk: ti: am33xx: add DPLL clock drivers

In reply to Dario Binacchi

The digital phase-locked loop (DPLL) provides all interface clocks and functional clocks to the processor of the AM33xx device. The AM33xx device integrates five different DPLLs:
* Core DPLL
* Per DPLL
* LCD DPLL
* DDR DPLL
* MPU DPLL

The patch adds support for the compatible strings:
* "ti,am3-dpll-core-clock"
* "ti,am3-dpll-no-gate-clock"
* "ti,am3-dpll-no-gate-j-type-clock"
* "ti,am3-dpll-x2-clock"

The code is loosely based on the drivers/clk/ti/dpll.c drivers of the Linux kernel version 5.9-rc7.
For DT binding details see:
- Documentation/devicetree/bindings/clock/ti/dpll.txt

---

Changes in v3:
- Remove doc/device-tree-bindings/clock/ti,dpll.txt.
- Add to commit message the references to linux kernel dt binding documentation.

 drivers/clk/Kconfig              |   7 +
 drivers/clk/Makefile             |   1 +
 drivers/clk/clk-ti-am3-dpll-x2.c |  78 +++++++++
 drivers/clk/clk-ti-am3-dpll.c    | 267 +++++++++++++++++++++++++++++++
 4 files changed, 353 insertions(+)
 create mode 100644 drivers/clk/clk-ti-am3-dpll-x2.c
 create mode 100644 drivers/clk/clk-ti-am3-dpll.c
drivers/clk/Kconfig +7 -0
index 85fb337150..301ecac652 100644
@@ -98,6 +98,13 @@ config CLK_STM32F
 	  This clock driver adds support for RCC clock management
 	  for STM32F4 and STM32F7 SoCs.
 
+config CLK_TI_AM3_DPLL
+	bool "TI AM33XX Digital Phase-Locked Loop (DPLL) clock drivers"
+	depends on CLK && OF_CONTROL
+	help
+	  This enables the DPLL clock drivers support on AM33XX SoCs. The DPLL
+	  provides all interface clocks and functional clocks to the processor.
+
 config CLK_TI_MUX
 	bool "TI mux clock driver"
 	depends on CLK && OF_CONTROL && CLK_CCF
drivers/clk/Makefile +1 -0
index 5582e8df04..f1eaae03c5 100644
@@ -47,6 +47,7 @@ obj-$(CONFIG_SANDBOX) += clk_sandbox.o
 obj-$(CONFIG_SANDBOX) += clk_sandbox_test.o
 obj-$(CONFIG_SANDBOX_CLK_CCF) += clk_sandbox_ccf.o
 obj-$(CONFIG_STM32H7) += clk_stm32h7.o
+obj-$(CONFIG_CLK_TI_AM3_DPLL) += clk-ti-am3-dpll.o clk-ti-am3-dpll-x2.o
 obj-$(CONFIG_CLK_TI_MUX) += clk-ti-mux.o
 obj-$(CONFIG_CLK_TI_SCI) += clk-ti-sci.o
 obj-$(CONFIG_CLK_VERSAL) += clk_versal.o
drivers/clk/clk-ti-am3-dpll-x2.c new file +78 -0

78 lines not on this page · raw message

drivers/clk/clk-ti-am3-dpll.c new file +267 -0

267 lines not on this page · raw message

Signature · 1 line
2.17.1
#10 lore raw

PATCH v3 9/27 clk: ti: add divider clock driver

In reply to Dario Binacchi

The patch adds support for TI divider clock binding. The driver uses routines provided by the common clock framework (ccf).

The code is based on the drivers/clk/ti/divider.c driver of the Linux kernel version 5.9-rc7.
For DT binding details see:
- Documentation/devicetree/bindings/clock/ti/divider.txt

---

Changes in v3:
- Remove doc/device-tree-bindings/clock/ti,autoidle.txt.
- Remove doc/device-tree-bindings/clock/ti,divider.txt.
- Add to commit message the references to linux kernel dt binding documentation.

Changes in v2:
- Merged to patch [09/31] clk: ti: refactor mux and divider clock drivers.

 drivers/clk/Kconfig          |   6 +
 drivers/clk/Makefile         |   2 +
 drivers/clk/clk-ti-divider.c | 380 +++++++++++++++++++++++++++++++++++
 drivers/clk/clk-ti-mux.c     |  27 +--
 drivers/clk/clk-ti.c         |  34 ++++
 drivers/clk/clk-ti.h         |  13 ++
 6 files changed, 437 insertions(+), 25 deletions(-)
 create mode 100644 drivers/clk/clk-ti-divider.c
 create mode 100644 drivers/clk/clk-ti.c
 create mode 100644 drivers/clk/clk-ti.h
drivers/clk/Kconfig +6 -0
index 301ecac652..bc6bb57904 100644
@@ -105,6 +105,12 @@ config CLK_TI_AM3_DPLL
 	  This enables the DPLL clock drivers support on AM33XX SoCs. The DPLL
 	  provides all interface clocks and functional clocks to the processor.
 
+config CLK_TI_DIVIDER
+	bool "TI divider clock driver"
+	depends on CLK && OF_CONTROL && CLK_CCF
+	help
+	  This enables the divider clock driver support on TI's SoCs.
+
 config CLK_TI_MUX
 	bool "TI mux clock driver"
 	depends on CLK && OF_CONTROL && CLK_CCF
drivers/clk/Makefile +2 -0
index f1eaae03c5..ee218aff08 100644
@@ -18,6 +18,7 @@ obj-$(CONFIG_ARCH_ASPEED) += aspeed/
 obj-$(CONFIG_ARCH_MEDIATEK) += mediatek/
 obj-$(CONFIG_ARCH_MTMIPS) += mtmips/
 obj-$(CONFIG_ARCH_MESON) += meson/
+obj-$(CONFIG_ARCH_OMAP2PLUS) += clk-ti.o
 obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip/
 obj-$(CONFIG_ARCH_SOCFPGA) += altera/
 obj-$(CONFIG_CLK_AT91) += at91/
@@ -48,6 +49,7 @@ obj-$(CONFIG_SANDBOX) += clk_sandbox_test.o
 obj-$(CONFIG_SANDBOX_CLK_CCF) += clk_sandbox_ccf.o
 obj-$(CONFIG_STM32H7) += clk_stm32h7.o
 obj-$(CONFIG_CLK_TI_AM3_DPLL) += clk-ti-am3-dpll.o clk-ti-am3-dpll-x2.o
+obj-$(CONFIG_CLK_TI_DIVIDER) += clk-ti-divider.o
 obj-$(CONFIG_CLK_TI_MUX) += clk-ti-mux.o
 obj-$(CONFIG_CLK_TI_SCI) += clk-ti-sci.o
 obj-$(CONFIG_CLK_VERSAL) += clk_versal.o
drivers/clk/clk-ti-divider.c new file +380 -0

380 lines not on this page · raw message

drivers/clk/clk-ti-mux.c +2 -25
index 7e39dd3477..e4b190bbcc 100644
@@ -12,6 +12,7 @@
 #include <clk-uclass.h>
 #include <asm/io.h>
 #include <linux/clk-provider.h>
+#include "clk-ti.h"
 
 struct clk_ti_mux_priv {
 	struct clk_bulk parents;
@@ -23,30 +24,6 @@ struct clk_ti_mux_priv {
 	s32 latch;
 };
 
-static void clk_ti_mux_rmw(u32 val, u32 mask, fdt_addr_t reg)
-{
-	u32 v;
-
-	v = readl(reg);
-	v &= ~mask;
-	v |= val;
-	writel(v, reg);
-}
-
-static void clk_ti_mux_latch(fdt_addr_t reg, s8 shift)
-{
-	u32 latch;
-
-	if (shift < 0)
-		return;
-
-	latch = 1 << shift;
-
-	clk_ti_mux_rmw(latch, latch, reg);
-	clk_ti_mux_rmw(0, latch, reg);
-	readl(reg);		/* OCP barrier */
-}
-
 static struct clk *clk_ti_mux_get_parent_by_index(struct clk_bulk *parents,
 						  int index)
 {
@@ -119,7 +96,7 @@ static int clk_ti_mux_set_parent(struct clk *clk, struct clk *parent)
 
 	val |= index << priv->shift;
 	writel(val, priv->reg);
-	clk_ti_mux_latch(priv->reg, priv->latch);
+	clk_ti_latch(priv->reg, priv->latch);
 	return 0;
 }
 
drivers/clk/clk-ti.c new file +34 -0
new file mode 100644
index 0000000000..594ef75270
@@ -0,0 +1,34 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * TI clock utilities
+ *
+ * Copyright (C) 2020 Dario Binacchi <[email protected]>
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include "clk-ti.h"
+
+static void clk_ti_rmw(u32 val, u32 mask, fdt_addr_t reg)
+{
+	u32 v;
+
+	v = readl(reg);
+	v &= ~mask;
+	v |= val;
+	writel(v, reg);
+}
+
+void clk_ti_latch(fdt_addr_t reg, s8 shift)
+{
+	u32 latch;
+
+	if (shift < 0)
+		return;
+
+	latch = 1 << shift;
+
+	clk_ti_rmw(latch, latch, reg);
+	clk_ti_rmw(0, latch, reg);
+	readl(reg);		/* OCP barrier */
+}
drivers/clk/clk-ti.h new file +13 -0
new file mode 100644
index 0000000000..601c3823f7
@@ -0,0 +1,13 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * TI clock utilities header
+ *
+ * Copyright (C) 2020 Dario Binacchi <[email protected]>
+ */
+
+#ifndef _CLK_TI_H
+#define _CLK_TI_H
+
+void clk_ti_latch(fdt_addr_t reg, s8 shift);
+
+#endif /* #ifndef _CLK_TI_H */
Signature · 1 line
2.17.1
#11 lore raw

PATCH v3 10/27 clk: ti: add gate clock driver

In reply to Dario Binacchi

The patch adds support for TI gate clock binding. The code is based on the drivers/clk/ti/gate.c driver of the Linux kernel version 5.9-rc7. For DT binding details see:
- Documentation/devicetree/bindings/clock/ti/gate.txt

---

Changes in v3:
- Remove doc/device-tree-bindings/clock/gpio-gate-clock.txt.
- Remove doc/device-tree-bindings/clock/ti,clockdomain.txt.
- Remove doc/device-tree-bindings/clock/ti,gate.txt.
- Add to commit message the references to linux kernel dt binding documentation.

 drivers/clk/Kconfig       |  6 +++
 drivers/clk/Makefile      |  1 +
 drivers/clk/clk-ti-gate.c | 92 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 99 insertions(+)
 create mode 100644 drivers/clk/clk-ti-gate.c
drivers/clk/Kconfig +6 -0
index bc6bb57904..480ffc7d9c 100644
@@ -111,6 +111,12 @@ config CLK_TI_DIVIDER
 	help
 	  This enables the divider clock driver support on TI's SoCs.
 
+config CLK_TI_GATE
+	bool "TI gate clock driver"
+	depends on CLK && OF_CONTROL
+	help
+	  This enables the gate clock driver support on TI's SoCs.
+
 config CLK_TI_MUX
 	bool "TI mux clock driver"
 	depends on CLK && OF_CONTROL && CLK_CCF
drivers/clk/Makefile +1 -0
index ee218aff08..809672e92e 100644
@@ -50,6 +50,7 @@ obj-$(CONFIG_SANDBOX_CLK_CCF) += clk_sandbox_ccf.o
 obj-$(CONFIG_STM32H7) += clk_stm32h7.o
 obj-$(CONFIG_CLK_TI_AM3_DPLL) += clk-ti-am3-dpll.o clk-ti-am3-dpll-x2.o
 obj-$(CONFIG_CLK_TI_DIVIDER) += clk-ti-divider.o
+obj-$(CONFIG_CLK_TI_GATE) += clk-ti-gate.o
 obj-$(CONFIG_CLK_TI_MUX) += clk-ti-mux.o
 obj-$(CONFIG_CLK_TI_SCI) += clk-ti-sci.o
 obj-$(CONFIG_CLK_VERSAL) += clk_versal.o
drivers/clk/clk-ti-gate.c new file +92 -0

92 lines not on this page · raw message

Signature · 1 line
2.17.1
#12 lore raw

PATCH v3 11/27 ti: am33xx: fix do_enable_clocks() to accept NULL parameters

In reply to Dario Binacchi

Up till this commit passing NULL as input parameter was allowed, but not handled properly. When a NULL parameter was passed to the function a data abort was raised.

---

(no changes since v1)

 arch/arm/mach-omap2/am33xx/clock.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)
arch/arm/mach-omap2/am33xx/clock.c +6 -4
index 8819062aaa..130ee6c6e3 100644
@@ -194,13 +194,14 @@ void do_enable_clocks(u32 *const *clk_domains,
 	u32 i, max = 100;
 
 	/* Put the clock domains in SW_WKUP mode */
-	for (i = 0; (i < max) && clk_domains[i]; i++) {
+	for (i = 0; (i < max) && clk_domains && clk_domains[i]; i++) {
 		enable_clock_domain(clk_domains[i],
 				    CD_CLKCTRL_CLKTRCTRL_SW_WKUP);
 	}
 
 	/* Clock modules that need to be put in SW_EXPLICIT_EN mode */
-	for (i = 0; (i < max) && clk_modules_explicit_en[i]; i++) {
+	for (i = 0; (i < max) && clk_modules_explicit_en &&
+	     clk_modules_explicit_en[i]; i++) {
 		enable_clock_module(clk_modules_explicit_en[i],
 				    MODULE_CLKCTRL_MODULEMODE_SW_EXPLICIT_EN,
 				    wait_for_enable);
@@ -215,12 +216,13 @@ void do_disable_clocks(u32 *const *clk_domains,
 
 
 	/* Clock modules that need to be put in SW_DISABLE */
-	for (i = 0; (i < max) && clk_modules_disable[i]; i++)
+	for (i = 0; (i < max) && clk_modules_disable && clk_modules_disable[i];
+	     i++)
 		disable_clock_module(clk_modules_disable[i],
 				     wait_for_disable);
 
 	/* Put the clock domains in SW_SLEEP mode */
-	for (i = 0; (i < max) && clk_domains[i]; i++)
+	for (i = 0; (i < max) && clk_domains && clk_domains[i]; i++)
 		disable_clock_domain(clk_domains[i]);
 }
 
Signature · 1 line
2.17.1
#13 lore raw

PATCH v3 12/27 clk: ti: add support for clkctrl clocks

In reply to Dario Binacchi

Until now the clkctrl clocks have been enabled/disabled through platform routines. Thanks to this patch they can be enabled and configured directly by the probed devices that need to use them.

For DT binding details see Linux doc:
- Documentation/devicetree/bindings/clock/ti-clkctrl.txt

---

Changes in v3:
- Fix access to registers listed by device tree following resync of am33xx-clock.dtsi with Linux 5.9-rc7.
- Remove doc/device-tree-bindings/clock/ti,clkctrl.txt.
- Add to commit message the references to linux kernel dt binding documentation.

 drivers/clk/Kconfig       |   6 ++
 drivers/clk/Makefile      |   1 +
 drivers/clk/clk-ti-ctrl.c | 153 ++++++++++++++++++++++++++++++++++++++
 3 files changed, 160 insertions(+)
 create mode 100644 drivers/clk/clk-ti-ctrl.c
drivers/clk/Kconfig +6 -0
index 480ffc7d9c..f383e295d3 100644
@@ -105,6 +105,12 @@ config CLK_TI_AM3_DPLL
 	  This enables the DPLL clock drivers support on AM33XX SoCs. The DPLL
 	  provides all interface clocks and functional clocks to the processor.
 
+config CLK_TI_CTRL
+	bool "TI OMAP4 clock controller"
+	depends on CLK && OF_CONTROL
+	help
+	  This enables the clock controller driver support on TI's SoCs.
+
 config CLK_TI_DIVIDER
 	bool "TI divider clock driver"
 	depends on CLK && OF_CONTROL && CLK_CCF
drivers/clk/Makefile +1 -0
index 809672e92e..c98aa27e71 100644
@@ -49,6 +49,7 @@ obj-$(CONFIG_SANDBOX) += clk_sandbox_test.o
 obj-$(CONFIG_SANDBOX_CLK_CCF) += clk_sandbox_ccf.o
 obj-$(CONFIG_STM32H7) += clk_stm32h7.o
 obj-$(CONFIG_CLK_TI_AM3_DPLL) += clk-ti-am3-dpll.o clk-ti-am3-dpll-x2.o
+obj-$(CONFIG_CLK_TI_CTRL) += clk-ti-ctrl.o
 obj-$(CONFIG_CLK_TI_DIVIDER) += clk-ti-divider.o
 obj-$(CONFIG_CLK_TI_GATE) += clk-ti-gate.o
 obj-$(CONFIG_CLK_TI_MUX) += clk-ti-mux.o
drivers/clk/clk-ti-ctrl.c new file +153 -0

153 lines not on this page · raw message

Signature · 1 line
2.17.1
#14 lore raw

PATCH v3 13/27 clk: ti: move drivers to 'ti' directory

In reply to Dario Binacchi

Add drivers/clk/ti/ folder and move all TI's code in this folder for better maintenance.

---

(no changes since v1)

 drivers/clk/Kconfig                           | 40 +-----------------
 drivers/clk/Makefile                          |  8 +---
 drivers/clk/ti/Kconfig                        | 42 +++++++++++++++++++
 drivers/clk/ti/Makefile                       | 12 ++++++
 .../clk-am3-dpll-x2.c}                        |  0
 .../{clk-ti-am3-dpll.c => ti/clk-am3-dpll.c}  |  0
 drivers/clk/{clk-ti-ctrl.c => ti/clk-ctrl.c}  |  0
 .../{clk-ti-divider.c => ti/clk-divider.c}    |  2 +-
 drivers/clk/{clk-ti-gate.c => ti/clk-gate.c}  |  0
 drivers/clk/{clk-ti-mux.c => ti/clk-mux.c}    |  2 +-
 drivers/clk/{clk-ti-sci.c => ti/clk-sci.c}    |  0
 drivers/clk/{clk-ti.c => ti/clk.c}            |  2 +-
 drivers/clk/{clk-ti.h => ti/clk.h}            |  0
 13 files changed, 59 insertions(+), 49 deletions(-)
 create mode 100644 drivers/clk/ti/Kconfig
 create mode 100644 drivers/clk/ti/Makefile
 rename drivers/clk/{clk-ti-am3-dpll-x2.c => ti/clk-am3-dpll-x2.c} (100%)
 rename drivers/clk/{clk-ti-am3-dpll.c => ti/clk-am3-dpll.c} (100%)
 rename drivers/clk/{clk-ti-ctrl.c => ti/clk-ctrl.c} (100%)
 rename drivers/clk/{clk-ti-divider.c => ti/clk-divider.c} (99%)
 rename drivers/clk/{clk-ti-gate.c => ti/clk-gate.c} (100%)
 rename drivers/clk/{clk-ti-mux.c => ti/clk-mux.c} (99%)
 rename drivers/clk/{clk-ti-sci.c => ti/clk-sci.c} (100%)
 rename drivers/clk/{clk-ti.c => ti/clk.c} (96%)
 rename drivers/clk/{clk-ti.h => ti/clk.h} (100%)
drivers/clk/Kconfig +1 -39
index f383e295d3..99b1254de6 100644
@@ -98,45 +98,6 @@ config CLK_STM32F
 	  This clock driver adds support for RCC clock management
 	  for STM32F4 and STM32F7 SoCs.
 
-config CLK_TI_AM3_DPLL
-	bool "TI AM33XX Digital Phase-Locked Loop (DPLL) clock drivers"
-	depends on CLK && OF_CONTROL
-	help
-	  This enables the DPLL clock drivers support on AM33XX SoCs. The DPLL
-	  provides all interface clocks and functional clocks to the processor.
-
-config CLK_TI_CTRL
-	bool "TI OMAP4 clock controller"
-	depends on CLK && OF_CONTROL
-	help
-	  This enables the clock controller driver support on TI's SoCs.
-
-config CLK_TI_DIVIDER
-	bool "TI divider clock driver"
-	depends on CLK && OF_CONTROL && CLK_CCF
-	help
-	  This enables the divider clock driver support on TI's SoCs.
-
-config CLK_TI_GATE
-	bool "TI gate clock driver"
-	depends on CLK && OF_CONTROL
-	help
-	  This enables the gate clock driver support on TI's SoCs.
-
-config CLK_TI_MUX
-	bool "TI mux clock driver"
-	depends on CLK && OF_CONTROL && CLK_CCF
-	help
-	  This enables the mux clock driver support on TI's SoCs.
-
-config CLK_TI_SCI
-	bool "TI System Control Interface (TI SCI) clock driver"
-	depends on CLK && TI_SCI_PROTOCOL && OF_CONTROL
-	help
-	  This enables the clock driver support over TI System Control Interface
-	  available on some new TI's SoCs. If you wish to use clock resources
-	  managed by the TI System Controller, say Y here. Otherwise, say N.
-
 config CLK_HSDK
 	bool "Enable cgu clock driver for HSDK boards"
 	depends on CLK && TARGET_HSDK
@@ -209,6 +170,7 @@ source "drivers/clk/owl/Kconfig"
 source "drivers/clk/renesas/Kconfig"
 source "drivers/clk/sunxi/Kconfig"
 source "drivers/clk/sifive/Kconfig"
+source "drivers/clk/ti/Kconfig"
 source "drivers/clk/tegra/Kconfig"
 source "drivers/clk/uniphier/Kconfig"
 
drivers/clk/Makefile +1 -7
index c98aa27e71..848cfd46f5 100644
@@ -13,12 +13,12 @@ obj-$(CONFIG_$(SPL_TPL_)CLK_COMPOSITE_CCF) += clk-composite.o
 
 obj-y += analogbits/
 obj-y += imx/
+obj-y += ti/
 obj-y += tegra/
 obj-$(CONFIG_ARCH_ASPEED) += aspeed/
 obj-$(CONFIG_ARCH_MEDIATEK) += mediatek/
 obj-$(CONFIG_ARCH_MTMIPS) += mtmips/
 obj-$(CONFIG_ARCH_MESON) += meson/
-obj-$(CONFIG_ARCH_OMAP2PLUS) += clk-ti.o
 obj-$(CONFIG_ARCH_ROCKCHIP) += rockchip/
 obj-$(CONFIG_ARCH_SOCFPGA) += altera/
 obj-$(CONFIG_CLK_AT91) += at91/
@@ -48,11 +48,5 @@ obj-$(CONFIG_SANDBOX) += clk_sandbox.o
 obj-$(CONFIG_SANDBOX) += clk_sandbox_test.o
 obj-$(CONFIG_SANDBOX_CLK_CCF) += clk_sandbox_ccf.o
 obj-$(CONFIG_STM32H7) += clk_stm32h7.o
-obj-$(CONFIG_CLK_TI_AM3_DPLL) += clk-ti-am3-dpll.o clk-ti-am3-dpll-x2.o
-obj-$(CONFIG_CLK_TI_CTRL) += clk-ti-ctrl.o
-obj-$(CONFIG_CLK_TI_DIVIDER) += clk-ti-divider.o
-obj-$(CONFIG_CLK_TI_GATE) += clk-ti-gate.o
-obj-$(CONFIG_CLK_TI_MUX) += clk-ti-mux.o
-obj-$(CONFIG_CLK_TI_SCI) += clk-ti-sci.o
 obj-$(CONFIG_CLK_VERSAL) += clk_versal.o
 obj-$(CONFIG_CLK_CDCE9XX) += clk-cdce9xx.o
drivers/clk/ti/Kconfig new file +42 -0

42 lines not on this page · raw message

drivers/clk/ti/Makefile new file +12 -0
new file mode 100644
index 0000000000..a279a2838d
@@ -0,0 +1,12 @@
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright (C) 2020 Dario Binacchi <[email protected]>
+#
+
+obj-$(CONFIG_ARCH_OMAP2PLUS) += clk.o
+obj-$(CONFIG_CLK_TI_AM3_DPLL) += clk-am3-dpll.o clk-am3-dpll-x2.o
+obj-$(CONFIG_CLK_TI_CTRL) += clk-ctrl.o
+obj-$(CONFIG_CLK_TI_DIVIDER) += clk-divider.o
+obj-$(CONFIG_CLK_TI_GATE) += clk-gate.o
+obj-$(CONFIG_CLK_TI_MUX) += clk-mux.o
+obj-$(CONFIG_CLK_TI_SCI) += clk-sci.o
drivers/clk/ti/clk-am3-dpll-x2.c renamed from drivers/clk/clk-ti-am3-dpll-x2.c +0 -0
similarity index 100%
rename from drivers/clk/clk-ti-am3-dpll-x2.c
rename to drivers/clk/ti/clk-am3-dpll-x2.c
drivers/clk/ti/clk-am3-dpll.c renamed from drivers/clk/clk-ti-am3-dpll.c +0 -0
similarity index 100%
rename from drivers/clk/clk-ti-am3-dpll.c
rename to drivers/clk/ti/clk-am3-dpll.c
drivers/clk/ti/clk-ctrl.c renamed from drivers/clk/clk-ti-ctrl.c +0 -0
similarity index 100%
rename from drivers/clk/clk-ti-ctrl.c
rename to drivers/clk/ti/clk-ctrl.c
drivers/clk/ti/clk-divider.c renamed from drivers/clk/clk-ti-divider.c +1 -1
similarity index 99%
rename from drivers/clk/clk-ti-divider.c
rename to drivers/clk/ti/clk-divider.c
index e89650883b..6c5c47f568 100644
@@ -16,7 +16,7 @@
 #include <linux/clk-provider.h>
 #include <linux/kernel.h>
 #include <linux/log2.h>
-#include "clk-ti.h"
+#include "clk.h"
 
 /*
  * The reverse of DIV_ROUND_UP: The maximum number which
drivers/clk/ti/clk-gate.c renamed from drivers/clk/clk-ti-gate.c +0 -0
similarity index 100%
rename from drivers/clk/clk-ti-gate.c
rename to drivers/clk/ti/clk-gate.c
drivers/clk/ti/clk-mux.c renamed from drivers/clk/clk-ti-mux.c +1 -1
similarity index 99%
rename from drivers/clk/clk-ti-mux.c
rename to drivers/clk/ti/clk-mux.c
index e4b190bbcc..a3ebef251c 100644
@@ -12,7 +12,7 @@
 #include <clk-uclass.h>
 #include <asm/io.h>
 #include <linux/clk-provider.h>
-#include "clk-ti.h"
+#include "clk.h"
 
 struct clk_ti_mux_priv {
 	struct clk_bulk parents;
drivers/clk/ti/clk-sci.c renamed from drivers/clk/clk-ti-sci.c +0 -0
similarity index 100%
rename from drivers/clk/clk-ti-sci.c
rename to drivers/clk/ti/clk-sci.c
drivers/clk/ti/clk.c renamed from drivers/clk/clk-ti.c +1 -1
similarity index 96%
rename from drivers/clk/clk-ti.c
rename to drivers/clk/ti/clk.c
index 594ef75270..e44b90ad6a 100644
@@ -7,7 +7,7 @@
 
 #include <common.h>
 #include <asm/io.h>
-#include "clk-ti.h"
+#include "clk.h"
 
 static void clk_ti_rmw(u32 val, u32 mask, fdt_addr_t reg)
 {
drivers/clk/ti/clk.h renamed from drivers/clk/clk-ti.h +0 -0
similarity index 100%
rename from drivers/clk/clk-ti.h
rename to drivers/clk/ti/clk.h
Signature · 1 line
2.17.1
#15 lore raw

PATCH v3 14/27 clk: ti: omap4: add clock manager driver

In reply to Dario Binacchi

This minimal driver is only used to bind child devices.

For DT binding details see Linux doc:
- Documentation/devicetree/bindings/arm/omap/prcm.txt

---

Changes in v3:
- doc/device-tree-bindings/arm/omap,prcm.txt.
- Add to commit message the references to linux kernel dt binding documentation.

 drivers/clk/ti/Makefile   |  2 +-
 drivers/clk/ti/omap4-cm.c | 22 ++++++++++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/ti/omap4-cm.c
drivers/clk/ti/Makefile +1 -1
index a279a2838d..0b7e61cdf7 100644
@@ -3,7 +3,7 @@
 # Copyright (C) 2020 Dario Binacchi <[email protected]>
 #
 
-obj-$(CONFIG_ARCH_OMAP2PLUS) += clk.o
+obj-$(CONFIG_ARCH_OMAP2PLUS) += clk.o omap4-cm.o
 obj-$(CONFIG_CLK_TI_AM3_DPLL) += clk-am3-dpll.o clk-am3-dpll-x2.o
 obj-$(CONFIG_CLK_TI_CTRL) += clk-ctrl.o
 obj-$(CONFIG_CLK_TI_DIVIDER) += clk-divider.o
drivers/clk/ti/omap4-cm.c new file +22 -0
new file mode 100644
index 0000000000..3cdc9b2888
@@ -0,0 +1,22 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * OMAP4 clock manager (cm)
+ *
+ * Copyright (C) 2020 Dario Binacchi <[email protected]>
+ */
+
+#include <common.h>
+#include <dm.h>
+#include <dm/lists.h>
+
+static const struct udevice_id ti_omap4_cm_ids[] = {
+	{.compatible = "ti,omap4-cm"},
+	{}
+};
+
+U_BOOT_DRIVER(ti_omap4_cm) = {
+	.name = "ti_omap4_cm",
+	.id = UCLASS_SIMPLE_BUS,
+	.of_match = ti_omap4_cm_ids,
+	.bind = dm_scan_fdt_dev,
+};
Signature · 1 line
2.17.1
#16 lore raw

PATCH v3 15/27 clk: ti: am335x: add clock manager driver

In reply to Dario Binacchi

The implementation of this driver was needed to bind the sub-nodes of the 'clocks' node. In fact, the lack of the compatible property in the 'clocks' node does not allow the generic 'simple-bus' driver to bind the 'clocks' node and in turn its sub-nodes.
The 'prcm at 200000' node is therefore the node closest to the 'clocks' node whose driver can bind all the 'clocks' sub-nodes. In this way, the address translation functions are able to walk along the device tree towards the upper nodes until the address composition is completed.

prcm: prcm at 200000 {
	compatible = "ti,am3-prcm", "simple-bus";
	reg = <0x200000 0x4000>;
	#address-cells = <1>;
	#size-cells = <1>;
	ranges = <0 0x200000 0x4000>;

	prcm_clocks: clocks {
		#address-cells = <1>;
		#size-cells = <0>;
	};

	prcm_clockdomains: clockdomains {
	};
};
&prcm_clocks {
	...
	dpll_core_ck: dpll_core_ck at 490 {
        	#clock-cells = <0>;
		compatible = "ti,am3-dpll-core-clock";
		clocks = <&sys_clkin_ck>, <&sys_clkin_ck>;
		reg = <0x0490>, <0x045c>, <0x0468>;
	};
	...
};

For DT binding details see Linux doc:
- Documentation/devicetree/bindings/arm/omap/prcm.txt

---

Changes in v3:
- Add to commit message the references to linux kernel dt binding documentation.

Changes in v2:
- Remove the 'ti_am3_prcm_clocks' driver. Handle 'prcm_clocks' node in the 'ti_am3_prcm' driver.
- Update the commit message.

 drivers/clk/ti/Makefile   |  8 ++++-
 drivers/clk/ti/am3-prcm.c | 65 +++++++++++++++++++++++++++++++++++++++
 2 files changed, 72 insertions(+), 1 deletion(-)
 create mode 100644 drivers/clk/ti/am3-prcm.c
drivers/clk/ti/Makefile +7 -1
index 0b7e61cdf7..3d6e0cd79d 100644
@@ -3,7 +3,13 @@
 # Copyright (C) 2020 Dario Binacchi <[email protected]>
 #
 
-obj-$(CONFIG_ARCH_OMAP2PLUS) += clk.o omap4-cm.o
+ifeq ($(CONFIG_ARCH_OMAP2PLUS), y)
+
+obj-y += clk.o omap4-cm.o
+obj-$(CONFIG_AM33XX) += am3-prcm.o
+
+endif # CONFIG_ARCH_OMAP2PLUS
+
 obj-$(CONFIG_CLK_TI_AM3_DPLL) += clk-am3-dpll.o clk-am3-dpll-x2.o
 obj-$(CONFIG_CLK_TI_CTRL) += clk-ctrl.o
 obj-$(CONFIG_CLK_TI_DIVIDER) += clk-divider.o
drivers/clk/ti/am3-prcm.c new file +65 -0

65 lines not on this page · raw message

Signature · 1 line
2.17.1
#17 lore raw

PATCH v3 16/27 fdt: translate address if #size-cells = <0>

In reply to Dario Binacchi

The __of_translate_address routine translates an address from the device tree into a CPU physical address. A note in the description of the routine explains that the crossing of any level with #size-cells = <0> is to be considered an error not by specification but since inherited from IBM. This does not happen for Texas Instruments, or at least for the beaglebone device tree. Without this patch, in fact, the translation into physical addresses of the registers contained in the am33xx-clocks.dtsi nodes would not be possible. They all have a parent with #size-cells = <0>.

The CONFIG_OF_TRANSLATE_ZERO_SIZE_CELLS symbol makes translation possible even in the case of crossing levels with #size-cells = <0>.

The patch acts conservatively on address translation, except for removing a check within the of_translate_one function in the drivers/core/of_addr.c file:

+

        ranges = of_get_property(parent, rprop, &rlen);

- if (ranges == NULL && !of_empty_ranges_quirk(parent)) {
- debug("no ranges; cannot translate\n");
- return 1;
- }

        if (ranges == NULL || rlen == 0) {
                offset = of_read_number(addr, na);
                memset(addr, 0, pna * 4);
		debug("empty ranges; 1:1 translation\n");

There are two reasons:
1 The function of_empty_ranges_quirk always returns false, invalidating
the following if statement in case of null ranges. Therefore one of the two checks is useless.

2 The implementation of the of_translate_one function found in the
common/fdt_support.c file has removed this check while keeping the one about the 1:1 translation.

The patch adds a test and modifies a check for the correctness of an address in the case of enabling translation also for zero size cells. The added test checks translations of addresses generated by nodes of a device tree similar to those you can find in the files am33xx.dtsi and am33xx-clocks.dtsi for which the patch was created.

The patch was also tested on a beaglebone black board. The addresses generated for the registers of the loaded drivers are those specified by the AM335x reference manual.

---

Changes in v3:
- Comment dm_flags field in the global_data structure.

Changes in v2:
- Fix a missing line in the commit message.
- Add dm_flags to global_data structure and GD_DM_FLG_SIZE_CELLS_0 macro to test without recompiling.
- Update the OF_CHECK_COUNTS macro in order to have just one #define by bringing the GD_DM_FLG_SIZE_CELLS_0 into the expression.
- Lower-case the 0xC019 hex number.

 arch/sandbox/dts/test.dts         | 21 ++++++++++
 common/fdt_support.c              |  6 ++-
 drivers/core/Kconfig              | 12 ++++++
 drivers/core/fdtaddr.c            |  2 +-
 drivers/core/of_addr.c            | 14 ++-----
 drivers/core/ofnode.c             |  7 +++-
 drivers/core/root.c               |  3 ++
 include/asm-generic/global_data.h |  6 +++
 test/dm/test-fdt.c                | 68 ++++++++++++++++++++++++++++++-
 9 files changed, 123 insertions(+), 16 deletions(-)
arch/sandbox/dts/test.dts +21 -0
index c7d1376911..e79537a8c3 100644
@@ -40,6 +40,7 @@
 		fdt-dummy1 = "/translation-test at 8000/dev at 1,100";
 		fdt-dummy2 = "/translation-test at 8000/dev at 2,200";
 		fdt-dummy3 = "/translation-test at 8000/noxlatebus at 3,300/dev at 42";
+		fdt-dummy4 = "/translation-test at 8000/xlatebus at 4,400/devs/dev at 19";
 		usb0 = &usb_0;
 		usb1 = &usb_1;
 		usb2 = &usb_2;
@@ -1028,6 +1029,7 @@
 			  1 0x100 0x9000 0x1000
 			  2 0x200 0xA000 0x1000
 			  3 0x300 0xB000 0x1000
+			  4 0x400 0xC000 0x1000
 			 >;
 
 		dma-ranges = <0 0x000 0x10000000 0x1000
@@ -1064,6 +1066,25 @@
 				reg = <0x42>;
 			};
 		};
+
+		xlatebus at 4,400 {
+			compatible = "sandbox,zero-size-cells-bus";
+			reg = <4 0x400 0x1000>;
+			#address-cells = <1>;
+			#size-cells = <1>;
+			ranges = <0 4 0x400 0x1000>;
+
+			devs {
+				#address-cells = <1>;
+				#size-cells = <0>;
+
+				dev at 19 {
+					compatible = "denx,u-boot-fdt-dummy";
+					reg = <0x19>;
+				};
+			};
+		};
+
 	};
 
 	osd {
common/fdt_support.c +4 -2
index a565b470f8..d8cf6f5725 100644
@@ -20,6 +20,8 @@
 #include <exports.h>
 #include <fdtdec.h>
 
+DECLARE_GLOBAL_DATA_PTR;
+
 /**
  * fdt_getprop_u32_default_node - Return a node's property or a default
  *
@@ -1001,8 +1003,8 @@ void fdt_del_node_and_alias(void *blob, const char *alias)
 /* Max address size we deal with */
 #define OF_MAX_ADDR_CELLS	4
 #define OF_BAD_ADDR	FDT_ADDR_T_NONE
-#define OF_CHECK_COUNTS(na, ns)	((na) > 0 && (na) <= OF_MAX_ADDR_CELLS && \
-			(ns) > 0)
+#define OF_CHECK_COUNTS(na, ns) (((na) > 0 && (na) <= OF_MAX_ADDR_CELLS) && \
+			 ((ns) > 0 || (gd->dm_flags & GD_DM_FLG_SIZE_CELLS_0)))
 
 /* Debug utility */
 #ifdef DEBUG
drivers/core/Kconfig +12 -0
index 07d3a6a7a4..d4ea202b16 100644
@@ -217,6 +217,18 @@ config OF_TRANSLATE
 	  used for the address translation. This function is faster and
 	  smaller in size than fdt_translate_address().
 
+config OF_TRANSLATE_ZERO_SIZE_CELLS
+	bool "Enable translation for zero size cells"
+	depends on OF_TRANSLATE
+	default n
+	help
+	  The routine used to translate an FDT address into a physical CPU
+	  address was developed by IBM. It considers that crossing any level
+	  with #size-cells = <0> makes translation impossible, even if it is
+	  not the way it was specified.
+	  Enabling this option makes translation possible even in the case
+	  of crossing levels with #size-cells = <0>.
+
 config SPL_OF_TRANSLATE
 	bool "Translate addresses using fdt_translate_address in SPL"
 	depends on SPL_DM && SPL_OF_CONTROL
drivers/core/fdtaddr.c +1 -1
index 8b48aa5bc5..51a0093d65 100644
@@ -49,7 +49,7 @@ fdt_addr_t devfdt_get_addr_index(const struct udevice *dev, int index)
 
 		reg += index * (na + ns);
 
-		if (ns) {
+		if (ns || (gd->dm_flags & GD_DM_FLG_SIZE_CELLS_0)) {
 			/*
 			 * Use the full-fledged translate function for complex
 			 * bus setups.
drivers/core/of_addr.c +4 -10
index ca34d84922..a590533c8a 100644
@@ -18,7 +18,9 @@
 /* Max address size we deal with */
 #define OF_MAX_ADDR_CELLS	4
 #define OF_CHECK_ADDR_COUNT(na)	((na) > 0 && (na) <= OF_MAX_ADDR_CELLS)
-#define OF_CHECK_COUNTS(na, ns)	(OF_CHECK_ADDR_COUNT(na) && (ns) > 0)
+#define OF_CHECK_COUNTS(na, ns)	(OF_CHECK_ADDR_COUNT(na) && \
+				 ((ns) > 0 || \
+				  (gd->dm_flags & GD_DM_FLG_SIZE_CELLS_0)))
 
 static struct of_bus *of_match_bus(struct device_node *np);
 
@@ -162,11 +164,6 @@ const __be32 *of_get_address(const struct device_node *dev, int index,
 }
 EXPORT_SYMBOL(of_get_address);
 
-static int of_empty_ranges_quirk(const struct device_node *np)
-{
-	return false;
-}
-
 static int of_translate_one(const struct device_node *parent,
 			    struct of_bus *bus, struct of_bus *pbus,
 			    __be32 *addr, int na, int ns, int pna,
@@ -193,11 +190,8 @@ static int of_translate_one(const struct device_node *parent,
 	 * As far as we know, this damage only exists on Apple machines, so
 	 * This code is only enabled on powerpc. --gcl
 	 */
+
 	ranges = of_get_property(parent, rprop, &rlen);
-	if (ranges == NULL && !of_empty_ranges_quirk(parent)) {
-		debug("no ranges; cannot translate\n");
-		return 1;
-	}
 	if (ranges == NULL || rlen == 0) {
 		offset = of_read_number(addr, na);
 		memset(addr, 0, pna * 4);
drivers/core/ofnode.c +5 -2
index 7d1b89514c..700cee9f56 100644
@@ -304,7 +304,8 @@ fdt_addr_t ofnode_get_addr_size_index(ofnode node, int index, fdt_size_t *size)
 
 		ns = of_n_size_cells(ofnode_to_np(node));
 
-		if (IS_ENABLED(CONFIG_OF_TRANSLATE) && ns > 0) {
+		if (IS_ENABLED(CONFIG_OF_TRANSLATE) &&
+		    (ns > 0 || (gd->dm_flags & GD_DM_FLG_SIZE_CELLS_0))) {
 			return of_translate_address(ofnode_to_np(node), prop_val);
 		} else {
 			na = of_n_addr_cells(ofnode_to_np(node));
@@ -656,8 +657,10 @@ fdt_addr_t ofnode_get_addr_size(ofnode node, const char *property,
 		ns = of_n_size_cells(np);
 		*sizep = of_read_number(prop + na, ns);
 
-		if (CONFIG_IS_ENABLED(OF_TRANSLATE) && ns > 0)
+		if (CONFIG_IS_ENABLED(OF_TRANSLATE) &&
+		    (ns > 0 || (gd->dm_flags & GD_DM_FLG_SIZE_CELLS_0))) {
 			return of_translate_address(np, prop);
+		}
 		else
 			return of_read_number(prop, na);
 	} else {
drivers/core/root.c +3 -0
index 0726be6b79..193164238a 100644
@@ -135,6 +135,9 @@ int dm_init(bool of_live)
 {
 	int ret;
 
+	if (IS_ENABLED(CONFIG_OF_TRANSLATE_ZERO_SIZE_CELLS))
+		gd->dm_flags |= GD_DM_FLG_SIZE_CELLS_0;
+
 	if (gd->dm_root) {
 		dm_warn("Virtual root driver already exists!\n");
 		return -EINVAL;
include/asm-generic/global_data.h +6 -0
index d4a4e2215d..b627817860 100644
@@ -64,6 +64,7 @@ typedef struct global_data {
 	struct global_data *new_gd;	/* relocated global data */
 
 #ifdef CONFIG_DM
+	unsigned long dm_flags;		/* Additional flags for Driver Model */
 	struct udevice	*dm_root;	/* Root instance for Driver Model */
 	struct udevice	*dm_root_f;	/* Pre-relocation root instance */
 	struct list_head uclass_root;	/* Head of core tree */
@@ -169,4 +170,9 @@ typedef struct global_data {
 #define GD_FLG_SKIP_LL_INIT	0x20000	/* Don't perform low-level init	   */
 #define GD_FLG_SMP_READY	0x40000	/* SMP init is complete		   */
 
+/*
+ * Global Data Driver Model Flags
+ */
+#define GD_DM_FLG_SIZE_CELLS_0	0x00001	/* Enable #size-cells=<0> translation */
+
 #endif /* __ASM_GENERIC_GBL_DATA_H */
test/dm/test-fdt.c +67 -1

84 lines not on this page · raw message

Signature · 1 line
2.17.1
#18 lore raw

PATCH v3 17/27 omap: timer: fix the rate setting

In reply to Dario Binacchi

The prescaler (PTV) setting must be taken into account even when the timer input clock frequency has been set.

---

(no changes since v1)

 drivers/timer/omap-timer.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/timer/omap-timer.c +3 -3
index cf3d27b96b..60af68e677 100644
@@ -19,8 +19,6 @@
 #define TCLR_PRE_EN			BIT(5)	/* Pre-scaler enable */
 #define TCLR_PTV_SHIFT			(2)	/* Pre-scaler shift value */
 
-#define TIMER_CLOCK             (V_SCLK / (2 << CONFIG_SYS_PTV))
-
 struct omap_gptimer_regs {
 	unsigned int tidr;		/* offset 0x00 */
 	unsigned char res1[12];
@@ -63,7 +61,9 @@ static int omap_timer_probe(struct udevice *dev)
 	struct omap_timer_priv *priv = dev_get_priv(dev);
 
 	if (!uc_priv->clock_rate)
-		uc_priv->clock_rate = TIMER_CLOCK;
+		uc_priv->clock_rate = V_SCLK;
+
+	uc_priv->clock_rate /= (2 << CONFIG_SYS_PTV);
 
 	/* start the counter ticking up, reload value on overflow */
 	writel(0, &priv->regs->tldr);
Signature · 1 line
2.17.1
#19 lore raw

PATCH v3 18/27 misc: am33xx: add control module driver

In reply to Dario Binacchi

The implementation of this driver was needed to bind the device tree sub-nodes of the 'clocks' node. In fact, the lack of the compatible property in the 'clocks' node does not allow the generic 'syscon' or 'simple-bus' drivers linked to the 'scm_conf at 0' node to bind the 'clocks' node and in turn its sub-nodes.
The 'scm at 210000' node is therefore the node closest to the 'clocks' node whose driver can bind all the 'clocks' sub-nodes. In this way, the address translation functions are able to walk along the device tree towards the upper nodes until the address composition is completed.

scm: scm at 210000 {
	compatible = "ti,am3-scm", "simple-bus";
	...

	scm_conf: scm_conf at 0 {
		compatible = "syscon", "simple-bus";
		#address-cells = <1>;
		#size-cells = <1>;
		ranges = <0 0 0x800>;

		scm_clocks: clocks {
			#address-cells = <1>;
			#size-cells = <0>;
		};
	};
};

For DT binding details see Linux doc:
- Documentation/devicetree/bindings/arm/omap/ctrl.txt

---

Changes in v3:
- Remove doc/device-tree-bindings/arm/omap,ctrl.txt.
- Remove doc/device-tree-bindings/pinctrl/pinctrl-single.txt.
- Add to commit message the references to linux kernel dt binding documentation.

Changes in v2:
- Remove the 'ti_am3_scm_clocks' driver. Handle 'scm_clocks' node in the 'ti_am3_scm' driver.
- Update the commit message.

 drivers/misc/Kconfig      |  7 ++++
 drivers/misc/Makefile     |  1 +
 drivers/misc/ti-am3-scm.c | 81 +++++++++++++++++++++++++++++++++++++++
 3 files changed, 89 insertions(+)
 create mode 100644 drivers/misc/ti-am3-scm.c
drivers/misc/Kconfig +7 -0
index b67e906a76..9e8b676637 100644
@@ -500,4 +500,11 @@ config ESM_PMIC
 	  Support ESM (Error Signal Monitor) on PMIC devices. ESM is used
 	  typically to reboot the board in error condition.
 
+config TI_AM3_SCM
+	bool "AM33XX specific control module support (SCM)"
+	depends on ARCH_OMAP2PLUS
+	help
+	 The control module includes status and control logic not addressed
+	 within the peripherals or the rest of the device infrastructure.
+
 endmenu
drivers/misc/Makefile +1 -0
index 947bd3a647..056fb3b522 100644
@@ -75,3 +75,4 @@ obj-$(CONFIG_MICROCHIP_FLEXCOM) += microchip_flexcom.o
 obj-$(CONFIG_K3_AVS0) += k3_avs.o
 obj-$(CONFIG_ESM_K3) += k3_esm.o
 obj-$(CONFIG_ESM_PMIC) += esm_pmic.o
+obj-$(CONFIG_TI_AM3_SCM) += ti-am3-scm.o
drivers/misc/ti-am3-scm.c new file +81 -0

81 lines not on this page · raw message

Signature · 1 line
2.17.1
#20 lore raw

v3 cover Add DM support for omap PWM backlight

In reply to Dario Binacchi
Quoted 35 lines · Dario Binacchi

The series was born from the need to manage the PWM backlight of the display connected to my beaglebone board. To hit the target, I had to develop drivers for PWM management which in turn relied on drivers for managing timers and clocks, all developed according to the driver model. My intention was to use the SoC-specific API only at strictly necessary points in the code. My previous patches for migrating the AM335x display driver to the driver model had required the implementation of additional functions outside the concerns of the driver, (settings for dividing the pixel clock rate, configuring the display DPLL rate, ....) not being able to use the API of the related clock drivers. This series shouldn't have repeated the same kind of mistake. Furthermore, I also wanted to fix that kind of forced choice. Almost everything should have been accessible via the driver model API. In the series there are also some patches that could be submitted separately, but which I have however inserted to avoid applying future patches to incorporate them.
With this last consideration, I hope I have convincingly justified the large number of patches in the series.

The patch enabling address translation into a CPU physical address from device-tree even in case of crossing levels with #size-cells = <0>, is crucial for the series. The previous implementation was unable to perform the address translation required by the am33xx device tree. I tried to apply in a conservative way as few changes as possible and to verify the execution of all the tests already developed, as well as the new ones I added for the new feature.

As recommended by Grygorii Strashko I have removed some patches to upload them in new different series:
- [v2,01/30] clk: remove a redundant header
- [v2,03/30] arch: sandbox: fix typo in clk.h
- [v2,20/30] video: backlight: fix pwm's duty cycle calculation
- [v2,21/30] video: backlight: fix pwm data structure description
- [v2,22/30] dm: core: improve uclass_get_device_by_phandle_id() description
- [v2,23/30] gpio: fix gpio_request_by_name() description

Quoted 8 lines

Grygorii suggested to remove also other patches that I have kept in the series to allow anyone who wants to be able to test it. Moreover after the addition of a patch that has largely changed the device tree. The patches removed are the one and only ones that do not affect the series in any way. I hope that the next version of this series will require only minimal changes allowing me to split it according to Grygorii's suggestions.
----

I must be missing something as this patch series does not apply without errors to U-Boot master:

error: drivers/clk/clk-ti-am3-dpll-x2.c: No such file or directory
error: drivers/clk/clk-ti-am3-dpll.c: No such file or directory
error: drivers/clk/clk-ti-ctrl.c: No such file or directory
error: drivers/clk/clk-ti-divider.c: No such file or directory
error: drivers/clk/clk-ti-gate.c: No such file or directory
error: drivers/clk/clk-ti-mux.c: No such file or directory
error: drivers/clk/clk-ti.c: No such file or directory
error: drivers/clk/clk-ti.h: No such file or directory
error: drivers/video/tilcdc-panel.c: No such file or directory
error: drivers/video/tilcdc-panel.h: No such file or directory
error: drivers/video/tilcdc.c: No such file or directory
error: drivers/video/tilcdc.h: No such file or directory

Does it probably depend on some other patches?

regards, Felix

#21 lore raw

v3 cover Add DM support for omap PWM backlight

Quoted 50 lines

Il 14/10/2020 10:22 Felix Brack <[email protected]> ha scritto:

Quoted 35 lines · Dario Binacchi

The series was born from the need to manage the PWM backlight of the display connected to my beaglebone board. To hit the target, I had to develop drivers for PWM management which in turn relied on drivers for managing timers and clocks, all developed according to the driver model. My intention was to use the SoC-specific API only at strictly necessary points in the code. My previous patches for migrating the AM335x display driver to the driver model had required the implementation of additional functions outside the concerns of the driver, (settings for dividing the pixel clock rate, configuring the display DPLL rate, ....) not being able to use the API of the related clock drivers. This series shouldn't have repeated the same kind of mistake. Furthermore, I also wanted to fix that kind of forced choice. Almost everything should have been accessible via the driver model API. In the series there are also some patches that could be submitted separately, but which I have however inserted to avoid applying future patches to incorporate them.
With this last consideration, I hope I have convincingly justified the large number of patches in the series.

The patch enabling address translation into a CPU physical address from device-tree even in case of crossing levels with #size-cells = <0>, is crucial for the series. The previous implementation was unable to perform the address translation required by the am33xx device tree. I tried to apply in a conservative way as few changes as possible and to verify the execution of all the tests already developed, as well as the new ones I added for the new feature.

As recommended by Grygorii Strashko I have removed some patches to upload them in new different series:
- [v2,01/30] clk: remove a redundant header
- [v2,03/30] arch: sandbox: fix typo in clk.h
- [v2,20/30] video: backlight: fix pwm's duty cycle calculation
- [v2,21/30] video: backlight: fix pwm data structure description
- [v2,22/30] dm: core: improve uclass_get_device_by_phandle_id() description
- [v2,23/30] gpio: fix gpio_request_by_name() description

Quoted 8 lines

Grygorii suggested to remove also other patches that I have kept in the series to allow anyone who wants to be able to test it. Moreover after the addition of a patch that has largely changed the device tree. The patches removed are the one and only ones that do not affect the series in any way. I hope that the next version of this series will require only minimal changes allowing me to split it according to Grygorii's suggestions.
----

Quoted 3 lines

I must be missing something as this patch series does not apply without errors to U-Boot master:

Hi Felix,
I applied the patch of the series downloaded from patchwork on master and I compiled it without errors.

Quoted 8 lines

error: drivers/clk/clk-ti-am3-dpll-x2.c: No such file or directory
error: drivers/clk/clk-ti-am3-dpll.c: No such file or directory
error: drivers/clk/clk-ti-ctrl.c: No such file or directory
error: drivers/clk/clk-ti-divider.c: No such file or directory
error: drivers/clk/clk-ti-gate.c: No such file or directory
error: drivers/clk/clk-ti-mux.c: No such file or directory
error: drivers/clk/clk-ti.c: No such file or directory
error: drivers/clk/clk-ti.h: No such file or directory

After applying the patch you should find:
ls drivers/clk/ti
am3-prcm.c
clk-am3-dpll.c
clk-am3-dpll-x2.c
clk.c
clk-ctrl.c
clk-divider.c
clk-gate.c
clk.h
clk-mux.c
clk-sci.c
Kconfig
Makefile
omap4-cm.c

Quoted 5 lines

error: drivers/video/tilcdc-panel.c: No such file or directory
error: drivers/video/tilcdc-panel.h: No such file or directory
error: drivers/video/tilcdc.c: No such file or directory
error: drivers/video/tilcdc.h: No such file or directory

and
ls drivers/video/ti
am335x-fb.c
am335x-fb.h
Kconfig
Makefile
tilcdc.c
tilcdc.h
tilcdc-panel.c
tilcdc-panel.h

Quoted 1 line

Does it probably depend on some other patches?

No, the series patch does not depend on other patches

Quoted 2 lines

regards, Felix

Best regards
Dario

#22 lore raw

v3 cover Add DM support for omap PWM backlight

Hello Dario,

Quoted 50 lines · Dario Binacchi
Quoted 49 lines

Il 14/10/2020 10:22 Felix Brack <[email protected]> ha scritto:

Quoted 43 lines · Dario Binacchi

The series was born from the need to manage the PWM backlight of the display connected to my beaglebone board. To hit the target, I had to develop drivers for PWM management which in turn relied on drivers for managing timers and clocks, all developed according to the driver model. My intention was to use the SoC-specific API only at strictly necessary points in the code. My previous patches for migrating the AM335x display driver to the driver model had required the implementation of additional functions outside the concerns of the driver, (settings for dividing the pixel clock rate, configuring the display DPLL rate, ....) not being able to use the API of the related clock drivers. This series shouldn't have repeated the same kind of mistake. Furthermore, I also wanted to fix that kind of forced choice. Almost everything should have been accessible via the driver model API. In the series there are also some patches that could be submitted separately, but which I have however inserted to avoid applying future patches to incorporate them.
With this last consideration, I hope I have convincingly justified the large number of patches in the series.

The patch enabling address translation into a CPU physical address from device-tree even in case of crossing levels with #size-cells = <0>, is crucial for the series. The previous implementation was unable to perform the address translation required by the am33xx device tree. I tried to apply in a conservative way as few changes as possible and to verify the execution of all the tests already developed, as well as the new ones I added for the new feature.

As recommended by Grygorii Strashko I have removed some patches to upload them in new different series:
- [v2,01/30] clk: remove a redundant header
- [v2,03/30] arch: sandbox: fix typo in clk.h
- [v2,20/30] video: backlight: fix pwm's duty cycle calculation
- [v2,21/30] video: backlight: fix pwm data structure description
- [v2,22/30] dm: core: improve uclass_get_device_by_phandle_id() description
- [v2,23/30] gpio: fix gpio_request_by_name() description

Grygorii suggested to remove also other patches that I have kept in the series to allow anyone who wants to be able to test it. Moreover after the addition of a patch that has largely changed the device tree. The patches removed are the one and only ones that do not affect the series in any way. I hope that the next version of this series will require only minimal changes allowing me to split it according to Grygorii's suggestions.
----

Quoted 7 lines
Quoted 3 lines

I must be missing something as this patch series does not apply without errors to U-Boot master:

Hi Felix,
I applied the patch of the series downloaded from patchwork on master and I compiled it without errors.

Did you do that against a recently cloned master?

Quoted 31 lines
Quoted 8 lines

error: drivers/clk/clk-ti-am3-dpll-x2.c: No such file or directory
error: drivers/clk/clk-ti-am3-dpll.c: No such file or directory
error: drivers/clk/clk-ti-ctrl.c: No such file or directory
error: drivers/clk/clk-ti-divider.c: No such file or directory
error: drivers/clk/clk-ti-gate.c: No such file or directory
error: drivers/clk/clk-ti-mux.c: No such file or directory
error: drivers/clk/clk-ti.c: No such file or directory
error: drivers/clk/clk-ti.h: No such file or directory

After applying the patch you should find:
ls drivers/clk/ti
am3-prcm.c
clk-am3-dpll.c
clk-am3-dpll-x2.c
clk.c
clk-ctrl.c
clk-divider.c
clk-gate.c
clk.h
clk-mux.c
clk-sci.c
Kconfig
Makefile
omap4-cm.c

Quoted 5 lines

error: drivers/video/tilcdc-panel.c: No such file or directory
error: drivers/video/tilcdc-panel.h: No such file or directory
error: drivers/video/tilcdc.c: No such file or directory
error: drivers/video/tilcdc.h: No such file or directory

Quoted 11 lines

and
ls drivers/video/ti
am335x-fb.c
am335x-fb.h
Kconfig
Makefile
tilcdc.c
tilcdc.h
tilcdc-panel.c
tilcdc-panel.h

As the patch series does not apply I don't see these files.

Quoted 8 lines
Quoted 1 line

Does it probably depend on some other patches?

No, the series patch does not depend on other patches

Quoted 2 lines

regards, Felix

Best regards
Dario

Two hours ago I did:

1. git clone https://gitlab.denx.de/u-boot/u-boot.git
2. downloaded Add-DM-support-for-omap-PWM-backlight.patch from
https://patchwork.ozlabs.org/project/uboot/list/?series=207124
3. git apply Add-DM-support-for-omap-PWM-backlight.patch --check -v

result:

Checking patch drivers/clk/clk-divider.c...
Checking patch include/linux/clk-provider.h...
Checking patch include/dt-bindings/bus/ti-sysc.h...
...
Checking patch drivers/clk/ti/Kconfig...
Checking patch drivers/clk/ti/Makefile...
Checking patch drivers/clk/clk-ti-am3-dpll-x2.c => drivers/clk/ti/clk-am3-dpll-x2.c...
error: drivers/clk/clk-ti-am3-dpll-x2.c: No such file or directory Checking patch drivers/clk/clk-ti-am3-dpll.c => drivers/clk/ti/clk-am3-dpll.c...
error: drivers/clk/clk-ti-am3-dpll.c: No such file or directory Checking patch drivers/clk/clk-ti-ctrl.c => drivers/clk/ti/clk-ctrl.c...
error: drivers/clk/clk-ti-ctrl.c: No such file or directory Checking patch drivers/clk/clk-ti-divider.c => drivers/clk/ti/clk-divider.c...
error: drivers/clk/clk-ti-divider.c: No such file or directory Checking patch drivers/clk/clk-ti-gate.c => drivers/clk/ti/clk-gate.c...
error: drivers/clk/clk-ti-gate.c: No such file or directory Checking patch drivers/clk/clk-ti-mux.c => drivers/clk/ti/clk-mux.c...
error: drivers/clk/clk-ti-mux.c: No such file or directory Checking patch drivers/clk/clk-ti-sci.c => drivers/clk/ti/clk-sci.c... Checking patch drivers/clk/clk-ti.c => drivers/clk/ti/clk.c...
error: drivers/clk/clk-ti.c: No such file or directory Checking patch drivers/clk/clk-ti.h => drivers/clk/ti/clk.h...
error: drivers/clk/clk-ti.h: No such file or directory Checking patch drivers/clk/ti/Makefile...
Checking patch drivers/clk/ti/omap4-cm.c...
Checking patch drivers/clk/ti/Makefile...
Checking patch drivers/clk/ti/am3-prcm.c...
Checking patch arch/sandbox/dts/test.dts...
Checking patch common/fdt_support.c...
Checking patch drivers/core/Kconfig...
Checking patch drivers/core/fdtaddr.c...
Checking patch drivers/core/of_addr.c...
Checking patch drivers/core/ofnode.c...
Checking patch drivers/core/root.c...
Checking patch include/asm-generic/global_data.h...
error: while searching for:
struct global_data *new_gd; /* relocated global data */

#ifdef CONFIG_DM

        struct udevice  *dm_root;       /* Root instance for Driver Model */
        struct udevice  *dm_root_f;     /* Pre-relocation root instance */
        struct list_head uclass_root;   /* Head of core tree */

error: patch failed: include/asm-generic/global_data.h:64
error: include/asm-generic/global_data.h: patch does not apply Checking patch test/dm/test-fdt.c...
Checking patch drivers/timer/omap-timer.c...
Checking patch drivers/misc/Kconfig...
...
Checking patch drivers/video/ti/Kconfig...
Checking patch drivers/video/ti/Makefile...
Checking patch drivers/video/am335x-fb.c => drivers/video/ti/am335x-fb.c... Checking patch drivers/video/am335x-fb.h => drivers/video/ti/am335x-fb.h... Checking patch drivers/video/tilcdc-panel.c => drivers/video/ti/tilcdc-panel.c...
error: drivers/video/tilcdc-panel.c: No such file or directory Checking patch drivers/video/tilcdc-panel.h => drivers/video/ti/tilcdc-panel.h...
error: drivers/video/tilcdc-panel.h: No such file or directory Checking patch drivers/video/tilcdc.c => drivers/video/ti/tilcdc.c...
error: drivers/video/tilcdc.c: No such file or directory Checking patch drivers/video/tilcdc.h => drivers/video/ti/tilcdc.h...
error: drivers/video/tilcdc.h: No such file or directory Checking patch board/ti/am335x/board.c...
Checking patch board/ti/am43xx/board.c...

Applying the patches 1 to 15 manually works but then patch 16 fails with:

Checking patch arch/sandbox/dts/test.dts... Checking patch common/fdt_support.c... Checking patch drivers/core/Kconfig... Checking patch drivers/core/fdtaddr.c... Checking patch drivers/core/of_addr.c... Checking patch drivers/core/ofnode.c... Checking patch drivers/core/root.c... Checking patch include/asm-generic/global_data.h...
error: while searching for:
struct global_data *new_gd; /* relocated global data */

#ifdef CONFIG_DM

        struct udevice  *dm_root;       /* Root instance for Driver Model */
        struct udevice  *dm_root_f;     /* Pre-relocation root instance */
        struct list_head uclass_root;   /* Head of core tree */

error: patch failed: include/asm-generic/global_data.h:64
error: include/asm-generic/global_data.h: patch does not apply Checking patch test/dm/test-fdt.c...

The include/asm-generic/global_data.h in the master does not have a line
reading 'struct global_data *new_gd; /* relocated global data */'.
Line 180 of the master include/asm-generic/global_data.h file however reads as follows: 'struct global_data *new_gd;'

regards Felix

#23 lore raw

v3 cover Add DM support for omap PWM backlight

Hi Felix,

Quoted 218 lines

Il 15/10/2020 10:53 Felix Brack <[email protected]> ha scritto:

Hello Dario,

Quoted 50 lines · Dario Binacchi
Quoted 49 lines

Il 14/10/2020 10:22 Felix Brack <[email protected]> ha scritto:

Quoted 43 lines · Dario Binacchi

The series was born from the need to manage the PWM backlight of the display connected to my beaglebone board. To hit the target, I had to develop drivers for PWM management which in turn relied on drivers for managing timers and clocks, all developed according to the driver model. My intention was to use the SoC-specific API only at strictly necessary points in the code. My previous patches for migrating the AM335x display driver to the driver model had required the implementation of additional functions outside the concerns of the driver, (settings for dividing the pixel clock rate, configuring the display DPLL rate, ....) not being able to use the API of the related clock drivers. This series shouldn't have repeated the same kind of mistake. Furthermore, I also wanted to fix that kind of forced choice. Almost everything should have been accessible via the driver model API. In the series there are also some patches that could be submitted separately, but which I have however inserted to avoid applying future patches to incorporate them.
With this last consideration, I hope I have convincingly justified the large number of patches in the series.

The patch enabling address translation into a CPU physical address from device-tree even in case of crossing levels with #size-cells = <0>, is crucial for the series. The previous implementation was unable to perform the address translation required by the am33xx device tree. I tried to apply in a conservative way as few changes as possible and to verify the execution of all the tests already developed, as well as the new ones I added for the new feature.

As recommended by Grygorii Strashko I have removed some patches to upload them in new different series:
- [v2,01/30] clk: remove a redundant header
- [v2,03/30] arch: sandbox: fix typo in clk.h
- [v2,20/30] video: backlight: fix pwm's duty cycle calculation
- [v2,21/30] video: backlight: fix pwm data structure description
- [v2,22/30] dm: core: improve uclass_get_device_by_phandle_id() description
- [v2,23/30] gpio: fix gpio_request_by_name() description

Grygorii suggested to remove also other patches that I have kept in the series to allow anyone who wants to be able to test it. Moreover after the addition of a patch that has largely changed the device tree. The patches removed are the one and only ones that do not affect the series in any way. I hope that the next version of this series will require only minimal changes allowing me to split it according to Grygorii's suggestions.
----

Quoted 7 lines
Quoted 3 lines

I must be missing something as this patch series does not apply without errors to U-Boot master:

Hi Felix,
I applied the patch of the series downloaded from patchwork on master and I compiled it without errors.

Did you do that against a recently cloned master?

Quoted 31 lines
Quoted 8 lines

error: drivers/clk/clk-ti-am3-dpll-x2.c: No such file or directory
error: drivers/clk/clk-ti-am3-dpll.c: No such file or directory
error: drivers/clk/clk-ti-ctrl.c: No such file or directory
error: drivers/clk/clk-ti-divider.c: No such file or directory
error: drivers/clk/clk-ti-gate.c: No such file or directory
error: drivers/clk/clk-ti-mux.c: No such file or directory
error: drivers/clk/clk-ti.c: No such file or directory
error: drivers/clk/clk-ti.h: No such file or directory

After applying the patch you should find:
ls drivers/clk/ti
am3-prcm.c
clk-am3-dpll.c
clk-am3-dpll-x2.c
clk.c
clk-ctrl.c
clk-divider.c
clk-gate.c
clk.h
clk-mux.c
clk-sci.c
Kconfig
Makefile
omap4-cm.c

Quoted 5 lines

error: drivers/video/tilcdc-panel.c: No such file or directory
error: drivers/video/tilcdc-panel.h: No such file or directory
error: drivers/video/tilcdc.c: No such file or directory
error: drivers/video/tilcdc.h: No such file or directory

Quoted 11 lines

and
ls drivers/video/ti
am335x-fb.c
am335x-fb.h
Kconfig
Makefile
tilcdc.c
tilcdc.h
tilcdc-panel.c
tilcdc-panel.h

As the patch series does not apply I don't see these files.

Quoted 8 lines
Quoted 1 line

Does it probably depend on some other patches?

No, the series patch does not depend on other patches

Quoted 2 lines

regards, Felix

Best regards
Dario

Two hours ago I did:

1. git clone https://gitlab.denx.de/u-boot/u-boot.git
2. downloaded Add-DM-support-for-omap-PWM-backlight.patch from
https://patchwork.ozlabs.org/project/uboot/list/?series=207124
3. git apply Add-DM-support-for-omap-PWM-backlight.patch --check -v

result:

Checking patch drivers/clk/clk-divider.c...
Checking patch include/linux/clk-provider.h...
Checking patch include/dt-bindings/bus/ti-sysc.h...
...
Checking patch drivers/clk/ti/Kconfig...
Checking patch drivers/clk/ti/Makefile...
Checking patch drivers/clk/clk-ti-am3-dpll-x2.c => drivers/clk/ti/clk-am3-dpll-x2.c...
error: drivers/clk/clk-ti-am3-dpll-x2.c: No such file or directory Checking patch drivers/clk/clk-ti-am3-dpll.c => drivers/clk/ti/clk-am3-dpll.c...
error: drivers/clk/clk-ti-am3-dpll.c: No such file or directory Checking patch drivers/clk/clk-ti-ctrl.c => drivers/clk/ti/clk-ctrl.c...
error: drivers/clk/clk-ti-ctrl.c: No such file or directory Checking patch drivers/clk/clk-ti-divider.c => drivers/clk/ti/clk-divider.c...
error: drivers/clk/clk-ti-divider.c: No such file or directory Checking patch drivers/clk/clk-ti-gate.c => drivers/clk/ti/clk-gate.c...
error: drivers/clk/clk-ti-gate.c: No such file or directory Checking patch drivers/clk/clk-ti-mux.c => drivers/clk/ti/clk-mux.c...
error: drivers/clk/clk-ti-mux.c: No such file or directory Checking patch drivers/clk/clk-ti-sci.c => drivers/clk/ti/clk-sci.c... Checking patch drivers/clk/clk-ti.c => drivers/clk/ti/clk.c...
error: drivers/clk/clk-ti.c: No such file or directory Checking patch drivers/clk/clk-ti.h => drivers/clk/ti/clk.h...
error: drivers/clk/clk-ti.h: No such file or directory Checking patch drivers/clk/ti/Makefile...
Checking patch drivers/clk/ti/omap4-cm.c...
Checking patch drivers/clk/ti/Makefile...
Checking patch drivers/clk/ti/am3-prcm.c...
Checking patch arch/sandbox/dts/test.dts...
Checking patch common/fdt_support.c...
Checking patch drivers/core/Kconfig...
Checking patch drivers/core/fdtaddr.c...
Checking patch drivers/core/of_addr.c...
Checking patch drivers/core/ofnode.c...
Checking patch drivers/core/root.c...
Checking patch include/asm-generic/global_data.h...
error: while searching for:
struct global_data *new_gd; /* relocated global data */

#ifdef CONFIG_DM

        struct udevice  *dm_root;       /* Root instance for Driver Model */
        struct udevice  *dm_root_f;     /* Pre-relocation root instance */
        struct list_head uclass_root;   /* Head of core tree */

error: patch failed: include/asm-generic/global_data.h:64
error: include/asm-generic/global_data.h: patch does not apply Checking patch test/dm/test-fdt.c...
Checking patch drivers/timer/omap-timer.c...
Checking patch drivers/misc/Kconfig...
...
Checking patch drivers/video/ti/Kconfig...
Checking patch drivers/video/ti/Makefile...
Checking patch drivers/video/am335x-fb.c => drivers/video/ti/am335x-fb.c... Checking patch drivers/video/am335x-fb.h => drivers/video/ti/am335x-fb.h... Checking patch drivers/video/tilcdc-panel.c => drivers/video/ti/tilcdc-panel.c...
error: drivers/video/tilcdc-panel.c: No such file or directory Checking patch drivers/video/tilcdc-panel.h => drivers/video/ti/tilcdc-panel.h...
error: drivers/video/tilcdc-panel.h: No such file or directory Checking patch drivers/video/tilcdc.c => drivers/video/ti/tilcdc.c...
error: drivers/video/tilcdc.c: No such file or directory Checking patch drivers/video/tilcdc.h => drivers/video/ti/tilcdc.h...
error: drivers/video/tilcdc.h: No such file or directory Checking patch board/ti/am335x/board.c...
Checking patch board/ti/am43xx/board.c...

Applying the patches 1 to 15 manually works but then patch 16 fails with:

Checking patch arch/sandbox/dts/test.dts... Checking patch common/fdt_support.c... Checking patch drivers/core/Kconfig... Checking patch drivers/core/fdtaddr.c... Checking patch drivers/core/of_addr.c... Checking patch drivers/core/ofnode.c... Checking patch drivers/core/root.c... Checking patch include/asm-generic/global_data.h...
error: while searching for:
struct global_data *new_gd; /* relocated global data */

#ifdef CONFIG_DM

        struct udevice  *dm_root;       /* Root instance for Driver Model */
        struct udevice  *dm_root_f;     /* Pre-relocation root instance */
        struct list_head uclass_root;   /* Head of core tree */

error: patch failed: include/asm-generic/global_data.h:64
error: include/asm-generic/global_data.h: patch does not apply Checking patch test/dm/test-fdt.c...

Quoted 6 lines

The include/asm-generic/global_data.h in the master does not have a line
reading 'struct global_data *new_gd; /* relocated global data */'.
Line 180 of the master include/asm-generic/global_data.h file however reads as follows: 'struct global_data *new_gd;'

regards Felix

Try with:
1. cd /tmp
2. git clone https://gitlab.denx.de/u-boot/u-boot.git
3. cd /tmp/u-boot
4. git checkout -b omap-pwm 9885313b9a
5. git am Add-DM-support-for-omap-PWM-backlight.patch

Regards,
Dario

#24 lore raw

v3 cover Add DM support for omap PWM backlight

Hello Dario,

Quoted 225 lines · Dario Binacchi

Hi Felix,

Quoted 223 lines

Il 15/10/2020 10:53 Felix Brack <[email protected]> ha scritto:

Hello Dario,

Quoted 50 lines · Dario Binacchi
Quoted 49 lines

Il 14/10/2020 10:22 Felix Brack <[email protected]> ha scritto:

Quoted 43 lines · Dario Binacchi

The series was born from the need to manage the PWM backlight of the display connected to my beaglebone board. To hit the target, I had to develop drivers for PWM management which in turn relied on drivers for managing timers and clocks, all developed according to the driver model. My intention was to use the SoC-specific API only at strictly necessary points in the code. My previous patches for migrating the AM335x display driver to the driver model had required the implementation of additional functions outside the concerns of the driver, (settings for dividing the pixel clock rate, configuring the display DPLL rate, ....) not being able to use the API of the related clock drivers. This series shouldn't have repeated the same kind of mistake. Furthermore, I also wanted to fix that kind of forced choice. Almost everything should have been accessible via the driver model API. In the series there are also some patches that could be submitted separately, but which I have however inserted to avoid applying future patches to incorporate them.
With this last consideration, I hope I have convincingly justified the large number of patches in the series.

The patch enabling address translation into a CPU physical address from device-tree even in case of crossing levels with #size-cells = <0>, is crucial for the series. The previous implementation was unable to perform the address translation required by the am33xx device tree. I tried to apply in a conservative way as few changes as possible and to verify the execution of all the tests already developed, as well as the new ones I added for the new feature.

As recommended by Grygorii Strashko I have removed some patches to upload them in new different series:
- [v2,01/30] clk: remove a redundant header
- [v2,03/30] arch: sandbox: fix typo in clk.h
- [v2,20/30] video: backlight: fix pwm's duty cycle calculation
- [v2,21/30] video: backlight: fix pwm data structure description
- [v2,22/30] dm: core: improve uclass_get_device_by_phandle_id() description
- [v2,23/30] gpio: fix gpio_request_by_name() description

Grygorii suggested to remove also other patches that I have kept in the series to allow anyone who wants to be able to test it. Moreover after the addition of a patch that has largely changed the device tree. The patches removed are the one and only ones that do not affect the series in any way. I hope that the next version of this series will require only minimal changes allowing me to split it according to Grygorii's suggestions.
----

Quoted 7 lines
Quoted 3 lines

I must be missing something as this patch series does not apply without errors to U-Boot master:

Hi Felix,
I applied the patch of the series downloaded from patchwork on master and I compiled it without errors.

Did you do that against a recently cloned master?

Quoted 31 lines
Quoted 8 lines

error: drivers/clk/clk-ti-am3-dpll-x2.c: No such file or directory
error: drivers/clk/clk-ti-am3-dpll.c: No such file or directory
error: drivers/clk/clk-ti-ctrl.c: No such file or directory
error: drivers/clk/clk-ti-divider.c: No such file or directory
error: drivers/clk/clk-ti-gate.c: No such file or directory
error: drivers/clk/clk-ti-mux.c: No such file or directory
error: drivers/clk/clk-ti.c: No such file or directory
error: drivers/clk/clk-ti.h: No such file or directory

After applying the patch you should find:
ls drivers/clk/ti
am3-prcm.c
clk-am3-dpll.c
clk-am3-dpll-x2.c
clk.c
clk-ctrl.c
clk-divider.c
clk-gate.c
clk.h
clk-mux.c
clk-sci.c
Kconfig
Makefile
omap4-cm.c

Quoted 5 lines

error: drivers/video/tilcdc-panel.c: No such file or directory
error: drivers/video/tilcdc-panel.h: No such file or directory
error: drivers/video/tilcdc.c: No such file or directory
error: drivers/video/tilcdc.h: No such file or directory

Quoted 11 lines

and
ls drivers/video/ti
am335x-fb.c
am335x-fb.h
Kconfig
Makefile
tilcdc.c
tilcdc.h
tilcdc-panel.c
tilcdc-panel.h

As the patch series does not apply I don't see these files.

Quoted 8 lines
Quoted 1 line

Does it probably depend on some other patches?

No, the series patch does not depend on other patches

Quoted 2 lines

regards, Felix

Best regards
Dario

Two hours ago I did:

1. git clone https://gitlab.denx.de/u-boot/u-boot.git
2. downloaded Add-DM-support-for-omap-PWM-backlight.patch from
https://patchwork.ozlabs.org/project/uboot/list/?series=207124
3. git apply Add-DM-support-for-omap-PWM-backlight.patch --check -v

result:

Checking patch drivers/clk/clk-divider.c...
Checking patch include/linux/clk-provider.h...
Checking patch include/dt-bindings/bus/ti-sysc.h...
...
Checking patch drivers/clk/ti/Kconfig...
Checking patch drivers/clk/ti/Makefile...
Checking patch drivers/clk/clk-ti-am3-dpll-x2.c => drivers/clk/ti/clk-am3-dpll-x2.c...
error: drivers/clk/clk-ti-am3-dpll-x2.c: No such file or directory Checking patch drivers/clk/clk-ti-am3-dpll.c => drivers/clk/ti/clk-am3-dpll.c...
error: drivers/clk/clk-ti-am3-dpll.c: No such file or directory Checking patch drivers/clk/clk-ti-ctrl.c => drivers/clk/ti/clk-ctrl.c...
error: drivers/clk/clk-ti-ctrl.c: No such file or directory Checking patch drivers/clk/clk-ti-divider.c => drivers/clk/ti/clk-divider.c...
error: drivers/clk/clk-ti-divider.c: No such file or directory Checking patch drivers/clk/clk-ti-gate.c => drivers/clk/ti/clk-gate.c...
error: drivers/clk/clk-ti-gate.c: No such file or directory Checking patch drivers/clk/clk-ti-mux.c => drivers/clk/ti/clk-mux.c...
error: drivers/clk/clk-ti-mux.c: No such file or directory Checking patch drivers/clk/clk-ti-sci.c => drivers/clk/ti/clk-sci.c... Checking patch drivers/clk/clk-ti.c => drivers/clk/ti/clk.c...
error: drivers/clk/clk-ti.c: No such file or directory Checking patch drivers/clk/clk-ti.h => drivers/clk/ti/clk.h...
error: drivers/clk/clk-ti.h: No such file or directory Checking patch drivers/clk/ti/Makefile...
Checking patch drivers/clk/ti/omap4-cm.c...
Checking patch drivers/clk/ti/Makefile...
Checking patch drivers/clk/ti/am3-prcm.c...
Checking patch arch/sandbox/dts/test.dts...
Checking patch common/fdt_support.c...
Checking patch drivers/core/Kconfig...
Checking patch drivers/core/fdtaddr.c...
Checking patch drivers/core/of_addr.c...
Checking patch drivers/core/ofnode.c...
Checking patch drivers/core/root.c...
Checking patch include/asm-generic/global_data.h...
error: while searching for:
struct global_data *new_gd; /* relocated global data */

#ifdef CONFIG_DM

        struct udevice  *dm_root;       /* Root instance for Driver Model */
        struct udevice  *dm_root_f;     /* Pre-relocation root instance */
        struct list_head uclass_root;   /* Head of core tree */

error: patch failed: include/asm-generic/global_data.h:64
error: include/asm-generic/global_data.h: patch does not apply Checking patch test/dm/test-fdt.c...
Checking patch drivers/timer/omap-timer.c...
Checking patch drivers/misc/Kconfig...
...
Checking patch drivers/video/ti/Kconfig...
Checking patch drivers/video/ti/Makefile...
Checking patch drivers/video/am335x-fb.c => drivers/video/ti/am335x-fb.c... Checking patch drivers/video/am335x-fb.h => drivers/video/ti/am335x-fb.h... Checking patch drivers/video/tilcdc-panel.c => drivers/video/ti/tilcdc-panel.c...
error: drivers/video/tilcdc-panel.c: No such file or directory Checking patch drivers/video/tilcdc-panel.h => drivers/video/ti/tilcdc-panel.h...
error: drivers/video/tilcdc-panel.h: No such file or directory Checking patch drivers/video/tilcdc.c => drivers/video/ti/tilcdc.c...
error: drivers/video/tilcdc.c: No such file or directory Checking patch drivers/video/tilcdc.h => drivers/video/ti/tilcdc.h...
error: drivers/video/tilcdc.h: No such file or directory Checking patch board/ti/am335x/board.c...
Checking patch board/ti/am43xx/board.c...

Applying the patches 1 to 15 manually works but then patch 16 fails with:

Checking patch arch/sandbox/dts/test.dts... Checking patch common/fdt_support.c... Checking patch drivers/core/Kconfig... Checking patch drivers/core/fdtaddr.c... Checking patch drivers/core/of_addr.c... Checking patch drivers/core/ofnode.c... Checking patch drivers/core/root.c... Checking patch include/asm-generic/global_data.h...
error: while searching for:
struct global_data *new_gd; /* relocated global data */

#ifdef CONFIG_DM

        struct udevice  *dm_root;       /* Root instance for Driver Model */
        struct udevice  *dm_root_f;     /* Pre-relocation root instance */
        struct list_head uclass_root;   /* Head of core tree */

error: patch failed: include/asm-generic/global_data.h:64
error: include/asm-generic/global_data.h: patch does not apply Checking patch test/dm/test-fdt.c...

The include/asm-generic/global_data.h in the master does not have a line
reading 'struct global_data *new_gd; /* relocated global data */'.
Line 180 of the master include/asm-generic/global_data.h file however reads as follows: 'struct global_data *new_gd;'

Quoted 7 lines
Quoted 1 line

regards Felix

Try with:
1. cd /tmp
2. git clone https://gitlab.denx.de/u-boot/u-boot.git
3. cd /tmp/u-boot
4. git checkout -b omap-pwm 9885313b9a

No, I won't. It will be a pleasure to me testing this patch series on the board I'm maintaining, but only after it applies cleanly to the HEAD of the U-Boot master branch. Meanwhile I suggest you add a comment about the required starting point in the repository to all future versions of this patch series.

Quoted 5 lines

5. git am Add-DM-support-for-omap-PWM-backlight.patch

Regards,
Dario

regards, Felix

#25 lore raw

v3 cover Add DM support for omap PWM backlight

Hi Felix,

Quoted 231 lines

Il 16/10/2020 10:41 Felix Brack <[email protected]> ha scritto:

Hello Dario,

Quoted 225 lines · Dario Binacchi

Hi Felix,

Quoted 223 lines

Il 15/10/2020 10:53 Felix Brack <[email protected]> ha scritto:

Hello Dario,

Quoted 50 lines · Dario Binacchi
Quoted 49 lines

Il 14/10/2020 10:22 Felix Brack <[email protected]> ha scritto:

Quoted 43 lines · Dario Binacchi

The series was born from the need to manage the PWM backlight of the display connected to my beaglebone board. To hit the target, I had to develop drivers for PWM management which in turn relied on drivers for managing timers and clocks, all developed according to the driver model. My intention was to use the SoC-specific API only at strictly necessary points in the code. My previous patches for migrating the AM335x display driver to the driver model had required the implementation of additional functions outside the concerns of the driver, (settings for dividing the pixel clock rate, configuring the display DPLL rate, ....) not being able to use the API of the related clock drivers. This series shouldn't have repeated the same kind of mistake. Furthermore, I also wanted to fix that kind of forced choice. Almost everything should have been accessible via the driver model API. In the series there are also some patches that could be submitted separately, but which I have however inserted to avoid applying future patches to incorporate them.
With this last consideration, I hope I have convincingly justified the large number of patches in the series.

The patch enabling address translation into a CPU physical address from device-tree even in case of crossing levels with #size-cells = <0>, is crucial for the series. The previous implementation was unable to perform the address translation required by the am33xx device tree. I tried to apply in a conservative way as few changes as possible and to verify the execution of all the tests already developed, as well as the new ones I added for the new feature.

As recommended by Grygorii Strashko I have removed some patches to upload them in new different series:
- [v2,01/30] clk: remove a redundant header
- [v2,03/30] arch: sandbox: fix typo in clk.h
- [v2,20/30] video: backlight: fix pwm's duty cycle calculation
- [v2,21/30] video: backlight: fix pwm data structure description
- [v2,22/30] dm: core: improve uclass_get_device_by_phandle_id() description
- [v2,23/30] gpio: fix gpio_request_by_name() description

Grygorii suggested to remove also other patches that I have kept in the series to allow anyone who wants to be able to test it. Moreover after the addition of a patch that has largely changed the device tree. The patches removed are the one and only ones that do not affect the series in any way. I hope that the next version of this series will require only minimal changes allowing me to split it according to Grygorii's suggestions.
----

Quoted 7 lines
Quoted 3 lines

I must be missing something as this patch series does not apply without errors to U-Boot master:

Hi Felix,
I applied the patch of the series downloaded from patchwork on master and I compiled it without errors.

Did you do that against a recently cloned master?

Quoted 31 lines
Quoted 8 lines

error: drivers/clk/clk-ti-am3-dpll-x2.c: No such file or directory
error: drivers/clk/clk-ti-am3-dpll.c: No such file or directory
error: drivers/clk/clk-ti-ctrl.c: No such file or directory
error: drivers/clk/clk-ti-divider.c: No such file or directory
error: drivers/clk/clk-ti-gate.c: No such file or directory
error: drivers/clk/clk-ti-mux.c: No such file or directory
error: drivers/clk/clk-ti.c: No such file or directory
error: drivers/clk/clk-ti.h: No such file or directory

After applying the patch you should find:
ls drivers/clk/ti
am3-prcm.c
clk-am3-dpll.c
clk-am3-dpll-x2.c
clk.c
clk-ctrl.c
clk-divider.c
clk-gate.c
clk.h
clk-mux.c
clk-sci.c
Kconfig
Makefile
omap4-cm.c

Quoted 5 lines

error: drivers/video/tilcdc-panel.c: No such file or directory
error: drivers/video/tilcdc-panel.h: No such file or directory
error: drivers/video/tilcdc.c: No such file or directory
error: drivers/video/tilcdc.h: No such file or directory

Quoted 11 lines

and
ls drivers/video/ti
am335x-fb.c
am335x-fb.h
Kconfig
Makefile
tilcdc.c
tilcdc.h
tilcdc-panel.c
tilcdc-panel.h

As the patch series does not apply I don't see these files.

Quoted 8 lines
Quoted 1 line

Does it probably depend on some other patches?

No, the series patch does not depend on other patches

Quoted 2 lines

regards, Felix

Best regards
Dario

Two hours ago I did:

1. git clone https://gitlab.denx.de/u-boot/u-boot.git
2. downloaded Add-DM-support-for-omap-PWM-backlight.patch from
https://patchwork.ozlabs.org/project/uboot/list/?series=207124
3. git apply Add-DM-support-for-omap-PWM-backlight.patch --check -v

result:

Checking patch drivers/clk/clk-divider.c...
Checking patch include/linux/clk-provider.h...
Checking patch include/dt-bindings/bus/ti-sysc.h...
...
Checking patch drivers/clk/ti/Kconfig...
Checking patch drivers/clk/ti/Makefile...
Checking patch drivers/clk/clk-ti-am3-dpll-x2.c => drivers/clk/ti/clk-am3-dpll-x2.c...
error: drivers/clk/clk-ti-am3-dpll-x2.c: No such file or directory Checking patch drivers/clk/clk-ti-am3-dpll.c => drivers/clk/ti/clk-am3-dpll.c...
error: drivers/clk/clk-ti-am3-dpll.c: No such file or directory Checking patch drivers/clk/clk-ti-ctrl.c => drivers/clk/ti/clk-ctrl.c...
error: drivers/clk/clk-ti-ctrl.c: No such file or directory Checking patch drivers/clk/clk-ti-divider.c => drivers/clk/ti/clk-divider.c...
error: drivers/clk/clk-ti-divider.c: No such file or directory Checking patch drivers/clk/clk-ti-gate.c => drivers/clk/ti/clk-gate.c...
error: drivers/clk/clk-ti-gate.c: No such file or directory Checking patch drivers/clk/clk-ti-mux.c => drivers/clk/ti/clk-mux.c...
error: drivers/clk/clk-ti-mux.c: No such file or directory Checking patch drivers/clk/clk-ti-sci.c => drivers/clk/ti/clk-sci.c... Checking patch drivers/clk/clk-ti.c => drivers/clk/ti/clk.c...
error: drivers/clk/clk-ti.c: No such file or directory Checking patch drivers/clk/clk-ti.h => drivers/clk/ti/clk.h...
error: drivers/clk/clk-ti.h: No such file or directory Checking patch drivers/clk/ti/Makefile...
Checking patch drivers/clk/ti/omap4-cm.c...
Checking patch drivers/clk/ti/Makefile...
Checking patch drivers/clk/ti/am3-prcm.c...
Checking patch arch/sandbox/dts/test.dts...
Checking patch common/fdt_support.c...
Checking patch drivers/core/Kconfig...
Checking patch drivers/core/fdtaddr.c...
Checking patch drivers/core/of_addr.c...
Checking patch drivers/core/ofnode.c...
Checking patch drivers/core/root.c...
Checking patch include/asm-generic/global_data.h...
error: while searching for:
struct global_data *new_gd; /* relocated global data */

#ifdef CONFIG_DM

        struct udevice  *dm_root;       /* Root instance for Driver Model */
        struct udevice  *dm_root_f;     /* Pre-relocation root instance */
        struct list_head uclass_root;   /* Head of core tree */

error: patch failed: include/asm-generic/global_data.h:64
error: include/asm-generic/global_data.h: patch does not apply Checking patch test/dm/test-fdt.c...
Checking patch drivers/timer/omap-timer.c...
Checking patch drivers/misc/Kconfig...
...
Checking patch drivers/video/ti/Kconfig...
Checking patch drivers/video/ti/Makefile...
Checking patch drivers/video/am335x-fb.c => drivers/video/ti/am335x-fb.c... Checking patch drivers/video/am335x-fb.h => drivers/video/ti/am335x-fb.h... Checking patch drivers/video/tilcdc-panel.c => drivers/video/ti/tilcdc-panel.c...
error: drivers/video/tilcdc-panel.c: No such file or directory Checking patch drivers/video/tilcdc-panel.h => drivers/video/ti/tilcdc-panel.h...
error: drivers/video/tilcdc-panel.h: No such file or directory Checking patch drivers/video/tilcdc.c => drivers/video/ti/tilcdc.c...
error: drivers/video/tilcdc.c: No such file or directory Checking patch drivers/video/tilcdc.h => drivers/video/ti/tilcdc.h...
error: drivers/video/tilcdc.h: No such file or directory Checking patch board/ti/am335x/board.c...
Checking patch board/ti/am43xx/board.c...

Applying the patches 1 to 15 manually works but then patch 16 fails with:

Checking patch arch/sandbox/dts/test.dts... Checking patch common/fdt_support.c... Checking patch drivers/core/Kconfig... Checking patch drivers/core/fdtaddr.c... Checking patch drivers/core/of_addr.c... Checking patch drivers/core/ofnode.c... Checking patch drivers/core/root.c... Checking patch include/asm-generic/global_data.h...
error: while searching for:
struct global_data *new_gd; /* relocated global data */

#ifdef CONFIG_DM

        struct udevice  *dm_root;       /* Root instance for Driver Model */
        struct udevice  *dm_root_f;     /* Pre-relocation root instance */
        struct list_head uclass_root;   /* Head of core tree */

error: patch failed: include/asm-generic/global_data.h:64
error: include/asm-generic/global_data.h: patch does not apply Checking patch test/dm/test-fdt.c...

The include/asm-generic/global_data.h in the master does not have a line
reading 'struct global_data *new_gd; /* relocated global data */'.
Line 180 of the master include/asm-generic/global_data.h file however reads as follows: 'struct global_data *new_gd;'

Quoted 8 lines
Quoted 7 lines
Quoted 1 line

regards Felix

Try with:
1. cd /tmp
2. git clone https://gitlab.denx.de/u-boot/u-boot.git
3. cd /tmp/u-boot
4. git checkout -b omap-pwm 9885313b9a

No, I won't.

Commit 9885313b9a was the HEAD of the master branch no more than a week ago when I uploaded the series. The series is made up of 27 patches, so it is not surprising that there is some conflict a week later if you want to apply the series to the HEAD of the master branch. As you can see, the commit 9885313b9a is dated 12 October 2020.

Quoted 2 lines

It will be a pleasure to me testing this patch series on the board I'm maintaining,

I appreciate it and I thank you

Quoted 2 lines

but only after it applies cleanly to the HEAD of the U-Boot master branch.

However if this is a problem, I will rebase the patch series on master and upload it to patchwork as version 4.

Quoted 3 lines

Meanwhile I suggest you add a comment about
the required starting point in the repository to all future versions of this patch series.

I'll do it for the next versions.

Quoted 8 lines
Quoted 6 lines

5. git am Add-DM-support-for-omap-PWM-backlight.patch

Regards,
Dario

regards, Felix

Regards,
Dario