For unclear reasons the driver is based on the Linux rn5t618 driver, but has been added to Barebox under a different name. To avoid confusion sync the name with the Linux driver.
Signed-off-by: Lucas Stach <[email protected]> --- drivers/mfd/Kconfig | 6 +- drivers/mfd/Makefile | 2 +- drivers/mfd/{rn5t568.c => rn5t618.c} | 76 +++++++-------- drivers/watchdog/Kconfig | 2 +- include/mfd/rn5t568.h | 134 --------------------------- include/mfd/rn5t618.h | 134 +++++++++++++++++++++++++++ 6 files changed, 177 insertions(+), 177 deletions(-) rename drivers/mfd/{rn5t568.c => rn5t618.c} (53%) delete mode 100644 include/mfd/rn5t568.h create mode 100644 include/mfd/rn5t618.h diff --git a/drivers/mfd/Kconfig b/drivers/mfd/Kconfig index 22b57eee1669..305a79baca46 100644 --- a/drivers/mfd/Kconfig +++ b/drivers/mfd/Kconfig @@ -81,12 +81,12 @@ config MFD_PCA9450 help Select this to support communication with the PCA9450 PMIC. -config MFD_RN568PMIC +config MFD_RN5T618 depends on I2C select REGMAP_I2C - bool "Ricoh RN5T568 MFD driver" + bool "Ricoh RN5T567/618 MFD driver" help - Select this to support communication with the Ricoh RN5T568 PMIC. + Select this to support communication with the Ricoh RN5T567/618 PMIC. config MFD_SUPERIO bool diff --git a/drivers/mfd/Makefile b/drivers/mfd/Makefile index 9d27b0bc336a..ae36d40d51be 100644 --- a/drivers/mfd/Makefile +++ b/drivers/mfd/Makefile @@ -15,7 +15,7 @@ obj-$(CONFIG_MFD_TWL4030) += twl4030.o obj-$(CONFIG_MFD_TWL6030) += twl6030.o obj-$(CONFIG_RAVE_SP_CORE) += rave-sp.o obj-$(CONFIG_MFD_STPMIC1) += stpmic1.o -obj-$(CONFIG_MFD_RN568PMIC) += rn5t568.o +obj-$(CONFIG_MFD_RN5T618) += rn5t618.o obj-$(CONFIG_MFD_SUPERIO) += superio.o obj-$(CONFIG_FINTEK_SUPERIO) += fintek-superio.o obj-$(CONFIG_SMSC_SUPERIO) += smsc-superio.o diff --git a/drivers/mfd/rn5t568.c b/drivers/mfd/rn5t618.c similarity index 53% rename from drivers/mfd/rn5t568.c rename to drivers/mfd/rn5t618.c index 5a0cec464a07..3af3e6e3e039 100644 --- a/drivers/mfd/rn5t568.c +++ b/drivers/mfd/rn5t618.c @@ -16,29 +16,29 @@ #include <linux/regmap.h> #include <reset_source.h> #include <restart.h> -#include <mfd/rn5t568.h> +#include <mfd/rn5t618.h> -struct rn5t568 { +struct rn5t618 { struct restart_handler restart; struct regmap *regmap; }; -static void rn5t568_restart(struct restart_handler *rst, +static void rn5t618_restart(struct restart_handler *rst, unsigned long flags) { - struct rn5t568 *rn5t568 = container_of(rst, struct rn5t568, restart); + struct rn5t618 *rn5t618 = container_of(rst, struct rn5t618, restart); - regmap_write(rn5t568->regmap, RN5T568_SLPCNT, RN5T568_SLPCNT_SWPPWROFF); + regmap_write(rn5t618->regmap, RN5T618_SLPCNT, RN5T618_SLPCNT_SWPPWROFF); } -static int rn5t568_reset_reason_detect(struct device *dev, +static int rn5t618_reset_reason_detect(struct device *dev, struct regmap *regmap) { enum reset_src_type type; unsigned int reg; int ret; - ret = regmap_read(regmap, RN5T568_PONHIS, ®); + ret = regmap_read(regmap, RN5T618_PONHIS, ®); if (ret) return ret; @@ -49,32 +49,32 @@ static int rn5t568_reset_reason_detect(struct device *dev, return 0; } - if (reg & (RN5T568_PONHIS_ON_EXTINPON | RN5T568_PONHIS_ON_PWRONPON)) { + if (reg & (RN5T618_PONHIS_ON_EXTINPON | RN5T618_PONHIS_ON_PWRONPON)) { type = RESET_POR; - } else if (!(reg & RN5T568_PONHIS_ON_REPWRPON)) { + } else if (!(reg & RN5T618_PONHIS_ON_REPWRPON)) { return -EINVAL; } else { - ret = regmap_read(regmap, RN5T568_POFFHIS, ®); + ret = regmap_read(regmap, RN5T618_POFFHIS, ®); if (ret) return ret; dev_dbg(dev, "Power-off history: %x\n", reg); - if (reg & RN5T568_POFFHIS_PWRONPOFF) + if (reg & RN5T618_POFFHIS_PWRONPOFF) type = RESET_POR; - else if (reg & RN5T568_POFFHIS_TSHUTPOFF) + else if (reg & RN5T618_POFFHIS_TSHUTPOFF) type = RESET_THERM; - else if (reg & RN5T568_POFFHIS_VINDETPOFF) + else if (reg & RN5T618_POFFHIS_VINDETPOFF) type = RESET_BROWNOUT; - else if (reg & RN5T568_POFFHIS_IODETPOFF) + else if (reg & RN5T618_POFFHIS_IODETPOFF) type = RESET_UKWN; - else if (reg & RN5T568_POFFHIS_CPUPOFF) + else if (reg & RN5T618_POFFHIS_CPUPOFF) type = RESET_RST; - else if (reg & RN5T568_POFFHIS_WDGPOFF) + else if (reg & RN5T618_POFFHIS_WDGPOFF) type = RESET_WDG; - else if (reg & RN5T568_POFFHIS_DCLIMPOFF) + else if (reg & RN5T618_POFFHIS_DCLIMPOFF) type = RESET_BROWNOUT; - else if (reg & RN5T568_POFFHIS_N_OEPOFF) + else if (reg & RN5T618_POFFHIS_N_OEPOFF) type = RESET_EXT; else return -EINVAL; @@ -84,20 +84,20 @@ static int rn5t568_reset_reason_detect(struct device *dev, return 0; } -static const struct regmap_config rn5t568_regmap_config = { +static const struct regmap_config rn5t618_regmap_config = { .reg_bits = 8, .val_bits = 8, - .max_register = RN5T568_MAX_REG, + .max_register = RN5T618_MAX_REG, }; -static int __init rn5t568_i2c_probe(struct device *dev) +static int __init rn5t618_i2c_probe(struct device *dev) { - struct rn5t568 *pmic_instance; + struct rn5t618 *pmic_instance; unsigned char reg[2]; int ret; - pmic_instance = xzalloc(sizeof(struct rn5t568)); - pmic_instance->regmap = regmap_init_i2c(to_i2c_client(dev), &rn5t568_regmap_config); + pmic_instance = xzalloc(sizeof(struct rn5t618)); + pmic_instance->regmap = regmap_init_i2c(to_i2c_client(dev), &rn5t618_regmap_config); if (IS_ERR(pmic_instance->regmap)) return PTR_ERR(pmic_instance->regmap); @@ -105,41 +105,41 @@ static int __init rn5t568_i2c_probe(struct device *dev) if (ret) return ret; - ret = regmap_bulk_read(pmic_instance->regmap, RN5T568_LSIVER, ®, 2); + ret = regmap_bulk_read(pmic_instance->regmap, RN5T618_LSIVER, ®, 2); if (ret) { dev_err(dev, "Failed to read PMIC version via I2C\n"); return ret; } - dev_info(dev, "Found NMD RN5T568 LSI %x, OTP: %x\n", reg[0], reg[1]); + dev_info(dev, "Found NMD RN5T567/618 LSI %x, OTP: %x\n", reg[0], reg[1]); /* Settings used to trigger software reset and by a watchdog trigger */ - regmap_write(pmic_instance->regmap, RN5T568_REPCNT, RN5T568_REPCNT_OFF_RESETO_16MS | - RN5T568_REPCNT_OFF_REPWRTIM_1000MS | RN5T568_REPCNT_OFF_REPWRON); + regmap_write(pmic_instance->regmap, RN5T618_REPCNT, RN5T618_REPCNT_OFF_RESETO_16MS | + RN5T618_REPCNT_OFF_REPWRTIM_1000MS | RN5T618_REPCNT_OFF_REPWRON); pmic_instance->restart.of_node = dev->of_node; - pmic_instance->restart.name = "RN5T568"; - pmic_instance->restart.restart = &rn5t568_restart; + pmic_instance->restart.name = "RN5T618"; + pmic_instance->restart.restart = &rn5t618_restart; restart_handler_register(&pmic_instance->restart); dev_dbg(dev, "RN5t: Restart handler with priority %d registered\n", pmic_instance->restart.priority); - ret = rn5t568_reset_reason_detect(dev, pmic_instance->regmap); + ret = rn5t618_reset_reason_detect(dev, pmic_instance->regmap); if (ret) dev_warn(dev, "Failed to query reset reason\n"); return of_platform_populate(dev->of_node, NULL, dev); } -static __maybe_unused const struct of_device_id rn5t568_of_match[] = { +static __maybe_unused const struct of_device_id rn5t618_of_match[] = { { .compatible = "ricoh,rn5t568", .data = NULL, }, { } }; -MODULE_DEVICE_TABLE(of, rn5t568_of_match); +MODULE_DEVICE_TABLE(of, rn5t618_of_match); -static struct driver rn5t568_i2c_driver = { - .name = "rn5t568-i2c", - .probe = rn5t568_i2c_probe, - .of_compatible = DRV_OF_COMPAT(rn5t568_of_match), +static struct driver rn5t618_i2c_driver = { + .name = "rn5t618-i2c", + .probe = rn5t618_i2c_probe, + .of_compatible = DRV_OF_COMPAT(rn5t618_of_match), }; -coredevice_i2c_driver(rn5t568_i2c_driver); +coredevice_i2c_driver(rn5t618_i2c_driver); diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig index c962e8f22e5a..97a305c164dc 100644 --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -128,7 +128,7 @@ config STPMIC1_WATCHDOG config RN568_WATCHDOG bool "Ricoh RN5t568 PMIC based Watchdog" - depends on MFD_RN568PMIC + depends on MFD_RN5T618 help Enable to support system control via the PMIC based watchdog. diff --git a/include/mfd/rn5t568.h b/include/mfd/rn5t568.h deleted file mode 100644 index 04b6c832a5d5..000000000000 --- a/include/mfd/rn5t568.h +++ /dev/null @@ -1,134 +0,0 @@ -// SPDX-License-Identifier: GPL-2.0-only -/* - * Copyright (C) 2014 Beniamino Galvani <[email protected]> - * Copyright (C) 2016 Toradex AG - */ - -#ifndef __MFD_RN5T568_H -#define __MFD_RN5T568_H - -#include <linux/bits.h> - -/* RN5T568 registers */ -enum { - RN5T568_LSIVER = 0x00, - RN5T568_OTPVER = 0x01, - RN5T568_IODAC = 0x02, - RN5T568_VINDAC = 0x03, - RN5T568_OUT32KEN = 0x05, - - RN5T568_CPUCNT = 0x06, - - RN5T568_PSWR = 0x07, - RN5T568_PONHIS = 0x09, - RN5T568_POFFHIS = 0x0A, - RN5T568_WATCHDOG = 0x0B, - RN5T568_WATCHDOGCNT = 0x0C, - RN5T568_PWRFUNC = 0x0D, - RN5T568_SLPCNT = 0x0E, - RN5T568_REPCNT = 0x0F, - RN5T568_PWRONTIMSET = 0x10, - RN5T568_NOETIMSETCNT = 0x11, - RN5T568_PWRIREN = 0x12, - RN5T568_PWRIRQ = 0x13, - RN5T568_PWRMON = 0x14, - RN5T568_PWRIRSEL = 0x15, - - RN5T568_DC1_SLOT = 0x16, - RN5T568_DC2_SLOT = 0x17, - RN5T568_DC3_SLOT = 0x18, - RN5T568_DC4_SLOT = 0x19, - - RN5T568_LDO1_SLOT = 0x1B, - RN5T568_LDO2_SLOT = 0x1C, - RN5T568_LDO3_SLOT = 0x1D, - RN5T568_LDO4_SLOT = 0x1E, - RN5T568_LDO5_SLOT = 0x1F, - - RN5T568_PSO0_SLOT = 0x25, - RN5T568_PSO1_SLOT = 0x26, - RN5T568_PSO2_SLOT = 0x27, - RN5T568_PSO3_SLOT = 0x28, - - RN5T568_LDORTC1_SLOT = 0x2A, - - RN5T568_DC1CTL = 0x2C, - RN5T568_DC1CTL2 = 0x2D, - RN5T568_DC2CTL = 0x2E, - RN5T568_DC2CTL2 = 0x2F, - RN5T568_DC3CTL = 0x30, - RN5T568_DC3CTL2 = 0x31, - RN5T568_DC4CTL = 0x32, - RN5T568_DC4CTL2 = 0x33, - - RN5T568_DC1DAC = 0x36, - RN5T568_DC2DAC = 0x37, - RN5T568_DC3DAC = 0x38, - RN5T568_DC4DAC = 0x39, - - RN5T568_DC1DAC_SLP = 0x3B, - RN5T568_DC2DAC_SLP = 0x3C, - RN5T568_DC3DAC_SLP = 0x3D, - RN5T568_DC4DAC_SLP = 0x3E, - - RN5T568_DCIREN = 0x40, - RN5T568_DCIRQ = 0x41, - RN5T568_DCIRMON = 0x42, - - RN5T568_LDOEN1 = 0x44, - RN5T568_LDOEN2 = 0x45, - RN5T568_LDODIS1 = 0x46, - - RN5T568_LDO1DAC = 0x4C, - RN5T568_LDO2DAC = 0x4D, - RN5T568_LDO3DAC = 0x4E, - RN5T568_LDO4DAC = 0x4F, - RN5T568_LDO5DAC = 0x50, - - RN5T568_LDORTC1DAC = 0x56, - RN5T568_LDORTC2DAC = 0x57, - - RN5T568_LDO1DAC_SLP = 0x58, - RN5T568_LDO2DAC_SLP = 0x59, - RN5T568_LDO3DAC_SLP = 0x5A, - RN5T568_LDO4DAC_SLP = 0x5B, - RN5T568_LDO5DAC_SLP = 0x5C, - - RN5T568_IOSEL = 0x90, - RN5T568_IOOUT = 0x91, - RN5T568_GPEDGE1 = 0x92, - RN5T568_EN_GPIR = 0x94, - RN5T568_IR_GPR = 0x95, - RN5T568_IR_GPF = 0x96, - RN5T568_MON_IOIN = 0x97, - RN5T568_GPLED_FUNC = 0x98, - RN5T568_INTPOL = 0x9C, - RN5T568_INTEN = 0x9D, - RN5T568_INTMON = 0x9E, - - RN5T568_PREVINDAC = 0xB0, - RN5T568_OVTEMP = 0xBC, - - RN5T568_MAX_REG = 0xBC, -}; - -#define RN5T568_PONHIS_ON_EXTINPON BIT(3) -#define RN5T568_PONHIS_ON_REPWRPON BIT(1) -#define RN5T568_PONHIS_ON_PWRONPON BIT(0) - -#define RN5T568_POFFHIS_N_OEPOFF BIT(7) -#define RN5T568_POFFHIS_DCLIMPOFF BIT(6) -#define RN5T568_POFFHIS_WDGPOFF BIT(5) -#define RN5T568_POFFHIS_CPUPOFF BIT(4) -#define RN5T568_POFFHIS_IODETPOFF BIT(3) -#define RN5T568_POFFHIS_VINDETPOFF BIT(2) -#define RN5T568_POFFHIS_TSHUTPOFF BIT(1) -#define RN5T568_POFFHIS_PWRONPOFF BIT(0) - -#define RN5T568_SLPCNT_SWPPWROFF BIT(0) - -#define RN5T568_REPCNT_OFF_RESETO_16MS 0x30 -#define RN5T568_REPCNT_OFF_REPWRTIM_1000MS 0x06 -#define RN5T568_REPCNT_OFF_REPWRON BIT(0) - -#endif diff --git a/include/mfd/rn5t618.h b/include/mfd/rn5t618.h new file mode 100644 index 000000000000..196ae00fb5b1 --- /dev/null +++ b/include/mfd/rn5t618.h @@ -0,0 +1,134 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (C) 2014 Beniamino Galvani <[email protected]> + * Copyright (C) 2016 Toradex AG + */ + +#ifndef __MFD_RN5T618_H +#define __MFD_RN5T618_H + +#include <linux/bits.h> + +/* RN5T618 registers */ +enum { + RN5T618_LSIVER = 0x00, + RN5T618_OTPVER = 0x01, + RN5T618_IODAC = 0x02, + RN5T618_VINDAC = 0x03, + RN5T618_OUT32KEN = 0x05, + + RN5T618_CPUCNT = 0x06, + + RN5T618_PSWR = 0x07, + RN5T618_PONHIS = 0x09, + RN5T618_POFFHIS = 0x0A, + RN5T618_WATCHDOG = 0x0B, + RN5T618_WATCHDOGCNT = 0x0C, + RN5T618_PWRFUNC = 0x0D, + RN5T618_SLPCNT = 0x0E, + RN5T618_REPCNT = 0x0F, + RN5T618_PWRONTIMSET = 0x10, + RN5T618_NOETIMSETCNT = 0x11, + RN5T618_PWRIREN = 0x12, + RN5T618_PWRIRQ = 0x13, + RN5T618_PWRMON = 0x14, + RN5T618_PWRIRSEL = 0x15, + + RN5T618_DC1_SLOT = 0x16, + RN5T618_DC2_SLOT = 0x17, + RN5T618_DC3_SLOT = 0x18, + RN5T618_DC4_SLOT = 0x19, + + RN5T618_LDO1_SLOT = 0x1B, + RN5T618_LDO2_SLOT = 0x1C, + RN5T618_LDO3_SLOT = 0x1D, + RN5T618_LDO4_SLOT = 0x1E, + RN5T618_LDO5_SLOT = 0x1F, + + RN5T618_PSO0_SLOT = 0x25, + RN5T618_PSO1_SLOT = 0x26, + RN5T618_PSO2_SLOT = 0x27, + RN5T618_PSO3_SLOT = 0x28, + + RN5T618_LDORTC1_SLOT = 0x2A, + + RN5T618_DC1CTL = 0x2C, + RN5T618_DC1CTL2 = 0x2D, + RN5T618_DC2CTL = 0x2E, + RN5T618_DC2CTL2 = 0x2F, + RN5T618_DC3CTL = 0x30, + RN5T618_DC3CTL2 = 0x31, + RN5T618_DC4CTL = 0x32, + RN5T618_DC4CTL2 = 0x33, + + RN5T618_DC1DAC = 0x36, + RN5T618_DC2DAC = 0x37, + RN5T618_DC3DAC = 0x38, + RN5T618_DC4DAC = 0x39, + + RN5T618_DC1DAC_SLP = 0x3B, + RN5T618_DC2DAC_SLP = 0x3C, + RN5T618_DC3DAC_SLP = 0x3D, + RN5T618_DC4DAC_SLP = 0x3E, + + RN5T618_DCIREN = 0x40, + RN5T618_DCIRQ = 0x41, + RN5T618_DCIRMON = 0x42, + + RN5T618_LDOEN1 = 0x44, + RN5T618_LDOEN2 = 0x45, + RN5T618_LDODIS1 = 0x46, + + RN5T618_LDO1DAC = 0x4C, + RN5T618_LDO2DAC = 0x4D, + RN5T618_LDO3DAC = 0x4E, + RN5T618_LDO4DAC = 0x4F, + RN5T618_LDO5DAC = 0x50, + + RN5T618_LDORTC1DAC = 0x56, + RN5T618_LDORTC2DAC = 0x57, + + RN5T618_LDO1DAC_SLP = 0x58, + RN5T618_LDO2DAC_SLP = 0x59, + RN5T618_LDO3DAC_SLP = 0x5A, + RN5T618_LDO4DAC_SLP = 0x5B, + RN5T618_LDO5DAC_SLP = 0x5C, + + RN5T618_IOSEL = 0x90, + RN5T618_IOOUT = 0x91, + RN5T618_GPEDGE1 = 0x92, + RN5T618_EN_GPIR = 0x94, + RN5T618_IR_GPR = 0x95, + RN5T618_IR_GPF = 0x96, + RN5T618_MON_IOIN = 0x97, + RN5T618_GPLED_FUNC = 0x98, + RN5T618_INTPOL = 0x9C, + RN5T618_INTEN = 0x9D, + RN5T618_INTMON = 0x9E, + + RN5T618_PREVINDAC = 0xB0, + RN5T618_OVTEMP = 0xBC, + + RN5T618_MAX_REG = 0xBC, +}; + +#define RN5T618_PONHIS_ON_EXTINPON BIT(3) +#define RN5T618_PONHIS_ON_REPWRPON BIT(1) +#define RN5T618_PONHIS_ON_PWRONPON BIT(0) + +#define RN5T618_POFFHIS_N_OEPOFF BIT(7) +#define RN5T618_POFFHIS_DCLIMPOFF BIT(6) +#define RN5T618_POFFHIS_WDGPOFF BIT(5) +#define RN5T618_POFFHIS_CPUPOFF BIT(4) +#define RN5T618_POFFHIS_IODETPOFF BIT(3) +#define RN5T618_POFFHIS_VINDETPOFF BIT(2) +#define RN5T618_POFFHIS_TSHUTPOFF BIT(1) +#define RN5T618_POFFHIS_PWRONPOFF BIT(0) + +#define RN5T618_SLPCNT_SWPPWROFF BIT(0) + +#define RN5T618_REPCNT_OFF_RESETO_16MS 0x30 +#define RN5T618_REPCNT_OFF_REPWRTIM_1000MS 0x06 +#define RN5T618_REPCNT_OFF_REPWRON BIT(0) + +#endif base-commit: 6c70fb327d486376c1f2e37dfff2212cb9eebb1b -- 2.47.3
