LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH v4 0/5] drivers: bus: Add Simple Power-Managed Bus
@ 2015-01-26 16:16 Geert Uytterhoeven
  2015-01-26 16:16 ` [PATCH v4 1/5] drivers: bus: Sort Kconfig entries alphabetically Geert Uytterhoeven
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Geert Uytterhoeven @ 2015-01-26 16:16 UTC (permalink / raw)
  To: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Grant Likely, Arnd Bergmann, Kevin Hilman, Ulf Hansson,
	Rafael J. Wysocki, Felipe Balbi
  Cc: Olof Johansson, Simon Horman, Magnus Damm, Greg Kroah-Hartman,
	devicetree, linux-sh, linux-pm, linux-arm-kernel, linux-kernel,
	Geert Uytterhoeven

        Hi all,

The Renesas Bus State Controller (BSC) provides an external bus for
connecting multiple external devices to an SoC, driving several chip
select lines, for e.g. NOR FLASH, Ethernet and USB.
On the kzm9g and ape6evm development boards, an smsc9220 Ethernet
controller is connnected to the BSC of an SH-Mobile AG5 (sh73a0) resp.
R-Mobile APE6 (r8a73a4) SoC.

The BSC is a fairly simple memory-mapped bus, hence a "simple-bus"
compatibility seems suitable.  However, the BSC is special in two
ways:
  1. It is part of a PM domain (A4S on sh73a0),
  2. It has a gateable functional clock (ZB).
Before a device connected to the BSC can be accessed, the PM domain
containing the BSC must be powered on, and the functional clock
driving the BSC must be enabled.

Both special properties can be described in DT in a standardized way
("power-domains = <&pd_a4s>" and "clocks = <&zb_clk>", cfr. the
example in the DT binding documentation).  Externally connected
devices are described as children of the BSC node.

Unfortunately this doesn't mean everything will work out-of-the-box.
There are two problems:
  1. Without a device driver bound to the bus device, this device is
     not attached to the PM domain. And although a child device is
     present and active, the PM domain may be powered down, as it's
     considered unused by the PM domain core.
  2. Without a device driver calling pm_runtime_enable(), its
     functional clock is not enabled. Once runtime PM is enabled, the
     R-Mobile PM domain platform driver manages the functional clock
     using runtime PM.

As none of the above is really bus hardware-specific (PM domains and
functional clocks in clock domains are handled from genpd and platform
code), this series adds a Simple Power-Managed Bus driver for
transparent busses, which matches against "simple-pm-bus", enables
runtime PM for the bus device, and calls of_platform_populate() to
probe for child devices.
Due to the child-parent relationship of devices connected to the bus,
as long as the device drivers for the child devices are runtime PM
enabled, the bus's PM domain will be powered, and the bus's clock will
be enabled automatically when needed, for both runtime PM and s2ram.

This was tested on sh73a0/kzm9g-multiplatform (by me), and (v3) on
r8a73a4/ape6evm-multiplatform (by Ulrich Hecht). Without this,
Ethernet doesn't work, as the ZB clock is disabled by
clk_disable_unused().

Felipe: It looks like drivers/usb/musb/musb_am335x.c can be removed, if
"ti,am33xx-usb" claims compatibility with "simple-pm-bus"?

As drivers/bus doesn't have a maintainer, and this driver is needed to
move two shmobile platforms away from legacy to multiplatform, I think
this can go in through Simon's shmobile tree.

Changes compared to v3:
  - Replace "simple-bus" by "simple-pm-bus" in the bindings,
  - Move the "renesas,bsc" bindings to a separate document,
  - Bind against the generic "simple-pm-bus" instead of "renesas,bsc",
  - Explicitly call of_platform_populate() after pm_runtime_enable() to
    enforce ordering, instead of depending on claimed compatibility with
    "simple-bus".

Changes compared to v2:
  - Document required properties inherited from "simple-bus",
  - Document required "reg" property for "renesas,bsc",
  - Move "ranges" before "reg" in the example,
  - Add Tested-by,
  - Split-off sh73a0/kzm9g and r8a73a4/ape6evm DTS updates.

Changes compared to v1 (more detailed change logs in the individual
patches):
  - Added sorting of drivers/bus Kconfig and Makefile entries,
  - Added DT binding documentation,
  - Rename from "Renesas Bus State Controller Driver" (renesas-bsc) to
    "Simple Power-Managed Bus Driver" (simple-pm-bus),
  - Postponed adding power-domains properties to the dtsi,
  - Added updates for r8a73a4/ape6evm.

Thanks for your comments!

Geert Uytterhoeven (5):
  drivers: bus: Sort Kconfig entries alphabetically
  drivers: bus: Sort Makefile entries alphabetically
  drivers: bus: Add Simple Power-Managed Bus DT Bindings
  drivers: bus: Add Renesas Bus State Controller (BSC) DT Bindings
  drivers: bus: Add Simple Power-Managed Bus Driver

 .../devicetree/bindings/bus/renesas,bsc.txt        | 46 +++++++++++++++++
 .../devicetree/bindings/bus/simple-pm-bus.txt      | 41 +++++++++++++++
 drivers/bus/Kconfig                                | 53 ++++++++++++--------
 drivers/bus/Makefile                               | 15 +++---
 drivers/bus/simple-pm-bus.c                        | 58 ++++++++++++++++++++++
 5 files changed, 186 insertions(+), 27 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/bus/renesas,bsc.txt
 create mode 100644 Documentation/devicetree/bindings/bus/simple-pm-bus.txt
 create mode 100644 drivers/bus/simple-pm-bus.c

-- 
1.9.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v4 1/5] drivers: bus: Sort Kconfig entries alphabetically
  2015-01-26 16:16 [PATCH v4 0/5] drivers: bus: Add Simple Power-Managed Bus Geert Uytterhoeven
@ 2015-01-26 16:16 ` Geert Uytterhoeven
  2015-01-26 16:16 ` [PATCH v4 2/5] drivers: bus: Sort Makefile " Geert Uytterhoeven
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Geert Uytterhoeven @ 2015-01-26 16:16 UTC (permalink / raw)
  To: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Grant Likely, Arnd Bergmann, Kevin Hilman, Ulf Hansson,
	Rafael J. Wysocki, Felipe Balbi
  Cc: Olof Johansson, Simon Horman, Magnus Damm, Greg Kroah-Hartman,
	devicetree, linux-sh, linux-pm, linux-arm-kernel, linux-kernel,
	Geert Uytterhoeven

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
---
v4:
  - No changes,

v3:
  - Add Tested-by,

v2:
  - New.
---
 drivers/bus/Kconfig | 44 ++++++++++++++++++++++----------------------
 1 file changed, 22 insertions(+), 22 deletions(-)

diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig
index b99729e368608bda..626960819e6df16c 100644
--- a/drivers/bus/Kconfig
+++ b/drivers/bus/Kconfig
@@ -4,6 +4,21 @@
 
 menu "Bus devices"
 
+config ARM_CCI
+	bool "ARM CCI driver support"
+	depends on ARM && OF && CPU_V7
+	help
+	  Driver supporting the CCI cache coherent interconnect for ARM
+	  platforms.
+
+config ARM_CCN
+	bool "ARM CCN driver support"
+	depends on ARM || ARM64
+	depends on PERF_EVENTS
+	help
+	  PMU (perf) driver supporting the ARM CCN (Cache Coherent Network)
+	  interconnect.
+
 config BRCMSTB_GISB_ARB
 	bool "Broadcom STB GISB bus arbiter"
 	depends on ARM || MIPS
@@ -27,15 +42,6 @@ config MVEBU_MBUS
 	  Driver needed for the MBus configuration on Marvell EBU SoCs
 	  (Kirkwood, Dove, Orion5x, MV78XX0 and Armada 370/XP).
 
-config OMAP_OCP2SCP
-	tristate "OMAP OCP2SCP DRIVER"
-	depends on ARCH_OMAP2PLUS
-	help
-	  Driver to enable ocp2scp module which transforms ocp interface
-	  protocol to scp protocol. In OMAP4, USB PHY is connected via
-	  OCP2SCP and in OMAP5, both USB PHY and SATA PHY is connected via
-	  OCP2SCP.
-
 config OMAP_INTERCONNECT
 	tristate "OMAP INTERCONNECT DRIVER"
 	depends on ARCH_OMAP2PLUS
@@ -43,20 +49,14 @@ config OMAP_INTERCONNECT
 	help
 	  Driver to enable OMAP interconnect error handling driver.
 
-config ARM_CCI
-	bool "ARM CCI driver support"
-	depends on ARM && OF && CPU_V7
-	help
-	  Driver supporting the CCI cache coherent interconnect for ARM
-	  platforms.
-
-config ARM_CCN
-	bool "ARM CCN driver support"
-	depends on ARM || ARM64
-	depends on PERF_EVENTS
+config OMAP_OCP2SCP
+	tristate "OMAP OCP2SCP DRIVER"
+	depends on ARCH_OMAP2PLUS
 	help
-	  PMU (perf) driver supporting the ARM CCN (Cache Coherent Network)
-	  interconnect.
+	  Driver to enable ocp2scp module which transforms ocp interface
+	  protocol to scp protocol. In OMAP4, USB PHY is connected via
+	  OCP2SCP and in OMAP5, both USB PHY and SATA PHY is connected via
+	  OCP2SCP.
 
 config VEXPRESS_CONFIG
 	bool "Versatile Express configuration bus"
-- 
1.9.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v4 2/5] drivers: bus: Sort Makefile entries alphabetically
  2015-01-26 16:16 [PATCH v4 0/5] drivers: bus: Add Simple Power-Managed Bus Geert Uytterhoeven
  2015-01-26 16:16 ` [PATCH v4 1/5] drivers: bus: Sort Kconfig entries alphabetically Geert Uytterhoeven
@ 2015-01-26 16:16 ` Geert Uytterhoeven
  2015-01-26 16:16 ` [PATCH v4 3/5] drivers: bus: Add Simple Power-Managed Bus DT Bindings Geert Uytterhoeven
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Geert Uytterhoeven @ 2015-01-26 16:16 UTC (permalink / raw)
  To: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Grant Likely, Arnd Bergmann, Kevin Hilman, Ulf Hansson,
	Rafael J. Wysocki, Felipe Balbi
  Cc: Olof Johansson, Simon Horman, Magnus Damm, Greg Kroah-Hartman,
	devicetree, linux-sh, linux-pm, linux-arm-kernel, linux-kernel,
	Geert Uytterhoeven

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
---
v4:
  - No changes,

v3:
  - Add Tested-by,

v2:
  - New.
---
 drivers/bus/Makefile | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/bus/Makefile b/drivers/bus/Makefile
index 2973c18cbcc27816..3cfaf2c7f25ac4f0 100644
--- a/drivers/bus/Makefile
+++ b/drivers/bus/Makefile
@@ -2,16 +2,16 @@
 # Makefile for the bus drivers.
 #
 
+# Interconnect bus drivers for ARM platforms
+obj-$(CONFIG_ARM_CCI)		+= arm-cci.o
+obj-$(CONFIG_ARM_CCN)		+= arm-ccn.o
+
 obj-$(CONFIG_BRCMSTB_GISB_ARB)	+= brcmstb_gisb.o
-obj-$(CONFIG_IMX_WEIM)	+= imx-weim.o
-obj-$(CONFIG_MVEBU_MBUS) += mvebu-mbus.o
-obj-$(CONFIG_OMAP_OCP2SCP)	+= omap-ocp2scp.o
+obj-$(CONFIG_IMX_WEIM)		+= imx-weim.o
+obj-$(CONFIG_MVEBU_MBUS) 	+= mvebu-mbus.o
 
 # Interconnect bus driver for OMAP SoCs.
 obj-$(CONFIG_OMAP_INTERCONNECT)	+= omap_l3_smx.o omap_l3_noc.o
 
-# Interconnect bus drivers for ARM platforms
-obj-$(CONFIG_ARM_CCI)		+= arm-cci.o
-obj-$(CONFIG_ARM_CCN)		+= arm-ccn.o
-
+obj-$(CONFIG_OMAP_OCP2SCP)	+= omap-ocp2scp.o
 obj-$(CONFIG_VEXPRESS_CONFIG)	+= vexpress-config.o
-- 
1.9.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v4 3/5] drivers: bus: Add Simple Power-Managed Bus DT Bindings
  2015-01-26 16:16 [PATCH v4 0/5] drivers: bus: Add Simple Power-Managed Bus Geert Uytterhoeven
  2015-01-26 16:16 ` [PATCH v4 1/5] drivers: bus: Sort Kconfig entries alphabetically Geert Uytterhoeven
  2015-01-26 16:16 ` [PATCH v4 2/5] drivers: bus: Sort Makefile " Geert Uytterhoeven
@ 2015-01-26 16:16 ` Geert Uytterhoeven
  2015-01-27 18:17   ` Mark Rutland
  2015-01-26 16:16 ` [PATCH v4 4/5] drivers: bus: Add Renesas Bus State Controller (BSC) " Geert Uytterhoeven
                   ` (2 subsequent siblings)
  5 siblings, 1 reply; 11+ messages in thread
From: Geert Uytterhoeven @ 2015-01-26 16:16 UTC (permalink / raw)
  To: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Grant Likely, Arnd Bergmann, Kevin Hilman, Ulf Hansson,
	Rafael J. Wysocki, Felipe Balbi
  Cc: Olof Johansson, Simon Horman, Magnus Damm, Greg Kroah-Hartman,
	devicetree, linux-sh, linux-pm, linux-arm-kernel, linux-kernel,
	Geert Uytterhoeven

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
---
v4:
  - Replace "simple-bus" by "simple-pm-bus",
  - Remove the "renesas,bsc" bindings. They will be specified in a
    separate document.

v3:
  - Add Tested-by,
  - Document required properties inherited from "simple-bus",
  - Document required "reg" property for "renesas,bsc",
  - Move "ranges" before "reg" in the example,

v2:
  - New.
---
 .../devicetree/bindings/bus/simple-pm-bus.txt      | 41 ++++++++++++++++++++++
 1 file changed, 41 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/bus/simple-pm-bus.txt

diff --git a/Documentation/devicetree/bindings/bus/simple-pm-bus.txt b/Documentation/devicetree/bindings/bus/simple-pm-bus.txt
new file mode 100644
index 0000000000000000..0415e93a816c5ac0
--- /dev/null
+++ b/Documentation/devicetree/bindings/bus/simple-pm-bus.txt
@@ -0,0 +1,41 @@
+Simple Power-Managed Bus
+========================
+
+A Simple Power-Managed Bus is a transparent bus that doesn't need a real
+driver, as it's typically initialized by the boot loader.
+
+However, its bus controller is part of a PM domain, or under the control of a
+functional clock.  Hence, the bus controller's PM domain and/or clock must be
+enabled for child devices connected to the bus (either on-SoC or externally)
+to function.
+
+The bindings for the Simple Power-Managed Bus extend the bindings for
+"simple-bus", as specified in ePAPR.
+
+
+Required properties:
+  - compatible: Must contain at least "simple-pm-bus".
+		It's recommended to let this be preceded by one or more
+		vendor-specific compatible values.
+  - #address-cells, #size-cells, ranges: Must describe the mapping between
+		parent address and child address spaces.
+
+Optional platform-specific properties for clock or PM domain control (at least
+one of them is required):
+  - clocks: Must contain a reference to the functional clock(s),
+  - power-domains: Must contain a reference to the PM domain.
+
+
+Example:
+
+	bsc: bus@fec10000 {
+		compatible = "renesas,bsc-sh73a0", "renesas,bsc",
+			     "simple-pm-bus";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges = <0 0 0x20000000>;
+		reg = <0xfec10000 0x400>;
+		interrupts = <0 39 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&zb_clk>;
+		power-domains = <&pd_a4s>;
+	};
-- 
1.9.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v4 4/5] drivers: bus: Add Renesas Bus State Controller (BSC) DT Bindings
  2015-01-26 16:16 [PATCH v4 0/5] drivers: bus: Add Simple Power-Managed Bus Geert Uytterhoeven
                   ` (2 preceding siblings ...)
  2015-01-26 16:16 ` [PATCH v4 3/5] drivers: bus: Add Simple Power-Managed Bus DT Bindings Geert Uytterhoeven
@ 2015-01-26 16:16 ` Geert Uytterhoeven
  2015-01-26 16:16 ` [PATCH v4 5/5] drivers: bus: Add Simple Power-Managed Bus Driver Geert Uytterhoeven
  2015-01-27 17:42 ` [PATCH v4 0/5] drivers: bus: Add Simple Power-Managed Bus Kevin Hilman
  5 siblings, 0 replies; 11+ messages in thread
From: Geert Uytterhoeven @ 2015-01-26 16:16 UTC (permalink / raw)
  To: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Grant Likely, Arnd Bergmann, Kevin Hilman, Ulf Hansson,
	Rafael J. Wysocki, Felipe Balbi
  Cc: Olof Johansson, Simon Horman, Magnus Damm, Greg Kroah-Hartman,
	devicetree, linux-sh, linux-pm, linux-arm-kernel, linux-kernel,
	Geert Uytterhoeven

The bindings for the BSC extend the bindings for "simple-pm-bus".

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
v4:
  - New, extracted from simple-pm-bus.txt in v3.
---
 .../devicetree/bindings/bus/renesas,bsc.txt        | 46 ++++++++++++++++++++++
 1 file changed, 46 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/bus/renesas,bsc.txt

diff --git a/Documentation/devicetree/bindings/bus/renesas,bsc.txt b/Documentation/devicetree/bindings/bus/renesas,bsc.txt
new file mode 100644
index 0000000000000000..90e94726943772c4
--- /dev/null
+++ b/Documentation/devicetree/bindings/bus/renesas,bsc.txt
@@ -0,0 +1,46 @@
+Renesas Bus State Controller (BSC)
+==================================
+
+The Renesas Bus State Controller (BSC, sometimes called "LBSC within Bus
+Bridge", or "External Bus Interface") can be found in several Renesas ARM SoCs.
+It provides an external bus for connecting multiple external devices to the
+SoC, driving several chip select lines, for e.g. NOR FLASH, Ethernet and USB.
+
+While the BSC is a fairly simple memory-mapped bus, it may be part of a PM
+domain, and may have a gateable functional clock.
+Before a device connected to the BSC can be accessed, the PM domain
+containing the BSC must be powered on, and the functional clock
+driving the BSC must be enabled.
+
+The bindings for the BSC extend the bindings for "simple-pm-bus".
+
+
+Required properties
+  - compatible: Must contain an SoC-specific value, and "renesas,bsc" and
+		"simple-pm-bus" as fallbacks.
+                SoC-specific values can be:
+		"renesas,bsc-r8a73a4" for R-Mobile APE6 (r8a73a4)
+		"renesas,bsc-sh73a0" for SH-Mobile AG5 (sh73a0)
+  - #address-cells, #size-cells, ranges: Must describe the mapping between
+		parent address and child address spaces.
+  - reg: Must contain the base address and length to access the bus controller.
+
+Optional properties:
+  - interrupts: Must contain a reference to the BSC interrupt, if available.
+  - clocks: Must contain a reference to the functional clock, if available.
+  - power-domains: Must contain a reference to the PM domain, if available.
+
+
+Example:
+
+	bsc: bus@fec10000 {
+		compatible = "renesas,bsc-sh73a0", "renesas,bsc",
+			     "simple-pm-bus";
+		#address-cells = <1>;
+		#size-cells = <1>;
+		ranges = <0 0 0x20000000>;
+		reg = <0xfec10000 0x400>;
+		interrupts = <0 39 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&zb_clk>;
+		power-domains = <&pd_a4s>;
+	};
-- 
1.9.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH v4 5/5] drivers: bus: Add Simple Power-Managed Bus Driver
  2015-01-26 16:16 [PATCH v4 0/5] drivers: bus: Add Simple Power-Managed Bus Geert Uytterhoeven
                   ` (3 preceding siblings ...)
  2015-01-26 16:16 ` [PATCH v4 4/5] drivers: bus: Add Renesas Bus State Controller (BSC) " Geert Uytterhoeven
@ 2015-01-26 16:16 ` Geert Uytterhoeven
  2015-01-30  9:34   ` Ulf Hansson
  2015-01-27 17:42 ` [PATCH v4 0/5] drivers: bus: Add Simple Power-Managed Bus Kevin Hilman
  5 siblings, 1 reply; 11+ messages in thread
From: Geert Uytterhoeven @ 2015-01-26 16:16 UTC (permalink / raw)
  To: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Grant Likely, Arnd Bergmann, Kevin Hilman, Ulf Hansson,
	Rafael J. Wysocki, Felipe Balbi
  Cc: Olof Johansson, Simon Horman, Magnus Damm, Greg Kroah-Hartman,
	devicetree, linux-sh, linux-pm, linux-arm-kernel, linux-kernel,
	Geert Uytterhoeven

Add a driver for transparent busses that don't need a real driver, but
where the bus controller is part of a PM domain, or under the control of
a functional clock.  Typically, the bus controller's PM domain and/or
clock must be enabled for child devices connected to the bus (either
on-SoC or externally) to function.

Hence the sole purpose of this driver is to enable its clock and PM
domain (if exist(s)), which are specified in the DT and managed from
platform and PM domain code, and to probe for child devices.

Due to the child-parent relationship with devices connected to the bus,
PM domain and clock state transitions are handled in the correct order.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
Tested-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
---
v4:
  - Bind against the generic "simple-pm-bus" instead of "renesas,bsc",
  - Explicitly call of_platform_populate() after pm_runtime_enable() to
    enforce ordering, instead of depending on claimed compatibility with
    "simple-bus",

v3:
  - Add Tested-by,

v2:
  - Rename from "Renesas Bus State Controller Driver" (renesas-bsc) to
    "Simple Power-Managed Bus Driver" (simple-pm-bus),
  - Change module license to GPL v2,
  - Change email address to geert+renesas@glider.be.
---
 drivers/bus/Kconfig         | 13 ++++++++++
 drivers/bus/Makefile        |  1 +
 drivers/bus/simple-pm-bus.c | 58 +++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 72 insertions(+)
 create mode 100644 drivers/bus/simple-pm-bus.c

diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig
index 626960819e6df16c..7e9c2674af81d6e9 100644
--- a/drivers/bus/Kconfig
+++ b/drivers/bus/Kconfig
@@ -58,6 +58,19 @@ config OMAP_OCP2SCP
 	  OCP2SCP and in OMAP5, both USB PHY and SATA PHY is connected via
 	  OCP2SCP.
 
+config SIMPLE_PM_BUS
+	bool "Simple Power-Managed Bus Driver"
+	depends on OF && PM
+	depends on ARCH_SHMOBILE || COMPILE_TEST
+	help
+	  Driver for transparent busses that don't need a real driver, but
+	  where the bus controller is part of a PM domain, or under the control
+	  of a functional clock, and thus relies on runtime PM for managing
+	  this PM domain and/or clock.
+	  An example of such a bus controller is the Renesas Bus State
+	  Controller (BSC, sometimes called "LBSC within Bus Bridge", or
+	  "External Bus Interface") as found on several Renesas ARM SoCs.
+
 config VEXPRESS_CONFIG
 	bool "Versatile Express configuration bus"
 	default y if ARCH_VEXPRESS
diff --git a/drivers/bus/Makefile b/drivers/bus/Makefile
index 3cfaf2c7f25ac4f0..e023a2bec664d900 100644
--- a/drivers/bus/Makefile
+++ b/drivers/bus/Makefile
@@ -14,4 +14,5 @@ obj-$(CONFIG_MVEBU_MBUS) 	+= mvebu-mbus.o
 obj-$(CONFIG_OMAP_INTERCONNECT)	+= omap_l3_smx.o omap_l3_noc.o
 
 obj-$(CONFIG_OMAP_OCP2SCP)	+= omap-ocp2scp.o
+obj-$(CONFIG_SIMPLE_PM_BUS)	+= simple-pm-bus.o
 obj-$(CONFIG_VEXPRESS_CONFIG)	+= vexpress-config.o
diff --git a/drivers/bus/simple-pm-bus.c b/drivers/bus/simple-pm-bus.c
new file mode 100644
index 0000000000000000..c5eb46cbf388b507
--- /dev/null
+++ b/drivers/bus/simple-pm-bus.c
@@ -0,0 +1,58 @@
+/*
+ * Simple Power-Managed Bus Driver
+ *
+ * Copyright (C) 2014-2015 Glider bvba
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License.  See the file "COPYING" in the main directory of this archive
+ * for more details.
+ */
+
+#include <linux/module.h>
+#include <linux/of_platform.h>
+#include <linux/platform_device.h>
+#include <linux/pm_runtime.h>
+
+
+static int simple_pm_bus_probe(struct platform_device *pdev)
+{
+	struct device_node *np = pdev->dev.of_node;
+
+	dev_dbg(&pdev->dev, "%s\n", __func__);
+
+	pm_runtime_enable(&pdev->dev);
+
+	if (np)
+		of_platform_populate(np, NULL, NULL, &pdev->dev);
+
+	return 0;
+}
+
+static int simple_pm_bus_remove(struct platform_device *pdev)
+{
+	dev_dbg(&pdev->dev, "%s\n", __func__);
+
+	pm_runtime_disable(&pdev->dev);
+	return 0;
+}
+
+static const struct of_device_id simple_pm_bus_of_match[] = {
+	{ .compatible = "simple-pm-bus", },
+	{ /* sentinel */ }
+};
+MODULE_DEVICE_TABLE(of, simple_pm_bus_of_match);
+
+static struct platform_driver simple_pm_bus_driver = {
+	.probe = simple_pm_bus_probe,
+	.remove = simple_pm_bus_remove,
+	.driver = {
+		.name = "simple-pm-bus",
+		.of_match_table = simple_pm_bus_of_match,
+	},
+};
+
+module_platform_driver(simple_pm_bus_driver);
+
+MODULE_DESCRIPTION("Simple Power-Managed Bus Driver");
+MODULE_AUTHOR("Geert Uytterhoeven <geert+renesas@glider.be>");
+MODULE_LICENSE("GPL v2");
-- 
1.9.1


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v4 0/5] drivers: bus: Add Simple Power-Managed Bus
  2015-01-26 16:16 [PATCH v4 0/5] drivers: bus: Add Simple Power-Managed Bus Geert Uytterhoeven
                   ` (4 preceding siblings ...)
  2015-01-26 16:16 ` [PATCH v4 5/5] drivers: bus: Add Simple Power-Managed Bus Driver Geert Uytterhoeven
@ 2015-01-27 17:42 ` Kevin Hilman
  5 siblings, 0 replies; 11+ messages in thread
From: Kevin Hilman @ 2015-01-27 17:42 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Grant Likely, Arnd Bergmann, Ulf Hansson, Rafael J. Wysocki,
	Felipe Balbi, Olof Johansson, Simon Horman, Magnus Damm,
	Greg Kroah-Hartman, devicetree, linux-sh, linux-pm,
	linux-arm-kernel, linux-kernel

Geert Uytterhoeven <geert+renesas@glider.be> writes:

>         Hi all,
>
> The Renesas Bus State Controller (BSC) provides an external bus for
> connecting multiple external devices to an SoC, driving several chip
> select lines, for e.g. NOR FLASH, Ethernet and USB.
> On the kzm9g and ape6evm development boards, an smsc9220 Ethernet
> controller is connnected to the BSC of an SH-Mobile AG5 (sh73a0) resp.
> R-Mobile APE6 (r8a73a4) SoC.
>
> The BSC is a fairly simple memory-mapped bus, hence a "simple-bus"
> compatibility seems suitable.  However, the BSC is special in two
> ways:
>   1. It is part of a PM domain (A4S on sh73a0),
>   2. It has a gateable functional clock (ZB).
> Before a device connected to the BSC can be accessed, the PM domain
> containing the BSC must be powered on, and the functional clock
> driving the BSC must be enabled.
>
> Both special properties can be described in DT in a standardized way
> ("power-domains = <&pd_a4s>" and "clocks = <&zb_clk>", cfr. the
> example in the DT binding documentation).  Externally connected
> devices are described as children of the BSC node.
>
> Unfortunately this doesn't mean everything will work out-of-the-box.
> There are two problems:
>   1. Without a device driver bound to the bus device, this device is
>      not attached to the PM domain. And although a child device is
>      present and active, the PM domain may be powered down, as it's
>      considered unused by the PM domain core.
>   2. Without a device driver calling pm_runtime_enable(), its
>      functional clock is not enabled. Once runtime PM is enabled, the
>      R-Mobile PM domain platform driver manages the functional clock
>      using runtime PM.
>
> As none of the above is really bus hardware-specific (PM domains and
> functional clocks in clock domains are handled from genpd and platform
> code), this series adds a Simple Power-Managed Bus driver for
> transparent busses, which matches against "simple-pm-bus", enables
> runtime PM for the bus device, and calls of_platform_populate() to
> probe for child devices.
> Due to the child-parent relationship of devices connected to the bus,
> as long as the device drivers for the child devices are runtime PM
> enabled, the bus's PM domain will be powered, and the bus's clock will
> be enabled automatically when needed, for both runtime PM and s2ram.
>
> This was tested on sh73a0/kzm9g-multiplatform (by me), and (v3) on
> r8a73a4/ape6evm-multiplatform (by Ulrich Hecht). Without this,
> Ethernet doesn't work, as the ZB clock is disabled by
> clk_disable_unused().
>
> Felipe: It looks like drivers/usb/musb/musb_am335x.c can be removed, if
> "ti,am33xx-usb" claims compatibility with "simple-pm-bus"?
>
> As drivers/bus doesn't have a maintainer, and this driver is needed to
> move two shmobile platforms away from legacy to multiplatform, I think
> this can go in through Simon's shmobile tree.
>
> Changes compared to v3:
>   - Replace "simple-bus" by "simple-pm-bus" in the bindings,
>   - Move the "renesas,bsc" bindings to a separate document,
>   - Bind against the generic "simple-pm-bus" instead of "renesas,bsc",
>   - Explicitly call of_platform_populate() after pm_runtime_enable() to
>     enforce ordering, instead of depending on claimed compatibility with
>     "simple-bus".
>
> Changes compared to v2:
>   - Document required properties inherited from "simple-bus",
>   - Document required "reg" property for "renesas,bsc",
>   - Move "ranges" before "reg" in the example,
>   - Add Tested-by,
>   - Split-off sh73a0/kzm9g and r8a73a4/ape6evm DTS updates.
>
> Changes compared to v1 (more detailed change logs in the individual
> patches):
>   - Added sorting of drivers/bus Kconfig and Makefile entries,
>   - Added DT binding documentation,
>   - Rename from "Renesas Bus State Controller Driver" (renesas-bsc) to
>     "Simple Power-Managed Bus Driver" (simple-pm-bus),
>   - Postponed adding power-domains properties to the dtsi,
>   - Added updates for r8a73a4/ape6evm.
>
> Thanks for your comments!

Reviewed-by: Kevin Hilman <khilman@linaro.org>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v4 3/5] drivers: bus: Add Simple Power-Managed Bus DT Bindings
  2015-01-26 16:16 ` [PATCH v4 3/5] drivers: bus: Add Simple Power-Managed Bus DT Bindings Geert Uytterhoeven
@ 2015-01-27 18:17   ` Mark Rutland
  2015-01-28 15:38     ` Geert Uytterhoeven
  0 siblings, 1 reply; 11+ messages in thread
From: Mark Rutland @ 2015-01-27 18:17 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rob Herring, Pawel Moll, Ian Campbell, Kumar Gala, grant.likely,
	Arnd Bergmann, Kevin Hilman, Ulf Hansson, Rafael J. Wysocki,
	Felipe Balbi, Olof Johansson, Simon Horman, Magnus Damm,
	Greg Kroah-Hartman, devicetree, linux-sh, linux-pm,
	linux-arm-kernel, linux-kernel

On Mon, Jan 26, 2015 at 04:16:15PM +0000, Geert Uytterhoeven wrote:
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Tested-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
> ---
> v4:
>   - Replace "simple-bus" by "simple-pm-bus",
>   - Remove the "renesas,bsc" bindings. They will be specified in a
>     separate document.
> 
> v3:
>   - Add Tested-by,
>   - Document required properties inherited from "simple-bus",
>   - Document required "reg" property for "renesas,bsc",
>   - Move "ranges" before "reg" in the example,
> 
> v2:
>   - New.
> ---
>  .../devicetree/bindings/bus/simple-pm-bus.txt      | 41 ++++++++++++++++++++++
>  1 file changed, 41 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/bus/simple-pm-bus.txt
> 
> diff --git a/Documentation/devicetree/bindings/bus/simple-pm-bus.txt b/Documentation/devicetree/bindings/bus/simple-pm-bus.txt
> new file mode 100644
> index 0000000000000000..0415e93a816c5ac0
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/bus/simple-pm-bus.txt
> @@ -0,0 +1,41 @@
> +Simple Power-Managed Bus
> +========================
> +
> +A Simple Power-Managed Bus is a transparent bus that doesn't need a real
> +driver, as it's typically initialized by the boot loader.
> +
> +However, its bus controller is part of a PM domain, or under the control of a
> +functional clock.  Hence, the bus controller's PM domain and/or clock must be
> +enabled for child devices connected to the bus (either on-SoC or externally)
> +to function.
> +
> +The bindings for the Simple Power-Managed Bus extend the bindings for
> +"simple-bus", as specified in ePAPR.

I would note that "simple-pm-bus" follows the "simple-bus" set of
properties, but is not an extension of "simple-bus".

For the reasons I mentioned previously, I don't think that any
"simple-pm-bus" should be "simple-bus" compatible (and I believe we
should document that requirement below).

> +
> +
> +Required properties:
> +  - compatible: Must contain at least "simple-pm-bus".
> +		It's recommended to let this be preceded by one or more
> +		vendor-specific compatible values.
> +  - #address-cells, #size-cells, ranges: Must describe the mapping between
> +		parent address and child address spaces.
> +
> +Optional platform-specific properties for clock or PM domain control (at least
> +one of them is required):
> +  - clocks: Must contain a reference to the functional clock(s),

I'm a little worried about the clocks. What are the expectations on
their configuration?

I don't see how we can generally rely on the clock configuration being
correct unless the input clocks only have on/off controls, and the OS
doesn't see any of the parent clock tree it could potentially change the
configuration of (beyond on/off).

Otherwise we're relying on implicit behaviour elsewhere in Linux (which
_will_ break over time), and this ends up not being usable by anything
else.

I'm coming to the opinion that while we might be able to have common
driver in Linux, we can't have a common "simple-pm-bus" binding because
it implicitly assumes too much about the OS behaviour.

Thanks,
Mark.

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v4 3/5] drivers: bus: Add Simple Power-Managed Bus DT Bindings
  2015-01-27 18:17   ` Mark Rutland
@ 2015-01-28 15:38     ` Geert Uytterhoeven
  0 siblings, 0 replies; 11+ messages in thread
From: Geert Uytterhoeven @ 2015-01-28 15:38 UTC (permalink / raw)
  To: Mark Rutland
  Cc: Geert Uytterhoeven, Rob Herring, Pawel Moll, Ian Campbell,
	Kumar Gala, grant.likely, Arnd Bergmann, Kevin Hilman,
	Ulf Hansson, Rafael J. Wysocki, Felipe Balbi, Olof Johansson,
	Simon Horman, Magnus Damm, Greg Kroah-Hartman, devicetree,
	linux-sh, linux-pm, linux-arm-kernel, linux-kernel

Hi Mark,

On Tue, Jan 27, 2015 at 7:17 PM, Mark Rutland <mark.rutland@arm.com> wrote:
>> --- /dev/null
>> +++ b/Documentation/devicetree/bindings/bus/simple-pm-bus.txt
>> @@ -0,0 +1,41 @@
>> +Simple Power-Managed Bus
>> +========================
>> +
>> +A Simple Power-Managed Bus is a transparent bus that doesn't need a real
>> +driver, as it's typically initialized by the boot loader.
>> +
>> +However, its bus controller is part of a PM domain, or under the control of a
>> +functional clock.  Hence, the bus controller's PM domain and/or clock must be
>> +enabled for child devices connected to the bus (either on-SoC or externally)
>> +to function.
>> +
>> +The bindings for the Simple Power-Managed Bus extend the bindings for
>> +"simple-bus", as specified in ePAPR.
>
> I would note that "simple-pm-bus" follows the "simple-bus" set of
> properties, but is not an extension of "simple-bus".

OK.

> For the reasons I mentioned previously, I don't think that any
> "simple-pm-bus" should be "simple-bus" compatible (and I believe we
> should document that requirement below).

>> +Required properties:
>> +  - compatible: Must contain at least "simple-pm-bus".

So you think I should add 'and must not contain "simple-bus"'?

>> +             It's recommended to let this be preceded by one or more
>> +             vendor-specific compatible values.
>> +  - #address-cells, #size-cells, ranges: Must describe the mapping between
>> +             parent address and child address spaces.
>> +
>> +Optional platform-specific properties for clock or PM domain control (at least
>> +one of them is required):
>> +  - clocks: Must contain a reference to the functional clock(s),
>
> I'm a little worried about the clocks. What are the expectations on
> their configuration?

The clocks are highly platform-dependent. Hence the exact expectations
belong in the binding documentation for the clock provider (and possibly
the PM domain provider, too).

> I don't see how we can generally rely on the clock configuration being
> correct unless the input clocks only have on/off controls, and the OS
> doesn't see any of the parent clock tree it could potentially change the
> configuration of (beyond on/off).

This is indeed not about generic programmable clock generators, but about
clocks that are used solely to start/stop a hardware module by (un)gating
a functional clock.

> Otherwise we're relying on implicit behaviour elsewhere in Linux (which
> _will_ break over time), and this ends up not being usable by anything
> else.
>
> I'm coming to the opinion that while we might be able to have common
> driver in Linux, we can't have a common "simple-pm-bus" binding because
> it implicitly assumes too much about the OS behaviour.

If the bus controller is clocked from a generic programmable clock generator,
it would need its own driver to configure e.g. the clock frequency, which
could need more information from DT. This is not covered by "simple-pm-bus".

Thanks for your comments!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@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

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v4 5/5] drivers: bus: Add Simple Power-Managed Bus Driver
  2015-01-26 16:16 ` [PATCH v4 5/5] drivers: bus: Add Simple Power-Managed Bus Driver Geert Uytterhoeven
@ 2015-01-30  9:34   ` Ulf Hansson
  2015-02-01  9:36     ` Geert Uytterhoeven
  0 siblings, 1 reply; 11+ messages in thread
From: Ulf Hansson @ 2015-01-30  9:34 UTC (permalink / raw)
  To: Geert Uytterhoeven
  Cc: Rob Herring, Pawel Moll, Mark Rutland, Ian Campbell, Kumar Gala,
	Grant Likely, Arnd Bergmann, Kevin Hilman, Rafael J. Wysocki,
	Felipe Balbi, Olof Johansson, Simon Horman, Magnus Damm,
	Greg Kroah-Hartman, devicetree, Linux-sh list, linux-pm,
	linux-arm-kernel, linux-kernel

On 26 January 2015 at 17:16, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
> Add a driver for transparent busses that don't need a real driver, but
> where the bus controller is part of a PM domain, or under the control of
> a functional clock.  Typically, the bus controller's PM domain and/or
> clock must be enabled for child devices connected to the bus (either
> on-SoC or externally) to function.
>
> Hence the sole purpose of this driver is to enable its clock and PM
> domain (if exist(s)), which are specified in the DT and managed from
> platform and PM domain code, and to probe for child devices.
>
> Due to the child-parent relationship with devices connected to the bus,
> PM domain and clock state transitions are handled in the correct order.
>
> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
> Tested-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>
> ---
> v4:
>   - Bind against the generic "simple-pm-bus" instead of "renesas,bsc",
>   - Explicitly call of_platform_populate() after pm_runtime_enable() to
>     enforce ordering, instead of depending on claimed compatibility with
>     "simple-bus",
>
> v3:
>   - Add Tested-by,
>
> v2:
>   - Rename from "Renesas Bus State Controller Driver" (renesas-bsc) to
>     "Simple Power-Managed Bus Driver" (simple-pm-bus),
>   - Change module license to GPL v2,
>   - Change email address to geert+renesas@glider.be.
> ---
>  drivers/bus/Kconfig         | 13 ++++++++++
>  drivers/bus/Makefile        |  1 +
>  drivers/bus/simple-pm-bus.c | 58 +++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 72 insertions(+)
>  create mode 100644 drivers/bus/simple-pm-bus.c
>
> diff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig
> index 626960819e6df16c..7e9c2674af81d6e9 100644
> --- a/drivers/bus/Kconfig
> +++ b/drivers/bus/Kconfig
> @@ -58,6 +58,19 @@ config OMAP_OCP2SCP
>           OCP2SCP and in OMAP5, both USB PHY and SATA PHY is connected via
>           OCP2SCP.
>
> +config SIMPLE_PM_BUS
> +       bool "Simple Power-Managed Bus Driver"
> +       depends on OF && PM
> +       depends on ARCH_SHMOBILE || COMPILE_TEST
> +       help
> +         Driver for transparent busses that don't need a real driver, but
> +         where the bus controller is part of a PM domain, or under the control
> +         of a functional clock, and thus relies on runtime PM for managing
> +         this PM domain and/or clock.
> +         An example of such a bus controller is the Renesas Bus State
> +         Controller (BSC, sometimes called "LBSC within Bus Bridge", or
> +         "External Bus Interface") as found on several Renesas ARM SoCs.
> +
>  config VEXPRESS_CONFIG
>         bool "Versatile Express configuration bus"
>         default y if ARCH_VEXPRESS
> diff --git a/drivers/bus/Makefile b/drivers/bus/Makefile
> index 3cfaf2c7f25ac4f0..e023a2bec664d900 100644
> --- a/drivers/bus/Makefile
> +++ b/drivers/bus/Makefile
> @@ -14,4 +14,5 @@ obj-$(CONFIG_MVEBU_MBUS)      += mvebu-mbus.o
>  obj-$(CONFIG_OMAP_INTERCONNECT)        += omap_l3_smx.o omap_l3_noc.o
>
>  obj-$(CONFIG_OMAP_OCP2SCP)     += omap-ocp2scp.o
> +obj-$(CONFIG_SIMPLE_PM_BUS)    += simple-pm-bus.o
>  obj-$(CONFIG_VEXPRESS_CONFIG)  += vexpress-config.o
> diff --git a/drivers/bus/simple-pm-bus.c b/drivers/bus/simple-pm-bus.c
> new file mode 100644
> index 0000000000000000..c5eb46cbf388b507
> --- /dev/null
> +++ b/drivers/bus/simple-pm-bus.c
> @@ -0,0 +1,58 @@
> +/*
> + * Simple Power-Managed Bus Driver
> + *
> + * Copyright (C) 2014-2015 Glider bvba
> + *
> + * This file is subject to the terms and conditions of the GNU General Public
> + * License.  See the file "COPYING" in the main directory of this archive
> + * for more details.
> + */
> +
> +#include <linux/module.h>
> +#include <linux/of_platform.h>
> +#include <linux/platform_device.h>
> +#include <linux/pm_runtime.h>
> +
> +
> +static int simple_pm_bus_probe(struct platform_device *pdev)
> +{
> +       struct device_node *np = pdev->dev.of_node;
> +
> +       dev_dbg(&pdev->dev, "%s\n", __func__);
> +
> +       pm_runtime_enable(&pdev->dev);
> +
> +       if (np)
> +               of_platform_populate(np, NULL, NULL, &pdev->dev);
> +

I am not sure my comments is valid in this initial step. Yet, you
state in the DT documentation, that this driver supports clocks and PM
domains.

How you are going add that support it quite interesting. :-) I also
especially interested how the interaction (child to parents) through
runtime PM will look like.

Overall, I like the idea in patchset, but I would like to understand a
bit more around the above.

Kind regards
Uffe

> +       return 0;
> +}
> +
> +static int simple_pm_bus_remove(struct platform_device *pdev)
> +{
> +       dev_dbg(&pdev->dev, "%s\n", __func__);
> +
> +       pm_runtime_disable(&pdev->dev);
> +       return 0;
> +}
> +
> +static const struct of_device_id simple_pm_bus_of_match[] = {
> +       { .compatible = "simple-pm-bus", },
> +       { /* sentinel */ }
> +};
> +MODULE_DEVICE_TABLE(of, simple_pm_bus_of_match);
> +
> +static struct platform_driver simple_pm_bus_driver = {
> +       .probe = simple_pm_bus_probe,
> +       .remove = simple_pm_bus_remove,
> +       .driver = {
> +               .name = "simple-pm-bus",
> +               .of_match_table = simple_pm_bus_of_match,
> +       },
> +};
> +
> +module_platform_driver(simple_pm_bus_driver);
> +
> +MODULE_DESCRIPTION("Simple Power-Managed Bus Driver");
> +MODULE_AUTHOR("Geert Uytterhoeven <geert+renesas@glider.be>");
> +MODULE_LICENSE("GPL v2");
> --
> 1.9.1
>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH v4 5/5] drivers: bus: Add Simple Power-Managed Bus Driver
  2015-01-30  9:34   ` Ulf Hansson
@ 2015-02-01  9:36     ` Geert Uytterhoeven
  0 siblings, 0 replies; 11+ messages in thread
From: Geert Uytterhoeven @ 2015-02-01  9:36 UTC (permalink / raw)
  To: Ulf Hansson
  Cc: Geert Uytterhoeven, Rob Herring, Pawel Moll, Mark Rutland,
	Ian Campbell, Kumar Gala, Grant Likely, Arnd Bergmann,
	Kevin Hilman, Rafael J. Wysocki, Felipe Balbi, Olof Johansson,
	Simon Horman, Magnus Damm, Greg Kroah-Hartman, devicetree,
	Linux-sh list, linux-pm, linux-arm-kernel, linux-kernel

Hi Ulf,

On Fri, Jan 30, 2015 at 10:34 AM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
> On 26 January 2015 at 17:16, Geert Uytterhoeven <geert+renesas@glider.be> wrote:
>> Add a driver for transparent busses that don't need a real driver, but
>> where the bus controller is part of a PM domain, or under the control of
>> a functional clock.  Typically, the bus controller's PM domain and/or
>> clock must be enabled for child devices connected to the bus (either
>> on-SoC or externally) to function.
>>
>> Hence the sole purpose of this driver is to enable its clock and PM
>> domain (if exist(s)), which are specified in the DT and managed from
>> platform and PM domain code, and to probe for child devices.
>>
>> Due to the child-parent relationship with devices connected to the bus,
>> PM domain and clock state transitions are handled in the correct order.
>>
>> Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
>> Tested-by: Ulrich Hecht <ulrich.hecht+renesas@gmail.com>

>> --- /dev/null
>> +++ b/drivers/bus/simple-pm-bus.c

>> +static int simple_pm_bus_probe(struct platform_device *pdev)
>> +{
>> +       struct device_node *np = pdev->dev.of_node;
>> +
>> +       dev_dbg(&pdev->dev, "%s\n", __func__);
>> +
>> +       pm_runtime_enable(&pdev->dev);
>> +
>> +       if (np)
>> +               of_platform_populate(np, NULL, NULL, &pdev->dev);
>> +
>
> I am not sure my comments is valid in this initial step. Yet, you
> state in the DT documentation, that this driver supports clocks and PM
> domains.
>
> How you are going add that support it quite interesting. :-) I also

The clock can be controlled through e.g. pm_clk domain (pm_clk_notifier
and pm_clk_{suspend,resume}()) or genpd (GENPD_FLAG_PM_CLK,
which you have added yourself ;-)

> especially interested how the interaction (child to parents) through
> runtime PM will look like.

When a child is to be runtime-resumed, the core make sure the parent is
runtime-resumed. When all children have been runtime-suspended, the parent
is runtime-suspended. This is already working. This patch series is the
only missing piece: without a driver that calls pm_runtime_enable(), the
parent is not runtime-managed.

> Overall, I like the idea in patchset, but I would like to understand a
> bit more around the above.

Thanks!

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@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

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-02-01  9:37 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-26 16:16 [PATCH v4 0/5] drivers: bus: Add Simple Power-Managed Bus Geert Uytterhoeven
2015-01-26 16:16 ` [PATCH v4 1/5] drivers: bus: Sort Kconfig entries alphabetically Geert Uytterhoeven
2015-01-26 16:16 ` [PATCH v4 2/5] drivers: bus: Sort Makefile " Geert Uytterhoeven
2015-01-26 16:16 ` [PATCH v4 3/5] drivers: bus: Add Simple Power-Managed Bus DT Bindings Geert Uytterhoeven
2015-01-27 18:17   ` Mark Rutland
2015-01-28 15:38     ` Geert Uytterhoeven
2015-01-26 16:16 ` [PATCH v4 4/5] drivers: bus: Add Renesas Bus State Controller (BSC) " Geert Uytterhoeven
2015-01-26 16:16 ` [PATCH v4 5/5] drivers: bus: Add Simple Power-Managed Bus Driver Geert Uytterhoeven
2015-01-30  9:34   ` Ulf Hansson
2015-02-01  9:36     ` Geert Uytterhoeven
2015-01-27 17:42 ` [PATCH v4 0/5] drivers: bus: Add Simple Power-Managed Bus Kevin Hilman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).