[PATCH v4 00/27] Add DM support for omap PWM backlight

Dario Binacchi
2020-10-19T16:46:31Z

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.

The patch series can be cleanly applied to the HEAD of the master which
at the time of release points to 3d19a7ee8c commit.

Changes in v4:
- Include device_compat.h header for dev_xxx macros.
- Remove a blank line at end of file arch/arm/dts/am33xx-l4.dtsi.
- Update clk_round_rate description.
- Add Sean Anderson review.
- Include device_compat.h header for dev_xxx macros.
- Include device_compat.h header for dev_xxx macros.
- Fix compilation errors on the dev parameter of the dev_xx macros.
- Include device_compat.h header for dev_xxx macros.
- Fix compilation errors on the dev parameter of the dev_xx macros.
- Include device_compat.h header for dev_xxx macros.
- Include device_compat.h header for dev_xxx macros.
- Fix compilation errors on the dev parameter of the dev_xx macros.
- Include device_compat.h header for dev_xxx macros.
- Add Sphinx documentation for dm_flags.
- Convert GD_DM_FLG_* to enum.
- Include device_compat.h header in test/dm/test-fdt.c for dev_xxx macros.
- Include device_compat.h header for dev_xxx macros.
- Include device_compat.h header for dev_xxx macros.
- Include device_compat.h header for dev_xxx macros.
- Add Simon Glass review.
- Include device_compat.h header for dev_xxx macros.

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 | 1962 ++++++++++++++++++++
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 | 166 ++
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 | 66 +
drivers/clk/ti/clk-am3-dpll-x2.c | 79 +
drivers/clk/ti/clk-am3-dpll.c | 268 +++
drivers/clk/ti/clk-ctrl.c | 154 ++
drivers/clk/ti/clk-divider.c | 381 ++++
drivers/clk/ti/clk-gate.c | 93 +
drivers/clk/ti/clk-mux.c | 253 +++
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 | 82 +
drivers/pwm/Kconfig | 7 +
drivers/pwm/Makefile | 1 +
drivers/pwm/pwm-ti-ehrpwm.c | 468 +++++
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 | 172 ++
drivers/video/ti/tilcdc-panel.h | 14 +
drivers/video/ti/tilcdc.c | 425 +++++
drivers/video/ti/tilcdc.h | 38 +
include/asm-generic/global_data.h | 18 +
include/clk-uclass.h | 8 +
include/clk.h | 28 +
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 | 149 +-
84 files changed, 5799 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

--
2.17.1