i2c-rk3x.c (a4721ced760684d1776bf31f7925aa41bb3f4846) | i2c-rk3x.c (e0442d76213981ab48e8ea0874bb6c47e3af5a36) |
---|---|
1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Driver for I2C adapter in Rockchip RK3xxx SoC 4 * 5 * Max Schwarz <max.schwarz@online.de> 6 * based on the patches by Rockchip Inc. 7 */ 8 --- 1179 unchanged lines hidden (view full) --- 1188}; 1189MODULE_DEVICE_TABLE(of, rk3x_i2c_match); 1190 1191static int rk3x_i2c_probe(struct platform_device *pdev) 1192{ 1193 struct device_node *np = pdev->dev.of_node; 1194 const struct of_device_id *match; 1195 struct rk3x_i2c *i2c; | 1// SPDX-License-Identifier: GPL-2.0-only 2/* 3 * Driver for I2C adapter in Rockchip RK3xxx SoC 4 * 5 * Max Schwarz <max.schwarz@online.de> 6 * based on the patches by Rockchip Inc. 7 */ 8 --- 1179 unchanged lines hidden (view full) --- 1188}; 1189MODULE_DEVICE_TABLE(of, rk3x_i2c_match); 1190 1191static int rk3x_i2c_probe(struct platform_device *pdev) 1192{ 1193 struct device_node *np = pdev->dev.of_node; 1194 const struct of_device_id *match; 1195 struct rk3x_i2c *i2c; |
1196 struct resource *mem; | |
1197 int ret = 0; 1198 int bus_nr; 1199 u32 value; 1200 int irq; 1201 unsigned long clk_rate; 1202 1203 i2c = devm_kzalloc(&pdev->dev, sizeof(struct rk3x_i2c), GFP_KERNEL); 1204 if (!i2c) --- 13 unchanged lines hidden (view full) --- 1218 i2c->adap.algo_data = i2c; 1219 i2c->adap.dev.parent = &pdev->dev; 1220 1221 i2c->dev = &pdev->dev; 1222 1223 spin_lock_init(&i2c->lock); 1224 init_waitqueue_head(&i2c->wait); 1225 | 1196 int ret = 0; 1197 int bus_nr; 1198 u32 value; 1199 int irq; 1200 unsigned long clk_rate; 1201 1202 i2c = devm_kzalloc(&pdev->dev, sizeof(struct rk3x_i2c), GFP_KERNEL); 1203 if (!i2c) --- 13 unchanged lines hidden (view full) --- 1217 i2c->adap.algo_data = i2c; 1218 i2c->adap.dev.parent = &pdev->dev; 1219 1220 i2c->dev = &pdev->dev; 1221 1222 spin_lock_init(&i2c->lock); 1223 init_waitqueue_head(&i2c->wait); 1224 |
1226 mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 1227 i2c->regs = devm_ioremap_resource(&pdev->dev, mem); | 1225 i2c->regs = devm_platform_ioremap_resource(pdev, 0); |
1228 if (IS_ERR(i2c->regs)) 1229 return PTR_ERR(i2c->regs); 1230 1231 /* Try to set the I2C adapter number from dt */ 1232 bus_nr = of_alias_get_id(np, "i2c"); 1233 1234 /* 1235 * Switch to new interface if the SoC also offers the old one. --- 131 unchanged lines hidden --- | 1226 if (IS_ERR(i2c->regs)) 1227 return PTR_ERR(i2c->regs); 1228 1229 /* Try to set the I2C adapter number from dt */ 1230 bus_nr = of_alias_get_id(np, "i2c"); 1231 1232 /* 1233 * Switch to new interface if the SoC also offers the old one. --- 131 unchanged lines hidden --- |