Re: [PATCH v1 net-next] net: dsa: microchip: add KSZ9477 I2C driver

2019-01-10 Thread Sergio Paracuellos
On Wed, Dec 19, 2018 at 4:41 AM wrote: > > From: Tristram Ha > > Add KSZ9477 I2C driver support. The code ksz9477.c and ksz_common.c are > used together to generate the I2C driver. > > Signed-off-by: Tristram Ha > --- > v1 > - Return error code from i2c_transfer > - Change GPL license > - Chang

Re: [PATCH v1 net-next] net: dsa: microchip: add KSZ9477 I2C driver

2019-01-09 Thread Marek Vasut
On 1/9/19 5:05 PM, Pavel Machek wrote: > On Wed 2018-12-19 22:50:16, tristram...@microchip.com wrote: >>> This header file makes no sense. Please move the functions into .c >> >> No, that would make code bigger & slower. >> >> It makes sense to me. But I'd add "inline" keyword t

Re: [PATCH v1 net-next] net: dsa: microchip: add KSZ9477 I2C driver

2019-01-09 Thread Pavel Machek
On Wed 2018-12-19 22:50:16, tristram...@microchip.com wrote: > > This header file makes no sense. Please move the functions into .c > > >>> > > >>> No, that would make code bigger & slower. > > >>> > > >>> It makes sense to me. But I'd add "inline" keyword to make the goal > > >>> explicit. >

Re: [PATCH v1 net-next] net: dsa: microchip: add KSZ9477 I2C driver

2018-12-21 Thread Marek Vasut
On 12/21/2018 01:23 PM, Dan Carpenter wrote: > On Fri, Dec 21, 2018 at 01:14:51PM +0100, Marek Vasut wrote: >> On 12/21/2018 10:29 AM, Dan Carpenter wrote: >>> On Wed, Dec 19, 2018 at 10:50:16PM +, tristram...@microchip.com wrote: So if I change the new code, should I go back to corre

Re: [PATCH v1 net-next] net: dsa: microchip: add KSZ9477 I2C driver

2018-12-21 Thread Dan Carpenter
On Fri, Dec 21, 2018 at 01:14:51PM +0100, Marek Vasut wrote: > On 12/21/2018 10:29 AM, Dan Carpenter wrote: > > On Wed, Dec 19, 2018 at 10:50:16PM +, tristram...@microchip.com wrote: > >> > >> So if I change the new code, should I go back to correct the old code? > > > > Other operating system

Re: [PATCH v1 net-next] net: dsa: microchip: add KSZ9477 I2C driver

2018-12-21 Thread Marek Vasut
On 12/21/2018 10:29 AM, Dan Carpenter wrote: > On Wed, Dec 19, 2018 at 10:50:16PM +, tristram...@microchip.com wrote: >> >> So if I change the new code, should I go back to correct the old code? > > Other operating systems would worry about breaking code which is working > fine, but re-writing

Re: [PATCH v1 net-next] net: dsa: microchip: add KSZ9477 I2C driver

2018-12-21 Thread Dan Carpenter
On Wed, Dec 19, 2018 at 10:50:16PM +, tristram...@microchip.com wrote: > > So if I change the new code, should I go back to correct the old code? Other operating systems would worry about breaking code which is working fine, but re-writing ancient code is The Linux Way. regards, dan carpenter

Re: [PATCH v1 net-next] net: dsa: microchip: add KSZ9477 I2C driver

2018-12-20 Thread Marek Vasut
On 12/21/2018 01:48 AM, tristram...@microchip.com wrote: Well, I just did 'git grep regmap_i2c drivers' and 'git grep regmap_spi drivers/' and found eg. drivers/iio/pressure/zpa2326_i2c.c drivers/iio/pressure/zpa2326_spi.c There's plenty of drivers using regmap in driv

RE: [PATCH v1 net-next] net: dsa: microchip: add KSZ9477 I2C driver

2018-12-20 Thread Tristram.Ha
> >> Well, I just did 'git grep regmap_i2c drivers' and 'git grep regmap_spi > >> drivers/' and found eg. > >> drivers/iio/pressure/zpa2326_i2c.c > >> drivers/iio/pressure/zpa2326_spi.c > >> > >> There's plenty of drivers using regmap in drivers/ to demonstrate how to > >> use it. And there's alway

Re: [PATCH v1 net-next] net: dsa: microchip: add KSZ9477 I2C driver

2018-12-19 Thread Marek Vasut
On 12/20/2018 12:31 AM, Marek Vasut wrote: > On 12/20/2018 12:11 AM, Marek Vasut wrote: >> On 12/19/2018 11:30 PM, tristram...@microchip.com wrote: Can this use regmap instead ? >>> >>> To tell the truth I do not know how. >>> >>> Some customers, like Sergio, seem to be using KSZ9897 with

Re: [PATCH v1 net-next] net: dsa: microchip: add KSZ9477 I2C driver

2018-12-19 Thread Marek Vasut
On 12/20/2018 12:11 AM, Marek Vasut wrote: > On 12/19/2018 11:30 PM, tristram...@microchip.com wrote: >>> Can this use regmap instead ? >>> >> >> To tell the truth I do not know how. >> >> Some customers, like Sergio, seem to be using KSZ9897 with I2C in their >> projects >> and so cannot wait fur

RE: [PATCH v1 net-next] net: dsa: microchip: add KSZ9477 I2C driver

2018-12-19 Thread Woojung.Huh
> > Is there any specific reason that ksz_i2c_read24 & ksz_i2c_write24 in > > ksz9477_i2c.c > > but, other functions are in ksz_i2c.h? > > > > There are specific registers in KSZ9477 such that using 24-bit is more > efficient than > reading 32-bit first and writing 32-bit. The other older switch

Re: [PATCH v1 net-next] net: dsa: microchip: add KSZ9477 I2C driver

2018-12-19 Thread Marek Vasut
On 12/19/2018 11:50 PM, tristram...@microchip.com wrote: >> This header file makes no sense. Please move the functions into .c > > No, that would make code bigger & slower. > > It makes sense to me. But I'd add "inline" keyword to make the goal > explicit. 1) It ma

Re: [PATCH v1 net-next] net: dsa: microchip: add KSZ9477 I2C driver

2018-12-19 Thread Marek Vasut
On 12/19/2018 11:30 PM, tristram...@microchip.com wrote: >> Can this use regmap instead ? >> > > To tell the truth I do not know how. > > Some customers, like Sergio, seem to be using KSZ9897 with I2C in their > projects > and so cannot wait further. Well, I just did 'git grep regmap_i2c driver

RE: [PATCH v1 net-next] net: dsa: microchip: add KSZ9477 I2C driver

2018-12-19 Thread Tristram.Ha
> Is there any specific reason that ksz_i2c_read24 & ksz_i2c_write24 in > ksz9477_i2c.c > but, other functions are in ksz_i2c.h? > There are specific registers in KSZ9477 such that using 24-bit is more efficient than reading 32-bit first and writing 32-bit. The other older switches mostly use

RE: [PATCH v1 net-next] net: dsa: microchip: add KSZ9477 I2C driver

2018-12-19 Thread Tristram.Ha
> This header file makes no sense. Please move the functions into .c > >>> > >>> No, that would make code bigger & slower. > >>> > >>> It makes sense to me. But I'd add "inline" keyword to make the goal > >>> explicit. > >> > >> 1) It makes no sense to have header files for things like this. T

RE: [PATCH v1 net-next] net: dsa: microchip: add KSZ9477 I2C driver

2018-12-19 Thread Tristram.Ha
> Can this use regmap instead ? > To tell the truth I do not know how. Some customers, like Sergio, seem to be using KSZ9897 with I2C in their projects and so cannot wait further.

Re: [PATCH v1 net-next] net: dsa: microchip: add KSZ9477 I2C driver

2018-12-19 Thread Marek Vasut
On 12/19/2018 06:22 PM, Pavel Machek wrote: > On Wed 2018-12-19 17:15:32, Jiri Pirko wrote: >> Wed, Dec 19, 2018 at 05:08:57PM CET, pa...@denx.de wrote: >>> Hi! >>> > +static int ksz_i2c_write32(struct ksz_device *dev, u32 reg, u32 value) > +{ > + value = cpu_to_be32(value); > + ret

Re: [PATCH v1 net-next] net: dsa: microchip: add KSZ9477 I2C driver

2018-12-19 Thread Pavel Machek
On Wed 2018-12-19 17:15:32, Jiri Pirko wrote: > Wed, Dec 19, 2018 at 05:08:57PM CET, pa...@denx.de wrote: > >Hi! > > > >> >+static int ksz_i2c_write32(struct ksz_device *dev, u32 reg, u32 value) > >> >+{ > >> >+ value = cpu_to_be32(value); > >> >+ return ksz_i2c_write(dev, reg, &value, 4); > >> >+}

Re: [PATCH v1 net-next] net: dsa: microchip: add KSZ9477 I2C driver

2018-12-19 Thread David Miller
From: Pavel Machek Date: Wed, 19 Dec 2018 17:08:57 +0100 > Hi! > >> >+static int ksz_i2c_write32(struct ksz_device *dev, u32 reg, u32 value) >> >+{ >> >+ value = cpu_to_be32(value); >> >+ return ksz_i2c_write(dev, reg, &value, 4); >> >+} >> >+ >> >+static int ksz_i2c_get(struct ksz_device *d

Re: [PATCH v1 net-next] net: dsa: microchip: add KSZ9477 I2C driver

2018-12-19 Thread Jiri Pirko
Wed, Dec 19, 2018 at 05:08:57PM CET, pa...@denx.de wrote: >Hi! > >> >+static int ksz_i2c_write32(struct ksz_device *dev, u32 reg, u32 value) >> >+{ >> >+ value = cpu_to_be32(value); >> >+ return ksz_i2c_write(dev, reg, &value, 4); >> >+} >> >+ >> >+static int ksz_i2c_get(struct ksz_device *dev,

Re: [PATCH v1 net-next] net: dsa: microchip: add KSZ9477 I2C driver

2018-12-19 Thread Pavel Machek
Hi! > >+static int ksz_i2c_write32(struct ksz_device *dev, u32 reg, u32 value) > >+{ > >+value = cpu_to_be32(value); > >+return ksz_i2c_write(dev, reg, &value, 4); > >+} > >+ > >+static int ksz_i2c_get(struct ksz_device *dev, u32 reg, void *data, size_t > >len) > >+{ > >+return ksz_i2

Re: [PATCH v1 net-next] net: dsa: microchip: add KSZ9477 I2C driver

2018-12-19 Thread Jiri Pirko
Wed, Dec 19, 2018 at 04:41:37AM CET, tristram...@microchip.com wrote: >From: Tristram Ha > >Add KSZ9477 I2C driver support. The code ksz9477.c and ksz_common.c are >used together to generate the I2C driver. > >Signed-off-by: Tristram Ha >diff --git a/drivers/net/dsa/microchip/ksz_i2c.h >b/drive

Re: [PATCH v1 net-next] net: dsa: microchip: add KSZ9477 I2C driver

2018-12-19 Thread Marek Vasut
On 12/19/2018 04:41 AM, tristram...@microchip.com wrote: > From: Tristram Ha > > Add KSZ9477 I2C driver support. The code ksz9477.c and ksz_common.c are > used together to generate the I2C driver. > > Signed-off-by: Tristram Ha Can this use regmap instead ? -- Best regards, Marek Vasut

RE: [PATCH v1 net-next] net: dsa: microchip: add KSZ9477 I2C driver

2018-12-18 Thread Woojung.Huh
Hi Tristram, > diff --git a/drivers/net/dsa/microchip/ksz9477_i2c.c > b/drivers/net/dsa/microchip/ksz9477_i2c.c > new file mode 100644 > index 000..29511e9 > --- /dev/null > +++ b/drivers/net/dsa/microchip/ksz9477_i2c.c .. > +static int ksz_i2c_read24(struct ksz_device *dev, u32 reg, u32 *val)