Commit Graph

190 Commits

Author SHA1 Message Date
Sebastian Huber
4c2da2c343 dev/serial: Simplify some Zynq UART functions
Make the initialization and polled functions independent of the Termios
context.  This helps to implement the kernel I/O support without a dependency
on the Termios framework.
2024-03-27 20:22:53 +01:00
Sebastian Huber
5b0e355ed7 bsps: Move declarations to <bsp/irq-generic.h>
Move declarations of bsp_interrupt_get_affinity() and
bsp_interrupt_set_affinity() to <bsp/irq-generic.h>.  Canonicalize the
<bsp/irq.h> includes.

Implement bsp_interrupt_get_affinity() and bsp_interrupt_set_affinity() only if
needed (usually RTEMS_SMP).

Provide stub implementations for i386 to fix build errors.
2024-03-27 20:20:38 +01:00
Sebastian Huber
1eed6f8bfc bsps: Avoid unused argument in clock interrupt
Pass the parameter of the clock interrupt handler to
Clock_driver_support_at_tick() and Clock_driver_timecounter_tick().  This makes
it possible to use the interrupt handler argument in clock drivers.

Use the interrupt handler provided by Clock_driver_support_install_isr() to
avoid local delarations of Clock_isr().

Update #4862.
2024-03-20 16:34:09 +01:00
Sebastian Huber
2f5a747dcc dev/irq: Optional arm_gic_irq_processor_count()
Provide arm_gic_irq_processor_count() only in SMP configurations.
2024-03-20 07:40:41 +01:00
Stanislav Pankevich
ef9a74fc1a arm/xilinx-zynqmp-rpu: Fix clock driver
We observed a strange behavior of the 1Hz timer when running cFS on Zynq
RPU. After some investigation, we reduced the error to the truncation
issue. This patch fixes the issue.
2024-03-19 13:25:16 +01:00
Kinsey Moore
fd790b3431 bsps/shared/xqspipsu: Read correct status bits
When resetting the QSPI FIFOs, the driver was reading write-only bits of
a register for status information when it was actually in a different
register. This corrects the driver so that it reads the correct status
bits.
2024-03-11 12:09:59 -05:00
Kinsey Moore
33379dcfc4 bsps/shared/xnandpsu: Add opportunistic page cache
Add an opportunistic page cache to the xnandpsu driver since it does not
implement partial page reads and common filesystem access patterns
perform multiple reads from the same page. This has been seen to provide
a 10x speedup to read speeds and a 2x speedup on first initialization
when used with JFFS2.
2024-03-11 12:09:59 -05:00
Sebastian Huber
85b55a7624 bsps/clock: Fix fast idle for SMP 2024-03-11 14:40:06 +01:00
Kinsey Moore
75d7af409f bsps/xnandpsu: Allow creation of BBT
This fixes a logic inversion that was preventing creation of a Bad Block
Table (BBT) from scratch on devices that lack one. This was discovered
during upstream integration testing. The BBT management layer in this
driver is not designed to be easily testable other than on real hardware.
2024-02-28 11:20:36 -06:00
Kinsey Moore
8f8f043234 bsps/qspipsu: Calculate correct parallel mode size
Stacked mode doubles the number of sectors and device size while
parallel mode doubles the sector size and the device size. Make sure
that this is accounted for in the device size accessor.
2024-02-19 09:26:04 -06:00
Kinsey Moore
150dcf5e47 libio: Clean up usage of rtems_termios_device_mode
This cleans up outputUsesInterrupts usage with rtems_termios_device_mode
enum values. The outputUsesInterrupts member was typed as an int, named
as if it were a boolean value, and used as if it were a
rtems_termios_device_mode enum. In this patch, values assigned to
outputUsesInterrupts have been converted to the corresponding
rtems_termios_device_mode enum value, conversions from
deviceOutputUsesInterrupts have been made explicit, and uses of
rtems_termios_device_mode enum values with deviceOutputUsesInterrupts
have been converted to booleans.
2024-01-10 14:43:53 -06:00
Kinsey Moore
3798c5735d bsps/xnandpsu: Allow manipulation of BBT
Expose functions to directly manipulate the bad block table (BBT). These
functions are necessary to correct possible BBT corruption caused by
bugs in the BBT management layer.
2023-12-14 13:40:03 -06:00
Kinsey Moore
437053282d bsps/xnandpsu: Constrain block erasure to device
The XNandPsu_EraseBlock function takes a target device and a block
offset for erasure. Ensure the block offset is within the size of the
target device.
2023-12-14 13:40:03 -06:00
Kinsey Moore
d77a873ddb bsps/xnandpsu: Mark correct reserved blocks
When marking the trailing blocks on a device as reserved for Bad Block
Table usage, ensure that the correct blocks are marked. This resolves an
off-by-one error that was marking one block too low and leaving the last
block in the device unmarked.
2023-12-14 13:40:03 -06:00
Kinsey Moore
f823dba027 bsps/xnandpsu: Write BBT to correct location
When writing out the Bad Block Table, write it to the targeted device
and ensure the block is appropriately mapped to the targeted device.
2023-12-14 13:40:03 -06:00
Kinsey Moore
757fbd6bc7 bsps/xnandpsu: Detect missing BBTs
Mark the BBT descriptor as invalid before scanning to ensure that
missing BBTs are detected and written correctly if necessary.
2023-12-14 13:40:03 -06:00
Kinsey Moore
d6b75cc248 bsps/xnandpsu: Read correct BBT size
The Bad Block Table is a per-device catalog of the dispositions of each
block in the device. Only read enough data to determine the dispositions
of blocks for the device being read.
2023-12-14 13:40:03 -06:00
Kinsey Moore
7946cff0bc bsps/xnandpsu: Fix BBT mapping functions
The xnandpsu driver includes functionality to map back and forth between
the flash-based BBT and the memory-based BBT with the values in each
being a bitwise inversion of each other. This resolves several bugs in
this process and simplifies the inversion from operating on the block
representation to operating on the entire BBT entry (4 blocks, 2 bits
per block, one byte total).

Bugs resolved in XNandPsu_ConvertBbt():
* The calculation of memory BBT entry offset was off by a factor of 4
* The entry offset into the flash BBT has been removed since each flash
  BBT directly describes the flash space it is contained within and has
  no reference to other devices in the chip

Bugs resolved in XNandPsu_WriteBbt():
* The BBT length calculated was reduced to NumTargetBlocks from
  NumBlocks since only the relevant portion of the in-memory BBT should
  be written to the flash-based BBT space
* An offset was applied to values retrieved from the in-memory BBT so
  that only the relevant portion was converted and written to the
  flash-based BBT
2023-12-14 13:40:03 -06:00
Philip Kirkpatrick
793c0f4671 bsps/arm: Add BSP for ZynqMP RPU 2023-11-20 10:43:55 -06:00
Kinsey Moore
bb6ed3bed7 bsps/xnandpsu: Always wrap page to device size
The xnandpsu driver conditionally tries to wrap page index to NAND chip
size causing an off-by-one error where the first page of the second chip
is not wrapped correctly. This removes the conditional so that page
index is always wrapped.
2023-10-27 11:33:44 -05:00
Kinsey Moore
3363fabb9d bsps/xnandpsu: Avoid loop counter reset
On configurations where multiple NAND chips are in use, the erasure
loop in XNandPsu_Erase() can reset the loop counter variable once it
gets to blocks in the second chip causing an infinite loop overwriting
parts of the first chip. This change ensures that the loop counter is
not accidentally reset.
2023-10-27 11:33:44 -05:00
Kinsey Moore
5b22003411 bsps: Remove unused includes 2023-10-13 19:02:15 -05:00
Kinsey Moore
41d43cef6c bsps/xnandpsu: Ensure buffer cache sync
When a buffer is modified by both hardware components such as DMA and by
software components, the buffer cache state must be kept in sync so that
data is not accidentally thrown away during future invalidations.
2023-09-26 09:02:48 -05:00
Kinsey Moore
2b5526aa5e bsps/xnandpsu: Don't rely on usleep for polling
When polling hardware registers in high performance situations, don't
rely on usleep or other standard sleep functions since they will
necessarily rely on kernel ticks to be woken up. This can easily cause
an immense reduction in throughput.
2023-09-26 09:02:48 -05:00
Kinsey Moore
3f3c646dea bsps/xqspipsu: Add SFDP config space read ability
This adds a function to allow reading of the SFDP configuration space
that describes attributes of NOR flash chips.
2023-09-23 09:42:30 -05:00
Kinsey Moore
853429c3f8 bsps/xqspipsu: Break out RDID
Expose a function to read the NOR flash chip ID information beyond the
minimum 3 bytes for the lookup table.
2023-09-23 09:42:30 -05:00
Kinsey Moore
8cea348934 bsps/xnandpsu: Ensure correct cache maintenance
The changes here ensure correct cache maintenance around DMA operations.
One cache flush was missing and two cache invalidations occurred before
the corresponding read that would make them necessary.
2023-09-06 08:53:02 -05:00
Christian Mauderer
5115e6524f bsps/shared: Fix Coverity warning in MCP7940M
Fixes the following Coverity warning:

** CID 1539495:  Integer handling issues  (CONSTANT_EXPRESSION_RESULT)
/bsps/shared/dev/rtc/mcp7940m.c: 317 in mcp7940m_set_time()

Basically coverity warns that (buf[...] & 0x7) can't be bigger than 7.
Just remove the unnecessary comparison.
2023-08-03 07:18:37 +02:00
Christian Mauderer
38dd86355d bsps/shared: Add MCP7940M RTC driver
The MCP7940M is a I2C RTC chip. The new driver uses the dev/i2c API to
support the RTC. It is written with the intention, that the driver can
be adapted to other RTCs with a similar register layout by just
replacing the initialization function.
2023-08-01 09:24:33 +02:00
Kinsey Moore
333fd02631 bsps/xqspipsu: Handle SMP systems properly
The NOR driver was not written with SMP systems and caching in mind.
This makes the IsBusy flag volatile for updates across cores and
introduces cache flushing and invalidation where necessary for data
manipulated by the DMA engine in the QSPI peripheral.
2023-06-22 10:46:33 -05:00
Kinsey Moore
09fd5dd353 bsps/xqspipsu: Use device information from the FCT
Instead of statically defining the device parameters, use the device
information available via the NOR device layer's Flash Configuration
Table.
2023-06-08 09:48:44 -05:00
Kinsey Moore
7a14c3df8b bsps/xqspipsu: Calculate erase sectors correctly
When given the exact bounds of a sector, the current algorithm
calculates that 3 sectors need to be erased. This corrects the
calculation such that only 1 sector needs to be erased for erasures that
exactly match sector boundaries.
2023-06-08 09:48:44 -05:00
Kinsey Moore
a67aab6cd4 bsps/xqspipsu: Ensure NOR writes align
This change causes NOR writes to be broken according to page boundaries.
Writes across page boundaries cause the writes beyond the boundary to
fail silently. This also introduces a new function that will explicitly
write pages.
2023-06-08 09:48:44 -05:00
Sebastian Huber
0c3d6f58f1 termios: Add <rtems/termiosdevice.h>
Add <rtems/termiosdevice.h> which does not depend on <rtems/libio.h> to
provide rtems_termios_device_context and rtems_termios_device_handler.
For polled serial device drivers, this removes a header file dependency
to the full file system support.
2023-05-31 10:07:17 +02:00
Sebastian Huber
49720a90d8 arm/xilinx-zynq: Improve Doxygen file comments 2023-05-26 06:56:11 +02:00
Sebastian Huber
f69326d0c2 bsps: Improve Doxygen file comments 2023-05-26 06:56:11 +02:00
Christian Mauderer
bb2e2d0c30 bsps/shared: Fix header for fsl-edma
If a different chip variant is used in the i.mxrt BSP, a different
header would have to be included. Make sure that the fsl-edma driver
uses a header that doesn't have to be adapted.
2023-05-22 09:45:42 +02:00
Sebastian Huber
bcef89f236 Update company name
The embedded brains GmbH & Co. KG is the legal successor of embedded
brains GmbH.
2023-05-20 11:05:26 +02:00
Kinsey Moore
7163014e3f bsps/xqspipsu: Add support for reading ECC
This adds a helper function to read the ECC status for an ECC unit in
SPI-attached NOR memory.
2023-03-22 13:30:08 -05:00
Kinsey Moore
ada805ea2e bsps/nand: Update Xilinx NAND driver
This resovles gcc warnings by updating to the latest Xilinx NAND
controller driver.
2023-01-30 10:44:24 -06:00
Alex White
d55c131965 bsps: Add Xilinx GQSPI flash helper
This adds helper functions for working with NOR flash connected to the
Xilinx GQSPI controller. The helper functions are based on Xilinx's
QSPIPSU flash interrupt example.
2023-01-27 14:49:28 -06:00
Alex White
fd2f9d40b5 bsps: Import Xilinx GQSPI driver
This adds Xilinx's driver for the Xilinx GQSPI controller embedded in
the ZynqMP SoC. Within that device alone, it is possible to access this
peripheral from MicroBlaze, ARMv7, and ARMv8 cores. The imported files
are and should be able to remain unmodified. Import information is kept
in bsps/shared/dev/spi/VERSION.
2023-01-27 14:49:27 -06:00
Sebastian Huber
6136e28bf9 clockdrv: Add clock driver implementation group
Use standard wording in Clock Driver related files.

Update #3706.
2023-01-24 09:56:53 +01:00
Kinsey Moore
f65bbb4059 bsps: Move ZynqMP-specific info into the BSP
The address of the nandpsu peripheral is specific to the ZynqMP SoC and
not relevant to other devices that might have one or more instances of
this peripheral.
2023-01-04 13:11:29 -06:00
Kinsey Moore
30ca711d19 bsps: Import Xilinx NAND driver
This adds Xilinx's driver for the Xilinx NAND controller embedded in the
ZynqMP SoC. Within that device alone, it is possible to access this
peripheral from MicroBlaze, ARMv7, and ARMv8 cores. This has been added
to the hardware ZynqMP BSPs since QEMU does not support emulation of
this peripheral. This driver supports polled operation only. The
imported files are and should be able to remain unmodified. Import
information is kept in bsps/shared/dev/nand/VERSION.
2022-12-23 13:06:42 -06:00
Joel Sherrill
d6ebf4067e bsps/shared/*: Change license to BSD-2
Updates #3053.
2022-06-15 12:35:18 -05:00
Sebastian Huber
0725b200e7 bsps: Add gicv3_get_attributes() 2022-04-06 09:48:52 +02:00
Sebastian Huber
d8b23fa488 bsps: Add gicv3_sgi_ppi_get_priority() 2022-04-06 09:48:52 +02:00
Sebastian Huber
f828ddd1a9 bsps: Add gicv3_sgi_ppi_set_priority() 2022-04-06 09:48:52 +02:00
Sebastian Huber
3026859d41 bsps: Move gicv3_init_cpu_interface()
Make the processor index a parameter.
2022-04-06 09:48:52 +02:00