lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:   Mon, 10 Jan 2022 06:37:01 +0000
From:   qinjian[覃健] <qinjian@...lus1.com>
To:     Stephen Boyd <sboyd@...nel.org>,
        "robh+dt@...nel.org" <robh+dt@...nel.org>
CC:     "mturquette@...libre.com" <mturquette@...libre.com>,
        "tglx@...utronix.de" <tglx@...utronix.de>,
        "maz@...nel.org" <maz@...nel.org>,
        "p.zabel@...gutronix.de" <p.zabel@...gutronix.de>,
        "linux@...linux.org.uk" <linux@...linux.org.uk>,
        "broonie@...nel.org" <broonie@...nel.org>,
        "arnd@...db.de" <arnd@...db.de>,
        "stefan.wahren@...e.com" <stefan.wahren@...e.com>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-clk@...r.kernel.org" <linux-clk@...r.kernel.org>,
        Wells Lu 呂芳騰 <wells.lu@...plus.com>
Subject: RE: [PATCH v7 06/10] clk: Add Sunplus SP7021 clock driver

> > > > +
> > > > +CLK_OF_DECLARE_DRIVER(sp_clkc, "sunplus,sp7021-clkc", sp_clk_setup);
> > >
> > > Why CLK_OF_DECLARE_DRIVER? There should be a comment but better would be
> > > to make a platform driver instead. If the platform driver can't be used,
> > > we need to know what other device driver is probing based on this clkc
> > > compatible string.
> >
> > Dear Stephen,
> >
> > Sorry, I don't understand your comment.
> > Did you mean, like below:
> >
> > static int sp7021_clk_probe(struct platform_device *pdev)
> > {
> >         ......
> >         sp_clk_data->num = CLK_MAX;
> >         return devm_of_clk_add_hw_provider(dev, of_clk_hw_onecell_get, sp_clk_data);
> > }
> >
> > static const struct of_device_id sp7021_clk_dt_ids[] = {
> >         { .compatible = "sunplus,sp7021-clkc", },
> >         { }
> > };
> > MODULE_DEVICE_TABLE(of, sp7021_clk_dt_ids);
> >
> > static struct platform_driver sp7021_clk_driver = {
> >         .probe  = sp7021_clk_probe,
> >         .driver = {
> >                 .name = "sp7021-clk",
> >                 .of_match_table = sp7021_clk_dt_ids,
> >         },
> > };
> > builtin_platform_driver(sp7021_clk_driver);
> >
> >
> > But, It's doesn't work.
> 
> Why doesn't it work?
> 
> > Most other clk drivers used CLK_OF_DECLARE_DRIVER or CLK_OF_DECLARE.
> > I just take these as the reference and it's working.
> 
> CLK_OF_DECLARE is for clks that need to be registered so the main
> irqchip and/or clocksource/clockevent can operate properly.
> CLK_OF_DECLARE_DRIVER is for the case that there's another driver that
> will attach to the device node that has the compatible string.

After some trace, I found:
In our dts, 'clkc' node defined @ clocks:
	clocks {
		...
		clkc: clock-controller@...00000 {
			#clock-cells = <1>;
			compatible = "sunplus,sp7021-clkc";
			reg = <0x9c000000 0x280>; // G0:CLKEN ~ G4:PLL
			clocks = <&extclk>, <&clkc PLL_SYS>;
			clock-names = "extclk", "pllsys";
		};
	};
	soc {
		...
	}
In this case, clk driver write as platform driver not work (sp7021_clk_probe not called)
But, CLK_OF_DECLARE and CLK_OF_DECLARE_DRIVER both worked (called from clk_of_init)

Then, I move the 'clkc' mode from 'clocks' to 'soc':
	clocks {
		...
	};
	soc {
		...
		clkc: clock-controller@...00000 {
			#clock-cells = <1>;
			compatible = "sunplus,sp7021-clkc";
			reg = <0x9c000000 0x280>; // G0:CLKEN ~ G4:PLL
			clocks = <&extclk>, <&clkc PLL_SYS>;
			clock-names = "extclk", "pllsys";
		};
	}
In this case, clk driver write as platform driver worked (called from platform_probe)
CLK_OF_DECLARE and CLK_OF_DECLARE_DRIVER also both worked. (still called from clk_of_init, more early than platform_probe)

It looks like CLK_OF_DECLARE/CLK_OF_DECLARE_DRIVER is better than platform driver.
Why you prefer platform driver?


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ