mbox series

[v3,0/9] Add Mobileye EyeQ system controller support (clk, reset, pinctrl)

Message ID 20240620-mbly-olb-v3-0-5f29f8ca289c@bootlin.com (mailing list archive)
Headers show
Series Add Mobileye EyeQ system controller support (clk, reset, pinctrl) | expand

Message

Théo Lebrun June 20, 2024, 5:30 p.m. UTC
Hello,

This builds on previous Mobileye EyeQ system-controller revisions,
supporting EyeQ5, EyeQ6L and EyeQ6H. We expose a few OLB
system-controller features here:
 - Clocks: some read-only PLLs derived from main crystal and some
   divider clocks based on PLLs.
 - Resets.
 - Pin controller, only on EyeQ5 (others will use pinctrl-single).

EyeQ6H is special in that it has seven instances of this
system-controller. Those are spread around and cannot be seen as a
single device, hence are exposed as seven DT nodes and seven
unique compatibles.

Following feedback (that took time to reach my brain, sorry about that):
 - We expose each system-controller as a single devicetree node. This
   means reverting previously accepted dt-bindings that described a
   one-node-per-feature approach.
 - We use auxiliary devices infrastructure to split functionality into
   separate drivers. Clock is the platform driver that spawns child
   auxdevs. They get an iomem pointer to the OLB region as
   platform_data. They know which behavior to implement by matching
   compatible on their parent device's OF node.

Patches are targeting MIPS, clk, reset and pinctrl:

MIPS:
 - dt-bindings: soc: mobileye: add EyeQ OLB system controller
 - MIPS: mobileye: eyeq5: add OLB system-controller node

clk:
 - Revert "dt-bindings: clock: mobileye,eyeq5-clk: add bindings"
 - clk: divider: Introduce CLK_DIVIDER_EVEN_INTEGERS flag
 - clk: eyeq: add driver

reset:
 - Revert "dt-bindings: reset: mobileye,eyeq5-reset: add bindings"
 - reset: eyeq: add platform driver

pinctrl:
 - Revert "dt-bindings: pinctrl: mobileye,eyeq5-pinctrl: add bindings"
 - pinctrl: eyeq5: add platform driver

Have a nice day,
Théo

Signed-off-by: Théo Lebrun <theo.lebrun@bootlin.com>
---
Changes in v3:
- Drivers: Switch to using auxiliary devices. Drop the MFD patches.
  Consequent changes to the clk driver that now spawns its auxdevs.
  Reset and pinctrl switch from being platform driver to auxdevs.
- dt-bindings and EyeQ5 DTS: remove "simple-mfd" compatible from all OLB
  nodes.
- dt-bindings: rewrite commit title and messages. Title now takes the
  standard revert format.
- dt-bindings: revert pinctrl dt-bindings as well; this was forgotten in
  the previous revision.
- clk driver: fix overflow of factors; they get stored in 32-bit ints in
  fixed-factor which we overflowed when spread-spectrum is enabled.
- Link to v2: https://lore.kernel.org/r/20240503-mbly-olb-v2-0-95ce5a1e18fe@bootlin.com

Changes in v2:
- dt-bindings:
  - Drop mobileye,eyeq5-clk and mobileye,eyeq5-reset bindings.
  - Update OLB bindings to handle clk/reset/pinctrl from OLB node.
- MFD:
  - Add core driver and MFD patches to allow setting sub-devices names
    from MFD cell.
  - Add MFD OLB driver.
- clk:
  - Change type of eqc_pll->reg64 from u32 to unsigned int.
  - Use resource indexes rather than names for iomem resources.
  - Put early PLLs into a separate match data table. Also, have store
    number of late clocks in early match data to properly alloc cells.
  - Pre-acquire all divclk resources first, then register them.
    This simplifies code.
  - Extract PLLs and divclks init to two separate functions.
  - Avoid variable declarations in loop bodies.
  - Do not register match data table to platform driver. It gets probed
    as MFD sub-device matching on driver name. Match data table is
    matched against parent OF node compatible.
  - Fix ugly memory corruption bug when clk count == 1.
- reset:
  - EQR_EYEQ5_SARCR and EQR_EYEQ6H_SARCR did not use offset 0x0: do
    minus four to all their offsets and reduce resource sizes.
  - Remove resource names. Reset i uses iomem resource index i.
  - Simplify xlate: have two implementations for of_reset_n_cells==1 and
    of_reset_n_cells==2. Both call the same helper internal function.
  - Do not register match data table to platform driver. It gets probed
    as MFD sub-device matching on driver name. Match data table is
    matched against parent OF node compatible.
- pinctrl:
  - Remove match data table to platform driver. It gets probed as MFD
    sub-device matching on driver name. Driver has single compatible.
  - Drop "Reviewed-by: Linus Walleij" as driver changed approach.
- MIPS DTS:
  - Squash all commits together into a single one.
  - Adapt to new approach: OLB is now a single OF node.
- Link to v1: https://lore.kernel.org/r/20240410-mbly-olb-v1-0-335e496d7be3@bootlin.com

---
Théo Lebrun (9):
      Revert "dt-bindings: clock: mobileye,eyeq5-clk: add bindings"
      Revert "dt-bindings: reset: mobileye,eyeq5-reset: add bindings"
      Revert "dt-bindings: pinctrl: mobileye,eyeq5-pinctrl: add bindings"
      dt-bindings: soc: mobileye: add EyeQ OLB system controller
      clk: divider: Introduce CLK_DIVIDER_EVEN_INTEGERS flag
      clk: eyeq: add driver
      reset: eyeq: add platform driver
      pinctrl: eyeq5: add platform driver
      MIPS: mobileye: eyeq5: add OLB system-controller node

 .../bindings/clock/mobileye,eyeq5-clk.yaml         |  51 --
 .../bindings/reset/mobileye,eyeq5-reset.yaml       |  43 --
 .../mobileye/mobileye,eyeq5-olb.yaml}              | 168 ++++-
 MAINTAINERS                                        |   5 +
 .../{eyeq5-fixed-clocks.dtsi => eyeq5-clocks.dtsi} |  54 +-
 arch/mips/boot/dts/mobileye/eyeq5-pins.dtsi        | 125 ++++
 arch/mips/boot/dts/mobileye/eyeq5.dtsi             |  22 +-
 drivers/clk/Kconfig                                |  12 +
 drivers/clk/Makefile                               |   1 +
 drivers/clk/clk-divider.c                          |  12 +-
 drivers/clk/clk-eyeq.c                             | 789 +++++++++++++++++++++
 drivers/pinctrl/Kconfig                            |  15 +
 drivers/pinctrl/Makefile                           |   1 +
 drivers/pinctrl/pinctrl-eyeq5.c                    | 576 +++++++++++++++
 drivers/reset/Kconfig                              |  14 +
 drivers/reset/Makefile                             |   1 +
 drivers/reset/reset-eyeq.c                         | 563 +++++++++++++++
 include/dt-bindings/clock/mobileye,eyeq5-clk.h     |  21 +
 include/linux/clk-provider.h                       |  11 +-
 19 files changed, 2326 insertions(+), 158 deletions(-)
---
base-commit: 061f2865f17c038f04a71ccdd6c90746381d63a8
change-id: 20240408-mbly-olb-75a85f5cfde3

Best regards,