u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] DM: I2C: Reduce overhead when used with OF_PLATDATA
@ 2018-08-21  1:24 Adam Ford
  2018-08-21  1:24 ` [U-Boot] [PATCH 2/2] DM: OMAP24XX_I2C: " Adam Ford
  2018-09-18 21:24 ` [U-Boot] [U-Boot, 1/2] DM: I2C: " Tom Rini
  0 siblings, 2 replies; 4+ messages in thread
From: Adam Ford @ 2018-08-21  1:24 UTC (permalink / raw)
  To: u-boot

Platforms with limited resources in SPL may enably OF_PLATDATA,
this limits some of the library functions and cannot extract data
from the device tree.  This patch adds additional wrappers around
these functions to only allow them when OF_CONTROL is enabled and
OF_PLATDATA is not.

Signed-off-by: Adam Ford <aford173@gmail.com>

diff --git a/drivers/i2c/i2c-uclass.c b/drivers/i2c/i2c-uclass.c
index 5e58dd0916..c5a3c4e201 100644
--- a/drivers/i2c/i2c-uclass.c
+++ b/drivers/i2c/i2c-uclass.c
@@ -562,7 +562,7 @@ int i2c_deblock(struct udevice *bus)
 	return ops->deblock(bus);
 }
 
-#if CONFIG_IS_ENABLED(OF_CONTROL)
+#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
 int i2c_chip_ofdata_to_platdata(struct udevice *dev, struct dm_i2c_chip *chip)
 {
 	int addr;
@@ -584,7 +584,7 @@ int i2c_chip_ofdata_to_platdata(struct udevice *dev, struct dm_i2c_chip *chip)
 
 static int i2c_post_probe(struct udevice *dev)
 {
-#if CONFIG_IS_ENABLED(OF_CONTROL)
+#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
 	struct dm_i2c_bus *i2c = dev_get_uclass_priv(dev);
 
 	i2c->speed_hz = dev_read_u32_default(dev, "clock-frequency", 100000);
@@ -597,7 +597,7 @@ static int i2c_post_probe(struct udevice *dev)
 
 static int i2c_child_post_bind(struct udevice *dev)
 {
-#if CONFIG_IS_ENABLED(OF_CONTROL)
+#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
 	struct dm_i2c_chip *plat = dev_get_parent_platdata(dev);
 
 	if (!dev_of_valid(dev))
@@ -612,7 +612,7 @@ UCLASS_DRIVER(i2c) = {
 	.id		= UCLASS_I2C,
 	.name		= "i2c",
 	.flags		= DM_UC_FLAG_SEQ_ALIAS,
-#if CONFIG_IS_ENABLED(OF_CONTROL)
+#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
 	.post_bind	= dm_scan_fdt_dev,
 #endif
 	.post_probe	= i2c_post_probe,
-- 
2.17.1

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

* [U-Boot] [PATCH 2/2] DM: OMAP24XX_I2C: Reduce overhead when used with OF_PLATDATA
  2018-08-21  1:24 [U-Boot] [PATCH 1/2] DM: I2C: Reduce overhead when used with OF_PLATDATA Adam Ford
@ 2018-08-21  1:24 ` Adam Ford
  2018-09-18 21:25   ` [U-Boot] [U-Boot, " Tom Rini
  2018-09-18 21:24 ` [U-Boot] [U-Boot, 1/2] DM: I2C: " Tom Rini
  1 sibling, 1 reply; 4+ messages in thread
From: Adam Ford @ 2018-08-21  1:24 UTC (permalink / raw)
  To: u-boot

Platforms with limited resources in SPL may enably OF_PLATDATA,
this limits some of the library functions and cannot extract data
from the device tree.  This patch adds additional wrappers around
these functions to only allow them when OF_CONTROL is enabled and
OF_PLATDATA is not.

Signed-off-by: Adam Ford <aford173@gmail.com>

diff --git a/drivers/i2c/omap24xx_i2c.c b/drivers/i2c/omap24xx_i2c.c
index 0759585c9e..54bf35e552 100644
--- a/drivers/i2c/omap24xx_i2c.c
+++ b/drivers/i2c/omap24xx_i2c.c
@@ -890,6 +890,7 @@ static int omap_i2c_probe(struct udevice *bus)
 	return 0;
 }
 
+#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
 static int omap_i2c_ofdata_to_platdata(struct udevice *bus)
 {
 	struct omap_i2c *priv = dev_get_priv(bus);
@@ -901,23 +902,26 @@ static int omap_i2c_ofdata_to_platdata(struct udevice *bus)
 	return 0;
 }
 
-static const struct dm_i2c_ops omap_i2c_ops = {
-	.xfer		= omap_i2c_xfer,
-	.probe_chip	= omap_i2c_probe_chip,
-	.set_bus_speed	= omap_i2c_set_bus_speed,
-};
-
 static const struct udevice_id omap_i2c_ids[] = {
 	{ .compatible = "ti,omap3-i2c" },
 	{ .compatible = "ti,omap4-i2c" },
 	{ }
 };
+#endif
+
+static const struct dm_i2c_ops omap_i2c_ops = {
+	.xfer		= omap_i2c_xfer,
+	.probe_chip	= omap_i2c_probe_chip,
+	.set_bus_speed	= omap_i2c_set_bus_speed,
+};
 
 U_BOOT_DRIVER(i2c_omap) = {
 	.name	= "i2c_omap",
 	.id	= UCLASS_I2C,
+#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
 	.of_match = omap_i2c_ids,
 	.ofdata_to_platdata = omap_i2c_ofdata_to_platdata,
+#endif
 	.probe	= omap_i2c_probe,
 	.priv_auto_alloc_size = sizeof(struct omap_i2c),
 	.ops	= &omap_i2c_ops,
-- 
2.17.1

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

* [U-Boot] [U-Boot, 1/2] DM: I2C: Reduce overhead when used with OF_PLATDATA
  2018-08-21  1:24 [U-Boot] [PATCH 1/2] DM: I2C: Reduce overhead when used with OF_PLATDATA Adam Ford
  2018-08-21  1:24 ` [U-Boot] [PATCH 2/2] DM: OMAP24XX_I2C: " Adam Ford
@ 2018-09-18 21:24 ` Tom Rini
  1 sibling, 0 replies; 4+ messages in thread
From: Tom Rini @ 2018-09-18 21:24 UTC (permalink / raw)
  To: u-boot

On Mon, Aug 20, 2018 at 08:24:34PM -0500, Adam Ford wrote:

> Platforms with limited resources in SPL may enably OF_PLATDATA,
> this limits some of the library functions and cannot extract data
> from the device tree.  This patch adds additional wrappers around
> these functions to only allow them when OF_CONTROL is enabled and
> OF_PLATDATA is not.
> 
> Signed-off-by: Adam Ford <aford173@gmail.com>
> 
> diff --git a/drivers/i2c/i2c-uclass.c b/drivers/i2c/i2c-uclass.c
> index 5e58dd0916..c5a3c4e201 100644

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180918/6d288212/attachment.sig>

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

* [U-Boot] [U-Boot, 2/2] DM: OMAP24XX_I2C: Reduce overhead when used with OF_PLATDATA
  2018-08-21  1:24 ` [U-Boot] [PATCH 2/2] DM: OMAP24XX_I2C: " Adam Ford
@ 2018-09-18 21:25   ` Tom Rini
  0 siblings, 0 replies; 4+ messages in thread
From: Tom Rini @ 2018-09-18 21:25 UTC (permalink / raw)
  To: u-boot

On Mon, Aug 20, 2018 at 08:24:35PM -0500, Adam Ford wrote:

> Platforms with limited resources in SPL may enably OF_PLATDATA,
> this limits some of the library functions and cannot extract data
> from the device tree.  This patch adds additional wrappers around
> these functions to only allow them when OF_CONTROL is enabled and
> OF_PLATDATA is not.
> 
> Signed-off-by: Adam Ford <aford173@gmail.com>
> 
> diff --git a/drivers/i2c/omap24xx_i2c.c b/drivers/i2c/omap24xx_i2c.c
> index 0759585c9e..54bf35e552 100644

Applied to u-boot/master, thanks!

-- 
Tom
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 819 bytes
Desc: not available
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20180918/93df6f96/attachment.sig>

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

end of thread, other threads:[~2018-09-18 21:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-08-21  1:24 [U-Boot] [PATCH 1/2] DM: I2C: Reduce overhead when used with OF_PLATDATA Adam Ford
2018-08-21  1:24 ` [U-Boot] [PATCH 2/2] DM: OMAP24XX_I2C: " Adam Ford
2018-09-18 21:25   ` [U-Boot] [U-Boot, " Tom Rini
2018-09-18 21:24 ` [U-Boot] [U-Boot, 1/2] DM: I2C: " Tom Rini

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