Commit Graph

30 Commits

Author SHA1 Message Date
Chris Friedt f4e07d15d6 sys: util: define bits per byte, nibble, and nibbles per byte
Collect some common bit-widths redefined in various locations
and put them under sys/util.h .

Signed-off-by: Chris Friedt <cfriedt@tenstorrent.com>
2024-10-15 19:05:06 +01:00
Benedikt Schmidt f54a97c117 drivers: fpga: configure CDONE for ICE40 as input
Configure the GPIO CDONE of the ICE40 as GPIO_INPUT.
Fixes #78934.

Signed-off-by: Benedikt Schmidt <benedikt.schmidt@embedded-solutions.at>
2024-09-28 08:18:49 -05:00
Pisit Sawangvonganan a9800e2ea7 style: drivers: adjust `return` usage in `void functions`
For code clarity, this commit adjusts the use of `return` statements
in functions with a void return type as follows:
- Transform `return foo();` into separate statements:
  `foo();`
  `return;`
- Remove unnecessary `return` statements when
  they don't affect control flow.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-09-18 09:56:16 +02:00
Elias Speinle c4dba39548 drivers: fpga: add driver for renesas slg471X5
add driver for renesas slg471X5

Signed-off-by: Elias Speinle <e.speinle@vogl-electronic.com>
2024-08-26 17:06:14 +02:00
Pisit Sawangvonganan 1bcae0ea9f style: drivers: comply with MISRA C:2012 Rule 15.6
Add missing braces to comply with MISRA C:2012 Rule 15.6 and
also following Zephyr's style guideline.

Signed-off-by: Pisit Sawangvonganan <pisit@ndrsolution.com>
2024-08-20 10:33:51 +02:00
Yong Cong Sin bbe5e1e6eb build: namespace the generated headers with `zephyr/`
Namespaced the generated headers with `zephyr` to prevent
potential conflict with other headers.

Introduce a temporary Kconfig `LEGACY_GENERATED_INCLUDE_PATH`
that is enabled by default. This allows the developers to
continue the use of the old include paths for the time being
until it is deprecated and eventually removed. The Kconfig will
generate a build-time warning message, similar to the
`CONFIG_TIMER_RANDOM_GENERATOR`.

Updated the includes path of in-tree sources accordingly.

Most of the changes here are scripted, check the PR for more
info.

Signed-off-by: Yong Cong Sin <ycsin@meta.com>
2024-05-28 22:03:55 +02:00
Hardeep Sharma b521bb655d drivers: fpga: Added altera FPGA bridge support
Added altera FPGA bridge support

Signed-off-by: Hardeep Sharma <hardeep.sharma@intel.com>
2024-04-26 09:30:24 +02:00
Tomasz Gorochowik 38dd10ea1c drivers: fpga: shell: add shell load error handling
Check if the call was successful, print an error otherwise.

Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2024-04-19 10:08:06 +02:00
Harshit Agarwal 785d349de2 drivers: fpga: add Microchip PolarFire SoC FPGA driver
Add FPGA driver support for Microchip PolarFire SoC.

Signed-off-by: Harshit Agarwal <harshit.agarwal@microchip.com>
2024-02-01 04:33:16 -05:00
Jonathan Hamberg 9c1a45cc00 posix: Fix name collision with __bswap
__bswap_ in zephyr/sys/byteorder.h conflicts with __bswap_ in host's
byteswap.h. byteswap.h from host compiler used in posix_native_64 boards
causes a compilation issue.

This commit renames __bswap_ to BSWAP_ to prevent collision.

Before this commit a compilation error can be created by adding #include
<byteswap.h> to samples/net/sockets/echo/src/socket_echo.c

This does not change external API to byteorder.h, but does change
internal implementation which some other source files depend on.

Replaced manual byteswap operations in devmem_service.c with APIs from
byteorder.h which automatically converts to CPU endianess when necessary.

Fixes #44324

Signed-off-by: Jonathan Hamberg <jonathanhamberg@gmail.com>
2024-01-10 18:13:44 +00:00
Gerard Marull-Paretas fe2bca3020 drivers: fpga: move to POST_KERNEL
Devices should be initialized either in pre-Kernel or post-Kernel
stages.

Signed-off-by: Gerard Marull-Paretas <gerard@teslabs.com>
2023-09-15 16:04:19 +02:00
Fabio Baltieri f45e7eddaa drivers: fpga: add an init priority config option
Add a Kconfig option for FPGA device initialization priority.

Signed-off-by: Fabio Baltieri <fabiobaltieri@google.com>
2023-08-24 15:35:37 +02:00
Christopher Friedt 64e6c90fc0 drivers: fpga: ice40: remove unnecessary include
The `<zephyr/posix/time.h>` header was unused in `fpga_ice40.c`
so remove it.

This fixes an error about `pthread_attr_t` not being defined.

Signed-off-by: Christopher Friedt <cfriedt@meta.com>
2023-08-23 10:06:00 +02:00
Anas Nashif bc03455f37 drivers: fpga: imply CRC
This driver needs CRC, so select it instead of relying on it set by
default.

Signed-off-by: Anas Nashif <anas.nashif@intel.com>
2023-08-18 08:52:16 +03:00
Gerard Marull-Paretas 3f2c2d4130 drivers: spi: make SPI dt-spec macros compatible with C++
As of today it is not possible to use SPI dt-spec macros in C++,
something known and documented. The main reason is because `cs` property
is initialized using a compound literal, something not supported in C++.
This PR takes another approach, that is to not make `cs` a pointer but a
struct member. This way, we can perform a regular initialization, at the
cost of using extra memory for unused delay/pin/flags if `cs` is not
used.

Fixes #56572

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-24 21:29:55 +02:00
Gerard Marull-Paretas 0ebe14beb4 sys: util: migrate all files to DIV_ROUND_UP
ceiling_fraction is deprecated, use DIV_ROUND_UP.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2023-04-11 12:00:37 +02:00
Henrik Brix Andersen c41dd36de2 drivers: kconfig: unify menuconfig title strings
Unify the drivers/*/Kconfig menuconfig title strings to the format
"<class> [(acronym)] [bus] drivers".

Including both the full name of the driver class and an acronym makes
menuconfig more user friendly as some of the acronyms are less well-known
than others. It also improves Kconfig search, both via menuconfig and via
the generated Kconfig documentation.

Signed-off-by: Henrik Brix Andersen <hebad@vestas.com>
2023-03-28 15:06:06 +02:00
Armin Brauns a6e5135381 drivers: fpga: ice40: fix busy delay loop
This was being optimized out entirely by certain compiler configurations.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-03-14 11:17:35 +01:00
Armin Brauns d0762e5439 drivers/fpga: ice40: use microsecond resolution for reset time
The 200ns reset time specified in the datasheet are a minimum time; and the
nanoseconds were being rounded to whole microseconds anyway.

Also make it the same type as `config_delay_us` (`uint16_t`).

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-03-14 11:17:35 +01:00
Armin Brauns 2f6dff59c5 drivers/fpga: ice40: use k_usleep instead of busy loop in SPI mode
The 200ns reset time are a minimum value, there is no need to enforce
precise timing (and thus manual per-device calibration) here.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-03-14 11:17:35 +01:00
Armin Brauns 8aec9dd552 drivers/fpga: ice40: fix minimum config delay
From FPGA-TN-02001-3.3 "iCE40 Programming and Configuration":

> After driving CRESET_B High or allowing it to float High, the AP must
> wait a minimum of 1200 µs, allowing the iCE40 FPGA to clear its internal
> configuration memory.

Signed-off-by: Armin Brauns <armin.brauns@embedded-solutions.at>
2023-03-14 11:17:35 +01:00
Chris Friedt 22fe674a9c drivers: fpga: ice40: add support for the Lattice iCE40 series
Add support for the Lattice iCE40 series FPGAs.

Fixes zephyrproject-rtos#48317

Signed-off-by: Chris Friedt <cfriedt@meta.com>
2022-11-17 09:17:44 -05:00
Michal Sieron 702caf1c7e samples: boards: Add Qomu board sample
First pads are being configured for use by the FPGA.
Then CPU loads usbserial bitstream.
Finally it reenables clocks, sets up USB PID and waits for device to
enumerate.

Also disable software resets in used clocks.

Signed-off-by: Michal Sieron <msieron@antmicro.com>
2022-10-20 15:41:09 +02:00
Gerard Marull-Paretas fb60aab245 drivers: migrate includes to <zephyr/...>
In order to bring consistency in-tree, migrate all drivers to the new
prefix <zephyr/...>. Note that the conversion has been scripted, refer
to #45388 for more details.

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-05-06 19:58:21 +02:00
Mateusz Sierszulski 06e4f36b4b fpga controller: drivers: add ZynqMP driver
This commit adds support for fpga driver on ZynqMP SoC.

Signed-off-by: Mateusz Sierszulski <msierszulski@antmicro.com>
2022-04-21 13:00:57 +02:00
Mateusz Sierszulski 6d56b82942 drivers: fpga: connect dts node with fpga driver
This commit connects the eos_s3 fpga driver with fpga dts node.

Signed-off-by: Mateusz Sierszulski <msierszulski@antmicro.com>
2022-04-08 15:54:33 -07:00
Gerard Marull-Paretas 95fb0ded6b kconfig: remove Enable from boolean prompts
According to Kconfig guidelines, boolean prompts must not start with
"Enable...". The following command has been used to automate the changes
in this patch:

sed -i "s/bool \"[Ee]nables\? \(\w\)/bool \"\U\1/g" **/Kconfig*

Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
2022-03-09 15:35:54 +01:00
Mateusz Sierszulski c09dfb3bf6 drivers: fpga controller: add shell support
This adds shell support for FPGA drivers.

Signed-off-by: Mateusz Sierszulski <msierszulski@internships.antmicro.com>
Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2021-09-03 09:54:00 -04:00
Mateusz Sierszulski a64ce1fc6b drivers: fpga controller: add eos_s3 fpga driver
This adds driver for EOS_S3 SoC FPGA.

Signed-off-by: Mateusz Sierszulski <msierszulski@internships.antmicro.com>
Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2021-09-03 09:54:00 -04:00
Mateusz Sierszulski 2c718b2726 drivers: fpga controller: add fpga api
This adds new FPGA controller which allow to control FPGA chips.

FPGA controller has been created to enable bitstream loading
into the reprogrammable logic. It adds completely new API,
which enables to check status of the FPGA chip, power it on
or off and reset it.

Signed-off-by: Mateusz Sierszulski <msierszulski@internships.antmicro.com>
Signed-off-by: Tomasz Gorochowik <tgorochowik@antmicro.com>
2021-09-03 09:54:00 -04:00