在Amlogic Meson G12A平台上为ENG28J60芯片编写设备树(DTS)覆盖
我需要编写一个 .dts
覆盖文件,以便在 Radxa Zero
(即 Amlogic Meson G12A<)上使用 Microchip
enc28j60
/code> 平台通过 SPI
。我使用的内核是 来自 radxa 的 5.10 。
从完全不知道我在做什么开始,我最终得到了以下覆盖:
/dts-v1/;
/plugin/;
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/gpio/meson-g12a-gpio.h>
&spicc1 {
// spicc1 defined in meson-g12-common.dtsi
// See meson-g12a-spi-spidev.dts
pinctrl-0 = <&spicc1_pins &spicc1_ss0_pins>;
pinctrl-names = "default";
// handled by `param_spidev_spi_bus` and meson-fixup.scr-cmd for the spi-spidev overlay
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
eth1: enc28j60@0 {
compatible = "microchip,enc28j60";
reg = <0>; /* for spi, this defines the chipselect */
/**
* gpio_int has interrupts-cells = <2>
*
* How does this distinguish between e.g. GPIOAO_4 on the first chip and GPIOZ_4 on the second ?!
*/
interrupt-parent = <&gpio_intc>;
interrupts = <GPIOX_8 IRQ_TYPE_EDGE_FALLING>;
// causes "enc28j60 spi1.0: there is not valid maps for state default"
pinctrl-0 = <&enc28j60_int_pin>;
pinctrl-names = "default";
spi-max-frequency = <12000000>;
status = "okay";
debug = <1>;
};
};
// See meson-g12-common.dtsi
// I think what happens here is that we define this pin as the interrupt pin (something must
// tell the chip that we want this pin to receive interrupts) and then "interrupts" in ð1
// actually uses it
&periphs_pinctrl {
enc28j60_int_pin: enc28j60_int_pin@0 {
amlogic,pins = <&gpio GPIOX_8>;
amlogic,function = <0>; /* in */
amlogic,pull = <IRQ_TYPE_NONE>;
};
};
// Not entirely sure this is correct, but I haven't found any other way to do this
// and this compiles
/ {
__overrides__ {
irq = <ð1>, "interrupts:0", <&enc28j60_int_pin>, "brcm,pins:0";
speed = <ð1>, "spi-max-frequency:0";
};
};
不幸的是,我努力的结果仍然是一个无法运行的 enc28j60
驱动程序:
[ 3.882872] enc28j60 spi1.0: there is not valid maps for state default
[ 3.884022] enc28j60 spi1.0: Ethernet driver 1.02 loaded
[ 3.896540] enc28j60 spi1.0: chip not found
[ 3.896686] enc28j60: probe of spi1.0 failed with error -5
我已经记录了整个过程并且Radxa 的进展(或缺乏)社区论坛。
我需要取得进展的是信息(但我很乐意接受所有问题的答案;)):
- 如何将内核和驱动程序置于调试模式,以便我可以看到 比上面输出的 dmesg 更详细的信息。
- 如何验证我尝试使用中断引脚执行的操作是否正确 并有意义。 (我在其他平台找到了类似的例子 [
tegra
,brcm
],但对于介子芯片,pinctrl
似乎是 完全作为内核驱动程序代码的一部分完成,而不是作为设备 树)。
I need to write a .dts
overlay file to use a Microchip enc28j60
on a Radxa Zero
, which is an Amlogic Meson G12A
platform via SPI
. The kernel I'm using is 5.10 from radxa.
Starting from having absolutely no idea what I was doing, I have ended up with the following overlay:
/dts-v1/;
/plugin/;
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/gpio/meson-g12a-gpio.h>
&spicc1 {
// spicc1 defined in meson-g12-common.dtsi
// See meson-g12a-spi-spidev.dts
pinctrl-0 = <&spicc1_pins &spicc1_ss0_pins>;
pinctrl-names = "default";
// handled by `param_spidev_spi_bus` and meson-fixup.scr-cmd for the spi-spidev overlay
status = "okay";
#address-cells = <1>;
#size-cells = <0>;
eth1: enc28j60@0 {
compatible = "microchip,enc28j60";
reg = <0>; /* for spi, this defines the chipselect */
/**
* gpio_int has interrupts-cells = <2>
*
* How does this distinguish between e.g. GPIOAO_4 on the first chip and GPIOZ_4 on the second ?!
*/
interrupt-parent = <&gpio_intc>;
interrupts = <GPIOX_8 IRQ_TYPE_EDGE_FALLING>;
// causes "enc28j60 spi1.0: there is not valid maps for state default"
pinctrl-0 = <&enc28j60_int_pin>;
pinctrl-names = "default";
spi-max-frequency = <12000000>;
status = "okay";
debug = <1>;
};
};
// See meson-g12-common.dtsi
// I think what happens here is that we define this pin as the interrupt pin (something must
// tell the chip that we want this pin to receive interrupts) and then "interrupts" in ð1
// actually uses it
&periphs_pinctrl {
enc28j60_int_pin: enc28j60_int_pin@0 {
amlogic,pins = <&gpio GPIOX_8>;
amlogic,function = <0>; /* in */
amlogic,pull = <IRQ_TYPE_NONE>;
};
};
// Not entirely sure this is correct, but I haven't found any other way to do this
// and this compiles
/ {
__overrides__ {
irq = <ð1>, "interrupts:0", <&enc28j60_int_pin>, "brcm,pins:0";
speed = <ð1>, "spi-max-frequency:0";
};
};
The result of my efforts, unfortunately is still a non-functioning enc28j60
driver:
[ 3.882872] enc28j60 spi1.0: there is not valid maps for state default
[ 3.884022] enc28j60 spi1.0: Ethernet driver 1.02 loaded
[ 3.896540] enc28j60 spi1.0: chip not found
[ 3.896686] enc28j60: probe of spi1.0 failed with error -5
I have documented the entire process and progress (or lack thereof) on the Radxa Community Forums.
What I would need to progress are either information (but I'll gladly accept answers to all of the questions ;)):
- How to put the kernel and driver into debug mode so that I can see
more detailed information than whatdmesg
is outputting above. - How to verify what I am trying to do with the interrupt pin is correct
and making sense. (I have found similar examples for other platforms
[tegra
,brcm
], but for the meson chips,pinctrl
seems to be
entirely done as part of the kernel driver code, not as a device
tree).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论