Commit graph

522 commits

Author SHA1 Message Date
Gerson Fernando Budke
6de5f4d729 soc: atmel_sam0: common: Add soc_port
Introduce soc_port common functions.  The sam0 pinmux driver was
refactored to use soc_port_pinmux_set common function.

This create the common base to implement sam0 pinctrl functions.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
2021-07-30 14:37:20 -05:00
Yuriy Vynnychek
6c76b416ee drivers: pinmux: introduce new Telink B91 Pinmux driver
Pinmux driver basic support for new Telink B91 platform.

Signed-off-by: Yuriy Vynnychek <yura.vynnychek@telink-semi.com>
2021-07-21 05:37:12 -04:00
Erwan Gouriou
7e8c497d40 drivers/pinmux: stm32: Group gpio devices usability checks
Move GPIO devices clock handling in stm32_pin_configure function
which is also used in stm32_setup_pins.
Additionally, add device usability check to be sure gpio driver
was initialized before being used by pinmux pseudo driver.

Last, going from the assumption that GPIO devices should be
initialized before being used by pinmux, then there is no need
to enable clock in case CONFIG_PM_DEVICE_RUNTIME=n.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-07-16 07:21:07 -04:00
Gerard Marull-Paretas
165ae60e40 drivers: pinmux: stm32: fix name clashes with G4 series
There is a name clash when using G4 series LL TIM driver depending on
the inclusion order of the LL TIM and pinmux headers. If the LL headers
are included after pinmux is included, AF1 and AF2 definitions used by
pinmux clash with the AF1 and AF2 TIMx register names.

In order to solve this problem with minimum impact, the following has
been done:

1. Prefix the AFx and ANALOG definitions with STM32
2. In order to avoid changing all *-pinctrl.dtsi files, the STM32_PINMUX
   macro contatenates STM32_ with the provided mode.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2021-07-12 16:03:18 -05:00
Tim Lin
8ea58d4389 ite: drivers/adc: create pinmux phandle to the ADC driver node
Create the pinmux phandle to the ADC driver node in the
devicetree. When the pinmux_pin_set function in
adc_it8xxx2_channel_setup can refer to the setting of
this phandle. It is more flexible to use.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-06-11 15:47:25 +02:00
Erwan Gouriou
88cf73d58f drivers/pinmux: stm32: Remove unused definition
`STM32_PINMUX_NAME` is not used anymore.
Removed

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-06-11 08:04:39 -05:00
Erwan Gouriou
fcc3177509 drivers/pinmux: stm32: Move stm32 driver from stm32/
Since we removed various series headers, move stm32 driver
under main driver/pinmux folder.
Take this change into account into various drivers.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-06-11 08:04:39 -05:00
Erwan Gouriou
00e1adda5c drivers/pinmux: stm32: Remove deprecated pinmux series headers
These headers were deprecated since release V2.5.0.
Users are expected to use dts based configuration API.
Remove these headers.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-06-11 08:04:39 -05:00
Scott Worley
825170e00b drivers: pinmux: mchp: Update pinmux based on latest HAL
Microchip HAL 1.2.0 fixed a bug in the define of GPIO
control register MUX field. The incorrect MUX defined
cleared by GPIO input pad disable field by accident.
After the MUX definition was corrected the pinmux driver
must be modified to mask off the input pad disable for
the pin to be operational.

Signed-off-by: Scott Worley <scott.worley@microchip.com>
2021-05-26 19:09:47 -05:00
Flavio Ceolin
d67a5786bc pm: device_runtime: Change API behavior s/_sync/_async
Most APIs have the default synchronous and an asynchronous version
with the sufix _async because that is the most common use.

All devices in tree right now are using the synchronous version, so
just change it to be consistent with the rest of the system.

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-05-26 10:56:55 -04:00
Erwan Gouriou
46f33bcd3e drivers/pinmux: stm32: Enable PM_DEVICE_RUNTIME services
Add PM_DEVICE_RUNTIME support

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-05-06 14:31:13 -04:00
Tim Lin
caa3328cc7 ite: drivers/pinmux: modify pinmux driver
Modify the pinmux control method and add support the fun3
& fun4 alternation function.

Signed-off-by: Tim Lin <tim2.lin@ite.corp-partner.google.com>
2021-05-05 08:45:16 -04:00
Gerard Marull-Paretas
693629ade3 drivers: pinmux: remove usage of device_pm_control_nop
device_pm_control_nop is now deprecated in favour of NULL.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2021-04-28 16:43:29 -04:00
Kumar Gala
8cae466100 drivers: pinmux: remove drivers/pinmux/pinmux.h
The file is only really used on STM32 SoCs so we can move the contents
that are relevant into pinmux_stm32.h and remove the file.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-04-02 07:42:18 -04:00
Flavio Ceolin
9fd4ea91b7 coccinelle: Remove extra semicolon
coccicheck --mode=patch --cocci=semicolon.cocci

Signed-off-by: Flavio Ceolin <flavio.ceolin@intel.com>
2021-03-25 11:35:30 -05:00
Kumar Gala
19121106f0 pinmux: s1000: Change to use ENOTSUP
Changed to use -ENOTSUP instead of -ENOSYS to be consistent with
other driver APIs.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-23 15:46:10 -05:00
Anas Nashif
5d6c219210 drivers: device: do not reuse tag name 'device'
Do not reuse tag name (misra rule 5.7).

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2021-03-22 19:48:14 -04:00
Jun Lin
2638f2ecc4 npcx: move scfg driver from pinctrl to soc/arm/nuvoton_npcx/common
In NPCX chips, System Configuration module can configure not only
pinctrl but also misc. functionality such as glue and flash write
protection. This change moves the scfg driver from the pinctrl folder
to soc/arm/nuvoton_npcx/common and renames it to avoid confusion.

Signed-off-by: Jun Lin <CHLin56@nuvoton.com>
2021-03-17 18:47:32 -04:00
Erwan Gouriou
bb014514e0 drivers/gpio: stm32: Use gpio device as gpio_stm32_configure arg
Now that pinmux driver holds a table of GPIO device pointers,
use gpio device as the single source of trust for gpio_base
and remove use of port_base and related code.
This way, gpio_stm32_configure could directly take gpio device
pointer as argument.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-03-03 12:13:34 -06:00
Erwan Gouriou
8d97f67159 drivers/pinmux: stm32: Control GPIO clock with central function
Use new gpio_stm32_clock_request function for GPIO clocks control.
To do this a new table of GPIO devices is set up at build time.
It is then used to populate targeted device when calling
gpio_stm32_clock_request.

Clean up remaining clock handling related code in the file.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2021-03-03 12:13:34 -06:00
Kumar Gala
263ac3e9e5 drivers: pinmux: mcux_lpc: Convert to using devicetree
Convert driver and users of pinmux on mcux lpc platforms to getting
basic port info from devicetree (register address, label)

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-03-01 12:04:53 -06:00
Kumar Gala
b275fec8c4 soc: stm32: convert to use DEVICE_DT_GET for clocks
Convert from device_get_binding to DEVICE_DT_GET.  In doing this we
no longer need the label in the devicetree node so we remove that.

Removed all __ASSERT_NO_MSG(clk) since we'll get a build error if
DEVICE_DT_GET cant be satisfied, and the clock control api's will
handle reporting if the device_is_ready.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-02-16 17:01:37 -06:00
Kumar Gala
c54005235c riscv: ite: it8xxx2: Rework device_get_binding for pinmux
Switch to use DEVICE_DT_GET instead of device_get_binding for pinmux
device.  As part of this change drop the "label" property from
the pinmux devicetree node and update the binding and dts files to
reflect that.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-02-16 09:45:57 -05:00
Kumar Gala
f6b7dd09ec pinmux: sifive: Convert SiFive pinmux to be devicetree based
Add a simple pinctrl node for the IOF registers under the GPIO
controller node to be used by the pinmux driver.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-02-15 08:33:00 -05:00
Kumar Gala
4276d7d247 pinmux: hsdk: Convert ARC HSDK pinmux to be devicetree based
Add a simple pinctrl node for the CREG GPIO MUX register to be used
by the pinmux driver.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2021-02-15 08:29:56 -05:00
Mulin Chao
b7ec2cd5de driver: gpio: add 1p8v level detection support in npcx series.
Part of GPIO pads in npcx series support low-voltage (1.8V) level
detection. In order to introduce this feature, this CL adds a new
NPCX-specific controller property, lvol_io_pads, in devicetree file.
For example, here is devicetree fragment which turn on low-voltage
support of i2c1_0 port.

/ {
      def_lvol_io_list {
          compatible = "nuvoton,npcx-lvolctrl-def";
          lvol_io_pads = <&lvol_io90   /* I2C1_SCL0 1.8V support */
                          &lvol_io87>; /* I2C1_SDA0 1,8V support */
     };
  };

Then these pads will turn on 1.8V level detection during initialization.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2021-01-18 19:09:34 +01:00
Mahavir Jain
29f87c3a0f boards: esp32: add XIP support and enable bootloader build
Disable RTC WDT enabled (by default) by 2nd stage bootloader in ESP-IDF.
This WDT timer ensures correct hand-over and startup sequence from
bootloader to application.

Enabling bootloader caused system clock initialization to fail
when clock rate is greater then 80MHz. This also fixes
esp32 clock source code.

Signed-off-by: Mahavir Jain <mahavir@espressif.com>
2021-01-13 09:10:46 -05:00
Mulin Chao
e258690655 driver: npcx: add glue module support in npcx series.
The System Glue module includes the three major functions:
— Power Switch Logic (PSL)
— SMBus multi-bus, wake-up support
— Simple Debug Port (SDP)

In NPCX7 series, the SMB5 and SMB6 modules contain a two-way switch to
support two separate SMBus/I2C buses (ports) with one SMB module
(controller). Since a single SMB module is able to serve only one
SMBus/I2C bus at a time, SMB_SEL registerin Glue module is used to
control theconnection of I2Cn_0 and I2Cn_1 interface pins to the SMBn
module (where n is 5, 6).

This CL provides a soc specific pin-control function called
"soc_pinctrl_i2c_port_sel" to switch buses (port) of the same SMB module
(controller). It will be used in the following i2c driver.

Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
2020-12-27 18:15:14 +01:00
Kumar Gala
609844d56e drivers: pinmux: Convert drivers to new DT device macros
Convert pinmux drivers from:

    DEVICE_AND_API_INIT -> DEVICE_DT{_INST}_DEFINE

etc..

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-19 20:06:45 -05:00
Kumar Gala
673a81eabb pinmux: Convert drivers to be devicetree based
Convert drivers to use pinmux devicetree node to create pinmux device
object.

On intel S1000 we add 'label' as a required property and set it to
'PINMUX' to match CONFIG_PINMUX_NAME.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-19 20:04:23 -05:00
Kumar Gala
8d96e8741b drivers: pinmux: Convert DEVICE_AND_API_INIT to DEVICE_DEFINE
Convert driver(s) to DEVICE_DEFINE instead of DEVICE_AND_API_INIT
so we can deprecate DEVICE_AND_API_INIT in the future.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-19 19:59:41 -05:00
Kumar Gala
80b4ec0ee1 drivers: pinmux: pinmux_mcux: Remove Kconfig options
We now get the specific port and name from devicetree so remove the
Kconfig options.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-18 07:52:52 -06:00
Kumar Gala
c9aa36ff39 drivers: pinmux: pinmux_mcux: Convert to devicetree
Use a similar model to the pinmux_rv32m1 driver for kinetis pinmux
driver.  We handle one subtle difference between clock on the KE1xF v
other SoCs.

As the Kconfig and devicetree label names are the same we maintain the
Kconfig options in the driver until all board users are converted over
to use devicetree instead of Kconfig.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-12-18 07:52:52 -06:00
Cheryl Su
da1b3c39c5 drivers/pinmux: it8xxx2 pinmux driver
This driver is setting the it8xxx2 register GCR1-15.
It's for selecting the pin function.
User would set pin at pinmux.c (under board/).

Signed-off-by: Cheryl Su <Cheryl.su@ite.com.tw>
2020-12-16 08:47:36 -05:00
Mulin Chao
daa48daf52 soc: replace DT_ with NPCX_DT_ prefix for all macros in soc_dt.h
This CL replaces all DT_ prefix with NPCX_DT_ for all macros used
for providing npcx device information in soc_dt.h It avoided the
ambiguity with the DT_ prefix for system DT macros/defines.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2020-12-09 00:46:57 -05:00
Mulin Chao
14b98135fd driver: npcx7: fixed typo in Kconfig.npcx files.
Fixed typo in Kconfig.npcx files.

Signed-off-by: Mulin Chao <mlchao@nuvoton.com>
2020-12-07 12:11:17 -05:00
Alexander Wachter
4dcf614784 include: drivers: pinmux: stm32: Add missing C linkage
The C linkage for C++ was missing in pinmux_stm32.h

Signed-off-by: Alexander Wachter <alexander.wachter@leica-geosystems.com>
2020-11-30 18:47:08 +01:00
Martin Jäger
92e16191ac drivers: gpio: stm32: use generic LL headers
Use generic LL headers instead of depending on soc.h.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-11-30 15:50:03 +01:00
Erwan Gouriou
aea89e565d drivers/pinmux: stm32: Deprecate SDMMC related macros
Following migration of all in-tree boards to device tree bindings
for SDMMC pins configuration, deprecate SDMMC related macros.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-11-03 11:11:04 +01:00
Erwan Gouriou
3289802268 drivers/pinmux: stm32: Deprecate I2S related macros
Following migration of all in-tree boards to device tree bindings
for I2S pins configuration, deprecate I2S related macros.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-11-03 11:11:04 +01:00
Erwan Gouriou
8c4c37e6f5 drivers/pinmux: stm32: Deprecate USB related macros
Following migration of all in-tree boards to device tree bindings
for USB pins configuration, deprecate USB related macros.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-11-03 11:11:04 +01:00
Erwan Gouriou
543b9e3ced drivers/pinmux: stm32: Deprecate ETH related macros
Following migration of all in-tree boards to device tree bindings
for ETH pins configuration, deprecate ETH related macros.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-11-03 11:11:04 +01:00
Erwan Gouriou
e992659260 drivers/pinmux: stm32: Deprecate ADC related macros
Following migration of all in-tree boards to device tree bindings
for ADC pins configuration, deprecate ADC related macros.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-11-03 11:11:04 +01:00
Erwan Gouriou
377f24a8d1 drivers/pinmux: stm32: Deprecate SPI related macros
Following migration of all in-tree boards to device tree bindings
for SPI pins configuration, deprecate SPI related macros.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-11-03 11:11:04 +01:00
Erwan Gouriou
164050f781 drivers/pinmux: stm32: Deprecate I2C related macros
Following migration of all in-tree boards to device tree bindings
for I2C pins configuration, deprecate I2C related macros.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-11-03 11:11:04 +01:00
Erwan Gouriou
c8065601af drivers/pinmux: stm32: Deprecate DAC related macros
Following migration of all in-tree boards to device tree bindings
for CAN pins configuration, deprecate DAC related macros.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-11-03 11:11:04 +01:00
Erwan Gouriou
3d5280503e drivers/pinmux: stm32: Deprecate CAN related macros
Following migration of all in-tree boards to device tree bindings
for serial pins configuration, deprecate CAN related macros.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-11-03 11:11:04 +01:00
Erwan Gouriou
5652b4a698 drivers/pinmux: stm32: Deprecate (LP)U(S)ART related macros
Following migration of all in-tree boards to device tree bindings
for serial pins configuration, deprecate (LP)U(S)ART related macros.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-11-03 11:11:04 +01:00
Erwan Gouriou
6a03627d1f drivers/pinmux: stm32: Deprecate PWM related macros
Following migration of all in-tree boards to device tree bindings
for pwm pins configuration, deprecate PWN related macros.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-11-03 11:11:04 +01:00
Mulin Chao
d55aa5a71b driver: npcx7: replace platform specific functions with 'npcx_' prefix.
Replace all platform specific functions with 'npcx_' prefix.

Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
2020-10-21 12:49:02 -05:00