[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <dbf6073c-0814-ec25-cec5-cb3cf9c931d8@microchip.com>
Date: Sat, 21 May 2022 11:27:01 +0000
From: <Conor.Dooley@...rochip.com>
To: <wsa@...nel.org>
CC: <linux-i2c@...r.kernel.org>, <ben.dooks@...ethink.co.uk>,
<Daire.McNamara@...rochip.com>, <linux-kernel@...r.kernel.org>,
<linux-riscv@...ts.infradead.org>
Subject: Re: [PATCH v3] i2c: add support for microchip fpga i2c controllers
On 21/05/2022 10:48, Wolfram Sang wrote:
> EXTERNAL EMAIL: Do not click links or open attachments unless you know the content is safe
> >
> Hi Conor,
>
> driver looks mostly good, but some comments:
>
Hey Wolfram, thanks for the review.
It'll be a few days before I can actually get back to you, but:
---8<---
>
> > + dev_info(&pdev->dev, "default to 100kHz\n");
> > + idev->bus_clk_rate = 100000;
> > + }
> > +
> > + if (idev->bus_clk_rate > 400000)
> > + return dev_err_probe(&pdev->dev, -EINVAL,
> > + "clock-frequency too high: %d\n",
> > + idev->bus_clk_rate);
> > +
> > + ret = devm_request_irq(&pdev->dev, irq, mchp_corei2c_isr, IRQF_SHARED,
> > + pdev->name, idev);
>
> Really SHARED?
Yeah, this driver supports both the hard peripherals & soft FPGA cores.
The hard peripherals do not have shared IRQs, but we don't really have
any control over what way the interrupts are wired for the soft cores.
Worth adding a comment to explain the reason for it being shared?
Thanks,
Conor.
>
> > + if (ret)
> > + return dev_err_probe(&pdev->dev, ret,
> > + "failed to claim irq %d\n", irq);
> > +
> > + ret = clk_prepare_enable(idev->i2c_clk);
> > + if (ret)
> > + return dev_err_probe(&pdev->dev, ret,
> > + "failed to enable clock\n");
> > +
> > + ret = mchp_corei2c_init(idev);
> > + if (ret) {
> > + clk_disable_unprepare(idev->i2c_clk);
> > + return dev_err_probe(&pdev->dev, ret, "failed to program clock divider\n");
> > + }
> > +
> > + i2c_set_adapdata(&idev->adapter, idev);
> > + snprintf(idev->adapter.name, sizeof(idev->adapter.name),
> > + "Microchip I2C hw bus");
>
> Most people add something like the base address here to distinguish
> multiple instances.
>
> > + idev->adapter.owner = THIS_MODULE;
> > + idev->adapter.algo = &mchp_corei2c_algo;
> > + idev->adapter.dev.parent = &pdev->dev;
> > + idev->adapter.dev.of_node = pdev->dev.of_node;
> > +
> > + platform_set_drvdata(pdev, idev);
> > +
> > + ret = i2c_add_adapter(&idev->adapter);
> > + if (ret) {
> > + clk_disable_unprepare(idev->i2c_clk);
> > + return ret;
> > + }
> > +
> > + dev_info(&pdev->dev, "Microchip I2C Probe Complete\n");
> > +
> > + return 0;
> > +}
>
> Rest looks good, Thank you for the submission.
>
> All the best,
>
> Wolfram
Powered by blists - more mailing lists