rust-for-linux.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ryo Munakata <ryomnktml@gmail.com>
To: rust-for-linux@vger.kernel.org
Cc: linux-kernel@vger.kernel.org,
	FUJITA Tomonori <fujita.tomonori@gmail.com>
Subject: Rust ENC28J60 ethernet driver working on Raspberry Pi
Date: Sat, 29 Apr 2023 22:02:44 +0900	[thread overview]
Message-ID: <a68fca00-666a-bbf4-b4d3-acd409dd69d2@gmail.com> (raw)

Hi all,

I've written an ethernet driver for ENC28J60, a stand-alone ethernet 
controller with a SPI interface, in Rust.
It works fine on Raspberry Pi 4B with Raspbian AArch64.
You can connect to the internet and play some videos on YouTube with it 
(10BASE-T though).
I hope it will be an example of real-world drivers in Rust.

* ENC28J60 ethernet driver in Rust
enc28j60rs: https://github.com/pfpacket/enc28j60rs
`impl Sync/Send`, mostly because of raw pointers, and the initialization 
of `workqueue::Work` and `sync::Spinlock`
require a tiny bit of "unsafe" code, but otherwise no unsafe code used.

* The forked kernel with Rust support for SPI and netdev
https://github.com/pfpacket/linux-rpi-rust/tree/rust-netdev
Forked from the Raspberry Pi tree and merged Rust-for-Linux `rust` 
branch into it.
(BTW are there any easier way to get Rust-for-Linux work on Raspberry 
Pi? If so please let me know.)
Then I added the SPI support referencing rust/kernel/platform.rs and 
netdev support.
The netdev support is based on the following GitHub PR from Fujita-san:
https://github.com/Rust-for-Linux/linux/pull/908

Regards,
Ryo Munakata

             reply	other threads:[~2023-04-29 13:02 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-04-29 13:02 Ryo Munakata [this message]
2023-05-12 17:28 ` Rust ENC28J60 ethernet driver working on Raspberry Pi Andreas Hindborg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a68fca00-666a-bbf4-b4d3-acd409dd69d2@gmail.com \
    --to=ryomnktml@gmail.com \
    --cc=fujita.tomonori@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rust-for-linux@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).