Skip to contentSkip to conversation

ARM: imx: use device properties for at24 eeprom

PATCH Applied Bartosz Golaszewski 3 participants 7 messages Apr 4, 2018 – Apr 18, 2018

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover ARM: imx: use device properties for at24 eeprom

We want to work towards phasing out the at24_platform_data structure. There are few users and its contents can be represented using generic device properties. Using device properties only will allow us to significantly simplify the at24 configuration code.

This series converts all users of at24_platform_data to using generic device properties or - as is the case with PATCH 1/4 - drops the platform data entirely since it's not needed.

Bartosz Golaszewski (4):
ARM: imx: vpr200: drop at24_platform_data
ARM: imx: pcm043: use device properties for at24 eeprom
ARM: imx: pca100: use device properties for at24 eeprom
ARM: imx: pcm037: use device properties for at24 eeprom

 arch/arm/mach-imx/mach-pca100.c | 13 ++++++-------
 arch/arm/mach-imx/mach-pcm037.c | 13 ++++++-------
 arch/arm/mach-imx/mach-pcm043.c | 13 ++++++-------
 arch/arm/mach-imx/mach-vpr200.c |  9 +--------
 4 files changed, 19 insertions(+), 29 deletions(-)
Signature · 1 line
2.16.3
#1 lore raw

PATCH 1/4 ARM: imx: vpr200: drop at24_platform_data

The information contained in the platform data struct is redundant.

Page size == 1 is the safe default assumed if no pagesize property is given. The EEPROM size can be indicated to the driver using the correct model name.

Drop the at24_platform_data entirely.

---
 arch/arm/mach-imx/mach-vpr200.c | 9 +--------
 1 file changed, 1 insertion(+), 8 deletions(-)
arch/arm/mach-imx/mach-vpr200.c +1 -8
index 5ff154c9a086..da3336aaa4c5 100644
@@ -29,7 +29,6 @@
 #include <asm/mach/time.h>
 
 #include <linux/i2c.h>
-#include <linux/platform_data/at24.h>
 #include <linux/mfd/mc13xxx.h>
 
 #include "common.h"
@@ -145,15 +144,9 @@ static const struct imxi2c_platform_data vpr200_i2c0_data __initconst = {
 	.bitrate = 50000,
 };
 
-static struct at24_platform_data vpr200_eeprom = {
-	.byte_len = 2048 / 8,
-	.page_size = 1,
-};
-
 static struct i2c_board_info vpr200_i2c_devices[] = {
 	{
-		I2C_BOARD_INFO("at24", 0x50), /* E0=0, E1=0, E2=0 */
-		.platform_data = &vpr200_eeprom,
+		I2C_BOARD_INFO("24c02", 0x50), /* E0=0, E1=0, E2=0 */
 	}, {
 		I2C_BOARD_INFO("mc13892", 0x08),
 		.platform_data = &vpr200_pmic,
Signature · 1 line
2.16.3
#2 lore raw

PATCH 2/4 ARM: imx: pcm043: use device properties for at24 eeprom

In reply to Bartosz Golaszewski

We want to work towards phasing out the at24_platform_data structure. There are few users and its contents can be represented using generic device properties. Using device properties only will allow us to significantly simplify the at24 configuration code.

Remove the at24_platform_data structure and replace it with an array of property entries. Specify the exact model instead of the "at24" wildcard and drop the byte_len/size property, as the model name already implies the EEPROM's size.

---
 arch/arm/mach-imx/mach-pcm043.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
arch/arm/mach-imx/mach-pcm043.c +6 -7
index 78e2bf8dcd96..e595e5368676 100644
@@ -24,7 +24,7 @@
 #include <linux/interrupt.h>
 #include <linux/delay.h>
 #include <linux/i2c.h>
-#include <linux/platform_data/at24.h>
+#include <linux/property.h>
 #include <linux/usb/otg.h>
 #include <linux/usb/ulpi.h>
 
@@ -110,16 +110,15 @@ static const struct imxi2c_platform_data pcm043_i2c0_data __initconst = {
 	.bitrate = 50000,
 };
 
-static struct at24_platform_data board_eeprom = {
-	.byte_len = 4096,
-	.page_size = 32,
-	.flags = AT24_FLAG_ADDR16,
+static const struct property_entry board_eeprom_properties[] = {
+	PROPERTY_ENTRY_U32("pagesize", 32),
+	{ }
 };
 
 static struct i2c_board_info pcm043_i2c_devices[] = {
 	{
-		I2C_BOARD_INFO("at24", 0x52), /* E0=0, E1=1, E2=0 */
-		.platform_data = &board_eeprom,
+		I2C_BOARD_INFO("24c32", 0x52), /* E0=0, E1=1, E2=0 */
+		.properties = board_eeprom_properties,
 	}, {
 		I2C_BOARD_INFO("pcf8563", 0x51),
 	},
Signature · 1 line
2.16.3
#3 lore raw

PATCH 3/4 ARM: imx: pca100: use device properties for at24 eeprom

In reply to Bartosz Golaszewski

We want to work towards phasing out the at24_platform_data structure. There are few users and its contents can be represented using generic device properties. Using device properties only will allow us to significantly simplify the at24 configuration code.

Remove the at24_platform_data structure and replace it with an array of property entries. Specify the exact model instead of the "at24" wildcard and drop the byte_len/size property, as the model name already implies the EEPROM's size.

---
 arch/arm/mach-imx/mach-pca100.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
arch/arm/mach-imx/mach-pca100.c +6 -7
index ed675863655b..5714e2f1b106 100644
@@ -20,7 +20,7 @@
 #include <linux/platform_device.h>
 #include <linux/io.h>
 #include <linux/i2c.h>
-#include <linux/platform_data/at24.h>
+#include <linux/property.h>
 #include <linux/dma-mapping.h>
 #include <linux/spi/spi.h>
 #include <linux/spi/eeprom.h>
@@ -168,16 +168,15 @@ static const struct imxi2c_platform_data pca100_i2c1_data __initconst = {
 	.bitrate = 100000,
 };
 
-static struct at24_platform_data board_eeprom = {
-	.byte_len = 4096,
-	.page_size = 32,
-	.flags = AT24_FLAG_ADDR16,
+static const struct property_entry board_eeprom_properties[] = {
+	PROPERTY_ENTRY_U32("pagesize", 32),
+	{ }
 };
 
 static struct i2c_board_info pca100_i2c_devices[] = {
 	{
-		I2C_BOARD_INFO("at24", 0x52), /* E0=0, E1=1, E2=0 */
-		.platform_data = &board_eeprom,
+		I2C_BOARD_INFO("24c32", 0x52), /* E0=0, E1=1, E2=0 */
+		.properties = board_eeprom_properties,
 	}, {
 		I2C_BOARD_INFO("pcf8563", 0x51),
 	}, {
Signature · 1 line
2.16.3
#4 lore raw

PATCH 4/4 ARM: imx: pcm037: use device properties for at24 eeprom

In reply to Bartosz Golaszewski

We want to work towards phasing out the at24_platform_data structure. There are few users and its contents can be represented using generic device properties. Using device properties only will allow us to significantly simplify the at24 configuration code.

Remove the at24_platform_data structure and replace it with an array of property entries. Specify the exact model instead of the "at24" wildcard and drop the byte_len/size property, as the model name already implies the EEPROM's size.

---
 arch/arm/mach-imx/mach-pcm037.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)
arch/arm/mach-imx/mach-pcm037.c +6 -7
index b787ba6897e4..004737c40fda 100644
@@ -23,7 +23,7 @@
 #include <linux/smsc911x.h>
 #include <linux/interrupt.h>
 #include <linux/i2c.h>
-#include <linux/platform_data/at24.h>
+#include <linux/property.h>
 #include <linux/delay.h>
 #include <linux/spi/spi.h>
 #include <linux/irq.h>
@@ -263,16 +263,15 @@ static const struct imxi2c_platform_data pcm037_i2c2_data __initconst = {
 	.bitrate = 20000,
 };
 
-static struct at24_platform_data board_eeprom = {
-	.byte_len = 4096,
-	.page_size = 32,
-	.flags = AT24_FLAG_ADDR16,
+static const struct property_entry board_eeprom_properties[] = {
+	PROPERTY_ENTRY_U32("pagesize", 32),
+	{ }
 };
 
 static struct i2c_board_info pcm037_i2c_devices[] = {
 	{
-		I2C_BOARD_INFO("at24", 0x52), /* E0=0, E1=1, E2=0 */
-		.platform_data = &board_eeprom,
+		I2C_BOARD_INFO("24c32", 0x52), /* E0=0, E1=1, E2=0 */
+		.properties = board_eeprom_properties,
 	}, {
 		I2C_BOARD_INFO("pcf8563", 0x51),
 	}
Signature · 1 line
2.16.3
maintainer Acked-by on the v1 series
#5 lore raw
In reply to Bartosz Golaszewski
Quoted 9 lines · Bartosz Golaszewski

We want to work towards phasing out the at24_platform_data structure. There are few users and its contents can be represented using generic device properties. Using device properties only will allow us to significantly simplify the at24 configuration code.

This series converts all users of at24_platform_data to using generic device properties or - as is the case with PATCH 1/4 - drops the platform data entirely since it's not needed.

Quoted 5 lines

Bartosz Golaszewski (4):
ARM: imx: vpr200: drop at24_platform_data
ARM: imx: pcm043: use device properties for at24 eeprom
ARM: imx: pca100: use device properties for at24 eeprom
ARM: imx: pcm037: use device properties for at24 eeprom

For what it's worth:

Sascha

Signature · 4 lines
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
Applied
#6 lore raw
In reply to Bartosz Golaszewski
Quoted 9 lines · Bartosz Golaszewski

We want to work towards phasing out the at24_platform_data structure. There are few users and its contents can be represented using generic device properties. Using device properties only will allow us to significantly simplify the at24 configuration code.

This series converts all users of at24_platform_data to using generic device properties or - as is the case with PATCH 1/4 - drops the platform data entirely since it's not needed.

Quoted 5 lines

Bartosz Golaszewski (4):
ARM: imx: vpr200: drop at24_platform_data
ARM: imx: pcm043: use device properties for at24 eeprom
ARM: imx: pca100: use device properties for at24 eeprom
ARM: imx: pcm037: use device properties for at24 eeprom

Applied all, thanks.