* [PATCH 0/2] 2c: mv64xxx: Fix clock resource for Armada 7K/8K
@ 2018-01-10 16:51 Gregory CLEMENT
2018-01-10 16:51 ` [PATCH 1/2] i2c: mv64xxx: Remove useless test before clk_disable_unprepare Gregory CLEMENT
2018-01-10 16:51 ` [PATCH 2/2] i2c: mv64xxx: Fix clock resource by adding an optional bus clock Gregory CLEMENT
0 siblings, 2 replies; 5+ messages in thread
From: Gregory CLEMENT @ 2018-01-10 16:51 UTC (permalink / raw)
To: linux-arm-kernel
Hi,
This short series fixes the way the clocks are used for the mv64xxx
controller embedded in the Marvell Armada 7K/8K SoCs. On these SoCs a
second one is needed in order to clock the registers. It was not
noticed until now because we relied on the bootloader and also because
the clock driver was wrong.
Thanks to this fix, it would be possible to fix the clock driver
without introducing a regression.
The first patch is just a small cleanup found when I wrote the main
patch.
Thanks,
Gregory
Gregory CLEMENT (2):
i2c: mv64xxx: Remove useless test before clk_disable_unprepare
i2c: mv64xxx: Fix clock resource by adding an optional bus clock
drivers/i2c/busses/i2c-mv64xxx.c | 20 +++++++++++++-------
1 file changed, 13 insertions(+), 7 deletions(-)
--
2.15.1
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 1/2] i2c: mv64xxx: Remove useless test before clk_disable_unprepare
2018-01-10 16:51 [PATCH 0/2] 2c: mv64xxx: Fix clock resource for Armada 7K/8K Gregory CLEMENT
@ 2018-01-10 16:51 ` Gregory CLEMENT
2018-01-10 16:51 ` [PATCH 2/2] i2c: mv64xxx: Fix clock resource by adding an optional bus clock Gregory CLEMENT
1 sibling, 0 replies; 5+ messages in thread
From: Gregory CLEMENT @ 2018-01-10 16:51 UTC (permalink / raw)
To: linux-arm-kernel
The 2 functions called from clk_disable_unprepare() already check that
the clock pointer is valid: no need to test it before calling it.
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
---
drivers/i2c/busses/i2c-mv64xxx.c | 8 ++------
1 file changed, 2 insertions(+), 6 deletions(-)
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index a832c45276a4..f69066266faa 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -950,9 +950,7 @@ mv64xxx_i2c_probe(struct platform_device *pd)
exit_reset:
reset_control_assert(drv_data->rstc);
exit_clk:
- /* Not all platforms have a clk */
- if (!IS_ERR(drv_data->clk))
- clk_disable_unprepare(drv_data->clk);
+ clk_disable_unprepare(drv_data->clk);
return rc;
}
@@ -965,9 +963,7 @@ mv64xxx_i2c_remove(struct platform_device *dev)
i2c_del_adapter(&drv_data->adapter);
free_irq(drv_data->irq, drv_data);
reset_control_assert(drv_data->rstc);
- /* Not all platforms have a clk */
- if (!IS_ERR(drv_data->clk))
- clk_disable_unprepare(drv_data->clk);
+ clk_disable_unprepare(drv_data->clk);
return 0;
}
--
2.15.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] i2c: mv64xxx: Fix clock resource by adding an optional bus clock
2018-01-10 16:51 [PATCH 0/2] 2c: mv64xxx: Fix clock resource for Armada 7K/8K Gregory CLEMENT
2018-01-10 16:51 ` [PATCH 1/2] i2c: mv64xxx: Remove useless test before clk_disable_unprepare Gregory CLEMENT
@ 2018-01-10 16:51 ` Gregory CLEMENT
2018-01-10 16:54 ` Thomas Petazzoni
1 sibling, 1 reply; 5+ messages in thread
From: Gregory CLEMENT @ 2018-01-10 16:51 UTC (permalink / raw)
To: linux-arm-kernel
On Armada 7K/8K we need to explicitly enable the bus clock. The bus clock
is optional because not all the SoCs need them but at least for Armada
7K/8K it is actually mandatory.
The binding documentation is updating accordingly.
Signed-off-by: Gregory CLEMENT <gregory.clement@free-electrons.com>
---
drivers/i2c/busses/i2c-mv64xxx.c | 12 +++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/drivers/i2c/busses/i2c-mv64xxx.c b/drivers/i2c/busses/i2c-mv64xxx.c
index f69066266faa..cce37d8ecf41 100644
--- a/drivers/i2c/busses/i2c-mv64xxx.c
+++ b/drivers/i2c/busses/i2c-mv64xxx.c
@@ -135,6 +135,7 @@ struct mv64xxx_i2c_data {
u32 freq_m;
u32 freq_n;
struct clk *clk;
+ struct clk *axi_clk;
wait_queue_head_t waitq;
spinlock_t lock;
struct i2c_msg *msg;
@@ -894,13 +895,20 @@ mv64xxx_i2c_probe(struct platform_device *pd)
init_waitqueue_head(&drv_data->waitq);
spin_lock_init(&drv_data->lock);
- /* Not all platforms have a clk */
+ /* Not all platforms have clocks */
drv_data->clk = devm_clk_get(&pd->dev, NULL);
if (IS_ERR(drv_data->clk) && PTR_ERR(drv_data->clk) == -EPROBE_DEFER)
return -EPROBE_DEFER;
if (!IS_ERR(drv_data->clk))
clk_prepare_enable(drv_data->clk);
+ drv_data->axi_clk = devm_clk_get(&pd->dev, "axi");
+ if (IS_ERR(drv_data->axi_clk) &&
+ PTR_ERR(drv_data->axi_clk) == -EPROBE_DEFER)
+ return -EPROBE_DEFER;
+ if (!IS_ERR(drv_data->axi_clk))
+ clk_prepare_enable(drv_data->axi_clk);
+
drv_data->irq = platform_get_irq(pd, 0);
if (pdata) {
@@ -950,6 +958,7 @@ mv64xxx_i2c_probe(struct platform_device *pd)
exit_reset:
reset_control_assert(drv_data->rstc);
exit_clk:
+ clk_disable_unprepare(drv_data->axi_clk);
clk_disable_unprepare(drv_data->clk);
return rc;
@@ -963,6 +972,7 @@ mv64xxx_i2c_remove(struct platform_device *dev)
i2c_del_adapter(&drv_data->adapter);
free_irq(drv_data->irq, drv_data);
reset_control_assert(drv_data->rstc);
+ clk_disable_unprepare(drv_data->axi_clk);
clk_disable_unprepare(drv_data->clk);
return 0;
--
2.15.1
^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH 2/2] i2c: mv64xxx: Fix clock resource by adding an optional bus clock
2018-01-10 16:51 ` [PATCH 2/2] i2c: mv64xxx: Fix clock resource by adding an optional bus clock Gregory CLEMENT
@ 2018-01-10 16:54 ` Thomas Petazzoni
2018-01-10 17:07 ` Gregory CLEMENT
0 siblings, 1 reply; 5+ messages in thread
From: Thomas Petazzoni @ 2018-01-10 16:54 UTC (permalink / raw)
To: linux-arm-kernel
Hello,
On Wed, 10 Jan 2018 17:51:47 +0100, Gregory CLEMENT wrote:
> On Armada 7K/8K we need to explicitly enable the bus clock. The bus clock
> is optional because not all the SoCs need them but at least for Armada
> 7K/8K it is actually mandatory.
>
> The binding documentation is updating accordingly.
Seems like the binding documentation update is not part of this patch :)
Thomas
--
Thomas Petazzoni, CTO, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH 2/2] i2c: mv64xxx: Fix clock resource by adding an optional bus clock
2018-01-10 16:54 ` Thomas Petazzoni
@ 2018-01-10 17:07 ` Gregory CLEMENT
0 siblings, 0 replies; 5+ messages in thread
From: Gregory CLEMENT @ 2018-01-10 17:07 UTC (permalink / raw)
To: linux-arm-kernel
Hi Thomas,
On mer., janv. 10 2018, Thomas Petazzoni <thomas.petazzoni@free-electrons.com> wrote:
> Hello,
>
> On Wed, 10 Jan 2018 17:51:47 +0100, Gregory CLEMENT wrote:
>> On Armada 7K/8K we need to explicitly enable the bus clock. The bus clock
>> is optional because not all the SoCs need them but at least for Armada
>> 7K/8K it is actually mandatory.
>>
>> The binding documentation is updating accordingly.
>
> Seems like the binding documentation update is not part of this patch
> :)
Indeed, I forgot to do the "git commit --amend".
Thanks,
Gregory
>
> Thomas
> --
> Thomas Petazzoni, CTO, Free Electrons
> Embedded Linux and Kernel engineering
> http://free-electrons.com
--
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2018-01-10 17:07 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-01-10 16:51 [PATCH 0/2] 2c: mv64xxx: Fix clock resource for Armada 7K/8K Gregory CLEMENT
2018-01-10 16:51 ` [PATCH 1/2] i2c: mv64xxx: Remove useless test before clk_disable_unprepare Gregory CLEMENT
2018-01-10 16:51 ` [PATCH 2/2] i2c: mv64xxx: Fix clock resource by adding an optional bus clock Gregory CLEMENT
2018-01-10 16:54 ` Thomas Petazzoni
2018-01-10 17:07 ` Gregory CLEMENT
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).