Re: Advice on MFD-style probing of DSA switch SoCs

From: Krzysztof Kozlowski
Date: Fri Dec 23 2022 - 03:44:25 EST


On 22/12/2022 14:48, Vladimir Oltean wrote:
> Hi,


(...)

> To add interrupts in a naive way, similar to how other DSA drivers have
> done it, it would have to be done like this:
>
> #include <dt-bindings/interrupt-controller/nxp-sja1110-acu-slir.h>
>
> sw2: ethernet-switch@2 {
> compatible = "nxp,sja1110a";
> reg = <2>;
> spi-max-frequency = <4000000>;
> spi-cpol;
> dsa,member = <0 1>;
>
> slir2: interrupt-controller {
> compatible = "nxp,sja1110-acu-slir";
> interrupt-controller;
> #interrupt-cells = <1>;
> interrupt-parent = <&gpio 10>;
> };
>
> ethernet-ports {
> #address-cells = <1>;
> #size-cells = <0>;
>


just trim the code... we do not need to scroll over unrelated pieces.

> };
>
> mdios {
> #address-cells = <1>;
> #size-cells = <0>;
>
> mdio@0 {
> compatible = "nxp,sja1110-base-t1-mdio";
> #address-cells = <1>;
> #size-cells = <0>;
> reg = <0>;
>
> sw2_port5_base_t1_phy: ethernet-phy@1 {
> compatible = "ethernet-phy-ieee802.3-c45";
> reg = <0x1>;
> interrupts-extended = <&slir2 SJA1110_IRQ_CBT1_PHY1>;
> };
>

...

> };
> };
>
> However, the irq_domain/irqchip handling code in this case will go to
> drivers/net/dsa/, and it won't really be a "driver" (there is no struct

Why? Devicetree hierarchy has nothing to do with Linux driver hierarchy
and nothing stops you from putting irqchip code in respective directory
for such DT. Your parent device can be MFD, can be same old DSA switch
driver etc. Several options.

Best regards,
Krzysztof