LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel
User Name
Password
Linux - Kernel This forum is for all discussion relating to the Linux kernel.

Notices


Reply
  Search this Thread
Old 08-27-2021, 04:42 AM   #1
Zano
LQ Newbie
 
Registered: Aug 2021
Posts: 2

Rep: Reputation: Disabled
DTS configuration for SPI BUS with spi-mux


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?
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How to specify the MDIO Bus details in Device tree (DTS) for a imx28 Board? redbrain17 Programming 0 11-08-2014 01:44 PM
SPI bus for upgrading EEprom ravi_chobey Linux - Embedded & Single-board computer 1 11-08-2012 06:59 PM
How to extract DTS core from DTS-HD MA? earthw0rmjim Linux - Software 0 09-06-2012 01:24 PM
How to send an initialization code for AMOLED over SPI Bus? sunr2007 Linux - Embedded & Single-board computer 0 05-05-2009 06:13 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software > Linux - Kernel

All times are GMT -5. The time now is 05:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration