Hi all,
first of all sorry if this is not the correct place where to ask this question, in case it's wrong, please lead me to the correct place.
As per title, I'm trying to my configure the SPI bus of my board. The SOC is an AT91SAM9G20 and I'm using mainline Linux Kernel 5.10.40.
This is a diagram of the hardware present on that spi bus:
Code:
MOSI /--------------------------------+--------+--------+--------\
MISO |/------------------------------+|-------+|-------+|-------\|
SCL ||/----------------------------+||------+||------+||------\||
||| ||| ||| ||| |||
+-------------+ ||| ||| ||| |||
| SoC ||| | +-+++-+ +-+++-+ +-+++-+ +-+++-+
| ||| | | dev0| | dev1| | dev2| | dev3|
| +--+++-+ |pioA3 +--+--+ +--+--+ +--+--+ +--+--+
| | SPI +--|-------------------------/ | | |
| +------+ | | | |
| |pioA26 +------+ 00 | | |
| +-------+-|-------| |-------------------/ 01 | |
| | GPIOA +-|-------| MUX |----------------------------/ 10 |
| +-------+ |pioA27 | |-------------------------------------/
+-------------+ +------+
The devices that I'm more interested in are dev0 (a spi-nor memory) and dev1 (an rtc clock). (If I am able to make dev1 working, dev2 and dev3 should be easy enough to configure).
This is the relevant part of the DTS:
Code:
spi0_mux: mux-controller {
compatible = "gpio-mux";
#mux-control-cells = <0>;
mux-gpios = <&pioA 26 GPIO_ACTIVE_HIGH>,
<&pioA 27 GPIO_ACTIVE_HIGH>;
};
&spi0 {
status = "okay";
cs-gpios = <&pioA 3 GPIO_ACTIVE_LOW>;
spi_pcm@0 {
compatible = "jedec,spi-nor";
reg = <0x0>;
spi-max-frequency = <50000000>;
m25p,fast-read;
label = "micron_pcm";
};
spi@1 {
compatible = "spi-mux";
reg = <1>;
#address-cells = <1>;
#size-cells = <0>;
spi-max-frequency = <50000000>;
mux-controls = <&spi0_mux>;
ds3234@0 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "dallas,ds3232";
reg = <0>;
spi-max-frequency = <5000000>;
status = "okay";
};
};
};
And this is the relevant selected configuration on the kernel itself:
Code:
CONFIG_RTC_CLASS=y
CONFIG_RTC_DEBUG=y
CONFIG_RTC_DRV_DS3232=y
CONFIG_MUX_GPIO=y
CONFIG_SPI=y
CONFIG_SPI_ATMEL=y
CONFIG_SPI_MUX=y
CONFIG_MTD_SPI_NOR
On the boot log, I successfully detect the memory:
Code:
spi-nor spi0.0: np8p128ax60 (16384 Kbytes)
3 cmdlinepart partitions found on MTD device micron_pcm
Creating 3 MTD partitions on "micron_pcm":
0x000000000000-0x000000020000 : "bootstrap"
0x000000020000-0x000000040000 : "fdt"
0x000000040000-0x000000300000 : "kernel/rootfs"
And I see that the GPIO mux is created:
Quote:
gpio-mux mux-controller: 4-way mux-controller registered
|
I also modified adding a printk in the init function of the rtc-ds3232 driver (file drivers/rtc/rtc-ds3232.c) in order to check if it was at least launched, and it is:
Code:
printk("============================= STUFF ==============================\n");
----
...
g_serial gadget: g_serial ready
============================= STUFF ==============================
i2c /dev entries driver
...
However, the rtc device file does not get created, neither in /dev nor in /sys/class.
I have not been able to pinpoint the problem with accuracy, and I'm still not sure if the DTS configuration is the correct one. I followed the instruction as explained on spi-mux.yaml file, but I'm not sure that everything is correct (or if I am missing something on the kernel config itself).
Does anybody have an idea on how to proceed?