Port-arm archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: FDT syscon driver



How to access it is dictated by the binding spec for your device. You need some way to find the phandle. Two methods I have encountered:

 1. A property on your device node has an xref to the syscon. Might look
    something like this:

      rockchip,grf = <&grf>;

    To use this in your driver:

      syscon = fdtbus_syscon_acquire(phandle, "rockchip,grf");

 2. A device node is the child of a node that is compatible with syscon:

      usb2phy_grf: syscon@ff450000 {
        compatible = "rockchip,rk3328-usb2phy-grf", "syscon", "simple-mfd";
        ...
        u2phy: usb2-phy@100 {
          compatible = "rockchip,rk3328-usb2phy";
          ...
        }
      }

    In this case, you can look it up directly by phandle from the child:

      syscon = fdtbus_syscon_lookup(OF_parent(phandle));


Lookup by device unit is not allowed because any relationship between nodes must be defined in the DT. Device units are not predictable and it's possible that a more specific driver could attach to that node, to implement the syscon interface with additional functionality.

Cheers,
Jared


On Sun, 1 Jul 2018, Robert Swindells wrote:


How do we use this ?

Would it be possible for each instance to print the name of the property
that would be needed to locate it ?

Maybe we could have an alternative lookup function that takes a
numeric argument to match against syscon0, syscon1, etc...

Robert Swindells




Home | Main Index | Thread Index | Old Index