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
Marin Jurjevic a2efd284c8 drivers: pinmux: stm32 Fix return stm32_dt_pinctrl_remap value
Fix incorrect return value check when converting pinctrl
format to existing pin config format

Signed-off-by: Marin Jurjevic <marin.jurjevic@hotmail.com>
2020-10-21 06:18:51 -05:00
Erwan Gouriou 84d2211057 drivers/pinmux: stm32f1: Revise timers possible remap values
Only pinctrl for tim2 can have a REMAP_FULL value.
Usual value is REMAP_1.
Fix this

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-20 09:09:29 -05:00
Erwan Gouriou fa190589a9 drivers/pinmux: stm32: remap code should be guarded under node status
CAN remaps were guarded by CMSIS defines which are always defined
for a given SoC.
Though under this control, we're using DT_ macros that expect
a certain node to be available, which otherwise leads to cmopilation
issue.
Align CAN node remap code on other peripherals code and check for
node availability.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-20 09:09:29 -05:00
Erwan Gouriou 0b9c584ec1 drivers/pinmux: stm32: Provide unique API to stm32_dt_pinctrl
Set stm32_dt_pinctrl_configure function as the unique entry point
to STM32 DT pinctrl management.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-20 09:09:29 -05:00
Erwan Gouriou f44e931b0c drivers/pinmux: stm32: Get remap functions visible across family
Move pinctrl remap functions out of stm32f1 definition in order
to get it available to all series.
Allows use of more IS_ENABLED macros in calling drivers and make
code more readable.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-20 09:09:29 -05:00
Erwan Gouriou 0143b5e3de drivers/pinctrl: stm32f1: Provide a function which centralize remap
Centralize AFIO remapping into one single function.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-20 09:09:29 -05:00
Eric Hay 5f42ba52d8 soc: arm: stm32g0: add STM32G070 SoC series
This commit adds support for the STM32G070xx SoCs
by STMicroelectronics.

Signed-off-by: Eric Hay <EHay@sierrawireless.com>
2020-10-09 11:49:39 +02:00
Mulin Chao 50753c1d7d drivers: npcx: Add const modifier for hal instances and so on.
Add const modifier for hal instances, clock devices pointer, and module
base address in npcx drivers to prevent driver functions change them
unexpectedly.

Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
2020-10-06 18:16:02 -05:00
Erwan Gouriou f100e2c09e drivers/pinmux: stm32f1: Update dt to gpio encoding function
Based on pinmux data encoded in dt bindings some stm32f1 post
processing is required to eventually fit into data structures
expected in gpio_stm32_configure function.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-01 11:08:42 -05:00
Erwan Gouriou e9eec5a5d1 include/dt-bindings/pinctrl: stm32: Rename stm32-pinctrlf1
Rename header file stm32-pinctrlf1.h to more appropriate
stm32f1-pinctrl.h

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-01 11:08:42 -05:00
Erwan Gouriou d1afd83df0 drivers/pinmux: stm32: provide dt pinctrl to gpio driver interface
Provides tool set to be used by device drivers in order to be able
to configure device signals.
This does not involve the implementation of a dedicated pinctrl
driver. In this regard, this is equivalent to implementation used
for treatment of current pinmux.c files.

Since STM32F1 uses a different GPIO configuration scheme, its
support is exlcuded for now.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-01 11:08:42 -05:00
Erwan Gouriou b9e59b5e9d drivers/pinmux: stm32: minor fixes
Update stm32_pin_configure prototype to use more appropriate
unsigned arguments
Additionally, fix documentation for z_pinmux_stm32_set function

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-10-01 11:08:42 -05:00
Brian Kubisiak a84a0e6671 drivers: pinmux: stm32f0: Add additional I2C pins.
Add additional pinmux definitions for I2C1 and I2C2 that are used
on the stm32f030 series SoCs. Additionally, correct the PF0 and PF1 I2C
functions, which were swapped.

Signed-off-by: Brian Kubisiak <brian@kubisiak.com>
2020-09-28 14:00:43 -05:00
Paul Fagerburg a8639a0432 drivers/pinmux/stm32: add/fix pinmux for F103xG
* Add missing the PINMUX macros for UART5 pins.
* Correct a typo in STM32F1_PINMUX_FUNC_PC5_ADC12_IN15; the macro
 used PC4 instead of PC5 for ADC12_IN15.

Signed-off-by: Paul Fagerburg <pfagerburg@google.com>
2020-09-18 14:25:55 -05:00
Martin Jäger 66dde3a968 drivers: dac: Enable for STM32F0 series
Add DAC nodes to devicetree, include LL headers in soc.h and add
pinmux defines for DAC.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-09-03 14:46:03 -05:00
Martin Jäger 1dab7751b5 drivers: dac: Enable for STM32G4 series
Add DAC nodes to devicetree, include LL headers in soc.h and add
pinmux defines for DAC.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-09-03 14:46:03 -05:00
Tomasz Bursztyka e18fcbba5a device: Const-ify all device driver instance pointers
Now that device_api attribute is unmodified at runtime, as well as all
the other attributes, it is possible to switch all device driver
instance to be constant.

A coccinelle rule is used for this:

@r_const_dev_1
  disable optional_qualifier
@
@@
-struct device *
+const struct device *

@r_const_dev_2
 disable optional_qualifier
@
@@
-struct device * const
+const struct device *

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-09-02 13:48:13 +02:00
Alexandre Bourdiol 8098ecbc02 boards: arm: nucleo_g071rb enable PWM
Tested with tests/drivers/pwm/pwm_api/
(requires https://github.com/zephyrproject-rtos/zephyr/pull/27204)
and with oscillo.

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-09-01 13:35:48 +02:00
Mulin Chao b3188f1c32 drivers: npcx: replace type of register base address with uintptr_t
Replace npcx register base address type, uint32_t, with uintptr_t.
It is easier to know what type of base address and for linear
addresses treated as integral values.

This CL also modified IS_BIT_SET() macro function to fit MISRA code
guidelines.

Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
2020-09-01 13:35:25 +02:00
Mulin Chao 1eca7ab46a drivers: npcx: remove suffix '_t' of device register structure.
Remove the '_t' suffix of device register structure since it is used
mainly with typedefs.

Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
2020-09-01 13:35:25 +02:00
Alexandre Bourdiol 5ae149a17b board: arm: nucleo_f207zg: add DAC support
Add DAC support to nucleo_f207zg:

Signed-off-by: Alexandre Bourdiol <alexandre.bourdiol@st.com>
2020-08-27 16:06:34 +02:00
Martin Jäger 202ca01dcb drivers: pinmux: stm32g4x: Add PWM8 defines
All positive PWM outputs of TIM8 added.

Signed-off-by: Martin Jäger <martin@libre.solar>
2020-08-26 12:33:07 +02:00
Erwin Rol 913c76864a drivers: pinmux: stm32: add SPI pinmux for F4 series
Add SPI NSS functionality on PB0, PD2, and PB14 pins.

Signed-off-by: Erwin Rol <erwin@erwinrol.com>
2020-08-18 14:50:34 +02:00
Richard Osterloh 702e8d0a31 drivers: pinmux: Fix NSS definitions for SPI
Complete hardware NSS multiplexing definitions for SPI

Signed-off-by: Richard Osterloh <richard.osterloh@gmail.com>
2020-08-14 18:02:28 +02:00
Mulin Chao 9cb73abbdc driver: pinctrl: Add pin control support in NPCX series.
Add pin controller support for Nuvoton NPCX series
Add pin-mux controller support for Nuvoton NPCX series.

This CL includes:
1. Add pin controller device tree declarations and introduce alt-cells
   to select pads' functionality.
2. Add npcx7-alts-map.dtsi since the mapping between IO and controller
   is irregular and vary in each chip series.
3. Add nuvoton,npcx-pinctrl-def.yaml and its declarations to change all
   pads' functionality to GPIO by default.
4. Pinmux controller driver implementation.

Signed-off-by: Mulin Chao <MLChao@nuvoton.com>
2020-08-13 16:42:20 +02:00
Tomasz Bursztyka af6140cc0d device: Apply config_info rename everywhere
Via coccinelle:

@r_device_config@
struct device *D;
@@

D->
-	config_info
+	config

And 2 grep/sed rules for macros:

git grep -rlz 'dev)->config_info' |
	xargs -0 sed -i 's/dev)->config_info/dev)->config/g'

git grep -rlz 'dev->config_info' |
	xargs -0 sed -i 's/dev->config_info/dev->config/g'

Fixes #27397

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-08-11 19:30:53 +02:00
Simon Guinot fb92dd1bc7 drivers: pinmux: add driver for NXP LPC11U6X MCUs
This patch adds a pinmux driver allowing to configure the IOCON (I/O
control) registers found on the LPC11U6x MCUs.

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
2020-07-29 20:12:24 +02:00
Simon Guinot 5f9b104db3 drivers: pinmux: sort entries in CMakeLists.txt and Kconfig
Sort source entries in CMakeLists.txt and Kconfig by alphabetic order.

Signed-off-by: Simon Guinot <simon.guinot@seagate.com>
2020-07-29 20:12:24 +02:00
Mahesh Mahadevan 23f97f52f7 pinmux: mxrt6xx: Update to support IOPCTL
Add changes for differences between IOPCTL and IOCON modules

Signed-off-by: Mahesh Mahadevan <mahesh.mahadevan@nxp.com>
2020-07-28 18:24:19 -05:00
Alexander Kozhinov 3ad1f91a80 drivers: pinumx: stm32: pinmux_stm32h7: added ethernet pins
added ethernet pins definition for stm32h7 SoC series

Signed-off-by: Alexander Kozhinov <AlexanderKozhinov@yandex.com>
2020-07-21 15:12:18 +02:00
Jeremy LOCHE 8344b8080b drivers: pinmux: corrected all USART6 alternate functions
Fixed AF for USART 6 on PC6/PC7 PG8/PG9/PG12/PG13/PG14/PG15
All RTS/CTS/RX/TX pins now have correct AF7 instead of wrong AF8.

Signed-off-by: Jeremy LOCHE <lochejeremy@gmail.com>
2020-07-13 11:53:12 +02:00
Jeremy LOCHE 695bd85b99 drivers: pinmux: stm32h7: fix incorrect PG9/PG14 usart6 AF
Fixes AF of PG9/PG14 for usart6. Must be AF7 instead of AF8

Signed-off-by: Jeremy LOCHE <lochejeremy@gmail.com>
2020-07-13 11:53:12 +02:00
Kwon Tae-young a4d5207675 drivers: pinmux: stm32f7: CAN, SPI, I2C pinmuxes added
All pinmux supporting CAN, SPI and I2C of F7 series are added.
Since the F7 series supports up to two CANs,
the pin names of CANs have been changed.

Several minor pinmux errors have also been fixed.
Sorted by Alternate function.

Signed-off-by: Kwon Tae-young <tykwon@m2i.co.kr>
2020-06-23 19:05:26 +02:00
Markus Becker 51d84c9eb4 drivers: pinmux: stm32: add PWM pinmux on PA3 for F4 series
Add PWM2 CH4 functionality on PA3 pin.

Signed-off-by: Markus Becker <markus.becker@tridonic.com>
2020-06-16 19:11:35 +02:00
Ilya Tagunov b899bbf9b9 soc: stm32l1: Enable DAC support
Enable STM32 DAC driver for STM32L1 series.

Signed-off-by: Ilya Tagunov <tagunil@gmail.com>
2020-06-12 11:06:44 +02:00
Andreas Sandberg aec341e677 boards: arm: b_l072z_lrwan1: Enable the USB controller
The STM32L072CZ MCU has a built-in USB device controller which is
supported by Zephyr's USB STM32 driver. The b_l072z_lrwan1 board has a
micro-USB connector that is wired to the MCU via two solder bridges
(SB15 and SB16) that need to be closed to connect the data lines.

Update the board documentation to describe the solder bridges and
enable the USB controller in the device tree.

Signed-off-by: Andreas Sandberg <andreas@sandberg.pp.se>
2020-06-11 13:11:59 -05:00
Dimitris Tassopoulos c2e9c1fa49 boards: nucleo_f401re: added pwm-led0
Added onboard led to the devicetree to be supported also with pwm-led0

Signed-off-by: Dimitris Tassopoulos <dimtass@gmail.com>
2020-06-11 10:58:58 +02:00
Kumar Gala a1b77fd589 zephyr: replace zephyr integer types with C99 types
git grep -l 'u\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/u\(8\|16\|32\|64\)_t/uint\1_t/g"
	git grep -l 's\(8\|16\|32\|64\)_t' | \
		xargs sed -i "s/s\(8\|16\|32\|64\)_t/int\1_t/g"

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-06-08 08:23:57 -05:00
Martí Bolívar 6e8775ff84 devicetree: remove DT_HAS_NODE_STATUS_OKAY
Several reviewers agreed that DT_HAS_NODE_STATUS_OKAY(...) was an
undesirable API for the following reasons:

- it's inconsistent with the rest of the DT_NODE_HAS_FOO names
- DT_NODE_HAS_FOO_BAR_BAZ(node) was agreed upon as a shorthand
  for macros which are equivalent to
  DT_NODE_HAS_FOO(node) && DT_NODE_HAS_BAR(node) &&
- DT_NODE_HAS_BAZ(node), and DT_HAS_NODE_STATUS_OKAY is an odd duck
- DT_NODE_HAS_STATUS(..., okay) was viewed as more readable anyway
- it is seen as a somewhat aesthetically challenged name

Replace all users with DT_NODE_HAS_STATUS(..., okay), which is
semantically equivalent.

This is mostly done with sed, but a few remaining cases were done by
hand, along with whitespace, docs, and comment changes. These special
cases include the Nordic SOC static assert files.

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-13 18:24:42 +02:00
Martí Bolívar 7e0eed9235 devicetree: allow access to all nodes
Usually, we want to operate only on "available" device
nodes ("available" means "status is okay and a matching binding is
found"), but that's not true in all cases.

Sometimes we want to operate on special nodes without matching
bindings, such as those describing memory.

To handle the distinction, change various additional devicetree APIs
making it clear that they operate only on available device nodes,
adjusting gen_defines and devicetree.h implementation details
accordingly:

- emit macros for all existing nodes in gen_defines.py, regardless
  of status or matching binding
- rename DT_NUM_INST to DT_NUM_INST_STATUS_OKAY
- rename DT_NODE_HAS_COMPAT to DT_NODE_HAS_COMPAT_STATUS_OKAY
- rename DT_INST_FOREACH to DT_INST_FOREACH_STATUS_OKAY
- rename DT_ANY_INST_ON_BUS to DT_ANY_INST_ON_BUS_STATUS_OKAY
- rewrite DT_HAS_NODE_STATUS_OKAY in terms of a new DT_NODE_HAS_STATUS
- resurrect DT_HAS_NODE in the form of DT_NODE_EXISTS
- remove DT_COMPAT_ON_BUS as a public API
- use the new default_prop_types edtlib parameter

Signed-off-by: Martí Bolívar <marti.bolivar@nordicsemi.no>
2020-05-08 19:37:18 -05:00
Tomasz Bursztyka 97326c0445 device: Fix structure attributes access
Since struct devconfig was merged earlier into struct device, let's fix
accessing config_info, name, ... attributes everywhere via:

grep -rlZ 'dev->config->' | xargs -0 sed -i 's/dev->config->/dev->/g'

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
2020-05-08 23:07:44 +02:00
Sahaj Sarup 351f39f9cd board: arm: Add Support For 96Boards Aerocore2
Changes:

- Added all required board files in /boards/arm/96b_aerocore2
- Modified pinmux for stm32f4

Most of the changes in this PR is based on reverse-engineering of the
PCB layout and following commits in the PX4 firmware repository for
the same board. The manufacturer does not provide and or generate
schematics and pinout tables for this board.

This PR includes almost all of the interfaces connected to the STM32
MCU, the only thing not included is the J9 and J8 headers that connect
to a 96Boards baseboard.
These headers are not vital to the functionality of the Aerocore2.

Signed-off-by: Sahaj Sarup <sahaj.sarup@linaro.org>
2020-05-08 07:33:43 -05:00
Helge Juul dc0c938359 boards: arm: stm32f746g_disco: enable sdmmc support
Update dtsi and pinmux macros for stm32f7 family. Add sdmmc1 to dts file
for stm32f746g_disco. Also add board specific configuration file for
fat_fs sample.

Signed-off-by: Helge Juul <helge@fastmail.com>
2020-05-08 10:53:10 +02:00
Anthony Brandon a71f77e601 boards: arm: stm32l496g_disco: enable sdmmc support
Update the dtsi for stm32l471 (which the higher SoCs are based on) to
support the stm32-sdmmc disk access device. Enable the device for the
stm32l496g_disco board, and update the pinmuxing.
Note that the stm32l496g_disco board also has a card detect gpio
(MFX_GPIO8), but this is not supported yet. When not specified the
driver will assume a card is present.

Signed-off-by: Anthony Brandon <anthony@amarulasolutions.com>
2020-05-08 10:53:10 +02:00
Erwan Gouriou 4b3d79f1bb drivers: stm32: Add pinmux headers for stm32l5
Copy/pasted from L4 series.

Signed-off-by: Erwan Gouriou <erwan.gouriou@linaro.org>
2020-05-08 00:34:34 -05:00
Gerard Marull-Paretas cfebfc188e drivers: adc: stm32: add support for H7 series
Add support for ADC on H7 series. Note that ADC1 and ADC2 share the same
register set, so it is added as "adc1_2".

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2020-05-07 23:01:59 -05:00
Francois Ramu 01e9983142 drivers: pinmux: stm32wb: use a pull-down for SPI SCK pin
Like stm32 L4 does,
when the STM32WBx SoC goes into STOP mode, the SPI device is disabled.
This cause the pins to not be drived anymore (i.e. they are floating)
except through their pull-up or pull-down.

From the logical point of view, the NSS pin is held high by a pull-up
so it's not a problem if the other pins are floating. However those pins
are floating input for the slaves, which increase their power
consumption.

The solution is to hold the state of the pins through a pull-up or a
pull-down. This is already done for the NSS and MOSI pins, but not for
SCK. Fix that by using pull-down on the SCK pin the same way it is
already done for the MOSI pin.

Signed-off-by: Francois Ramu <francois.ramu@st.com>
2020-05-07 23:00:32 -05:00
Kumar Gala 0a7d4e2135 devicetree: Change DT_FOREACH_IMPL_ to not insert semicolon
Remove semicolon between instance invocations of DT_FOREACH_IMPL_ and
thus DT_INST_FOREACH.  This provides more flexibility to the user.  This
requires we fixup in tree users to add semicolon where needed.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-07 20:03:56 -05:00
Pete Johanson 91d6139338 boards: arm: nucleo_wb55rg: Enable USB for stm32wb.
* Define USB driver for base stm32wb device.
* Enable USB for the nucleo_wb55rg board.
* Properly initialize USB power + clock for the platform.

Signed-off-by: Pete Johanson <peter@peterjohanson.com>
2020-05-06 10:46:23 -05:00
Kumar Gala fdd85d5ad7 dts: Rename DT_HAS_NODE macro to DT_HAS_NODE_STATUS_OKAY
Rename DT_HAS_NODE to DT_HAS_NODE_STATUS_OKAY so the semantics are
clear.  As going forward DT_HAS_NODE will report if a NODE exists
regardless of its status.

Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
2020-05-06 05:25:41 -05:00