Commit b7c3d077 authored by Serge Semin's avatar Serge Semin Committed by Wolfram Sang

i2c: designware: Move reg-space remapping into a dedicated function

This is a preparation patch before adding a quirk with custom registers
map creation required for the Baikal-T1 System I2C support.
Signed-off-by: default avatarSerge Semin <Sergey.Semin@baikalelectronics.ru>
Reviewed-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: default avatarWolfram Sang <wsa@kernel.org>
parent fac25d7a
...@@ -108,6 +108,15 @@ static void dw_i2c_plat_pm_cleanup(struct dw_i2c_dev *dev) ...@@ -108,6 +108,15 @@ static void dw_i2c_plat_pm_cleanup(struct dw_i2c_dev *dev)
pm_runtime_put_noidle(dev->dev); pm_runtime_put_noidle(dev->dev);
} }
static int dw_i2c_plat_request_regs(struct dw_i2c_dev *dev)
{
struct platform_device *pdev = to_platform_device(dev->dev);
dev->base = devm_platform_ioremap_resource(pdev, 0);
return PTR_ERR_OR_ZERO(dev->base);
}
static int dw_i2c_plat_probe(struct platform_device *pdev) static int dw_i2c_plat_probe(struct platform_device *pdev)
{ {
struct dw_i2c_platform_data *pdata = dev_get_platdata(&pdev->dev); struct dw_i2c_platform_data *pdata = dev_get_platdata(&pdev->dev);
...@@ -125,15 +134,14 @@ static int dw_i2c_plat_probe(struct platform_device *pdev) ...@@ -125,15 +134,14 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
return -ENOMEM; return -ENOMEM;
dev->flags = (uintptr_t)device_get_match_data(&pdev->dev); dev->flags = (uintptr_t)device_get_match_data(&pdev->dev);
dev->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(dev->base))
return PTR_ERR(dev->base);
dev->dev = &pdev->dev; dev->dev = &pdev->dev;
dev->irq = irq; dev->irq = irq;
platform_set_drvdata(pdev, dev); platform_set_drvdata(pdev, dev);
ret = dw_i2c_plat_request_regs(dev);
if (ret)
return ret;
dev->rst = devm_reset_control_get_optional_exclusive(&pdev->dev, NULL); dev->rst = devm_reset_control_get_optional_exclusive(&pdev->dev, NULL);
if (IS_ERR(dev->rst)) if (IS_ERR(dev->rst))
return PTR_ERR(dev->rst); return PTR_ERR(dev->rst);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment