[RESEND PATCH v4 2/2] eeprom: at24: Add support for address-width property
From: Alan Chiang 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 Signed-off-by: Andy Yeh --- drivers/misc/eeprom/at24.c | 17 + 1 file changed, 17 insertions(+) diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c index 0c125f2..7ea640b 100644 --- a/drivers/misc/eeprom/at24.c +++ b/drivers/misc/eeprom/at24.c @@ -478,6 +478,23 @@ 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: + if (chip->flags & AT24_FLAG_ADDR16) + dev_warn(dev, "Override address width to be 8, while default is 16\n"); + chip->flags &= ~AT24_FLAG_ADDR16; + 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
[RESEND PATCH v4 1/2] dt-bindings: at24: Add address-width property
From: Alan Chiang Currently the only way to use a variant of a supported model with a different address with a different address width is to define a new compatible string and the corresponding chip data structure. Provide a flexible way to specify the size of the address pointer by defining a new property: address-width. Signed-off-by: Alan Chiang Signed-off-by: Andy Yeh Acked-by: Sakari Ailus Reviewed-by: Rob Herring --- 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..aededdb 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
[RESEND PATCH v4 0/2] Add aproperty in at24.c
From: Alan Chiang The RESEND PATCH modifies the commit message and adds the Reviewed-by. 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. Alan 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| 17 + 2 files changed, 19 insertions(+) -- 2.7.4
[RESEND PATCH v4 1/2] dt-bindings: at24: Add address-width property
From: Alan Chiang The AT24 series chips use 8-bit address by default. If some chips would like to support more than 8 bits, the at24 driver should be added the compatible field for specfic chips. Provide a flexible way to determine the addressing bits through address-width in this patch. Signed-off-by: Alan Chiang Signed-off-by: Andy Yeh Acked-by: Sakari Ailus --- since v1: -- Remove the address-width field in the example. since v2: -- Remove redundant space. since v3: -- Add Acked-by. --- 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..aededdb 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
[RESEND PATCH v4 2/2] eeprom: at24: Add support for address-width property
From: Alan Chiang 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 Signed-off-by: Andy Yeh Reviewed-by: Andy Shevchenko Acked-by: Sakari Ailus --- since v1 -- Add a warn message for 8-bit addressing. since v2 -- Modify the warning message for clear. -- Move the clearing bit operation outside of a statement. since v3 -- Merge the warning message into one line. --- drivers/misc/eeprom/at24.c | 17 + 1 file changed, 17 insertions(+) diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c index 0c125f2..7ea640b 100644 --- a/drivers/misc/eeprom/at24.c +++ b/drivers/misc/eeprom/at24.c @@ -478,6 +478,23 @@ 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: + if (chip->flags & AT24_FLAG_ADDR16) + dev_warn(dev, "Override address width to be 8, while default is 16\n"); + chip->flags &= ~AT24_FLAG_ADDR16; + 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
[RESEND PATCH v4 0/2] Add a property in at24.c
From: Alan Chiang This RESEND PATCH only adds the Acked-by and Reviewed-by, no other patch for the codes. 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. Alan 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| 17 + 2 files changed, 19 insertions(+) -- 2.7.4
[PATCH v4 0/2] Add a property in at24.c
From: Alan Chiang 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. Alan 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| 17 + 2 files changed, 19 insertions(+) -- 2.7.4
[PATCH v4 1/2] dt-bindings: at24: Add address-width property
From: Alan Chiang The AT24 series chips use 8-bit address by default. If some chips would like to support more than 8 bits, the at24 driver should be added the compatible field for specfic chips. Provide a flexible way to determine the addressing bits through address-width in this patch. Signed-off-by: Alan Chiang Signed-off-by: Andy Yeh Acked-by: Sakari Ailus --- since v1: -- Remove the address-width field in the example. since v2: -- Remove redundant space. since v3: -- Add Acked-by. --- 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..aededdb 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
[PATCH v4 2/2] eeprom: at24: Add support for address-width property
From: Alan Chiang 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 Signed-off-by: Andy Yeh --- since v1 -- Add a warn message for 8-bit addressing. since v2 -- Modify the warning message for clear. -- Move the clearing bit operation outside of a statement. since v3 -- Merge the warning message into one line. --- drivers/misc/eeprom/at24.c | 17 + 1 file changed, 17 insertions(+) diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c index 0c125f2..7ea640b 100644 --- a/drivers/misc/eeprom/at24.c +++ b/drivers/misc/eeprom/at24.c @@ -478,6 +478,23 @@ 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: + if (chip->flags & AT24_FLAG_ADDR16) + dev_warn(dev, "Override address width to be 8, while default is 16\n"); + chip->flags &= ~AT24_FLAG_ADDR16; + 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
[PATCH v3 0/2] Add a property in at24.c
From: Alan Chiang 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. Alan 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| 18 ++ 2 files changed, 20 insertions(+) -- 2.7.4
[PATCH v3 1/2] dt-bindings: at24: Add address-width property
From: Alan Chiang The AT24 series chips use 8-bit address by default. If some chips would like to support more than 8 bits, the at24 driver should be added the compatible field for specfic chips. Provide a flexible way to determine the addressing bits through address-width in this patch. Signed-off-by: Alan Chiang Signed-off-by: Andy Yeh --- since v1: -- Remove the address-width field in the example. since v2: -- Remove redundant space. --- 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..aededdb 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
[PATCH v3 2/2] eeprom: at24: Add support for address-width property
From: Alan Chiang 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 Signed-off-by: Andy Yeh --- since v1 -- Add a warn message for 8-bit addressing. since v2 -- Modify the warning message for clear. -- Move the clearing bit operation outside of a statement. --- drivers/misc/eeprom/at24.c | 18 ++ 1 file changed, 18 insertions(+) diff --git a/drivers/misc/eeprom/at24.c b/drivers/misc/eeprom/at24.c index 0c125f2..d606f3b 100644 --- a/drivers/misc/eeprom/at24.c +++ b/drivers/misc/eeprom/at24.c @@ -478,6 +478,24 @@ 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: + if (chip->flags & AT24_FLAG_ADDR16) + dev_warn(dev, "Override address width to be 8," +"while default is 16\n"); + chip->flags &= ~AT24_FLAG_ADDR16; + 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
[PATCH v2 1/2] dt-bindings: at24: Add address-width property
From: "alanx.chiang" 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 Signed-off-by: Andy Yeh --- 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
[PATCH v2 2/2] eeprom: at24: Add support for address-width property
From: "alanx.chiang" 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 Signed-off-by: Andy Yeh --- 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
[PATCH v2 0/2] Add a property in at24.c
From: "alanx.chiang" 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