* [PATCH v3 resend] i2c: designware: add reset interface
@ 2016-12-27 14:22 ` Zhangfei Gao
0 siblings, 0 replies; 10+ messages in thread
From: Zhangfei Gao @ 2016-12-27 14:22 UTC (permalink / raw)
To: Wolfram Sang, andriy.shevchenko, mika.westerberg, jarkko.nikula, p.zabel
Cc: linux-arm-kernel, linux-i2c, Zhangfei Gao
Some platforms like hi3660 need do reset first to allow accessing registers
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Ramiro Oliveira <ramiro.oliveira@synopsys.com>
---
rebase to 4.10-rc1
drivers/i2c/busses/i2c-designware-core.h | 1 +
drivers/i2c/busses/i2c-designware-platdrv.c | 28 ++++++++++++++++++++++++----
2 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/drivers/i2c/busses/i2c-designware-core.h b/drivers/i2c/busses/i2c-designware-core.h
index 26250b4..302807c 100644
--- a/drivers/i2c/busses/i2c-designware-core.h
+++ b/drivers/i2c/busses/i2c-designware-core.h
@@ -88,6 +88,7 @@ struct dw_i2c_dev {
void __iomem *base;
struct completion cmd_complete;
struct clk *clk;
+ struct reset_control *rst;
u32 (*get_clk_rate_khz) (struct dw_i2c_dev *dev);
struct dw_pci_controller *controller;
int cmd_err;
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 6ce4313..79c4b4e 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -38,6 +38,7 @@
#include <linux/pm_runtime.h>
#include <linux/property.h>
#include <linux/io.h>
+#include <linux/reset.h>
#include <linux/slab.h>
#include <linux/acpi.h>
#include <linux/platform_data/i2c-designware.h>
@@ -199,6 +200,14 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
dev->irq = irq;
platform_set_drvdata(pdev, dev);
+ dev->rst = devm_reset_control_get_optional_exclusive(&pdev->dev, NULL);
+ if (IS_ERR(dev->rst)) {
+ if (PTR_ERR(dev->rst) == -EPROBE_DEFER)
+ return -EPROBE_DEFER;
+ } else {
+ reset_control_deassert(dev->rst);
+ }
+
if (pdata) {
dev->clk_freq = pdata->i2c_scl_freq;
} else {
@@ -235,12 +244,13 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
&& dev->clk_freq != 1000000 && dev->clk_freq != 3400000) {
dev_err(&pdev->dev,
"Only 100kHz, 400kHz, 1MHz and 3.4MHz supported");
- return -EINVAL;
+ r = -EINVAL;
+ goto exit_reset;
}
r = i2c_dw_eval_lock_support(dev);
if (r)
- return r;
+ goto exit_reset;
dev->functionality = I2C_FUNC_10BIT_ADDR | DW_IC_DEFAULT_FUNCTIONALITY;
@@ -286,10 +296,18 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
}
r = i2c_dw_probe(dev);
- if (r && !dev->pm_runtime_disabled)
- pm_runtime_disable(&pdev->dev);
+ if (r)
+ goto exit_probe;
return r;
+
+exit_probe:
+ if (!dev->pm_runtime_disabled)
+ pm_runtime_disable(&pdev->dev);
+exit_reset:
+ if (!IS_ERR_OR_NULL(dev->rst))
+ reset_control_assert(dev->rst);
+ return r;
}
static int dw_i2c_plat_remove(struct platform_device *pdev)
@@ -306,6 +324,8 @@ static int dw_i2c_plat_remove(struct platform_device *pdev)
pm_runtime_put_sync(&pdev->dev);
if (!dev->pm_runtime_disabled)
pm_runtime_disable(&pdev->dev);
+ if (!IS_ERR_OR_NULL(dev->rst))
+ reset_control_assert(dev->rst);
return 0;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v3 resend] i2c: designware: add reset interface
@ 2016-12-27 14:22 ` Zhangfei Gao
0 siblings, 0 replies; 10+ messages in thread
From: Zhangfei Gao @ 2016-12-27 14:22 UTC (permalink / raw)
To: linux-arm-kernel
Some platforms like hi3660 need do reset first to allow accessing registers
Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Tested-by: Ramiro Oliveira <ramiro.oliveira@synopsys.com>
---
rebase to 4.10-rc1
drivers/i2c/busses/i2c-designware-core.h | 1 +
drivers/i2c/busses/i2c-designware-platdrv.c | 28 ++++++++++++++++++++++++----
2 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/drivers/i2c/busses/i2c-designware-core.h b/drivers/i2c/busses/i2c-designware-core.h
index 26250b4..302807c 100644
--- a/drivers/i2c/busses/i2c-designware-core.h
+++ b/drivers/i2c/busses/i2c-designware-core.h
@@ -88,6 +88,7 @@ struct dw_i2c_dev {
void __iomem *base;
struct completion cmd_complete;
struct clk *clk;
+ struct reset_control *rst;
u32 (*get_clk_rate_khz) (struct dw_i2c_dev *dev);
struct dw_pci_controller *controller;
int cmd_err;
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 6ce4313..79c4b4e 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -38,6 +38,7 @@
#include <linux/pm_runtime.h>
#include <linux/property.h>
#include <linux/io.h>
+#include <linux/reset.h>
#include <linux/slab.h>
#include <linux/acpi.h>
#include <linux/platform_data/i2c-designware.h>
@@ -199,6 +200,14 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
dev->irq = irq;
platform_set_drvdata(pdev, dev);
+ dev->rst = devm_reset_control_get_optional_exclusive(&pdev->dev, NULL);
+ if (IS_ERR(dev->rst)) {
+ if (PTR_ERR(dev->rst) == -EPROBE_DEFER)
+ return -EPROBE_DEFER;
+ } else {
+ reset_control_deassert(dev->rst);
+ }
+
if (pdata) {
dev->clk_freq = pdata->i2c_scl_freq;
} else {
@@ -235,12 +244,13 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
&& dev->clk_freq != 1000000 && dev->clk_freq != 3400000) {
dev_err(&pdev->dev,
"Only 100kHz, 400kHz, 1MHz and 3.4MHz supported");
- return -EINVAL;
+ r = -EINVAL;
+ goto exit_reset;
}
r = i2c_dw_eval_lock_support(dev);
if (r)
- return r;
+ goto exit_reset;
dev->functionality = I2C_FUNC_10BIT_ADDR | DW_IC_DEFAULT_FUNCTIONALITY;
@@ -286,10 +296,18 @@ static int dw_i2c_plat_probe(struct platform_device *pdev)
}
r = i2c_dw_probe(dev);
- if (r && !dev->pm_runtime_disabled)
- pm_runtime_disable(&pdev->dev);
+ if (r)
+ goto exit_probe;
return r;
+
+exit_probe:
+ if (!dev->pm_runtime_disabled)
+ pm_runtime_disable(&pdev->dev);
+exit_reset:
+ if (!IS_ERR_OR_NULL(dev->rst))
+ reset_control_assert(dev->rst);
+ return r;
}
static int dw_i2c_plat_remove(struct platform_device *pdev)
@@ -306,6 +324,8 @@ static int dw_i2c_plat_remove(struct platform_device *pdev)
pm_runtime_put_sync(&pdev->dev);
if (!dev->pm_runtime_disabled)
pm_runtime_disable(&pdev->dev);
+ if (!IS_ERR_OR_NULL(dev->rst))
+ reset_control_assert(dev->rst);
return 0;
}
--
2.7.4
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v3 resend] i2c: designware: add reset interface
2016-12-27 14:22 ` Zhangfei Gao
@ 2016-12-27 14:41 ` Jarkko Nikula
-1 siblings, 0 replies; 10+ messages in thread
From: Jarkko Nikula @ 2016-12-27 14:41 UTC (permalink / raw)
To: Zhangfei Gao, Wolfram Sang, andriy.shevchenko, mika.westerberg, p.zabel
Cc: linux-arm-kernel, linux-i2c
On 12/27/2016 04:22 PM, Zhangfei Gao wrote:
> Some platforms like hi3660 need do reset first to allow accessing registers
>
> Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Tested-by: Ramiro Oliveira <ramiro.oliveira@synopsys.com>
> ---
> rebase to 4.10-rc1
>
> drivers/i2c/busses/i2c-designware-core.h | 1 +
> drivers/i2c/busses/i2c-designware-platdrv.c | 28 ++++++++++++++++++++++++----
> 2 files changed, 25 insertions(+), 4 deletions(-)
>
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v3 resend] i2c: designware: add reset interface
@ 2016-12-27 14:41 ` Jarkko Nikula
0 siblings, 0 replies; 10+ messages in thread
From: Jarkko Nikula @ 2016-12-27 14:41 UTC (permalink / raw)
To: linux-arm-kernel
On 12/27/2016 04:22 PM, Zhangfei Gao wrote:
> Some platforms like hi3660 need do reset first to allow accessing registers
>
> Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Tested-by: Ramiro Oliveira <ramiro.oliveira@synopsys.com>
> ---
> rebase to 4.10-rc1
>
> drivers/i2c/busses/i2c-designware-core.h | 1 +
> drivers/i2c/busses/i2c-designware-platdrv.c | 28 ++++++++++++++++++++++++----
> 2 files changed, 25 insertions(+), 4 deletions(-)
>
Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com>
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 resend] i2c: designware: add reset interface
2016-12-27 14:22 ` Zhangfei Gao
@ 2017-01-12 18:54 ` Wolfram Sang
-1 siblings, 0 replies; 10+ messages in thread
From: Wolfram Sang @ 2017-01-12 18:54 UTC (permalink / raw)
To: Zhangfei Gao
Cc: andriy.shevchenko, mika.westerberg, jarkko.nikula, p.zabel,
linux-arm-kernel, linux-i2c
On Tue, Dec 27, 2016 at 10:22:40PM +0800, Zhangfei Gao wrote:
> Some platforms like hi3660 need do reset first to allow accessing registers
>
> Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Tested-by: Ramiro Oliveira <ramiro.oliveira@synopsys.com>
Applied to for-next, thanks!
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v3 resend] i2c: designware: add reset interface
@ 2017-01-12 18:54 ` Wolfram Sang
0 siblings, 0 replies; 10+ messages in thread
From: Wolfram Sang @ 2017-01-12 18:54 UTC (permalink / raw)
To: linux-arm-kernel
On Tue, Dec 27, 2016 at 10:22:40PM +0800, Zhangfei Gao wrote:
> Some platforms like hi3660 need do reset first to allow accessing registers
>
> Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Tested-by: Ramiro Oliveira <ramiro.oliveira@synopsys.com>
Applied to for-next, thanks!
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 resend] i2c: designware: add reset interface
2017-01-12 18:54 ` Wolfram Sang
@ 2017-03-06 15:11 ` Ramiro Oliveira
-1 siblings, 0 replies; 10+ messages in thread
From: Ramiro Oliveira @ 2017-03-06 15:11 UTC (permalink / raw)
To: Wolfram Sang, Zhangfei Gao
Cc: Luis.Oliveira, jarkko.nikula, linux-i2c, p.zabel,
andriy.shevchenko, mika.westerberg, linux-arm-kernel
Hi Wolfram
On 1/12/2017 6:54 PM, Wolfram Sang wrote:
> On Tue, Dec 27, 2016 at 10:22:40PM +0800, Zhangfei Gao wrote:
>> Some platforms like hi3660 need do reset first to allow accessing registers
>>
>> Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
>> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>> Tested-by: Ramiro Oliveira <ramiro.oliveira@synopsys.com>
>
> Applied to for-next, thanks!
>
I haven't been able to find this patch anywhere. Do you still have plans to
apply it to for-next?
--
Best Regards
Ramiro Oliveira
Ramiro.Oliveira@synopsys.com
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v3 resend] i2c: designware: add reset interface
@ 2017-03-06 15:11 ` Ramiro Oliveira
0 siblings, 0 replies; 10+ messages in thread
From: Ramiro Oliveira @ 2017-03-06 15:11 UTC (permalink / raw)
To: linux-arm-kernel
Hi Wolfram
On 1/12/2017 6:54 PM, Wolfram Sang wrote:
> On Tue, Dec 27, 2016 at 10:22:40PM +0800, Zhangfei Gao wrote:
>> Some platforms like hi3660 need do reset first to allow accessing registers
>>
>> Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
>> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
>> Tested-by: Ramiro Oliveira <ramiro.oliveira@synopsys.com>
>
> Applied to for-next, thanks!
>
I haven't been able to find this patch anywhere. Do you still have plans to
apply it to for-next?
--
Best Regards
Ramiro Oliveira
Ramiro.Oliveira at synopsys.com
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v3 resend] i2c: designware: add reset interface
2017-03-06 15:11 ` Ramiro Oliveira
@ 2017-03-09 14:43 ` Wolfram Sang
-1 siblings, 0 replies; 10+ messages in thread
From: Wolfram Sang @ 2017-03-09 14:43 UTC (permalink / raw)
To: Ramiro Oliveira
Cc: Zhangfei Gao, andriy.shevchenko, mika.westerberg, jarkko.nikula,
p.zabel, linux-arm-kernel, linux-i2c, Luis.Oliveira
[-- Attachment #1: Type: text/plain, Size: 830 bytes --]
On Mon, Mar 06, 2017 at 03:11:48PM +0000, Ramiro Oliveira wrote:
> Hi Wolfram
>
> On 1/12/2017 6:54 PM, Wolfram Sang wrote:
> > On Tue, Dec 27, 2016 at 10:22:40PM +0800, Zhangfei Gao wrote:
> >> Some platforms like hi3660 need do reset first to allow accessing registers
> >>
> >> Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
> >> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> >> Tested-by: Ramiro Oliveira <ramiro.oliveira@synopsys.com>
> >
> > Applied to for-next, thanks!
> >
>
> I haven't been able to find this patch anywhere. Do you still have plans to
> apply it to for-next?
Uh, thanks for the heads up. Can't really tell why it fell through the
cracks :( It probably got lost by an improper rebase by me? Sorry about
that.
Applied to for-current, thanks again!
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v3 resend] i2c: designware: add reset interface
@ 2017-03-09 14:43 ` Wolfram Sang
0 siblings, 0 replies; 10+ messages in thread
From: Wolfram Sang @ 2017-03-09 14:43 UTC (permalink / raw)
To: linux-arm-kernel
On Mon, Mar 06, 2017 at 03:11:48PM +0000, Ramiro Oliveira wrote:
> Hi Wolfram
>
> On 1/12/2017 6:54 PM, Wolfram Sang wrote:
> > On Tue, Dec 27, 2016 at 10:22:40PM +0800, Zhangfei Gao wrote:
> >> Some platforms like hi3660 need do reset first to allow accessing registers
> >>
> >> Signed-off-by: Zhangfei Gao <zhangfei.gao@linaro.org>
> >> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> >> Tested-by: Ramiro Oliveira <ramiro.oliveira@synopsys.com>
> >
> > Applied to for-next, thanks!
> >
>
> I haven't been able to find this patch anywhere. Do you still have plans to
> apply it to for-next?
Uh, thanks for the heads up. Can't really tell why it fell through the
cracks :( It probably got lost by an improper rebase by me? Sorry about
that.
Applied to for-current, thanks again!
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20170309/e4894bf1/attachment.sig>
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2017-03-09 14:44 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-27 14:22 [PATCH v3 resend] i2c: designware: add reset interface Zhangfei Gao
2016-12-27 14:22 ` Zhangfei Gao
2016-12-27 14:41 ` Jarkko Nikula
2016-12-27 14:41 ` Jarkko Nikula
2017-01-12 18:54 ` Wolfram Sang
2017-01-12 18:54 ` Wolfram Sang
2017-03-06 15:11 ` Ramiro Oliveira
2017-03-06 15:11 ` Ramiro Oliveira
2017-03-09 14:43 ` Wolfram Sang
2017-03-09 14:43 ` Wolfram Sang
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.