linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/2] Add a property in at24.c
@ 2018-06-26  6:22 alanx.chiang
  2018-06-26  6:22 ` [PATCH v2 1/2] dt-bindings: at24: Add address-width property alanx.chiang
                   ` (2 more replies)
  0 siblings, 3 replies; 18+ messages in thread
From: alanx.chiang @ 2018-06-26  6:22 UTC (permalink / raw)
  To: linux-i2c
  Cc: andy.yeh, sakari.ailus, andriy.shevchenko, rajmohan.mani,
	andy.shevchenko, brgl, robh+dt, mark.rutland, arnd, gregkh,
	linux-kernel, alanx.chiang

From: "alanx.chiang" <alanx.chiang@intel.com>

In at24.c, it uses 8-bit addressing by default. In this patch,
add a property address-width that provides a flexible method to
pass the information to the driver.

alanx.chiang (2):
  dt-bindings: at24: Add address-width property
  eeprom: at24: Add support for address-width property

 Documentation/devicetree/bindings/eeprom/at24.txt |  2 ++
 drivers/misc/eeprom/at24.c                        | 16 ++++++++++++++++
 2 files changed, 18 insertions(+)

-- 
2.7.4


^ permalink raw reply	[flat|nested] 18+ messages in thread

* [PATCH v2 1/2] dt-bindings: at24: Add address-width property
  2018-06-26  6:22 [PATCH v2 0/2] Add a property in at24.c alanx.chiang
@ 2018-06-26  6:22 ` alanx.chiang
  2018-06-26  6:49   ` Sakari Ailus
  2018-06-26 16:44   ` Rob Herring
  2018-06-26  6:22 ` [PATCH v2 2/2] eeprom: at24: Add support for " alanx.chiang
  2018-06-26  7:41 ` [PATCH v2 0/2] Add a property in at24.c Bartosz Golaszewski
  2 siblings, 2 replies; 18+ messages in thread
From: alanx.chiang @ 2018-06-26  6:22 UTC (permalink / raw)
  To: linux-i2c
  Cc: andy.yeh, sakari.ailus, andriy.shevchenko, rajmohan.mani,
	andy.shevchenko, brgl, robh+dt, mark.rutland, arnd, gregkh,
	linux-kernel, alanx.chiang

From: "alanx.chiang" <alanx.chiang@intel.com>

The AT24 series chips use 8-bit address by default. If some
chips would like to support more than 8 bits, should add the compatible
field for specfic chips in the driver.

Provide a flexible way to determine the addressing bits through
address-width in this patch.

Signed-off-by: Alan Chiang <alanx.chiang@intel.com>
Signed-off-by: Andy Yeh <andy.yeh@intel.com>

---
since v1:
-- Remove the address-width field in the example.

---
 Documentation/devicetree/bindings/eeprom/at24.txt | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/Documentation/devicetree/bindings/eeprom/at24.txt b/Documentation/devicetree/bindings/eeprom/at24.txt
index 61d833a..9467482 100644
--- a/Documentation/devicetree/bindings/eeprom/at24.txt
+++ b/Documentation/devicetree/bindings/eeprom/at24.txt
@@ -72,6 +72,8 @@ Optional properties:
 
   - wp-gpios: GPIO to which the write-protect pin of the chip is connected.
 
+  - address-width : number of address bits (one of 8, 16).
+
 Example:
 
 eeprom@52 {
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* [PATCH v2 2/2] eeprom: at24: Add support for address-width property
  2018-06-26  6:22 [PATCH v2 0/2] Add a property in at24.c alanx.chiang
  2018-06-26  6:22 ` [PATCH v2 1/2] dt-bindings: at24: Add address-width property alanx.chiang
@ 2018-06-26  6:22 ` alanx.chiang
  2018-06-26  6:47   ` Sakari Ailus
  2018-06-26  7:41 ` [PATCH v2 0/2] Add a property in at24.c Bartosz Golaszewski
  2 siblings, 1 reply; 18+ messages in thread
From: alanx.chiang @ 2018-06-26  6:22 UTC (permalink / raw)
  To: linux-i2c
  Cc: andy.yeh, sakari.ailus, andriy.shevchenko, rajmohan.mani,
	andy.shevchenko, brgl, robh+dt, mark.rutland, arnd, gregkh,
	linux-kernel, alanx.chiang

From: "alanx.chiang" <alanx.chiang@intel.com>

Provide a flexible way to determine the addressing bits of eeprom.
Pass the addressing bits to driver through address-width property.

Signed-off-by: Alan Chiang <alanx.chiang@intel.com>
Signed-off-by: Andy Yeh <andy.yeh@intel.com>

---
since v1
-- Add a warn message for 8-bit addressing.

---
 drivers/misc/eeprom/at24.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
index 0c125f2..231afcd 100644
--- a/drivers/misc/eeprom/at24.c
+++ b/drivers/misc/eeprom/at24.c
@@ -478,6 +478,22 @@ static void at24_properties_to_pdata(struct device *dev,
 	if (device_property_present(dev, "no-read-rollover"))
 		chip->flags |= AT24_FLAG_NO_RDROL;
 
+	err = device_property_read_u32(dev, "address-width", &val);
+	if (!err) {
+		switch (val) {
+		case 8:
+			chip->flags &= ~AT24_FLAG_ADDR16;
+			dev_warn(dev, "address-width is 8, clear the ADD16 bit\n");
+			break;
+		case 16:
+			chip->flags |= AT24_FLAG_ADDR16;
+			break;
+		default:
+			dev_warn(dev, "Bad \"address-width\" property: %u\n",
+				 val);
+		}
+	}
+
 	err = device_property_read_u32(dev, "size", &val);
 	if (!err)
 		chip->byte_len = val;
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 2/2] eeprom: at24: Add support for address-width property
  2018-06-26  6:22 ` [PATCH v2 2/2] eeprom: at24: Add support for " alanx.chiang
@ 2018-06-26  6:47   ` Sakari Ailus
  2018-06-26  7:11     ` Chiang, AlanX
  0 siblings, 1 reply; 18+ messages in thread
From: Sakari Ailus @ 2018-06-26  6:47 UTC (permalink / raw)
  To: alanx.chiang
  Cc: linux-i2c, andy.yeh, andriy.shevchenko, rajmohan.mani,
	andy.shevchenko, brgl, robh+dt, mark.rutland, arnd, gregkh,
	linux-kernel

Hi Alan,

On Tue, Jun 26, 2018 at 02:22:08PM +0800, alanx.chiang@intel.com wrote:
> From: "alanx.chiang" <alanx.chiang@intel.com>
> 
> Provide a flexible way to determine the addressing bits of eeprom.
> Pass the addressing bits to driver through address-width property.
> 
> Signed-off-by: Alan Chiang <alanx.chiang@intel.com>
> Signed-off-by: Andy Yeh <andy.yeh@intel.com>
> 
> ---
> since v1
> -- Add a warn message for 8-bit addressing.
> 
> ---
>  drivers/misc/eeprom/at24.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
> index 0c125f2..231afcd 100644
> --- a/drivers/misc/eeprom/at24.c
> +++ b/drivers/misc/eeprom/at24.c
> @@ -478,6 +478,22 @@ static void at24_properties_to_pdata(struct device *dev,
>  	if (device_property_present(dev, "no-read-rollover"))
>  		chip->flags |= AT24_FLAG_NO_RDROL;
>  
> +	err = device_property_read_u32(dev, "address-width", &val);
> +	if (!err) {
> +		switch (val) {
> +		case 8:
> +			chip->flags &= ~AT24_FLAG_ADDR16;
> +			dev_warn(dev, "address-width is 8, clear the ADD16 bit\n");

Even though the default is 8 address bits, I don't see a need to issue a
warning if the address-width property sets that to 8 explicitly. I.e. only
warn if the flag was set.

> +			break;
> +		case 16:
> +			chip->flags |= AT24_FLAG_ADDR16;
> +			break;
> +		default:
> +			dev_warn(dev, "Bad \"address-width\" property: %u\n",
> +				 val);
> +		}
> +	}
> +
>  	err = device_property_read_u32(dev, "size", &val);
>  	if (!err)
>  		chip->byte_len = val;

-- 
Regards,

Sakari Ailus
sakari.ailus@linux.intel.com

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 1/2] dt-bindings: at24: Add address-width property
  2018-06-26  6:22 ` [PATCH v2 1/2] dt-bindings: at24: Add address-width property alanx.chiang
@ 2018-06-26  6:49   ` Sakari Ailus
  2018-06-26 16:44   ` Rob Herring
  1 sibling, 0 replies; 18+ messages in thread
From: Sakari Ailus @ 2018-06-26  6:49 UTC (permalink / raw)
  To: alanx.chiang
  Cc: linux-i2c, andy.yeh, andriy.shevchenko, rajmohan.mani,
	andy.shevchenko, brgl, robh+dt, mark.rutland, arnd, gregkh,
	linux-kernel

Hi Alan,

On Tue, Jun 26, 2018 at 02:22:07PM +0800, alanx.chiang@intel.com wrote:
> From: "alanx.chiang" <alanx.chiang@intel.com>
> 
> The AT24 series chips use 8-bit address by default. If some
> chips would like to support more than 8 bits, should add the compatible
> field for specfic chips in the driver.
> 
> Provide a flexible way to determine the addressing bits through
> address-width in this patch.
> 
> Signed-off-by: Alan Chiang <alanx.chiang@intel.com>
> Signed-off-by: Andy Yeh <andy.yeh@intel.com>
> 
> ---
> since v1:
> -- Remove the address-width field in the example.
> 
> ---
>  Documentation/devicetree/bindings/eeprom/at24.txt | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/Documentation/devicetree/bindings/eeprom/at24.txt b/Documentation/devicetree/bindings/eeprom/at24.txt
> index 61d833a..9467482 100644
> --- a/Documentation/devicetree/bindings/eeprom/at24.txt
> +++ b/Documentation/devicetree/bindings/eeprom/at24.txt
> @@ -72,6 +72,8 @@ Optional properties:
>  
>    - wp-gpios: GPIO to which the write-protect pin of the chip is connected.
>  
> +  - address-width : number of address bits (one of 8, 16).

Please remove the space before the colon; that way it looks the same as the
rest.

> +
>  Example:
>  
>  eeprom@52 {

-- 
Kind regards,

Sakari Ailus
sakari.ailus@linux.intel.com

^ permalink raw reply	[flat|nested] 18+ messages in thread

* RE: [PATCH v2 2/2] eeprom: at24: Add support for address-width property
  2018-06-26  6:47   ` Sakari Ailus
@ 2018-06-26  7:11     ` Chiang, AlanX
  2018-06-26  7:26       ` Sakari Ailus
  2018-06-26 12:11       ` Andy Shevchenko
  0 siblings, 2 replies; 18+ messages in thread
From: Chiang, AlanX @ 2018-06-26  7:11 UTC (permalink / raw)
  To: Sakari Ailus
  Cc: linux-i2c, Yeh, Andy, Shevchenko, Andriy, Mani, Rajmohan,
	andy.shevchenko, brgl, robh+dt, mark.rutland, arnd, gregkh,
	linux-kernel

Hi Sakari,

> -----Original Message-----
> From: Sakari Ailus [mailto:sakari.ailus@linux.intel.com]
> Sent: Tuesday, June 26, 2018 2:48 PM
> To: Chiang, AlanX <alanx.chiang@intel.com>
> Cc: linux-i2c@vger.kernel.org; Yeh, Andy <andy.yeh@intel.com>;
> Shevchenko, Andriy <andriy.shevchenko@intel.com>; Mani, Rajmohan
> <rajmohan.mani@intel.com>; andy.shevchenko@gmail.com; brgl@bgdev.pl;
> robh+dt@kernel.org; mark.rutland@arm.com; arnd@arndb.de;
> gregkh@linuxfoundation.org; linux-kernel@vger.kernel.org
> Subject: Re: [PATCH v2 2/2] eeprom: at24: Add support for address-width
> property
> 
> Hi Alan,
> 
> On Tue, Jun 26, 2018 at 02:22:08PM +0800, alanx.chiang@intel.com wrote:
> > From: "alanx.chiang" <alanx.chiang@intel.com>
> >
> > Provide a flexible way to determine the addressing bits of eeprom.
> > Pass the addressing bits to driver through address-width property.
> >
> > Signed-off-by: Alan Chiang <alanx.chiang@intel.com>
> > Signed-off-by: Andy Yeh <andy.yeh@intel.com>
> >
> > ---
> > since v1
> > -- Add a warn message for 8-bit addressing.
> >
> > ---
> >  drivers/misc/eeprom/at24.c | 16 ++++++++++++++++
> >  1 file changed, 16 insertions(+)
> >
> > diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
> > index 0c125f2..231afcd 100644
> > --- a/drivers/misc/eeprom/at24.c
> > +++ b/drivers/misc/eeprom/at24.c
> > @@ -478,6 +478,22 @@ static void at24_properties_to_pdata(struct device
> *dev,
> >  	if (device_property_present(dev, "no-read-rollover"))
> >  		chip->flags |= AT24_FLAG_NO_RDROL;
> >
> > +	err = device_property_read_u32(dev, "address-width", &val);
> > +	if (!err) {
> > +		switch (val) {
> > +		case 8:
> > +			chip->flags &= ~AT24_FLAG_ADDR16;
> > +			dev_warn(dev, "address-width is 8, clear the ADD16
> bit\n");
> 
> Even though the default is 8 address bits, I don't see a need to issue a
> warning if the address-width property sets that to 8 explicitly. I.e. only warn
> if the flag was set.
> 

Do you mean I have to add a statement for checking if the bit has been set before?
For example:

If (chip->flags & AT24_FLAG_ADDR16)
	dev_warn(dev, "address-width is 8, clear the ADD16 bit\n");

If it is, I would like to modify it as below:

case 8:
	If (chip->flags & AT24_FLAG_ADDR16) {
		chip->flags &= ~AT24_FLAG_ADDR16;
		dev_warn(dev, "address-width is 8, clear the ADDR16 bit\n");
	}
	break;

> > +			break;
> > +		case 16:
> > +			chip->flags |= AT24_FLAG_ADDR16;
> > +			break;
> > +		default:
> > +			dev_warn(dev, "Bad \"address-width\" property:
> %u\n",
> > +				 val);
> > +		}
> > +	}
> > +
> >  	err = device_property_read_u32(dev, "size", &val);
> >  	if (!err)
> >  		chip->byte_len = val;
> 
> --
> Regards,
> 
> Sakari Ailus
> sakari.ailus@linux.intel.com

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 2/2] eeprom: at24: Add support for address-width property
  2018-06-26  7:11     ` Chiang, AlanX
@ 2018-06-26  7:26       ` Sakari Ailus
  2018-06-26 12:11       ` Andy Shevchenko
  1 sibling, 0 replies; 18+ messages in thread
From: Sakari Ailus @ 2018-06-26  7:26 UTC (permalink / raw)
  To: Chiang, AlanX
  Cc: linux-i2c, Yeh, Andy, Shevchenko, Andriy, Mani, Rajmohan,
	andy.shevchenko, brgl, robh+dt, mark.rutland, arnd, gregkh,
	linux-kernel

On Tue, Jun 26, 2018 at 07:11:54AM +0000, Chiang, AlanX wrote:
> Hi Sakari,
> 
> > -----Original Message-----
> > From: Sakari Ailus [mailto:sakari.ailus@linux.intel.com]
> > Sent: Tuesday, June 26, 2018 2:48 PM
> > To: Chiang, AlanX <alanx.chiang@intel.com>
> > Cc: linux-i2c@vger.kernel.org; Yeh, Andy <andy.yeh@intel.com>;
> > Shevchenko, Andriy <andriy.shevchenko@intel.com>; Mani, Rajmohan
> > <rajmohan.mani@intel.com>; andy.shevchenko@gmail.com; brgl@bgdev.pl;
> > robh+dt@kernel.org; mark.rutland@arm.com; arnd@arndb.de;
> > gregkh@linuxfoundation.org; linux-kernel@vger.kernel.org
> > Subject: Re: [PATCH v2 2/2] eeprom: at24: Add support for address-width
> > property
> > 
> > Hi Alan,
> > 
> > On Tue, Jun 26, 2018 at 02:22:08PM +0800, alanx.chiang@intel.com wrote:
> > > From: "alanx.chiang" <alanx.chiang@intel.com>
> > >
> > > Provide a flexible way to determine the addressing bits of eeprom.
> > > Pass the addressing bits to driver through address-width property.
> > >
> > > Signed-off-by: Alan Chiang <alanx.chiang@intel.com>
> > > Signed-off-by: Andy Yeh <andy.yeh@intel.com>
> > >
> > > ---
> > > since v1
> > > -- Add a warn message for 8-bit addressing.
> > >
> > > ---
> > >  drivers/misc/eeprom/at24.c | 16 ++++++++++++++++
> > >  1 file changed, 16 insertions(+)
> > >
> > > diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c
> > > index 0c125f2..231afcd 100644
> > > --- a/drivers/misc/eeprom/at24.c
> > > +++ b/drivers/misc/eeprom/at24.c
> > > @@ -478,6 +478,22 @@ static void at24_properties_to_pdata(struct device
> > *dev,
> > >  	if (device_property_present(dev, "no-read-rollover"))
> > >  		chip->flags |= AT24_FLAG_NO_RDROL;
> > >
> > > +	err = device_property_read_u32(dev, "address-width", &val);
> > > +	if (!err) {
> > > +		switch (val) {
> > > +		case 8:
> > > +			chip->flags &= ~AT24_FLAG_ADDR16;
> > > +			dev_warn(dev, "address-width is 8, clear the ADD16
> > bit\n");
> > 
> > Even though the default is 8 address bits, I don't see a need to issue a
> > warning if the address-width property sets that to 8 explicitly. I.e. only warn
> > if the flag was set.
> > 
> 
> Do you mean I have to add a statement for checking if the bit has been set before?
> For example:
> 
> If (chip->flags & AT24_FLAG_ADDR16)
> 	dev_warn(dev, "address-width is 8, clear the ADD16 bit\n");
> 
> If it is, I would like to modify it as below:
> 
> case 8:
> 	If (chip->flags & AT24_FLAG_ADDR16) {
> 		chip->flags &= ~AT24_FLAG_ADDR16;
> 		dev_warn(dev, "address-width is 8, clear the ADDR16 bit\n");
> 	}
> 	break;

Seems good to me.

-- 
Sakari Ailus
sakari.ailus@linux.intel.com

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 0/2] Add a property in at24.c
  2018-06-26  6:22 [PATCH v2 0/2] Add a property in at24.c alanx.chiang
  2018-06-26  6:22 ` [PATCH v2 1/2] dt-bindings: at24: Add address-width property alanx.chiang
  2018-06-26  6:22 ` [PATCH v2 2/2] eeprom: at24: Add support for " alanx.chiang
@ 2018-06-26  7:41 ` Bartosz Golaszewski
  2018-06-26 12:14   ` Andy Shevchenko
  2 siblings, 1 reply; 18+ messages in thread
From: Bartosz Golaszewski @ 2018-06-26  7:41 UTC (permalink / raw)
  To: alanx.chiang
  Cc: linux-i2c, andy.yeh, Sakari Ailus, andriy.shevchenko,
	rajmohan.mani, Andy Shevchenko, Rob Herring, Mark Rutland,
	Arnd Bergmann, Greg Kroah-Hartman, Linux Kernel Mailing List

2018-06-26 8:22 GMT+02:00  <alanx.chiang@intel.com>:
> From: "alanx.chiang" <alanx.chiang@intel.com>
>
> In at24.c, it uses 8-bit addressing by default. In this patch,
> add a property address-width that provides a flexible method to
> pass the information to the driver.
>
> alanx.chiang (2):
>   dt-bindings: at24: Add address-width property
>   eeprom: at24: Add support for address-width property
>
>  Documentation/devicetree/bindings/eeprom/at24.txt |  2 ++
>  drivers/misc/eeprom/at24.c                        | 16 ++++++++++++++++
>  2 files changed, 18 insertions(+)
>
> --
> 2.7.4
>

What is your use case exactly? Do you have an EEPROM model that's not
yet supported explicitly in the driver? Why would you need this
option?

Best regards,
Bartosz Golaszewski

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 2/2] eeprom: at24: Add support for address-width property
  2018-06-26  7:11     ` Chiang, AlanX
  2018-06-26  7:26       ` Sakari Ailus
@ 2018-06-26 12:11       ` Andy Shevchenko
  1 sibling, 0 replies; 18+ messages in thread
From: Andy Shevchenko @ 2018-06-26 12:11 UTC (permalink / raw)
  To: Chiang, AlanX, Sakari Ailus
  Cc: linux-i2c, Yeh, Andy, Mani, Rajmohan, andy.shevchenko, brgl,
	robh+dt, mark.rutland, arnd, gregkh, linux-kernel

On Tue, 2018-06-26 at 15:11 +0800, Chiang, AlanX wrote:

> If it is, I would like to modify it as below:
> 
> case 8:
> 	If (chip->flags & AT24_FLAG_ADDR16) {
> 		chip->flags &= ~AT24_FLAG_ADDR16;
> 		dev_warn(dev, "address-width is 8, clear the ADDR16
> bit\n");
> 	}
> 	break;

No need to put bit clearing inside the loop, something like below would
be slightly better.

if (chip->flags & AT24_FLAG_ADDR16)
	dev_warn(dev, "address-width is 8, clear the ADDR16 bit\n");
chip->flags &= ~AT24_FLAG_ADDR16;

On top of this the message would sound clearer if you put it like

"Override address width to be 8, while default is 16"

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 0/2] Add a property in at24.c
  2018-06-26  7:41 ` [PATCH v2 0/2] Add a property in at24.c Bartosz Golaszewski
@ 2018-06-26 12:14   ` Andy Shevchenko
  2018-06-26 12:36     ` Bartosz Golaszewski
  0 siblings, 1 reply; 18+ messages in thread
From: Andy Shevchenko @ 2018-06-26 12:14 UTC (permalink / raw)
  To: Bartosz Golaszewski, alanx.chiang
  Cc: linux-i2c, andy.yeh, Sakari Ailus, rajmohan.mani,
	Andy Shevchenko, Rob Herring, Mark Rutland, Arnd Bergmann,
	Greg Kroah-Hartman, Linux Kernel Mailing List

On Tue, 2018-06-26 at 09:41 +0200, Bartosz Golaszewski wrote:
> 2018-06-26 8:22 GMT+02:00  <alanx.chiang@intel.com>:
> > From: "alanx.chiang" <alanx.chiang@intel.com>
> > 
> > In at24.c, it uses 8-bit addressing by default. In this patch,
> > add a property address-width that provides a flexible method to
> > pass the information to the driver.
> > 
> > alanx.chiang (2):
> >   dt-bindings: at24: Add address-width property
> >   eeprom: at24: Add support for address-width property
> > 
> >  Documentation/devicetree/bindings/eeprom/at24.txt |  2 ++
> >  drivers/misc/eeprom/at24.c                        | 16
> > ++++++++++++++++
> >  2 files changed, 18 insertions(+)
> > 
> > --
> > 2.7.4
> > 
> 
> What is your use case exactly? Do you have an EEPROM model that's not
> yet supported explicitly in the driver? Why would you need this
> option?

The current at24 driver has no address width support, thus, reusing same
(allocated) IDs (non-DT case) is hard.

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 0/2] Add a property in at24.c
  2018-06-26 12:14   ` Andy Shevchenko
@ 2018-06-26 12:36     ` Bartosz Golaszewski
  2018-06-26 13:23       ` Andy Shevchenko
  0 siblings, 1 reply; 18+ messages in thread
From: Bartosz Golaszewski @ 2018-06-26 12:36 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: alanx.chiang, linux-i2c, andy.yeh, Sakari Ailus, rajmohan.mani,
	Andy Shevchenko, Rob Herring, Mark Rutland, Arnd Bergmann,
	Greg Kroah-Hartman, Linux Kernel Mailing List

2018-06-26 14:14 GMT+02:00 Andy Shevchenko <andriy.shevchenko@linux.intel.com>:
> On Tue, 2018-06-26 at 09:41 +0200, Bartosz Golaszewski wrote:
>> 2018-06-26 8:22 GMT+02:00  <alanx.chiang@intel.com>:
>> > From: "alanx.chiang" <alanx.chiang@intel.com>
>> >
>> > In at24.c, it uses 8-bit addressing by default. In this patch,
>> > add a property address-width that provides a flexible method to
>> > pass the information to the driver.
>> >
>> > alanx.chiang (2):
>> >   dt-bindings: at24: Add address-width property
>> >   eeprom: at24: Add support for address-width property
>> >
>> >  Documentation/devicetree/bindings/eeprom/at24.txt |  2 ++
>> >  drivers/misc/eeprom/at24.c                        | 16
>> > ++++++++++++++++
>> >  2 files changed, 18 insertions(+)
>> >
>> > --
>> > 2.7.4
>> >
>>
>> What is your use case exactly? Do you have an EEPROM model that's not
>> yet supported explicitly in the driver? Why would you need this
>> option?
>
> The current at24 driver has no address width support, thus, reusing same
> (allocated) IDs (non-DT case) is hard.
>

Every supported compatible has the width already specified in its
corresponding chip data.

Bart

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 0/2] Add a property in at24.c
  2018-06-26 12:36     ` Bartosz Golaszewski
@ 2018-06-26 13:23       ` Andy Shevchenko
  2018-06-26 13:30         ` Bartosz Golaszewski
  0 siblings, 1 reply; 18+ messages in thread
From: Andy Shevchenko @ 2018-06-26 13:23 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: alanx.chiang, linux-i2c, andy.yeh, Sakari Ailus, rajmohan.mani,
	Andy Shevchenko, Rob Herring, Mark Rutland, Arnd Bergmann,
	Greg Kroah-Hartman, Linux Kernel Mailing List

On Tue, 2018-06-26 at 14:36 +0200, Bartosz Golaszewski wrote:
> 2018-06-26 14:14 GMT+02:00 Andy Shevchenko
> <andriy.shevchenko@linux.intel.com>:
> > On Tue, 2018-06-26 at 09:41 +0200, Bartosz Golaszewski wrote:

> > > What is your use case exactly? Do you have an EEPROM model that's
> > > not
> > > yet supported explicitly in the driver? Why would you need this
> > > option?
> > 
> > The current at24 driver has no address width support,

> >  thus, reusing same
> > (allocated) IDs (non-DT case) is hard.

^^^^^

> Every supported compatible has the width already specified in its
> corresponding chip data.


Please, read again carefully what I wrote before.

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 0/2] Add a property in at24.c
  2018-06-26 13:23       ` Andy Shevchenko
@ 2018-06-26 13:30         ` Bartosz Golaszewski
  2018-06-26 15:48           ` Andy Shevchenko
  0 siblings, 1 reply; 18+ messages in thread
From: Bartosz Golaszewski @ 2018-06-26 13:30 UTC (permalink / raw)
  To: Andy Shevchenko
  Cc: alanx.chiang, linux-i2c, andy.yeh, Sakari Ailus, Rajmohan Mani,
	Andy Shevchenko, Rob Herring, Mark Rutland, Arnd Bergmann,
	Greg Kroah-Hartman, Linux Kernel Mailing List

2018-06-26 15:23 GMT+02:00 Andy Shevchenko <andriy.shevchenko@linux.intel.com>:
> On Tue, 2018-06-26 at 14:36 +0200, Bartosz Golaszewski wrote:
>> 2018-06-26 14:14 GMT+02:00 Andy Shevchenko
>> <andriy.shevchenko@linux.intel.com>:
>> > On Tue, 2018-06-26 at 09:41 +0200, Bartosz Golaszewski wrote:
>
>> > > What is your use case exactly? Do you have an EEPROM model that's
>> > > not
>> > > yet supported explicitly in the driver? Why would you need this
>> > > option?
>> >
>> > The current at24 driver has no address width support,
>
>> >  thus, reusing same
>> > (allocated) IDs (non-DT case) is hard.
>
> ^^^^^
>
>> Every supported compatible has the width already specified in its
>> corresponding chip data.
>
>
> Please, read again carefully what I wrote before.
>

Ok makes sense in that case. Could you just point me towards an
example model which has the address width different than the default
for its type?

Bart

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 0/2] Add a property in at24.c
  2018-06-26 13:30         ` Bartosz Golaszewski
@ 2018-06-26 15:48           ` Andy Shevchenko
  2018-06-26 16:21             ` Yeh, Andy
  0 siblings, 1 reply; 18+ messages in thread
From: Andy Shevchenko @ 2018-06-26 15:48 UTC (permalink / raw)
  To: Bartosz Golaszewski
  Cc: alanx.chiang, linux-i2c, andy.yeh, Sakari Ailus, Rajmohan Mani,
	Andy Shevchenko, Rob Herring, Mark Rutland, Arnd Bergmann,
	Greg Kroah-Hartman, Linux Kernel Mailing List

On Tue, 2018-06-26 at 15:30 +0200, Bartosz Golaszewski wrote:
> 2018-06-26 15:23 GMT+02:00 Andy Shevchenko <andriy.shevchenko@linux.in
> tel.com>:
> > On Tue, 2018-06-26 at 14:36 +0200, Bartosz Golaszewski wrote:
> > > 2018-06-26 14:14 GMT+02:00 Andy Shevchenko
> > > <andriy.shevchenko@linux.intel.com>:
> > > > On Tue, 2018-06-26 at 09:41 +0200, Bartosz Golaszewski wrote:
> > > > > What is your use case exactly? Do you have an EEPROM model
> > > > > that's
> > > > > not
> > > > > yet supported explicitly in the driver? Why would you need
> > > > > this
> > > > > option?
> > > > 
> > > > The current at24 driver has no address width support,
> > > >  thus, reusing same
> > > > (allocated) IDs (non-DT case) is hard.
> > 
> > ^^^^^
> > 
> > > Every supported compatible has the width already specified in its
> > > corresponding chip data.
> > 
> > 
> > Please, read again carefully what I wrote before.
> > 
> 
> Ok makes sense in that case. Could you just point me towards an
> example model which has the address width different than the default
> for its type?

AFAIK, it's a companion device inside the camera voice coil IC, i.e.
DONGWOON DW9714.

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

^ permalink raw reply	[flat|nested] 18+ messages in thread

* RE: [PATCH v2 0/2] Add a property in at24.c
  2018-06-26 15:48           ` Andy Shevchenko
@ 2018-06-26 16:21             ` Yeh, Andy
  2018-06-26 16:31               ` Mani, Rajmohan
  2018-06-26 16:38               ` Andy Shevchenko
  0 siblings, 2 replies; 18+ messages in thread
From: Yeh, Andy @ 2018-06-26 16:21 UTC (permalink / raw)
  To: Andy Shevchenko, Bartosz Golaszewski
  Cc: Chiang, AlanX, linux-i2c, Sakari Ailus, Mani, Rajmohan,
	Andy Shevchenko, Rob Herring, Mark Rutland, Arnd Bergmann,
	Greg Kroah-Hartman, Linux Kernel Mailing List

> -----Original Message-----
> From: Andy Shevchenko [mailto:andriy.shevchenko@linux.intel.com]
> Sent: Tuesday, June 26, 2018 11:48 PM
> To: Bartosz Golaszewski <brgl@bgdev.pl>
> Cc: Chiang, AlanX <alanx.chiang@intel.com>; linux-i2c <linux-
> i2c@vger.kernel.org>; Yeh, Andy <andy.yeh@intel.com>; Sakari Ailus
> <sakari.ailus@linux.intel.com>; Mani, Rajmohan <rajmohan.mani@intel.com>;
> Andy Shevchenko <andy.shevchenko@gmail.com>; Rob Herring
> <robh+dt@kernel.org>; Mark Rutland <mark.rutland@arm.com>; Arnd
> Bergmann <arnd@arndb.de>; Greg Kroah-Hartman
> <gregkh@linuxfoundation.org>; Linux Kernel Mailing List <linux-
> kernel@vger.kernel.org>
> Subject: Re: [PATCH v2 0/2] Add a property in at24.c
> 
> On Tue, 2018-06-26 at 15:30 +0200, Bartosz Golaszewski wrote:
> > 2018-06-26 15:23 GMT+02:00 Andy Shevchenko
> <andriy.shevchenko@linux.in
> > tel.com>:
> > > On Tue, 2018-06-26 at 14:36 +0200, Bartosz Golaszewski wrote:
> > > > 2018-06-26 14:14 GMT+02:00 Andy Shevchenko
> > > > <andriy.shevchenko@linux.intel.com>:
> > > > > On Tue, 2018-06-26 at 09:41 +0200, Bartosz Golaszewski wrote:
> > > > > > What is your use case exactly? Do you have an EEPROM model
> > > > > > that's not yet supported explicitly in the driver? Why would
> > > > > > you need this option?
> > > > >
> > > > > The current at24 driver has no address width support,  thus,
> > > > > reusing same
> > > > > (allocated) IDs (non-DT case) is hard.
> > >
> > > ^^^^^
> > >
> > > > Every supported compatible has the width already specified in its
> > > > corresponding chip data.
> > >
> > >
> > > Please, read again carefully what I wrote before.
> > >
> >
> > Ok makes sense in that case. Could you just point me towards an
> > example model which has the address width different than the default
> > for its type?
> 
> AFAIK, it's a companion device inside the camera voice coil IC, i.e.
> DONGWOON DW9714.
> 

Nope, actually it is DW9807 instead, which is used on a Samsung Chromebook.

> --
> Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Intel Finland Oy

^ permalink raw reply	[flat|nested] 18+ messages in thread

* RE: [PATCH v2 0/2] Add a property in at24.c
  2018-06-26 16:21             ` Yeh, Andy
@ 2018-06-26 16:31               ` Mani, Rajmohan
  2018-06-26 16:38               ` Andy Shevchenko
  1 sibling, 0 replies; 18+ messages in thread
From: Mani, Rajmohan @ 2018-06-26 16:31 UTC (permalink / raw)
  To: Yeh, Andy, Andy Shevchenko, Bartosz Golaszewski
  Cc: Chiang, AlanX, linux-i2c, Sakari Ailus, Andy Shevchenko,
	Rob Herring, Mark Rutland, Arnd Bergmann, Greg Kroah-Hartman,
	Linux Kernel Mailing List

Hi Bartosz,

> -----Original Message-----
> From: Yeh, Andy
> Sent: Tuesday, June 26, 2018 9:21 AM
> To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>; Bartosz
> Golaszewski <brgl@bgdev.pl>
> Cc: Chiang, AlanX <alanx.chiang@intel.com>; linux-i2c <linux-
> i2c@vger.kernel.org>; Sakari Ailus <sakari.ailus@linux.intel.com>; Mani,
> Rajmohan <rajmohan.mani@intel.com>; Andy Shevchenko
> <andy.shevchenko@gmail.com>; Rob Herring <robh+dt@kernel.org>; Mark
> Rutland <mark.rutland@arm.com>; Arnd Bergmann <arnd@arndb.de>; Greg
> Kroah-Hartman <gregkh@linuxfoundation.org>; Linux Kernel Mailing List
> <linux-kernel@vger.kernel.org>
> Subject: RE: [PATCH v2 0/2] Add a property in at24.c
> 
> > -----Original Message-----
> > From: Andy Shevchenko [mailto:andriy.shevchenko@linux.intel.com]
> > Sent: Tuesday, June 26, 2018 11:48 PM
> > To: Bartosz Golaszewski <brgl@bgdev.pl>
> > Cc: Chiang, AlanX <alanx.chiang@intel.com>; linux-i2c <linux-
> > i2c@vger.kernel.org>; Yeh, Andy <andy.yeh@intel.com>; Sakari Ailus
> > <sakari.ailus@linux.intel.com>; Mani, Rajmohan
> > <rajmohan.mani@intel.com>; Andy Shevchenko
> > <andy.shevchenko@gmail.com>; Rob Herring <robh+dt@kernel.org>; Mark
> > Rutland <mark.rutland@arm.com>; Arnd Bergmann <arnd@arndb.de>; Greg
> > Kroah-Hartman <gregkh@linuxfoundation.org>; Linux Kernel Mailing List
> > <linux- kernel@vger.kernel.org>
> > Subject: Re: [PATCH v2 0/2] Add a property in at24.c
> >
> > On Tue, 2018-06-26 at 15:30 +0200, Bartosz Golaszewski wrote:
> > > 2018-06-26 15:23 GMT+02:00 Andy Shevchenko
> > <andriy.shevchenko@linux.in
> > > tel.com>:
> > > > On Tue, 2018-06-26 at 14:36 +0200, Bartosz Golaszewski wrote:
> > > > > 2018-06-26 14:14 GMT+02:00 Andy Shevchenko
> > > > > <andriy.shevchenko@linux.intel.com>:
> > > > > > On Tue, 2018-06-26 at 09:41 +0200, Bartosz Golaszewski wrote:
> > > > > > > What is your use case exactly? Do you have an EEPROM model
> > > > > > > that's not yet supported explicitly in the driver? Why would
> > > > > > > you need this option?
> > > > > >
> > > > > > The current at24 driver has no address width support,  thus,
> > > > > > reusing same
> > > > > > (allocated) IDs (non-DT case) is hard.
> > > >
> > > > ^^^^^
> > > >
> > > > > Every supported compatible has the width already specified in
> > > > > its corresponding chip data.
> > > >
> > > >
> > > > Please, read again carefully what I wrote before.
> > > >
> > >
> > > Ok makes sense in that case. Could you just point me towards an
> > > example model which has the address width different than the default
> > > for its type?
> >
> > AFAIK, it's a companion device inside the camera voice coil IC, i.e.
> > DONGWOON DW9714.
> >
> 
> Nope, actually it is DW9807 instead, which is used on a Samsung Chromebook.

M24C64S is one example, where reusing same id (non-DT case) is not possible,
since this model uses 16 bits as address width, as the driver supports only
8 bits address width as default.

Thanks
Raj

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 0/2] Add a property in at24.c
  2018-06-26 16:21             ` Yeh, Andy
  2018-06-26 16:31               ` Mani, Rajmohan
@ 2018-06-26 16:38               ` Andy Shevchenko
  1 sibling, 0 replies; 18+ messages in thread
From: Andy Shevchenko @ 2018-06-26 16:38 UTC (permalink / raw)
  To: Yeh, Andy, Bartosz Golaszewski
  Cc: Chiang, AlanX, linux-i2c, Sakari Ailus, Mani, Rajmohan,
	Andy Shevchenko, Rob Herring, Mark Rutland, Arnd Bergmann,
	Greg Kroah-Hartman, Linux Kernel Mailing List

On Tue, 2018-06-26 at 16:21 +0000, Yeh, Andy wrote:

> > > Ok makes sense in that case. Could you just point me towards an
> > > example model which has the address width different than the
> > > default
> > > for its type?
> > 
> > AFAIK, it's a companion device inside the camera voice coil IC, i.e.
> > DONGWOON DW9714.
> > 
> 
> Nope, actually it is DW9807 instead, which is used on a Samsung
> Chromebook.

Ah, okay, good to know.

-- 
Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Intel Finland Oy

^ permalink raw reply	[flat|nested] 18+ messages in thread

* Re: [PATCH v2 1/2] dt-bindings: at24: Add address-width property
  2018-06-26  6:22 ` [PATCH v2 1/2] dt-bindings: at24: Add address-width property alanx.chiang
  2018-06-26  6:49   ` Sakari Ailus
@ 2018-06-26 16:44   ` Rob Herring
  1 sibling, 0 replies; 18+ messages in thread
From: Rob Herring @ 2018-06-26 16:44 UTC (permalink / raw)
  To: Alan Chiang
  Cc: Linux I2C, Andy Yeh, Sakari Ailus, Andy Shevchenko,
	Rajmohan Mani, Andy Shevchenko, Bartosz Golaszewski,
	Mark Rutland, Arnd Bergmann, Greg Kroah-Hartman, linux-kernel

On Tue, Jun 26, 2018 at 12:22 AM <alanx.chiang@intel.com> wrote:
>
> From: "alanx.chiang" <alanx.chiang@intel.com>

Please fix your author name and send bindings to the DT list if you
want them reviewed.

>
> The AT24 series chips use 8-bit address by default. If some
> chips would like to support more than 8 bits, should add the compatible
> field for specfic chips in the driver.
>
> Provide a flexible way to determine the addressing bits through
> address-width in this patch.
>
> Signed-off-by: Alan Chiang <alanx.chiang@intel.com>
> Signed-off-by: Andy Yeh <andy.yeh@intel.com>
>
> ---
> since v1:
> -- Remove the address-width field in the example.
>
> ---
>  Documentation/devicetree/bindings/eeprom/at24.txt | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/eeprom/at24.txt b/Documentation/devicetree/bindings/eeprom/at24.txt
> index 61d833a..9467482 100644
> --- a/Documentation/devicetree/bindings/eeprom/at24.txt
> +++ b/Documentation/devicetree/bindings/eeprom/at24.txt
> @@ -72,6 +72,8 @@ Optional properties:
>
>    - wp-gpios: GPIO to which the write-protect pin of the chip is connected.
>
> +  - address-width : number of address bits (one of 8, 16).
> +
>  Example:
>
>  eeprom@52 {
> --
> 2.7.4
>

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2018-06-26 16:45 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-06-26  6:22 [PATCH v2 0/2] Add a property in at24.c alanx.chiang
2018-06-26  6:22 ` [PATCH v2 1/2] dt-bindings: at24: Add address-width property alanx.chiang
2018-06-26  6:49   ` Sakari Ailus
2018-06-26 16:44   ` Rob Herring
2018-06-26  6:22 ` [PATCH v2 2/2] eeprom: at24: Add support for " alanx.chiang
2018-06-26  6:47   ` Sakari Ailus
2018-06-26  7:11     ` Chiang, AlanX
2018-06-26  7:26       ` Sakari Ailus
2018-06-26 12:11       ` Andy Shevchenko
2018-06-26  7:41 ` [PATCH v2 0/2] Add a property in at24.c Bartosz Golaszewski
2018-06-26 12:14   ` Andy Shevchenko
2018-06-26 12:36     ` Bartosz Golaszewski
2018-06-26 13:23       ` Andy Shevchenko
2018-06-26 13:30         ` Bartosz Golaszewski
2018-06-26 15:48           ` Andy Shevchenko
2018-06-26 16:21             ` Yeh, Andy
2018-06-26 16:31               ` Mani, Rajmohan
2018-06-26 16:38               ` Andy Shevchenko

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).