Skip to contentSkip to conversation

ARM: shmobile: compile drivers/sh for CONFIG_ARCH_SHMOBILE_MULTI

PATCH In review Ben Dooks 5 participants 22 messages Jan 10, 2014 – Mar 12, 2014 SuperH

lore
Share & tools
lore

Ben Dooks

author
#0 lore raw

PATCH 1/1 ARM: shmobile: compile drivers/sh for CONFIG_ARCH_SHMOBILE_MULTI

If the kernel is built to support multi-arm configurmation with shmobile support built in, then the drivers/sh is not built. This contains drivers that are essential to devices support by that configuration, including the PM runtime code in drivers/sh/pm_runtime.c (which implicitly enables the bus clocks for all devices).

If CONFIG_ARCH_SHMOBILE_MULTI then build the drivers/sh directory, but ensure that bits that may conflict (drivers/sh/clk if the common clock framework is not enabled) are built.

The ARCH_SHMOBILE_MULTI was added by efacfce5f8a ("ARM: shmobile: Introduce ARCH_SHMOBILE_MULTI") but this has only just recently been found due to building device-tree only kernels.

Cc Linux Kernel list <[email protected]>
Cc Linus SH list <[email protected]>
Cc Simon Horman <[email protected]>
Cc Magnus Damm <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/Makefile    | 1 +
 drivers/sh/Makefile | 3 +++
 2 files changed, 4 insertions(+)
drivers/Makefile +1 -0
index 8e3b8b0..abc4744 100644
@@ -118,6 +118,7 @@ obj-$(CONFIG_SGI_SN)		+= sn/
 obj-y				+= firmware/
 obj-$(CONFIG_CRYPTO)		+= crypto/
 obj-$(CONFIG_SUPERH)		+= sh/
+obj-$(CONFIG_ARCH_SHMOBILE_MULTI)	+= sh/
 obj-$(CONFIG_ARCH_SHMOBILE_LEGACY)	+= sh/
 ifndef CONFIG_ARCH_USES_GETTIMEOFFSET
 obj-y				+= clocksource/
drivers/sh/Makefile +3 -0
index fc67f56..86604a5 100644
@@ -3,7 +3,10 @@
 #
 obj-y	:= intc/
 
+ifeq ($(CONFIG_COMMON_CLK),n)
 obj-$(CONFIG_HAVE_CLK)		+= clk/
+endif
+
 obj-$(CONFIG_MAPLE)		+= maple/
 obj-$(CONFIG_SUPERHYWAY)	+= superhyway/
 
Signature · 1 line
1.8.5.2
#1 lore raw
Quoted 30 lines · Ben Dooks

If the kernel is built to support multi-arm configurmation with shmobile support built in, then the drivers/sh is not built. This contains drivers that are essential to devices support by that configuration, including the PM runtime code in drivers/sh/pm_runtime.c (which implicitly enables the bus clocks for all devices).

If CONFIG_ARCH_SHMOBILE_MULTI then build the drivers/sh directory, but ensure that bits that may conflict (drivers/sh/clk if the common clock framework is not enabled) are built.

The ARCH_SHMOBILE_MULTI was added by efacfce5f8a ("ARM: shmobile: Introduce ARCH_SHMOBILE_MULTI") but this has only just recently been found due to building device-tree only kernels.

Cc Linux Kernel list <[email protected]>
Cc Linus SH list <[email protected]>
Cc Simon Horman <[email protected]>
Cc Magnus Damm <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
 drivers/Makefile    | 1 +
 drivers/sh/Makefile | 3 +++
 2 files changed, 4 insertions(+)
drivers/Makefile +0 -0
index 8e3b8b0..abc4744 100644

drivers/Makefile obj-$(CONFIG_SGI_SN) += sn/ · line 122

Quoted 5 lines
drivers/Makefile +1 -0
@@ -118,6 +118,7 @@ obj-$(CONFIG_SGI_SN)		+= sn/
 obj-y				+= firmware/
 obj-$(CONFIG_CRYPTO)		+= crypto/
 obj-$(CONFIG_SUPERH)		+= sh/
+obj-$(CONFIG_ARCH_SHMOBILE_MULTI)	+= sh/
 obj-$(CONFIG_ARCH_SHMOBILE_LEGACY)	+= sh/

Can't we just do the following?

  obj-$(CONFIG_ARCH_SHMOBILE)	+= sh/
Quoted 20 lines
drivers/Makefile +0 -0
 ifndef CONFIG_ARCH_USES_GETTIMEOFFSET
 obj-y				+= clocksource/
drivers/sh/Makefile +3 -0
index fc67f56..86604a5 100644
@@ -3,7 +3,10 @@
 #
 obj-y	:= intc/
 
+ifeq ($(CONFIG_COMMON_CLK),n)
 obj-$(CONFIG_HAVE_CLK)		+= clk/
+endif
+
 obj-$(CONFIG_MAPLE)		+= maple/
 obj-$(CONFIG_SUPERHYWAY)	+= superhyway/
 
Signature · 1 line
1.8.5.2
author
#2 lore raw
Quoted 26 lines · Simon Horman
Quoted 25 lines · Ben Dooks

If the kernel is built to support multi-arm configurmation with shmobile support built in, then the drivers/sh is not built. This contains drivers that are essential to devices support by that configuration, including the PM runtime code in drivers/sh/pm_runtime.c (which implicitly enables the bus clocks for all devices).

If CONFIG_ARCH_SHMOBILE_MULTI then build the drivers/sh directory, but ensure that bits that may conflict (drivers/sh/clk if the common clock framework is not enabled) are built.

The ARCH_SHMOBILE_MULTI was added by efacfce5f8a ("ARM: shmobile: Introduce ARCH_SHMOBILE_MULTI") but this has only just recently been found due to building device-tree only kernels.

Cc Linux Kernel list <[email protected]>
Cc Linus SH list <[email protected]>
Cc Simon Horman <[email protected]>
Cc Magnus Damm <[email protected]>
Cc Greg Kroah-Hartman <[email protected]>
---
  drivers/Makefile    | 1 +
  drivers/sh/Makefile | 3 +++
  2 files changed, 4 insertions(+)
Quoted 12 lines

drivers/Makefile obj-$(CONFIG_SGI_SN) += sn/ · line 122

Quoted 10 lines
drivers/Makefile +1 -0
index 8e3b8b0..abc4744 100644
@@ -118,6 +118,7 @@ obj-$(CONFIG_SGI_SN)		+= sn/
  obj-y				+= firmware/
  obj-$(CONFIG_CRYPTO)		+= crypto/
  obj-$(CONFIG_SUPERH)		+= sh/
+obj-$(CONFIG_ARCH_SHMOBILE_MULTI)	+= sh/
  obj-$(CONFIG_ARCH_SHMOBILE_LEGACY)	+= sh/

Can't we just do the following?

I think this is probably a better fix. I am wondering what the original logic of not doing this was.

Signature · 2 lines
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius
#3 lore raw
In reply to Ben Dooks

drivers/sh/Makefile line 9

Quoted 10 lines · Ben Dooks
drivers/sh/Makefile +3 -0
@@ -3,7 +3,10 @@
 #
 obj-y  := intc/
 
+ifeq ($(CONFIG_COMMON_CLK),n)
 obj-$(CONFIG_HAVE_CLK)         += clk/
+endif
+

This part breaks my Koelsch legacy (non-reference) build:

arch/arm/kernel/built-in.o: In function `twd_local_timer_common_register':
io.c:(.init.text+0x1804): undefined reference to clk_enable' io.c:(.init.text+0x1828): undefined reference to clk_get_rate' drivers/built-in.o: In function `sci_port_disable':
clkdev.c:(.text+0x2ae30): undefined reference to clk_disable' clkdev.c:(.text+0x2ae38): undefined reference to clk_disable' drivers/built-in.o: In function `sci_port_enable':
clkdev.c:(.text+0x2ae74): undefined reference to clk_enable' clkdev.c:(.text+0x2ae7c): undefined reference to clk_get_rate' clkdev.c:(.text+0x2ae88): undefined reference to clk_enable' drivers/built-in.o: In function sci_notifier':
clkdev.c:(.text+0x2c85c): undefined reference to clk_get_rate' drivers/built-in.o: In function __pm_clk_remove':
clkdev.c:(.text+0x40844): undefined reference to clk_disable' drivers/built-in.o: In function pm_clk_suspend':
clkdev.c:(.text+0x40c6c): undefined reference to clk_disable' drivers/built-in.o: In function pm_clk_resume':
clkdev.c:(.text+0x40ce0): undefined reference to clk_enable' drivers/built-in.o: In function qspi_set_config_register':
clkdev.c:(.text+0x515a4): undefined reference to clk_get_rate' drivers/built-in.o: In function rspi_set_config_register':
clkdev.c:(.text+0x516dc): undefined reference to clk_get_rate' drivers/built-in.o: In function rspi_remove':
clkdev.c:(.text+0x518ac): undefined reference to clk_disable' drivers/built-in.o: In function rspi_probe':
clkdev.c:(.text+0x51a20): undefined reference to clk_enable' clkdev.c:(.text+0x51d60): undefined reference to clk_disable' drivers/built-in.o: In function `hspi_transfer_one_message':
clkdev.c:(.text+0x5312c): undefined reference to clk_get_rate' drivers/built-in.o: In function sh_msiof_spi_txrx':
clkdev.c:(.text+0x53d90): undefined reference to clk_get_rate' drivers/built-in.o: In function sh_msiof_spi_chipselect':
clkdev.c:(.text+0x54200): undefined reference to clk_enable' clkdev.c:(.text+0x542b8): undefined reference to clk_disable' drivers/built-in.o: In function `sh_cmt_start':
clkdev.c:(.text+0x6f900): undefined reference to clk_enable' clkdev.c:(.text+0x6f93c): undefined reference to clk_get_rate' clkdev.c:(.text+0x6f95c): undefined reference to clk_get_rate' clkdev.c:(.text+0x6fa08): undefined reference to clk_disable' drivers/built-in.o: In function `sh_cmt_stop':
clkdev.c:(.text+0x6fc14): undefined reference to clk_disable' drivers/built-in.o: In function __sh_tmu_disable':
clkdev.c:(.text+0x70590): undefined reference to clk_disable' drivers/built-in.o: In function __sh_tmu_enable':
clkdev.c:(.text+0x70980): undefined reference to clk_enable' clkdev.c:(.text+0x709f0): undefined reference to clk_get_rate' drivers/built-in.o: In function `em_sti_start':
clkdev.c:(.text+0x70f44): undefined reference to clk_enable' clkdev.c:(.text+0x70f68): undefined reference to clk_get_rate' drivers/built-in.o: In function `em_sti_stop':
clkdev.c:(.text+0x710d0): undefined reference to clk_disable' arch/arm/mach-shmobile/built-in.o: In function shmobile_clk_init':
platsmp-apmu.c:(.init.text+0x7ac): undefined reference to `recalculate_root_clocks'
platsmp-apmu.c:(.init.text+0x7b0): undefined reference to `clk_enable_init_clocks'
arch/arm/mach-shmobile/built-in.o: In function `r8a7791_clock_init':
platsmp-apmu.c:(.init.text+0x8fc): undefined reference to clk_register' platsmp-apmu.c:(.init.text+0x920): undefined reference to sh_clk_mstp_register' arch/arm/mach-shmobile/built-in.o:(.data+0x16f0): undefined reference to `followparent_recalc'

Both of my Koelsch legacy and reference configs have CONFIG_HAVE_CLK=y, but only the reference once has CONFIG_COMMON_CLK=y.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

author
#4 lore raw
Quoted 17 lines · Geert Uytterhoeven

drivers/sh/Makefile line 9

Quoted 10 lines · Ben Dooks
drivers/sh/Makefile +3 -0
@@ -3,7 +3,10 @@
  #
  obj-y  := intc/
 
+ifeq ($(CONFIG_COMMON_CLK),n)
  obj-$(CONFIG_HAVE_CLK)         += clk/
+endif
+

This part breaks my Koelsch legacy (non-reference) build:

arch/arm/kernel/built-in.o: In function `twd_local_timer_common_register':
io.c:(.init.text+0x1804): undefined reference to clk_enable' io.c:(.init.text+0x1828): undefined reference to clk_get_rate'

...

Quoted 3 lines

Both of my Koelsch legacy and reference configs have CONFIG_HAVE_CLK=y, but only the reference once has CONFIG_COMMON_CLK=y.

Hmm, thought undefined symbols got set to 'n'.

I can either fix this by

ifneq ($(CONFIG_COMMON_CLK),y)
endif

or adding an extra Kconfig for SH specific legacy clock code.

Signature · 2 lines
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius
#5 lore raw

Hi Ben,

Quoted 22 lines · Ben Dooks
Quoted 17 lines · Geert Uytterhoeven

drivers/sh/Makefile line 9

Quoted 11 lines · Ben Dooks
drivers/sh/Makefile +3 -0
@@ -3,7 +3,10 @@
  #
  obj-y  := intc/
 
+ifeq ($(CONFIG_COMMON_CLK),n)
  obj-$(CONFIG_HAVE_CLK)         += clk/
+endif
+

This part breaks my Koelsch legacy (non-reference) build:

Quoted 3 lines

arch/arm/kernel/built-in.o: In function `twd_local_timer_common_register':
io.c:(.init.text+0x1804): undefined reference to clk_enable' io.c:(.init.text+0x1828): undefined reference to clk_get_rate'

Quoted 7 lines

...

Quoted 3 lines

Both of my Koelsch legacy and reference configs have CONFIG_HAVE_CLK=y, but only the reference once has CONFIG_COMMON_CLK=y.

Hmm, thought undefined symbols got set to 'n'.

No, they're empty.
Doh, should have realized that myself...

Quoted 4 lines

I can either fix this by

ifneq ($(CONFIG_COMMON_CLK),y)
endif

That's the typical pattern for this.

Sometimes people use

    obj-$(CONFIG_COMMON_CLK)$(CONFIG_HAVE_CLK) += clk/

but that's less readable.

Quoted 1 line

or adding an extra Kconfig for SH specific legacy clock code.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

author
#6 lore raw

PATCH 1/1 ARM: shmobile: compile drivers/sh for CONFIG_ARCH_SHMOBILE_MULTI

In reply to Ben Dooks

If the kernel is built to support multi-arm configurmation with shmobile support built in, then the drivers/sh is not built. This contains drivers that are essential to devices support by that configuration, including the PM runtime code in drivers/sh/pm_runtime.c (which implicitly enables the bus clocks for all devices).

If CONFIG_ARCH_SHMOBILE_MULTI then build the drivers/sh directory, but ensure that bits that may conflict (drivers/sh/clk if the common clock framework is not enabled) are built.

The ARCH_SHMOBILE_MULTI was added by efacfce5f8a ("ARM: shmobile: Introduce ARCH_SHMOBILE_MULTI") but this has only just recently been found due to changes currently only in Simon Horman's tree. This patch is a partial revert of bf98c1eac1d4a6b ("ARM: Rename ARCH_SHMOBILE to ARCH_SHMOBILE_LEGACY") to address the issue of drivers not being built.

It is also possible the drivers/sh/intc will also need to be built however the lack of intc is not causing a number of drivers to fail to properly manage their clocks. This is left as an future patch for someone who understands that part of the code.

Cc Linus SH list <[email protected]>
Cc Simon Horman <[email protected]>
Cc Magnus Damm <[email protected]>
---
 drivers/Makefile    | 2 +-
 drivers/sh/Makefile | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/Makefile +1 -1
index 8e3b8b0..3cc8214 100644
@@ -118,7 +118,7 @@ obj-$(CONFIG_SGI_SN)		+= sn/
 obj-y				+= firmware/
 obj-$(CONFIG_CRYPTO)		+= crypto/
 obj-$(CONFIG_SUPERH)		+= sh/
-obj-$(CONFIG_ARCH_SHMOBILE_LEGACY)	+= sh/
+obj-$(CONFIG_ARCH_SHMOBILE)	+= sh/
 ifndef CONFIG_ARCH_USES_GETTIMEOFFSET
 obj-y				+= clocksource/
 endif
drivers/sh/Makefile +3 -0
index fc67f56..b4d588c 100644
@@ -3,7 +3,10 @@
 #
 obj-y	:= intc/
 
+ifneq ($(CONFIG_COMMON_CLK),y)
 obj-$(CONFIG_HAVE_CLK)		+= clk/
+endif
+
 obj-$(CONFIG_MAPLE)		+= maple/
 obj-$(CONFIG_SUPERHYWAY)	+= superhyway/
 
Signature · 1 line
1.8.5.2
#7 lore raw
In reply to Ben Dooks
Quoted 16 lines · Ben Dooks

If the kernel is built to support multi-arm configurmation with shmobile support built in, then the drivers/sh is not built. This contains drivers that are essential to devices support by that configuration, including the PM runtime code in drivers/sh/pm_runtime.c (which implicitly enables the bus clocks for all devices).

If CONFIG_ARCH_SHMOBILE_MULTI then build the drivers/sh directory, but ensure that bits that may conflict (drivers/sh/clk if the common clock framework is not enabled) are built.

The ARCH_SHMOBILE_MULTI was added by efacfce5f8a ("ARM: shmobile: Introduce ARCH_SHMOBILE_MULTI") but this has only just recently been found due to changes currently only in Simon Horman's tree. This patch is a partial revert of bf98c1eac1d4a6b ("ARM: Rename ARCH_SHMOBILE to ARCH_SHMOBILE_LEGACY") to address the issue of drivers not being built.

Quoted 4 lines

It is also possible the drivers/sh/intc will also need to be built however the lack of intc is not causing a number of drivers to fail to properly manage their clocks. This is left as an future patch for that is perfectly fine. someone who understands that part of the code.

Laurent, what are you feelings on this?

Quoted 41 lines
Cc Linus SH list <[email protected]>
Cc Simon Horman <[email protected]>
Cc Magnus Damm <[email protected]>
---
 drivers/Makefile    | 2 +-
 drivers/sh/Makefile | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/Makefile +1 -1
index 8e3b8b0..3cc8214 100644
@@ -118,7 +118,7 @@ obj-$(CONFIG_SGI_SN)		+= sn/
 obj-y				+= firmware/
 obj-$(CONFIG_CRYPTO)		+= crypto/
 obj-$(CONFIG_SUPERH)		+= sh/
-obj-$(CONFIG_ARCH_SHMOBILE_LEGACY)	+= sh/
+obj-$(CONFIG_ARCH_SHMOBILE)	+= sh/
 ifndef CONFIG_ARCH_USES_GETTIMEOFFSET
 obj-y				+= clocksource/
 endif
drivers/sh/Makefile +3 -0
index fc67f56..b4d588c 100644
@@ -3,7 +3,10 @@
 #
 obj-y	:= intc/
 
+ifneq ($(CONFIG_COMMON_CLK),y)
 obj-$(CONFIG_HAVE_CLK)		+= clk/
+endif
+
 obj-$(CONFIG_MAPLE)		+= maple/
 obj-$(CONFIG_SUPERHYWAY)	+= superhyway/
 
Signature · 1 line
1.8.5.2
#8 lore raw
In reply to Ben Dooks

Hi Simon,

Quoted 17 lines · On Wednesday 15 January 2014 08:55:05 Simon Horman wrote:
Quoted 16 lines · Ben Dooks

If the kernel is built to support multi-arm configurmation with shmobile support built in, then the drivers/sh is not built. This contains drivers that are essential to devices support by that configuration, including the PM runtime code in drivers/sh/pm_runtime.c (which implicitly enables the bus clocks for all devices).

If CONFIG_ARCH_SHMOBILE_MULTI then build the drivers/sh directory, but ensure that bits that may conflict (drivers/sh/clk if the common clock framework is not enabled) are built.

The ARCH_SHMOBILE_MULTI was added by efacfce5f8a ("ARM: shmobile:
Introduce ARCH_SHMOBILE_MULTI") but this has only just recently been found due to changes currently only in Simon Horman's tree. This patch is a partial revert of bf98c1eac1d4a6b ("ARM: Rename ARCH_SHMOBILE to ARCH_SHMOBILE_LEGACY") to address the issue of drivers not being built.

Quoted 6 lines
Quoted 4 lines

It is also possible the drivers/sh/intc will also need to be built however the lack of intc is not causing a number of drivers to fail to properly manage their clocks. This is left as an future patch for that is perfectly fine. someone who understands that part of the code.

Laurent, what are you feelings on this?

If we end up needing an interrupt controller supported by drivers/sh/intc for a multiplatform kernel I would rather like to port the driver to drivers/irqchip instead of compiling drivers/sh/intc for the platform.

Regarding drivers/sh/pm_runtime.c, compiling it for ARCH_SHMOBILE_MULTI will cause multiplatform kernels running on non-Renesas platforms to add a pm clock notifier. We need to at least add a runtime check.

Quoted 38 lines
Quoted 38 lines
Cc Linus SH list <[email protected]>
Cc Simon Horman <[email protected]>
Cc Magnus Damm <[email protected]>

---

 drivers/Makefile    | 2 +-
 drivers/sh/Makefile | 3 +++
 2 files changed, 4 insertions(+), 1 deletion(-)
drivers/Makefile +1 -1
index 8e3b8b0..3cc8214 100644
@@ -118,7 +118,7 @@ obj-$(CONFIG_SGI_SN)		+= sn/
 obj-y				+= firmware/
 obj-$(CONFIG_CRYPTO)		+= crypto/
 obj-$(CONFIG_SUPERH)		+= sh/
-obj-$(CONFIG_ARCH_SHMOBILE_LEGACY)	+= sh/
+obj-$(CONFIG_ARCH_SHMOBILE)	+= sh/
 ifndef CONFIG_ARCH_USES_GETTIMEOFFSET
 obj-y				+= clocksource/
 endif
drivers/sh/Makefile +3 -0
index fc67f56..b4d588c 100644
@@ -3,7 +3,10 @@
 #
 obj-y	:= intc/
 
+ifneq ($(CONFIG_COMMON_CLK),y)
 obj-$(CONFIG_HAVE_CLK)		+= clk/
+endif
+
 obj-$(CONFIG_MAPLE)		+= maple/
 obj-$(CONFIG_SUPERHYWAY)	+= superhyway/
Signature · 3 lines
Regards,

Laurent Pinchart
author
#9 lore raw
In reply to Ben Dooks
Quoted 27 lines · Laurent Pinchart

Hi Simon,

Quoted 17 lines · On Wednesday 15 January 2014 08:55:05 Simon Horman wrote:
Quoted 16 lines · Ben Dooks

If the kernel is built to support multi-arm configurmation with shmobile support built in, then the drivers/sh is not built. This contains drivers that are essential to devices support by that configuration, including the PM runtime code in drivers/sh/pm_runtime.c (which implicitly enables the bus clocks for all devices).

If CONFIG_ARCH_SHMOBILE_MULTI then build the drivers/sh directory, but ensure that bits that may conflict (drivers/sh/clk if the common clock framework is not enabled) are built.

The ARCH_SHMOBILE_MULTI was added by efacfce5f8a ("ARM: shmobile:
Introduce ARCH_SHMOBILE_MULTI") but this has only just recently been found due to changes currently only in Simon Horman's tree. This patch is a partial revert of bf98c1eac1d4a6b ("ARM: Rename ARCH_SHMOBILE to ARCH_SHMOBILE_LEGACY") to address the issue of drivers not being built.

Quoted 6 lines
Quoted 4 lines

It is also possible the drivers/sh/intc will also need to be built however the lack of intc is not causing a number of drivers to fail to properly manage their clocks. This is left as an future patch for that is perfectly fine. someone who understands that part of the code.

Laurent, what are you feelings on this?

Quoted 7 lines

If we end up needing an interrupt controller supported by drivers/sh/intc for a multiplatform kernel I would rather like to port the driver to drivers/irqchip instead of compiling drivers/sh/intc for the platform.

Regarding drivers/sh/pm_runtime.c, compiling it for ARCH_SHMOBILE_MULTI will cause multiplatform kernels running on non-Renesas platforms to add a pm clock notifier. We need to at least add a runtime check.

Hmm, could we move that to the mstp code or add bindings to the specific architectures that need it?

Signature · 2 lines
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius
author
#10 lore raw
In reply to Ben Dooks
Quoted 38 lines · Ben Dooks
Quoted 37 lines · Laurent Pinchart

Hi Simon,

Quoted 22 lines · On Wednesday 15 January 2014 08:55:05 Simon Horman wrote:
Quoted 21 lines · Ben Dooks

If the kernel is built to support multi-arm configurmation with shmobile
support built in, then the drivers/sh is not built. This contains drivers
that are essential to devices support by that configuration, including the
PM runtime code in drivers/sh/pm_runtime.c (which implicitly enables the
bus clocks for all devices).

If CONFIG_ARCH_SHMOBILE_MULTI then build the drivers/sh directory, but ensure that bits that may conflict (drivers/sh/clk if the common clock framework is not enabled) are built.

The ARCH_SHMOBILE_MULTI was added by efacfce5f8a ("ARM: shmobile:
Introduce ARCH_SHMOBILE_MULTI") but this has only just recently been found
due to changes currently only in Simon Horman's tree. This patch is a partial revert of bf98c1eac1d4a6b ("ARM: Rename ARCH_SHMOBILE to ARCH_SHMOBILE_LEGACY") to address the issue of drivers not being built.

Quoted 6 lines
Quoted 4 lines

It is also possible the drivers/sh/intc will also need to be built however the lack of intc is not causing a number of drivers to fail to properly manage their clocks. This is left as an future patch for that is perfectly fine. someone who understands that part of the code.

Laurent, what are you feelings on this?

If we end up needing an interrupt controller supported by drivers/sh/intc for
a multiplatform kernel I would rather like to port the driver to drivers/irqchip instead of compiling drivers/sh/intc for the platform.

Quoted 8 lines
Quoted 5 lines

Regarding drivers/sh/pm_runtime.c, compiling it for ARCH_SHMOBILE_MULTI will
cause multiplatform kernels running on non-Renesas platforms to add a pm clock
notifier. We need to at least add a runtime check.

Hmm, could we move that to the mstp code or add bindings to the specific architectures that need it?

I was having a think, and how about adding the following to each driver that expects clock management to happen for it, such as the following in the probe sequence:

	pm_runtime_manage_clock(dev);

This would mean the following:

- People would know a driver had its clock managed elsewhere
- You couldn't build a system with the clock_ops disabled.
- A system where a mix of drivers where used would work fine
- drivers/sh/pm_runtime.c could be deleted too.

Signature · 2 lines
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius
#11 lore raw
In reply to Ben Dooks

Hi Ben,

Quoted 43 lines · On Thursday 16 January 2014 17:25:09 Ben Dooks wrote:
Quoted 31 lines · Ben Dooks
Quoted 30 lines · Laurent Pinchart
Quoted 17 lines · On Wednesday 15 January 2014 08:55:05 Simon Horman wrote:
Quoted 16 lines · Ben Dooks

If the kernel is built to support multi-arm configurmation with shmobile support built in, then the drivers/sh is not built. This contains drivers that are essential to devices support by that configuration, including the PM runtime code in drivers/sh/pm_runtime.c (which implicitly enables the bus clocks for all devices).

If CONFIG_ARCH_SHMOBILE_MULTI then build the drivers/sh directory, but ensure that bits that may conflict (drivers/sh/clk if the common clock framework is not enabled) are built.

The ARCH_SHMOBILE_MULTI was added by efacfce5f8a ("ARM: shmobile:
Introduce ARCH_SHMOBILE_MULTI") but this has only just recently been found due to changes currently only in Simon Horman's tree. This patch is a partial revert of bf98c1eac1d4a6b ("ARM: Rename ARCH_SHMOBILE to ARCH_SHMOBILE_LEGACY") to address the issue of drivers not being built.

Quoted 6 lines
Quoted 4 lines

It is also possible the drivers/sh/intc will also need to be built however the lack of intc is not causing a number of drivers to fail to properly manage their clocks. This is left as an future patch for that is perfectly fine. someone who understands that part of the code.

Laurent, what are you feelings on this?

If we end up needing an interrupt controller supported by drivers/sh/intc for a multiplatform kernel I would rather like to port the driver to drivers/irqchip instead of compiling drivers/sh/intc for the platform.

Quoted 6 lines
Quoted 3 lines

Regarding drivers/sh/pm_runtime.c, compiling it for ARCH_SHMOBILE_MULTI will cause multiplatform kernels running on non-Renesas platforms to add a pm clock notifier. We need to at least add a runtime check.

Hmm, could we move that to the mstp code or add bindings to the specific architectures that need it?

I was having a think, and how about adding the following to each driver that expects clock management to happen for it, such as the following in the probe sequence:

Quoted 8 lines
	pm_runtime_manage_clock(dev);

This would mean the following:

- People would know a driver had its clock managed elsewhere
- You couldn't build a system with the clock_ops disabled.
- A system where a mix of drivers where used would work fine
- drivers/sh/pm_runtime.c could be deleted too.

That sounds like a good idea to me. I like how drivers will be responsible for explicitly delegating clock handling to generic code. This combines simplicity with flexibility, and doesn't hide clock handling.

Mark, Rafael, any opinion ?

Signature · 3 lines
Regards,

Laurent Pinchart
#12 lore raw
In reply to Ben Dooks
Quoted 15 lines · Laurent Pinchart
Quoted 4 lines · On Thursday 16 January 2014 17:25:09 Ben Dooks wrote:

I was having a think, and how about adding the following to each driver that expects clock management to happen for it, such as the following in the probe sequence:

Quoted 8 lines
	pm_runtime_manage_clock(dev);

This would mean the following:

- People would know a driver had its clock managed elsewhere
- You couldn't build a system with the clock_ops disabled.
- A system where a mix of drivers where used would work fine
- drivers/sh/pm_runtime.c could be deleted too.

Quoted 5 lines

That sounds like a good idea to me. I like how drivers will be responsible for explicitly delegating clock handling to generic code. This combines simplicity with flexibility, and doesn't hide clock handling.

Mark, Rafael, any opinion ?

I think that just makes things more complicated and isn't adding anything over pm_runtime_enable(), it's just boilerplate code. In theory essentially every driver running on platforms which don't have explicit management of core IP clocks ought to be calling this since potentially the IP might be deployed on another platform which does have clock management (this does actually happen with things like the DesignWare IPs) and it doesn't do anything like say which clocks are expected to be managed in this way which is another thing that can come up when moving devices between platforms.

I'm also struggling to see how it provides any sort of build time protection, it would allow the generation of a warning at runtime at best.

As far as I can tell the problem that Ben has seen here is that the platform really, really needs the code for its power domains running to be functional (this doesn't seem unreasonable and may not be related to clocks, this may be required to have the IPs powered up at all). I'd expect this is something for the platform to sort out rather than something for individual drivers to have to carry code for.

If it was going to be drivers carrying code for this I would expect it to be something like providing a list of clocks to be managed along with runtime PM - this would also make the code more widely applicable since it's quite common for the runtime PM callbacks to do nothing more than just enable and disable clocks.

author
#13 lore raw
In reply to Ben Dooks
Quoted 22 lines · Mark Brown
Quoted 15 lines · Laurent Pinchart
Quoted 4 lines · On Thursday 16 January 2014 17:25:09 Ben Dooks wrote:

I was having a think, and how about adding the following to each driver that expects clock management to happen for it, such as the following in the probe sequence:

Quoted 8 lines
	pm_runtime_manage_clock(dev);

This would mean the following:

- People would know a driver had its clock managed elsewhere
- You couldn't build a system with the clock_ops disabled.
- A system where a mix of drivers where used would work fine
- drivers/sh/pm_runtime.c could be deleted too.

Quoted 5 lines

That sounds like a good idea to me. I like how drivers will be responsible for explicitly delegating clock handling to generic code. This combines simplicity with flexibility, and doesn't hide clock handling.

Mark, Rafael, any opinion ?

Quoted 9 lines

I think that just makes things more complicated and isn't adding anything over pm_runtime_enable(), it's just boilerplate code. In theory essentially every driver running on platforms which don't have explicit management of core IP clocks ought to be calling this since potentially the IP might be deployed on another platform which does have clock management (this does actually happen with things like the DesignWare IPs) and it doesn't do anything like say which clocks are expected to be managed in this way which is another thing that can come up when moving devices between platforms.

That sounds like a real headache where you have two sets of code looking at possibly the same clocks, and behaving differently between different platforms.

Quoted 3 lines

I'm also struggling to see how it provides any sort of build time protection, it would allow the generation of a warning at runtime at best.

If you don't have the code it WILL NOT LINK. At the moment it is entirely possible to link a kernel which will produce a set of confusing errors as drivers fail to initialise at startup.

We've already had other people run into the issue where they do not know why a driver is failing to work (rcar-thermal is one) as the code that was managing the clock for it magically vanished during the development cycle.

Quoted 6 lines

As far as I can tell the problem that Ben has seen here is that the platform really, really needs the code for its power domains running to be functional (this doesn't seem unreasonable and may not be related to clocks, this may be required to have the IPs powered up at all). I'd expect this is something for the platform to sort out rather than something for individual drivers to have to carry code for.

What's power domains got to do with this? You keep bringing this up but the error is purely to do with clock management. The code happens to be sitting in the drivers/base/pm directory, but could easily sit elsewhere.

Quoted 5 lines

If it was going to be drivers carrying code for this I would expect it to be something like providing a list of clocks to be managed along with runtime PM - this would also make the code more widely applicable since it's quite common for the runtime PM callbacks to do nothing more than just enable and disable clocks.

If we are really saying that bus clocks should not be managed by the drivers, then we should just enable this across the whole kernel and remove the management from any extant drivers (or make it so that any drivers that must manage their bus clocks have a call to do so).

Signature · 2 lines
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius
#14 lore raw
In reply to Ben Dooks
Quoted 12 lines · Ben Dooks
Quoted 9 lines · Mark Brown

I think that just makes things more complicated and isn't adding anything over pm_runtime_enable(), it's just boilerplate code. In theory essentially every driver running on platforms which don't have explicit management of core IP clocks ought to be calling this since potentially the IP might be deployed on another platform which does have clock management (this does actually happen with things like the DesignWare IPs) and it doesn't do anything like say which clocks are expected to be managed in this way which is another thing that can come up when moving devices between platforms.

Quoted 3 lines

That sounds like a real headache where you have two sets of code looking at possibly the same clocks, and behaving differently between different platforms.

Yup, it's usually only one set of code on the client side but it's annoying that platform integrations aren't done consistently in hardware and that this flows through into software.

Quoted 7 lines
Quoted 3 lines

I'm also struggling to see how it provides any sort of build time protection, it would allow the generation of a warning at runtime at best.

If you don't have the code it WILL NOT LINK. At the moment it is entirely possible to link a kernel which will produce a set of confusing errors as drivers fail to initialise at startup.

How will this prevent the code linking? I would expect the "manage the clocks via runtime PM" call to be a bit of core code, I wouldn't expect it to be provided by a specific platform otherwise we're in for fail in a multiplatform environment. Besides, if it fails to link there's some missing Kconfig anyway since randconfig is supposed to work.

Quoted 4 lines

We've already had other people run into the issue where they do not know why a driver is failing to work (rcar-thermal is one) as the code that was managing the clock for it magically vanished during the development cycle.

I agree there's a usability problem here, I just don't think that this is the best fix for it, I think it's breaking abstractions.

Quoted 11 lines
Quoted 6 lines

As far as I can tell the problem that Ben has seen here is that the platform really, really needs the code for its power domains running to be functional (this doesn't seem unreasonable and may not be related to clocks, this may be required to have the IPs powered up at all). I'd expect this is something for the platform to sort out rather than something for individual drivers to have to carry code for.

What's power domains got to do with this? You keep bringing this up but the error is purely to do with clock management. The code happens to be sitting in the drivers/base/pm directory, but could easily sit elsewhere.

What these platforms are saying is esssentially that the clocks are part of the power domain - they're a fundamental part of getting the IP available for use so there is no point in managing them separately. This is where I think the abstraction problem is coming, to me it seems like the platform isn't successfully ensuring that the code to manage the power domain is there. The fact that part of what's missing is the clocks shouldn't matter to the drivers, in doing things like this the platform is trying to abstract that detail away from the drivers.

Quoted 11 lines
Quoted 5 lines

If it was going to be drivers carrying code for this I would expect it to be something like providing a list of clocks to be managed along with runtime PM - this would also make the code more widely applicable since it's quite common for the runtime PM callbacks to do nothing more than just enable and disable clocks.

If we are really saying that bus clocks should not be managed by the drivers, then we should just enable this across the whole kernel and remove the management from any extant drivers (or make it so that any drivers that must manage their bus clocks have a call to do so).

Yes, I think that would be a useful way to go since it would factor out some common code patterns that keep cropping up (as I suggested to you previously). It may not just be the main IP clocks that the drivers are managing like this (some drivers end up managing other clocks at the same time even if they could be more flexible) so if it was something drivers could make use of themselves that'd be good.

author
#15 lore raw

PATCH 1/1 ARM: shmobile: compile drivers/sh for CONFIG_ARCH_SHMOBILE_MULTI

I've added linux-arm-kernel to the list to get a wider view from people who actively use the clock subsystem.

Quoted 76 lines · Mark Brown
Quoted 12 lines · Ben Dooks
Quoted 9 lines · Mark Brown

I think that just makes things more complicated and isn't adding anything over pm_runtime_enable(), it's just boilerplate code. In theory essentially every driver running on platforms which don't have explicit management of core IP clocks ought to be calling this since potentially the IP might be deployed on another platform which does have clock management (this does actually happen with things like the DesignWare IPs) and it doesn't do anything like say which clocks are expected to be managed in this way which is another thing that can come up when moving devices between platforms.

Quoted 3 lines

That sounds like a real headache where you have two sets of code looking at possibly the same clocks, and behaving differently between different platforms.

Yup, it's usually only one set of code on the client side but it's annoying that platform integrations aren't done consistently in hardware and that this flows through into software.

Quoted 7 lines
Quoted 3 lines

I'm also struggling to see how it provides any sort of build time protection, it would allow the generation of a warning at runtime at best.

If you don't have the code it WILL NOT LINK. At the moment it is entirely possible to link a kernel which will produce a set of confusing errors as drivers fail to initialise at startup.

How will this prevent the code linking? I would expect the "manage the clocks via runtime PM" call to be a bit of core code, I wouldn't expect it to be provided by a specific platform otherwise we're in for fail in a multiplatform environment. Besides, if it fails to link there's some missing Kconfig anyway since randconfig is supposed to work.

Quoted 4 lines

We've already had other people run into the issue where they do not know why a driver is failing to work (rcar-thermal is one) as the code that was managing the clock for it magically vanished during the development cycle.

I agree there's a usability problem here, I just don't think that this is the best fix for it, I think it's breaking abstractions.

Quoted 11 lines
Quoted 6 lines

As far as I can tell the problem that Ben has seen here is that the platform really, really needs the code for its power domains running to be functional (this doesn't seem unreasonable and may not be related to clocks, this may be required to have the IPs powered up at all). I'd expect this is something for the platform to sort out rather than something for individual drivers to have to carry code for.

What's power domains got to do with this? You keep bringing this up but the error is purely to do with clock management. The code happens to be sitting in the drivers/base/pm directory, but could easily sit elsewhere.

What these platforms are saying is esssentially that the clocks are part of the power domain - they're a fundamental part of getting the IP available for use so there is no point in managing them separately. This is where I think the abstraction problem is coming, to me it seems like the platform isn't successfully ensuring that the code to manage the power domain is there. The fact that part of what's missing is the clocks shouldn't matter to the drivers, in doing things like this the platform is trying to abstract that detail away from the drivers.

Quoted 11 lines
Quoted 5 lines

If it was going to be drivers carrying code for this I would expect it to be something like providing a list of clocks to be managed along with runtime PM - this would also make the code more widely applicable since it's quite common for the runtime PM callbacks to do nothing more than just enable and disable clocks.

If we are really saying that bus clocks should not be managed by the drivers, then we should just enable this across the whole kernel and remove the management from any extant drivers (or make it so that any drivers that must manage their bus clocks have a call to do so).

Quoted 6 lines

Yes, I think that would be a useful way to go since it would factor out some common code patterns that keep cropping up (as I suggested to you previously). It may not just be the main IP clocks that the drivers are managing like this (some drivers end up managing other clocks at the same time even if they could be more flexible) so if it was something drivers could make use of themselves that'd be good.

At the moment, the code to actually use the support is sitting in drivers/sh and gets initialised if it is built. This is the source of the original confusions.

I think it would be ok if drivers could /opt out/ if the bus clock handling was done like this for all platforms and we simply noted that the pm code is doing it. At that point it would be nice just to build the code in drivers/base/power unconditionally.

At the moment we could quite easily enable this code for all the ARM platforms as the clk framework should deal nicely with properly balanced clk_enable() and clk_disable() calls.

Enabling it across the board would also remove any issues with changes in platform behaviour and find any bugs sooner rather than later.

Signature · 2 lines
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius
#16 lore raw

PATCH 1/1 ARM: shmobile: compile drivers/sh for CONFIG_ARCH_SHMOBILE_MULTI

Quoted 86 lines · On Monday 20 January 2014 13:19:07 Ben Dooks wrote:

I've added linux-arm-kernel to the list to get a wider view from people who actively use the clock subsystem.

Quoted 75 lines · Mark Brown
Quoted 11 lines · Ben Dooks
Quoted 9 lines · Mark Brown

I think that just makes things more complicated and isn't adding anything over pm_runtime_enable(), it's just boilerplate code. In theory essentially every driver running on platforms which don't have explicit management of core IP clocks ought to be calling this since potentially the IP might be deployed on another platform which does have clock management (this does actually happen with things like the DesignWare IPs) and it doesn't do anything like say which clocks are expected to be managed in this way which is another thing that can come up when moving devices between platforms.

Quoted 3 lines

That sounds like a real headache where you have two sets of code looking at possibly the same clocks, and behaving differently between different platforms.

Yup, it's usually only one set of code on the client side but it's annoying that platform integrations aren't done consistently in hardware and that this flows through into software.

Quoted 7 lines
Quoted 3 lines

I'm also struggling to see how it provides any sort of build time protection, it would allow the generation of a warning at runtime at best.

If you don't have the code it WILL NOT LINK. At the moment it is entirely possible to link a kernel which will produce a set of confusing errors as drivers fail to initialise at startup.

How will this prevent the code linking? I would expect the "manage the clocks via runtime PM" call to be a bit of core code, I wouldn't expect it to be provided by a specific platform otherwise we're in for fail in a multiplatform environment. Besides, if it fails to link there's some missing Kconfig anyway since randconfig is supposed to work.

Quoted 4 lines

We've already had other people run into the issue where they do not know why a driver is failing to work (rcar-thermal is one) as the code that was managing the clock for it magically vanished during the development cycle.

I agree there's a usability problem here, I just don't think that this is the best fix for it, I think it's breaking abstractions.

Quoted 11 lines
Quoted 6 lines

As far as I can tell the problem that Ben has seen here is that the platform really, really needs the code for its power domains running to be functional (this doesn't seem unreasonable and may not be related to clocks, this may be required to have the IPs powered up at all). I'd expect this is something for the platform to sort out rather than something for individual drivers to have to carry code for.

What's power domains got to do with this? You keep bringing this up but the error is purely to do with clock management. The code happens to be sitting in the drivers/base/pm directory, but could easily sit elsewhere.

What these platforms are saying is esssentially that the clocks are part of the power domain - they're a fundamental part of getting the IP available for use so there is no point in managing them separately. This is where I think the abstraction problem is coming, to me it seems like the platform isn't successfully ensuring that the code to manage the power domain is there. The fact that part of what's missing is the clocks shouldn't matter to the drivers, in doing things like this the platform is trying to abstract that detail away from the drivers.

Quoted 11 lines
Quoted 5 lines

If it was going to be drivers carrying code for this I would expect it to be something like providing a list of clocks to be managed along with runtime PM - this would also make the code more widely applicable since it's quite common for the runtime PM callbacks to do nothing more than just enable and disable clocks.

If we are really saying that bus clocks should not be managed by the drivers, then we should just enable this across the whole kernel and remove the management from any extant drivers (or make it so that any drivers that must manage their bus clocks have a call to do so).

Quoted 6 lines

Yes, I think that would be a useful way to go since it would factor out some common code patterns that keep cropping up (as I suggested to you previously). It may not just be the main IP clocks that the drivers are managing like this (some drivers end up managing other clocks at the same time even if they could be more flexible) so if it was something drivers could make use of themselves that'd be good.

Quoted 5 lines

At the moment, the code to actually use the support is sitting in drivers/sh and gets initialised if it is built. This is the source of the original confusions.

I think it would be ok if drivers could /opt out/

Most drivers have a single functional clock (if any) and only need it to be enabled/disabled in sync with runtime PM. As this requirements is common, making it the default sounds reasonable. Other drivers need to manage their clocks, or at least part of their clocks, manually. There are good and bad reasons for this, and some bad reasons come from driver code that should be fixed, but we can't ignore the problems for now.

The simplest implementation would be a way to let a driver opt-out completely. Unless a driver opts out, the runtime PM core will get the default clock for the device (with a NULL con ID) and manage it automatically. I'm not sure what to do when the runtime PM core fails to get the clock, as this can be caused by various problems or non-problems.

One particular problem that needs to be considered is deferred probing. An option would be to have all non-SoC devices opt-out from automatic clock management, but that will make the opt-out case the most common one. We also need to consider IP cores that can be present on-SoC or off-SoC in discrete chips.

The problem isn't as simple as it seems, and more advanced implementations that would allow listing clocks that should be managed automatically (or the other way around) would also add another level of complexity. The required information is platform-dependent, but we currently don't express it as such in DT.

Quoted 10 lines

if the bus clock handling was done like this for all platforms and we simply noted that the pm code is doing it. At that point it would be nice just to build the code in drivers/base/power unconditionally.

At the moment we could quite easily enable this code for all the ARM platforms as the clk framework should deal nicely with properly balanced clk_enable() and clk_disable() calls.

Enabling it across the board would also remove any issues with changes in platform behaviour and find any bugs sooner rather than later.

Signature · 3 lines
Regards,

Laurent Pinchart
#17 lore raw

PATCH 1/1 ARM: shmobile: compile drivers/sh for CONFIG_ARCH_SHMOBILE_MULTI

Quoted 5 lines · Laurent Pinchart

The problem isn't as simple as it seems, and more advanced implementations that would allow listing clocks that should be managed automatically (or the other way around) would also add another level of complexity. The required information is platform-dependent, but we currently don't express it as such in DT.

Well, the set of clocks an IP requires will tend to be the same - it's
normally just that integrators may have done things like tie them
together or decide to spread confusion by renaming them.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140120/4673e8f6/attachment.sig>

#18 lore raw

PATCH 1/1 ARM: shmobile: compile drivers/sh for CONFIG_ARCH_SHMOBILE_MULTI

Hi Mark,

Quoted 10 lines · On Monday 20 January 2014 15:56:43 Mark Brown wrote:
Quoted 5 lines · Laurent Pinchart

The problem isn't as simple as it seems, and more advanced implementations that would allow listing clocks that should be managed automatically (or the other way around) would also add another level of complexity. The required information is platform-dependent, but we currently don't express it as such in DT.

Well, the set of clocks an IP requires will tend to be the same - it's normally just that integrators may have done things like tie them together or decide to spread confusion by renaming them.

That's the problem :-) How should the runtime PM core be given the list of clocks it needs to manage ? That information needs to come from somewhere.

Signature · 10 lines
Regards,

Laurent Pinchart
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 490 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20140120/a2303b43/attachment.sig>
#19 lore raw

PATCH 1/1 ARM: shmobile: compile drivers/sh for CONFIG_ARCH_SHMOBILE_MULTI

Hi Laurent,

Quoted 8 lines · Laurent Pinchart
Quoted 7 lines · On Monday 20 January 2014 15:56:43 Mark Brown wrote:
Quoted 5 lines · Laurent Pinchart

The problem isn't as simple as it seems, and more advanced implementations that would allow listing clocks that should be managed automatically (or the other way around) would also add another level of complexity. The required information is platform-dependent, but we currently don't express it as such in DT.

Quoted 6 lines
Quoted 3 lines

Well, the set of clocks an IP requires will tend to be the same - it's normally just that integrators may have done things like tie them together or decide to spread confusion by renaming them.

That's the problem :-) How should the runtime PM core be given the list of clocks it needs to manage ? That information needs to come from somewhere.

Stirring the pot again...

Which clocks a device needs is expressed in DT with CCF.
In the simple case, the runtime PM core can just control them based on device use.
In the complex case, the driver can regain control using its own pm callbacks, right?

Probably I'm still missing something, as I haven't had enough exposure to runtime PM and CCF ;-)

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#20 lore raw

PATCH 1/1 ARM: shmobile: compile drivers/sh for CONFIG_ARCH_SHMOBILE_MULTI

Hi Geert,

Quoted 16 lines · On Tuesday 11 March 2014 20:15:04 Geert Uytterhoeven wrote:
Quoted 8 lines · Laurent Pinchart
Quoted 7 lines · On Monday 20 January 2014 15:56:43 Mark Brown wrote:
Quoted 5 lines · Laurent Pinchart

The problem isn't as simple as it seems, and more advanced implementations that would allow listing clocks that should be managed automatically (or the other way around) would also add another level of complexity. The required information is platform-dependent, but we currently don't express it as such in DT.

Quoted 6 lines
Quoted 3 lines

Well, the set of clocks an IP requires will tend to be the same - it's normally just that integrators may have done things like tie them together or decide to spread confusion by renaming them.

That's the problem :-) How should the runtime PM core be given the list of clocks it needs to manage ? That information needs to come from somewhere.

Quoted 7 lines

Stirring the pot again...

Which clocks a device needs is expressed in DT with CCF.
In the simple case, the runtime PM core can just control them based on device use.
In the complex case, the driver can regain control using its own pm callbacks, right?

Sure, the driver can of course control the clocks manually in its PM callbacks if it needs to. The point, however, is to control the clocks from core code whenever possible. We thus need to define exact semantics to make sure each side knows what tasks to perform, and what to expect from the other side. For instance, in the DT case, the runtime PM core can easily get the list of the clocks used by the device from its DT node, but how can it know which clock(s) it should manage automatically and which clock(s) it should leave for the driver to control ?

Quoted 2 lines

Probably I'm still missing something, as I haven't had enough exposure to runtime PM and CCF ;-)

Signature · 3 lines
Regards,

Laurent Pinchart
#21 lore raw

PATCH 1/1 ARM: shmobile: compile drivers/sh for CONFIG_ARCH_SHMOBILE_MULTI

Hi Geert,

Quoted 26 lines · On Wednesday 12 March 2014 15:18:46 Laurent Pinchart wrote:
Quoted 17 lines · On Tuesday 11 March 2014 20:15:04 Geert Uytterhoeven wrote:
Quoted 8 lines · Laurent Pinchart
Quoted 7 lines · On Monday 20 January 2014 15:56:43 Mark Brown wrote:
Quoted 5 lines · Laurent Pinchart

The problem isn't as simple as it seems, and more advanced implementations that would allow listing clocks that should be managed automatically (or the other way around) would also add another level of complexity. The required information is platform- dependent, but we currently don't express it as such in DT.

Quoted 7 lines
Quoted 3 lines

Well, the set of clocks an IP requires will tend to be the same - it's normally just that integrators may have done things like tie them together or decide to spread confusion by renaming them.

That's the problem :-) How should the runtime PM core be given the list of clocks it needs to manage ? That information needs to come from somewhere.

Quoted 7 lines

Stirring the pot again...

Which clocks a device needs is expressed in DT with CCF.
In the simple case, the runtime PM core can just control them based on device use.
In the complex case, the driver can regain control using its own pm callbacks, right?

Quoted 11 lines

Sure, the driver can of course control the clocks manually in its PM callbacks if it needs to. The point, however, is to control the clocks from core code whenever possible. We thus need to define exact semantics to make sure each side knows what tasks to perform, and what to expect from the other side. For instance, in the DT case, the runtime PM core can easily get the list of the clocks used by the device from its DT node, but how can it know which clock(s) it should manage automatically and which clock(s) it should leave for the driver to control ?

Quoted 2 lines

Probably I'm still missing something, as I haven't had enough exposure to runtime PM and CCF ;-)

If you haven't seen it already, https://lkml.org/lkml/2014/1/31/290
("[RFC/PATCH] base: platform: add generic clock handling for platform-bus") might be related.

Signature · 3 lines
Regards,

Laurent Pinchart