Message ID | 20240821105943.230281-12-ada@thorsis.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | Microchip OTPC driver on SAM9X60 exposing UIDxR as additional nvmem device | expand |
Hi Alexander,
kernel test robot noticed the following build warnings:
[auto build test WARNING on 47ac09b91befbb6a235ab620c32af719f8208399]
url: https://github.com/intel-lab-lkp/linux/commits/Alexander-Dahl/nvmem-microchip-otpc-Avoid-writing-a-write-only-register/20240821-193942
base: 47ac09b91befbb6a235ab620c32af719f8208399
patch link: https://lore.kernel.org/r/20240821105943.230281-12-ada%40thorsis.com
patch subject: [PATCH v1 11/12] nvmem: microchip-otpc: Enable main RC oscillator clock
config: x86_64-buildonly-randconfig-001-20240822 (https://download.01.org/0day-ci/archive/20240822/202408222300.BEv0hBO5-lkp@intel.com/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20240822/202408222300.BEv0hBO5-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202408222300.BEv0hBO5-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/nvmem/microchip-otpc.c:61: warning: Function parameter or struct member 'clk' not described in 'mchp_otpc'
vim +61 drivers/nvmem/microchip-otpc.c
98830350d3fc82 Claudiu Beznea 2022-07-06 47
98830350d3fc82 Claudiu Beznea 2022-07-06 48 /**
98830350d3fc82 Claudiu Beznea 2022-07-06 49 * struct mchp_otpc - OTPC private data structure
98830350d3fc82 Claudiu Beznea 2022-07-06 50 * @base: base address
98830350d3fc82 Claudiu Beznea 2022-07-06 51 * @dev: struct device pointer
98830350d3fc82 Claudiu Beznea 2022-07-06 52 * @packets: list of packets in OTP memory
98830350d3fc82 Claudiu Beznea 2022-07-06 53 * @npackets: number of packets in OTP memory
98830350d3fc82 Claudiu Beznea 2022-07-06 54 */
98830350d3fc82 Claudiu Beznea 2022-07-06 55 struct mchp_otpc {
98830350d3fc82 Claudiu Beznea 2022-07-06 56 void __iomem *base;
98830350d3fc82 Claudiu Beznea 2022-07-06 57 struct device *dev;
1acc431703527a Alexander Dahl 2024-08-21 58 struct clk *clk;
98830350d3fc82 Claudiu Beznea 2022-07-06 59 struct list_head packets;
98830350d3fc82 Claudiu Beznea 2022-07-06 60 u32 npackets;
98830350d3fc82 Claudiu Beznea 2022-07-06 @61 };
98830350d3fc82 Claudiu Beznea 2022-07-06 62
On 21.08.2024 13:59, Alexander Dahl wrote: > Without enabling that clock, initializing the packet list leads to a > read timeout on the first packet. > > According to SAM9X60 datasheet (DS60001579G) section "23.4 Product > Dependencies" the clock must be enabled for reading and writing. > > Tested on sam9x60-curiosity board. > > Signed-off-by: Alexander Dahl <ada@thorsis.com> > --- > drivers/nvmem/microchip-otpc.c | 11 +++++++++++ > 1 file changed, 11 insertions(+) > > diff --git a/drivers/nvmem/microchip-otpc.c b/drivers/nvmem/microchip-otpc.c > index a80535c3d162..047ca5ac6407 100644 > --- a/drivers/nvmem/microchip-otpc.c > +++ b/drivers/nvmem/microchip-otpc.c > @@ -8,6 +8,7 @@ > */ > > #include <linux/bitfield.h> > +#include <linux/clk.h> > #include <linux/dev_printk.h> > #include <linux/iopoll.h> > #include <linux/module.h> > @@ -54,6 +55,7 @@ > struct mchp_otpc { > void __iomem *base; > struct device *dev; > + struct clk *clk; > struct list_head packets; > u32 npackets; > }; > @@ -272,6 +274,15 @@ static int mchp_otpc_probe(struct platform_device *pdev) > if (IS_ERR(otpc->base)) > return PTR_ERR(otpc->base); > > + // NOTE: Maybe make this optional, especially if sama7g5 testing Looking though DS, on SAMA7G5 the clock here should be MCK0. I think it should be added for SAMA7G5, too, with a fixes tag. > + // shows the clock is not required there? Use C style comments /* comment */ > + otpc->clk = devm_clk_get_enabled(&pdev->dev, "main_rc_osc"); Maybe name it "bus-clk", "bus" or something otpc specific. > + if (IS_ERR(otpc->clk)) { > + dev_err(&pdev->dev, "Error (%ld) getting clock!\n", > + PTR_ERR(otpc->clk)); > + return PTR_ERR(otpc->clk); return dev_err_probe(). > + } > + > reg = readl_relaxed(otpc->base + MCHP_OTPC_WPSR); > if (reg) > dev_warn(&pdev->dev,
diff --git a/drivers/nvmem/microchip-otpc.c b/drivers/nvmem/microchip-otpc.c index a80535c3d162..047ca5ac6407 100644 --- a/drivers/nvmem/microchip-otpc.c +++ b/drivers/nvmem/microchip-otpc.c @@ -8,6 +8,7 @@ */ #include <linux/bitfield.h> +#include <linux/clk.h> #include <linux/dev_printk.h> #include <linux/iopoll.h> #include <linux/module.h> @@ -54,6 +55,7 @@ struct mchp_otpc { void __iomem *base; struct device *dev; + struct clk *clk; struct list_head packets; u32 npackets; }; @@ -272,6 +274,15 @@ static int mchp_otpc_probe(struct platform_device *pdev) if (IS_ERR(otpc->base)) return PTR_ERR(otpc->base); + // NOTE: Maybe make this optional, especially if sama7g5 testing + // shows the clock is not required there? + otpc->clk = devm_clk_get_enabled(&pdev->dev, "main_rc_osc"); + if (IS_ERR(otpc->clk)) { + dev_err(&pdev->dev, "Error (%ld) getting clock!\n", + PTR_ERR(otpc->clk)); + return PTR_ERR(otpc->clk); + } + reg = readl_relaxed(otpc->base + MCHP_OTPC_WPSR); if (reg) dev_warn(&pdev->dev,
Without enabling that clock, initializing the packet list leads to a read timeout on the first packet. According to SAM9X60 datasheet (DS60001579G) section "23.4 Product Dependencies" the clock must be enabled for reading and writing. Tested on sam9x60-curiosity board. Signed-off-by: Alexander Dahl <ada@thorsis.com> --- drivers/nvmem/microchip-otpc.c | 11 +++++++++++ 1 file changed, 11 insertions(+)