Message ID | 20190226142846.28294-2-pgaj@cadence.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | Drop support for I2C 10 bit devices from I3C subsystem | expand |
On 26/02/19 14:28, Przemyslaw Gaj wrote: > This patch dropps support for I2C devices with 10 bit addressing. When I2C > device with 10 bit address is defined in DT, I3C master registration fails. > > Signed-off-by: Przemyslaw Gaj <pgaj@cadence.com> > > --- > > Main changes between v1 and v2 are: > - Add error message when registering I2C device with 10 bit address. > > --- > drivers/i3c/master.c | 9 +++++++++ > 1 file changed, 9 insertions(+) > > diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c > index 2dc628d..8c1e365 100644 > --- a/drivers/i3c/master.c > +++ b/drivers/i3c/master.c > @@ -1962,6 +1962,15 @@ of_i3c_master_add_i2c_boardinfo(struct i3c_master_controller *master, > if (ret) > return ret; > > + /* The I3C Specification does not clearly say I2C devices with 10-bit > + * address are supported. These devices can't be passed properly through > + * DEFSLVS command. > + */ IMO we just need to say 10-bit address not used or not supported in i3c. > + if (boardinfo->base.flags & I2C_CLIENT_TEN) { > + dev_err(&master->dev, "I2C device with 10 bit address not supported."); > + return -ENOTSUPP; > + } > + > /* LVR is encoded in reg[2]. */ > boardinfo->lvr = reg[2]; > Also need to change: #define I2C_MAX_ADDR GENMASK(9, 0) to #define I2C_MAX_ADDR GENMASK(6, 0) in master.h file Not sure about: unsigned long addrslots[((I2C_MAX_ADDR + 1) * 2) / BITS_PER_LONG]; @Boris can you check this part? Best regards, Vitor Soares
Hi Vitor, On Wed, 27 Feb 2019 12:05:30 +0000 vitor <vitor.soares@synopsys.com> wrote: > On 26/02/19 14:28, Przemyslaw Gaj wrote: > > This patch dropps support for I2C devices with 10 bit addressing. When I2C > > device with 10 bit address is defined in DT, I3C master registration fails. > > > > Signed-off-by: Przemyslaw Gaj <pgaj@cadence.com> > > > > --- > > > > Main changes between v1 and v2 are: > > - Add error message when registering I2C device with 10 bit address. > > > > --- > > drivers/i3c/master.c | 9 +++++++++ > > 1 file changed, 9 insertions(+) > > > > diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c > > index 2dc628d..8c1e365 100644 > > --- a/drivers/i3c/master.c > > +++ b/drivers/i3c/master.c > > @@ -1962,6 +1962,15 @@ of_i3c_master_add_i2c_boardinfo(struct i3c_master_controller *master, > > if (ret) > > return ret; > > > > + /* The I3C Specification does not clearly say I2C devices with 10-bit > > + * address are supported. These devices can't be passed properly through > > + * DEFSLVS command. > > + */ > > IMO we just need to say 10-bit address not used or not supported in i3c. I'd like to keep a clear comment on why it cannot supported right now even though the spec is unclear about that. If the spec is updated to state that I2C devs using extended addresses are forbidden, then we'll update this comment accordingly. > > > + if (boardinfo->base.flags & I2C_CLIENT_TEN) { > > + dev_err(&master->dev, "I2C device with 10 bit address not supported."); > > + return -ENOTSUPP; > > + } > > + > > /* LVR is encoded in reg[2]. */ > > boardinfo->lvr = reg[2]; > > > > Also need to change: > > #define I2C_MAX_ADDR GENMASK(9, 0) > to > #define I2C_MAX_ADDR GENMASK(6, 0) > in master.h file Yep, you can reduce the address space. > > Not sure about: > unsigned long addrslots[((I2C_MAX_ADDR + 1) * 2) / BITS_PER_LONG]; > @Boris can you check this part? This part is still valid, no need to update it as you already updated I2C_MAX_ADDR. Thanks for the review. Boris
Hi, On 27/02/19 12:10, Boris Brezillon wrote: > Hi Vitor, > > On Wed, 27 Feb 2019 12:05:30 +0000 > vitor <vitor.soares@synopsys.com> wrote: > >> On 26/02/19 14:28, Przemyslaw Gaj wrote: >>> This patch dropps support for I2C devices with 10 bit addressing. When I2C >>> device with 10 bit address is defined in DT, I3C master registration fails. >>> >>> Signed-off-by: Przemyslaw Gaj <pgaj@cadence.com> >>> >>> --- >>> >>> Main changes between v1 and v2 are: >>> - Add error message when registering I2C device with 10 bit address. >>> >>> --- >>> drivers/i3c/master.c | 9 +++++++++ >>> 1 file changed, 9 insertions(+) >>> >>> diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c >>> index 2dc628d..8c1e365 100644 >>> --- a/drivers/i3c/master.c >>> +++ b/drivers/i3c/master.c >>> @@ -1962,6 +1962,15 @@ of_i3c_master_add_i2c_boardinfo(struct i3c_master_controller *master, >>> if (ret) >>> return ret; >>> >>> + /* The I3C Specification does not clearly say I2C devices with 10-bit >>> + * address are supported. These devices can't be passed properly through >>> + * DEFSLVS command. >>> + */ >> IMO we just need to say 10-bit address not used or not supported in i3c. > I'd like to keep a clear comment on why it cannot supported right now > even though the spec is unclear about that. If the spec is updated to > state that I2C devs using extended addresses are forbidden, then we'll > update this comment accordingly. I'm not sure if the terms aren't the same, but let's keep the comment. > >>> + if (boardinfo->base.flags & I2C_CLIENT_TEN) { >>> + dev_err(&master->dev, "I2C device with 10 bit address not supported."); >>> + return -ENOTSUPP; >>> + } >>> + >>> /* LVR is encoded in reg[2]. */ >>> boardinfo->lvr = reg[2]; >>> >> Also need to change: >> >> #define I2C_MAX_ADDR GENMASK(9, 0) >> to >> #define I2C_MAX_ADDR GENMASK(6, 0) >> in master.h file > Yep, you can reduce the address space. > >> Not sure about: >> unsigned long addrslots[((I2C_MAX_ADDR + 1) * 2) / BITS_PER_LONG]; >> @Boris can you check this part? > This part is still valid, no need to update it as you already updated > I2C_MAX_ADDR. > > Thanks for the review. > > Boris Also we can make i2c_algorithm.functionality = I2C_FUNC_SMBUS_EMUL | I2C_FUNC_I2C, and in this way we won't need ->i2c_func() and avoid the I2C_FUNC_10BIT_ADDR flag on host controller side. Best regards, Vitor Soares
On Wed, 27 Feb 2019 12:52:42 +0000 vitor <vitor.soares@synopsys.com> wrote: > Hi, > > On 27/02/19 12:10, Boris Brezillon wrote: > > Hi Vitor, > > > > On Wed, 27 Feb 2019 12:05:30 +0000 > > vitor <vitor.soares@synopsys.com> wrote: > > > >> On 26/02/19 14:28, Przemyslaw Gaj wrote: > >>> This patch dropps support for I2C devices with 10 bit addressing. When I2C > >>> device with 10 bit address is defined in DT, I3C master registration fails. > >>> > >>> Signed-off-by: Przemyslaw Gaj <pgaj@cadence.com> > >>> > >>> --- > >>> > >>> Main changes between v1 and v2 are: > >>> - Add error message when registering I2C device with 10 bit address. > >>> > >>> --- > >>> drivers/i3c/master.c | 9 +++++++++ > >>> 1 file changed, 9 insertions(+) > >>> > >>> diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c > >>> index 2dc628d..8c1e365 100644 > >>> --- a/drivers/i3c/master.c > >>> +++ b/drivers/i3c/master.c > >>> @@ -1962,6 +1962,15 @@ of_i3c_master_add_i2c_boardinfo(struct i3c_master_controller *master, > >>> if (ret) > >>> return ret; > >>> > >>> + /* The I3C Specification does not clearly say I2C devices with 10-bit Nitpick: please do not use net-style comments in the I3C subsystem. Use /* * blablabla */ instead. > >>> + * address are supported. These devices can't be passed properly through > >>> + * DEFSLVS command. > >>> + */ > >> IMO we just need to say 10-bit address not used or not supported in i3c. > > I'd like to keep a clear comment on why it cannot supported right now > > even though the spec is unclear about that. If the spec is updated to > > state that I2C devs using extended addresses are forbidden, then we'll > > update this comment accordingly. > > I'm not sure if the terms aren't the same, Don't understand what you mean, sorry. >but let's keep the comment. > > > > >>> + if (boardinfo->base.flags & I2C_CLIENT_TEN) { > >>> + dev_err(&master->dev, "I2C device with 10 bit address not supported."); > >>> + return -ENOTSUPP; > >>> + } > >>> + > >>> /* LVR is encoded in reg[2]. */ > >>> boardinfo->lvr = reg[2]; > >>> > >> Also need to change: > >> > >> #define I2C_MAX_ADDR GENMASK(9, 0) > >> to > >> #define I2C_MAX_ADDR GENMASK(6, 0) > >> in master.h file > > Yep, you can reduce the address space. > > > >> Not sure about: > >> unsigned long addrslots[((I2C_MAX_ADDR + 1) * 2) / BITS_PER_LONG]; > >> @Boris can you check this part? > > This part is still valid, no need to update it as you already updated > > I2C_MAX_ADDR. > > > > Thanks for the review. > > > > Boris > > Also we can make i2c_algorithm.functionality = I2C_FUNC_SMBUS_EMUL | I2C_FUNC_I2C, and in this way we won't need ->i2c_func() and avoid the I2C_FUNC_10BIT_ADDR flag on host controller side. Ack. Let's rip ->i2c_func() out and return I2C_FUNC_SMBUS_EMUL | I2C_FUNC_I2C for everyone. We'll add it back if some drivers want to support SMBUS natively or if 10bit addressing appears to be needed at some point.
diff --git a/drivers/i3c/master.c b/drivers/i3c/master.c index 2dc628d..8c1e365 100644 --- a/drivers/i3c/master.c +++ b/drivers/i3c/master.c @@ -1962,6 +1962,15 @@ of_i3c_master_add_i2c_boardinfo(struct i3c_master_controller *master, if (ret) return ret; + /* The I3C Specification does not clearly say I2C devices with 10-bit + * address are supported. These devices can't be passed properly through + * DEFSLVS command. + */ + if (boardinfo->base.flags & I2C_CLIENT_TEN) { + dev_err(&master->dev, "I2C device with 10 bit address not supported."); + return -ENOTSUPP; + } + /* LVR is encoded in reg[2]. */ boardinfo->lvr = reg[2];
This patch dropps support for I2C devices with 10 bit addressing. When I2C device with 10 bit address is defined in DT, I3C master registration fails. Signed-off-by: Przemyslaw Gaj <pgaj@cadence.com> --- Main changes between v1 and v2 are: - Add error message when registering I2C device with 10 bit address. --- drivers/i3c/master.c | 9 +++++++++ 1 file changed, 9 insertions(+)