Re: [PATCH v2 0/8] Per-user clock constraints

2014-10-09 Thread Tomeu Vizoso
On 9 October 2014 03:32, Stephen Boyd sb...@codeaurora.org wrote:
 On 10/07/2014 08:21 AM, Tomeu Vizoso wrote:

 Hello,

 this second version of the series adds several cleanups that were
 suggested by
 Stephen Boyd and contains several improvements to the seventh patch (clk:
 Make
 clk API return per-user struct clk instances) that were suggested by him
 during
 the review of v1.

 The first six patches are just cleanups that should be desirable on their
 own,
 and that should make easier to review the actual per-user clock patch.

 The seventh patch actually moves the per-clock data that was stored in
 struct
 clk to a new struct clk_core and adds references to it from both struct
 clk and
 struct clk_hw. struct clk is now ready to contain information that is
 specific
 to a given clk consumer.

 The eighth patch adds API for setting floor and ceiling constraints and
 stores
 that information on the per-user struct clk, which is iterable from struct
 clk_core.



 As said in the patches, can you please indicate which baseline this is on?

Sure, this was based on v3.17. Also available at:

http://cgit.collabora.com/git/user/tomeu/linux.git/log/?h=per-user-clk-constraints-v2

 Also can you rebase onto clk-next if you send again before that is merged
 into 3.18-rc1? There are some changes in the debugfs part that will
 conflict. I'll review the more complicated parts in detail soon.

Ack.

Thanks,

Tomeu
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 12/13] tty: serial: 8250: omap: add custom irq handling

2014-10-09 Thread Heikki Krogerus
On Mon, Sep 29, 2014 at 08:06:48PM +0200, Sebastian Andrzej Siewior wrote:
 We have (or will have) custom DMA callbacks in the omap driver due to
 the different behaviour in the RX and TX case. To make this work
 we need a few changes in the IRQ handler to invoke the rx_handler again
 after the manual mode or retry the tx_handler again before falling
 back to the manual mode.
 
 Heikki didn't want to see the extra hacks in the generic / default irq
 handler and Peter wasn't too happy about an OMAP-only IRQ handler. The
 way I planned it is to use this extra IRQ routine only in DMA case. If
 Peter dislike this approach then I hope Heikki doesn't block changes in
 the default IRQ handler :)
 
 Cc: Heikki Krogerus heikki.kroge...@linux.intel.com
 Cc: Peter Hurley pe...@hurleysoftware.com
 Signed-off-by: Sebastian Andrzej Siewior bige...@linutronix.de

Looks good to me.

Reviewed-by: Heikki Krogerus heikki.kroge...@linux.intel.com


-- 
heikki
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC PATCH 3/6] ARM: OMAP4: hwmod: set DSS submodule parent hwmods

2014-10-09 Thread Tomi Valkeinen
Set DSS core hwmod as the parent for all the DSS submodules.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 8 +++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 44e5634bba34..df8dc0f6530f 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -647,7 +647,8 @@ static struct omap_hwmod omap44xx_dss_dispc_hwmod = {
.context_offs = OMAP4_RM_DSS_DSS_CONTEXT_OFFSET,
},
},
-   .dev_attr   = omap44xx_dss_dispc_dev_attr
+   .dev_attr   = omap44xx_dss_dispc_dev_attr,
+   .parent_hwmod   = omap44xx_dss_hwmod,
 };
 
 /*
@@ -701,6 +702,7 @@ static struct omap_hwmod omap44xx_dss_dsi1_hwmod = {
},
.opt_clks   = dss_dsi1_opt_clks,
.opt_clks_cnt   = ARRAY_SIZE(dss_dsi1_opt_clks),
+   .parent_hwmod   = omap44xx_dss_hwmod,
 };
 
 /* dss_dsi2 */
@@ -733,6 +735,7 @@ static struct omap_hwmod omap44xx_dss_dsi2_hwmod = {
},
.opt_clks   = dss_dsi2_opt_clks,
.opt_clks_cnt   = ARRAY_SIZE(dss_dsi2_opt_clks),
+   .parent_hwmod   = omap44xx_dss_hwmod,
 };
 
 /*
@@ -790,6 +793,7 @@ static struct omap_hwmod omap44xx_dss_hdmi_hwmod = {
},
.opt_clks   = dss_hdmi_opt_clks,
.opt_clks_cnt   = ARRAY_SIZE(dss_hdmi_opt_clks),
+   .parent_hwmod   = omap44xx_dss_hwmod,
 };
 
 /*
@@ -836,6 +840,7 @@ static struct omap_hwmod omap44xx_dss_rfbi_hwmod = {
},
.opt_clks   = dss_rfbi_opt_clks,
.opt_clks_cnt   = ARRAY_SIZE(dss_rfbi_opt_clks),
+   .parent_hwmod   = omap44xx_dss_hwmod,
 };
 
 /*
@@ -859,6 +864,7 @@ static struct omap_hwmod omap44xx_dss_venc_hwmod = {
.context_offs = OMAP4_RM_DSS_DSS_CONTEXT_OFFSET,
},
},
+   .parent_hwmod   = omap44xx_dss_hwmod,
 };
 
 /*
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC PATCH 1/6] ARM: OMAP2+: hwmod: add parent_hwmod support

2014-10-09 Thread Tomi Valkeinen
Add parent_hwmod pointer to omap_hwmod. This can be set to point to a
parent hwmod that needs to be enabled for the child hwmod to work.

This is used at hwmod setup time: when doing the initial setup and
reset, first enable the parent hwmod, and after setup and reset is done,
restore the parent hwmod to postsetup_state.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod.c | 22 ++
 arch/arm/mach-omap2/omap_hwmod.h |  1 +
 2 files changed, 23 insertions(+)

diff --git a/arch/arm/mach-omap2/omap_hwmod.c b/arch/arm/mach-omap2/omap_hwmod.c
index 9e91a4e7519a..6e0cac89bcfe 100644
--- a/arch/arm/mach-omap2/omap_hwmod.c
+++ b/arch/arm/mach-omap2/omap_hwmod.c
@@ -2719,11 +2719,33 @@ static int __init _setup(struct omap_hwmod *oh, void 
*data)
if (oh-_state != _HWMOD_STATE_INITIALIZED)
return 0;
 
+   if (oh-parent_hwmod) {
+   int r;
+
+   r = _enable(oh-parent_hwmod);
+   WARN(r, hwmod: %s: setup: failed to enable parent hwmod %s\n,
+   oh-name, oh-parent_hwmod-name);
+   }
+
_setup_iclk_autoidle(oh);
 
if (!_setup_reset(oh))
_setup_postsetup(oh);
 
+   if (oh-parent_hwmod) {
+   u8 postsetup_state;
+
+   postsetup_state = oh-parent_hwmod-_postsetup_state;
+
+   if (postsetup_state == _HWMOD_STATE_IDLE)
+   _idle(oh-parent_hwmod);
+   else if (postsetup_state == _HWMOD_STATE_DISABLED)
+   _shutdown(oh-parent_hwmod);
+   else if (postsetup_state != _HWMOD_STATE_ENABLED)
+   WARN(1, hwmod: %s: unknown postsetup state %d! 
defaulting to enabled\n,
+oh-parent_hwmod-name, postsetup_state);
+   }
+
return 0;
 }
 
diff --git a/arch/arm/mach-omap2/omap_hwmod.h b/arch/arm/mach-omap2/omap_hwmod.h
index 0f97d635ff90..7bd2b59857c2 100644
--- a/arch/arm/mach-omap2/omap_hwmod.h
+++ b/arch/arm/mach-omap2/omap_hwmod.h
@@ -676,6 +676,7 @@ struct omap_hwmod {
u8  _int_flags;
u8  _state;
u8  _postsetup_state;
+   struct omap_hwmod   *parent_hwmod;
 };
 
 struct omap_hwmod *omap_hwmod_lookup(const char *name);
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC PATCH 2/6] ARM: OMAP5: hwmod: set DSS submodule parent hwmods

2014-10-09 Thread Tomi Valkeinen
Set DSS core hwmod as the parent for all the DSS submodules.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_54xx_data.c | 5 +
 1 file changed, 5 insertions(+)

diff --git a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
index 1103aa0e0d29..229c7fb7e1c3 100644
--- a/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_54xx_data.c
@@ -421,6 +421,7 @@ static struct omap_hwmod omap54xx_dss_dispc_hwmod = {
.opt_clks   = dss_dispc_opt_clks,
.opt_clks_cnt   = ARRAY_SIZE(dss_dispc_opt_clks),
.dev_attr   = dss_dispc_dev_attr,
+   .parent_hwmod   = omap54xx_dss_hwmod,
 };
 
 /*
@@ -462,6 +463,7 @@ static struct omap_hwmod omap54xx_dss_dsi1_a_hwmod = {
},
.opt_clks   = dss_dsi1_a_opt_clks,
.opt_clks_cnt   = ARRAY_SIZE(dss_dsi1_a_opt_clks),
+   .parent_hwmod   = omap54xx_dss_hwmod,
 };
 
 /* dss_dsi1_c */
@@ -482,6 +484,7 @@ static struct omap_hwmod omap54xx_dss_dsi1_c_hwmod = {
},
.opt_clks   = dss_dsi1_c_opt_clks,
.opt_clks_cnt   = ARRAY_SIZE(dss_dsi1_c_opt_clks),
+   .parent_hwmod   = omap54xx_dss_hwmod,
 };
 
 /*
@@ -521,6 +524,7 @@ static struct omap_hwmod omap54xx_dss_hdmi_hwmod = {
},
.opt_clks   = dss_hdmi_opt_clks,
.opt_clks_cnt   = ARRAY_SIZE(dss_hdmi_opt_clks),
+   .parent_hwmod   = omap54xx_dss_hwmod,
 };
 
 /*
@@ -560,6 +564,7 @@ static struct omap_hwmod omap54xx_dss_rfbi_hwmod = {
},
.opt_clks   = dss_rfbi_opt_clks,
.opt_clks_cnt   = ARRAY_SIZE(dss_rfbi_opt_clks),
+   .parent_hwmod   = omap54xx_dss_hwmod,
 };
 
 /*
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC PATCH 4/6] ARM: OMAP4: hwmod: use MODULEMODE properly

2014-10-09 Thread Tomi Valkeinen
Instead of using a hacky dss_fck clock (which toggles the MODULEMODE
bit) as DSS L3 interface clock, set the .modulemode field in the
omap44xx_dss_hwmod. This works now that the DSS core hwmod is enabled
during DSS submodule resets.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 15 ---
 1 file changed, 8 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index df8dc0f6530f..8126f178d57e 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -589,6 +589,7 @@ static struct omap_hwmod omap44xx_dss_hwmod = {
.omap4 = {
.clkctrl_offs = OMAP4_CM_DSS_DSS_CLKCTRL_OFFSET,
.context_offs = OMAP4_RM_DSS_DSS_CONTEXT_OFFSET,
+   .modulemode   = MODULEMODE_SWCTRL,
},
},
.opt_clks   = dss_opt_clks,
@@ -3677,7 +3678,7 @@ static struct omap_hwmod_addr_space 
omap44xx_dss_dma_addrs[] = {
 static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss = {
.master = omap44xx_l3_main_2_hwmod,
.slave  = omap44xx_dss_hwmod,
-   .clk= dss_fck,
+   .clk= l3_div_ck,
.addr   = omap44xx_dss_dma_addrs,
.user   = OCP_USER_SDMA,
 };
@@ -3713,7 +3714,7 @@ static struct omap_hwmod_addr_space 
omap44xx_dss_dispc_dma_addrs[] = {
 static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_dispc = {
.master = omap44xx_l3_main_2_hwmod,
.slave  = omap44xx_dss_dispc_hwmod,
-   .clk= dss_fck,
+   .clk= l3_div_ck,
.addr   = omap44xx_dss_dispc_dma_addrs,
.user   = OCP_USER_SDMA,
 };
@@ -3749,7 +3750,7 @@ static struct omap_hwmod_addr_space 
omap44xx_dss_dsi1_dma_addrs[] = {
 static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_dsi1 = {
.master = omap44xx_l3_main_2_hwmod,
.slave  = omap44xx_dss_dsi1_hwmod,
-   .clk= dss_fck,
+   .clk= l3_div_ck,
.addr   = omap44xx_dss_dsi1_dma_addrs,
.user   = OCP_USER_SDMA,
 };
@@ -3785,7 +3786,7 @@ static struct omap_hwmod_addr_space 
omap44xx_dss_dsi2_dma_addrs[] = {
 static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_dsi2 = {
.master = omap44xx_l3_main_2_hwmod,
.slave  = omap44xx_dss_dsi2_hwmod,
-   .clk= dss_fck,
+   .clk= l3_div_ck,
.addr   = omap44xx_dss_dsi2_dma_addrs,
.user   = OCP_USER_SDMA,
 };
@@ -3821,7 +3822,7 @@ static struct omap_hwmod_addr_space 
omap44xx_dss_hdmi_dma_addrs[] = {
 static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_hdmi = {
.master = omap44xx_l3_main_2_hwmod,
.slave  = omap44xx_dss_hdmi_hwmod,
-   .clk= dss_fck,
+   .clk= l3_div_ck,
.addr   = omap44xx_dss_hdmi_dma_addrs,
.user   = OCP_USER_SDMA,
 };
@@ -3857,7 +3858,7 @@ static struct omap_hwmod_addr_space 
omap44xx_dss_rfbi_dma_addrs[] = {
 static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_rfbi = {
.master = omap44xx_l3_main_2_hwmod,
.slave  = omap44xx_dss_rfbi_hwmod,
-   .clk= dss_fck,
+   .clk= l3_div_ck,
.addr   = omap44xx_dss_rfbi_dma_addrs,
.user   = OCP_USER_SDMA,
 };
@@ -3893,7 +3894,7 @@ static struct omap_hwmod_addr_space 
omap44xx_dss_venc_dma_addrs[] = {
 static struct omap_hwmod_ocp_if omap44xx_l3_main_2__dss_venc = {
.master = omap44xx_l3_main_2_hwmod,
.slave  = omap44xx_dss_venc_hwmod,
-   .clk= dss_fck,
+   .clk= l3_div_ck,
.addr   = omap44xx_dss_venc_dma_addrs,
.user   = OCP_USER_SDMA,
 };
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC PATCH 0/6] ARM: OMAP4+: hwmod: fixing omap4+ DSS hwmods

2014-10-09 Thread Tomi Valkeinen
This is an RFC to fix the issues with boot time DSS hwmod setup.

There was an earlier series sent by Archit here:

http://www.spinics.net/lists/linux-omap/msg107700.html

This series takes different approach, and just tries to fix the issue at setup
time by making sure the DSS core hwmod is enabled when a DSS submodule hwmod is
being setup.

Quickly tested on OMAP4 Panda and OMAP5 uEVM.

 Tomi

Tomi Valkeinen (6):
  ARM: OMAP2+: hwmod: add parent_hwmod support
  ARM: OMAP5: hwmod: set DSS submodule parent hwmods
  ARM: OMAP4: hwmod: set DSS submodule parent hwmods
  ARM: OMAP4: hwmod: use MODULEMODE properly
  ARM: OMAP4: fix RFBI iclk
  ARM: dts: omap4.dtsi: remove dss_fck

 arch/arm/boot/dts/omap4.dtsi   |  2 +-
 arch/arm/boot/dts/omap44xx-clocks.dtsi |  8 
 arch/arm/mach-omap2/omap_hwmod.c   | 22 ++
 arch/arm/mach-omap2/omap_hwmod.h   |  1 +
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 25 -
 arch/arm/mach-omap2/omap_hwmod_54xx_data.c |  5 +
 6 files changed, 45 insertions(+), 18 deletions(-)

-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC PATCH 5/6] ARM: OMAP4: fix RFBI iclk

2014-10-09 Thread Tomi Valkeinen
RFBI iclk was set to point to hacky dss_fck, which will be removed.
Instead use l3_div_ck, which is the proper clock for this. l3_div_ck
is the parent of dss_fck, so the clock rate is the same as previously.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 arch/arm/boot/dts/omap4.dtsi   | 2 +-
 arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/boot/dts/omap4.dtsi b/arch/arm/boot/dts/omap4.dtsi
index 69408b53200d..4c15409a9056 100644
--- a/arch/arm/boot/dts/omap4.dtsi
+++ b/arch/arm/boot/dts/omap4.dtsi
@@ -880,7 +880,7 @@
reg = 0x58002000 0x1000;
status = disabled;
ti,hwmods = dss_rfbi;
-   clocks = dss_dss_clk, dss_fck;
+   clocks = dss_dss_clk, l3_div_ck;
clock-names = fck, ick;
};
 
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c 
b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
index 8126f178d57e..d6f41e1b6d1b 100644
--- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
+++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c
@@ -824,7 +824,7 @@ static struct omap_hwmod_dma_info 
omap44xx_dss_rfbi_sdma_reqs[] = {
 };
 
 static struct omap_hwmod_opt_clk dss_rfbi_opt_clks[] = {
-   { .role = ick, .clk = dss_fck },
+   { .role = ick, .clk = l3_div_ck },
 };
 
 static struct omap_hwmod omap44xx_dss_rfbi_hwmod = {
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[RFC PATCH 6/6] ARM: dts: omap4.dtsi: remove dss_fck

2014-10-09 Thread Tomi Valkeinen
dss_fck is a hacky clock, used to work around problems with MODULEMODE
bit handling in DSS hwmods.

These problems have now been solved, so we can remove the dss_fck clock.

Signed-off-by: Tomi Valkeinen tomi.valkei...@ti.com
---
 arch/arm/boot/dts/omap44xx-clocks.dtsi | 8 
 1 file changed, 8 deletions(-)

diff --git a/arch/arm/boot/dts/omap44xx-clocks.dtsi 
b/arch/arm/boot/dts/omap44xx-clocks.dtsi
index c821ff5e9b8d..f2c48f09824e 100644
--- a/arch/arm/boot/dts/omap44xx-clocks.dtsi
+++ b/arch/arm/boot/dts/omap44xx-clocks.dtsi
@@ -1018,14 +1018,6 @@
reg = 0x1120;
};
 
-   dss_fck: dss_fck {
-   #clock-cells = 0;
-   compatible = ti,gate-clock;
-   clocks = l3_div_ck;
-   ti,bit-shift = 1;
-   reg = 0x1120;
-   };
-
fdif_fck: fdif_fck {
#clock-cells = 0;
compatible = ti,divider-clock;
-- 
2.1.1

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 0/8] Per-user clock constraints

2014-10-09 Thread Tomeu Vizoso
Hello,

this third version of the series is basically just a rebase on top of 
linux-next 20141009.

The first six patches are just cleanups that should be desirable on their own,
and that should make easier to review the actual per-user clock patch.

The seventh patch actually moves the per-clock data that was stored in struct
clk to a new struct clk_core and adds references to it from both struct clk and
struct clk_hw. struct clk is now ready to contain information that is specific
to a given clk consumer.

The eighth patch adds API for setting floor and ceiling constraints and stores
that information on the per-user struct clk, which is iterable from struct
clk_core.

http://cgit.collabora.com/git/user/tomeu/linux.git/log/?h=per-user-clk-constraints-v3

Thanks,

Tomeu

Tomeu Vizoso (8):
  MIPS: Alchemy: Remove direct access to prepare_count field of struct
clk
  clk: Remove unused function __clk_get_prepare_count
  clk: Don't try to use a struct clk* after it could have been freed
  clk: Don't expose __clk_get_accuracy
  clk: change clk_debugfs_add_file to take a struct clk_hw
  clk: Change clk_ops-determine_rate to return a clk_hw as the best
parent
  clk: Make clk API return per-user struct clk instances
  clk: Add floor and ceiling constraints to clock rates

 Documentation/clk.txt   |   2 +-
 arch/arm/mach-omap2/cclock3xxx_data.c   | 108 +++--
 arch/arm/mach-omap2/clock.h |  11 +-
 arch/arm/mach-omap2/clock_common_data.c |   5 +-
 arch/mips/alchemy/common/clock.c|  17 +-
 drivers/clk/at91/clk-programmable.c |   4 +-
 drivers/clk/bcm/clk-kona.c  |   4 +-
 drivers/clk/clk-composite.c |   9 +-
 drivers/clk/clk.c   | 748 
 drivers/clk/clk.h   |   5 +
 drivers/clk/clkdev.c|  24 +-
 drivers/clk/hisilicon/clk-hi3620.c  |   2 +-
 drivers/clk/qcom/clk-rcg.c  |  20 +-
 drivers/clk/qcom/clk-rcg2.c |  28 +-
 drivers/clk/sunxi/clk-factors.c |   4 +-
 drivers/clk/sunxi/clk-sun6i-ar100.c |   4 +-
 include/linux/clk-private.h |  40 +-
 include/linux/clk-provider.h|  30 +-
 include/linux/clk.h |  18 +
 19 files changed, 717 insertions(+), 366 deletions(-)

-- 
1.9.3

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v3 7/8] clk: Make clk API return per-user struct clk instances

2014-10-09 Thread Tomeu Vizoso
Moves clock state to struct clk_core, but takes care to change as little API as
possible.

struct clk_hw still has a pointer to a struct clk, which is the
implementation's per-user clk instance, for backwards compatibility.

The struct clk that clk_get_parent() returns isn't owned by the caller, but by
the clock implementation, so the former shouldn't call clk_put() on it.

Because some boards in mach-omap2 still register clocks statically, their clock
registration had to be updated to take into account that the clock information
is stored in struct clk_core now.

Signed-off-by: Tomeu Vizoso tomeu.viz...@collabora.com

---

v3: * Rebase on top of linux-next 20141009

v2: * Remove exported functions that aren't really used outside clk.c
* Rename new internal functions to clk_core_ prefix
* Remove redundant checks for error pointers in *_get_parent
* Change __clk_create_clk to take a struct clk_hw instead
* Match the original error behavior in clk_get_sys
---
 arch/arm/mach-omap2/cclock3xxx_data.c   | 108 --
 arch/arm/mach-omap2/clock.h |  11 +-
 arch/arm/mach-omap2/clock_common_data.c |   5 +-
 drivers/clk/clk.c   | 630 
 drivers/clk/clk.h   |   5 +
 drivers/clk/clkdev.c|  24 +-
 include/linux/clk-private.h |  35 +-
 include/linux/clk-provider.h|  22 +-
 8 files changed, 549 insertions(+), 291 deletions(-)

diff --git a/arch/arm/mach-omap2/cclock3xxx_data.c 
b/arch/arm/mach-omap2/cclock3xxx_data.c
index eb8c75e..9b210df 100644
--- a/arch/arm/mach-omap2/cclock3xxx_data.c
+++ b/arch/arm/mach-omap2/cclock3xxx_data.c
@@ -82,7 +82,7 @@ DEFINE_CLK_MUX(osc_sys_ck, osc_sys_ck_parent_names, NULL, 0x0,
   OMAP3430_PRM_CLKSEL, OMAP3430_SYS_CLKIN_SEL_SHIFT,
   OMAP3430_SYS_CLKIN_SEL_WIDTH, 0x0, NULL);
 
-DEFINE_CLK_DIVIDER(sys_ck, osc_sys_ck, osc_sys_ck, 0x0,
+DEFINE_CLK_DIVIDER(sys_ck, osc_sys_ck, osc_sys_ck_core, 0x0,
   OMAP3430_PRM_CLKSRC_CTRL, OMAP_SYSCLKDIV_SHIFT,
   OMAP_SYSCLKDIV_WIDTH, CLK_DIVIDER_ONE_BASED, NULL);
 
@@ -131,7 +131,7 @@ static struct clk_hw_omap dpll3_ck_hw = {
 
 DEFINE_STRUCT_CLK(dpll3_ck, dpll3_ck_parent_names, dpll3_ck_ops);
 
-DEFINE_CLK_DIVIDER(dpll3_m2_ck, dpll3_ck, dpll3_ck, 0x0,
+DEFINE_CLK_DIVIDER(dpll3_m2_ck, dpll3_ck, dpll3_ck_core, 0x0,
   OMAP_CM_REGADDR(PLL_MOD, CM_CLKSEL1),
   OMAP3430_CORE_DPLL_CLKOUT_DIV_SHIFT,
   OMAP3430_CORE_DPLL_CLKOUT_DIV_WIDTH,
@@ -148,12 +148,12 @@ static const struct clk_ops core_ck_ops = {};
 DEFINE_STRUCT_CLK_HW_OMAP(core_ck, NULL);
 DEFINE_STRUCT_CLK(core_ck, core_ck_parent_names, core_ck_ops);
 
-DEFINE_CLK_DIVIDER(l3_ick, core_ck, core_ck, 0x0,
+DEFINE_CLK_DIVIDER(l3_ick, core_ck, core_ck_core, 0x0,
   OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
   OMAP3430_CLKSEL_L3_SHIFT, OMAP3430_CLKSEL_L3_WIDTH,
   CLK_DIVIDER_ONE_BASED, NULL);
 
-DEFINE_CLK_DIVIDER(l4_ick, l3_ick, l3_ick, 0x0,
+DEFINE_CLK_DIVIDER(l4_ick, l3_ick, l3_ick_core, 0x0,
   OMAP_CM_REGADDR(CORE_MOD, CM_CLKSEL),
   OMAP3430_CLKSEL_L4_SHIFT, OMAP3430_CLKSEL_L4_WIDTH,
   CLK_DIVIDER_ONE_BASED, NULL);
@@ -271,9 +271,9 @@ static struct clk_hw_omap dpll1_ck_hw = {
 
 DEFINE_STRUCT_CLK(dpll1_ck, dpll3_ck_parent_names, dpll1_ck_ops);
 
-DEFINE_CLK_FIXED_FACTOR(dpll1_x2_ck, dpll1_ck, dpll1_ck, 0x0, 2, 1);
+DEFINE_CLK_FIXED_FACTOR(dpll1_x2_ck, dpll1_ck, dpll1_ck_core, 0x0, 2, 1);
 
-DEFINE_CLK_DIVIDER(dpll1_x2m2_ck, dpll1_x2_ck, dpll1_x2_ck, 0x0,
+DEFINE_CLK_DIVIDER(dpll1_x2m2_ck, dpll1_x2_ck, dpll1_x2_ck_core, 0x0,
   OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_CLKSEL2_PLL),
   OMAP3430_MPU_DPLL_CLKOUT_DIV_SHIFT,
   OMAP3430_MPU_DPLL_CLKOUT_DIV_WIDTH,
@@ -288,7 +288,7 @@ static const char *mpu_ck_parent_names[] = {
 DEFINE_STRUCT_CLK_HW_OMAP(mpu_ck, mpu_clkdm);
 DEFINE_STRUCT_CLK(mpu_ck, mpu_ck_parent_names, core_l4_ick_ops);
 
-DEFINE_CLK_DIVIDER(arm_fck, mpu_ck, mpu_ck, 0x0,
+DEFINE_CLK_DIVIDER(arm_fck, mpu_ck, mpu_ck_core, 0x0,
   OMAP_CM_REGADDR(MPU_MOD, OMAP3430_CM_IDLEST_PLL),
   OMAP3430_ST_MPU_CLK_SHIFT, OMAP3430_ST_MPU_CLK_WIDTH,
   0x0, NULL);
@@ -417,7 +417,7 @@ static const struct clk_div_table dpll4_mx_ck_div_table[] = 
{
{ .div = 0 },
 };
 
-DEFINE_CLK_DIVIDER(dpll4_m5_ck, dpll4_ck, dpll4_ck, 0x0,
+DEFINE_CLK_DIVIDER(dpll4_m5_ck, dpll4_ck, dpll4_ck_core, 0x0,
   OMAP_CM_REGADDR(OMAP3430_CAM_MOD, CM_CLKSEL),
   OMAP3430_CLKSEL_CAM_SHIFT, OMAP3630_CLKSEL_CAM_WIDTH,
   CLK_DIVIDER_ONE_BASED, NULL);
@@ -459,7 +459,7 @@ static struct clk_hw_omap dpll4_m5x2_ck_hw = {
 DEFINE_STRUCT_CLK_FLAGS(dpll4_m5x2_ck, dpll4_m5x2_ck_parent_names,
dpll4_m5x2_ck_ops

Re: RCU bug with v3.17-rc3 ?

2014-10-09 Thread Johannes Weiner
Hi Felipe,

On Wed, Oct 08, 2014 at 04:29:38PM -0500, Felipe Balbi wrote:
 Finally bisected it down to commit 139e561660fe11e0fc35e142a800df3dd7d03e9d
 (lib: radix_tree: tree node interface). Here's full bisect log:
 
 git bisect start
 # good: [455c6fdbd219161bd09b1165f11699d6d73de11c] Linux 3.14
 git bisect good 455c6fdbd219161bd09b1165f11699d6d73de11c
 # bad: [1860e379875dfe7271c649058aeddffe5afd9d0d] Linux 3.15
 git bisect bad 1860e379875dfe7271c649058aeddffe5afd9d0d
 # bad: [74a475acea49459721ae4b062d3da68c74259009] SubmittingPatches: add 
 style recommendation to use imperative descriptions
 git bisect bad 74a475acea49459721ae4b062d3da68c74259009
 # good: [c12e69c6aaf785fd307d05cb6f36ca0e7577ead7] Merge tag 
 'staging-3.15-rc1' of 
 git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
 git bisect good c12e69c6aaf785fd307d05cb6f36ca0e7577ead7
 # good: [0fc31966035d7a540c011b6c967ce8eae1db121b] Merge branch 'for-davem' 
 of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next
 git bisect good 0fc31966035d7a540c011b6c967ce8eae1db121b
 # good: [bdfc7cbdeef8cadba0e5793079ac0130b8e2220c] Merge branch 
 'mips-for-linux-next' of git://git.linux-mips.org/pub/scm/ralf/upstream-sfr
 git bisect good bdfc7cbdeef8cadba0e5793079ac0130b8e2220c
 # good: [0f1b1e6d73cb989ce2c071edc57deade3b084dfe] Merge branch 'for-linus' 
 of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
 git bisect good 0f1b1e6d73cb989ce2c071edc57deade3b084dfe
 # good: [181e7d5d7bd7747e882e3ca89ecbf0fc3e72d0da] ixgbe: remove redundant if 
 clause from PTP work
 git bisect good 181e7d5d7bd7747e882e3ca89ecbf0fc3e72d0da
 # good: [59ecc26004e77e100c700b1d0da7502b0fdadb46] Merge 
 git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
 git bisect good 59ecc26004e77e100c700b1d0da7502b0fdadb46
 # good: [2b665e276c15ba7d9fc8cdd16931883a51ed13e4] fs/direct-io.c: remove 
 redundant comparison
 git bisect good 2b665e276c15ba7d9fc8cdd16931883a51ed13e4
 # bad: [f412c97abef71026d8192ca8efca231f1e3906b3] mm, hugetlb: mark some 
 bootstrap functions as __init
 git bisect bad f412c97abef71026d8192ca8efca231f1e3906b3
 # good: [4e35f483850ba46b838adfd312b3052416e15204] mm, hugetlb: use 
 vma_resv_map() map types
 git bisect good 4e35f483850ba46b838adfd312b3052416e15204
 # good: [6dbaf22ce1f1dfba33313198eb5bd989ae76dd87] mm: shmem: save one radix 
 tree lookup when truncating swapped pages
 git bisect good 6dbaf22ce1f1dfba33313198eb5bd989ae76dd87
 # good: [91b0abe36a7b2b3b02d7500925a5f8455334f0e5] mm + fs: store shadow 
 entries in page cache
 git bisect good 91b0abe36a7b2b3b02d7500925a5f8455334f0e5
 # bad: [139e561660fe11e0fc35e142a800df3dd7d03e9d] lib: radix_tree: tree node 
 interface
 git bisect bad 139e561660fe11e0fc35e142a800df3dd7d03e9d
 # good: [a528910e12ec7ee203095eb1711468a66b9b60b0] mm: thrash detection-based 
 file cache sizing
 git bisect good a528910e12ec7ee203095eb1711468a66b9b60b0
 # first bad commit: [139e561660fe11e0fc35e142a800df3dd7d03e9d] lib: 
 radix_tree: tree node interface
 
 I tried reverting that commit on v3.15 but it's non-trivial; I'll leave
 that for tomorrow. Meanwhile, adding folks involved with that commit to
 Cc list and another backtrace for reference:
 
 [  113.696647] Unable to handle kernel paging request at virtual address 
 
 [  113.704370] pgd = c0004000
 [  113.707276] [] *pgd=9fef6821, *pte=, *ppte=
 [  113.713998] Internal error: Oops: 17 [#1] SMP ARM
 [  113.718912] Modules linked in: g_mass_storage usb_f_mass_storage 
 libcomposite configfs musb_dsps musb_hdrc musb_am335x
 [  113.730144] CPU: 0 PID: 1368 Comm: file-storage Not tainted 
 3.17.0-02899-g748eb79 #239
 [  113.738410] task: de606e00 ti: dd0ba000 task.ti: dd0ba000
 [  113.744060] PC is at find_get_entry+0x64/0x100

Could you please provide the disassembly of that function?

I'm thinking it's not the slot pointer itself that's bad, because
__radix_tree_lookup() dereferences that to test if it's populated
before returning it, and slot life-time is guaranteed by RCU.

That would only leave garbage in the slot itself, crashing during
page_cache_get_speculative().

I'll keep staring at this change, but nothing stands out to me yet.

Thanks,
Johannes

 [  113.748700] LR is at 0xfffa
 [  113.751978] pc : [c01065b4]lr : [fffa]psr: a00f0013
 [  113.751978] sp : dd0bbba0  ip :   fp : dd0bbbd4
 [  113.763962] r10: c0665100  r9 : 1000  r8 : 001a
 [  113.769415] r7 : dd0ee9b8  r6 : 0001  r5 :   r4 : dd0ee880
 [  113.776228] r3 : dd0bbb8c  r2 :   r1 : 001a  r0 : 
 [  113.783044] Flags: NzCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM  Segment 
 kernel
 [  113.790674] Control: 10c5387d  Table: 9e210019  DAC: 0015
 [  113.796672] Process file-storage (pid: 1368, stack limit = 0xdd0ba248)
 [  113.803486] Stack: (0xdd0bbba0 to 0xdd0bc000)
 [  113.808038] bba0:   c0106550 00017508 0002 dd0ee880 
 dd0ee9b4 001a
 [  

Re: RCU bug with v3.17-rc3 ?

2014-10-09 Thread Felipe Balbi
Hi Johannes,

On Thu, Oct 09, 2014 at 12:01:38PM -0400, Johannes Weiner wrote:
 On Wed, Oct 08, 2014 at 04:29:38PM -0500, Felipe Balbi wrote:
  Finally bisected it down to commit 139e561660fe11e0fc35e142a800df3dd7d03e9d
  (lib: radix_tree: tree node interface). Here's full bisect log:
  
  git bisect start
  # good: [455c6fdbd219161bd09b1165f11699d6d73de11c] Linux 3.14
  git bisect good 455c6fdbd219161bd09b1165f11699d6d73de11c
  # bad: [1860e379875dfe7271c649058aeddffe5afd9d0d] Linux 3.15
  git bisect bad 1860e379875dfe7271c649058aeddffe5afd9d0d
  # bad: [74a475acea49459721ae4b062d3da68c74259009] SubmittingPatches: add 
  style recommendation to use imperative descriptions
  git bisect bad 74a475acea49459721ae4b062d3da68c74259009
  # good: [c12e69c6aaf785fd307d05cb6f36ca0e7577ead7] Merge tag 
  'staging-3.15-rc1' of 
  git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging
  git bisect good c12e69c6aaf785fd307d05cb6f36ca0e7577ead7
  # good: [0fc31966035d7a540c011b6c967ce8eae1db121b] Merge branch 'for-davem' 
  of git://git.kernel.org/pub/scm/linux/kernel/git/linville/wireless-next
  git bisect good 0fc31966035d7a540c011b6c967ce8eae1db121b
  # good: [bdfc7cbdeef8cadba0e5793079ac0130b8e2220c] Merge branch 
  'mips-for-linux-next' of git://git.linux-mips.org/pub/scm/ralf/upstream-sfr
  git bisect good bdfc7cbdeef8cadba0e5793079ac0130b8e2220c
  # good: [0f1b1e6d73cb989ce2c071edc57deade3b084dfe] Merge branch 'for-linus' 
  of git://git.kernel.org/pub/scm/linux/kernel/git/jikos/hid
  git bisect good 0f1b1e6d73cb989ce2c071edc57deade3b084dfe
  # good: [181e7d5d7bd7747e882e3ca89ecbf0fc3e72d0da] ixgbe: remove redundant 
  if clause from PTP work
  git bisect good 181e7d5d7bd7747e882e3ca89ecbf0fc3e72d0da
  # good: [59ecc26004e77e100c700b1d0da7502b0fdadb46] Merge 
  git://git.kernel.org/pub/scm/linux/kernel/git/herbert/crypto-2.6
  git bisect good 59ecc26004e77e100c700b1d0da7502b0fdadb46
  # good: [2b665e276c15ba7d9fc8cdd16931883a51ed13e4] fs/direct-io.c: remove 
  redundant comparison
  git bisect good 2b665e276c15ba7d9fc8cdd16931883a51ed13e4
  # bad: [f412c97abef71026d8192ca8efca231f1e3906b3] mm, hugetlb: mark some 
  bootstrap functions as __init
  git bisect bad f412c97abef71026d8192ca8efca231f1e3906b3
  # good: [4e35f483850ba46b838adfd312b3052416e15204] mm, hugetlb: use 
  vma_resv_map() map types
  git bisect good 4e35f483850ba46b838adfd312b3052416e15204
  # good: [6dbaf22ce1f1dfba33313198eb5bd989ae76dd87] mm: shmem: save one 
  radix tree lookup when truncating swapped pages
  git bisect good 6dbaf22ce1f1dfba33313198eb5bd989ae76dd87
  # good: [91b0abe36a7b2b3b02d7500925a5f8455334f0e5] mm + fs: store shadow 
  entries in page cache
  git bisect good 91b0abe36a7b2b3b02d7500925a5f8455334f0e5
  # bad: [139e561660fe11e0fc35e142a800df3dd7d03e9d] lib: radix_tree: tree 
  node interface
  git bisect bad 139e561660fe11e0fc35e142a800df3dd7d03e9d
  # good: [a528910e12ec7ee203095eb1711468a66b9b60b0] mm: thrash 
  detection-based file cache sizing
  git bisect good a528910e12ec7ee203095eb1711468a66b9b60b0
  # first bad commit: [139e561660fe11e0fc35e142a800df3dd7d03e9d] lib: 
  radix_tree: tree node interface
  
  I tried reverting that commit on v3.15 but it's non-trivial; I'll leave
  that for tomorrow. Meanwhile, adding folks involved with that commit to
  Cc list and another backtrace for reference:
  
  [  113.696647] Unable to handle kernel paging request at virtual address 
  
  [  113.704370] pgd = c0004000
  [  113.707276] [] *pgd=9fef6821, *pte=, *ppte=
  [  113.713998] Internal error: Oops: 17 [#1] SMP ARM
  [  113.718912] Modules linked in: g_mass_storage usb_f_mass_storage 
  libcomposite configfs musb_dsps musb_hdrc musb_am335x
  [  113.730144] CPU: 0 PID: 1368 Comm: file-storage Not tainted 
  3.17.0-02899-g748eb79 #239
  [  113.738410] task: de606e00 ti: dd0ba000 task.ti: dd0ba000
  [  113.744060] PC is at find_get_entry+0x64/0x100
 
 Could you please provide the disassembly of that function?

here you go. It's ARM assembly however:

Dump of assembler code for function find_get_entry:
   0xc011da48 +0: mov r12, sp
   0xc011da4c +4: push{r4, r5, r6, r7, r8, r9, r11, r12, lr, pc}
   0xc011da50 +8: sub r11, r12, #4
   0xc011da54 +12:sub sp, sp, #16
   0xc011da58 +16:push{lr}; (str lr, [sp, #-4]!)
   0xc011da5c +20:bl  0xc000ef00 __gnu_mcount_nc
   0xc011da60 +24:mov r6, r0
   0xc011da64 +28:mov r7, r1
   0xc011da68 +32:ldr r2, [pc, #520]  ; 0xc011dc78 
find_get_entry+560
   0xc011da6c +36:mov r3, #0
   0xc011da70 +40:mov r1, r3
   0xc011da74 +44:str r2, [sp, #8]
   0xc011da78 +48:str r3, [sp]
   0xc011da7c +52:mov r2, r3
   0xc011da80 +56:str r3, [sp, #4]
   0xc011da84 +60:ldr r0, [pc, #496]  ; 0xc011dc7c 
find_get_entry+564
   0xc011da88 +64:mov r3, #2
   0xc011da8c +68:bl  0xc0095f88 lock_acquire
   0xc011da90 +72:

Re: [RFC PATCH 1/6] ARM: OMAP2+: hwmod: add parent_hwmod support

2014-10-09 Thread Archit Taneja
Hi,

On Thu, Oct 9, 2014 at 7:33 PM, Tomi Valkeinen tomi.valkei...@ti.com wrote:
 Add parent_hwmod pointer to omap_hwmod. This can be set to point to a
 parent hwmod that needs to be enabled for the child hwmod to work.

 This is used at hwmod setup time: when doing the initial setup and
 reset, first enable the parent hwmod, and after setup and reset is done,
 restore the parent hwmod to postsetup_state.


This method is better. It's less intrusive and only takes place at setup time.

Reviewed-by: Archit Taneja archit.tan...@gmail.com
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [RFC PATCH 0/6] ARM: OMAP4+: hwmod: fixing omap4+ DSS hwmods

2014-10-09 Thread Archit Taneja
On Thu, Oct 9, 2014 at 7:33 PM, Tomi Valkeinen tomi.valkei...@ti.com wrote:
 This is an RFC to fix the issues with boot time DSS hwmod setup.

 There was an earlier series sent by Archit here:

 http://www.spinics.net/lists/linux-omap/msg107700.html

 This series takes different approach, and just tries to fix the issue at setup
 time by making sure the DSS core hwmod is enabled when a DSS submodule hwmod 
 is
 being setup.

 Quickly tested on OMAP4 Panda and OMAP5 uEVM.

The series looks good to me.

Reviewed-by: Archit Taneja archit.tan...@gmail.com

Archit
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] ARM: dts: Disable smc91x on n900 until bootloader dependency is removed

2014-10-09 Thread Tony Lindgren
I added smc91x support but turns out we currently do not set the
smc91x timings in gpmc.c but rely on the bootloader timings. This
produces the following error unless the smc91x GPMC timings are
initialized by the bootloader:

Unhandled fault: external abort on non-linefetch (0x1008) at 0xd080630e
...
[c04067fc] (smc_drv_probe) from [c038e9c4] (platform_drv_probe+0x2c/0x5c)
[c038e9c4] (platform_drv_probe) from [c038d450] 
(driver_probe_device+0x104/0x22c)
[c038d450] (driver_probe_device) from [c038d60c] (__driver_attach+0x94/0x98)
[c038d60c] (__driver_attach) from [c038bc3c] (bus_for_each_dev+0x54/0x88)
[c038bc3c] (bus_for_each_dev) from [c038cc3c] (bus_add_driver+0xd8/0x1d8)
[c038cc3c] (bus_add_driver) from [c038dd74] (driver_register+0x78/0xf4)
[c038dd74] (driver_register) from [c0008924] (do_one_initcall+0x80/0x1c0)
[c0008924] (do_one_initcall) from [c0852d9c] 
(kernel_init_freeable+0x1b8/0x28c)
[c0852d9c] (kernel_init_freeable) from [c05ce86c] (kernel_init+0x8/0xec)
[c05ce86c] (kernel_init) from [c000e728] (ret_from_fork+0x14/0x2c)

Let's fix the issue by disabling the smc91x module for now until we
have sorted out the issues in gpmc.c.

Reported-by: Kevin Hilman khil...@linaro.org
Signed-off-by: Tony Lindgren t...@atomide.com

--- a/arch/arm/boot/dts/omap3-n900.dts
+++ b/arch/arm/boot/dts/omap3-n900.dts
@@ -659,6 +659,9 @@
 
ethernet@gpmc {
compatible = smsc,lan91c94;
+
+   status = disabled;
+
interrupt-parent = gpio2;
interrupts = 22 IRQ_TYPE_LEVEL_HIGH;  /* gpio54 */
reg = 1 0x300 0xf;/* 16 byte IO range at offset 
0x300 */
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


cpuidle - minimum time for sleep

2014-10-09 Thread Ran Shalit
Hello,

Does anybody know what is the minimum expected time for sleep period
with the cpuidle ?

I intend t use the menu governer, and I try to estimate the sleep time.

Thanks,
Ran
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: cpuidle - minimum time for sleep

2014-10-09 Thread Valdis . Kletnieks
On Thu, 09 Oct 2014 21:28:23 +0300, Ran Shalit said:

 Does anybody know what is the minimum expected time for sleep period
 with the cpuidle ?

Both processor dependent and sleep level dependent.  There's a certain
amount of latency induced by the hardware waking up.

Look at /sys/devices/system/cpu/cpu*/cpuidle/state*/latency


pgpNPLCCaPNRr.pgp
Description: PGP signature


[PATCH 05/12] rtc: omap: remove redundant debug message

2014-10-09 Thread Johan Hovold
Remove redundant debug message.

The corresponding error has already been logged by rtc core.

Signed-off-by: Johan Hovold jo...@kernel.org
---
 drivers/rtc/rtc-omap.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
index d1b5562a148b..e50ffd7063f5 100644
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -485,11 +485,9 @@ static int __init omap_rtc_probe(struct platform_device 
*pdev)
 
rtc = devm_rtc_device_register(pdev-dev, pdev-name,
omap_rtc_ops, THIS_MODULE);
-   if (IS_ERR(rtc)) {
-   pr_debug(%s: can't register RTC device, err %ld\n,
-   pdev-name, PTR_ERR(rtc));
+   if (IS_ERR(rtc))
goto fail0;
-   }
+
platform_set_drvdata(pdev, rtc);
 
return 0;
-- 
2.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 02/12] rtc: omap: fix missing wakealarm attribute

2014-10-09 Thread Johan Hovold
The platform device must be registered as wakeup capable before
registering the class device, or the wakealarm attribute will not be
created.

Also make sure to unregister the wakeup source on probe errors.

Fixes: 1d2e2b65d098 (rtc: omap: restore back (hard-code) wakeup support)
Cc: stable sta...@vger.kernel.org
Signed-off-by: Johan Hovold jo...@kernel.org
---
 drivers/rtc/rtc-omap.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
index f842c216f2dd..828cb9983cc2 100644
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -416,6 +416,8 @@ static int __init omap_rtc_probe(struct platform_device 
*pdev)
rtc_writel(KICK1_VALUE, OMAP_RTC_KICK1_REG);
}
 
+   device_init_wakeup(pdev-dev, true);
+
rtc = devm_rtc_device_register(pdev-dev, pdev-name,
omap_rtc_ops, THIS_MODULE);
if (IS_ERR(rtc)) {
@@ -484,8 +486,6 @@ static int __init omap_rtc_probe(struct platform_device 
*pdev)
 *is write-only, and always reads as zero...)
 */
 
-   device_init_wakeup(pdev-dev, true);
-
if (new_ctrl  (u8) OMAP_RTC_CTRL_SPLIT)
pr_info(%s: split power mode\n, pdev-name);
 
@@ -495,6 +495,7 @@ static int __init omap_rtc_probe(struct platform_device 
*pdev)
return 0;
 
 fail0:
+   device_init_wakeup(pdev-dev, false);
if (id_entry-driver_data  OMAP_RTC_HAS_KICKER)
rtc_writel(0, OMAP_RTC_KICK0_REG);
pm_runtime_put_sync(pdev-dev);
-- 
2.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 00/12] rtc: omap: fixes and power-off feature

2014-10-09 Thread Johan Hovold
This series fixes a few issues with the omap rtc-driver, cleans up a bit
and finally adds support for the PMIC control feature found in some
revisions of this RTC IP block.

Ultimately, this allows for powering off the Beaglebone and waking it up
again on RTC alarms.

I noticed yesterday that Lokesh Vutla recently posted some patches to
add regulator support to this driver. [1] While that series has some
issues that needs to be addressed, I still think it could be a good idea
to rebase my pmic_power_en patch on top of it as it adds some long
overdue device abstraction. That would be needed anyway in order to
support the new power-off infrastructure that's in the pipe in a clean
way. [2]

So my suggestion is to merge the first seven patches, rebase Lokesh
series on top of that, and then I rebase my final five patches on top
of that in turn. Hopefully, the new power-off handler call chain will
have stabilised by then.

Johan

[1] http://www.spinics.net/lists/devicetree/msg50869.html
[2] https://lkml.org/lkml/2014/10/7/30


Johan Hovold (12):
  rtc: omap: fix clock-source configuration
  rtc: omap: fix missing wakealarm attribute
  rtc: omap: fix class-device registration
  rtc: omap: remove unused register-base define
  rtc: omap: remove redundant debug message
  rtc: omap: use dev_info and dev_dbg
  rtc: omap: silence bogus power-up reset message at probe
  rtc: omap: restore irq state after reading TC registers
  rtc: omap: add support for pmic_power_en
  rtc: omap: enable wake-up from power off
  ARM: dts: am33xx: update rtc node compatible property
  ARM: dts: am335x-bone-common: enable power off and rtc wake up

 Documentation/devicetree/bindings/rtc/rtc-omap.txt |   9 +-
 arch/arm/boot/dts/am335x-bone-common.dtsi  |   4 +
 arch/arm/boot/dts/am33xx.dtsi  |   2 +-
 drivers/rtc/rtc-omap.c | 202 -
 4 files changed, 173 insertions(+), 44 deletions(-)

-- 
2.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 03/12] rtc: omap: fix class-device registration

2014-10-09 Thread Johan Hovold
Make sure not to register the class device until after it has been
configured and interrupt handlers registered at probe.

Currently, the device is not fully configured (e.g. 24-hour mode) when
the class device is registered, something which involves driver
callbacks for example to read the current time.

This reordering also prevents user space from enabling an alarm before
an interrupt handler has been registered.

Note that the interrupts are now registered using the platform-device
rather than class-device name.

Signed-off-by: Johan Hovold jo...@kernel.org
---
 drivers/rtc/rtc-omap.c | 32 +---
 1 file changed, 17 insertions(+), 15 deletions(-)

diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
index 828cb9983cc2..2eca141e784e 100644
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -147,8 +147,9 @@ static void rtc_wait_not_busy(void)
/* now we have ~15 usec to read/write various registers */
 }
 
-static irqreturn_t rtc_irq(int irq, void *rtc)
+static irqreturn_t rtc_irq(int irq, void *dev_id)
 {
+   struct rtc_device   *rtc = platform_get_drvdata(dev_id);
unsigned long   events = 0;
u8  irq_data;
 
@@ -164,7 +165,8 @@ static irqreturn_t rtc_irq(int irq, void *rtc)
if (irq_data  OMAP_RTC_STATUS_1S_EVENT)
events |= RTC_IRQF | RTC_UF;
 
-   rtc_update_irq(rtc, 1, events);
+   if (rtc)
+   rtc_update_irq(rtc, 1, events);
 
return IRQ_HANDLED;
 }
@@ -416,17 +418,6 @@ static int __init omap_rtc_probe(struct platform_device 
*pdev)
rtc_writel(KICK1_VALUE, OMAP_RTC_KICK1_REG);
}
 
-   device_init_wakeup(pdev-dev, true);
-
-   rtc = devm_rtc_device_register(pdev-dev, pdev-name,
-   omap_rtc_ops, THIS_MODULE);
-   if (IS_ERR(rtc)) {
-   pr_debug(%s: can't register RTC device, err %ld\n,
-   pdev-name, PTR_ERR(rtc));
-   goto fail0;
-   }
-   platform_set_drvdata(pdev, rtc);
-
/* clear pending irqs, and set 1/second periodic,
 * which we'll use instead of update irqs
 */
@@ -450,14 +441,14 @@ static int __init omap_rtc_probe(struct platform_device 
*pdev)
 
/* handle periodic and alarm irqs */
if (devm_request_irq(pdev-dev, omap_rtc_timer, rtc_irq, 0,
-   dev_name(rtc-dev), rtc)) {
+   dev_name(pdev-dev), pdev)) {
pr_debug(%s: RTC timer interrupt IRQ%d already claimed\n,
pdev-name, omap_rtc_timer);
goto fail0;
}
if ((omap_rtc_timer != omap_rtc_alarm) 
(devm_request_irq(pdev-dev, omap_rtc_alarm, rtc_irq, 0,
-   dev_name(rtc-dev), rtc))) {
+   dev_name(pdev-dev), pdev))) {
pr_debug(%s: RTC alarm interrupt IRQ%d already claimed\n,
pdev-name, omap_rtc_alarm);
goto fail0;
@@ -492,6 +483,17 @@ static int __init omap_rtc_probe(struct platform_device 
*pdev)
if (reg != new_ctrl)
rtc_write(new_ctrl, OMAP_RTC_CTRL_REG);
 
+   device_init_wakeup(pdev-dev, true);
+
+   rtc = devm_rtc_device_register(pdev-dev, pdev-name,
+   omap_rtc_ops, THIS_MODULE);
+   if (IS_ERR(rtc)) {
+   pr_debug(%s: can't register RTC device, err %ld\n,
+   pdev-name, PTR_ERR(rtc));
+   goto fail0;
+   }
+   platform_set_drvdata(pdev, rtc);
+
return 0;
 
 fail0:
-- 
2.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 07/12] rtc: omap: silence bogus power-up reset message at probe

2014-10-09 Thread Johan Hovold
Some legacy RTC IP revisions has a power-up reset flag in the status
register that later revisions lack.

As this flag is always read back as set on later revisions (or is
overloaded with a different flag), make sure to only clear the flag and
print the info message on legacy platforms.

Signed-off-by: Johan Hovold jo...@kernel.org
---
 drivers/rtc/rtc-omap.c | 23 +--
 1 file changed, 17 insertions(+), 6 deletions(-)

diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
index 1c58920b0c88..0ef016553a97 100644
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -118,6 +118,12 @@
  */
 #define OMAP_RTC_HAS_32KCLK_EN BIT(2)
 
+/*
+ * Some legacy RTC IP revisions has a power-up reset flag which later
+ * revisions lack.
+ */
+#define OMAP_RTC_HAS_POWER_UP_RESETBIT(3)
+
 static void __iomem*rtc_base;
 
 #define rtc_read(addr) readb(rtc_base + (addr))
@@ -347,6 +353,7 @@ static int omap_rtc_timer;
 static struct platform_device_id omap_rtc_devtype[] = {
{
.name   = DRIVER_NAME,
+   .driver_data = OMAP_RTC_HAS_POWER_UP_RESET,
},
[OMAP_RTC_DATA_AM3352_IDX] = {
.name   = am3352-rtc,
@@ -376,7 +383,7 @@ static int __init omap_rtc_probe(struct platform_device 
*pdev)
 {
struct resource *res;
struct rtc_device   *rtc;
-   u8  reg, new_ctrl;
+   u8  reg, mask, new_ctrl;
const struct platform_device_id *id_entry;
const struct of_device_id *of_id;
 
@@ -429,12 +436,16 @@ static int __init omap_rtc_probe(struct platform_device 
*pdev)
 
/* clear old status */
reg = rtc_read(OMAP_RTC_STATUS_REG);
-   if (reg  (u8) OMAP_RTC_STATUS_POWER_UP) {
-   dev_info(pdev-dev, RTC power up reset detected\n);
-   rtc_write(OMAP_RTC_STATUS_POWER_UP, OMAP_RTC_STATUS_REG);
+
+   mask = OMAP_RTC_STATUS_ALARM;
+   if (id_entry-driver_data  OMAP_RTC_HAS_POWER_UP_RESET) {
+   mask |= OMAP_RTC_STATUS_POWER_UP;
+   if (reg  OMAP_RTC_STATUS_POWER_UP)
+   dev_info(pdev-dev, RTC power up reset detected\n);
}
-   if (reg  (u8) OMAP_RTC_STATUS_ALARM)
-   rtc_write(OMAP_RTC_STATUS_ALARM, OMAP_RTC_STATUS_REG);
+
+   if (reg  mask)
+   rtc_write(reg  mask, OMAP_RTC_STATUS_REG);
 
/* handle periodic and alarm irqs */
if (devm_request_irq(pdev-dev, omap_rtc_timer, rtc_irq, 0,
-- 
2.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 04/12] rtc: omap: remove unused register-base define

2014-10-09 Thread Johan Hovold
Remove register-base define, which is no longer used.

Signed-off-by: Johan Hovold jo...@kernel.org
---
 drivers/rtc/rtc-omap.c | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
index 2eca141e784e..d1b5562a148b 100644
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -41,8 +41,6 @@
 
 #defineDRIVER_NAME omap_rtc
 
-#define OMAP_RTC_BASE  0xfffb4800
-
 /* RTC registers */
 #define OMAP_RTC_SECONDS_REG   0x00
 #define OMAP_RTC_MINUTES_REG   0x04
-- 
2.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 01/12] rtc: omap: fix clock-source configuration

2014-10-09 Thread Johan Hovold
Make sure not to reset the clock-source configuration when enabling the
32kHz clock mux.

Until the clock source can be configured through device tree we must not
overwrite settings made by the bootloader (e.g. clock-source selection).

Fixes: cd914bba03d8 (drivers/rtc/rtc-omap.c: add support for enabling
32khz clock)
Cc: stable sta...@vger.kernel.org

Signed-off-by: Johan Hovold jo...@kernel.org
---
 drivers/rtc/rtc-omap.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
index 21142e6574a9..f842c216f2dd 100644
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -431,8 +431,10 @@ static int __init omap_rtc_probe(struct platform_device 
*pdev)
rtc_write(0, OMAP_RTC_INTERRUPTS_REG);
 
/* enable RTC functional clock */
-   if (id_entry-driver_data  OMAP_RTC_HAS_32KCLK_EN)
-   rtc_writel(OMAP_RTC_OSC_32KCLK_EN, OMAP_RTC_OSC_REG);
+   if (id_entry-driver_data  OMAP_RTC_HAS_32KCLK_EN) {
+   reg = rtc_read(OMAP_RTC_OSC_REG);
+   rtc_writel(reg | OMAP_RTC_OSC_32KCLK_EN, OMAP_RTC_OSC_REG);
+   }
 
/* clear old status */
reg = rtc_read(OMAP_RTC_STATUS_REG);
-- 
2.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 10/12] rtc: omap: enable wake-up from power off

2014-10-09 Thread Johan Hovold
The ALARM interrupt must not be disabled during shutdown in order to be
able to power up the system using an RTC alarm.

Signed-off-by: Johan Hovold jo...@kernel.org
---
 drivers/rtc/rtc-omap.c | 10 +-
 1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
index b0319864dd42..8836c58901b5 100644
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -670,7 +670,15 @@ static SIMPLE_DEV_PM_OPS(omap_rtc_pm_ops, 
omap_rtc_suspend, omap_rtc_resume);
 
 static void omap_rtc_shutdown(struct platform_device *pdev)
 {
-   rtc_write(0, OMAP_RTC_INTERRUPTS_REG);
+   u8 mask;
+
+   /*
+* Keep the ALARM interrupt enabled to allow the system to power up on
+* alarm events.
+*/
+   mask = rtc_read(OMAP_RTC_INTERRUPTS_REG);
+   mask = OMAP_RTC_INTERRUPTS_IT_ALARM;
+   rtc_write(mask, OMAP_RTC_INTERRUPTS_REG);
 }
 
 MODULE_ALIAS(platform:omap_rtc);
-- 
2.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 12/12] ARM: dts: am335x-bone-common: enable power off and rtc wake up

2014-10-09 Thread Johan Hovold
Configure the RTC as system-power controller, which allows the system to
be powered off as well as woken up again on subsequent RTC alarms.

Note that the PMIC needs to be put in SLEEP (rather than OFF) mode to
maintain RTC power. Specifically, this means that the PMIC
ti,pmic-shutdown-controller property must be left unset in order to be
able to wake up on RTC alarms.

Tested on BeagleBone Black (rev A5).

Signed-off-by: Johan Hovold jo...@kernel.org
---
 arch/arm/boot/dts/am335x-bone-common.dtsi | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/boot/dts/am335x-bone-common.dtsi 
b/arch/arm/boot/dts/am335x-bone-common.dtsi
index bde1777b62be..d0693bea9580 100644
--- a/arch/arm/boot/dts/am335x-bone-common.dtsi
+++ b/arch/arm/boot/dts/am335x-bone-common.dtsi
@@ -298,3 +298,7 @@
cd-gpios = gpio0 6 GPIO_ACTIVE_HIGH;
cd-inverted;
 };
+
+rtc {
+   ti,system-power-controller;
+};
-- 
2.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 09/12] rtc: omap: add support for pmic_power_en

2014-10-09 Thread Johan Hovold
Add new property ti,system-power-controller to register the RTC as a
power-off handler.

Some RTC IP revisions can control an external PMIC via the pmic_power_en
pin, which can be configured to transition to OFF on ALARM2 events and
back to ON on subsequent ALARM (wakealarm) events.

This is based on earlier work by Colin Foe-Parker and AnilKumar Ch. [1]

[1] https://www.mail-archive.com/linux-omap@vger.kernel.org/msg82127.html

Signed-off-by: Johan Hovold jo...@kernel.org
---
 Documentation/devicetree/bindings/rtc/rtc-omap.txt |   9 +-
 drivers/rtc/rtc-omap.c | 107 -
 2 files changed, 110 insertions(+), 6 deletions(-)

diff --git a/Documentation/devicetree/bindings/rtc/rtc-omap.txt 
b/Documentation/devicetree/bindings/rtc/rtc-omap.txt
index 5a0f02d34d95..750efd40c72e 100644
--- a/Documentation/devicetree/bindings/rtc/rtc-omap.txt
+++ b/Documentation/devicetree/bindings/rtc/rtc-omap.txt
@@ -5,11 +5,17 @@ Required properties:
- ti,da830-rtc  - for RTC IP used similar to that on DA8xx SoC family.
- ti,am3352-rtc - for RTC IP used similar to that on AM335x SoC 
family.
This RTC IP has special WAKE-EN Register to enable
-   Wakeup generation for event Alarm.
+   Wakeup generation for event Alarm. It can also be
+   used to control an external PMIC via the
+   pmic_power_en pin.
 - reg: Address range of rtc register set
 - interrupts: rtc timer, alarm interrupts in order
 - interrupt-parent: phandle for the interrupt controller
 
+Optional properties:
+- ti,system-power-controller: whether the rtc is controlling the system power
+  through pmic_power_en
+
 Example:
 
 rtc@1c23000 {
@@ -18,4 +24,5 @@ rtc@1c23000 {
interrupts = 19
  19;
interrupt-parent = intc;
+   ti,system-power-controller;
 };
diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
index 62e2e9a9887a..b0319864dd42 100644
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -70,6 +70,15 @@
 
 #define OMAP_RTC_IRQWAKEEN 0x7c
 
+#define OMAP_RTC_ALARM2_SECONDS_REG0x80
+#define OMAP_RTC_ALARM2_MINUTES_REG0x84
+#define OMAP_RTC_ALARM2_HOURS_REG  0x88
+#define OMAP_RTC_ALARM2_DAYS_REG   0x8c
+#define OMAP_RTC_ALARM2_MONTHS_REG 0x90
+#define OMAP_RTC_ALARM2_YEARS_REG  0x94
+
+#define OMAP_RTC_PMIC_REG  0x98
+
 /* OMAP_RTC_CTRL_REG bit fields: */
 #define OMAP_RTC_CTRL_SPLITBIT(7)
 #define OMAP_RTC_CTRL_DISABLE  BIT(6)
@@ -82,6 +91,7 @@
 
 /* OMAP_RTC_STATUS_REG bit fields: */
 #define OMAP_RTC_STATUS_POWER_UP   BIT(7)
+#define OMAP_RTC_STATUS_ALARM2 BIT(7)
 #define OMAP_RTC_STATUS_ALARM  BIT(6)
 #define OMAP_RTC_STATUS_1D_EVENT   BIT(5)
 #define OMAP_RTC_STATUS_1H_EVENT   BIT(4)
@@ -91,6 +101,7 @@
 #define OMAP_RTC_STATUS_BUSY   BIT(0)
 
 /* OMAP_RTC_INTERRUPTS_REG bit fields: */
+#define OMAP_RTC_INTERRUPTS_IT_ALARM2  BIT(4)
 #define OMAP_RTC_INTERRUPTS_IT_ALARM   BIT(3)
 #define OMAP_RTC_INTERRUPTS_IT_TIMER   BIT(2)
 
@@ -100,6 +111,9 @@
 /* OMAP_RTC_IRQWAKEEN bit fields: */
 #define OMAP_RTC_IRQWAKEEN_ALARM_WAKEENBIT(1)
 
+/* OMAP_RTC_PMIC bit fields: */
+#define OMAP_RTC_PMIC_POWER_EN_EN  BIT(16)
+
 /* OMAP_RTC_KICKER values */
 #defineKICK0_VALUE 0x83e70b13
 #defineKICK1_VALUE 0x95a4f1e0
@@ -124,11 +138,18 @@
  */
 #define OMAP_RTC_HAS_POWER_UP_RESETBIT(3)
 
+/*
+ * Some RTC IP revisions can control an external PMIC via the pmic_power_en
+ * pin.
+ */
+#define OMAP_RTC_HAS_PMIC_MODE BIT(4)
+
 static void __iomem*rtc_base;
 
 #define rtc_read(addr) readb(rtc_base + (addr))
 #define rtc_write(val, addr)   writeb(val, rtc_base + (addr))
 
+#define rtc_readl(addr)readl(rtc_base + (addr))
 #define rtc_writel(val, addr)  writel(val, rtc_base + (addr))
 
 
@@ -338,6 +359,61 @@ static int omap_rtc_set_alarm(struct device *dev, struct 
rtc_wkalrm *alm)
return 0;
 }
 
+static struct platform_device *omap_rtc_power_off_dev;
+
+/*
+ * omap_rtc_poweroff: RTC-controlled power off
+ *
+ * The RTC can be used to control an external PMIC via the pmic_power_en pin,
+ * which can be configured to transition to OFF on ALARM2 events.
+ *
+ * Notes:
+ * The two-second alarm offset is the shortest offset possible as the alarm
+ * registers must be set before the next timer update and the offset
+ * calculation is to heavy for everything to be done within a single access
+ * period (~15us).
+ *
+ * Called with local interrupts disabled.
+ */
+static void omap_rtc_power_off(void)
+{
+   struct rtc_time tm;
+   unsigned long now;
+   u32 val;
+
+   /* enable pmic_power_en control */
+   val = rtc_readl(OMAP_RTC_PMIC_REG);
+   rtc_writel(val | OMAP_RTC_PMIC_POWER_EN_EN, OMAP_RTC_PMIC_REG);
+
+   

[PATCH 11/12] ARM: dts: am33xx: update rtc node compatible property

2014-10-09 Thread Johan Hovold
Enable am33xx specific RTC features (e.g. PMIC control) by adding
ti,am3352-rtc to the compatible property of the rtc node.

Signed-off-by: Johan Hovold jo...@kernel.org
---
 arch/arm/boot/dts/am33xx.dtsi | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/boot/dts/am33xx.dtsi b/arch/arm/boot/dts/am33xx.dtsi
index 3a0a161342ba..098e53602d5c 100644
--- a/arch/arm/boot/dts/am33xx.dtsi
+++ b/arch/arm/boot/dts/am33xx.dtsi
@@ -411,7 +411,7 @@
};
 
rtc: rtc@44e3e000 {
-   compatible = ti,da830-rtc;
+   compatible = ti,am3352-rtc, ti,da830-rtc;
reg = 0x44e3e000 0x1000;
interrupts = 75
  76;
-- 
2.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: cpuidle - minimum time for sleep

2014-10-09 Thread Nishanth Menon
On 10/09/2014 02:01 PM, valdis.kletni...@vt.edu wrote:
 On Thu, 09 Oct 2014 21:28:23 +0300, Ran Shalit said:
 
 Does anybody know what is the minimum expected time for sleep period
 with the cpuidle ?
 
 Both processor dependent and sleep level dependent.  There's a certain
 amount of latency induced by the hardware waking up.
 
 Look at /sys/devices/system/cpu/cpu*/cpuidle/state*/latency
 
Yes, that is correct. the sleep and wakeup time are dependent on the
power state we attempt (may or maynot achieve)

I personally toggle an unused pin using padmux register write with
weak pull up/down in controlled tests (mostly using disable =1 for
states I am not measuring), then capture pinctrl toggles using [1]
into a csv for many thousands of iterations then use the conservative
values. I usually do this at the slowest frequency to capture the
worst case values that i feed into cpuidle_driver.states.exit_latency
and appropriate value for target_residency - I usually ignore
power_usage as the value is never a constant and depends on quiet a
few factors that i cannot discuss in public domain.

Here are some helpful links on OMAP specific strategies (these may be
a little old, but just search for CPUIDLE latency measure in google)

https://lwn.net/Articles/384146/

http://www.omappedia.org/wiki/Power_Management_Device_Latencies_Measurement

http://lists.linaro.org/pipermail/linaro-dev/2010-August/000568.html


[1] https://www.saleae.com/

-- 
Regards,
Nishanth Menon
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 08/12] rtc: omap: restore irq state after reading TC registers

2014-10-09 Thread Johan Hovold
Make sure to restore local irq state when reading the timer/calendar
(TC) registers, so that omap_rtc_read_time() can be called with
interrupts disabled.

Signed-off-by: Johan Hovold jo...@kernel.org
---
 drivers/rtc/rtc-omap.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
index 0ef016553a97..62e2e9a9887a 100644
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -239,8 +239,10 @@ static void bcd2tm(struct rtc_time *tm)
 
 static int omap_rtc_read_time(struct device *dev, struct rtc_time *tm)
 {
+   unsigned long flags;
+
/* we don't report wday/yday/isdst ... */
-   local_irq_disable();
+   local_irq_save(flags);
rtc_wait_not_busy();
 
tm-tm_sec = rtc_read(OMAP_RTC_SECONDS_REG);
@@ -250,7 +252,7 @@ static int omap_rtc_read_time(struct device *dev, struct 
rtc_time *tm)
tm-tm_mon = rtc_read(OMAP_RTC_MONTHS_REG);
tm-tm_year = rtc_read(OMAP_RTC_YEARS_REG);
 
-   local_irq_enable();
+   local_irq_restore(flags);
 
bcd2tm(tm);
return 0;
-- 
2.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 06/12] rtc: omap: use dev_info and dev_dbg

2014-10-09 Thread Johan Hovold
Use dev_info and dev_dbg rather than pr_info and pr_debug.

Signed-off-by: Johan Hovold jo...@kernel.org
---
 drivers/rtc/rtc-omap.c | 19 +--
 1 file changed, 9 insertions(+), 10 deletions(-)

diff --git a/drivers/rtc/rtc-omap.c b/drivers/rtc/rtc-omap.c
index e50ffd7063f5..1c58920b0c88 100644
--- a/drivers/rtc/rtc-omap.c
+++ b/drivers/rtc/rtc-omap.c
@@ -392,13 +392,13 @@ static int __init omap_rtc_probe(struct platform_device 
*pdev)
 
omap_rtc_timer = platform_get_irq(pdev, 0);
if (omap_rtc_timer = 0) {
-   pr_debug(%s: no update irq?\n, pdev-name);
+   dev_dbg(pdev-dev, no update irq\n);
return -ENOENT;
}
 
omap_rtc_alarm = platform_get_irq(pdev, 1);
if (omap_rtc_alarm = 0) {
-   pr_debug(%s: no alarm irq?\n, pdev-name);
+   dev_dbg(pdev-dev, no alarm irq\n);
return -ENOENT;
}
 
@@ -430,8 +430,7 @@ static int __init omap_rtc_probe(struct platform_device 
*pdev)
/* clear old status */
reg = rtc_read(OMAP_RTC_STATUS_REG);
if (reg  (u8) OMAP_RTC_STATUS_POWER_UP) {
-   pr_info(%s: RTC power up reset detected\n,
-   pdev-name);
+   dev_info(pdev-dev, RTC power up reset detected\n);
rtc_write(OMAP_RTC_STATUS_POWER_UP, OMAP_RTC_STATUS_REG);
}
if (reg  (u8) OMAP_RTC_STATUS_ALARM)
@@ -440,22 +439,22 @@ static int __init omap_rtc_probe(struct platform_device 
*pdev)
/* handle periodic and alarm irqs */
if (devm_request_irq(pdev-dev, omap_rtc_timer, rtc_irq, 0,
dev_name(pdev-dev), pdev)) {
-   pr_debug(%s: RTC timer interrupt IRQ%d already claimed\n,
-   pdev-name, omap_rtc_timer);
+   dev_dbg(pdev-dev, RTC timer interrupt IRQ%d already 
claimed\n,
+   omap_rtc_timer);
goto fail0;
}
if ((omap_rtc_timer != omap_rtc_alarm) 
(devm_request_irq(pdev-dev, omap_rtc_alarm, rtc_irq, 0,
dev_name(pdev-dev), pdev))) {
-   pr_debug(%s: RTC alarm interrupt IRQ%d already claimed\n,
-   pdev-name, omap_rtc_alarm);
+   dev_dbg(pdev-dev, RTC alarm interrupt IRQ%d already 
claimed\n,
+   omap_rtc_alarm);
goto fail0;
}
 
/* On boards with split power, RTC_ON_NOFF won't reset the RTC */
reg = rtc_read(OMAP_RTC_CTRL_REG);
if (reg  (u8) OMAP_RTC_CTRL_STOP)
-   pr_info(%s: already running\n, pdev-name);
+   dev_info(pdev-dev, already running\n);
 
/* force to 24 hour mode */
new_ctrl = reg  (OMAP_RTC_CTRL_SPLIT|OMAP_RTC_CTRL_AUTO_COMP);
@@ -476,7 +475,7 @@ static int __init omap_rtc_probe(struct platform_device 
*pdev)
 */
 
if (new_ctrl  (u8) OMAP_RTC_CTRL_SPLIT)
-   pr_info(%s: split power mode\n, pdev-name);
+   dev_info(pdev-dev, split power mode\n);
 
if (reg != new_ctrl)
rtc_write(new_ctrl, OMAP_RTC_CTRL_REG);
-- 
2.0.4

--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: RCU bug with v3.17-rc3 ?

2014-10-09 Thread Felipe Balbi
Hi,

On Thu, Oct 09, 2014 at 11:26:56AM -0500, Felipe Balbi wrote:
  I'm thinking it's not the slot pointer itself that's bad, because
  __radix_tree_lookup() dereferences that to test if it's populated
  before returning it, and slot life-time is guaranteed by RCU.
  
  That would only leave garbage in the slot itself, crashing during
  page_cache_get_speculative().
  
  I'll keep staring at this change, but nothing stands out to me yet.
 
 alright, it's pretty deterministic however. Always on the same test, no
 matter which USB controller, no matter if backing store is RAM or MMC.
 
 Those two undefined instructions on the disassembly caught my attention,
 perhaps I'm facing a GCC bug ?

no, probably not a GCC bug. Looking at your commit, however. Man, it
does quite many things at once. Moves code around, adds new functions by
refactoring (and changing) code, renames things, changes int offset into
unsigned ints. Should not be too difficult too to miss a bug in there.

I'll continue digging here.

-- 
balbi


signature.asc
Description: Digital signature


Re: RCU bug with v3.17-rc3 ?

2014-10-09 Thread Rabin Vincent
On Thu, Oct 09, 2014 at 11:26:56AM -0500, Felipe Balbi wrote:
 alright, it's pretty deterministic however. Always on the same test, no
 matter which USB controller, no matter if backing store is RAM or MMC.
 
 Those two undefined instructions on the disassembly caught my attention,
 perhaps I'm facing a GCC bug ?

The undefined instructions are just ARM's BUG() implementation.

But did you see the question I asked you yesterday in your other thread?
http://www.spinics.net/lists/arm-kernel/msg368634.html

Here it is again:

  What GCC version are you using?
  
  4.8.1 and 4.8.2 are known to miscompile the ARM kernel and these
  find_get_entry() crashes with 0x involved smell a lot like the
  earlier reports from kernels build with those compilers:
  
  https://lkml.org/lkml/2014/6/25/456
  https://lkml.org/lkml/2014/6/30/375
  https://lkml.org/lkml/2014/6/30/660
  https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58854
  https://lkml.org/lkml/2014/5/9/330

Also, I didn't see any public email making a definitive link between GCC
PR 58854 that Nathan pointed out in https://lkml.org/lkml/2014/6/30/660
and the earlier find_get_entry() crashes, but I just built GCC 4.8.1 and
an ARM kernel with that, and the GCC bug is clearly seen in
radix_tree_lookup_slot() which returns the pointer which
find_get_entry() is dereferencing:

  radix_tree_lookup_slot:
   e1a0c00d  mov ip, sp
   e92dd800  push{fp, ip, lr, pc}
   e24cb004  sub fp, ip, #4
   e24dd008  sub sp, sp, #8
   e3a02000  mov r2, #0
   e24b3010  sub r3, fp, #16
   ebc5  bl  c0176ab8 __radix_tree_lookup
   e24bd00c  sub sp, fp, #12--- sp moved up
   e350  cmp r0, #0
   151b0010  ldrne   r0, [fp, #-16] --- load from under sp 
   e89da800  ldm sp, {fp, sp, pc}

Please check your compiler to make sure it's not the same problem.
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: RCU bug with v3.17-rc3 ?

2014-10-09 Thread Felipe Balbi
Hi,

On Thu, Oct 09, 2014 at 10:41:01PM +0200, Rabin Vincent wrote:
 On Thu, Oct 09, 2014 at 11:26:56AM -0500, Felipe Balbi wrote:
  alright, it's pretty deterministic however. Always on the same test, no
  matter which USB controller, no matter if backing store is RAM or MMC.
  
  Those two undefined instructions on the disassembly caught my attention,
  perhaps I'm facing a GCC bug ?
 
 The undefined instructions are just ARM's BUG() implementation.
 
 But did you see the question I asked you yesterday in your other thread?
 http://www.spinics.net/lists/arm-kernel/msg368634.html

hmm, completely missed that, sorry. I'm using 4.8.2, will try something
else.

-- 
balbi


signature.asc
Description: Digital signature


Re: [PATCH] ARM: dts: Disable smc91x on n900 until bootloader dependency is removed

2014-10-09 Thread Kevin Hilman
Tony Lindgren t...@atomide.com writes:

 I added smc91x support but turns out we currently do not set the
 smc91x timings in gpmc.c but rely on the bootloader timings. This
 produces the following error unless the smc91x GPMC timings are
 initialized by the bootloader:

 Unhandled fault: external abort on non-linefetch (0x1008) at 0xd080630e
 ...
 [c04067fc] (smc_drv_probe) from [c038e9c4] (platform_drv_probe+0x2c/0x5c)
 [c038e9c4] (platform_drv_probe) from [c038d450] 
 (driver_probe_device+0x104/0x22c)
 [c038d450] (driver_probe_device) from [c038d60c] 
 (__driver_attach+0x94/0x98)
 [c038d60c] (__driver_attach) from [c038bc3c] (bus_for_each_dev+0x54/0x88)
 [c038bc3c] (bus_for_each_dev) from [c038cc3c] (bus_add_driver+0xd8/0x1d8)
 [c038cc3c] (bus_add_driver) from [c038dd74] (driver_register+0x78/0xf4)
 [c038dd74] (driver_register) from [c0008924] (do_one_initcall+0x80/0x1c0)
 [c0008924] (do_one_initcall) from [c0852d9c] 
 (kernel_init_freeable+0x1b8/0x28c)
 [c0852d9c] (kernel_init_freeable) from [c05ce86c] (kernel_init+0x8/0xec)
 [c05ce86c] (kernel_init) from [c000e728] (ret_from_fork+0x14/0x2c)

 Let's fix the issue by disabling the smc91x module for now until we
 have sorted out the issues in gpmc.c.

 Reported-by: Kevin Hilman khil...@linaro.org
 Signed-off-by: Tony Lindgren t...@atomide.com

Tested-by: Kevin Hilman khil...@linaro.org
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: RCU bug with v3.17-rc3 ?

2014-10-09 Thread Felipe Balbi
Hi,

On Thu, Oct 09, 2014 at 03:46:37PM -0500, Felipe Balbi wrote:
 On Thu, Oct 09, 2014 at 10:41:01PM +0200, Rabin Vincent wrote:
  On Thu, Oct 09, 2014 at 11:26:56AM -0500, Felipe Balbi wrote:
   alright, it's pretty deterministic however. Always on the same test, no
   matter which USB controller, no matter if backing store is RAM or MMC.
   
   Those two undefined instructions on the disassembly caught my attention,
   perhaps I'm facing a GCC bug ?
  
  The undefined instructions are just ARM's BUG() implementation.
  
  But did you see the question I asked you yesterday in your other thread?
  http://www.spinics.net/lists/arm-kernel/msg368634.html
 
 hmm, completely missed that, sorry. I'm using 4.8.2, will try something
 else.

seems to be working fine now, thanks. I'll leave test running overnight
just in case.

thanks again, and sorry for the noise.

PS: I wonder if we should a warning message to the build system if we're
building with known broken versions of GCC.

-- 
balbi


signature.asc
Description: Digital signature


Re: RCU bug with v3.17-rc3 ?

2014-10-09 Thread Aaro Koskinen
Hi,

On Thu, Oct 09, 2014 at 10:41:01PM +0200, Rabin Vincent wrote:
   What GCC version are you using?
   
   4.8.1 and 4.8.2 are known to miscompile the ARM kernel and these
   find_get_entry() crashes with 0x involved smell a lot like the
   earlier reports from kernels build with those compilers:
   
   https://lkml.org/lkml/2014/6/25/456
   https://lkml.org/lkml/2014/6/30/375
   https://lkml.org/lkml/2014/6/30/660
   https://gcc.gnu.org/bugzilla/show_bug.cgi?id=58854
   https://lkml.org/lkml/2014/5/9/330

Is it possible to blacklist those GCC versions on ARM somehow as it
seems people are still using them?

This bug also ruined a file system on one of my boxes last year
(see e.g. http://marc.info/?l=linux-arm-kernelm=139033442527244w=2).

A.
--
To unsubscribe from this list: send the line unsubscribe linux-omap in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v3 7/8] clk: Make clk API return per-user struct clk instances

2014-10-09 Thread Stephen Boyd
On 10/09, Tomeu Vizoso wrote:
  arch/arm/mach-omap2/cclock3xxx_data.c   | 108 --
  arch/arm/mach-omap2/clock.h |  11 +-
  arch/arm/mach-omap2/clock_common_data.c |   5 +-
  drivers/clk/clk.c   | 630 
 
  drivers/clk/clk.h   |   5 +
  drivers/clk/clkdev.c|  24 +-
  include/linux/clk-private.h |  35 +-
  include/linux/clk-provider.h|  22 +-
  8 files changed, 549 insertions(+), 291 deletions(-)

The difstat looks good.

 
 diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
 index fb820bf..4db918a 100644
 --- a/drivers/clk/clk.c
 +++ b/drivers/clk/clk.c
 @@ -695,6 +731,13 @@ struct clk *__clk_lookup(const char *name)
   return NULL;
  }
  
 +struct clk *__clk_lookup(const char *name)
 +{
 + struct clk_core *clk = clk_core_lookup(name);
 +
 + return !clk ? NULL : clk-hw-clk;

This just looks weird with clk-hw-clk. I know we're trying to
keep the diff small by not renaming clk to core when it's used
extensively throughout the code, but for small little additions
like this I would prefer we use core for clk_core pointers and
clk for clk pointers. Then a patch at the end can rename
everything to be consistent. This thing also threw me off because
I searched for kfree(core) but couldn't find it so I thought we
leaked the clk_core structure.

 +}
 +
  /*
   * Helper for finding best parent to provide a given frequency. This can be 
 used
   * directly as a determine_rate callback (e.g. for a mux), or from a more
 @@ -2175,24 +2298,24 @@ void clk_unregister(struct clk *clk)
* a reference to this clock.
*/
   flags = clk_enable_lock();
 - clk-ops = clk_nodrv_ops;
 + clk-core-ops = clk_nodrv_ops;
   clk_enable_unlock(flags);
  
 - if (!hlist_empty(clk-children)) {
 - struct clk *child;
 + if (!hlist_empty(clk-core-children)) {
 + struct clk_core *child;
   struct hlist_node *t;
  
   /* Reparent all children to the orphan list. */
 - hlist_for_each_entry_safe(child, t, clk-children, child_node)
 - clk_set_parent(child, NULL);
 + hlist_for_each_entry_safe(child, t, clk-core-children, 
 child_node)
 + clk_core_set_parent(child, NULL);
   }
  
 - hlist_del_init(clk-child_node);
 + hlist_del_init(clk-core-child_node);
  
 - if (clk-prepare_count)
 + if (clk-core-prepare_count)
   pr_warn(%s: unregistering prepared clock: %s\n,
 - __func__, clk-name);
 - kref_put(clk-ref, __clk_release);
 + __func__, clk-core-name);
 + kref_put(clk-core-ref, __clk_release);
  
   clk_prepare_unlock();

It might be worth it to make a core local variable in this
function.

  }
 @@ -2255,32 +2378,38 @@ void devm_clk_unregister(struct device *dev, struct 
 clk *clk)
  }
  EXPORT_SYMBOL_GPL(devm_clk_unregister);
  
 +static void clk_core_put(struct clk_core *clk)
 +{
 + struct module *owner;
 +
 + if (!clk || WARN_ON_ONCE(IS_ERR(clk)))
 + return;
 +
 + clk_prepare_lock();
 + owner = clk-owner;

Same here too, we don't need to protect the access to owner so it
can move outside the lock.

 + kref_put(clk-ref, __clk_release);
 + module_put(owner);
 + clk_prepare_unlock();
 +}
 +
  /*
   * clkdev helpers
   */
  int __clk_get(struct clk *clk)
  {
   if (clk) {
 - if (!try_module_get(clk-owner))
 + if (!try_module_get(clk-core-owner))
   return 0;
  
 - kref_get(clk-ref);
 + kref_get(clk-core-ref);
   }
   return 1;

Grow a core pointer?

  }
 @@ -2391,6 +2520,31 @@ int clk_notifier_unregister(struct clk *clk, struct 
 notifier_block *nb)
  }
  EXPORT_SYMBOL_GPL(clk_notifier_unregister);
  
 +struct clk *__clk_create_clk(struct clk_hw *hw, const char *dev_id,

Curious, why the underscore?

 +  const char *con_id)
 +{
 + struct clk *clk;
 +
 + /* This is to allow this function to be chained to others */
 + if (!hw || IS_ERR(hw))
 + return (struct clk *) hw;
 +
 + clk = kzalloc(sizeof(*clk), GFP_KERNEL);
 + if (!clk)
 + return ERR_PTR(-ENOMEM);
 +
 + clk-core = hw-core;
 + clk-dev_id = dev_id;
 + clk-con_id = con_id;
 +
 + return clk;
 +}
 diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c
 index da4bda8..4411db6 100644
 --- a/drivers/clk/clkdev.c
 +++ b/drivers/clk/clkdev.c
 @@ -69,6 +70,10 @@ struct clk *of_clk_get(struct device_node *np, int index)
  
   clk = of_clk_get_by_clkspec(clkspec);
   of_node_put(clkspec.np);
 +
 + if (!IS_ERR(clk))
 + clk = __clk_create_clk(__clk_get_hw(clk), np-full_name, NULL);

We lost the debugging information here about the device
requesting this clock and the name they called it. 

Re: [PATCH v3 7/8] clk: Make clk API return per-user struct clk instances

2014-10-09 Thread Kodiak Furr
Kodiak Furr liked your message with Boxer for Android.

On Oct 9, 2014 6:22 PM, Stephen Boyd sb...@codeaurora.org wrote:

 On 10/09, Tomeu Vizoso wrote: 
   arch/arm/mach-omap2/cclock3xxx_data.c   | 108 -- 
   arch/arm/mach-omap2/clock.h |  11 +- 
   arch/arm/mach-omap2/clock_common_data.c |   5 +- 
   drivers/clk/clk.c   | 630 
  
   drivers/clk/clk.h   |   5 + 
   drivers/clk/clkdev.c    |  24 +- 
   include/linux/clk-private.h |  35 +- 
   include/linux/clk-provider.h    |  22 +- 
   8 files changed, 549 insertions(+), 291 deletions(-) 

 The difstat looks good. 

  
  diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c 
  index fb820bf..4db918a 100644 
  --- a/drivers/clk/clk.c 
  +++ b/drivers/clk/clk.c 
  @@ -695,6 +731,13 @@ struct clk *__clk_lookup(const char *name) 
   return NULL; 
   } 
   
  +struct clk *__clk_lookup(const char *name) 
  +{ 
  + struct clk_core *clk = clk_core_lookup(name); 
  + 
  + return !clk ? NULL : clk-hw-clk; 

 This just looks weird with clk-hw-clk. I know we're trying to 
 keep the diff small by not renaming clk to core when it's used 
 extensively throughout the code, but for small little additions 
 like this I would prefer we use core for clk_core pointers and 
 clk for clk pointers. Then a patch at the end can rename 
 everything to be consistent. This thing also threw me off because 
 I searched for kfree(core) but couldn't find it so I thought we 
 leaked the clk_core structure. 

  +} 
  + 
   /* 
    * Helper for finding best parent to provide a given frequency. This can 
 be used 
    * directly as a determine_rate callback (e.g. for a mux), or from a more 
  @@ -2175,24 +2298,24 @@ void clk_unregister(struct clk *clk) 
   * a reference to this clock. 
   */ 
   flags = clk_enable_lock(); 
  - clk-ops = clk_nodrv_ops; 
  + clk-core-ops = clk_nodrv_ops; 
   clk_enable_unlock(flags); 
   
  - if (!hlist_empty(clk-children)) { 
  - struct clk *child; 
  + if (!hlist_empty(clk-core-children)) { 
  + struct clk_core *child; 
   struct hlist_node *t; 
   
   /* Reparent all children to the orphan list. */ 
  - hlist_for_each_entry_safe(child, t, clk-children, child_node) 
  - clk_set_parent(child, NULL); 
  + hlist_for_each_entry_safe(child, t, clk-core-children, child_node) 
  + clk_core_set_parent(child, NULL); 
   } 
   
  - hlist_del_init(clk-child_node); 
  + hlist_del_init(clk-core-child_node); 
   
  - if (clk-prepare_count) 
  + if (clk-core-prepare_count) 
   pr_warn(%s: unregistering prepared clock: %s\n, 
  - __func__, clk-name); 
  - kref_put(clk-ref, __clk_release); 
  + __func__, clk-core-name); 
  + kref_put(clk-core-ref, __clk_release); 
   
   clk_prepare_unlock(); 

 It might be worth it to make a core local variable in this 
 function. 

   } 
  @@ -2255,32 +2378,38 @@ void devm_clk_unregister(struct device *dev, struct 
  clk *clk) 
   } 
   EXPORT_SYMBOL_GPL(devm_clk_unregister); 
   
  +static void clk_core_put(struct clk_core *clk) 
  +{ 
  + struct module *owner; 
  + 
  + if (!clk || WARN_ON_ONCE(IS_ERR(clk))) 
  + return; 
  + 
  + clk_prepare_lock(); 
  + owner = clk-owner; 

 Same here too, we don't need to protect the access to owner so it 
 can move outside the lock. 

  + kref_put(clk-ref, __clk_release); 
  + module_put(owner); 
  + clk_prepare_unlock(); 
  +} 
  + 
   /* 
    * clkdev helpers 
    */ 
   int __clk_get(struct clk *clk) 
   { 
   if (clk) { 
  - if (!try_module_get(clk-owner)) 
  + if (!try_module_get(clk-core-owner)) 
   return 0; 
   
  - kref_get(clk-ref); 
  + kref_get(clk-core-ref); 
   } 
   return 1; 

 Grow a core pointer? 

   } 
  @@ -2391,6 +2520,31 @@ int clk_notifier_unregister(struct clk *clk, struct 
  notifier_block *nb) 
   } 
   EXPORT_SYMBOL_GPL(clk_notifier_unregister); 
   
  +struct clk *__clk_create_clk(struct clk_hw *hw, const char *dev_id, 

 Curious, why the underscore? 

  +  const char *con_id) 
  +{ 
  + struct clk *clk; 
  + 
  + /* This is to allow this function to be chained to others */ 
  + if (!hw || IS_ERR(hw)) 
  + return (struct clk *) hw; 
  + 
  + clk = kzalloc(sizeof(*clk), GFP_KERNEL); 
  + if (!clk) 
  + return ERR_PTR(-ENOMEM); 
  + 
  + clk-core = hw-core; 
  + clk-dev_id = dev_id; 
  + clk-con_id = con_id; 
  + 
  + return clk; 
  +} 
  diff --git a/drivers/clk/clkdev.c b/drivers/clk/clkdev.c 
  index da4bda8..4411db6 100644 
  --- a/drivers/clk/clkdev.c 
  +++ b/drivers/clk/clkdev.c 
  @@ -69,6 +70,10 @@ struct clk *of_clk_get(struct device_node *np, int 
  index) 
   
   clk = of_clk_get_by_clkspec(clkspec); 
   of_node_put(clkspec.np); 
  + 
  + if (!IS_ERR(clk)) 
  + clk = __clk_create_clk(__clk_get_hw(clk), np-full_name, NULL); 

 We lost the debugging information here about the device 
 requesting this clock and the name they called it. We get the 
 device node name but that might not match the device name. We 
 probably need to make private