| Commit message (Collapse) | Author | Age | Files | Lines |
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Now that the driver core will call the driver probe function if there is
no bus probe function, remove all bus probe functions that do what the
core can do instead.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20240228160518.1589193-3-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
| |
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Now that driver core will call dev->driver->remove if dev->bus->remove
is NULL, we cann remove all bus_type::remove functions that do the same.
This has the welcome side effect that devices that device_remove will
return false when called on a device the neither has a bus remove or
driver remove function and thus we can skip tracing these calls when
CONFIG_DEBUG_PROBES is enabled.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20240215103353.2799723-2-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ \ |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This adds PBL support to the lpi2c driver which can be used for early
I2C support on i.MX93.
Link: https://lore.barebox.org/20240205074553.2005284-4-s.hauer@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
In PBL we don't have get_time_ns() and is_timeout() available. In
preparation for adding PBL support to the driver replace the timeout
loops with udelay() which we have available in PBL.
Link: https://lore.barebox.org/20240205074553.2005284-3-s.hauer@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |/
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The clock rate is not expected to change during runtime, so we can
determine it during probe instead of later when actually transferring
messages. This helps us to integrate PBL support into the driver where
we don't have clk_get_rate() available.
Link: https://lore.barebox.org/20240205074553.2005284-2-s.hauer@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
|
|
|
|
|
|
|
| |
All callers of of_find_i2c_adapter_by_node expect errors to be indicated
by NULL and don't check non-NULL pointers with IS_ERR().
Therefore map of_device_ensure_probed() errors to NULL as well to avoid
dereferencing error pointers.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
Link: https://lore.barebox.org/20240216220337.2327115-1-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
| |
Link: https://lore.barebox.org/20231110125800.1901232-13-s.hauer@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Now that there are no longer any users of regmap.h in headers, let's
switch all users in the source files to linux/regmap.h.
That way, the only users of regmap.h whether directly or indirectly will
be out-of-tree code, which will fail with an error if they are dependent
on the old semantics of regmap_bulk_read and regmap_bulk_write.
After a transitory period, we can then drop regmap.h.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20231020071853.2826528-12-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
| |
Add a slice for I2C adapters so that devices using I2C in the background
can check if a I2C bus is busy.
Tested-by: Gerald Loacker <gerald.loacker@wolfvision.net>
Link: https://lore.barebox.org/20230908131117.1769957-1-s.hauer@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This patch updates the stm32 i2c driver. The original source is taken from
the STMicroelectronics/u-boot repository [1].
As a bonus from the update, the i2c_probe command now works properly,
added support for stm32mp13x CPUs and a parser for some stm32-specific
i2c devicetree properties.
[1] https://github.com/STMicroelectronics/u-boot/blob/v2022.10-stm32mp/drivers/i2c/stm32f7_i2c.c
Signed-off-by: Alexander Shiyan <eagle.alexander923@gmail.com>
Link: https://lore.barebox.org/20230728102332.40088-1-eagle.alexander923@gmail.com
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
| |
We have the %pOF format specifier for printing device nodes. Use it
where appropriate.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Syncing device trees with Linux upstream can lead to breakage, when
the device trees are switched to newer bindings, which are not yet
supported in barebox. To make it easier to spot such issues, we want to
start applying some heuristics to flag possibly problematic DT changes.
One step towards being able to do that is to know what nodes barebox
actually consumes. Most of the nodes have a compatible entry, which is
matched by an array of of_device_id, so let's have MODULE_DEVICE_TABLE
point at it for future extraction.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20230612125908.1087340-1-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
struct device::rescan is called by the core to let the subsystem rescan
the controllers device node. Implement that for I2C. Ahmad recently
implemented the struct device::detect hook for the very same purpose.
The downside of that approach was that device_detect() had to be called
manually and that either needs knowledge which device actually has
updated device nodes, or all devices were detected, like unrelated USB
or MMC/SD devices. The rescan hook doesn't need that manual detect call,
so just drop the I2C detect implementation in favour for implementing
rescan.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
|
|
|
|
| |
Currently arch specific headers can be included with
longer possible as there won't be a single mach anymore.
Move all omap specific header files to include/mach/omap/ to
prepare for multi-arch support.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
For MMCs, we already support detect on both the hardware device and the
mmcX virtual device. Let's do the same for i2c, so users have the option
to do `detect i2c0` instead of `detect 30a30000.i2c@30a30000.of`.
`detect -a` still works as expected, as the detect callback is a no-op
if everything on the bus is already registered.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
Link: https://lore.barebox.org/20230125075323.1759934-1-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
The i.MX early I2C code requires waiting for the controller to settle
after configuration. This is currently done using udelay which is
supported on ARMv8 but not on ARMv7.
For the i.MX6 we will have to use a custom delay. This was only
tested on the i.MX6Q but should work on all other i.MX6 chips.
Signed-off-by: John Watts <contact@jookia.org>
Link: https://lore.barebox.org/20230201094435.1228362-1-contact@jookia.org
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Based on the corresponding Kernel commit c126f7c3b8c4:
The i2c_recover_bus() returns -EOPNOTSUPP if bus recovery isn't wired up
by the bus driver, which the case for Tegra I2C driver for example. This
error code is then propagated to I2C client and might be confusing, thus
make i2c_recover_bus() to return -EBUSY instead.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
i2c_fsl_set_clk() is called before the i2c device has been initialized,
so the dev_dbg() messages therein show up as:
<NULL>: <i2c_fsl_set_clk> I2C_CLK=66000000, REQ DIV=660
Use the parent device instead for printing these messages.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
|
|
|
| |
This adds early i2c support for i.MX6. Nothing special here, just a
plain copy of the i.MX8 code with the divider adjusted.
Signed-off-by: John Watts <contact@jookia.org>
Link: https://lore.barebox.org/20230121144429.3524905-2-contact@jookia.org
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
of_device_ensure_probed will call device::detect on the I2C adapter,
so it can detect its children node, in case they were not probed before.
This can happen if the nodes were added dynamically via device tree
fixup or overlay. Implement a detect callback to support this.
To keep existing behavior, we call this detect callback unconditionally
while newly registering the adapter.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20230116133639.1999170-3-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| |
| | |
There's no debug message when registering a device over DT, only via
legacy board info. Add a common print instead.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20230116133639.1999170-2-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
|
|
|
|
|
|
| |
The driver was recently updated for SAMA5D2 support and SAMA5D4/SAM9x60
is straight-forward to add on top. While at it, drop has_clear_cmd,
which denotes hardware I2C bus recovery support. We never used the
member.
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20230109130822.1657470-6-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
| |
The '_d' suffix was originally meant to distinguish barebox struct
names from Linux struct names. struct driver doesn't exist in Linux,
so we can rename it and remove the meaningless suffix.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
Link: https://lore.barebox.org/20221214123512.189688-4-s.hauer@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The '_d' suffix was originally introduced in case we want to import
Linux struct device as a separate struct into barebox. Over time it
became clear that this won't happen, instead barebox struct device_d
is basically the same as Linux struct device. Rename the struct name
accordingly to make porting Linux code easier.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
Link: https://lore.barebox.org/20221214123512.189688-3-s.hauer@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Linux struct device has the member of_node for the device_node pointer.
Rename this in barebox accordingly to minimize the necessary changes
when porting Linux code. This was done with the semantic patch:
@@ struct device_d E; @@
- E.device_node
+ E.of_node
@@ struct device_d *E; @@
- E->device_node
+ E->of_node
Plus some manual adjustments.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
Link: https://lore.barebox.org/20221214123512.189688-2-s.hauer@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The current wait time of 1 ms is apparently too short in some
circumstances leading to following error when communicating
with a KSZ switch with 100 kHz from an i.MX8MN I2C controller:
ERROR: ksz9477-i2c ksz85630: error detecting KSZ9477: I/O error
Increasing the poll time to 5ms resolved this issue:
ksz9477-i2c ksz85630: Found KSZ9893
ksz9477-i2c ksz85630: chip id: 0x00989360
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20230110085237.3440824-1-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
| |
bcm283x_i2c_init is called before the i2c adapter device is allocated
and thus these message are prefixed with "<NULL>:". Use the hardware
device instead to fix this.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20221201133846.639078-1-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
This new helper is the i2c equivalent of the existing
of_device_enable_and_register_by_alias(). That function isn't applicable
to i2c devices as it would create a platform device, but we need the
controller to create an i2c device instead.
This function was implemented for board code that uses an I2C EEPROM to
determine whether a specific I2C device is available on the same bus.
As reading the EEPROM requires the i2c controller be probed, there was
no way to reprobe the i2c controller children to create a device for the
previously disabled node. With of_i2c_register_devices_by_node(), this
is now possible and this helper makes it easier to use from board code.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20220905103613.1750340-2-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
| |
i2c controllers probe the devices on their bus themselves, so in the
case the i2c controller was already probed, we currently have no way to
have it reread the device tree after fixing it up or applying an
overlay. Add a new helper that retriggers the device creation.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20220905103613.1750340-1-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
Fixes an issue where the driver in case of NACK error would not properly
terminate the tranfer, resulting in BSC not sending the STOP condition
until just before the next xfer.
Signed-off-by: Daniel Brát <danek.brat@gmail.com>
Link: https://lore.barebox.org/20220720103313.7837-1-danek.brat@gmail.com
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|/
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The prebootloader is inherently board-specific, so it's natural to
hardcode the i2c driver used and we only support fsl_i2c at the moment
anyway. For abstractions used by different prebootloaders though
(e.g. PMIC writing, SPD EEPROM decoding), it would be good for generic
code to use a pbl_i2c abstraction, so it can be reused across PBLs using
different I2C controllers. Add such an abstraction and use it where
appropriate.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Reviewed-by: Marco Felsch <m.felsch@pengutronix.de>
Link: https://lore.barebox.org/20220805125413.1046239-8-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
| |
Add a driver to support the i2c host controller (BSC)
found in Broadcom's bcm283x family of SoCs (used by rpi boards).
Signed-off-by: Daniel Brát <danek.brat@gmail.com>
Link: https://lore.barebox.org/20220615203909.27363-1-danek.brat@gmail.com
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
| |
barebox (and kernel) API is for i2c_adapter::master_xfer to return the
number of successfully transmitted messages and a negative value on
error. This was not observed in the Rockchip driver, fix this.
Reported-by: Matthias Fend <matthias.fend@emfend.at>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20220510153657.2033190-1-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
| |
Add a driver to support the Cadence I2C host controller found in Zynq
UltraScale+ MPSoCs.
Signed-off-by: Matthias Fend <matthias.fend@emfend.at>
Link: https://lore.barebox.org/20220510130414.344586-1-matthias.fend@emfend.at
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
|
| |
Most peripheral driver are usable for both STM32 MPUs and MCUs, but so
far we they were only used for STM32MP1. In preparation for adding
MCU support, introduce a new ARCH_STM32 selected by ARCH_STM32MP and
migrate common drivers to it.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20220131075725.1873026-12-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
| |
For addressing the PMIC on Rockchip platforms, add an i2c controller
driver. Tested with rk3399 and rk808.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20220114085425.315113-1-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|
|
|
|
|
|
|
|
|
| |
"GPL-2.0-only" was introduced in SPDX 2.0, and the old identifier
"GPL-2.0" is now considered deprecated; see <https://spdx.org/licenses>.
Fixes: 28f4a6a4df76f0f1581d (2021-10-30, "drivers: add missing SPDX-License-Identifier")
Signed-off-by: Roland Hieber <rhi@pengutronix.de>
Link: https://lore.barebox.org/20211117113851.2022669-2-rhi@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ |
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| | |
This adds the suitable SPDX-License-Identifier to all files in drivers/
that previously lacked one.
To aid manual inspection, following heuristics can be used:
* No changes outside of comments/whitespace:
git show -U0 HEAD | rg -v '^(@@|diff|index)|[-+]([-+]|//|#|[\s/]\*)'
* -or-later come in pairs:
git show --inter-hunk-context=19 HEAD | \
perl -0777 -F'/^@/gm' -ne 'for (@F) { @m = /later/g; print if @m & 1 }'
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20211030175632.2276077-4-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |
| |
| |
| |
| |
| |
| |
| | |
Replace the boilerplate with a short equivalent identifier.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20211030175632.2276077-3-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ \ |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Driver core will already print an error with the probe's return code,
so no need to print a less useful message before that.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20211030175812.2276705-10-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|