Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drivers: bus: Add Simple Power-Managed Bus Driver

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>
Reviewed-by: Kevin Hilman <khilman@linaro.org>
Signed-off-by: Simon Horman <horms+renesas@verge.net.au>

authored by

Geert Uytterhoeven and committed by
Simon Horman
89d463ea b1e5bbd6

+72
+13
drivers/bus/Kconfig
··· 58 58 OCP2SCP and in OMAP5, both USB PHY and SATA PHY is connected via 59 59 OCP2SCP. 60 60 61 + config SIMPLE_PM_BUS 62 + bool "Simple Power-Managed Bus Driver" 63 + depends on OF && PM 64 + depends on ARCH_SHMOBILE || COMPILE_TEST 65 + help 66 + Driver for transparent busses that don't need a real driver, but 67 + where the bus controller is part of a PM domain, or under the control 68 + of a functional clock, and thus relies on runtime PM for managing 69 + this PM domain and/or clock. 70 + An example of such a bus controller is the Renesas Bus State 71 + Controller (BSC, sometimes called "LBSC within Bus Bridge", or 72 + "External Bus Interface") as found on several Renesas ARM SoCs. 73 + 61 74 config VEXPRESS_CONFIG 62 75 bool "Versatile Express configuration bus" 63 76 default y if ARCH_VEXPRESS
+1
drivers/bus/Makefile
··· 14 14 obj-$(CONFIG_OMAP_INTERCONNECT) += omap_l3_smx.o omap_l3_noc.o 15 15 16 16 obj-$(CONFIG_OMAP_OCP2SCP) += omap-ocp2scp.o 17 + obj-$(CONFIG_SIMPLE_PM_BUS) += simple-pm-bus.o 17 18 obj-$(CONFIG_VEXPRESS_CONFIG) += vexpress-config.o
+58
drivers/bus/simple-pm-bus.c
··· 1 + /* 2 + * Simple Power-Managed Bus Driver 3 + * 4 + * Copyright (C) 2014-2015 Glider bvba 5 + * 6 + * This file is subject to the terms and conditions of the GNU General Public 7 + * License. See the file "COPYING" in the main directory of this archive 8 + * for more details. 9 + */ 10 + 11 + #include <linux/module.h> 12 + #include <linux/of_platform.h> 13 + #include <linux/platform_device.h> 14 + #include <linux/pm_runtime.h> 15 + 16 + 17 + static int simple_pm_bus_probe(struct platform_device *pdev) 18 + { 19 + struct device_node *np = pdev->dev.of_node; 20 + 21 + dev_dbg(&pdev->dev, "%s\n", __func__); 22 + 23 + pm_runtime_enable(&pdev->dev); 24 + 25 + if (np) 26 + of_platform_populate(np, NULL, NULL, &pdev->dev); 27 + 28 + return 0; 29 + } 30 + 31 + static int simple_pm_bus_remove(struct platform_device *pdev) 32 + { 33 + dev_dbg(&pdev->dev, "%s\n", __func__); 34 + 35 + pm_runtime_disable(&pdev->dev); 36 + return 0; 37 + } 38 + 39 + static const struct of_device_id simple_pm_bus_of_match[] = { 40 + { .compatible = "simple-pm-bus", }, 41 + { /* sentinel */ } 42 + }; 43 + MODULE_DEVICE_TABLE(of, simple_pm_bus_of_match); 44 + 45 + static struct platform_driver simple_pm_bus_driver = { 46 + .probe = simple_pm_bus_probe, 47 + .remove = simple_pm_bus_remove, 48 + .driver = { 49 + .name = "simple-pm-bus", 50 + .of_match_table = simple_pm_bus_of_match, 51 + }, 52 + }; 53 + 54 + module_platform_driver(simple_pm_bus_driver); 55 + 56 + MODULE_DESCRIPTION("Simple Power-Managed Bus Driver"); 57 + MODULE_AUTHOR("Geert Uytterhoeven <geert+renesas@glider.be>"); 58 + MODULE_LICENSE("GPL v2");