From: <Conor.Dooley@microchip.com>
To: <wsa@kernel.org>
Cc: <linux-i2c@vger.kernel.org>, <ben.dooks@codethink.co.uk>,
<Daire.McNamara@microchip.com>, <linux-kernel@vger.kernel.org>,
<linux-riscv@lists.infradead.org>
Subject: Re: [PATCH v3] i2c: add support for microchip fpga i2c controllers
Date: Sat, 21 May 2022 11:27:01 +0000 [thread overview]
Message-ID: <dbf6073c-0814-ec25-cec5-cb3cf9c931d8@microchip.com> (raw)
In-Reply-To: <Yoi1bV95l7+thgS5@shikoro>
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
_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv
next prev parent reply other threads:[~2022-05-21 11:27 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-16 7:33 [PATCH v3] i2c: add support for microchip fpga i2c controllers Conor Dooley
2022-05-21 9:48 ` Wolfram Sang
2022-05-21 11:27 ` Conor.Dooley [this message]
2022-05-21 11:28 ` Wolfram Sang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=dbf6073c-0814-ec25-cec5-cb3cf9c931d8@microchip.com \
--to=conor.dooley@microchip.com \
--cc=Daire.McNamara@microchip.com \
--cc=ben.dooks@codethink.co.uk \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.org \
--cc=wsa@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox