summaryrefslogtreecommitdiffstats
path: root/drivers/i2c/busses/i2c-rk3x.c
diff options
context:
space:
mode:
authorDavid Wu <david.wu@rock-chips.com>2016-05-16 21:57:39 +0800
committerWolfram Sang <wsa@the-dreams.de>2016-06-17 13:39:15 +0200
commitbef358c4fe2efa7467297303cafe973748afda93 (patch)
tree9ac77848d066b4e254051e164b5a23789d7072d6 /drivers/i2c/busses/i2c-rk3x.c
parent69eda367ac4240428b9d16ab0c81113753ea079a (diff)
downloadlinux-bef358c4fe2efa7467297303cafe973748afda93.tar.bz2
i2c: rk3x: Change SoC data to not use array
Specifying the i2c SoC data in an array provides very little benefit and gets unwieldly / confusing as the array grows since the next bit of code needs to refer to elements in the array by their raw integral index. Let's just create a single 'static const' structure for each SoC so that we can refer to these structures by ID. Signed-off-by: David Wu <david.wu@rock-chips.com> Reviewed-by: Heiko Stuebner <heiko@sntech.de> Suggested-by: Douglas Anderson <dianders@chromium.org> Reviewed-by: Douglas Anderson <dianders@chromium.org> Tested-by: Heiko Stuebner <heiko@sntech.de> Signed-off-by: Wolfram Sang <wsa@the-dreams.de>
Diffstat (limited to 'drivers/i2c/busses/i2c-rk3x.c')
-rw-r--r--drivers/i2c/busses/i2c-rk3x.c38
1 files changed, 30 insertions, 8 deletions
diff --git a/drivers/i2c/busses/i2c-rk3x.c b/drivers/i2c/busses/i2c-rk3x.c
index 9eeb4e5312f3..d7a871f9a52d 100644
--- a/drivers/i2c/busses/i2c-rk3x.c
+++ b/drivers/i2c/busses/i2c-rk3x.c
@@ -864,17 +864,39 @@ static const struct i2c_algorithm rk3x_i2c_algorithm = {
.functionality = rk3x_i2c_func,
};
-static struct rk3x_i2c_soc_data soc_data[3] = {
- { .grf_offset = 0x154 }, /* rk3066 */
- { .grf_offset = 0x0a4 }, /* rk3188 */
- { .grf_offset = -1 }, /* no I2C switching needed */
+static const struct rk3x_i2c_soc_data rk3066_soc_data = {
+ .grf_offset = 0x154,
+};
+
+static const struct rk3x_i2c_soc_data rk3188_soc_data = {
+ .grf_offset = 0x0a4,
+};
+
+static const struct rk3x_i2c_soc_data rk3228_soc_data = {
+ .grf_offset = -1,
+};
+
+static const struct rk3x_i2c_soc_data rk3288_soc_data = {
+ .grf_offset = -1,
};
static const struct of_device_id rk3x_i2c_match[] = {
- { .compatible = "rockchip,rk3066-i2c", .data = (void *)&soc_data[0] },
- { .compatible = "rockchip,rk3188-i2c", .data = (void *)&soc_data[1] },
- { .compatible = "rockchip,rk3228-i2c", .data = (void *)&soc_data[2] },
- { .compatible = "rockchip,rk3288-i2c", .data = (void *)&soc_data[2] },
+ {
+ .compatible = "rockchip,rk3066-i2c",
+ .data = (void *)&rk3066_soc_data
+ },
+ {
+ .compatible = "rockchip,rk3188-i2c",
+ .data = (void *)&rk3188_soc_data
+ },
+ {
+ .compatible = "rockchip,rk3228-i2c",
+ .data = (void *)&rk3228_soc_data
+ },
+ {
+ .compatible = "rockchip,rk3288-i2c",
+ .data = (void *)&rk3288_soc_data
+ },
{},
};
MODULE_DEVICE_TABLE(of, rk3x_i2c_match);