| #
1e3057c6 |
| 26-Feb-2025 |
Etienne Carriere <etienne.carriere@foss.st.com> |
drivers: stm32_i2c: fallback to interrupt access when no bottom half
Change stm32_i2c driver to allow I2C transfers in interrupt context before bottom half thread is initialized and after it's relea
drivers: stm32_i2c: fallback to interrupt access when no bottom half
Change stm32_i2c driver to allow I2C transfers in interrupt context before bottom half thread is initialized and after it's released.
This can be needed by PMIC driver to handle PMCI interrupt events when bottom half thread is not supported by normal wold. In that case, PMIC driver would need to register its interrupt to stm32_i2c driver.
Thread accesses to the bus still start by locking the I2C bus mutex. Before using the bus, the sequence now masks the PMIC interrupt and polls (with timeout) on I2C bus access atomic lock. This lock may be held by an I2C transfer currently executing in an interrupt context. A 100ms timeout is short enough to also allow debug console traces in the interrupt sequence. Masking the interrupt before polling the lock ensures no new pending interrupt will interrupt us (and execute a I2C transfer) while the thread context accesses the I2C bus.
Interrupt accesses to the bus atomically set/clear the I2C bus access lock while executing the interrupt sequence.
Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com> Signed-off-by: Thomas Bourgoin <thomas.bourgoin@foss.st.com> Reviewed-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
show more ...
|
| #
ded20780 |
| 23-Oct-2024 |
Etienne Carriere <etienne.carriere@foss.st.com> |
drivers: stm32_i2c: use compatible st,stm32mp15-i2c-non-secure
Change STM32 I2C driver to rely on the compatible DT property of the node to store whether the bus is expected assigned to secure or no
drivers: stm32_i2c: use compatible st,stm32mp15-i2c-non-secure
Change STM32 I2C driver to rely on the compatible DT property of the node to store whether the bus is expected assigned to secure or non-secure world. Using a non-secure I2C bus in OP-TEE on stm32mp1 platforms is something expected only on STM32MP15 variant for compatibility with platform already supported in upstream Linux/U-Boot components, as defined by st,stm32mp15-i2c-non-secure specific compatible string ID.
Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com> Acked-by: Gatien Chevallier <gatien.chevallier@foss.st.com>
show more ...
|
| #
bdde1c99 |
| 18-Mar-2024 |
Etienne Carriere <etienne.carriere@foss.st.com> |
drivers: stm32_i2c: protect bus access with a mutex
Protect concurrent accesses to an STM32 I2C bus with a PM aware mutex.
Acked-by: Gatien Chevallier <gatien.chevallier@foss.st.com> Signed-off-by:
drivers: stm32_i2c: protect bus access with a mutex
Protect concurrent accesses to an STM32 I2C bus with a PM aware mutex.
Acked-by: Gatien Chevallier <gatien.chevallier@foss.st.com> Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| #
d50fee03 |
| 16-Oct-2023 |
Etienne Carriere <etienne.carriere@foss.st.com> |
core: prefix header file guard names with __
Improves header files guard names consistency by using a __ prefix where missing.
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Signed-off-by:
core: prefix header file guard names with __
Improves header files guard names consistency by using a __ prefix where missing.
Reviewed-by: Jens Wiklander <jens.wiklander@linaro.org> Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| #
5bc9f8e5 |
| 05-Oct-2023 |
Etienne Carriere <etienne.carriere@foss.st.com> |
drivers: stm32_i2c: register a DT_DRIVER_I2C driver
Registers stm32_i2c driver as a DT_DRIVER_I2C driver.
Acked-by: Gatien Chevallier <gatien.chevallier@foss.st.com> Acked-by: Thomas Bourgoin <thom
drivers: stm32_i2c: register a DT_DRIVER_I2C driver
Registers stm32_i2c driver as a DT_DRIVER_I2C driver.
Acked-by: Gatien Chevallier <gatien.chevallier@foss.st.com> Acked-by: Thomas Bourgoin <thomas.bourgoin@foss.st.com> Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| #
9ef7a09c |
| 25-May-2023 |
Etienne Carriere <etienne.carriere@foss.st.com> |
drivers: stm32_i2c: remove cases when CFG_DRIVERS_PINCTRL is disabled
Removes implementation when CFG_DRIVERS_PINCTRL is disables as stm32mp1 platform configuration enforces the switch is enabled.
drivers: stm32_i2c: remove cases when CFG_DRIVERS_PINCTRL is disabled
Removes implementation when CFG_DRIVERS_PINCTRL is disables as stm32mp1 platform configuration enforces the switch is enabled.
Acked-by: Gatien Chevallier <gatien.chevallier@foss.st.com> Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| #
73ba32eb |
| 23-May-2023 |
Etienne Carriere <etienne.carriere@foss.st.com> |
drivers: stm32_i2c: support CFG_DRIVERS_PINCTRL
Updates stm32_i2c driver for when CFG_DRIVERS_PINCTRL is enabled making I2C driver to get pin control configuration using the generic pin control fram
drivers: stm32_i2c: support CFG_DRIVERS_PINCTRL
Updates stm32_i2c driver for when CFG_DRIVERS_PINCTRL is enabled making I2C driver to get pin control configuration using the generic pin control framework. When enabled, stm32_i2c driver get the active and sleep pin control configuration from the device tree. Sleep pinctrl configuration is optional.
SE050 and STM32MP1 PMIC drivers that use the stm32_i2c bus are both updated accordingly.
Acked-by: Gatien Chevallier <gatien.chevallier@foss.st.com> Signed-off-by: Etienne Carriere <etienne.carriere@foss.st.com>
show more ...
|
| #
929ec061 |
| 16-Nov-2021 |
Etienne Carriere <etienne.carriere@linaro.org> |
drivers: stm32_i2c: use generic clock API
Replaces use of ST specific stm32mp_clk_xxx() clocks functions in favor to OP-TEE generic clock API functions clk_xxx() using struct clk * as clock referenc
drivers: stm32_i2c: use generic clock API
Replaces use of ST specific stm32mp_clk_xxx() clocks functions in favor to OP-TEE generic clock API functions clk_xxx() using struct clk * as clock references. Updates I2C driver and PMIC that is a consumer of an I2C bus.
Reviewed-by: Lionel Debieve <lionel.debieve@foss.st.com> Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| #
2b81d819 |
| 23-Sep-2021 |
Etienne Carriere <etienne.carriere@linaro.org> |
drivers: stm32_i2c: stm32_i2c_get_setup_from_fdt() returns TEE_Result
Change stm32_i2c interface function stm32_i2c_get_setup_from_fdt() to return a TEE_Result code rather than a FDT error code.
Re
drivers: stm32_i2c: stm32_i2c_get_setup_from_fdt() returns TEE_Result
Change stm32_i2c interface function stm32_i2c_get_setup_from_fdt() to return a TEE_Result code rather than a FDT error code.
Reviewed-by: Lionel Debieve <lionel.debieve@foss.st.com> Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| #
717f942a |
| 03-Nov-2021 |
Lionel Debieve <lionel.debieve@foss.st.com> |
drivers: stm32_i2c: use reg_size to map virtual addresses
Use directly the register map size from the dt_node_info structure to call the io_pa_or_va() function.
Signed-off-by: Lionel Debieve <lione
drivers: stm32_i2c: use reg_size to map virtual addresses
Use directly the register map size from the dt_node_info structure to call the io_pa_or_va() function.
Signed-off-by: Lionel Debieve <lionel.debieve@foss.st.com> Reviewed-by: Etienne Carriere <etienne.carriere@linaro.org>
show more ...
|
| #
b4bfc9a9 |
| 30-Apr-2021 |
Jens Wiklander <jens.wiklander@linaro.org> |
core/include/*/*.h: use U() for unsigned constants
Updates with the U() macro as described in the recently updated coding guidelines.
Acked-by: Ruchika Gupta <ruchika.gupta@linaro.org> Acked-by: Je
core/include/*/*.h: use U() for unsigned constants
Updates with the U() macro as described in the recently updated coding guidelines.
Acked-by: Ruchika Gupta <ruchika.gupta@linaro.org> Acked-by: Jerome Forissier <jerome@forissier.org> Signed-off-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
6470bd16 |
| 05-May-2020 |
Etienne Carriere <etienne.carriere@st.com> |
drivers: stm32_i2c: fixup typo in sec_cfg field description
Fixup typo in i2c_cfg::sec_cfg description inline comment.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com> Acked-by: Jerome For
drivers: stm32_i2c: fixup typo in sec_cfg field description
Fixup typo in i2c_cfg::sec_cfg description inline comment.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com> Acked-by: Jerome Forissier <jerome@forissier.org>
show more ...
|
| #
3ebb1380 |
| 01-May-2020 |
Etienne Carriere <etienne.carriere@st.com> |
drivers: stm32_i2c: allow any bus frequency
Do not limit I2C bus to 3 frequencies (100KHz, 400KHz, 1MHz). Instead allow for any frequency up to 1MHz. Depending on the requested frequency defined in
drivers: stm32_i2c: allow any bus frequency
Do not limit I2C bus to 3 frequencies (100KHz, 400KHz, 1MHz). Instead allow for any frequency up to 1MHz. Depending on the requested frequency defined in clock-frequency DT entry, use the I2C spec data from either Standard, Fast or Fast Plus mode.
This change removes use of rate IDs and use instead the rate value itself as identifiers, allowing more flexible implementation.
Changes local variable clock_src in i2c_setup_timing() from uint32_t to unsigned long for consistency.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com> Signed-off-by: Yann Gautier <yann.gautier@st.com> Acked-by: Jerome Forissier <jerome@forissier.org>
show more ...
|
| #
31c3d89f |
| 01-May-2020 |
Etienne Carriere <etienne.carriere@st.com> |
drivers: stm32_i2c: don't recompute I2C timings setting
Save I2C timing configuration when computed and reused it when needing the same frequency later on.
Signed-off-by: Etienne Carriere <etienne.
drivers: stm32_i2c: don't recompute I2C timings setting
Save I2C timing configuration when computed and reused it when needing the same frequency later on.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com> Acked-by: Jerome Forissier <jerome@forissier.org>
show more ...
|
| #
c6563194 |
| 17-May-2019 |
Etienne Carriere <etienne.carriere@st.com> |
stm32_i2c: save DTB status
This change saves DTB status value found in the I2C node and introduces i2c_is_secure() to state the bus state.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com>
stm32_i2c: save DTB status
This change saves DTB status value found in the I2C node and introduces i2c_is_secure() to state the bus state.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
834ce4c6 |
| 03-May-2019 |
Etienne Carriere <etienne.carriere@st.com> |
stm32_i2c: optimized I2C 1 byte memory transfer
Introduce stm32_i2c_read_write_membyte() to operate a single byte data transfer in memory mode. This function will be used by the power management seq
stm32_i2c: optimized I2C 1 byte memory transfer
Introduce stm32_i2c_read_write_membyte() to operate a single byte data transfer in memory mode. This function will be used by the power management sequence in order to relax pager resident memory footprint when I2C need to execute in an unpaged context.
Signed-off-by: Etienne Carriere <etienne.carriere@st.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org>
show more ...
|
| #
61e7d84c |
| 29-Apr-2019 |
Etienne Carriere <etienne.carriere@linaro.org> |
stm32_i2c: expose standard speed in driver API
Move definition of I2C standard speeds configuration means from driver source file to its header file. This change allows bus owners to use appropriate
stm32_i2c: expose standard speed in driver API
Move definition of I2C standard speeds configuration means from driver source file to its header file. This change allows bus owners to use appropriate value for bus configuration.
Exposes struct i2c_speed_e and enum i2c_speed_e
This change fixes the driver API as enum i2c_speed_e is expected by the API.
Fixes: b844655c9519 ("stm32_i2c: driver for STM32 I2C bus")
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
show more ...
|
| #
c75303f7 |
| 08-Mar-2019 |
Etienne Carriere <etienne.carriere@linaro.org> |
stm32_i2c: handle pinctrl
Get pinctrl support from stm32_gpio.h into STM32 I2C driver. When device tree content defines pins related to an I2C interface, the I2C driver saves the pins configuration
stm32_i2c: handle pinctrl
Get pinctrl support from stm32_gpio.h into STM32 I2C driver. When device tree content defines pins related to an I2C interface, the I2C driver saves the pins configuration instances and set the registered pins in the expected power mode at runtime.
Signed-off-by: Etienne Carriere <etienne.carriere@linaro.org> Acked-by: Jens Wiklander <jens.wiklander@linaro.org>
show more ...
|
| #
b844655c |
| 07-Mar-2019 |
Etienne Carriere <etienne.carriere@st.com> |
stm32_i2c: driver for STM32 I2C bus
Drivers is embedded upon CFG_STM32_I2C=y.
The driver main API functions are: stm32_i2c_init() to initialize the device driver, stm32_i2c_mem_{write|read}() for I
stm32_i2c: driver for STM32 I2C bus
Drivers is embedded upon CFG_STM32_I2C=y.
The driver main API functions are: stm32_i2c_init() to initialize the device driver, stm32_i2c_mem_{write|read}() for I2C memory mode transfer, stm32_i2c_master_{transmit|receive}() for stream transfer.
2 helpers: stm32_i2c_is_device_ready() checks the hardware I2C link, stm32_i2c_get_setup_from_fdt() fills the I2C initialization structure from the content found in the DT.
I2C driver instances do not register themselves to the PM framework. Bus owner is responsible for calling the stm32_i2c_{suspend|resume}() APIs when the owner device executes a PM sequence.
stm32_i2c driver is dual licensed GPL-2.0/BSD-3-Clause. The conversion algorithm for converting device tree bindings timing information into STM32 I2C timings configuration register is shared with other packages (Linux kernel, Arm Trusted Firmware-A, U-Boot).
Signed-off-by: Etienne Carriere <etienne.carriere@st.com> Signed-off-by: Nicolas Le Bayon <nicolas.le.bayon@st.com> Signed-off-by: Pascal Paillet <p.paillet@st.com> Signed-off-by: Pierre-Yves MORDRET <pierre-yves.mordret@st.com> Signed-off-by: Yann Gautier <yann.gautier@st.com> Acked-by: Jerome Forissier <jerome.forissier@linaro.org> Reviewed-by: Joakim Bech <joakim.bech@linaro.org>
show more ...
|