Message ID | f0b979221dedec7db9cab201388bf44c0d987a3d.1590594293.git-series.maxime@cerno.tech (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | clk: bcm: rpi: Add support for BCM2711 firmware clocks | expand |
On Wed, 2020-05-27 at 17:44 +0200, Maxime Ripard wrote: > The firmware clocks driver was previously probed through a platform_device > created by the firmware driver. > > Since we will now have a node for that clocks driver, we need to create the > device only in the case where there's no node for it already. > > Signed-off-by: Maxime Ripard <maxime@cerno.tech> > --- Reviewed-by: Nicolas Saenz Julienne <nsaenzjulienne@suse.de> Regards, Nicolas > drivers/firmware/raspberrypi.c | 14 ++++++++++++++ > 1 file changed, 14 insertions(+) > > diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c > index ef8098856a47..b25901a77c09 100644 > --- a/drivers/firmware/raspberrypi.c > +++ b/drivers/firmware/raspberrypi.c > @@ -208,6 +208,20 @@ rpi_register_hwmon_driver(struct device *dev, struct > rpi_firmware *fw) > > static void rpi_register_clk_driver(struct device *dev) > { > + struct device_node *firmware; > + > + /* > + * Earlier DTs don't have a node for the firmware clocks but > + * rely on us creating a platform device by hand. If we do > + * have a node for the firmware clocks, just bail out here. > + */ > + firmware = of_get_compatible_child(dev->of_node, > + "raspberrypi,firmware-clocks"); > + if (firmware) { > + of_node_put(firmware); > + return; > + } > + > rpi_clk = platform_device_register_data(dev, "raspberrypi-clk", > -1, NULL, 0); > }
diff --git a/drivers/firmware/raspberrypi.c b/drivers/firmware/raspberrypi.c index ef8098856a47..b25901a77c09 100644 --- a/drivers/firmware/raspberrypi.c +++ b/drivers/firmware/raspberrypi.c @@ -208,6 +208,20 @@ rpi_register_hwmon_driver(struct device *dev, struct rpi_firmware *fw) static void rpi_register_clk_driver(struct device *dev) { + struct device_node *firmware; + + /* + * Earlier DTs don't have a node for the firmware clocks but + * rely on us creating a platform device by hand. If we do + * have a node for the firmware clocks, just bail out here. + */ + firmware = of_get_compatible_child(dev->of_node, + "raspberrypi,firmware-clocks"); + if (firmware) { + of_node_put(firmware); + return; + } + rpi_clk = platform_device_register_data(dev, "raspberrypi-clk", -1, NULL, 0); }
The firmware clocks driver was previously probed through a platform_device created by the firmware driver. Since we will now have a node for that clocks driver, we need to create the device only in the case where there's no node for it already. Signed-off-by: Maxime Ripard <maxime@cerno.tech> --- drivers/firmware/raspberrypi.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+)