From: Wolfram Sang <wsa@kernel.org>
To: Conor Dooley <conor.dooley@microchip.com>
Cc: linux-i2c@vger.kernel.org, ben.dooks@codethink.co.uk,
linux-kernel@vger.kernel.org, linux-riscv@lists.infradead.org,
daire.mcnamara@microchip.com
Subject: Re: [PATCH v6 1/2] i2c: add support for microchip fpga i2c controllers
Date: Wed, 6 Jul 2022 09:19:20 +0200 [thread overview]
Message-ID: <YsU3eLA3PrceFS65@shikoro> (raw)
In-Reply-To: <20220621074238.957177-1-conor.dooley@microchip.com>
[-- Attachment #1: Type: text/plain, Size: 2397 bytes --]
Hi Conor,
thank you for sending this driver.
On Tue, Jun 21, 2022 at 08:42:38AM +0100, Conor Dooley wrote:
> Add Microchip CoreI2C i2c controller support. This driver supports the
> "hard" i2c controller on the Microchip PolarFire SoC & the basic feature
> set for "soft" i2c controller implemtations in the FPGA fabric.
>
> Co-developed-by: Daire McNamara <daire.mcnamara@microchip.com>
> Signed-off-by: Daire McNamara <daire.mcnamara@microchip.com>
> Signed-off-by: Conor Dooley <conor.dooley@microchip.com>
Where are the bindings? Are they already on the way upstream?
> drivers/i2c/busses/i2c-microchip-core.c | 486 ++++++++++++++++++++++++
The biggest remark I have is to rename the driver a little. Usually a
"-core" suffix means that there are other drivers like "-platform" or
"-pci" use this core. Would "i2c-microchip-fpga" or
"i2c-microchip-corei2c" work for you?
> +#include <linux/clk.h>
> +#include <linux/clkdev.h>
> +#include <linux/err.h>
> +#include <linux/i2c.h>
> +#include <linux/iopoll.h>
Do you really need that?
...
> +static irqreturn_t mchp_corei2c_handle_isr(struct mchp_corei2c_dev *idev)
> +{
> + u32 status = idev->isr_status;
> + u8 ctrl;
> + bool last_byte = false, finished = false;
> +
> + if (!idev->buf)
> + return IRQ_NONE;
> +
> + switch (status) {
> + case STATUS_M_START_SENT:
> + case STATUS_M_REPEATED_START_SENT:
> + ctrl = readb(idev->base + CORE_I2C_CTRL);
> + ctrl &= ~CTRL_STA;
> + writeb(idev->addr, idev->base + CORE_I2C_DATA);
> + writeb(ctrl, idev->base + CORE_I2C_CTRL);
> + if (idev->msg_len <= 0)
> + finished = true;
How can it happen that len is < 0? Wouldn't that be an error case?
...
> +static u32 mchp_corei2c_func(struct i2c_adapter *adap)
> +{
> + return I2C_FUNC_I2C | I2C_FUNC_SMBUS_EMUL;
Have you testes SMBUS_QUICK as well?
...
> + idev->dev = &pdev->dev;
> + init_completion(&idev->msg_complete);
> + spin_lock_init(&idev->lock);
You never use this lock.
...
> + 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;
> + idev->adapter.timeout = MICROCHIP_I2C_TIMEOUT;
Simply use HZ here?
All in all, only minor stuff. Driver looks really good in general.
Thanks and happy hacking,
Wolfram
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2022-07-06 7:19 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-06-21 7:42 [PATCH v6 1/2] i2c: add support for microchip fpga i2c controllers Conor Dooley
2022-06-21 7:42 ` [PATCH v6 2/2] MAINTAINERS: add the polarfire soc's i2c driver Conor Dooley
2022-07-06 7:21 ` Wolfram Sang
2022-07-06 7:41 ` Conor.Dooley
2022-07-06 7:19 ` Wolfram Sang [this message]
2022-07-06 8:03 ` [PATCH v6 1/2] i2c: add support for microchip fpga i2c controllers Conor.Dooley
2022-07-06 10:32 ` Wolfram Sang
2022-07-06 10:50 ` Conor.Dooley
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=YsU3eLA3PrceFS65@shikoro \
--to=wsa@kernel.org \
--cc=ben.dooks@codethink.co.uk \
--cc=conor.dooley@microchip.com \
--cc=daire.mcnamara@microchip.com \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-riscv@lists.infradead.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;
as well as URLs for NNTP newsgroup(s).