[net-next PATCH v5 06/10] net: pcs: Add Xilinx PCS driver
kernel test robot
lkp at intel.com
Sat May 24 02:25:00 PDT 2025
Hi Sean,
kernel test robot noticed the following build warnings:
[auto build test WARNING on net-next/main]
url: https://github.com/intel-lab-lkp/linux/commits/Sean-Anderson/dt-bindings-net-Add-Xilinx-PCS/20250524-043901
base: net-next/main
patch link: https://lore.kernel.org/r/20250523203339.1993685-7-sean.anderson%40linux.dev
patch subject: [net-next PATCH v5 06/10] net: pcs: Add Xilinx PCS driver
config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20250524/202505241748.uSxf3hT5-lkp@intel.com/config)
compiler: clang version 18.1.8 (https://github.com/llvm/llvm-project 3b5b5c1ec4a3095ab096dd780e84d7ab81f3d7ff)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250524/202505241748.uSxf3hT5-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 at intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202505241748.uSxf3hT5-lkp@intel.com/
All warnings (new ones prefixed by >>):
>> drivers/net/pcs/pcs-xilinx.c:295:2: warning: label at end of compound statement is a C23 extension [-Wc23-extensions]
295 | }
| ^
1 warning generated.
vim +295 drivers/net/pcs/pcs-xilinx.c
240
241 static int xilinx_pcs_probe(struct mdio_device *mdiodev)
242 {
243 struct device *dev = &mdiodev->dev;
244 struct fwnode_handle *fwnode = dev->fwnode;
245 int ret, i, j, mode_count;
246 struct xilinx_pcs *xp;
247 const char **modes;
248 u32 phy_id;
249
250 xp = devm_kzalloc(dev, sizeof(*xp), GFP_KERNEL);
251 if (!xp)
252 return -ENOMEM;
253 xp->mdiodev = mdiodev;
254 dev_set_drvdata(dev, xp);
255
256 xp->irq = fwnode_irq_get_byname(fwnode, "an");
257 /* There's no _optional variant, so this is the best we've got */
258 if (xp->irq < 0 && xp->irq != -EINVAL)
259 return dev_err_probe(dev, xp->irq, "could not get IRQ\n");
260
261 mode_count = fwnode_property_string_array_count(fwnode,
262 "xlnx,pcs-modes");
263 if (!mode_count)
264 mode_count = -ENODATA;
265 if (mode_count < 0) {
266 dev_err(dev, "could not read xlnx,pcs-modes: %d", mode_count);
267 return mode_count;
268 }
269
270 modes = kcalloc(mode_count, sizeof(*modes), GFP_KERNEL);
271 if (!modes)
272 return -ENOMEM;
273
274 ret = fwnode_property_read_string_array(fwnode, "xlnx,pcs-modes",
275 modes, mode_count);
276 if (ret < 0) {
277 dev_err(dev, "could not read xlnx,pcs-modes: %d\n", ret);
278 kfree(modes);
279 return ret;
280 }
281
282 for (i = 0; i < mode_count; i++) {
283 for (j = 0; j < ARRAY_SIZE(xilinx_pcs_interfaces); j++) {
284 if (!strcmp(phy_modes(xilinx_pcs_interfaces[j]), modes[i])) {
285 __set_bit(xilinx_pcs_interfaces[j],
286 xp->pcs.supported_interfaces);
287 goto next;
288 }
289 }
290
291 dev_err(dev, "invalid pcs-mode \"%s\"\n", modes[i]);
292 kfree(modes);
293 return -EINVAL;
294 next:
> 295 }
296
297 kfree(modes);
298 if ((test_bit(PHY_INTERFACE_MODE_SGMII, xp->pcs.supported_interfaces) ||
299 test_bit(PHY_INTERFACE_MODE_1000BASEX, xp->pcs.supported_interfaces)) &&
300 test_bit(PHY_INTERFACE_MODE_2500BASEX, xp->pcs.supported_interfaces)) {
301 dev_err(dev,
302 "Switching from SGMII or 1000Base-X to 2500Base-X not supported\n");
303 return -EINVAL;
304 }
305
306 xp->reset = devm_gpiod_get_optional(dev, "reset", GPIOD_OUT_HIGH);
307 if (IS_ERR(xp->reset))
308 return dev_err_probe(dev, PTR_ERR(xp->reset),
309 "could not get reset gpio\n");
310
311 xp->done = devm_gpiod_get_optional(dev, "done", GPIOD_IN);
312 if (IS_ERR(xp->done))
313 return dev_err_probe(dev, PTR_ERR(xp->done),
314 "could not get done gpio\n");
315
316 xp->refclk = devm_clk_get_optional_enabled(dev, "refclk");
317 if (IS_ERR(xp->refclk))
318 return dev_err_probe(dev, PTR_ERR(xp->refclk),
319 "could not get/enable reference clock\n");
320
321 gpiod_set_value_cansleep(xp->reset, 0);
322 if (xp->done) {
323 if (read_poll_timeout(gpiod_get_value_cansleep, ret, ret, 1000,
324 100000, true, xp->done))
325 return dev_err_probe(dev, -ETIMEDOUT,
326 "timed out waiting for reset\n");
327 } else {
328 /* Just wait for a while and hope we're done */
329 usleep_range(50000, 100000);
330 }
331
332 if (fwnode_property_present(fwnode, "#clock-cells")) {
333 const char *parent = "refclk";
334 struct clk_init_data init = {
335 .name = fwnode_get_name(fwnode),
336 .ops = &xilinx_pcs_clk_ops,
337 .parent_names = &parent,
338 .num_parents = 1,
339 .flags = 0,
340 };
341
342 xp->refclk_out.init = &init;
343 ret = devm_clk_hw_register(dev, &xp->refclk_out);
344 if (ret)
345 return dev_err_probe(dev, ret,
346 "could not register refclk\n");
347
348 ret = devm_of_clk_add_hw_provider(dev, of_clk_hw_simple_get,
349 &xp->refclk_out);
350 if (ret)
351 return dev_err_probe(dev, ret,
352 "could not register refclk\n");
353 }
354
355 /* Sanity check */
356 ret = get_phy_c22_id(mdiodev->bus, mdiodev->addr, &phy_id);
357 if (ret)
358 return dev_err_probe(dev, ret, "could not read id\n");
359 if ((phy_id & 0xfffffff0) != 0x01740c00)
360 dev_warn(dev, "unknown phy id %x\n", phy_id);
361
362 if (xp->irq < 0) {
363 xp->pcs.poll = true;
364 } else {
365 /* The IRQ is enabled by default; turn it off */
366 ret = mdiodev_write(xp->mdiodev, XILINX_PCS_ANICR, 0);
367 if (ret) {
368 dev_err(dev, "could not disable IRQ: %d\n", ret);
369 return ret;
370 }
371
372 /* Some PCSs have a bad habit of re-enabling their IRQ!
373 * Request the IRQ in probe so we don't end up triggering the
374 * spurious IRQ logic.
375 */
376 ret = devm_request_threaded_irq(dev, xp->irq, NULL, xilinx_pcs_an_irq,
377 IRQF_SHARED | IRQF_ONESHOT,
378 dev_name(dev), xp);
379 if (ret) {
380 dev_err(dev, "could not request IRQ: %d\n", ret);
381 return ret;
382 }
383 }
384
385 xp->pcs.ops = &xilinx_pcs_ops;
386 ret = devm_pcs_register(dev, &xp->pcs);
387 if (ret)
388 return dev_err_probe(dev, ret, "could not register PCS\n");
389
390 if (xp->irq < 0)
391 dev_info(dev, "probed with irq=poll\n");
392 else
393 dev_info(dev, "probed with irq=%d\n", xp->irq);
394 return 0;
395 }
396
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
More information about the linux-arm-kernel
mailing list