From e37ef6dcdb1f4738b01cec7fb7be46af07816af9 Mon Sep 17 00:00:00 2001 From: David Virag Date: Fri, 10 Sep 2021 00:28:12 +0200 Subject: soc: samsung: exynos-pmu: Fix compilation when nothing selects CONFIG_MFD_CORE Commit 93618e344a5e ("soc: samsung: exynos-pmu: instantiate clkout driver as MFD") adds a "devm_mfd_add_devices" call in the exynos-pmu driver which depends on CONFIG_MFD_CORE. If no driver selects that config, the build will fail if CONFIG_EXYNOS_PMU is enabled with the following error: drivers/soc/samsung/exynos-pmu.c:137: undefined reference to `devm_mfd_add_devices' Fix this by making CONFIG_EXYNOS_PMU select CONFIG_MFD_CORE. Fixes: 93618e344a5e ("soc: samsung: exynos-pmu: instantiate clkout driver as MFD") Cc: Signed-off-by: David Virag Link: https://lore.kernel.org/r/20210909222812.108614-1-virag.david003@gmail.com Signed-off-by: Krzysztof Kozlowski --- drivers/soc/samsung/Kconfig | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers') diff --git a/drivers/soc/samsung/Kconfig b/drivers/soc/samsung/Kconfig index 5745d7e5908e..1f643c0f5c93 100644 --- a/drivers/soc/samsung/Kconfig +++ b/drivers/soc/samsung/Kconfig @@ -25,6 +25,7 @@ config EXYNOS_PMU bool "Exynos PMU controller driver" if COMPILE_TEST depends on ARCH_EXYNOS || ((ARM || ARM64) && COMPILE_TEST) select EXYNOS_PMU_ARM_DRIVERS if ARM && ARCH_EXYNOS + select MFD_CORE # There is no need to enable these drivers for ARMv8 config EXYNOS_PMU_ARM_DRIVERS -- cgit From d1141886c8d72ad77920e6e4b617d366e6e3ee8a Mon Sep 17 00:00:00 2001 From: Krzysztof Kozlowski Date: Sun, 19 Sep 2021 11:31:12 +0200 Subject: soc: samsung: exynos-chipid: avoid soc_device_to_device() soc_device_to_device() seems to be discouraged [1] so remove it in favor of printing info message with platform device. This will only change the prefix in the info message from "soc soc0: " to "exynos-chipid 10000000.chipid:". [1] https://lore.kernel.org/lkml/20191111052741.GB3176397@kroah.com/ Signed-off-by: Krzysztof Kozlowski Reviewed-by: Sylwester Nawrocki Tested-by: Sylwester Nawrocki Reviewed-by: Alim Akhtar Tested-by: Alim Akhtar Link: https://lore.kernel.org/r/20210919093114.35987-2-krzysztof.kozlowski@canonical.com --- drivers/soc/samsung/exynos-chipid.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'drivers') diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c index 5c1d0f97f766..dcd9a08ce706 100644 --- a/drivers/soc/samsung/exynos-chipid.c +++ b/drivers/soc/samsung/exynos-chipid.c @@ -104,8 +104,7 @@ static int exynos_chipid_probe(struct platform_device *pdev) platform_set_drvdata(pdev, soc_dev); - dev_info(soc_device_to_device(soc_dev), - "Exynos: CPU[%s] PRO_ID[0x%x] REV[0x%x] Detected\n", + dev_info(&pdev->dev, "Exynos: CPU[%s] PRO_ID[0x%x] REV[0x%x] Detected\n", soc_dev_attr->soc_id, product_id, revision); return 0; -- cgit From 1e3e559f8d4e5b4c873414078facb35273ecbf4b Mon Sep 17 00:00:00 2001 From: Krzysztof Kozlowski Date: Sun, 19 Sep 2021 11:31:13 +0200 Subject: soc: samsung: exynos-chipid: convert to a module Exynos ChipID and ASV (Adaptive Supply Voltage) driver is not essential to system boot and it can successfully be built and loaded as module. This makes core kernel image smaller and reduces the memory footprint when multi-platform kernel is booted on non-Exynos board. Usually it is also distro-friendly. Add multiple authors of the driver since its conversion from mach-exynos, ordered alphabetically by first name. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Sylwester Nawrocki Tested-by: Sylwester Nawrocki Reviewed-by: Alim Akhtar Tested-by: Alim Akhtar Link: https://lore.kernel.org/r/20210919093114.35987-3-krzysztof.kozlowski@canonical.com --- drivers/soc/samsung/Kconfig | 3 ++- drivers/soc/samsung/Makefile | 3 ++- drivers/soc/samsung/exynos-chipid.c | 11 ++++++++++- drivers/soc/samsung/exynos5422-asv.c | 1 + 4 files changed, 15 insertions(+), 3 deletions(-) (limited to 'drivers') diff --git a/drivers/soc/samsung/Kconfig b/drivers/soc/samsung/Kconfig index 1f643c0f5c93..fe139f26d093 100644 --- a/drivers/soc/samsung/Kconfig +++ b/drivers/soc/samsung/Kconfig @@ -13,13 +13,14 @@ config EXYNOS_ASV_ARM depends on EXYNOS_CHIPID config EXYNOS_CHIPID - bool "Exynos ChipID controller and ASV driver" if COMPILE_TEST + tristate "Exynos ChipID controller and ASV driver" if COMPILE_TEST depends on ARCH_EXYNOS || COMPILE_TEST select EXYNOS_ASV_ARM if ARM && ARCH_EXYNOS select MFD_SYSCON select SOC_BUS help Support for Samsung Exynos SoC ChipID and Adaptive Supply Voltage. + This driver can also be built as module (exynos_chipid). config EXYNOS_PMU bool "Exynos PMU controller driver" if COMPILE_TEST diff --git a/drivers/soc/samsung/Makefile b/drivers/soc/samsung/Makefile index 0c523a8de4eb..2ae4bea804cf 100644 --- a/drivers/soc/samsung/Makefile +++ b/drivers/soc/samsung/Makefile @@ -1,8 +1,9 @@ # SPDX-License-Identifier: GPL-2.0 obj-$(CONFIG_EXYNOS_ASV_ARM) += exynos5422-asv.o +obj-$(CONFIG_EXYNOS_CHIPID) += exynos_chipid.o +exynos_chipid-y += exynos-chipid.o exynos-asv.o -obj-$(CONFIG_EXYNOS_CHIPID) += exynos-chipid.o exynos-asv.o obj-$(CONFIG_EXYNOS_PMU) += exynos-pmu.o obj-$(CONFIG_EXYNOS_PMU_ARM_DRIVERS) += exynos3250-pmu.o exynos4-pmu.o \ diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c index dcd9a08ce706..b2627a3a127a 100644 --- a/drivers/soc/samsung/exynos-chipid.c +++ b/drivers/soc/samsung/exynos-chipid.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include #include @@ -128,6 +129,7 @@ static const struct of_device_id exynos_chipid_of_device_ids[] = { { .compatible = "samsung,exynos4210-chipid" }, {} }; +MODULE_DEVICE_TABLE(of, exynos_chipid_of_device_ids); static struct platform_driver exynos_chipid_driver = { .driver = { @@ -137,4 +139,11 @@ static struct platform_driver exynos_chipid_driver = { .probe = exynos_chipid_probe, .remove = exynos_chipid_remove, }; -builtin_platform_driver(exynos_chipid_driver); +module_platform_driver(exynos_chipid_driver); + +MODULE_DESCRIPTION("Samsung Exynos ChipID controller and ASV driver"); +MODULE_AUTHOR("Bartlomiej Zolnierkiewicz "); +MODULE_AUTHOR("Krzysztof Kozlowski "); +MODULE_AUTHOR("Pankaj Dubey "); +MODULE_AUTHOR("Sylwester Nawrocki "); +MODULE_LICENSE("GPL"); diff --git a/drivers/soc/samsung/exynos5422-asv.c b/drivers/soc/samsung/exynos5422-asv.c index ca409a976e34..475ae5276529 100644 --- a/drivers/soc/samsung/exynos5422-asv.c +++ b/drivers/soc/samsung/exynos5422-asv.c @@ -503,3 +503,4 @@ int exynos5422_asv_init(struct exynos_asv *asv) return 0; } +EXPORT_SYMBOL_GPL(exynos5422_asv_init); -- cgit From 140bbfe7cd4be0aa6543f94d3994e4774b325abc Mon Sep 17 00:00:00 2001 From: Krzysztof Kozlowski Date: Sun, 19 Sep 2021 11:31:14 +0200 Subject: soc: samsung: exynos-chipid: do not enforce built-in After converting the Exynos ChipID and ASV driver to a module, allow to actually choose it to be a module, while being a default built-in. The side effect is that driver could be now entirely disabled even for kernel with ARCH_EXYNOS, but this is not a critical issue because driver is not necessary for the proper platform boot. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Sylwester Nawrocki Tested-by: Sylwester Nawrocki Reviewed-by: Alim Akhtar Tested-by: Alim Akhtar Link: https://lore.kernel.org/r/20210919093114.35987-4-krzysztof.kozlowski@canonical.com --- drivers/soc/samsung/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'drivers') diff --git a/drivers/soc/samsung/Kconfig b/drivers/soc/samsung/Kconfig index fe139f26d093..e2cedef1e8d1 100644 --- a/drivers/soc/samsung/Kconfig +++ b/drivers/soc/samsung/Kconfig @@ -13,8 +13,9 @@ config EXYNOS_ASV_ARM depends on EXYNOS_CHIPID config EXYNOS_CHIPID - tristate "Exynos ChipID controller and ASV driver" if COMPILE_TEST + tristate "Exynos ChipID controller and ASV driver" depends on ARCH_EXYNOS || COMPILE_TEST + default ARCH_EXYNOS select EXYNOS_ASV_ARM if ARM && ARCH_EXYNOS select MFD_SYSCON select SOC_BUS -- cgit From 178d6c1b83e5244b866d90071246b3b0135c3f7d Mon Sep 17 00:00:00 2001 From: Krzysztof Kozlowski Date: Fri, 8 Oct 2021 09:52:53 +0200 Subject: soc: samsung: pm_domains: drop unused is_off field The 'is_off' member of internal state structure 'exynos_pm_domain' is not used anymore. Fixes: 2ed5f236716c ("ARM: EXYNOS: Detect power domain state on registration from DT") Signed-off-by: Krzysztof Kozlowski Link: https://lore.kernel.org/r/20211008075253.67961-1-krzysztof.kozlowski@canonical.com --- drivers/soc/samsung/pm_domains.c | 1 - 1 file changed, 1 deletion(-) (limited to 'drivers') diff --git a/drivers/soc/samsung/pm_domains.c b/drivers/soc/samsung/pm_domains.c index 5ec0c13f0aaf..d07f3c9d6903 100644 --- a/drivers/soc/samsung/pm_domains.c +++ b/drivers/soc/samsung/pm_domains.c @@ -28,7 +28,6 @@ struct exynos_pm_domain_config { */ struct exynos_pm_domain { void __iomem *base; - bool is_off; struct generic_pm_domain pd; u32 local_pwr_cfg; }; -- cgit From c072c4ef7ef09e1d6470c48cf52570487589b76a Mon Sep 17 00:00:00 2001 From: Sam Protsenko Date: Thu, 14 Oct 2021 16:35:06 +0300 Subject: soc: samsung: exynos-chipid: Pass revision reg offsets Old Exynos SoCs have both Product ID and Revision ID in one single register, while new SoCs tend to have two separate registers for those IDs. Implement handling of both cases by passing Revision ID register offsets in driver data. Previously existing macros for Exynos4210 (removed in this patch) were incorrect: #define EXYNOS_SUBREV_MASK (0xf << 4) #define EXYNOS_MAINREV_MASK (0xf << 0) Actual format of PRO_ID register in Exynos4210 (offset 0x0): [31:12] Product ID [9:8] Package information [7:4] Main Revision Number [3:0] Sub Revision Number This patch doesn't change the behavior on existing platforms, so '/sys/devices/soc0/revision' will show the same string as before. Signed-off-by: Sam Protsenko Tested-by: Henrik Grimler Link: https://lore.kernel.org/r/20211014133508.1210-1-semen.protsenko@linaro.org Signed-off-by: Krzysztof Kozlowski --- drivers/soc/samsung/exynos-chipid.c | 69 +++++++++++++++++++++++++++++++------ 1 file changed, 58 insertions(+), 11 deletions(-) (limited to 'drivers') diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c index b2627a3a127a..986978e83661 100644 --- a/drivers/soc/samsung/exynos-chipid.c +++ b/drivers/soc/samsung/exynos-chipid.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -25,6 +26,17 @@ #include "exynos-asv.h" +struct exynos_chipid_variant { + unsigned int rev_reg; /* revision register offset */ + unsigned int main_rev_shift; /* main revision offset in rev_reg */ + unsigned int sub_rev_shift; /* sub revision offset in rev_reg */ +}; + +struct exynos_chipid_info { + u32 product_id; + u32 revision; +}; + static const struct exynos_soc_id { const char *name; unsigned int id; @@ -50,31 +62,57 @@ static const char *product_id_to_soc_id(unsigned int product_id) int i; for (i = 0; i < ARRAY_SIZE(soc_ids); i++) - if ((product_id & EXYNOS_MASK) == soc_ids[i].id) + if (product_id == soc_ids[i].id) return soc_ids[i].name; return NULL; } +static int exynos_chipid_get_chipid_info(struct regmap *regmap, + const struct exynos_chipid_variant *data, + struct exynos_chipid_info *soc_info) +{ + int ret; + unsigned int val, main_rev, sub_rev; + + ret = regmap_read(regmap, EXYNOS_CHIPID_REG_PRO_ID, &val); + if (ret < 0) + return ret; + soc_info->product_id = val & EXYNOS_MASK; + + if (data->rev_reg != EXYNOS_CHIPID_REG_PRO_ID) { + ret = regmap_read(regmap, data->rev_reg, &val); + if (ret < 0) + return ret; + } + main_rev = (val >> data->main_rev_shift) & EXYNOS_REV_PART_MASK; + sub_rev = (val >> data->sub_rev_shift) & EXYNOS_REV_PART_MASK; + soc_info->revision = (main_rev << EXYNOS_REV_PART_SHIFT) | sub_rev; + + return 0; +} + static int exynos_chipid_probe(struct platform_device *pdev) { + const struct exynos_chipid_variant *drv_data; + struct exynos_chipid_info soc_info; struct soc_device_attribute *soc_dev_attr; struct soc_device *soc_dev; struct device_node *root; struct regmap *regmap; - u32 product_id; - u32 revision; int ret; + drv_data = of_device_get_match_data(&pdev->dev); + if (!drv_data) + return -EINVAL; + regmap = device_node_to_regmap(pdev->dev.of_node); if (IS_ERR(regmap)) return PTR_ERR(regmap); - ret = regmap_read(regmap, EXYNOS_CHIPID_REG_PRO_ID, &product_id); + ret = exynos_chipid_get_chipid_info(regmap, drv_data, &soc_info); if (ret < 0) return ret; - revision = product_id & EXYNOS_REV_MASK; - soc_dev_attr = devm_kzalloc(&pdev->dev, sizeof(*soc_dev_attr), GFP_KERNEL); if (!soc_dev_attr) @@ -87,8 +125,8 @@ static int exynos_chipid_probe(struct platform_device *pdev) of_node_put(root); soc_dev_attr->revision = devm_kasprintf(&pdev->dev, GFP_KERNEL, - "%x", revision); - soc_dev_attr->soc_id = product_id_to_soc_id(product_id); + "%x", soc_info.revision); + soc_dev_attr->soc_id = product_id_to_soc_id(soc_info.product_id); if (!soc_dev_attr->soc_id) { pr_err("Unknown SoC\n"); return -ENODEV; @@ -106,7 +144,7 @@ static int exynos_chipid_probe(struct platform_device *pdev) platform_set_drvdata(pdev, soc_dev); dev_info(&pdev->dev, "Exynos: CPU[%s] PRO_ID[0x%x] REV[0x%x] Detected\n", - soc_dev_attr->soc_id, product_id, revision); + soc_dev_attr->soc_id, soc_info.product_id, soc_info.revision); return 0; @@ -125,9 +163,18 @@ static int exynos_chipid_remove(struct platform_device *pdev) return 0; } +static const struct exynos_chipid_variant exynos4210_chipid_drv_data = { + .rev_reg = 0x0, + .main_rev_shift = 4, + .sub_rev_shift = 0, +}; + static const struct of_device_id exynos_chipid_of_device_ids[] = { - { .compatible = "samsung,exynos4210-chipid" }, - {} + { + .compatible = "samsung,exynos4210-chipid", + .data = &exynos4210_chipid_drv_data, + }, + { } }; MODULE_DEVICE_TABLE(of, exynos_chipid_of_device_ids); -- cgit From 81a51eb6be3dbb76790b7353ec8dfaadfc751782 Mon Sep 17 00:00:00 2001 From: Sam Protsenko Date: Thu, 14 Oct 2021 16:35:08 +0300 Subject: soc: samsung: exynos-chipid: Add Exynos850 support Add chip-id support for Exynos850 SoC. Despite its "E3830" ID, the actual SoC name is Exynos850 (Exynos3830 name is internal and outdated). Format of Product_ID register in Exynos850 (offset 0x0): [31:0] Product ID (identification) Format of CHIPID_REV register in Exynos850 (offset 0x10): [23:20] Main revision [19:16] Sub revision Signed-off-by: Sam Protsenko Link: https://lore.kernel.org/r/20211014133508.1210-3-semen.protsenko@linaro.org Signed-off-by: Krzysztof Kozlowski --- drivers/soc/samsung/exynos-chipid.c | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'drivers') diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c index 986978e83661..0aeb24bcc11a 100644 --- a/drivers/soc/samsung/exynos-chipid.c +++ b/drivers/soc/samsung/exynos-chipid.c @@ -55,6 +55,7 @@ static const struct exynos_soc_id { { "EXYNOS5440", 0xE5440000 }, { "EXYNOS5800", 0xE5422000 }, { "EXYNOS7420", 0xE7420000 }, + { "EXYNOS850", 0xE3830000 }, }; static const char *product_id_to_soc_id(unsigned int product_id) @@ -169,10 +170,19 @@ static const struct exynos_chipid_variant exynos4210_chipid_drv_data = { .sub_rev_shift = 0, }; +static const struct exynos_chipid_variant exynos850_chipid_drv_data = { + .rev_reg = 0x10, + .main_rev_shift = 20, + .sub_rev_shift = 16, +}; + static const struct of_device_id exynos_chipid_of_device_ids[] = { { .compatible = "samsung,exynos4210-chipid", .data = &exynos4210_chipid_drv_data, + }, { + .compatible = "samsung,exynos850-chipid", + .data = &exynos850_chipid_drv_data, }, { } }; -- cgit From d96890fca9fd429dd3834dae27e1047760da245b Mon Sep 17 00:00:00 2001 From: Will McVicker Date: Wed, 13 Oct 2021 21:22:55 +0000 Subject: rtc: s3c: remove HAVE_S3C_RTC in favor of direct dependencies The config HAVE_S3C_RTC is not really needed since we can simply just add the dependencies directly to RTC_DRV_S3C. Also, one less config to keep track of! Signed-off-by: Will McVicker Acked-by: Alexandre Belloni Link: https://lore.kernel.org/r/20211013212256.3425889-1-willmcvicker@google.com Signed-off-by: Krzysztof Kozlowski --- drivers/rtc/Kconfig | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) (limited to 'drivers') diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index e1bc5214494e..7208eeb8459a 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -1404,16 +1404,10 @@ config RTC_DRV_OMAP This driver can also be built as a module, if so, module will be called rtc-omap. -config HAVE_S3C_RTC - bool - help - This will include RTC support for Samsung SoCs. If - you want to include RTC support for any machine, kindly - select this in the respective mach-XXXX/Kconfig file. - config RTC_DRV_S3C tristate "Samsung S3C series SoC RTC" - depends on ARCH_S3C64XX || HAVE_S3C_RTC || COMPILE_TEST + depends on ARCH_EXYNOS || ARCH_S3C64XX || ARCH_S3C24XX || ARCH_S5PV210 || \ + COMPILE_TEST help RTC (Realtime Clock) driver for the clock inbuilt into the Samsung S3C24XX series of SoCs. This can provide periodic -- cgit From b417d1e88f32645ed62a00d43c347b4386a0a021 Mon Sep 17 00:00:00 2001 From: Chanho Park Date: Thu, 21 Oct 2021 10:20:16 +0900 Subject: soc: samsung: exynos-chipid: add exynosautov9 SoC support The product id of Exynos Auto v9 is "0xAAA8_0000". Add this id and its name. Cc: Sam Protsenko Signed-off-by: Chanho Park Link: https://lore.kernel.org/r/20211021012017.158919-2-chanho61.park@samsung.com Signed-off-by: Krzysztof Kozlowski --- drivers/soc/samsung/exynos-chipid.c | 1 + 1 file changed, 1 insertion(+) (limited to 'drivers') diff --git a/drivers/soc/samsung/exynos-chipid.c b/drivers/soc/samsung/exynos-chipid.c index 0aeb24bcc11a..a28053ec7e6a 100644 --- a/drivers/soc/samsung/exynos-chipid.c +++ b/drivers/soc/samsung/exynos-chipid.c @@ -56,6 +56,7 @@ static const struct exynos_soc_id { { "EXYNOS5800", 0xE5422000 }, { "EXYNOS7420", 0xE7420000 }, { "EXYNOS850", 0xE3830000 }, + { "EXYNOSAUTOV9", 0xAAA80000 }, }; static const char *product_id_to_soc_id(unsigned int product_id) -- cgit