Skip to contentSkip to conversation

i2c: Drop redundant platform data setting in drivers

PATCH New Simon Glass 4 participants 7 messages Aug 6, 2016 – Aug 9, 2016

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

PATCH 1/2 i2c: Drop redundant platform data setting in drivers

The i2c uclass has a default setting for per_child_platdata_auto_alloc_size so drivers do not need to set it. Remove this from drivers to avoid confusion.

---

 drivers/i2c/cros_ec_ldo.c          | 1 -
 drivers/i2c/cros_ec_tunnel.c       | 1 -
 drivers/i2c/intel_i2c.c            | 1 -
 drivers/i2c/muxes/i2c-mux-uclass.c | 1 -
 drivers/i2c/s3c24x0_i2c.c          | 2 --
 5 files changed, 6 deletions(-)
drivers/i2c/cros_ec_ldo.c +0 -1
index b817c61..a4cd660 100644
@@ -72,6 +72,5 @@ U_BOOT_DRIVER(cros_ec_ldo) = {
 	.name	= "cros_ec_ldo_tunnel",
 	.id	= UCLASS_I2C,
 	.of_match = cros_ec_i2c_ids,
-	.per_child_auto_alloc_size = sizeof(struct dm_i2c_chip),
 	.ops	= &cros_ec_i2c_ops,
 };
drivers/i2c/cros_ec_tunnel.c +0 -1
index 7ab1fd8..e2c6e44 100644
@@ -36,6 +36,5 @@ U_BOOT_DRIVER(cros_ec_tunnel) = {
 	.name	= "cros_ec_tunnel",
 	.id	= UCLASS_I2C,
 	.of_match = cros_ec_i2c_ids,
-	.per_child_auto_alloc_size = sizeof(struct dm_i2c_chip),
 	.ops	= &cros_ec_i2c_ops,
 };
drivers/i2c/intel_i2c.c +0 -1
index 8b63916..5b7953a 100644
@@ -325,7 +325,6 @@ U_BOOT_DRIVER(intel_i2c) = {
 	.name	= "i2c_intel",
 	.id	= UCLASS_I2C,
 	.of_match = intel_i2c_ids,
-	.per_child_auto_alloc_size = sizeof(struct dm_i2c_chip),
 	.ops	= &intel_i2c_ops,
 	.priv_auto_alloc_size = sizeof(struct intel_i2c),
 	.bind	= intel_i2c_bind,
drivers/i2c/muxes/i2c-mux-uclass.c +0 -1
index 3f52bff..7a698b6 100644
@@ -183,7 +183,6 @@ static const struct dm_i2c_ops i2c_mux_bus_ops = {
 U_BOOT_DRIVER(i2c_mux_bus) = {
 	.name		= "i2c_mux_bus_drv",
 	.id		= UCLASS_I2C,
-	.per_child_auto_alloc_size = sizeof(struct dm_i2c_chip),
 	.ops	= &i2c_mux_bus_ops,
 };
 
drivers/i2c/s3c24x0_i2c.c +0 -2
index dc9b661..eab49d0 100644
@@ -1433,7 +1433,6 @@ U_BOOT_DRIVER(i2c_s3c) = {
 	.id	= UCLASS_I2C,
 	.of_match = s3c_i2c_ids,
 	.ofdata_to_platdata = s3c_i2c_ofdata_to_platdata,
-	.per_child_auto_alloc_size = sizeof(struct dm_i2c_chip),
 	.priv_auto_alloc_size = sizeof(struct s3c24x0_i2c_bus),
 	.ops	= &s3c_i2c_ops,
 };
@@ -1458,7 +1457,6 @@ U_BOOT_DRIVER(hs_i2c) = {
 	.id	= UCLASS_I2C,
 	.of_match = exynos_hs_i2c_ids,
 	.ofdata_to_platdata = s3c_i2c_ofdata_to_platdata,
-	.per_child_auto_alloc_size = sizeof(struct dm_i2c_chip),
 	.priv_auto_alloc_size = sizeof(struct s3c24x0_i2c_bus),
 	.ops	= &exynos_hs_i2c_ops,
 };
Signature · 1 line
2.8.0.rc3.226.g39d4020
#1 lore raw

PATCH 2/2 x86: i2c: Avoid using BSS before it is available

If intel_i2c_bind() is called before relocation there is no BSS section available. Use the data section instead, which is always available.

A better fix might be to use global_data, perhaps a new member in x86's struct arch_global_data. Comments welcome.

---

 drivers/i2c/intel_i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/i2c/intel_i2c.c +1 -1
index 5b7953a..01badf2 100644
@@ -289,7 +289,7 @@ static int intel_i2c_probe(struct udevice *dev)
 
 static int intel_i2c_bind(struct udevice *dev)
 {
-	static int num_cards;
+	static int num_cards __attribute__ ((section(".data")));
 	char name[20];
 
 	/* Create a unique device name for PCI type devices */
Signature · 1 line
2.8.0.rc3.226.g39d4020
#2 lore raw

PATCH 2/2 x86: i2c: Avoid using BSS before it is available

Quoted 12 lines · Simon Glass

If intel_i2c_bind() is called before relocation there is no BSS section available. Use the data section instead, which is always available.

A better fix might be to use global_data, perhaps a new member in x86's struct arch_global_data. Comments welcome.

---

 drivers/i2c/intel_i2c.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
#3 lore raw

PATCH 2/2 x86: i2c: Avoid using BSS before it is available

Hello Simon,

Am 07.08.2016 um 08:54 schrieb Bin Meng:

Quoted 7 lines · Simon Glass
Quoted 6 lines

If intel_i2c_bind() is called before relocation there is no BSS section available. Use the data section instead, which is always available.

A better fix might be to use global_data, perhaps a new member in x86's struct arch_global_data. Comments welcome.

Quoted 8 lines
Quoted 6 lines

---

  drivers/i2c/intel_i2c.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Hmm... I see no i2c_bind() in mainline U-Boot drivers/i2c/intel_i2c.c driver ?

Is this patch and also patch:
http://patchwork.ozlabs.org/patch/656335/

dependend on another patch(or patchserie) ?

bye,
Heiko

Signature · 2 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
#4 lore raw

PATCH 2/2 x86: i2c: Avoid using BSS before it is available

Hi Heiko,

Quoted 23 lines · Heiko Schocher

Hello Simon,

Am 07.08.2016 um 08:54 schrieb Bin Meng:

Quoted 9 lines · Simon Glass
Quoted 7 lines

If intel_i2c_bind() is called before relocation there is no BSS section available. Use the data section instead, which is always available.

A better fix might be to use global_data, perhaps a new member in x86's struct arch_global_data. Comments welcome.

Quoted 8 lines
Quoted 6 lines

---

  drivers/i2c/intel_i2c.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
Quoted 7 lines

Hmm... I see no i2c_bind() in mainline U-Boot drivers/i2c/intel_i2c.c driver ?

Is this patch and also patch:
http://patchwork.ozlabs.org/patch/656335/

dependend on another patch(or patchserie) ?

Yes it depends on Stefan's x86 i2c driver. He asked me to take a look. It can be squashed in - will leave this to Stefan.

Regards,
Simon

#5 lore raw

PATCH 2/2 x86: i2c: Avoid using BSS before it is available

Hi Simon,

Quoted 27 lines · Simon Glass
Quoted 26 lines · Heiko Schocher

Hello Simon,

Am 07.08.2016 um 08:54 schrieb Bin Meng:

Quoted 9 lines · Simon Glass
Quoted 7 lines

If intel_i2c_bind() is called before relocation there is no BSS section available. Use the data section instead, which is always available.

A better fix might be to use global_data, perhaps a new member in x86's struct arch_global_data. Comments welcome.

Quoted 8 lines
Quoted 6 lines

---

  drivers/i2c/intel_i2c.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)

Hmm... I see no i2c_bind() in mainline U-Boot drivers/i2c/intel_i2c.c driver ?

Quoted 7 lines
Quoted 4 lines

Is this patch and also patch:
http://patchwork.ozlabs.org/patch/656335/

dependend on another patch(or patchserie) ?

Yes it depends on Stefan's x86 i2c driver. He asked me to take a look. It can be squashed in - will leave this to Stefan.

I have squashed it in v2 of the SMBus I2C driver patch which will hit the list very soon.

Thanks,
Stefan
Avoid

#6 lore raw

PATCH 1/2 i2c: Drop redundant platform data setting in drivers

In reply to Simon Glass
Quoted 5 lines · Simon Glass

The i2c uclass has a default setting for per_child_platdata_auto_alloc_size so drivers do not need to set it. Remove this from drivers to avoid confusion.

Quoted 9 lines

---

 drivers/i2c/cros_ec_ldo.c          | 1 -
 drivers/i2c/cros_ec_tunnel.c       | 1 -
 drivers/i2c/intel_i2c.c            | 1 -
 drivers/i2c/muxes/i2c-mux-uclass.c | 1 -
 drivers/i2c/s3c24x0_i2c.c          | 2 --
 5 files changed, 6 deletions(-)