From: Andy Shevchenko <andriy.shevchenko-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
To: Tali Perry <tali.perry1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
Cc: brendanhiggins-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
avifishman70-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
tmaimon77-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
kfting-KrzQf0k3Iz9BDgjK7y7TUQ@public.gmane.org,
venture-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
yuenn-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
benjaminfair-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org,
robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org,
linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
openbmc-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
Subject: Re: [PATCH v9 3/3] i2c: npcm7xx: Add support for slave mode for Nuvoton
Date: Mon, 23 Mar 2020 18:01:58 +0200 [thread overview]
Message-ID: <20200323160158.GR1922688@smile.fi.intel.com> (raw)
In-Reply-To: <20200323134437.259210-4-tali.perry1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
On Mon, Mar 23, 2020 at 03:44:37PM +0200, Tali Perry wrote:
> Add support for slave mode for Nuvoton
> NPCM BMC I2C controller driver.
Same comments apply as per previous patch.
...
> +#if IS_ENABLED(CONFIG_I2C_SLAVE)
Perhaps create a separate module and compile it when user selects?
See I²C DesignWare split.
...
> +#if IS_ENABLED(CONFIG_I2C_SLAVE)
> + if (bus->slave) {
> + npcm_i2c_slave_enable_l(bus, I2C_SLAVE_ADDR1, bus->slave->addr,
> + true);
> + }
Put it on one line and drop {} -- it will be much better to read.
> +#endif
...
> +static void npcm_i2c_write_to_fifo_slave(struct npcm_i2c *bus,
> + u16 max_bytes_to_send)
> +{
> + // Fill the FIFO, while the FIFO is not full and there are more bytes to
> + // write
> + npcm_i2c_clear_fifo_int(bus);
> + npcm_i2c_clear_tx_fifo(bus);
> + iowrite8(0, bus->reg + NPCM_I2CTXF_CTL);
> +
> + while ((max_bytes_to_send--) && (I2C_HW_FIFO_SIZE -
> + npcm_i2c_get_fifo_fullness(bus))) {
> + if (bus->slv_wr_size > 0) {
> + npcm_i2c_wr_byte(bus,
> + bus->slv_wr_buf[bus->slv_wr_ind %
> + I2C_HW_FIFO_SIZE]);
> + bus->slv_wr_ind = (bus->slv_wr_ind + 1) %
> + I2C_HW_FIFO_SIZE;
> + bus->slv_wr_size--; // size indicates the # of bytes in
> + // the SW FIFO, not HW.
> + } else {
> + break;
> + }
This looks ugly. Can you redo the style.
> + }
> +}
...
> +#if IS_ENABLED(CONFIG_I2C_SLAVE)
> + if (bus->slave) {
> + bus->slv_rd_buf[bus->slv_rd_ind %
> + I2C_HW_FIFO_SIZE] = data;
> + bus->slv_rd_ind++;
> + if (bus->slv_rd_ind == 1 && bus->read_block_use)
> + // 1st byte is length in block protocol
> + bus->slv_rd_size = data +
> + (u8)bus->PEC_use +
> + (u8)bus->read_block_use;
> + }
> +#endif
Ditto.
...
> I2C_FUNC_SMBUS_EMUL |
> I2C_FUNC_SMBUS_BLOCK_DATA |
> I2C_FUNC_SMBUS_PEC
> +#if IS_ENABLED(CONFIG_I2C_SLAVE)
> + | I2C_FUNC_SLAVE
> +#endif
Completely inconsistent style.
> ;
--
With Best Regards,
Andy Shevchenko
prev parent reply other threads:[~2020-03-23 16:01 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-23 13:44 [PATCH v9 0/3] i2c: npcm7xx: add NPCM i2c controller driver Tali Perry
2020-03-23 13:44 ` [PATCH v9 1/3] dt-bindings: i2c: npcm7xx: add NPCM I2C controller Tali Perry
[not found] ` <20200323134437.259210-2-tali.perry1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-03-23 15:03 ` Andy Shevchenko
2020-03-23 13:44 ` [PATCH v9 2/3] i2c: npcm7xx: Add Nuvoton NPCM I2C controller driver Tali Perry
[not found] ` <20200323134437.259210-3-tali.perry1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-03-23 15:56 ` Andy Shevchenko
2020-03-23 13:44 ` [PATCH v9 3/3] i2c: npcm7xx: Add support for slave mode for Nuvoton Tali Perry
[not found] ` <20200323134437.259210-4-tali.perry1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2020-03-23 16:01 ` Andy Shevchenko [this message]
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=20200323160158.GR1922688@smile.fi.intel.com \
--to=andriy.shevchenko-vuqaysv1563yd54fqh9/ca@public.gmane.org \
--cc=avifishman70-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=benjaminfair-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=brendanhiggins-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=kfting-KrzQf0k3Iz9BDgjK7y7TUQ@public.gmane.org \
--cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
--cc=linux-i2c-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
--cc=openbmc-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=robh+dt-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
--cc=tali.perry1-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=tmaimon77-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
--cc=venture-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.org \
--cc=wsa-z923LK4zBo2bacvFa/9K2g@public.gmane.org \
--cc=yuenn-hpIqsD4AKlfQT0dZR+AlfA@public.gmane.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).