summaryrefslogtreecommitdiffstats
path: root/drivers/mfd
Commit message (Collapse)AuthorAgeFilesLines
* 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>
* regmap: Implement syscon_regmap_lookup_by_compatible()Ahmad Fatoum2019-02-251-0/+14
| | | | | | | | | Implement syscon_regmap_lookup_by_compatible() to simplify porting kernel code. Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de> Signed-off-by: Sam Ravnborg <sam@ravnborg.org> Tested-by: Ladislav Michl <ladis@linux-mips.org> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* devfs: Drop dev_lseek_default()Andrey Smirnov2019-01-296-6/+0
| | | | | | | | | | | | | | | | | | | | | Only the following cdevs do not declare an .lseek() operation: - Console devices in common/console.c - Firmware framework in common/firmware.c - JTAG driver in drivers/misc/jtag.c - UBI in drivers/mtd/ubi/barebox.c Of those four, first two are marked DEVFS_IS_CHARACTER_DEV and implement only .write() operation and the last two don't implement anything but .ioctl(). While there's probably no meaningful way to use lseek() against any of those devices, there doesn't seem to be any harm in allowing it either. Change devfs_lseek() to ignore absense of .lseek() callback and drop dev_lseek_default() and all references to it in the codebase. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2019-01-152-7/+3
|\
| * mfd: syscon: Switch to using %pa to print memory addressesAndrey Smirnov2019-01-091-1/+1
| | | | | | | | | | | | | | | | Switch to using %pa to print memory addresses in order to be able to support both 64 and 32 bit builds. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mfd: rave-sp: Make use of wait_on_timeout()Andrey Smirnov2018-12-101-6/+2
| | | | | | | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mfd: rave-sp: Add parameters to query IP address/netmaskAndrey Smirnov2018-12-131-0/+72
|/ | | | | | | | | | | | Unlike LCD type information, IP address as well as netmaks are not stored in an easily usable format in RAVE SP EEPROM. In order to obtain them we need to issue a special command to RAVE SP. For that purpose add device "sp" and expose that data as a device parameters (sp.ipaddr and sp.netmask, correspondingly) Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mfd: da9063: fix wrong NULL pointer testOleksij Rempel2018-11-211-1/+1
| | | | | | | | checking for priv == NULL and using in this case priv->dev makes no sense. Signed-off-by: Oleksij Rempel <linux@rempel-privat.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* i2c: introduce device_i2c_driver() macroMarco Felsch2018-10-199-79/+9
| | | | | | | | | Add macro and dependency to avoid boilerplate code. Since now simple i2c drivers only have to include the i2c.h header and call the device_i2c_driver() macro to register a i2c device driver. Signed-off-by: Marco Felsch <m.felsch@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mfd: rave-sp: Emulate CMD_GET_STATUS on device that don't support itAndrey Smirnov2018-08-311-34/+66
| | | | | | | | | | | | | | CMD_GET_STATUS is not supported by some devices implementing RDU2-compatible ICD as well as "legacy" devices. To account for that fact, add code that obtains the same information (app/bootloader FW version) using several different commands. This is a backport of Linux kernel patch [1] [1] https://lore.kernel.org/lkml/20180707024108.32373-5-andrew.smirnov@gmail.com/T/#md1b7130a992235d57cabadc8e59fc74ee3b21d9e Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mfd: rave-sp: Add legacy watchdog ping command translationAndrey Smirnov2018-08-311-0/+2
| | | | | | | | | | | | This is needed to make rave-sp-wdt driver to properly ping the watchdog on "legacy" firmware. This is a backport of Linux kernel patch [1] [1] https://lore.kernel.org/lkml/20180707024108.32373-5-andrew.smirnov@gmail.com/T/#m767615239f8aa681a2dc0ccfe1c877e4cbb0edf6 Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mfd: rave-sp: Add mapping for legacy EEPROM commandAndrey Smirnov2018-08-311-0/+2
| | | | | | | | | | | | This is needed to make rave-sp-eeprom driver work on "legacy" firmware. This is a backport of Linux kernel patch [1] [1] https://lore.kernel.org/lkml/20180707024108.32373-5-andrew.smirnov@gmail.com/T/#mae2272763ae092b5b11ab128f5c22039d55557cb Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mfd: rave-sp: Fix incorrectly specified checksum typeAndrey Smirnov2018-08-311-1/+1
| | | | | | | | | | | | RAVE SP firmware covered by "legacy" variant uses 16-bit CCITT checksum algorithm. Change the code to correctly reflect that. This is a backport of Linux kernel patch [1] [1] https://lore.kernel.org/lkml/20180707024108.32373-5-andrew.smirnov@gmail.com/T/#m6251b0a4869dd303c21910fc99f2ce127cf8aae0 Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mfd: rave-sp: Remove unused definesAndrey Smirnov2018-08-311-10/+0
| | | | | | | | | | | | Remove unusded defines that are a leftover from earlier iterations of the driver. This is a backport of Linux kernel patch [1] [1] https://lore.kernel.org/lkml/20180707024108.32373-5-andrew.smirnov@gmail.com/T/#m02a75392c729828f822e2cd52f86e541b1649a27 Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* wdt: da9053: fix missed dev->hwdev conversionLucas Stach2018-06-081-1/+1
| | | | | | Fixes: 1ef7cd07a304 (watchdog: rename dev to hwdev) Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/misc'Sascha Hauer2018-05-093-0/+767
|\
| * mfd: Port RAVE SP driver from Linux kernelAndrey Smirnov2018-05-043-0/+767
| | | | | | | | | | | | | | Port MFD driver for RAVE SP from Linux kernel. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/mfd-dialog'Sascha Hauer2018-05-092-12/+149
|\ \
| * | mfd: da9063: update Kconfig for DA9062Stefan Christ2018-04-121-1/+1
| | | | | | | | | | | | | | | Signed-off-by: Stefan Christ <s.christ@phytec.de> Signed-off-by: Christian Hemp <c.hemp@phytec.de>
| * | mfd: da9063: read out and report device idEnrico Scholz2018-04-121-0/+13
| | | | | | | | | | | | | | | | | | | | | | | | just some kind of debugging atm... Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Tested-by: Stefan Christ <s.christ@phytec.de> Signed-off-by: Christian Hemp <c.hemp@phytec.de>
| * | mfd: da9063: added of_device_id informationEnrico Scholz2018-04-121-0/+47
| | | | | | | | | | | | | | | | | | Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Tested-by: Stefan Christ <s.christ@phytec.de> Signed-off-by: Christian Hemp <c.hemp@phytec.de>
| * | mfd: da9063: add device specific init functionEnrico Scholz2018-04-121-1/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | Provide some more information about the used PMIC type; later patches will add support for DA9062 which needs a custom init function. Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Tested-by: Stefan Christ <s.christ@phytec.de> Signed-off-by: Christian Hemp <c.hemp@phytec.de>
| * | mfd: da9063: use da906x_reg_update()Enrico Scholz2018-04-121-9/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Use the previously added da906x_reg_update() function. NOTE: patch depends on another patchset ("da9063: reset watchdog timer"), Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Tested-by: Stefan Christ <s.christ@phytec.de> Signed-off-by: Christian Hemp <c.hemp@phytec.de>
| * | mfd: da9063: added generic reg_update() functionEnrico Scholz2018-04-121-0/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Used to set or clear bits of a register. The calculation of 'client' might look odd and unnecessary complicated. But style prepares access to other register banks which is added in following patches. Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Tested-by: Stefan Christ <s.christ@phytec.de> Signed-off-by: Christian Hemp <c.hemp@phytec.de>
| * | mfd: da9063: reset watchdog timerEnrico Scholz2018-04-121-2/+34
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Setting the new timeout does not suffice for restarting the watchdog; the self-clearing bit in CONTROL_F must be set too. barebox does not provide a ping function in its watchdog api to restart the watchdog timer. Detect ping vs. set_timeout() by comparing the actual with the previous timeout value. Signed-off-by: Enrico Scholz <enrico.scholz@sigma-chemnitz.de> Tested-by: Stefan Christ <s.christ@phytec.de> Signed-off-by: Christian Hemp <c.hemp@phytec.de>
* | | Merge branch 'for-next/aiodev'Sascha Hauer2018-05-091-0/+15
|\ \ \ | |/ / |/| |
| * | aiodev: mc13xxx: add adc supportAndrey Gusakov2018-04-101-0/+3
| | | | | | | | | | | | | | | Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * | mfd: mc13xxx: add function returning mc13xxx typeAndrey Gusakov2018-04-101-0/+12
| |/ | | | | | | | | Signed-off-by: Andrey Gusakov <andrey.gusakov@cogentembedded.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* / mfd: da9063: Fix compilationSascha Hauer2018-04-121-1/+1
|/ | | | | | Fixes: 1ef7cd07a3 watchdog: rename dev to hwdev Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* rename file_operations -> cdev_operationsSascha Hauer2018-04-066-6/+6
| | | | | | | | Linux also has struct file_operations which are something different. Rename our file_operations to cdev_operations which better matches what we have. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* regmap: Implement syscon_node_to_regmap()Andrey Smirnov2017-03-091-1/+53
| | | | | | | Implement syscon_node_to_regmap() to simplify porting kernel code. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* da9053: add dt_ids to be probed by devicetreeMichael Grzeschik2017-01-101-0/+9
| | | | | | | | We add the da9052 compatible to get this driver probed by devicetree users. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* da9053: reset FAULTLOG after readMichael Grzeschik2017-01-101-0/+4
| | | | | | | | | | The driver has to reset the FAULTLOG register after every read by writing the value back. In the current case the FALUTLOG register keep its value over every software reset and will only reset on power-off. This drives the reset-source value unreliable. Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mfd: syscon: drop EXPORT_SYMBOL for static functionLucas Stach2016-10-041-2/+0
| | | | | Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mfd mc13xxx: add MC13892_REVISION_2_4Alexander Kurz2016-08-181-0/+1
| | | | | | | | An MC13892CJ having REV[4:0]=0x14 can be found in the kindle-d01100. Add the revision to the list to support this device. Signed-off-by: Alexander Kurz <akurz@blala.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* Merge branch 'for-next/syscon'Sascha Hauer2016-08-031-21/+62
|\
| * mfd: syscon: Use IOMEM instead of explicit castAndrey Smirnov2016-07-191-1/+1
| | | | | | | | | | Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mfd: syscon: Don't check xzalloc return for NULLAndrey Smirnov2016-07-191-2/+0
| | | | | | | | | | | | | | Xzalloc never returns NULL, so this check does not bring any value. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
| * mfd: syscon: Decouple syscon interface from platform devicesAndrey Smirnov2016-07-191-18/+61
| | | | | | | | | | | | | | | | | | | | | | | | Follow Linux Kernel change introduced in bdb0066df96e74a4002125467ebe459feff1ebef and avoid device/driver model for DT-based platforms. See the original kernel commit for the rationale. Also make syscon_base_lookup_by_pdevname() behave the same way as its kernel counterpart in the case whern "property" argument is NULL. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Merge branch 'for-next/imx'Sascha Hauer2016-08-031-1/+2
|\ \ | |/ |/|
| * mc13xxx: make driver-provided SPI frequency overridableAlexander Kurz2016-08-031-1/+2
| | | | | | | | | | | | | | | | | | | | The preset SPI frequency for mc13xxx PMIC introduced with patch 6e18b3a48ee4 ("mc13xxx: Define maximum SPI clock frequency global to driver") is not desirable or working on all boards. Provide a possibility to override the default SPI max_speed_hz from board code. Signed-off-by: Alexander Kurz <akurz@blala.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | mfd: syscon: Don't call request_iomem_region()Andrey Smirnov2016-07-191-6/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | On platforms that mix dedicated IP block register space with miscellaneous registers it is necessary to share register window between syscon and dedicated IP block driver. Calling request_iomem_region() implies exclusive ownership of the region, which, in the case above could not happen. This change also makes this driver's behaviour to that of its Linux kernel counterpart. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* | Revert "syscon: Decrease driver registration priority"Andrey Smirnov2016-07-191-1/+1
|/ | | | | | | | | | | Fixing the i.MX6 specific issue this way breaks things on CLPS711x target. Better fix for the problem is to follow this patch. This reverts commit c203958f3bbf25fc3d612497057b962e96ad1c52. Reported-by: Alexander Shiyan <shc_work@mail.ru> Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* syscon: Decrease driver registration priorityAndrey Smirnov2016-05-181-1/+1
| | | | | | | | | | | | | | | A number of devices on i.MX6 list "syscon" as second compatibility string, among them, most importantly, is "iomuxv3" pinmux driver, which gets probed at "postcore_initcall". Probing this driver at "core_initcall" results in "syscon" driver usurping pinmux device and preventing "iomuxv3" driver from loading and correctly initializing pinmux of the system (which in turn results in a lot of sadness). Moving this driver to be initialized at "device_initcall" time resolves the issue. Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* string: Fix (v)asprintf prototypesSascha Hauer2016-04-151-2/+2
| | | | | | | | | | Our asprintf and vasprintf have different prototypes than the glibc functions. This causes trouble when we want to share barebox code with userspace code. Change the prototypes for (v)asprintf to match the glibc prototypes. Since the current (v)asprintf are convenient to use change the existing functions to b(v)asprintf. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mfd: mc13xxx: Switch to regmap supportSascha Hauer2016-02-051-71/+56
| | | | | | This moves the mc13xxx driver over to regmap. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mfd: da9053: remove references to nonexistent cdev memberLucas Stach2015-09-041-2/+1
| | | | | Signed-off-by: Lucas Stach <l.stach@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mfd: da9053: add da9053 watchdog and system restart driverJuergen Borleis2015-08-283-0/+316
| | | | | | Signed-off-by: Jan Luebbe <jlu@pengutronix.de> Signed-off-by: Juergen Borleis <jbe@pengutronix.de> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
* mfd: da9063: add da9063 watchdog and system restart driverPhilipp Zabel2015-08-283-0/+174
| | | | Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de>
* of: use 'const void *' for struct of_device_id.dataAntony Pavlov2015-04-301-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since 2011 barebox' of_device_id struct uses unsigned long type for data field: struct of_device_id { char *compatible; unsigned long data; }; Almost always struct of_device_id.data field are used as pointer and need 'unsigned long' casting. E.g. see 'git grep -A 4 of_device_id drivers/' output: drivers/ata/sata-imx.c:static __maybe_unused struct of_device_id imx_sata_dt_ids[] = { drivers/ata/sata-imx.c- { drivers/ata/sata-imx.c- .compatible = "fsl,imx6q-ahci", drivers/ata/sata-imx.c- .data = (unsigned long)&data_imx6, drivers/ata/sata-imx.c- }, { Here is of_device_id struct in linux kernel v4.0: struct of_device_id { char name[32]; char type[32]; char compatible[128]; const void *data; }; Changing of_device_id.data type to 'const void *data' will increase barebox' linux kernel compatibility and decrease number of 'unsigned long' casts. Part of the patch was done using the 'coccinelle' tool with the following semantic patch: @rule1@ identifier dev; identifier type; identifier func; @@ func(...) { <... - dev_get_drvdata(dev, (unsigned long *)&type) + dev_get_drvdata(dev, (const void **)&type) ...> } @rule2@ identifier dev; identifier type; identifier func; identifier data; @@ func(...) { <... - dev_get_drvdata(dev, (unsigned long *)&type->data) + dev_get_drvdata(dev, (const void **)&type->data) ...> } Signed-off-by: Antony Pavlov <antonynpavlov@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>