Page MenuHomeFreeBSD

dwc: Add support for the cvitek ethernet controller
AcceptedPublic

Authored by bnovkov on Jan 20 2025, 6:04 PM.
Tags
None
Referenced Files
Unknown Object (File)
Sun, Apr 20, 1:28 AM
Unknown Object (File)
Sat, Apr 19, 6:22 AM
Unknown Object (File)
Sat, Apr 19, 12:50 AM
Unknown Object (File)
Thu, Apr 17, 10:47 AM
Unknown Object (File)
Thu, Apr 17, 2:39 AM
Unknown Object (File)
Tue, Apr 8, 9:24 AM
Unknown Object (File)
Mar 8 2025, 11:42 PM
Unknown Object (File)
Feb 27 2025, 5:36 PM
Subscribers

Details

Reviewers
br
manu
Summary

This patch adds support for the cvitek flavor of the DWC ethernet
controller. This controller is present on the Milk-V riscv SoCs.

Test Plan

I've been running this patch on a Milk-V Duo S board for a week and didn't run into any issues so far.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

bnovkov created this revision.
manu requested changes to this revision.Jan 20 2025, 6:26 PM

You should add the file to one of the std.XXX file in sys/riscv/conf

sys/dev/dwc/if_dwc_cvitek.c
80

No syscon handle in the device dtb node ?

This revision now requires changes to proceed.Jan 20 2025, 6:26 PM
bnovkov marked an inline comment as done.

Address @manu 's comments.

You should add the file to one of the std.XXX file in sys/riscv/conf

Ah sorry, my differential uploading spree was interrupted before I could do that, D48533 should take care of that.

sys/dev/dwc/if_dwc_cvitek.c
80

No, but it does make more sense that way.
I added a phandle to the dtb node and updated the code accordingly.

sys/dev/dwc/if_dwc_cvitek.c
80

What do you mean ? You're not supposed to modify the dtb but follow the bindings.

Remove redundant initialization steps.

sys/dev/dwc/if_dwc_cvitek.c
80

The bindings required a few smaller interventions in other places to make things work, and in the previous diff I just added a syscon phandle reference to avoid the hacky way of searching for a syscon.

However, after some more digging, it turned out that the steps in the init method were not required at all, the driver works without the clock-related steps fomr the init procedure.

sys/dev/dwc/if_dwc_cvitek.c
80

Probably because u-boot have init the controller already, it's likely needed.

sys/dev/dwc/if_dwc_cvitek.c
80

sorry, managed to miss your comment.
So the DTS lists the stmmaceth clock as a 'fixed-clock', I guess this is why the driver works without explicitly enabling the clock in probe.

@manu are there any leftover issues here that you'd like to see addressed? I'm not entirely sure what is blocking this review at the moment.

manu added inline comments.
sys/dev/dwc/if_dwc_cvitek.c
74

That's a bit weird but ok, not the first time we see stuff like this :)

80

Ok, make sense then.

This revision is now accepted and ready to land.Feb 22 2025, 5:29 PM