summaryrefslogtreecommitdiffstats
path: root/drivers/mfd
Commit message (Collapse)AuthorAgeFilesLines
* mfd: mc34704: fix register readingUwe Kleine-König2020-10-211-2/+2
| | | | | | | | | | | According to the data sheet (MC34704 Rev. 8.0, 12/2014) must always have the MSB set in the "Sub-address" byte for reads. This fixes reading out registers on a MC34704AEP chip. Fixes: 514387711f2d ("i2c: add driver for the MC34704 PMIC") Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/percent_pe' into masterSascha Hauer2020-10-141-2/+1
|\
| * vsprintf: retire strerrorp in favor of %peAhmad Fatoum2020-09-291-2/+1
| | | | | | | | | | | | | | | | | | strerrorp() is only used along with printf. We now have a format specifier for printing error pointers directly, so use that and remove strerrorp. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/driver-macro' into masterSascha Hauer2020-10-142-27/+10
|\ \
| * | treewide: Use driver macroSascha Hauer2020-09-292-27/+10
| |/ | | | | | | | | | | | | We have several macros for a oneline driver registration. Add some missing and use them consistently where possible througout the tree. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / driver: migrate some from dev_get_drvdata to device_get_match_dataAhmad Fatoum2020-10-091-3/+1
|/ | | | | | | | The dev_get_drvdata instances here all store a valid pointer in the match data and can be readily converted. Do so. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mfd: add Atmel Flexcom supportAhmad Fatoum2020-08-033-0/+84
| | | | | | | | | | | | | | This is a wrapper which embeds a SPI controller, a I2C controller and a USART. Only one function can be used at a time. The choice is done at boot time by the probe function of this MFD driver according to a device tree property. These IP cores are available in the sama5d2 and sam9x60. We already have support for all three configurations, only thing we need is the MFD selecting one of them. Add this. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mfd: superio: depend on X86 || COMPILE_TESTAhmad Fatoum2020-07-141-0/+2
| | | | | | | | Super I/O chips are usually found x86 PCs. Make them depend on it, so users of other arches aren't prompted for it, when they oldconfig. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mfd: superio: smsc: fix C99ism initial declaration in for loopAhmad Fatoum2020-07-141-1/+2
| | | | | | | | | | | Codebase is meant to be gnu89, but was only enforced starting with bc4840e98b94 ("kbuild: add -Wmissing-prototypes and -std=gnu89 to KBUILD_HOSTCFLAGS"). Since then, this driver no longer compiles. Fix this. Fixes: eaf020f1bb52 ("mfd: superio: add base SMSC MFD driver") Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: make use of PTR_ERR_OR_ZEROUwe Kleine-König2020-06-261-4/+1
| | | | | | | | | | | PTR_ERR_OR_ZERO is designed to replace boiler plate like: if (IS_ERR(x)) return PTR_ERR(x); return 0; Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/stm32'Sascha Hauer2020-05-141-1/+1
|\
| * mfd: stpmic1: move to coredevice levelLucas Stach2020-05-121-1/+1
| | | | | | | | | | | | | | | | The PMIC provides regulators, which are needed before other devices can probe. Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | drivers: mark first batch of compilable drivers for COMPILE_TESTAhmad Fatoum2020-05-081-1/+1
|/ | | | | | | | | All of these drivers have a runtime dependency on SoC peripherals, but can nevertheless be compile-tested. Add COMPILE_TEST as an alternate dependency. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/spi'Sascha Hauer2020-04-161-4/+27
|\
| * regmap-mmio: Add big endian supportSascha Hauer2020-04-141-4/+27
| | | | | | | | | | | | Add support for parsing the big-endian device tree property. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/pwm'Sascha Hauer2020-04-163-0/+82
|\ \
| * | PWM: add support for STM32Ahmad Fatoum2020-03-313-0/+82
| |/ | | | | | | | | | | | | | | This driver adds support for PWM driver on STM32 platform based on the Linux v5.4 support. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mfd: syscon: implement device_node_to_regmapAhmad Fatoum2020-04-151-5/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Extend our syscon API with a device_node_to_regmap function that has the same semantics as upstream: __________________________________________________________________________ | Linux commit 39233b7c611248c0d05209b4854bc63e26485655 | CommitDate: Thu Aug 8 15:30:07 2019 -0700 | | mfd/syscon: Add device_node_to_regmap() | | device_node_to_regmap() is exactly like syscon_node_to_regmap(), but it | does not check that the node is compatible with "syscon", and won't | attach the first clock it finds to the regmap. | | The rationale behind this, is that one device node with a standard | compatible string "foo,bar" can be covered by multiple drivers sharing a | regmap, or by a single driver doing all the job without a regmap, but | these are implementation details which shouldn't reflect on the | devicetree. | | Signed-off-by: Paul Cercueil <paul@crapouillou.net> | Acked-by: Arnd Bergmann <arnd@arndb.de> | Signed-off-by: Paul Burton <paul.burton@mips.com> |__________________________________________________________________________ Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mfd: syscon: refactor of_syscon_register compatible checkAhmad Fatoum2020-04-151-7/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Linux also provides a device_node_to_regmap function that doesn't do a compatible = "syscon" check. In preparation for having it in barebox, factor out the compatible check into the callers. While at it make the clock checking explicit, so the diff clearly indicates, we touched all instances and to prepare for follow-up commits. No functional change. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mfd: syscon: enable specified clocks on syscon_base_lookup_by_phandleAhmad Fatoum2020-04-151-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since commit b36b7b72 ("mfd: syscon: clock peripheral if specified in device tree"), we now clock syscons during access if the device tree nodes indicate a clocks property. We haven't been doing this for syscon_base_lookup_by_phandle though, because we did this as part of the regmap access functions, but that function returns a direct pointer to the MMIO region. The best way forward is probably dropping the syscon_base API altogether and change users to the regmap API instead, but for now, make the behavior consistent by enabling it permanently. This makes use safe from breakage that results from upstream device trees moving a clock from the consumer to the syscon provider (like in [1]) I've reviewed the current driver code users of syscon_base_lookup_by_phandle and all upstream device trees that match against the drivers lack a clocks property, so this shouldn't alter behavior (for now). [1]: c9322d4fe ("net: designware: eqos: stm32: drop no longer needed syscfg-clk") Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mfd: double-quote the menu prompt of MFDMasahiro Yamada2020-04-151-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Linux commit 801b27db4638 ("kconfig: drop T_WORD from the RHS of 'prompt' symbol") requires every prompt to be quoted even if it is a single word. This is the only place with no quoting. It must be surrounded by double-quotes in order to sync Kconfig to Linux 5.6-rc1 or later. While I was here, I reworded "MFD" to "Multifunction device drivers" to be consistent with Linux. Signed-off-by: Masahiro Yamada <masahiroy@kernel.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mfd: rave-sp: Fix rave_sp_emulated_get_status()Andrey Smirnov2020-04-011-1/+1
|/ | | | | | | | | Original code in rave_sp_emulated_get_status() got the meaning of RAVE_SP_STATUS_GS_FIRMWARE_MODE wrong. Invert it to correctly detect if RAVE SP device is in bootloader mode or not. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mfd: syscon: clock peripheral if specified in device treeAhmad Fatoum2020-02-191-2/+18
| | | | | | | | | | Linux supports a clocks property in syscon nodes to indicate that access should only occur with the clock active. Attach the clock to the regmap if found. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mfd: syscon: use regmap-mmio as backendAhmad Fatoum2020-02-191-25/+2
| | | | | | | | | Linux supports a clocks property in syscon nodes to indicate that access should only occur with the clock active. The new regmap-mmio supports this, thus port syscon over, so it can make use of it in a later commit. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/watchdog'Sascha Hauer2019-12-102-2/+0
|\
| * watchdog: always populate watchdog priority from device tree if possibleAhmad Fatoum2019-11-112-2/+0
| | | | | | | | | | | | | | | | | | | | | | So far, only the da9063 and da9053 have made use of the optional barebox watchdog-priority binding. Move it into the core, so other device drivers automatically have their watchdog-priority property parsed as well. This patch doesn't introduce any functional changes for upstream boards. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/stm32'Sascha Hauer2019-12-101-2/+1
|\ \
| * | mfd: stpmic1: use register define from headerAhmad Fatoum2019-11-131-2/+1
| |/ | | | | | | | | | | | | | | | | A previous commit has copied over the upstream <linux/mfd/stpmic1.h> header. Use it instead of replicating register definitions in the MFD and watchdog cell driver. No functional change. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mfd: da9063: don't try to register gpiochip when GPIOLIB isn't builtLucas Stach2019-12-021-7/+9
| | | | | | | | | | | | Fixes: feee4b638048 (gpio: add DA9062 MFD gpio support) Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mfd: superio: add missing semicolon after EXPORT_SYMBOLLucas Stach2019-12-021-2/+2
| | | | | | | | | | | | Fixes: efd517c35f12 (mfd: add basic Super I/O chip helpers) Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mfd: da9053: fix typo in variable nameLucas Stach2019-11-251-1/+1
|/ | | | | | Fixes: 06928c7d1758 (mfd: da9053: use new reset_source_set_device) Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/watchdog'Sascha Hauer2019-11-071-1/+13
|\
| * mfd: da9063: fix watchdog ping executionMarco Felsch2019-11-051-0/+12
| | | | | | | | | | | | | | | | | | The watchdog resets the system if the watchdog gets pinged to fast. Between each watchdog ping must be a pause of at least 200ms. This commit fixes that by rejecting two fast requests. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mfd: da9063: fix TWDSCALE debug messageMarco Felsch2019-11-051-1/+1
| | | | | | | | | | | | | | | | | | The TWDSCALE is the found scale + 1 as described in the datasheets for the DA9062/3 devices. The driver logic is correct just the debug message is wrong. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/stm32'Sascha Hauer2019-11-071-1/+0
|\ \
| * | mfd: stpmic1: use dev_get_regmap instead of priv memberAhmad Fatoum2019-11-061-1/+0
| |/ | | | | | | | | | | | | | | | | When we call regmap_init, the regmap is associated with the device supplied and can be queried with dev_get_regmap. This is more natural than expecting cell drivers to cast dev->parent->priv. Do it. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / mfd: superio: use strerrorp helper instead of open-codingAhmad Fatoum2019-10-281-1/+1
|/ | | | | | | Apparently, we have a helper for strerror(-PTR_ERR(regmap)). Use it. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mfd: superio: add base SMSC MFD driverAhmad Fatoum2019-10-143-0/+122
| | | | | | | | | The SMSC FDC37C93xAPM is the Super I/O chip on the Dell Latitude 7490. This adds device detection for it and its siblings, so device drivers can be written against it or init scripts can use its regmap interface. Signed-off-by: Ahmad Fatoum <ahmad@a3f.at> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mfd: superio: add Fintek MFD driverAhmad Fatoum2019-10-143-0/+129
| | | | | | | | | Super I/O chips require a password to unlock access to the I/O ports. Add a driver that pokes the password and registers the appropriate GPIO and Watchdog devices as well as a regmap reflecting the Super I/O chip. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mfd: add basic Super I/O chip helpersAhmad Fatoum2019-10-143-0/+102
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Super I/O chips are ICs common to x86 that are used for interfacing to low-bandwidth peripherals. They often contain serial ports, watchdog timers and hardware monitoring units. They are usually addressable via one of two I/O port pairs, either 0x2e-0x2f or 0x4e-0x4f, but they don't typically respond to reads from their range unless a device-specific 'password' has been poked in. After this is done, they are read and written in the same manner however. On Linux, these devices aren't subject to any device/driver model. Each driver for some function (e.g. watchdog or GPIO) duplicates the device probe in the module_init and board-specific configuration is handled via module parameters. Lets do it a bit fancier in barebox and add a helper to register chips and a regmap for the control and configuration registers as well as a helper to register child devices for each function contained within the Super I/O chip. Board-specific configuration, e.g. which pin to use as a watchdog reset, can then be realized using barebox device-specific parameters. The regmap will be more of a debugging aid, however. For ease of porting from Linux, it's expected that access to the I/O ports won't happen via the regmap. For this reason, the new <superio.h> header offers functions to read/write these chips' registers as well. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* gpio: add DA9062 MFD gpio supportMarco Felsch2019-10-141-0/+136
| | | | | | | | | The DA9062 PMIC is a mfd device which have 5 gpios. These can be configured to work as input/output or to have an alternate function. This commit adds the support to configure the gpios as input or output. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mfd: da9063: add support to populate subdevsMarco Felsch2019-10-141-0/+3
| | | | | | | | | | The upstream dt-bindings abstracts the DA9063/2 PMIC MFD by multiple of-subnodes and the linux-mfd core creates platform-devices for each node. Due to the lack of a mfd fw we need to add the platform-devices by our own to reuse the upstream bindings. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/stm32'Sascha Hauer2019-09-123-0/+106
|\
| * mfd: add support for STPMIC1Ahmad Fatoum2019-09-093-0/+106
| | | | | | | | | | | | | | | | | | The PMIC is addressable over I2C and, besides power management, integrates a watchdog, a user power on key handling and 64 bit of non-volatile memory. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/reset-source'Sascha Hauer2019-09-122-8/+2
|\ \
| * | mfd: da9063: use new reset_source_set_device()Uwe Kleine-König2019-09-091-4/+1
| | | | | | | | | | | | | | | | | | | | | | | | Make use of the just introduced reset_source_set_device() to save some boilerplate. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | mfd: da9053: use new reset_source_set_device()Uwe Kleine-König2019-09-091-4/+1
| |/ | | | | | | | | | | | | | | Make use of the just introduced reset_source_set_device() to save some boilerplate. Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / mfd: rave-sp: Emulate firmware/bootloader mode reporting on RDU2Andrey Smirnov2019-09-091-2/+16
|/ | | | | | | | | Add code to emulate firmware/bootloader mode reporting via "general_status" field on RDU2. This is needed to correctly report if RAVE SP is in bootloader of application mode during startup. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mfd: syscon: add syscon_regmap_lookup_by_phandle()Marcin Niestroj2019-07-021-0/+19
| | | | | | | | This function is handy when syscon is passed as phandle to device_node property. Signed-off-by: Marcin Niestroj <m.niestroj@grinn-global.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* treewide: Add missing includesSascha Hauer2019-03-181-0/+1
| | | | | | | | | Many files in the tree implement functions, but do not include the header files which provide the prototypes for these functions. This means conflicting prototypes remain undetected. Add the missing includes. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>