Skip to content
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

Introduce Bouffalo Lab SoC's #78795

Open
wants to merge 21 commits into
base: main
Choose a base branch
from

Conversation

nandojve
Copy link
Member

@nandojve nandojve commented Sep 21, 2024

This PR is intent to continue the work started at #37686. It rewrite the original work to be compatible with Zephyr 3.7. It extends the original work to complete remove the Bouffalo Lab SDK. This means that a re-write was made to use direct register access. This proves to drop ~8k Flash content.

  • Introduces Bouffalo Lab BL-60x SoC.
  • Add following drivers:
    • Pinctrl
    • Serial
    • GPIO
  • Add following boards:
  • bl604e_iot_dvk (from Bouffalo Lab) - can only be obtained directly with Bouffalo Lab
  • dt_bl10_devkit (from DOIT) - easy to find and start will come in a future PR as requested
  • Add bflb_mcu_tool runner to easy flash

This work is Co-Authored by Camille BAUD mail@massdriver.space

In the first wave we will introduce BL 60x/70x series, with uses E24 SiFive's core. On a second moment we will add the newer XuanTie-902/6/7 (LP/M/D) from T-Head BL61x/80x.

@zephyrbot
Copy link
Collaborator

The following west manifest projects have been modified in this Pull Request:

Name Old Revision New Revision Diff
hal_bouffalolab N/A nandojve/hal_bouffalolab@main N/A

Note: This message is automatically posted and updated by the Manifest GitHub Action.

@zephyrbot zephyrbot added manifest manifest-hal_bouffalolab DNM This PR should not be merged (Do Not Merge) labels Sep 21, 2024
@nandojve nandojve force-pushed the bflb/bflb_upstream branch 3 times, most recently from 36aa581 to 7b2500b Compare September 21, 2024 16:16
@nandojve nandojve added this to the v4.0.0 milestone Sep 21, 2024
@nandojve nandojve force-pushed the bflb/bflb_upstream branch 3 times, most recently from f026bea to 3ee0c70 Compare September 23, 2024 12:12
@nandojve nandojve marked this pull request as ready for review September 23, 2024 19:02
@zephyrbot zephyrbot added area: GPIO area: Pinctrl area: Interrupt Controller area: Timer Timer area: West West utility platform: nRF Nordic nRFx area: Process area: RISCV RISCV Architecture (32-bit & 64-bit) area: UART Universal Asynchronous Receiver-Transmitter labels Sep 23, 2024
@ycsin
Copy link
Member

ycsin commented Nov 5, 2024

This work was made by 2 persons. My first try was on Ago/2021 when I used the Bouffalo Lab SDK 1.4.x, see #37686. I kept the code working over time locally and last year Camille started to extend the implementation. At first, the idea was to use the newer Bouffalo Lab SDK 2.0 but we saw that it will be a waist of time. Then we decided to use only registers and the code was partially rewritten by him from 82e3a9f forward. Because of this, the PR was submitted in a way that we can keep clear what each one made. This is the why the PR have intermediary stages.

A commit can have multiple sign-offs / authors, I don't see why we can't squash them and need to upstream local history, you can add a reference to a local branch with the history in the upstream commit message if you like.

About the below suggested order.

  1. devicetree bindings
  2. introduction of soc
  3. introduction of board
  4. drivers

IMHO this order does not fit. Usually it is necessary to introduce first the code that will be used by the module/board. This means that to have a serial device working you may need pinctrl and serial at minimum. On the same way, to flash a board you need to have the flasher available. I'm mentioning this because someone could then argue that we should start introducing an empty board and then fill all the details on each commit, which makes no sense because can create problems with git bisect. At end, the sequence must not be broke from a bisect perspective because you must not enable something that is not yet available in the tree.

I'm sorry that the sample order doesn't fit, I guess it is bisectable if you introduce the drivers first, followed by board, I believe I was referring to #56370 at the time of comment, but typed something wrong

@ycsin ycsin dismissed their stale review November 5, 2024 05:53

not convinced, but don't want to block

Enable the suport to sifive,clic machine timer.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
Add initial version that uses bouffalo_sdk 1.4.2.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
Add necessary bflb prefix to be used on devicetree bindings and identify
the board vendor.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
Introduce Bouffalo Lab vendor with BL602 cpu.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
Add initial version.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
Switch to use the riscv-privileged mode.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
Add Bouffalo Lab pinctrl driver.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
Add Bouffalo Lab serial driver. The driver uses pinctrl to configure
pins and have power management capabilities.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
Enable interrupt support in the driver.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
Add Bouffalo Lab ISP console flash runner.  This tool enable bootloader
to flash devices using serial port.

The blflash Rust tool can be found at
  https://github.com/spacemeowx2/blflash

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
@nandojve
Copy link
Member Author

Rebased on top of RC-3.

This work was made by 2 persons. My first try was on Ago/2021 when I used the Bouffalo Lab SDK 1.4.x, see #37686. I kept the code working over time locally and last year Camille started to extend the implementation. At first, the idea was to use the newer Bouffalo Lab SDK 2.0 but we saw that it will be a waist of time. Then we decided to use only registers and the code was partially rewritten by him from 82e3a9f forward. Because of this, the PR was submitted in a way that we can keep clear what each one made. This is the why the PR have intermediary stages.

A commit can have multiple sign-offs / authors, I don't see why we can't squash them and need to upstream local history, you can add a reference to a local branch with the history in the upstream commit message if you like.

Hi @ycsin,

This is not about local history is about what each person contributed. If you squash the content you don't know what each person made. This is a Open Source project and we want to keep clear what each person made.

nandojve and others added 11 commits November 10, 2024 15:15
Add initial version.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
This replace the SDK 1.4.2 by a direct register access aproach. This
means that future operations on hal_bouffalolab do not require any
dependency of a SDK from Bouffalo Lab anymore.

The code was inspired by the newer SDK 2.0.

Signed-off-by: Camille BAUD <mail@massdriver.space>
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
Make all changes on the SoC to remove SDK dependency.

Signed-off-by: Camille BAUD <mail@massdriver.space>
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
Update the BL60x cpu devicetree definitions.

Signed-off-by: Camille BAUD <mail@massdriver.space>
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
Update pinctrl driver to be SDK independent.

Signed-off-by: Camille BAUD <mail@massdriver.space>
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
Add Bouffalo Lab gpio driver.

Signed-off-by: Camille BAUD <mail@massdriver.space>
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
Update serial driver to be SDK independent.

Signed-off-by: Camille BAUD <mail@massdriver.space>
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
Add Bouffalo Lab ISP console flash runner.  This tool enable bootloader
to flash devices using serial port.

The blflash Rust tool can be found at
    https://pypi.org/project/bflb-mcu-tool

Signed-off-by: Camille BAUD <mail@massdriver.space>
Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
Move the board to the new SoC directory.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
Use official flash tool by default.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
Introduce Bouffalo Lab platform.

Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
@nandojve
Copy link
Member Author

  • Update board docs
  • drop bflb-mcu-tool from requirements to avoid problems with dependencies.

@nandojve nandojve requested a review from josuah November 10, 2024 14:20
@fkokosinski
Copy link
Member

Rebased on top of RC-3.

This work was made by 2 persons. My first try was on Ago/2021 when I used the Bouffalo Lab SDK 1.4.x, see #37686. I kept the code working over time locally and last year Camille started to extend the implementation. At first, the idea was to use the newer Bouffalo Lab SDK 2.0 but we saw that it will be a waist of time. Then we decided to use only registers and the code was partially rewritten by him from 82e3a9f forward. Because of this, the PR was submitted in a way that we can keep clear what each one made. This is the why the PR have intermediary stages.

A commit can have multiple sign-offs / authors, I don't see why we can't squash them and need to upstream local history, you can add a reference to a local branch with the history in the upstream commit message if you like.

Hi @ycsin,

This is not about local history is about what each person contributed. If you squash the content you don't know what each person made. This is a Open Source project and we want to keep clear what each person made.

If you want to keep attribution, you could always add Co-authored-by at the end of the commit message. It's a fairly wide-spread convention.

But the most important question is - does this PR include any commit that can result in a failed build? If so, then this will make bisecting unnecessarily difficult in the future.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: Devicetree area: GPIO area: Interrupt Controller area: Pinctrl area: Process area: RISCV RISCV Architecture (32-bit & 64-bit) area: Timer Timer area: UART Universal Asynchronous Receiver-Transmitter area: West West utility DNM This PR should not be merged (Do Not Merge) manifest manifest-hal_bouffalolab
Projects
None yet
Development

Successfully merging this pull request may close these issues.

9 participants