| Commit message (Collapse) | Author | Age | Files | Lines |
... | |
|\ \ |
|
| | |
| | |
| | |
| | |
| | |
| | | |
Needed for the remoteproc driver on this SoC.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
This adds support for the different i.MX8M SoCs to the i.MX rproc
driver. i.MX8MM and i.MX8MQ can be handled like the i.MX7D with a
different address space map. i.MX8MN and i.MX8MP are different though.
Unlike the other SoCs which have a Cortex-M4 Coprocessor these have
a Cortex-M7 Coprocessor. On these SoCs the TCM is only accessible when
the Coprocessor is already started. A bit in the IOMUX GPR register
space is needed to hold the CPU in wait mode until we uploaded the code
to the TCM.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Replace the register offset/masks/values in driver data with function
hooks to prepare the driver for adding SoCs that do not fit into this
one-register-write scheme.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Sort the SoC specific functions alphabetically to have a more natural
order before adding more SoCs to the driver.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |/
| |
| |
| |
| |
| |
| | |
size is actually end - start + 1, fix size passed to
request_sdram_region().
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ \ |
|
| |\ \ |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
SoCs like the i.MX6 have their BootROM consult two distinct 32-bit
registers to determine the reboot mode. Extend the driver to support
this. While backwards compatible, this is not so far supported by the
upstream binding, which is why a new barebox,syscon-reboot-mode is
introduced. This new compatible be inhibit used to inhibit fixup
into a kernel device tree.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The upstream binding and driver implementation only supports
reboot modes of 32-bit length. This is insufficient for cases where
multiple registers need to be written for the reboot mode to become
active. The i.MX6 is an example for this, the BootROM expects a second
32-bit register to indicate whether the reboot mode in the first is
valid. In preparation for adding support for this to the
syscon-reboot-mode driver. Migrate the reboot-mode core to support this.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Instead of relying that the kernel and barebox device trees are in sync,
just enforce it by having barebox fix up the device tree node it probed
into the kernel device tree. We usually want that, but some reboot mode
drivers might want to inhibit the fixup, e.g. because they implement
a non-upstream binding or because they communicate with the BootROM,
while the kernel shouldn't. For those the fixup is made optional via
a struct reboot_mode_driver::no_fixup member.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Reboot modes are one-shot information that should be valid for only a
single reset. Syscons that survive a warm reset are one way to implement
this. This is used by many BootROMs to allow falling into a recovery
mode on the next boot. This ports the Linux syscon-reboot-mode support.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Reboot modes provide a well-defined way to exchange information between
different stage of the boot process. When configured, users can type
`reboot bootloader` in the OS and barebox can read it out a device
parameter. Likewise barebox can write a reboot mode for the BootROM to
evaluate and then reset to fall into a serial recovery mode for example.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ \ \ \ |
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Using %pe instead of PTR_ERR has the benefit of being less verbose and
less error-prone (no negation necessary) while potentially reducing
code size. Make use of it.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |/ / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
strerrorp() is only used along with printf. We now have a format
specifier for printing error pointers directly, so use that and
remove strerrorp.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ \ \ \ |
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
Device gadget must be properly uninitialized on poweroff however host
system might not detect barebox's usb gadget has beeing disconnected.
Signed-off-by: Jules Maselbas <jmaselbas@kalray.eu>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
The current way to set a property with multiple values (e.g. compatible
strings) is to have
char properties[] = "st,stm32mp157c-dk2\0st,stm32mp157";
of_set_property(np, "compatible", properties, sizeof(properties), 1);
Add a new helper to make this easier at the cost of one runtime
reallocation:
of_property_write_strings(np, "compatible,
"st,stm32mp157c-dk2", "st,stm32mp157", NULL);
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
This is a simple driver for the ADC. It's designed to get single
readings. Possible uses would be temperature sensing a thermistor,
measuring a power rail, or a detecting multi-level board ID pin
strapping.
It's not designed to co-exist with a touch screen controller driver,
which uses the same hardware on the AM335x, as there is no barebox
touchscreen driver.
The device tree binding is compatible with the Linux IIO driver.
This is from the Linux driver:
The ADC clock is expected to run at target of 3MHz, and expected to
capture 12-bit data at a rate of 200 KSPS. The TSC_ADC_SS
controller design assumes the OCP clock is at least 6x faster than
the ADC clock.
The OCP clock is 100 MHz, from CORE_CLKOUTM4/2. The AM335x Reference
Manual §12.2.2 gives a max ADC clock of 24 MHz. There's nothing about
the factor of 6x OCP to ADC, a 3 MHz ADC target, nor 200 kSPS. In
§12.3.7 a limit of at least 15 ADC clock cycles per sample is given.
The AM335x Datasheet §5.10 provides more parameters for the ADC: An ADC
clock max of 3 MHz, a nominal conversion time of 13 cycles, min and max
acquisition time of 2 to 257 cycles, and a max sample rate (@ 3 MHz) of
200 kSPS.
A 3 MHz ADC clock at 15 cycles per sample provides for a 200 kSPS
sampling rate. The minimum open, sampling, and conversion times are 0,
1, and 13 clocks, respectively. This would seem to indicate the
sampling at 14 cyles per sample is possible. Perhaps the "Sample Delay"
in the reference manual is called "Acquisition Time" in the datasheet,
and the reference manual minimum of 1 cycle is incorrect and the minimum
is actually 2 cycles. Which would then produce a minimum of 15 cycles
per sample.
This driver assumes the external references will be used (as does the
Linux IIO driver). This would have been good to put into the device
tree bindings, but the Linux driver's bindings did not do that.
The Barebox driver will convert the ADC reading to mV, and assumes the
external refs are GND and 1.8V. This also would have been nice to put
into the device tree binding. It also doesn't allow for automatically
adjusting for an external divider, commonly to measure power rails above
1.8V, e.g. the BeagleBone Black ain7 measures the 3.3V rail divided by
2.
Signed-off-by: Trent Piepho <trent.piepho@synapse.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | |
| | | | | |
When dynamically assigning device names, an aiodev's name will be
"aiodev" and an index, not part of the name string itself, will be
allocated dynamically. These are combined to register a device with a
name like "aiodev0" or "aiodev1".
The shell environment variables use the device name, so one might use
"${aiodev0.in_value0_mV}" and "${aiodev1.in_value0_mV}".
However, the channel names that are used with aiochannel_get_by_name()
just use the aiodev's name and channel name. So channel 0 of the 1st
aiodev would be "aiodev.in_value0_mV" and the 2nd aiodev would use the
same name.
Change the channel naming to use the device instance name, e.g.
"aiodev0", rather than the aiodev's base name. This makes the names
used aiochannel_get_by_name() match the environment variable names and
also avoids duplicate names with more than one dynamically allocated
aiodev.
Rename aiochannel_get_by_name() to aiochannel_by_name() so that any out
of tree boards that use it will fail to compile, since they now need to
pass in a different name.
Signed-off-by: Trent Piepho <trent.piepho@synapse.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |/ / /
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Unadorned 0 is an int, but is printed used %zu. As it's just an interger
literal, just hardcode it into the string.
Signed-off-by: Ahmad Fatoum <ahmad@a3f.at>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ \ \ \
| | |/ /
| |/| | |
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
BAREBOX_MAGICVAR now generates a unique identifier automatically,
so we can convert users of BAREBOX_MAGICVAR_NAMED to the simpler
BAREBOX_MAGICVAR macro.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ \ \ |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Add driver registration macros for phy drivers similar to the existing
platform device macros. This also changes the initcall level from
fs_initcall to device_initcall for the phy drivers. It is not clear
why the phy driver have been at fs_initcall in the first place, changing
it shouldn't be a problem.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Shorten driver registration by using the suitable macro.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| |/ /
| | |
| | |
| | |
| | |
| | |
| | | |
We have several macros for a oneline driver registration. Add some
missing and use them consistently where possible througout the tree.
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ \ \ |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The dev_get_drvdata instances here all store a valid pointer in the
match data and can be readily converted. Do so.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The driver has a couple of issues in how it handles match data:
- First use of dev_get_drvdata is superfluous as result is unused
- Second use of dev_get_drvdata stores a sizeof(const void *)
into an enum typed object
- hdmi->dev_type contains a truncated pointer to a struct
dw_hdmi_data and compares it with an enum, which will always fail
Fix these and while it, refactor the code a bit to get rid of
dw_hdmi_data, whose only other member is unused.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Probing the nand_mxs device driver on 64 bit systems invokes
undefined behavior, because of an errant cast. Fix this.
No change of behavior for 32-bit SoCs intended. On error,
type == 0 == GPMI_MXS as it used to.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Probing the lm75 device driver on 64 bit systems invokes
undefined behavior, because of an errant cast. Fix this.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
i.MX8 MM & MN are both ARM64 SoCs with a device compatible
with "fsl,imx28-dma-apbh". Probing the barebox device driver on these
SoCs would invoke undefined behavior however, because of an
errant cast. Fix this.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
dev->id_entry is not populated for devices probed from the device
tree. It was used unconditionally however. Use device_get_match_data
instead to support device tree probing.
While at it, remove the array and the enum, we can store pointers
to the correct chipdef structs directly.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | |/
| |/|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
We use dev_get_drvdata to get the driver match data associated with a
device. This has two shortcomings:
- Linux has dev_get_drvdata too, which returns a private pointer for
driver specific info to associate with a device. We use dev->priv
(or more often container_of) for that in barebox instead
- It nearly always involves a cast to a double pointer, which is
error-prone as size and alignment match need to be ensured
on the programmer's part and can easily be gotten wrong:
enum dev_type type;
dev_get_drvdata(dev, (const void **)&type); // UB!
Add a new function that instead of using a double pointer argument,
returns the pointer directly:
- For normal pointer driver data, no cast is necessary
- For integer driver data casted to a pointer for storage,
the cast is still necessary, but it's only a single pointer
this way
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ \ \ |
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The stub should have the same function signature as the non-stub
function.
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Drop the local reference for each driver since the regulator_dev can
handle this now. Attention: The pfuze is out of scope since this driver
is not really a regulator driver.
While on it fix a few minor style issues on the bcm2835 driver too.
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
It is useful to know the physical device a regulator_dev belongs to.
This is at least needed for the new deep-probe mechanism. It is also
useful for a few regulator drivers to drop their own device_d reference.
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
The dts regulators subnode can be incomplete e.g. if the pre-programmed
values are valid and shouldn't be changed. Missing regulator nodes are
indicated by "of_regulator_match->of_node == NULL". Take missing
regulators into account and register only existing ones.
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Add simple parameter check to avoid possible NULL pointer dereferences.
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Don't ignore errors from __regulator_register().
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | | |
| | | |
| | | |
| | | |
| | | |
| | | |
| | | | |
Add missing error handling for spi_new_device().
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | |/
| |/|
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The regulator id should be given without the "-supply" suffix else the
core is searching for "vbat-supply-supply".
Fixes: bf8f62d334 ("video/ssd1307fb: add support for VBAT")
Signed-off-by: Marco Felsch <m.felsch@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
|\ \ \
| |_|/
|/| | |
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
rstc is never read before written, so just drop the initializer.
Reported-by: clang-analyzer-10
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Reading the interrupt registers has a side-effect, so their value need
not be used for anythig. Storing it into a variable never read
obfuscates this however. Cast to (void) for clarity.
Reported-by: clang-analyzer-10
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
The primitives asix_mdio_write and asix_mdio_read use return errors, but
are unchecked. Propagate them instead.
Reported-by: clang-analyzer-10
[afa: Untested on real hardware]
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | |
| | | |
Instead of storing the clk into the driver's device-specific private
data, just store the rate and make sure it's != 0 on probe.
This aligns us with what Linux does for the STM32 IWDG and DW WDT.
Reported-by: clang-analyzer-10
Cc: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
|