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

Add overlay for Seeed Studio CAN BUS FD HAT #4034

Merged
merged 3 commits into from Dec 30, 2020
Merged

Add overlay for Seeed Studio CAN BUS FD HAT #4034

merged 3 commits into from Dec 30, 2020

Conversation

menschel
Copy link
Contributor

@menschel menschel commented Dec 29, 2020

This PR relates to #4032

This patch adds the overlay for the Seeed Studio CAN BUS FD HAT
with two CAN FD Channels and an RTC.
https://www.seeedstudio.com/CAN-BUS-FD-HAT-for-Raspberry-Pi-p-4742.html

The overlay was generated by

ovmerge -c mcp251xfd-overlay.dts,spi0-0,interrupt=25 \
           mcp251xfd-overlay.dts,spi0-1,interrupt=24 \
           i2c-rtc-overlay.dts,pcf85063

The overlay was tested on rpi zero w.

$ dmesg | grep -Ei can\|spi\|rtc
[   29.729815] CAN device driver interface
[   29.751296] spi_master spi0: will run message pump with realtime priority
[   29.766387] mcp251xfd spi0.1 can0: MCP2518FD rev0.0 (-RX_INT -MAB_NO_WARN +CRC_REG +CRC_RX +CRC_TX +ECC -HD c:40.00MHz m:20.00MHz r:17.00MHz e:0.00MHz) successfully initialized.
[   29.791519] mcp251xfd spi0.0 can1: MCP2518FD rev0.0 (-RX_INT -MAB_NO_WARN +CRC_REG +CRC_RX +CRC_TX +ECC -HD c:40.00MHz m:20.00MHz r:17.00MHz e:0.00MHz) successfully initialized.
[   29.899859] mcp251xfd spi0.1 mcp1: renamed from can0
[   29.919640] mcp251xfd spi0.0 mcp0: renamed from can1
[   30.158817] rtc-pcf85063 1-0051: registered as rtc0

This patch adds the overlay for the Seeed Studio CAN BUS FD HAT
with two CAN FD Channels and an RTC.
https://www.seeedstudio.com/CAN-BUS-FD-HAT-for-Raspberry-Pi-p-4742.html

The overlay was generated by
ovmerge -c mcp251xfd-overlay.dts,spi0-0,interrupt=25 \
           mcp251xfd-overlay.dts,spi0-1,interrupt=24 \
           i2c-rtc-overlay.dts,pcf85063

Signed-off-by: Patrick Menschel <menschel.p@posteo.de>
@menschel
Copy link
Contributor Author

Note:
There is actually one issue with this board. During enumeration the can interfaces come out in wrong order, so there is the necessity to swap both. This is done by udev rule in my case.

SUBSYSTEM=="net", ACTION=="add", DEVPATH=="/devices/platform/soc/*/*/*/spi0.0/net/can?", NAME="mcp0"
SUBSYSTEM=="net", ACTION=="add", DEVPATH=="/devices/platform/soc/*/*/*/spi0.1/net/can?", NAME="mcp1"

It would be more feasible to correct the order in dt overlay. Is there an easy way to achieve this?

I know of aliases but do they work with network device naming, not only /dev/$ALIAS ?

Another thought, should I add a paragraph about #4032 in the README ?

This is a proposal on how a description could look like.

Signed-off-by: Patrick Menschel <menschel.p@posteo.de>
@menschel
Copy link
Contributor Author

Added a proposal for describing the contents of #4032 in README

Copy link
Contributor

@pelwell pelwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are a few formatting issues with the README, but otherwise I'm happy with this.

arch/arm/boot/dts/overlays/README Outdated Show resolved Hide resolved
arch/arm/boot/dts/overlays/README Outdated Show resolved Hide resolved
Signed-off-by: Patrick Menschel <menschel.p@posteo.de>
@pelwell pelwell merged commit 774f426 into raspberrypi:rpi-5.4.y Dec 30, 2020
pelwell pushed a commit that referenced this pull request Dec 30, 2020
This patch adds the overlay for the Seeed Studio CAN BUS FD HAT
with two CAN FD Channels and an RTC.
https://www.seeedstudio.com/CAN-BUS-FD-HAT-for-Raspberry-Pi-p-4742.html

The overlay was generated by
ovmerge -c mcp251xfd-overlay.dts,spi0-0,interrupt=25 \
           mcp251xfd-overlay.dts,spi0-1,interrupt=24 \
           i2c-rtc-overlay.dts,pcf85063


Also, add description on how to generate overlays

Signed-off-by: Patrick Menschel <menschel.p@posteo.de>
popcornmix pushed a commit that referenced this pull request Dec 31, 2020
This patch adds the overlay for the Seeed Studio CAN BUS FD HAT
with two CAN FD Channels and an RTC.
https://www.seeedstudio.com/CAN-BUS-FD-HAT-for-Raspberry-Pi-p-4742.html

The overlay was generated by
ovmerge -c mcp251xfd-overlay.dts,spi0-0,interrupt=25 \
           mcp251xfd-overlay.dts,spi0-1,interrupt=24 \
           i2c-rtc-overlay.dts,pcf85063


Also, add description on how to generate overlays

Signed-off-by: Patrick Menschel <menschel.p@posteo.de>
@marckleinebudde
Copy link
Contributor

Hello,

I know that I'm late to the party, buy there are two seed studio can-fd hats. The older one has two mcp2517fd chips, one connected to spi0-0, the other to spi1-0, while the new one has two mcp2518fd chips on spi0-0 and spi0-1. Can we rename this overlay to include mcp2518fd in the name?

@menschel
Copy link
Contributor Author

I think the correct way would be to distinguish by version number but after reading my version this seems unlikely a solution.

On the bottom side of my (mcp2518fd) board, it reads

CAN-BUS(FD) HAT for Raspberry Pi
www.seeedstudio.com
v1.0 6/20/2020

@marckleinebudde
Copy link
Contributor

My mcp2517fd (https://www.seeedstudio.com/2-Channel-CAN-BUS-FD-Shield-for-Raspberry-Pi-p-4072.html) board says:

2-Channel CAN-BUS(FD) Shield
for Raspberry Pi (MCP2517FD)
www.seeedstudio.com
v1.0 1/8/2019

My mcp2518fd board says:

2-Channel CAN FD Master
HAT for Raspberry Pi
www.seeedstudio.com
v1.0 2/28/2020

Same version number, different date...

I'm using the following overlays:

# Seeedstudio CAN-BUS FD 2517FD
#dtoverlay=spi1-1cs
#dtoverlay=mcp251xfd,spi0-0,interrupt=25
#dtoverlay=mcp251xfd,spi1-0,interrupt=24

# Seeedstudio CAN-BUS FD 2518FD
#dtoverlay=mcp251xfd,spi0-0,interrupt=25
#dtoverlay=mcp251xfd,spi0-1,interrupt=24

Which means both mcp2518fd variants are compatible (at least when it comes to SPI, I haven't checked the I2C).

@menschel
Copy link
Contributor Author

We could label these v1, v2 and v3 and add the link in README for reference.

If the Master HAT has the same RTC we get away with v1 and v2.

@menschel
Copy link
Contributor Author

menschel commented Jan 2, 2021

I did some experimenting and came to the conclusion that an overlay generated by

ovmerge -c spi1-1cs-overlay.dts \
           mcp251xfd-overlay.dts,spi0-0,interrupt=25 \
           mcp251xfd-overlay.dts,spi0-1,interrupt=24 \
           mcp251xfd-overlay.dts,spi1-0,interrupt=24 \
           i2c-rtc-overlay.dts,pcf85063

works with my board. Seems the "not there" device is just skipped.

It may not be a clean solution but if this works on the other boards, we may get away with one overlay.

@marckleinebudde
Copy link
Contributor

IMHO this is not an option, as it enables spi1-1cs unconditionally. Better make it two overlays. Either with -v1, -v2 or with -mcp2517fd, -mcp2518fd.

@menschel
Copy link
Contributor Author

menschel commented Jan 2, 2021

I'm fine with the -v1, -v2 naming. Feel free to open the next PR and change the naming as appropriate.

@marckleinebudde
Copy link
Contributor

marckleinebudde commented Jan 2, 2021

Here's the pull request: #4041

popcornmix pushed a commit that referenced this pull request Jan 7, 2021
This patch adds the overlay for the Seeed Studio CAN BUS FD HAT
with two CAN FD Channels and an RTC.
https://www.seeedstudio.com/CAN-BUS-FD-HAT-for-Raspberry-Pi-p-4742.html

The overlay was generated by
ovmerge -c mcp251xfd-overlay.dts,spi0-0,interrupt=25 \
           mcp251xfd-overlay.dts,spi0-1,interrupt=24 \
           i2c-rtc-overlay.dts,pcf85063


Also, add description on how to generate overlays

Signed-off-by: Patrick Menschel <menschel.p@posteo.de>
popcornmix pushed a commit that referenced this pull request Jan 11, 2021
This patch adds the overlay for the Seeed Studio CAN BUS FD HAT
with two CAN FD Channels and an RTC.
https://www.seeedstudio.com/CAN-BUS-FD-HAT-for-Raspberry-Pi-p-4742.html

The overlay was generated by
ovmerge -c mcp251xfd-overlay.dts,spi0-0,interrupt=25 \
           mcp251xfd-overlay.dts,spi0-1,interrupt=24 \
           i2c-rtc-overlay.dts,pcf85063


Also, add description on how to generate overlays

Signed-off-by: Patrick Menschel <menschel.p@posteo.de>
popcornmix pushed a commit that referenced this pull request Jan 14, 2021
This patch adds the overlay for the Seeed Studio CAN BUS FD HAT
with two CAN FD Channels and an RTC.
https://www.seeedstudio.com/CAN-BUS-FD-HAT-for-Raspberry-Pi-p-4742.html

The overlay was generated by
ovmerge -c mcp251xfd-overlay.dts,spi0-0,interrupt=25 \
           mcp251xfd-overlay.dts,spi0-1,interrupt=24 \
           i2c-rtc-overlay.dts,pcf85063


Also, add description on how to generate overlays

Signed-off-by: Patrick Menschel <menschel.p@posteo.de>
popcornmix pushed a commit that referenced this pull request Jan 21, 2021
This patch adds the overlay for the Seeed Studio CAN BUS FD HAT
with two CAN FD Channels and an RTC.
https://www.seeedstudio.com/CAN-BUS-FD-HAT-for-Raspberry-Pi-p-4742.html

The overlay was generated by
ovmerge -c mcp251xfd-overlay.dts,spi0-0,interrupt=25 \
           mcp251xfd-overlay.dts,spi0-1,interrupt=24 \
           i2c-rtc-overlay.dts,pcf85063


Also, add description on how to generate overlays

Signed-off-by: Patrick Menschel <menschel.p@posteo.de>
popcornmix pushed a commit that referenced this pull request Jan 25, 2021
This patch adds the overlay for the Seeed Studio CAN BUS FD HAT
with two CAN FD Channels and an RTC.
https://www.seeedstudio.com/CAN-BUS-FD-HAT-for-Raspberry-Pi-p-4742.html

The overlay was generated by
ovmerge -c mcp251xfd-overlay.dts,spi0-0,interrupt=25 \
           mcp251xfd-overlay.dts,spi0-1,interrupt=24 \
           i2c-rtc-overlay.dts,pcf85063


Also, add description on how to generate overlays

Signed-off-by: Patrick Menschel <menschel.p@posteo.de>
popcornmix pushed a commit that referenced this pull request Jan 27, 2021
This patch adds the overlay for the Seeed Studio CAN BUS FD HAT
with two CAN FD Channels and an RTC.
https://www.seeedstudio.com/CAN-BUS-FD-HAT-for-Raspberry-Pi-p-4742.html

The overlay was generated by
ovmerge -c mcp251xfd-overlay.dts,spi0-0,interrupt=25 \
           mcp251xfd-overlay.dts,spi0-1,interrupt=24 \
           i2c-rtc-overlay.dts,pcf85063


Also, add description on how to generate overlays

Signed-off-by: Patrick Menschel <menschel.p@posteo.de>
Noltari pushed a commit to Noltari/rpi-linux that referenced this pull request Aug 20, 2021
This patch adds the overlay for the Seeed Studio CAN BUS FD HAT
with two CAN FD Channels and an RTC.
https://www.seeedstudio.com/CAN-BUS-FD-HAT-for-Raspberry-Pi-p-4742.html

The overlay was generated by
ovmerge -c mcp251xfd-overlay.dts,spi0-0,interrupt=25 \
           mcp251xfd-overlay.dts,spi0-1,interrupt=24 \
           i2c-rtc-overlay.dts,pcf85063


Also, add description on how to generate overlays

Signed-off-by: Patrick Menschel <menschel.p@posteo.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants