-
Notifications
You must be signed in to change notification settings - Fork 7.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
drivers: crc: Add hardware-based CRC driver #74977
Conversation
Hello @zkat2, and thank you very much for your first pull request to the Zephyr project! |
@mathieuchopstm Would you mind having a look ? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is going in the right direction IMO, there are some compliance issues that need attention.
drivers/crc/crc_stm32.c
Outdated
#include <zephyr/logging/log.h> | ||
#include <errno.h> | ||
#include <soc.h> | ||
#include <zephyr/device.h> | ||
#include <zephyr/drivers/clock_control/stm32_clock_control.h> | ||
#include <zephyr/init.h> | ||
#include <zephyr/drivers/crc.h> | ||
#include "stm32_ll_crc.h" | ||
|
||
LOG_MODULE_REGISTER(crc_stm32); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You need to pass the logging level from Kconfig.
Try to group includes and have some order like system
> zephyr
> SoC
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(crc_stm32, CONFIG_CRC_HW_LOG_LEVEL);
#include <errno.h>
#include <zephyr/device.h>
#include <zephyr/drivers/clock_control/stm32_clock_control.h>
#include <zephyr/drivers/crc.h>
#include <soc.h>
#include <stm32_ll_crc.h>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks promising, thanks.
Some additional requests as you're introducing a brand new API:
- API doc, see doc/hardware/peripherals/dac.rst as a minimum doc page
- Add yourself as maintainer in MAINTAINERS.yaml
- Last (maybe the most important): please provide a sample or a test (both would be ideal ;)) in order:
- to demonstrate how to use the API and how to configure a device
- ensure the API and related drivers are compiled systematically in CI
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few more comments but we're getting there, thanks for the work so far.
Also, as you're introducing a new API, I've added flag "Architecture review", so it could be introduced to Architecture working group on next session (Tuesday 5PM CET, see https://github.com/zephyrproject-rtos/zephyr/wiki/Architecture-Working-Group). It would be nice that you're able to join, but it is not blocking if you can't .
3423893
to
53243de
Compare
Any plans to make this driver subsystem provide backends for https://github.com/zephyrproject-rtos/zephyr/blob/main/include/zephyr/sys/crc.h ? |
f16c5fb
to
8864920
Compare
Adds support for hardware-based CRC-8-CCITT and CRC-32-IEEE calculations. Signed-off-by: Zoe Kaute <zoe.kaute@brillpower.com>
Introduces a new sample that demonstrates how to use the hardware-based CRC API. Signed-off-by: Zoe Kaute <zoe.kaute@brillpower.com>
Add a test suite to validate the hardware-based CRC API. Signed-off-by: Zoe Kaute <zoe.kaute@brillpower.com>
Add the CRC node to stm32g4 device tree source file. Signed-off-by: Zoe Kaute <zoe.kaute@brillpower.com>
Architecture WG:
|
@carlescufi Are you able to elaborate what these two options would entail? Are you suggesting an API rework or grouping the hardware and software implementations in a subsystem? Any additional details or examples would be appreciated. |
As far as I can tell you there is no CRC.
|
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
@zkat2 Hey! Sorry to see this work abandoned. Do you have any plans - and bandwidth - for resuming work on this? I'd love to collaborate on it, if needed. |
Hello @henrikbrixandersen . We are preparing for a CRC hardware-based device driver (which similar to implementation in this PR) and we also introduce a CRC subsystem (implementation is quite similar to random system) includes a software backend (using sys/crc.h) and a CRC hardware backend (using CRC device driver). It will be sent out at the end of this week. |
Hello. I have sent out a PR to add a CRC device driver implementation for Renesas RA device that referred to this PR here #87557. I'm also implement a new CRC subsystem using software/hardware backend implementation. |
Adds hardware support for CRC-8-CCITT and CRC-32-IEEE calculations and introduces a devicetree binding for STM32 CRC.