summaryrefslogtreecommitdiff
path: root/drivers/pinctrl/nxp/pinctrl-imx.c
AgeCommit message (Collapse)Author
2025-01-25pinctrl: imx: Split MMIO accessors into pinctrl-imx-mmio.cMarek Vasut
Split MMIO accessors into pinctrl-imx-mmio.c and build this file only if Kconfig symbol PINCTRL_IMX_MMIO is selected. Select PINCTRL_IMX_MMIO Kconfig symbol for all but pinctrl-imx8.c driver, which does not use the MMIO accessors. This reduces the amount of code compiled on platforms which do not use the code. No functional change. Signed-off-by: Marek Vasut <marex@denx.de>
2025-01-25pinctrl: imx: Split imx_pinctrl_set_state_scu() from ↵Marek Vasut
imx_pinctrl_set_state_mmio() Call imx_pinctrl_set_state_common() from imx_pinctrl_scu_conf_pins(), rename imx_pinctrl_scu_conf_pins() to imx_pinctrl_set_state_scu(). Get rid of the unnecessary ifdeffery in pinctrl-imx.h in the process. Remove all SCU support from pinctrl-imx.c imx_pinctrl_set_state_mmio() which makes that function a pure MMIO pinctrl configuration accessor. Update pinctrl-imx8.c to call imx_pinctrl_set_state_scu directly. No functional change. This patch is best viewed with git show -w due to indent change. Signed-off-by: Marek Vasut <marex@denx.de>
2025-01-25pinctrl: imx: Split imx_pinctrl_set_state() into common and mmio partsMarek Vasut
Split imx_pinctrl_set_state() into imx_pinctrl_set_state_common() and imx_pinctrl_set_state_mmio(). The former does the common configuration parsing, the later does call imx_pinctrl_set_state_common() and then does pin configuration using either SCU or MMIO accesses. The SCU part is going to be moved out in follow up patches. This is a preparatory patch for follow up pinctrl drivers which do not use the MMIO accessors, but some other means, like SCU or otherwise. Those will call the common imx_pinctrl_set_state_common() function wrapped into some other imx_pinctrl_set_state_*() function, in a way similar to imx_pinctrl_set_state_mmio() does so for MMIO accesses. Update all imx_pinctrl_set_state_mmio() call sites to call imx_pinctrl_set_state_mmio() instead. No functional change. Signed-off-by: Marek Vasut <marex@denx.de>
2025-01-25pinctrl: imx: Rename imx_pinctrl_remove() to imx_pinctrl_remove_mmio()Marek Vasut
The current implementation of imx_pinctrl_remove() is specific to the MMIO accessor implementation, rename the function to imx_pinctrl_remove_mmio() to make this obvious. No functional change. Signed-off-by: Marek Vasut <marex@denx.de>
2025-01-25pinctrl: imx: Split imx_pinctrl_probe() into common and mmio partsMarek Vasut
Split imx_pinctrl_probe() into imx_pinctrl_probe_common() and imx_pinctrl_probe_mmio(). The former does the common setup, the later does the common setup and MMIO access configuration. The common setup can be used as-is for SCU based systems, update the pinctrl-imx8 to call only the common setup, update all the other pinctrl drivers to call imx_pinctrl_probe_mmio(). No functional change. Signed-off-by: Marek Vasut <marex@denx.de>
2025-01-25pinctrl: imx: Inline struct imx_pinctrl_soc_info access into probeMarek Vasut
The probe function is identical across all the pinctrl drivers. Inline the imx_pinctrl_soc_info access into imx_pinctrl_probe() and drop all the duplicate probe functions. No functional change. Signed-off-by: Marek Vasut <marex@denx.de>
2025-01-25pinctrl: imx: Drop .remove callback for SCU variantMarek Vasut
The return callback for SCU variant of the pinctrl drivers does nothing but returns 0. Remove the return callback from the SCU driver itself, that has the same effect. No functional change. Signed-off-by: Marek Vasut <marex@denx.de>
2025-01-25pinctrl: imx: Push imx_pinctrl_ops into drivers and staticizeMarek Vasut
Move imx_pinctrl_ops into drivers and staticize. This is preparatory patch for follow up pinctrl drivers which will not use this variant of imx_pinctrl_ops content. This should not change size, as most of the deployments compiled in one pinctrl driver anyway. No functional change. Signed-off-by: Marek Vasut <marex@denx.de>
2025-01-20pinctrl: imx: Fix NULL dereference in imx_pinctrl_probe()Jesse Taube
When converting to ofnode `ofnode_read_u32` was accedentally used to replace `fdtdec_get_int` instead of `ofnode_read_u32_default`. Use `ofnode_read_u32_default` to fix this. Fixes: 59382d2 ("pinctrl: imx: Convert to use livetree API for fdt access") Signed-off-by: Jesse Taube <Mr.Bossman075@gmail.com>
2024-10-25pinctrl: imx: Convert to use livetree API for fdt accessTim Harvey
Convert to using livetree API functions. Without this if livetree is enabled (OF_LIVE) the imx8mq-pinctrl driver will (silently) fail to probe causing issues with multiple devices. Signed-off-by: Tim Harvey <tharvey@gateworks.com>
2024-05-20Restore patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"Tom Rini
As part of bringing the master branch back in to next, we need to allow for all of these changes to exist here. Reported-by: Jonas Karlman <jonas@kwiboo.se> Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-19Revert "Merge patch series "arm: dts: am62-beagleplay: Fix Beagleplay Ethernet""Tom Rini
When bringing in the series 'arm: dts: am62-beagleplay: Fix Beagleplay Ethernet"' I failed to notice that b4 noticed it was based on next and so took that as the base commit and merged that part of next to master. This reverts commit c8ffd1356d42223cbb8c86280a083cc3c93e6426, reversing changes made to 2ee6f3a5f7550de3599faef9704e166e5dcace35. Reported-by: Jonas Karlman <jonas@kwiboo.se> Signed-off-by: Tom Rini <trini@konsulko.com>
2024-05-07pinctrl: Remove <common.h> and add needed includesTom Rini
Remove <common.h> from this driver directory and when needed add missing include files directly. Reviewed-by: Peter Robinson <pbrobinson@gmail.com> Signed-off-by: Tom Rini <trini@konsulko.com>
2021-02-02common: Drop asm/global_data.h from common headerSimon Glass
Move this out of the common header and include it only where needed. In a number of cases this requires adding "struct udevice;" to avoid adding another large header or in other cases replacing / adding missing header files that had been pulled in, very indirectly. Finally, we have a few cases where we did not need to include <asm/global_data.h> at all, so remove that include. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
2020-05-18common: Drop linux/bitops.h from common headerSimon Glass
Move this uncommon header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-02-05dm: core: Create a new header file for 'compat' featuresSimon Glass
At present dm/device.h includes the linux-compatible features. This requires including linux/compat.h which in turn includes a lot of headers. One of these is malloc.h which we thus end up including in every file in U-Boot. Apart from the inefficiency of this, it is problematic for sandbox which needs to use the system malloc() in some files. Move the compatibility features into a separate header file. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-02-05dm: core: Require users of devres to include the headerSimon Glass
At present devres.h is included in all files that include dm.h but few make use of it. Also this pulls in linux/compat which adds several more headers. Drop the automatic inclusion and require files to include devres themselves. This provides a good indication of which files use devres. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Anatolij Gustschin <agust@denx.de>
2019-10-08pinctrl: imx: use devfdt_get_addr_size_indexPeng Fan
fdtdec_get_addr_size could not parse addr/size correctly is using address-cells 2 and size-cells 2 on an ARM32 SoC. So switch to use devfdt_get_addr_size_index. Signed-off-by: Peng Fan <peng.fan@nxp.com>
2019-01-28pinctrl: imx: Fix select input issueYe Li
The pinctrl supports to set any bit in input register on iMX6 if the MSB of input value is 0xff. But the driver uses signed int for input value, so when executing the codes below, it won't meet. Because this is arithmetic right shift. if (input_val >> 24 == 0xff) Fix the issue by changing the input_val, config_val and mux_mode to u32. Signed-off-by: Ye Li <ye.li@nxp.com> Reviewed-by: Fugang Duan <fugang.duan@nxp.com> Reviewed-by: Peng Fan <peng.fan@nxp.com>
2018-10-22pinctrl: Add pinctrl driver for i.MX8Peng Fan
Add pinctrl driver for i.MX8. The pads configuration is controlled by SCU, so need to ask SCU to configure pads through scfw API. Add pinctrl-scu to invoke sc_pad_set to configure pads. Add a new flag IMX8_USE_SCU to differentiate i.MX8 from other platforms which could directly configure pads from Acore side. Add CONFIG_PINCTRL_IMX8 as the built gate. Signed-off-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Anatolij Gustschin <agust@denx.de> Cc: Stefano Babic <sbabic@denx.de>
2018-05-07SPDX: Convert all of our single license tags to Linux Kernel styleTom Rini
When U-Boot started using SPDX tags we were among the early adopters and there weren't a lot of other examples to borrow from. So we picked the area of the file that usually had a full license text and replaced it with an appropriate SPDX-License-Identifier: entry. Since then, the Linux Kernel has adopted SPDX tags and they place it as the very first line in a file (except where shebangs are used, then it's second line) and with slightly different comment styles than us. In part due to community overlap, in part due to better tag visibility and in part for other minor reasons, switch over to that style. This commit changes all instances where we have a single declared license in the tag as both the before and after are identical in tag contents. There's also a few places where I found we did not have a tag and have introduced one. Signed-off-by: Tom Rini <trini@konsulko.com>
2017-08-23pinctrl: imx: Fix mask when SHARE_MUX_CONF_REG is setPeng Fan
when using SHARE_MUX_CONF_REG, wrong mask is used for writing config value, which causes mux value is cleared. Signed-off-by: Peng Fan <peng.fan@nxp.com> Cc: Simon Glass <sjg@chromium.org> Cc: Stefano Babic <sbabic@denx.de>
2017-06-01dm: Use dm.h header when driver mode is usedSimon Glass
This header includes things that are needed to make driver build. Adjust existing users to include that always, even if other dm/ includes are present Signed-off-by: Simon Glass <sjg@chromium.org>
2017-05-18pinctrl: imx: fix memory leakPeng Fan
Each time set_state is called, a new piece memory will be allocated for pin_data, but not freed, this will incur memory leak. When error, the devm API could not free memory automatically. So need call devm_kfree when error. Issue reported by Coverity Signed-off-by: Peng Fan <peng.fan@nxp.com> Cc: Simon Glass <sjg@chromium.org> Cc: Stefan Agner <stefan.agner@toradex.com> Cc: Stefano Babic <sbabic@denx.de>
2017-03-17pinctrl: Add i.MX7ULP pinctrl driverPeng Fan
Add i.MX7ULP pinctrl driver. Select CONFIG_PINCTRL_IMX7ULP to use this driver. Signed-off-by: Peng Fan <peng.fan@nxp.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by : Stefano Babic <sbabic@denx.de>
2017-02-08dm: core: Replace of_offset with accessorSimon Glass
At present devices use a simple integer offset to record the device tree node associated with the device. In preparation for supporting a live device tree, which uses a node pointer instead, refactor existing code to access this field through an inline function. Signed-off-by: Simon Glass <sjg@chromium.org>
2016-10-07pinctrl: imx: do not announce driver initializationStefan Agner
It is not usual that drivers announce when they have been initialized. use dev_dbg to announce device initialization. Signed-off-by: Stefan Agner <stefan.agner@toradex.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2016-02-21pinctrl: imx: Introduce pinctrl driver for i.MX6Peng Fan
Introduce pinctrl for i.MX6 1. pinctrl-imx.c is for common usage. It's used by i.MX6/7. 2. Add PINCTRL_IMX PINCTRL_IMX6 Kconfig entry. 3. To the pinctrl_ops implementation, only set_state is implemented. To i.MX6/7, the pinctrl dts entry is as following: &iomuxc { pinctrl-names = "default"; pinctrl_csi1: csi1grp { fsl,pins = < MX6UL_PAD_CSI_MCLK__CSI_MCLK 0x1b088 MX6UL_PAD_CSI_PIXCLK__CSI_PIXCLK 0x1b088 MX6UL_PAD_CSI_VSYNC__CSI_VSYNC 0x1b088 >; }; [.....] }; there is no property named function or groups. So pinctrl_generic_set_state can not be used here. 5. This driver is a simple implementation for i.mx iomux controller, only parse the fsl,pins property and write value to registers. 6. With DEBUG enabled, we can see log when "i2c bus 0": " set_state_simple op missing imx_pinctrl_set_state: i2c1grp mux_reg 0x14c, conf_reg 0x3bc, input_reg 0x5d8, mux_mode 0x0, input_val 0x1, config_val 0x4000007f write mux: offset 0x14c val 0x10 select_input: offset 0x5d8 val 0x1 write config: offset 0x3bc val 0x7f mux_reg 0x148, conf_reg 0x3b8, input_reg 0x5d4, mux_mode 0x0, input_val 0x1, config_val 0x4000007f write mux: offset 0x148 val 0x10 select_input: offset 0x5d4 val 0x1 write config: offset 0x3b8 val 0x7f " this means imx6 pinctrl driver works as expected. Signed-off-by: Peng Fan <van.freenix@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>