summaryrefslogtreecommitdiff
path: root/drivers/pinctrl
AgeCommit message (Collapse)AuthorFilesLines
2020-07-20treewide: convert devfdt_get_addr() to dev_read_addr()Masahiro Yamada7-7/+7
When you enable CONFIG_OF_LIVE, you will end up with a lot of conversions. To generate this commit, I used coccinelle excluding drivers/core/, include/dm/, and test/ The semantic patch that makes this change is as follows: <smpl> @@ expression dev; @@ -devfdt_get_addr(dev) +dev_read_addr(dev) </smpl> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2020-07-20treewide: convert (void *)devfdt_get_addr() to dev_read_addr_ptr()Masahiro Yamada1-1/+1
Use the _ptr suffixed variant instead of casting. Also, convert it to dev_read_addr_ptr(), which is safe to CONFIG_OF_LIVE. One curious part is an error check like follows in drivers/watchdog/omap_wdt.c: priv->regs = (struct wd_timer *)devfdt_get_addr(dev); if (!priv->regs) return -EINVAL; devfdt_get_addr() returns FDT_ADDR_T_NONE (i.e. -1) on error. So, this code does not catch any error in DT parsing. dev_read_addr_ptr() returns NULL on error, so this error check will work. I generated this commit by the following command: $ find . -name .git -prune -o -name '*.[ch]' -type f -print | \ xargs sed -i -e 's/([^*)]*\*)devfdt_get_addr(/dev_read_addr_ptr(/' I manually fixed drivers/usb/host/ehci-mx6.c Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
2020-07-17Merge https://gitlab.denx.de/u-boot/custodians/u-boot-x86Tom Rini3-10/+27
- New timer API to allow delays with a 32-bit microsecond timer - Add dynamic ACPI structs (DSDT/SSDT) generations to the DM core - x86: Enable ACPI table generation by default - x86: Enable the copy framebuffer on Coral - x86: A few fixes to FSP2 with ApolloLake - x86: Drop setup_pcat_compatibility() - x86: Primary-to-Sideband Bus minor fixes
2020-07-17x86: pinctrl: Drop the acpi_path memberSimon Glass1-4/+0
This is in the device tree now, so drop the unnecessary field here. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2020-07-17x86: pinctrl: Set up itss in the probe() methodSimon Glass1-4/+4
At present the itss is probed in the ofdata_to_platdata() method. This is incorrect since itss is a child of p2sb which itself needs to probe the pinctrl device. This means that p2sb is effectively not probed when the itss is probed, so we get the wrong register address from p2sb. Fix this by moving the itss probe to the correct place. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
2020-07-17x86: pinctrl: Add multi-ACPI controlSimon Glass2-0/+14
Add a Kconfig to control whether pinctrl is represented as a single ACPI device or as multiple devices. In the latter case (the default) we should return the pin number relative to the pinctrl device. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
2020-07-17x86: pinctrl: Add a way to get the pinctrl reg addressSimon Glass1-2/+9
At present we can query the offset of a pinctrl register within the p2sb. For ACPI we need to get the actual address of the register. Add a function to handle this and rename the old one to more accurately reflect its purpose. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com>
2020-07-14pinctrl: imx5: move soc info to data sectionPeng Fan1-1/+1
The soc info without initialization value should be put into data section. The driver could be used before relocation, with it in BSS section could cause issue, since BSS section is not initializated and it might overwrite other areas that used by others, such as dtb. Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-07-14pinctrl: imx8m: move soc info to data sectionPeng Fan1-1/+1
The soc info without initialization value should be put into data section. The driver could be used before relocation, with it in BSS section could cause issue, since BSS section is not initializated and it might overwrite other areas that used by others, such as dtb. Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-07-14pinctrl: imx7: move soc info to data sectionPeng Fan1-1/+1
The soc info without initialization value should be put into data section. The driver could be used before relocation, with it in BSS section could cause issue, since BSS section is not initializated and it might overwrite other areas that used by others, such as dtb. Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-07-10core: add support for U_BOOT_DRIVER_ALIASWalter Lozano2-0/+4
Currently when using OF_PLATDATA the binding between devices and drivers is done trying to match the compatible string in the node with a driver name. However, usually a single driver supports multiple compatible strings which causes that only devices which its compatible string matches a driver name get bound. To overcome this issue, this patch adds the U_BOOT_DRIVER_ALIAS macro, which generates no code at all, but allows an easy way to declare driver name aliases. Thanks to this, dtoc could be improve to look for the driver name based on its alias when it populates the U_BOOT_DEVICE entry. Signed-off-by: Walter Lozano <walter.lozano@collabora.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-07-10drivers: rename drivers to match compatible stringWalter Lozano6-8/+8
When using OF_PLATDATA, the bind process between devices and drivers is performed trying to match compatible string with driver names. However driver names are not strictly defined, and also there are different names used when declaring a driver with U_BOOT_DRIVER, the name of the symbol used in the linker list and the used in the struct driver_info. In order to make things a bit more clear, rename the drivers names. This will also help for further OF_PLATDATA improvements, such as checking for valid driver names. Signed-off-by: Walter Lozano <walter.lozano@collabora.com> Reviewed-by: Simon Glass <sjg@chromium.org> Add a fix for sandbox of-platdata to avoid using an invalid ANSI colour: Signed-off-by: Simon Glass <sjg@chromium.org>
2020-07-07pinctrl: stm32: add information on pin configurationPatrick Delaunay1-3/+24
Add information on pin configuration used for pinmux command: - bias configuration for output (disable, pull up, pull down) - otype for input (open drain or push pull) Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
2020-07-07pinctrl: stmfx: add information on pin configurationPatrick Delaunay1-1/+31
Add information on pin configuration used for pinmux command. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
2020-07-07gpio: stmfx: add ops get_dir_flagsPatrick Delaunay1-0/+50
Add support of ops get_dir_flags() to read dir flags from STMFX registers. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
2020-07-07gpio: stmfx: add ops set_dir_flagPatrick Delaunay1-0/+37
Manage the flags for GPIO configuration: - open_drain, push_pull - pull_up, pull_down Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
2020-07-07gpio: stmfx: add function stmfx_read_reg and stmfx_write_regPatrick Delaunay1-42/+26
Add the helper functions stmfx_read_reg() and stmfx_write_reg() to avoid duplicated code for access to stmfx's register with mask. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
2020-07-07gpio: stmfx: rename function used to change pin configurationPatrick Delaunay1-10/+8
Rename the two function used to change the pin configuration from stmfx_pinctrl_.. stmfx_conf_... to clarify the function usage. No functional change. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
2020-07-07gpio: stmfx: move function to prepare new ops introductionPatrick Delaunay1-30/+30
Move the functions stmfx_pinctrl_set_pupd and stmfx_pinctrl_set_type; they can be used by the new ops get_dir_flags and set_dir_flags introduced by next patch. No functional change. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
2020-07-01dm: Fix error handling for dev_read_addr_ptrSean Anderson2-2/+2
dev_read_addr_ptr had different semantics depending on whether OF_LIVE was enabled. This patch converts both implementations to return NULL on error, and converts all call sites which check for FDT_ADDR_T_NONE to check for NULL instead. This patch also removes the call to map_physmem, since we have dev_remap_addr* for those semantics. Signed-off-by: Sean Anderson <seanga2@gmail.com> Reviewed-by: Bin Meng <bmeng.cn@gmail.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-05-19common: Drop linux/bitops.h from common headerSimon Glass28-0/+28
Move this uncommon header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-19common: Drop linux/delay.h from common headerSimon Glass1-0/+1
Move this uncommon header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-19common: Drop linux/bug.h from common headerSimon Glass5-0/+5
Move this uncommon header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-19common: Drop log.h from common headerSimon Glass25-0/+25
Move this header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-19common: Drop image.h from common headerSimon Glass5-0/+5
Move this uncommon header out of the common header. Signed-off-by: Simon Glass <sjg@chromium.org>
2020-05-10pinctrl: nxp: scu: Check the pad partition before set pinmuxYe Li1-2/+7
If a pad is not owned by current partition we should not set its pinmux. Signed-off-by: Ye Li <ye.li@nxp.com> Signed-off-by: Peng Fan <peng.fan@nxp.com>
2020-04-23dm: pinctrl: Use right device pointer for configuring pinctrlLokesh Vutla1-2/+2
commit 719cab6d2e2bf ("dm: pinctrl: convert pinctrl-single to livetree") converted pinctrl driver to livetree. In this conversion, the call to read pinctrl-single,pins/bits property is provided with pinctrl device pointer instead of pinctrl config pointer. Because of this none of the pins gets configured. Fix it by passing the right udevice pointer. Fixes: 719cab6d2e2bf ("dm: pinctrl: convert pinctrl-single to livetree") Reported-by: Tom Rini <trini@konsulko.com> Reviewed-by: Patrick Delaunay <patrick.delaunay@st.com> Signed-off-by: Lokesh Vutla <lokeshvutla@ti.com>
2020-04-17test: dm: update test for pins configuration in pinctrl nodePatrick Delaunay1-1/+13
Add test for "pins" configuration in gpio uclass with set_state() ops and test for generic parsing of pinconf_param array). set_state() is called by: - pinctrl_generic_set_state |- pinctrl_generic_set_state_subnode Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-04-17pinctrl: sandbox: Add mux information in get_pin_muxingPatrick Delaunay1-0/+30
Add param information in pin information output. This update prepare unitary test for pin configuration in pinctrl node. Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Simon Glass <sjg@chromium.org>
2020-04-17dm: pinctrl: migrate pinctrl-generic to livetreePatrick Delaunay1-19/+11
Migrate pinctrl-generic to livetree: - dev_for_each_property - dev_read_prop_by_prop - dev_read_string_count - dev_read_string_index and get rid of DECLARE_GLOBAL_DATA_PTR. This patch solves the parsing issue during sandbox tests for pin configuration (OF_LIVE is activated in sandbox_defconfig and sub node are not correctly parsed in pinctrl_generic_set_state_subnode with fdt lib API). Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-04-17dm: pinctrl: convert pinctrl-single to livetreePatrick Delaunay1-18/+9
Convert 'pinctrl-single' using livetree functions - dev_read_prop - dev_read_u32_default - dev_read_u32_array - dev_read_bool - dev_read_addr and get rid of DECLARE_GLOBAL_DATA_PTR. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com>
2020-02-13pinctrl: stmfx: update the result type of dm_i2c_reg_readPatrick Delaunay1-3/+4
Use int as result of dm_i2c_reg_read to avoid warning with W=1 (warning: comparison is always false due to limited range of data type [-Wtype-limits]) Signed-off-by: Patrick Delaunay <patrick.delaunay@st.com> Reviewed-by: Patrice Chotard <patrice.chotard@st.com>
2020-02-11Merge tag 'dm-pull-6feb20' of https://gitlab.denx.de/u-boot/custodians/u-boot-dmTom Rini15-0/+27
sandbox conversion to SDL2 TPM TEE driver Various minor sandbox video enhancements New driver model core utility functions
2020-02-07x86: Give each driver an IRQ typeSimon Glass1-1/+1
Add an IRQ type to each driver and use irq_first_device_type() to find and probe the correct one. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2020-02-06dm: core: Create a new header file for 'compat' featuresSimon Glass15-0/+20
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-06dm: core: Require users of devres to include the headerSimon Glass7-0/+7
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>
2020-02-03x86: Move itss.h from Apollo Lake to the generic x86 include directoryWolfgang Wallner1-1/+1
The code in this file is not specific to Apollo Lake. According to coreboot sources (where this code comes from), it is common to at least: * Apollo Lake * Cannon Lake * Ice Lake * Skylake Signed-off-by: Wolfgang Wallner <wolfgang.wallner@br-automation.com> Reviewed-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2020-01-16pinctrl: mediatek: add support for different pinctrlSam Shih7-19/+125
Due to the pinctrl hardware of MT7622 is difference from others SoC which using the common part of mediatek pinctrl. So we need to modify the common part of mediatek pinctrl. Signed-off-by: Sam Shih <sam.shih@mediatek.com> Reviewed-by: Ryder Lee <ryder.lee@mediatek.com>
2020-01-16pinctrl: mediatek: add driver for MT7622Sam Shih3-0/+757
This patch add Pinctrl driver for MediaTek MT7622 SoC. Signed-off-by: Sam Shih <sam.shih@mediatek.com> Reviewed-by: Ryder Lee <ryder.lee@mediatek.com>
2020-01-16pinctrl: mediatek: add driver for MT8512mingming lee3-0/+392
Add Pinctrl driver for MediaTek MT8512 SoC. Signed-off-by: mingming lee <mingming.lee@mediatek.com>
2020-01-15pinctrl: add i.MXRT driverGiulio Benetti3-0/+55
Add i.MXRT pinctrl driver. Signed-off-by: Giulio Benetti <giulio.benetti@benettiengineering.com>
2020-01-08Merge tag 'u-boot-imx-20200108' of ↵Tom Rini1-0/+1
https://gitlab.denx.de/u-boot/custodians/u-boot-imx --------------------------------------------------------------------- Add i.MX8MP SoC and EVK board Update README for i.MX8MN EVK and fix mmc env Add pca9450 driver -------------------------------------------------------------------- Travis: https://travis-ci.org/sbabic/u-boot-imx/builds/634211885
2020-01-08pinctrl: imx8m: support i.MX8MPPeng Fan1-0/+1
Add i.MX8MP compatible to let the pinctrl driver could support i.MX8MP. Reviewed-by: Ye Li <ye.li@nxp.com> Signed-off-by: Peng Fan <peng.fan@nxp.com>
2019-12-15x86: apl: Add pinctrl driverSimon Glass3-3/+206
Add a driver for the Apollo Lake pinctrl. This mostly makes use of the common Intel pinctrl support. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2019-12-15x86: Add a generic Intel pinctrl driverSimon Glass5-0/+667
Recent Intel SoCs share a pinctrl mechanism with many common elements. Add an implementation of this core functionality, allowing SoC-specific drivers to avoid adding common code. As well as a pinctrl driver this provides a GPIO driver based on the same code. Once other SoCs use this driver we may consider moving more properties to the device tree (e.g. the community info and pad definitions). Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2019-12-15dm: pinctrl: Allow enabling full pinctrl in SPL/TPLSimon Glass1-0/+14
At present these options cannot be enabled for SPL/TPL, but this can be useful in some cases. Add Kconfig options to allow it. Signed-off-by: Simon Glass <sjg@chromium.org> Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
2019-12-05pinctrl: rockchip: Add pinctrl support for rk3308David Wu4-1/+468
An iomux register contains 8 pins, each of which is represented by 2 bits, but the register offset is 0x8. For example, GRF_GPIO0A_IOMUX offset is 0x0, but GRF_GPIO0B_IOMUX offset is 0x8, the offset 0x4 is reserved. So add a type IOMUX_8WIDTH_2BIT to calculate offset. Signed-off-by: David Wu <david.wu@rock-chips.com> Reviewed-by: Kever Yang <kever.yang@rock-chips.com>
2019-12-03pinctrl: add driver for MT8518mingming lee3-0/+416
Add Pinctrl driver for MediaTek MT8518 SoC. Signed-off-by: mingming lee <mingming.lee@mediatek.com>
2019-11-24drivers: bcm283x: Set pre-location flag for OF_BOARDMatthias Brugger1-1/+1
U-Boot support on Raspberry Pi 4 relies on the device-tree provided by the firmware. The blob does not contain the U-Boot specific pre-loc-rel properties. The result is, that the U-Boot banner is not printed. We fix this by setting the DM_FLAG_PRE_RELOC flag in the driver, if we rely on a device-tree provided by the firmware. Reported-by: Heinrich Schuchardt <xypron.glpk@gmx.de> Signed-off-by: Matthias Brugger <mbrugger@suse.com>
2019-11-24pinctrl: bcm283x: Add compatible for RPi4Matthias Brugger1-0/+1
The Raspberry Pi 4 upstream kernel device tree instroduces a new compatible for the pinctroller. Add this to the driver so that we can boot with the upstream kernel DT. Signed-off-by: Matthias Brugger <mbrugger@suse.com>