Skip to content

Commit 64954d1

Browse files
committed
Merge tag 'samsung-drivers-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux into arm/drivers
Samsung SoC drivers changes for v5.16 1. Convert Exynos ChipID and ASV driver to a module and make it a default, instead of selected. The driver is not essential, so it could be disabled, if needed. 2. Add support for Exynos850 and Exynos Auto v9 to Exynos ChipID and ASV driver. 3. Get rid of HAVE_S3C_RTC because it was adding just another layer instead of direct dependencies. 4. Minor cleanups. * tag 'samsung-drivers-5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/krzk/linux: soc: samsung: exynos-chipid: add exynosautov9 SoC support rtc: s3c: remove HAVE_S3C_RTC in favor of direct dependencies soc: samsung: exynos-chipid: Add Exynos850 support dt-bindings: samsung: exynos-chipid: Document Exynos850 compatible soc: samsung: exynos-chipid: Pass revision reg offsets soc: samsung: pm_domains: drop unused is_off field arm64: exynos: don't have ARCH_EXYNOS select EXYNOS_CHIPID soc: samsung: exynos-chipid: do not enforce built-in soc: samsung: exynos-chipid: convert to a module soc: samsung: exynos-chipid: avoid soc_device_to_device() soc: samsung: exynos-pmu: Fix compilation when nothing selects CONFIG_MFD_CORE Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Arnd Bergmann <[email protected]>
2 parents c680797 + b417d1e commit 64954d1

File tree

12 files changed

+94
-37
lines changed

12 files changed

+94
-37
lines changed

Documentation/devicetree/bindings/arm/samsung/exynos-chipid.yaml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,9 @@ maintainers:
1111

1212
properties:
1313
compatible:
14-
items:
15-
- const: samsung,exynos4210-chipid
14+
enum:
15+
- samsung,exynos4210-chipid
16+
- samsung,exynos850-chipid
1617

1718
reg:
1819
maxItems: 1

arch/arm/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -475,7 +475,6 @@ config ARCH_S3C24XX
475475
select GPIOLIB
476476
select GENERIC_IRQ_MULTI_HANDLER
477477
select HAVE_S3C2410_I2C if I2C
478-
select HAVE_S3C_RTC if RTC_CLASS
479478
select NEED_MACH_IO_H
480479
select S3C2410_WATCHDOG
481480
select SAMSUNG_ATAGS

arch/arm/mach-exynos/Kconfig

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ menuconfig ARCH_EXYNOS
1313
select ARM_GIC
1414
select EXYNOS_IRQ_COMBINER
1515
select COMMON_CLK_SAMSUNG
16-
select EXYNOS_CHIPID
1716
select EXYNOS_THERMAL
1817
select EXYNOS_PMU
1918
select EXYNOS_SROM
@@ -22,7 +21,6 @@ menuconfig ARCH_EXYNOS
2221
select HAVE_ARM_ARCH_TIMER if ARCH_EXYNOS5
2322
select HAVE_ARM_SCU if SMP
2423
select HAVE_S3C2410_I2C if I2C
25-
select HAVE_S3C_RTC if RTC_CLASS
2624
select PINCTRL
2725
select PINCTRL_EXYNOS
2826
select PM_GENERIC_DOMAINS if PM

arch/arm/mach-s5pv210/Kconfig

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ config ARCH_S5PV210
1313
select COMMON_CLK_SAMSUNG
1414
select GPIOLIB
1515
select HAVE_S3C2410_I2C if I2C
16-
select HAVE_S3C_RTC if RTC_CLASS
1716
select PINCTRL
1817
select PINCTRL_EXYNOS
1918
select SOC_SAMSUNG

arch/arm64/Kconfig.platforms

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,10 +92,8 @@ config ARCH_BRCMSTB
9292
config ARCH_EXYNOS
9393
bool "ARMv8 based Samsung Exynos SoC family"
9494
select COMMON_CLK_SAMSUNG
95-
select EXYNOS_CHIPID
9695
select EXYNOS_PM_DOMAINS if PM_GENERIC_DOMAINS
9796
select EXYNOS_PMU
98-
select HAVE_S3C_RTC if RTC_CLASS
9997
select PINCTRL
10098
select PINCTRL_EXYNOS
10199
select PM_GENERIC_DOMAINS if PM

drivers/rtc/Kconfig

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1404,16 +1404,10 @@ config RTC_DRV_OMAP
14041404
This driver can also be built as a module, if so, module
14051405
will be called rtc-omap.
14061406

1407-
config HAVE_S3C_RTC
1408-
bool
1409-
help
1410-
This will include RTC support for Samsung SoCs. If
1411-
you want to include RTC support for any machine, kindly
1412-
select this in the respective mach-XXXX/Kconfig file.
1413-
14141407
config RTC_DRV_S3C
14151408
tristate "Samsung S3C series SoC RTC"
1416-
depends on ARCH_S3C64XX || HAVE_S3C_RTC || COMPILE_TEST
1409+
depends on ARCH_EXYNOS || ARCH_S3C64XX || ARCH_S3C24XX || ARCH_S5PV210 || \
1410+
COMPILE_TEST
14171411
help
14181412
RTC (Realtime Clock) driver for the clock inbuilt into the
14191413
Samsung S3C24XX series of SoCs. This can provide periodic

drivers/soc/samsung/Kconfig

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,21 @@ config EXYNOS_ASV_ARM
1313
depends on EXYNOS_CHIPID
1414

1515
config EXYNOS_CHIPID
16-
bool "Exynos ChipID controller and ASV driver" if COMPILE_TEST
16+
tristate "Exynos ChipID controller and ASV driver"
1717
depends on ARCH_EXYNOS || COMPILE_TEST
18+
default ARCH_EXYNOS
1819
select EXYNOS_ASV_ARM if ARM && ARCH_EXYNOS
1920
select MFD_SYSCON
2021
select SOC_BUS
2122
help
2223
Support for Samsung Exynos SoC ChipID and Adaptive Supply Voltage.
24+
This driver can also be built as module (exynos_chipid).
2325

2426
config EXYNOS_PMU
2527
bool "Exynos PMU controller driver" if COMPILE_TEST
2628
depends on ARCH_EXYNOS || ((ARM || ARM64) && COMPILE_TEST)
2729
select EXYNOS_PMU_ARM_DRIVERS if ARM && ARCH_EXYNOS
30+
select MFD_CORE
2831

2932
# There is no need to enable these drivers for ARMv8
3033
config EXYNOS_PMU_ARM_DRIVERS

drivers/soc/samsung/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
# SPDX-License-Identifier: GPL-2.0
22

33
obj-$(CONFIG_EXYNOS_ASV_ARM) += exynos5422-asv.o
4+
obj-$(CONFIG_EXYNOS_CHIPID) += exynos_chipid.o
5+
exynos_chipid-y += exynos-chipid.o exynos-asv.o
46

5-
obj-$(CONFIG_EXYNOS_CHIPID) += exynos-chipid.o exynos-asv.o
67
obj-$(CONFIG_EXYNOS_PMU) += exynos-pmu.o
78

89
obj-$(CONFIG_EXYNOS_PMU_ARM_DRIVERS) += exynos3250-pmu.o exynos4-pmu.o \

drivers/soc/samsung/exynos-chipid.c

Lines changed: 80 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@
1515
#include <linux/device.h>
1616
#include <linux/errno.h>
1717
#include <linux/mfd/syscon.h>
18+
#include <linux/module.h>
1819
#include <linux/of.h>
20+
#include <linux/of_device.h>
1921
#include <linux/platform_device.h>
2022
#include <linux/regmap.h>
2123
#include <linux/slab.h>
@@ -24,6 +26,17 @@
2426

2527
#include "exynos-asv.h"
2628

29+
struct exynos_chipid_variant {
30+
unsigned int rev_reg; /* revision register offset */
31+
unsigned int main_rev_shift; /* main revision offset in rev_reg */
32+
unsigned int sub_rev_shift; /* sub revision offset in rev_reg */
33+
};
34+
35+
struct exynos_chipid_info {
36+
u32 product_id;
37+
u32 revision;
38+
};
39+
2740
static const struct exynos_soc_id {
2841
const char *name;
2942
unsigned int id;
@@ -42,38 +55,66 @@ static const struct exynos_soc_id {
4255
{ "EXYNOS5440", 0xE5440000 },
4356
{ "EXYNOS5800", 0xE5422000 },
4457
{ "EXYNOS7420", 0xE7420000 },
58+
{ "EXYNOS850", 0xE3830000 },
59+
{ "EXYNOSAUTOV9", 0xAAA80000 },
4560
};
4661

4762
static const char *product_id_to_soc_id(unsigned int product_id)
4863
{
4964
int i;
5065

5166
for (i = 0; i < ARRAY_SIZE(soc_ids); i++)
52-
if ((product_id & EXYNOS_MASK) == soc_ids[i].id)
67+
if (product_id == soc_ids[i].id)
5368
return soc_ids[i].name;
5469
return NULL;
5570
}
5671

72+
static int exynos_chipid_get_chipid_info(struct regmap *regmap,
73+
const struct exynos_chipid_variant *data,
74+
struct exynos_chipid_info *soc_info)
75+
{
76+
int ret;
77+
unsigned int val, main_rev, sub_rev;
78+
79+
ret = regmap_read(regmap, EXYNOS_CHIPID_REG_PRO_ID, &val);
80+
if (ret < 0)
81+
return ret;
82+
soc_info->product_id = val & EXYNOS_MASK;
83+
84+
if (data->rev_reg != EXYNOS_CHIPID_REG_PRO_ID) {
85+
ret = regmap_read(regmap, data->rev_reg, &val);
86+
if (ret < 0)
87+
return ret;
88+
}
89+
main_rev = (val >> data->main_rev_shift) & EXYNOS_REV_PART_MASK;
90+
sub_rev = (val >> data->sub_rev_shift) & EXYNOS_REV_PART_MASK;
91+
soc_info->revision = (main_rev << EXYNOS_REV_PART_SHIFT) | sub_rev;
92+
93+
return 0;
94+
}
95+
5796
static int exynos_chipid_probe(struct platform_device *pdev)
5897
{
98+
const struct exynos_chipid_variant *drv_data;
99+
struct exynos_chipid_info soc_info;
59100
struct soc_device_attribute *soc_dev_attr;
60101
struct soc_device *soc_dev;
61102
struct device_node *root;
62103
struct regmap *regmap;
63-
u32 product_id;
64-
u32 revision;
65104
int ret;
66105

106+
drv_data = of_device_get_match_data(&pdev->dev);
107+
if (!drv_data)
108+
return -EINVAL;
109+
67110
regmap = device_node_to_regmap(pdev->dev.of_node);
68111
if (IS_ERR(regmap))
69112
return PTR_ERR(regmap);
70113

71-
ret = regmap_read(regmap, EXYNOS_CHIPID_REG_PRO_ID, &product_id);
114+
ret = exynos_chipid_get_chipid_info(regmap, drv_data, &soc_info);
72115
if (ret < 0)
73116
return ret;
74117

75-
revision = product_id & EXYNOS_REV_MASK;
76-
77118
soc_dev_attr = devm_kzalloc(&pdev->dev, sizeof(*soc_dev_attr),
78119
GFP_KERNEL);
79120
if (!soc_dev_attr)
@@ -86,8 +127,8 @@ static int exynos_chipid_probe(struct platform_device *pdev)
86127
of_node_put(root);
87128

88129
soc_dev_attr->revision = devm_kasprintf(&pdev->dev, GFP_KERNEL,
89-
"%x", revision);
90-
soc_dev_attr->soc_id = product_id_to_soc_id(product_id);
130+
"%x", soc_info.revision);
131+
soc_dev_attr->soc_id = product_id_to_soc_id(soc_info.product_id);
91132
if (!soc_dev_attr->soc_id) {
92133
pr_err("Unknown SoC\n");
93134
return -ENODEV;
@@ -104,9 +145,8 @@ static int exynos_chipid_probe(struct platform_device *pdev)
104145

105146
platform_set_drvdata(pdev, soc_dev);
106147

107-
dev_info(soc_device_to_device(soc_dev),
108-
"Exynos: CPU[%s] PRO_ID[0x%x] REV[0x%x] Detected\n",
109-
soc_dev_attr->soc_id, product_id, revision);
148+
dev_info(&pdev->dev, "Exynos: CPU[%s] PRO_ID[0x%x] REV[0x%x] Detected\n",
149+
soc_dev_attr->soc_id, soc_info.product_id, soc_info.revision);
110150

111151
return 0;
112152

@@ -125,10 +165,29 @@ static int exynos_chipid_remove(struct platform_device *pdev)
125165
return 0;
126166
}
127167

168+
static const struct exynos_chipid_variant exynos4210_chipid_drv_data = {
169+
.rev_reg = 0x0,
170+
.main_rev_shift = 4,
171+
.sub_rev_shift = 0,
172+
};
173+
174+
static const struct exynos_chipid_variant exynos850_chipid_drv_data = {
175+
.rev_reg = 0x10,
176+
.main_rev_shift = 20,
177+
.sub_rev_shift = 16,
178+
};
179+
128180
static const struct of_device_id exynos_chipid_of_device_ids[] = {
129-
{ .compatible = "samsung,exynos4210-chipid" },
130-
{}
181+
{
182+
.compatible = "samsung,exynos4210-chipid",
183+
.data = &exynos4210_chipid_drv_data,
184+
}, {
185+
.compatible = "samsung,exynos850-chipid",
186+
.data = &exynos850_chipid_drv_data,
187+
},
188+
{ }
131189
};
190+
MODULE_DEVICE_TABLE(of, exynos_chipid_of_device_ids);
132191

133192
static struct platform_driver exynos_chipid_driver = {
134193
.driver = {
@@ -138,4 +197,11 @@ static struct platform_driver exynos_chipid_driver = {
138197
.probe = exynos_chipid_probe,
139198
.remove = exynos_chipid_remove,
140199
};
141-
builtin_platform_driver(exynos_chipid_driver);
200+
module_platform_driver(exynos_chipid_driver);
201+
202+
MODULE_DESCRIPTION("Samsung Exynos ChipID controller and ASV driver");
203+
MODULE_AUTHOR("Bartlomiej Zolnierkiewicz <[email protected]>");
204+
MODULE_AUTHOR("Krzysztof Kozlowski <[email protected]>");
205+
MODULE_AUTHOR("Pankaj Dubey <[email protected]>");
206+
MODULE_AUTHOR("Sylwester Nawrocki <[email protected]>");
207+
MODULE_LICENSE("GPL");

drivers/soc/samsung/exynos5422-asv.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -503,3 +503,4 @@ int exynos5422_asv_init(struct exynos_asv *asv)
503503

504504
return 0;
505505
}
506+
EXPORT_SYMBOL_GPL(exynos5422_asv_init);

0 commit comments

Comments
 (0)