mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-15 00:34:10 +08:00
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. -----BEGIN PGP SIGNATURE----- iQJEBAABCgAuFiEE3dJiKD0RGyM7briowTdm5oaLg9cFAmF3zFcQHGtyemtAa2Vy bmVsLm9yZwAKCRDBN2bmhouD1wXED/9VSIwfegbhUkfa9yCetdt8dDrjINAUuZ89 FZsplj7BdFJVra7KxjZ6WSWqT5bBVF804mPQKi/filUvuZLr8oOVc/BCdARPMqxq 3rui2xiXvUgDWfJmqFEaVhTTChKAK2NKMgC+aGB0Ah3PK9QbO9fG+E1IcOBLIEUQ bQH77+GH4rG8/INWdrqmL7LrJUkOyUsCgK3IxGh08m6nRgn8Xfwk1Y0UPpeGgQTs 66CnmIgBiN3+w0MeFClHpLXokBnSSFwrtITrwLILffAO18EEFaaErSZhSyge4tdu WwH9no+mcp8gpV7mU/b4rAhNVqn6LIldGrk3O6H9Pm9RJj1ITsLYdTXEpUKErXma g3ZloSyQ/zMUAM3K6rMHYg92Z8pUTnbkbYI6hoCgPGmrHIIRIhIjbjafBHuFZuhL aeLUCcPxGv3tETjmDaSscHDJ+kVtCyArAoggDbPzWr8V7IO8OmMecxTfYJEKPelM CH0uvIBHgXRtSF091XbrJ8vXy/GZSWZJH5CrQmeY/HqE+iJFAYXGj53fohGlOu7m t0OsCnnX/eaCRFPtg6yUfGbiJ3xjdyTvA6ffn7c4Eel4tezy3HnGIaIjA/QI2KVa J18YWZDMGxeQpofuTo8wpCZiUZo/6zlVb3zh9vyRvf1gR06Ln8y5Kb+SAna+EvTj YDxiCGYwIg== =ZJb8 -----END PGP SIGNATURE----- gpgsig -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEEo6/YBQwIrVS28WGKmmx57+YAGNkFAmF4G7MACgkQmmx57+YA GNk7ug//Y69NRwLTxnZSY5mX88SegROm4oARW8+hZLA3XGmpZuZsNBzc709p/64B Ba/AKIILWKzY4kp5gdT+u02JYoPNVYGuq0SQ1F/Owj7ojAQkBKpwlvDARCIWIFN0 4HohEU6eO1XOm3aUqKYsGfZxk53ECnx3IP5vxSVkTUGOSQKNQAsqIKG+bfYM3J/4 AsMFwm7aMHxgBqAxk3ZTPeqAl2JLH5+7uIcZHRWqt9wCiPMWXLSVbKpW79xPHCHC eaRw6je+HI4MwZjNSqdmaiP/4WCnKGowiq0OGnkv9vcH4GykT9a6qS3pTL50rLom lHov9WbNXGP+wFYMWLn9f8fyLwFmdNmOFvkQT6IX2H4a6VlceMqx6HfAKzeAr6fX 6ck6/t8gjF/s9rXpR08sBDpefXLxp7nYZSsFMNesVRCD+h+JciC3pnUw+YgUpcRb GK4AoaxHbaIJy94OzARGECOP7fzXfVFBrMHgYucWOeVvX1W7JX0eyDKOAkWF4W+J R+af/7HIcNtB1bXFpxL6Njeyyf2B4a8qncMlLTtJ7r5DX5oU7T8KRngzD4kCvnkP gjkBzY1+41/K9RCII6L05miNc36ATf/07bQx4e1F2L9/1RzGnjIl8OxN5OVs89y0 CvplsgtlYgnGccNbpChO0r4IaR7UWYTDPulXkEdNE+jJxuTYvwI= =y2Ab -----END PGP SIGNATURE----- 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/20211026094709.75692-2-krzysztof.kozlowski@canonical.com Signed-off-by: Arnd Bergmann <arnd@arndb.de>
This commit is contained in:
commit
64954d19e0
@ -11,8 +11,9 @@ maintainers:
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
items:
|
||||
- const: samsung,exynos4210-chipid
|
||||
enum:
|
||||
- samsung,exynos4210-chipid
|
||||
- samsung,exynos850-chipid
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
@ -475,7 +475,6 @@ config ARCH_S3C24XX
|
||||
select GPIOLIB
|
||||
select GENERIC_IRQ_MULTI_HANDLER
|
||||
select HAVE_S3C2410_I2C if I2C
|
||||
select HAVE_S3C_RTC if RTC_CLASS
|
||||
select NEED_MACH_IO_H
|
||||
select S3C2410_WATCHDOG
|
||||
select SAMSUNG_ATAGS
|
||||
|
@ -13,7 +13,6 @@ menuconfig ARCH_EXYNOS
|
||||
select ARM_GIC
|
||||
select EXYNOS_IRQ_COMBINER
|
||||
select COMMON_CLK_SAMSUNG
|
||||
select EXYNOS_CHIPID
|
||||
select EXYNOS_THERMAL
|
||||
select EXYNOS_PMU
|
||||
select EXYNOS_SROM
|
||||
@ -22,7 +21,6 @@ menuconfig ARCH_EXYNOS
|
||||
select HAVE_ARM_ARCH_TIMER if ARCH_EXYNOS5
|
||||
select HAVE_ARM_SCU if SMP
|
||||
select HAVE_S3C2410_I2C if I2C
|
||||
select HAVE_S3C_RTC if RTC_CLASS
|
||||
select PINCTRL
|
||||
select PINCTRL_EXYNOS
|
||||
select PM_GENERIC_DOMAINS if PM
|
||||
|
@ -13,7 +13,6 @@ config ARCH_S5PV210
|
||||
select COMMON_CLK_SAMSUNG
|
||||
select GPIOLIB
|
||||
select HAVE_S3C2410_I2C if I2C
|
||||
select HAVE_S3C_RTC if RTC_CLASS
|
||||
select PINCTRL
|
||||
select PINCTRL_EXYNOS
|
||||
select SOC_SAMSUNG
|
||||
|
@ -92,10 +92,8 @@ config ARCH_BRCMSTB
|
||||
config ARCH_EXYNOS
|
||||
bool "ARMv8 based Samsung Exynos SoC family"
|
||||
select COMMON_CLK_SAMSUNG
|
||||
select EXYNOS_CHIPID
|
||||
select EXYNOS_PM_DOMAINS if PM_GENERIC_DOMAINS
|
||||
select EXYNOS_PMU
|
||||
select HAVE_S3C_RTC if RTC_CLASS
|
||||
select PINCTRL
|
||||
select PINCTRL_EXYNOS
|
||||
select PM_GENERIC_DOMAINS if PM
|
||||
|
@ -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
|
||||
|
@ -13,18 +13,21 @@ 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"
|
||||
depends on ARCH_EXYNOS || COMPILE_TEST
|
||||
default ARCH_EXYNOS
|
||||
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
|
||||
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
|
||||
|
@ -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 \
|
||||
|
@ -15,7 +15,9 @@
|
||||
#include <linux/device.h>
|
||||
#include <linux/errno.h>
|
||||
#include <linux/mfd/syscon.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_device.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/slab.h>
|
||||
@ -24,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;
|
||||
@ -42,6 +55,8 @@ static const struct exynos_soc_id {
|
||||
{ "EXYNOS5440", 0xE5440000 },
|
||||
{ "EXYNOS5800", 0xE5422000 },
|
||||
{ "EXYNOS7420", 0xE7420000 },
|
||||
{ "EXYNOS850", 0xE3830000 },
|
||||
{ "EXYNOSAUTOV9", 0xAAA80000 },
|
||||
};
|
||||
|
||||
static const char *product_id_to_soc_id(unsigned int product_id)
|
||||
@ -49,31 +64,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)
|
||||
@ -86,8 +127,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;
|
||||
@ -104,9 +145,8 @@ 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",
|
||||
soc_dev_attr->soc_id, product_id, revision);
|
||||
dev_info(&pdev->dev, "Exynos: CPU[%s] PRO_ID[0x%x] REV[0x%x] Detected\n",
|
||||
soc_dev_attr->soc_id, soc_info.product_id, soc_info.revision);
|
||||
|
||||
return 0;
|
||||
|
||||
@ -125,11 +165,30 @@ static int exynos_chipid_remove(struct platform_device *pdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct of_device_id exynos_chipid_of_device_ids[] = {
|
||||
{ .compatible = "samsung,exynos4210-chipid" },
|
||||
{}
|
||||
static const struct exynos_chipid_variant exynos4210_chipid_drv_data = {
|
||||
.rev_reg = 0x0,
|
||||
.main_rev_shift = 4,
|
||||
.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,
|
||||
},
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, exynos_chipid_of_device_ids);
|
||||
|
||||
static struct platform_driver exynos_chipid_driver = {
|
||||
.driver = {
|
||||
.name = "exynos-chipid",
|
||||
@ -138,4 +197,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 <b.zolnierkie@samsung.com>");
|
||||
MODULE_AUTHOR("Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>");
|
||||
MODULE_AUTHOR("Pankaj Dubey <pankaj.dubey@samsung.com>");
|
||||
MODULE_AUTHOR("Sylwester Nawrocki <s.nawrocki@samsung.com>");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
@ -503,3 +503,4 @@ int exynos5422_asv_init(struct exynos_asv *asv)
|
||||
|
||||
return 0;
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(exynos5422_asv_init);
|
||||
|
@ -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;
|
||||
};
|
||||
|
@ -9,10 +9,8 @@
|
||||
#define __LINUX_SOC_EXYNOS_CHIPID_H
|
||||
|
||||
#define EXYNOS_CHIPID_REG_PRO_ID 0x00
|
||||
#define EXYNOS_SUBREV_MASK (0xf << 4)
|
||||
#define EXYNOS_MAINREV_MASK (0xf << 0)
|
||||
#define EXYNOS_REV_MASK (EXYNOS_SUBREV_MASK | \
|
||||
EXYNOS_MAINREV_MASK)
|
||||
#define EXYNOS_REV_PART_MASK 0xf
|
||||
#define EXYNOS_REV_PART_SHIFT 4
|
||||
#define EXYNOS_MASK 0xfffff000
|
||||
|
||||
#define EXYNOS_CHIPID_REG_PKG_ID 0x04
|
||||
|
Loading…
Reference in New Issue
Block a user