mfd: Add Renesas Synchronization Management Unit (SMU) support
PATCH 1/1 mfd: Add Renesas Synchronization Management Unit (SMU) support
From: Min Li <[email protected]>
Add support for ClockMatrix(TM) and 82P33xxx families of timing and synchronization devices. The access interface can be either SPI or I2C. Currently, it will create 2 types of MFD devices, which are to be used by the corresponding rsmu character device driver and the PTP hardware clock driver, respectively.
--- drivers/mfd/Kconfig | 28 +- drivers/mfd/Makefile | 2 + drivers/mfd/rsmu_i2c.c | 344 +++++++++++++++++ drivers/mfd/rsmu_private.h | 32 ++ drivers/mfd/rsmu_spi.c | 371 ++++++++++++++++++ include/linux/mfd/idt82p33_reg.h | 102 +++++ include/linux/mfd/idt8a340_reg.h | 817 +++++++++++++++++++++++++++++++++++++++ include/linux/mfd/rsmu.h | 42 ++ 8 files changed, 1737 insertions(+), 1 deletion(-) create mode 100644 drivers/mfd/rsmu_i2c.c create mode 100644 drivers/mfd/rsmu_private.h create mode 100644 drivers/mfd/rsmu_spi.c create mode 100644 include/linux/mfd/idt82p33_reg.h create mode 100644 include/linux/mfd/idt8a340_reg.h create mode 100644 include/linux/mfd/rsmu.h
drivers/mfd/Kconfig +27 -1
@@ -2087,6 +2087,32 @@ config MFD_ACER_A500_EC The controller itself is ENE KB930, it is running firmware customized for the specific needs of the Acer A500 hardware. +config MFD_RSMU_I2C + tristate "Renesas Synchronization Management Unit with I2C" + depends on I2C && OF + select MFD_CORE + help + Support for the Renesas synchronization management unit, such as + Clockmatrix and 82P33XXX series. This option supports I2C as + the control interface. + + This driver provides common support for accessing the device, + additional drivers must be enabled in order to use the functionality + of the device. + +config MFD_RSMU_SPI + tristate "Renesas Synchronization Management Unit with SPI" + depends on SPI && OF + select MFD_CORE + help + Support for the Renesas synchronization management unit, such as + Clockmatrix and 82P33XXX series. This option supports SPI as + the control interface. + + This driver provides common support for accessing the device, + additional drivers must be enabled in order to use the functionality + of the device. + menu "Multimedia Capabilities Port drivers" depends on ARCH_SA1100
@@ -2131,7 +2157,7 @@ config RAVE_SP_CORE device found on several devices in RAVE line of hardware. config SGI_MFD_IOC3 - bool "SGI IOC3 core driver" + tristate "SGI IOC3 core driver" depends on PCI && MIPS && 64BIT select MFD_CORE help
drivers/mfd/Makefile +2 -0
@@ -237,6 +237,8 @@ obj-$(CONFIG_MFD_HI655X_PMIC) += hi655x-pmic.o obj-$(CONFIG_MFD_DLN2) += dln2.o obj-$(CONFIG_MFD_RT5033) += rt5033.o obj-$(CONFIG_MFD_SKY81452) += sky81452.o +obj-$(CONFIG_MFD_RSMU_I2C) += rsmu_i2c.o +obj-$(CONFIG_MFD_RSMU_SPI) += rsmu_spi.o intel-soc-pmic-objs := intel_soc_pmic_core.o intel_soc_pmic_crc.o obj-$(CONFIG_INTEL_SOC_PMIC) += intel-soc-pmic.o
drivers/mfd/rsmu_i2c.c new file +344 -0
344 lines not on this page · raw message
drivers/mfd/rsmu_private.h new file +32 -0
@@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* +* Multi-function driver for the IDT ClockMatrix(TM) and 82p33xxx families of +* timing and synchronization devices. +* +* Copyright (C) 2019 Integrated Device Technology, Inc., a Renesas Company. +*/ + +#ifndef __RSMU_MFD_PRIVATE_H +#define __RSMU_MFD_PRIVATE_H + +#include <linux/mfd/rsmu.h> + +/* Maximum number of mfd devices */ +#define RSMU_MAX_MFD_DEV 4 + +struct rsmu_dev { +struct device *dev; +void *client; +struct regmap *regmap; +struct mutex lock; +enum rsmu_type type; +u8 index; +u16 page; +}; + +enum rsmu_mfd_type { +RSMU_MFD_PTP =0 , +RSMU_MFD_CDEV =1 , +RSMU_MFD_NUM =2 , +}; +#endif /* __LINUX_MFD_RSMU_H */
drivers/mfd/rsmu_spi.c new file +371 -0
371 lines not on this page · raw message
include/linux/mfd/idt82p33_reg.h new file +102 -0
102 lines not on this page · raw message
include/linux/mfd/idt8a340_reg.h new file +817 -0
817 lines not on this page · raw message
include/linux/mfd/rsmu.h new file +42 -0
42 lines not on this page · raw message
Signature · 1 line
2.7.4
kernel test robot
build botThank you for the patch! Yet something to improve:
Hi,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on net-next/master]
url: https://github.com/0day-ci/linux/commits/min-li-xe-renesas-com/mfd-Add-Renesas-Synchronization-Management-Unit-SMU-support/20210314-014512 base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 5ab6f96a12f4f28d5a283dcf46b004cc653246a1 config: openrisc-randconfig-r001-20210314 (attached as .config) compiler: or1k-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/4d537d85df739a32487e30fb69388b030577cb42
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review min-li-xe-renesas-com/mfd-Add-Renesas-Synchronization-Management-Unit-SMU-support/20210314-014512 git checkout 4d537d85df739a32487e30fb69388b030577cb42
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=openrisc
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
or1k-linux-ld: drivers/mfd/rsmu_spi.o: in function `rsmu_read':
>> rsmu_spi.c:(.text+0x6bc): multiple definition of `rsmu_read'; drivers/mfd/rsmu_i2c.o:rsmu_i2c.c:(.text+0x400): first defined here or1k-linux-ld: drivers/mfd/rsmu_spi.o: in function `rsmu_write': >> rsmu_spi.c:(.text+0x770): multiple definition of `rsmu_write'; drivers/mfd/rsmu_i2c.o:rsmu_i2c.c:(.text+0x434): first defined here
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build botThank you for the patch! Yet something to improve:
Hi,
Thank you for the patch! Yet something to improve:
[auto build test ERROR on net-next/master]
url: https://github.com/0day-ci/linux/commits/min-li-xe-renesas-com/mfd-Add-Renesas-Synchronization-Management-Unit-SMU-support/20210314-014512 base: https://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next.git 5ab6f96a12f4f28d5a283dcf46b004cc653246a1 config: i386-randconfig-s032-20210314 (attached as .config) compiler: gcc-9 (Debian 9.3.0-22) 9.3.0 reproduce: # apt-get install sparse # sparse version: v0.6.3-262-g5e674421-dirty # https://github.com/0day-ci/linux/commit/4d537d85df739a32487e30fb69388b030577cb42 git remote add linux-review https://github.com/0day-ci/linux git fetch --no-tags linux-review min-li-xe-renesas-com/mfd-Add-Renesas-Synchronization-Management-Unit-SMU-support/20210314-014512 git checkout 4d537d85df739a32487e30fb69388b030577cb42 # save the attached .config to linux build tree make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
ld: drivers/mfd/rsmu_spi.o: in function `rsmu_read':
>> drivers/mfd/rsmu_spi.c:187: multiple definition of `rsmu_read'; drivers/mfd/rsmu_i2c.o:drivers/mfd/rsmu_i2c.c:171: first defined here ld: drivers/mfd/rsmu_spi.o: in function `rsmu_write': >> drivers/mfd/rsmu_spi.c:206: multiple definition of `rsmu_write'; drivers/mfd/rsmu_i2c.o:drivers/mfd/rsmu_i2c.c:179: first defined here
vim +187 drivers/mfd/rsmu_spi.c
185
186 int rsmu_read(struct device *dev, u16 reg, u8 *buf, u16 size)
> 187 {
188 struct rsmu_dev *rsmu = dev_get_drvdata(dev);
189 u8 addr = (u8)(reg & RSMU_LOWER_ADDR_MASK);
190 int err;
191
192 err = rsmu_write_page_register(rsmu, reg);
193 if (err)
194 return err;
195
196 err = rsmu_read_device(rsmu, addr, buf, size);
197 if (err)
198 dev_err(rsmu->dev,
199 "failed to read offset address 0x%x\n", addr);
200
201 return err;
202 }
203 EXPORT_SYMBOL_GPL(rsmu_read);
204
205 int rsmu_write(struct device *dev, u16 reg, u8 *buf, u16 size)
> 206 { 207 struct rsmu_dev *rsmu = dev_get_drvdata(dev);
208 u8 addr = (u8)(reg & RSMU_LOWER_ADDR_MASK);
209 int err;
210
211 err = rsmu_write_page_register(rsmu, reg);
212 if (err)
213 return err;
214
215 err = rsmu_write_device(rsmu, addr, buf, size);
216 if (err)
217 dev_err(rsmu->dev,
218 "failed to write offset address 0x%x\n", addr);
219
220 return err;
221 }
222 EXPORT_SYMBOL_GPL(rsmu_write);
223
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org