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

soc: samsung: exynos-pmu: instantiate clkout driver as MFD

The Exynos clock output (clkout) driver uses same register address space
(Power Management Unit address space) as Exynos PMU driver and same set
of compatibles. It was modeled as clock provider instantiated with
CLK_OF_DECLARE_DRIVER().

This however brings ordering problems and lack of probe deferral,
therefore clkout driver should be converted to a regular module and
instantiated as a child of PMU driver to be able to use existing
compatibles and address space.

Signed-off-by: Krzysztof Kozlowski <krzk@kernel.org>
Tested-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Reviewed-by: Sylwester Nawrocki <s.nawrocki@samsung.com>
Reviewed-by: Stephen Boyd <sboyd@kernel.org>
Link: https://lore.kernel.org/r/20201001165646.32279-2-krzk@kernel.org

+11
+11
drivers/soc/samsung/exynos-pmu.c
··· 8 8 #include <linux/of.h> 9 9 #include <linux/of_address.h> 10 10 #include <linux/of_device.h> 11 + #include <linux/mfd/core.h> 11 12 #include <linux/mfd/syscon.h> 12 13 #include <linux/platform_device.h> 13 14 #include <linux/delay.h> ··· 98 97 { /*sentinel*/ }, 99 98 }; 100 99 100 + static const struct mfd_cell exynos_pmu_devs[] = { 101 + { .name = "exynos-clkout", }, 102 + }; 103 + 101 104 struct regmap *exynos_get_pmu_regmap(void) 102 105 { 103 106 struct device_node *np = of_find_matching_node(NULL, ··· 115 110 static int exynos_pmu_probe(struct platform_device *pdev) 116 111 { 117 112 struct device *dev = &pdev->dev; 113 + int ret; 118 114 119 115 pmu_base_addr = devm_platform_ioremap_resource(pdev, 0); 120 116 if (IS_ERR(pmu_base_addr)) ··· 133 127 pmu_context->pmu_data->pmu_init(); 134 128 135 129 platform_set_drvdata(pdev, pmu_context); 130 + 131 + ret = devm_mfd_add_devices(dev, PLATFORM_DEVID_NONE, exynos_pmu_devs, 132 + ARRAY_SIZE(exynos_pmu_devs), NULL, 0, NULL); 133 + if (ret) 134 + return ret; 136 135 137 136 if (devm_of_platform_populate(dev)) 138 137 dev_err(dev, "Error populating children, reboot and poweroff might not work properly\n");