diff options
author | Guenter Roeck <linux@roeck-us.net> | 2013-07-10 15:03:21 -0400 |
---|---|---|
committer | Wolfram Sang <wsa@the-dreams.de> | 2013-08-07 11:30:04 -0400 |
commit | 421476aeed56a8d19c890ae6729e3c43b740da7a (patch) | |
tree | 0fd92df9b573fde8c930da6301a6eea0a79ac833 /drivers/i2c | |
parent | c66c4cc087eb1f5307f6391e467797227aed758a (diff) |
i2c: mpc: Define unique I2C adapter names
The I2C adapters on Freescale MPC107/824x/85xx/512x/52xx/83xx/86xx all
have the same name "MPC adapter". Since I2C adapter numbers can change
across reboots and even after loading/unloading an I2C bus master driver,
adapter names have to be used to identify adapters and thus should be
unique and well defined. Since this is not the case with this driver,
it is difficult if not impossible to identify a specific adapter from
user space on affected platforms.
To remedy the problem, use the adapter memory address as part of the
adapter name.
With this patch, adapter names are:
On P2020:
MPC adapter at 0xfff703000
MPC adapter at 0xfff703100
On P5040:
MPC adapter at 0xffe118000
MPC adapter at 0xffe118100
MPC adapter at 0xffe119000
MPC adapter at 0xffe119100
Signed-off-by: Guenter Roeck <linux@roeck-us.net>
Acked-by: Jean Delvare <khali@linux-fr.org>
Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-mpc.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c index 7607dc061918..99acf636e496 100644 --- a/drivers/i2c/busses/i2c-mpc.c +++ b/drivers/i2c/busses/i2c-mpc.c | |||
@@ -609,7 +609,6 @@ static const struct i2c_algorithm mpc_algo = { | |||
609 | 609 | ||
610 | static struct i2c_adapter mpc_ops = { | 610 | static struct i2c_adapter mpc_ops = { |
611 | .owner = THIS_MODULE, | 611 | .owner = THIS_MODULE, |
612 | .name = "MPC adapter", | ||
613 | .algo = &mpc_algo, | 612 | .algo = &mpc_algo, |
614 | .timeout = HZ, | 613 | .timeout = HZ, |
615 | }; | 614 | }; |
@@ -623,6 +622,7 @@ static int fsl_i2c_probe(struct platform_device *op) | |||
623 | u32 clock = MPC_I2C_CLOCK_LEGACY; | 622 | u32 clock = MPC_I2C_CLOCK_LEGACY; |
624 | int result = 0; | 623 | int result = 0; |
625 | int plen; | 624 | int plen; |
625 | struct resource res; | ||
626 | 626 | ||
627 | match = of_match_device(mpc_i2c_of_match, &op->dev); | 627 | match = of_match_device(mpc_i2c_of_match, &op->dev); |
628 | if (!match) | 628 | if (!match) |
@@ -682,6 +682,9 @@ static int fsl_i2c_probe(struct platform_device *op) | |||
682 | platform_set_drvdata(op, i2c); | 682 | platform_set_drvdata(op, i2c); |
683 | 683 | ||
684 | i2c->adap = mpc_ops; | 684 | i2c->adap = mpc_ops; |
685 | of_address_to_resource(op->dev.of_node, 0, &res); | ||
686 | scnprintf(i2c->adap.name, sizeof(i2c->adap.name), | ||
687 | "MPC adapter at 0x%llx", (unsigned long long)res.start); | ||
685 | i2c_set_adapdata(&i2c->adap, i2c); | 688 | i2c_set_adapdata(&i2c->adap, i2c); |
686 | i2c->adap.dev.parent = &op->dev; | 689 | i2c->adap.dev.parent = &op->dev; |
687 | i2c->adap.dev.of_node = of_node_get(op->dev.of_node); | 690 | i2c->adap.dev.of_node = of_node_get(op->dev.of_node); |