* [PATCH 01/17] Documentation: i2c: describe devicetree method for instantiating devices
2014-02-10 10:03 [PATCH 00/17] i2c: deprecate class based instantiation for embedded I2C drivers Wolfram Sang
@ 2014-02-10 10:03 ` Wolfram Sang
2014-02-10 18:21 ` linux at roeck-us.net
2014-02-15 14:48 ` Wolfram Sang
2014-02-10 10:03 ` [PATCH 02/17] i2c: add deprecation warning for class based instantiation Wolfram Sang
` (5 subsequent siblings)
6 siblings, 2 replies; 13+ messages in thread
From: Wolfram Sang @ 2014-02-10 10:03 UTC (permalink / raw)
To: linux-arm-kernel
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Cc: devicetree at vger.kernel.org
Cc: linux-arm-kernel at lists.infradead.org
---
Documentation/i2c/instantiating-devices | 34 +++++++++++++++++++++++++++++++--
1 file changed, 32 insertions(+), 2 deletions(-)
diff --git a/Documentation/i2c/instantiating-devices b/Documentation/i2c/instantiating-devices
index c70e7a7..6df095a 100644
--- a/Documentation/i2c/instantiating-devices
+++ b/Documentation/i2c/instantiating-devices
@@ -8,8 +8,8 @@ reason, the kernel code must instantiate I2C devices explicitly. There are
several ways to achieve this, depending on the context and requirements.
-Method 1: Declare the I2C devices by bus number
------------------------------------------------
+Method 1a: Declare the I2C devices by bus number
+------------------------------------------------
This method is appropriate when the I2C bus is a system bus as is the case
for many embedded systems. On such systems, each I2C bus has a number
@@ -51,6 +51,36 @@ The devices will be automatically unbound and destroyed when the I2C bus
they sit on goes away (if ever.)
+Method 1b: Declare the I2C devices via devicetree
+-------------------------------------------------
+
+This method has the same implications as method 1a. The declaration of I2C
+devices is here done via devicetree as subnodes of the master controller.
+
+Example:
+
+ i2c1: i2c at 400a0000 {
+ /* ... master properties skipped ... */
+ clock-frequency = <100000>;
+
+ flash at 50 {
+ compatible = "atmel,24c256";
+ reg = <0x50>;
+ };
+
+ pca9532: gpio at 60 {
+ compatible = "nxp,pca9532";
+ gpio-controller;
+ #gpio-cells = <2>;
+ reg = <0x60>;
+ };
+ };
+
+Here, two devices are attached to the bus using a speed of 100kHz. For
+additional properties which might be needed to set up the device, please refer
+to its devicetree documentation in Documentation/devicetree/bindings/.
+
+
Method 2: Instantiate the devices explicitly
--------------------------------------------
--
1.8.5.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 01/17] Documentation: i2c: describe devicetree method for instantiating devices
2014-02-10 10:03 ` [PATCH 01/17] Documentation: i2c: describe devicetree method for instantiating devices Wolfram Sang
@ 2014-02-10 18:21 ` linux at roeck-us.net
2014-02-12 15:15 ` Wolfram Sang
2014-02-15 14:48 ` Wolfram Sang
1 sibling, 1 reply; 13+ messages in thread
From: linux at roeck-us.net @ 2014-02-10 18:21 UTC (permalink / raw)
To: linux-arm-kernel
Quoting Wolfram Sang <wsa@the-dreams.de>:
> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
> Cc: devicetree at vger.kernel.org
> Cc: linux-arm-kernel at lists.infradead.org
> ---
>
> Documentation/i2c/instantiating-devices | 34
> +++++++++++++++++++++++++++++++--
> 1 file changed, 32 insertions(+), 2 deletions(-)
>
> diff --git a/Documentation/i2c/instantiating-devices
> b/Documentation/i2c/instantiating-devices
> index c70e7a7..6df095a 100644
> --- a/Documentation/i2c/instantiating-devices
> +++ b/Documentation/i2c/instantiating-devices
> @@ -8,8 +8,8 @@ reason, the kernel code must instantiate I2C devices
> explicitly. There are
> several ways to achieve this, depending on the context and requirements.
>
>
> -Method 1: Declare the I2C devices by bus number
> ------------------------------------------------
> +Method 1a: Declare the I2C devices by bus number
> +------------------------------------------------
>
> This method is appropriate when the I2C bus is a system bus as is the case
> for many embedded systems. On such systems, each I2C bus has a number
> @@ -51,6 +51,36 @@ The devices will be automatically unbound and
> destroyed when the I2C bus
> they sit on goes away (if ever.)
>
>
> +Method 1b: Declare the I2C devices via devicetree
> +-------------------------------------------------
> +
Hi Wolfram,
There is now also a means to instantiate I2C devices through
ACPI. This is documented in Documentation/acpi/enumeration.txt.
Might be worthwhile to reference it from instantiating-devices.
I guess that would be a separate patch though.
Thanks,
Guenter
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 01/17] Documentation: i2c: describe devicetree method for instantiating devices
2014-02-10 10:03 ` [PATCH 01/17] Documentation: i2c: describe devicetree method for instantiating devices Wolfram Sang
2014-02-10 18:21 ` linux at roeck-us.net
@ 2014-02-15 14:48 ` Wolfram Sang
1 sibling, 0 replies; 13+ messages in thread
From: Wolfram Sang @ 2014-02-15 14:48 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Feb 10, 2014 at 11:03:55AM +0100, Wolfram Sang wrote:
> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
> Cc: devicetree at vger.kernel.org
> Cc: linux-arm-kernel at lists.infradead.org
Applied to for-current, thanks!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140215/2a5386f4/attachment.sig>
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 02/17] i2c: add deprecation warning for class based instantiation
2014-02-10 10:03 [PATCH 00/17] i2c: deprecate class based instantiation for embedded I2C drivers Wolfram Sang
2014-02-10 10:03 ` [PATCH 01/17] Documentation: i2c: describe devicetree method for instantiating devices Wolfram Sang
@ 2014-02-10 10:03 ` Wolfram Sang
2014-02-10 10:04 ` [PATCH 10/17] i2c: i2c-nomadik: deprecate " Wolfram Sang
` (4 subsequent siblings)
6 siblings, 0 replies; 13+ messages in thread
From: Wolfram Sang @ 2014-02-10 10:03 UTC (permalink / raw)
To: linux-arm-kernel
Class based instantiation can cause noticeable delays when booting. This
mechanism is used when it is not possible to describe slaves on I2C
busses. As we do have other mechanisms, most embedded I2C will not need
classes and for embedded it is explicitly not recommended to use them. Add
a deprecation warning for drivers which want to disable class based
instantiation in the near future to gain boot-up time, so users relying
on this technique can switch to something better. They really should.
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Cc: Jean Delvare <khali@linux-fr.org>
Cc: linux-arm-kernel at lists.infradead.org
---
drivers/i2c/i2c-core.c | 7 +++++++
include/linux/i2c.h | 1 +
2 files changed, 8 insertions(+)
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index d74c0b3..42fcc59 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -1935,6 +1935,13 @@ static int i2c_detect_address(struct i2c_client *temp_client,
struct i2c_client *client;
/* Detection succeeded, instantiate the device */
+ if (adapter->class & I2C_CLASS_DEPRECATED)
+ dev_warn(&adapter->dev,
+ "This adapter will soon drop class based instantiation of devices. "
+ "Please make sure client 0x%02x gets instantiated by other means. "
+ "Check 'Documentation/i2c/instantiating-devices' for details.\n",
+ info.addr);
+
dev_dbg(&adapter->dev, "Creating %s at 0x%02x\n",
info.type, info.addr);
client = i2c_new_device(adapter, &info);
diff --git a/include/linux/i2c.h b/include/linux/i2c.h
index d9c8dbd3..b9e1707 100644
--- a/include/linux/i2c.h
+++ b/include/linux/i2c.h
@@ -473,6 +473,7 @@ void i2c_unlock_adapter(struct i2c_adapter *);
#define I2C_CLASS_HWMON (1<<0) /* lm_sensors, ... */
#define I2C_CLASS_DDC (1<<3) /* DDC bus on graphics adapters */
#define I2C_CLASS_SPD (1<<7) /* Memory modules */
+#define I2C_CLASS_DEPRECATED (1<<8) /* Warn users that adapter will stop using classes */
/* Internal numbers to terminate lists */
#define I2C_CLIENT_END 0xfffeU
--
1.8.5.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 10/17] i2c: i2c-nomadik: deprecate class based instantiation
2014-02-10 10:03 [PATCH 00/17] i2c: deprecate class based instantiation for embedded I2C drivers Wolfram Sang
2014-02-10 10:03 ` [PATCH 01/17] Documentation: i2c: describe devicetree method for instantiating devices Wolfram Sang
2014-02-10 10:03 ` [PATCH 02/17] i2c: add deprecation warning for class based instantiation Wolfram Sang
@ 2014-02-10 10:04 ` Wolfram Sang
2014-02-12 16:24 ` Linus Walleij
2014-02-10 10:04 ` [PATCH 13/17] i2c: i2c-s3c2410: " Wolfram Sang
` (3 subsequent siblings)
6 siblings, 1 reply; 13+ messages in thread
From: Wolfram Sang @ 2014-02-10 10:04 UTC (permalink / raw)
To: linux-arm-kernel
Warn users that class based instantiation is going away soon in favour
of more robust probing and faster bootup times.
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Cc: Alessandro Rubini <rubini@unipv.it>
Cc: Linus Walleij <linus.walleij@linaro.org>
---
This patch is a suggestion. Looking for an ack by someone who actually uses
the driver.
drivers/i2c/busses/i2c-nomadik.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-nomadik.c b/drivers/i2c/busses/i2c-nomadik.c
index 8bf9ac0..e3777ac 100644
--- a/drivers/i2c/busses/i2c-nomadik.c
+++ b/drivers/i2c/busses/i2c-nomadik.c
@@ -1019,7 +1019,7 @@ static int nmk_i2c_probe(struct amba_device *adev, const struct amba_id *id)
adap->dev.of_node = np;
adap->dev.parent = &adev->dev;
adap->owner = THIS_MODULE;
- adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
+ adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD | I2C_CLASS_DEPRECATED;
adap->algo = &nmk_i2c_algo;
adap->timeout = msecs_to_jiffies(pdata->timeout);
snprintf(adap->name, sizeof(adap->name),
--
1.8.5.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 10/17] i2c: i2c-nomadik: deprecate class based instantiation
2014-02-10 10:04 ` [PATCH 10/17] i2c: i2c-nomadik: deprecate " Wolfram Sang
@ 2014-02-12 16:24 ` Linus Walleij
0 siblings, 0 replies; 13+ messages in thread
From: Linus Walleij @ 2014-02-12 16:24 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Feb 10, 2014 at 11:04 AM, Wolfram Sang <wsa@the-dreams.de> wrote:
> Warn users that class based instantiation is going away soon in favour
> of more robust probing and faster bootup times.
>
> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
> Cc: Alessandro Rubini <rubini@unipv.it>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> ---
>
> This patch is a suggestion. Looking for an ack by someone who actually uses
> the driver.
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 13/17] i2c: i2c-s3c2410: deprecate class based instantiation
2014-02-10 10:03 [PATCH 00/17] i2c: deprecate class based instantiation for embedded I2C drivers Wolfram Sang
` (2 preceding siblings ...)
2014-02-10 10:04 ` [PATCH 10/17] i2c: i2c-nomadik: deprecate " Wolfram Sang
@ 2014-02-10 10:04 ` Wolfram Sang
2014-02-10 10:04 ` [PATCH 14/17] i2c: i2c-sirf: " Wolfram Sang
` (2 subsequent siblings)
6 siblings, 0 replies; 13+ messages in thread
From: Wolfram Sang @ 2014-02-10 10:04 UTC (permalink / raw)
To: linux-arm-kernel
Warn users that class based instantiation is going away soon in favour
of more robust probing and faster bootup times.
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Cc: Ben Dooks <ben-linux@fluff.org>
Cc: Kukjin Kim <kgene.kim@samsung.com>
---
This patch is a suggestion. Looking for an ack by someone who actually uses
the driver.
drivers/i2c/busses/i2c-s3c2410.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index bf8fb94..4a623e0 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -1062,7 +1062,7 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
i2c->adap.owner = THIS_MODULE;
i2c->adap.algo = &s3c24xx_i2c_algorithm;
i2c->adap.retries = 2;
- i2c->adap.class = I2C_CLASS_HWMON | I2C_CLASS_SPD;
+ i2c->adap.class = I2C_CLASS_HWMON | I2C_CLASS_SPD | I2C_CLASS_DEPRECATED;
i2c->tx_setup = 50;
init_waitqueue_head(&i2c->wait);
--
1.8.5.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 14/17] i2c: i2c-sirf: deprecate class based instantiation
2014-02-10 10:03 [PATCH 00/17] i2c: deprecate class based instantiation for embedded I2C drivers Wolfram Sang
` (3 preceding siblings ...)
2014-02-10 10:04 ` [PATCH 13/17] i2c: i2c-s3c2410: " Wolfram Sang
@ 2014-02-10 10:04 ` Wolfram Sang
2014-02-10 10:04 ` [PATCH 15/17] i2c: i2c-stu300: " Wolfram Sang
2014-03-28 7:55 ` [PATCH 00/17] i2c: deprecate class based instantiation for embedded I2C drivers Wolfram Sang
6 siblings, 0 replies; 13+ messages in thread
From: Wolfram Sang @ 2014-02-10 10:04 UTC (permalink / raw)
To: linux-arm-kernel
Warn users that class based instantiation is going away soon in favour
of more robust probing and faster bootup times.
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Cc: Barry Song <baohua@kernel.org>
---
This patch is a suggestion. Looking for an ack by someone who actually uses
the driver.
drivers/i2c/busses/i2c-sirf.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-sirf.c b/drivers/i2c/busses/i2c-sirf.c
index 6784f7f..8e3be7e 100644
--- a/drivers/i2c/busses/i2c-sirf.c
+++ b/drivers/i2c/busses/i2c-sirf.c
@@ -312,7 +312,7 @@ static int i2c_sirfsoc_probe(struct platform_device *pdev)
goto out;
}
adap = &siic->adapter;
- adap->class = I2C_CLASS_HWMON;
+ adap->class = I2C_CLASS_HWMON | I2C_CLASS_DEPRECATED;
mem_res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
siic->base = devm_ioremap_resource(&pdev->dev, mem_res);
--
1.8.5.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 15/17] i2c: i2c-stu300: deprecate class based instantiation
2014-02-10 10:03 [PATCH 00/17] i2c: deprecate class based instantiation for embedded I2C drivers Wolfram Sang
` (4 preceding siblings ...)
2014-02-10 10:04 ` [PATCH 14/17] i2c: i2c-sirf: " Wolfram Sang
@ 2014-02-10 10:04 ` Wolfram Sang
2014-02-12 16:22 ` Linus Walleij
2014-03-28 7:55 ` [PATCH 00/17] i2c: deprecate class based instantiation for embedded I2C drivers Wolfram Sang
6 siblings, 1 reply; 13+ messages in thread
From: Wolfram Sang @ 2014-02-10 10:04 UTC (permalink / raw)
To: linux-arm-kernel
Warn users that class based instantiation is going away soon in favour
of more robust probing and faster bootup times.
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Cc: Linus Walleij <linus.walleij@linaro.org>
---
This patch is a suggestion. Looking for an ack by someone who actually uses
the driver.
drivers/i2c/busses/i2c-stu300.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-stu300.c b/drivers/i2c/busses/i2c-stu300.c
index 04a17b9..d381af9 100644
--- a/drivers/i2c/busses/i2c-stu300.c
+++ b/drivers/i2c/busses/i2c-stu300.c
@@ -911,7 +911,7 @@ static int stu300_probe(struct platform_device *pdev)
adap = &dev->adapter;
adap->owner = THIS_MODULE;
/* DDC class but actually often used for more generic I2C */
- adap->class = I2C_CLASS_DDC;
+ adap->class = I2C_CLASS_DDC | I2C_CLASS_DEPRECATED;
strlcpy(adap->name, "ST Microelectronics DDC I2C adapter",
sizeof(adap->name));
adap->nr = bus_nr;
--
1.8.5.1
^ permalink raw reply related [flat|nested] 13+ messages in thread
* [PATCH 15/17] i2c: i2c-stu300: deprecate class based instantiation
2014-02-10 10:04 ` [PATCH 15/17] i2c: i2c-stu300: " Wolfram Sang
@ 2014-02-12 16:22 ` Linus Walleij
0 siblings, 0 replies; 13+ messages in thread
From: Linus Walleij @ 2014-02-12 16:22 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Feb 10, 2014 at 11:04 AM, Wolfram Sang <wsa@the-dreams.de> wrote:
> Warn users that class based instantiation is going away soon in favour
> of more robust probing and faster bootup times.
>
> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
> Cc: Linus Walleij <linus.walleij@linaro.org>
> ---
>
> This patch is a suggestion. Looking for an ack by someone who actually uses
> the driver.
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Yours,
Linus Walleij
^ permalink raw reply [flat|nested] 13+ messages in thread
* [PATCH 00/17] i2c: deprecate class based instantiation for embedded I2C drivers
2014-02-10 10:03 [PATCH 00/17] i2c: deprecate class based instantiation for embedded I2C drivers Wolfram Sang
` (5 preceding siblings ...)
2014-02-10 10:04 ` [PATCH 15/17] i2c: i2c-stu300: " Wolfram Sang
@ 2014-03-28 7:55 ` Wolfram Sang
6 siblings, 0 replies; 13+ messages in thread
From: Wolfram Sang @ 2014-03-28 7:55 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Feb 10, 2014 at 11:03:54AM +0100, Wolfram Sang wrote:
> With I2C, class based instantiation means if a master driver has e.g.
> I2C_CLASS_HWMON set, all slave drivers with this class will try to probe a
> device using an array of possible addresses and some heuristics. That creates
> traffic and needs time, even when nothing is connected. This mechanism is
> needed when you do not have another method to describe the slaves. Embedded I2C
> drivers do not need class based instantiation, since there is i2c_board_info or
> devicetree description. Some drivers have the class flags set, though, and it
> has spread further over the years. We can't remove the flags directly, because
> there might be users out there relying on this feature. So, we add a
> deprecation warning if a device is instantiated via class attributes. After
> giving some time to switch over, we can then finally remove the class flags and
> gain boot time.
>
> Patch 1 adds some missing documentation. Patch 2 adds the deprecation feature.
> Patches 3+4 are tested on hardware I need. Patches 5-17 are suggestions for
> drivers I think could benefit from that. For those, acks are needed before I
> will apply them to my tree. If you use a different driver which can also
> benefit from this, just send a patch adding the new DEPRECATED flag.
>
> The series can also be found here:
>
> git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux.git i2c/deprecated_class
>
> Thanks,
>
> Wolfram
>
>
> Wolfram Sang (17):
> Documentation: i2c: describe devicetree method for instantiating
> devices
> i2c: add deprecation warning for class based instantiation
> i2c: i2c-omap: deprecate class based instantiation
> i2c: i2c-at91: deprecate class based instantiation
> i2c: i2c-bcm2835: deprecate class based instantiation
> i2c: i2c-bfin-twi: deprecate class based instantiation
> i2c: i2c-davinci: deprecate class based instantiation
> i2c: i2c-designware-platdrv: deprecate class based instantiation
> i2c: i2c-mv64xxx: deprecate class based instantiation
> i2c: i2c-nomadik: deprecate class based instantiation
> i2c: i2c-ocores: deprecate class based instantiation
> i2c: i2c-rcar: deprecate class based instantiation
> i2c: i2c-s3c2410: deprecate class based instantiation
> i2c: i2c-sirf: deprecate class based instantiation
> i2c: i2c-stu300: deprecate class based instantiation
> i2c: i2c-tegra: deprecate class based instantiation
> i2c: i2c-xiic: deprecate class based instantiation
I reconsidered and have now applied all patches. That way, all these
drivers can be converted to no class based instantiation in one go after
some grace period. If it turns out, one driver actually needs it, there
is still the grace period left to remove the DEPRECATED flag again.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140328/dd0e039f/attachment-0001.sig>
^ permalink raw reply [flat|nested] 13+ messages in thread