izmit escort escort ankara adana escort

 FAQ •  Search •  Register •  Login 

All times are UTC + 1 hour [ DST ]




Post new topic Reply to topic  [ 9 posts ] 
Author Message
 Post subject: at91sam9x35 spidev error
PostPosted: Mon Aug 14, 2017 11:46 am 
Offline

Joined: Mon Aug 14, 2017 9:36 am
Posts: 10
Dear all,

I have at91sam9x35 based custom board and want to use spi (spidev) from user space. For the same i have edited at91sam9x35.dtsi as follows .


at91sam9x35.dtsi
Code:
spi0: spi@f0000000 {
            #address-cells = <1>;
            #size-cells = <0>;
            compatible = "atmel,at91sam9x5-spi";
            reg = <0xf0000000 0x100>;
            interrupts = <13 4 3>;
            pinctrl-names = "default";
            pinctrl-0 = <&pinctrl_spi0>;
            dma-mask = <0xffffffff>;
            dma = <&dma0 0x10002212>;
            status = "okay";            
            //also checked with spi-num-chipselects = <1>
            cs-gpios = <&pioA 14 0>;
            spidev@0 {
            compatible = "linux,spidev";
            spi-max-frequency = <10000000>;
            reg = <0>;
            };
            
         };

spi0 {
               pinctrl_spi0: spi0-0 {
                  atmel,pins =
                     <0 11 0x1 0x0   /* PA11 periph A SPI0_MISO */
                      0 12 0x1 0x0   /* PA12 periph A SPI0_MOSI */
                      0 13 0x1 0x0   /* PA13 periph A SPI0_SPCK */
                      0 14 0x1 0x0>;   /* PA14 periph A SPI0_NPCS0 */
               };
            };



But at the time of booting device cant get registered successfully.
it shows following error.


Quote:
atmel_spi f0000000.spi: Using dma0chan1 (tx) and dma0chan2 (rx) for DMA transfers
atmel_spi f0000000.spi: Atmel SPI Controller at 0xf0000000 (irq 17)
atmel_spi f0000000.spi: master is unqueued, this is deprecated
atmel_spi f0000000.spi: chipselect 0 already in use
spi_master spi32766: spi_device register error /ahb/apb/spi@f0000000/m25p80@0



Still the devise listed under /dev but no any output signal on spi port when i write to .

Code:
# ls /dev/spidev*
/dev/spidev32766.0



I have 3.6.9 kernel. as i am new to device tree concept, i am unable to understand where did i wrong?


Top
 Profile  
Reply with quote  
 Post subject: Re: at91sam9x35 spidev error
PostPosted: Tue Aug 15, 2017 10:58 pm 
Offline

Joined: Thu Apr 19, 2007 10:15 pm
Posts: 1478
Location: USA
nmmane wrote:
For the same i have edited at91sam9x35.dtsi as follows .
Either that's a big edit to at91sam9x35.dtsi, or you actually edited at91sam9x5.dtsi and are misreporting what you did.

Obviously you cannot modify the SoC itself, and yet you are modifying the Device Tree files that describe that SoC.
Instead your edits should be applied to your board-level DT file(s), and the SoC-level files should be left as generic descriptions.

nmmane wrote:
But at the time of booting device cant get registered successfully.
...
Still the devise listed under /dev but no any output signal on spi port when i write to .
You seem to be referring to a single "device", when in fact there are several SPI devices.
Study the Linux kernel documentation for SPI, especially the spi-summary,

The salient log messages are:
Quote:
atmel_spi f0000000.spi: chipselect 0 already in use
spi_master spi32766: spi_device register error /ahb/apb/spi@f0000000/m25p80@0
Even though you write that you have a "custom" board, you seem to be (blindly) reusing Device Tree definitions for the AT91SAM9X35-EK board.
You have two SPI slave devices configured to the first CS of the SPI master.

Regards


Top
 Profile  
Reply with quote  
 Post subject: Re: at91sam9x35 spidev error
PostPosted: Wed Aug 16, 2017 8:49 am 
Offline

Joined: Mon Aug 14, 2017 9:36 am
Posts: 10
Quote:
Either that's a big edit to at91sam9x35.dtsi, or you actually edited at91sam9x5.dtsi and are misreporting what you did.


sorry, i have put wrong file name before data it was at91sam9x5.dtsi


now I have put the spidev tag in core9x35ek.dts file and it removes chip select error.

Code:
spi0: spi@f0000000 {
            status = "okay";            
            cs-gpios = <&pioA 14 0>;
            spidev@0 {                     
            compatible = "linux,spidev";            
            spi-max-frequency = <10000000>;
            reg = <0>;
            };
         };


now output is

Code:
atmel_spi f0000000.spi: Using dma0chan1 (tx) and  dma0chan2 (rx) for DMA transfers
atmel_spi f0000000.spi: Atmel SPI Controller at 0xf0000000 (irq 17)
atmel_spi f0000000.spi: master is unqueued, this is deprecated
m25p80 spi32766.0: unrecognized JEDEC id ffffff



Quote:
reusing Device Tree definitions for the AT91SAM9X35-EK board.


my core board is CORE9x53 and base board is custom board.

Code:
m25p80 spi32766.0: unrecognized JEDEC id ffffff

what dose it means?


Top
 Profile  
Reply with quote  
 Post subject: Re: at91sam9x35 spidev error
PostPosted: Fri Aug 18, 2017 1:40 am 
Offline

Joined: Thu Apr 19, 2007 10:15 pm
Posts: 1478
Location: USA
nmmane wrote:
Code:
m25p80 spi32766.0: unrecognized JEDEC id ffffff

what dose it means?
Apparently you still have a leftover definition from the AT91SAM9X35-EK board.
"m25p80" is the label for the SPI serial flash chip on some SAM9x5 SoMs (aka "computer module" or CM).
The Corewind SoM that you're using does not have any SPI serial flash.
So you have not properly gone through the Device Tree files that you copied and are now using, and verified that the active devices actually exist.

Regards


Top
 Profile  
Reply with quote  
 Post subject: Re: at91sam9x35 spidev error
PostPosted: Wed Aug 23, 2017 6:51 am 
Offline

Joined: Mon Aug 14, 2017 9:36 am
Posts: 10
I did not found any m25p80 device added in dt files. Is there any other way to find .


Top
 Profile  
Reply with quote  
 Post subject: Re: at91sam9x35 spidev error
PostPosted: Thu Aug 24, 2017 9:02 pm 
Offline

Joined: Thu Apr 19, 2007 10:15 pm
Posts: 1478
Location: USA
nmmane wrote:
I did not found any m25p80 device added in dt files. Is there any other way to find .
What did you look for, and where did you look?

Code:
$ find arch/arm/boot/dts -name "at91*" | xargs grep m25p80
arch/arm/boot/dts/at91sam9n12ek.dts:            m25p80@0 {
arch/arm/boot/dts/at91sam9x5cm.dtsi:            m25p80@0 {
$


Top
 Profile  
Reply with quote  
 Post subject: Re: at91sam9x35 spidev error
PostPosted: Sat Aug 26, 2017 12:31 pm 
Offline

Joined: Mon Aug 14, 2017 9:36 am
Posts: 10
Thank You So much :D

I have't seen in 'at91sam9x5cm.dtsi' , as i searched manually. Now i removed this section and now my spidev32766.0 mounded successfully.

do you know any detailed document to study device tree structure and working for beginners.

But still i cant get output signals on CLK/CS/MOSI :( .
Any idea about how to trace why there is no signal on output lines.

Code:
spi0: spi@f0000000 {
            #address-cells = <1>;
            #size-cells = <0>;
            compatible = "atmel,at91sam9x5-spi";
            reg = <0xf0000000 0x100>;
            interrupts = <13 4 3>;
            pinctrl-names = "default";
            pinctrl-0 = <&pinctrl_spi0>;
            dma-mask = <0xffffffff>;
            dma = <&dma0 0x10002212>;
            status = "disabled";
         };




Code:
spi0 {
               pinctrl_spi0: spi0-0 {
                  atmel,pins =
                     <0 11 0x1 0x0   /* PA11 periph A SPI0_MISO */
                      0 12 0x1 0x0   /* PA12 periph A SPI0_MOSI */
                      0 13 0x1 0x0   /* PA13 periph A SPI0_SPCK */
                      0 14 0x1 0x0>;   /* PA14 periph A SPI0_NPCS0 */
               };
            };




Code:
spi0: spi@f0000000 {
            cs-gpios = <&pioA 14 0>;
            spidev@0 {                     
            compatible = "linux,spidev";            
            spi-max-frequency = <10000000>;
            reg = <0>;
            };            
         };




Code:
spi0: spi@f0000000 {
            status = "okay";
         };


Top
 Profile  
Reply with quote  
 Post subject: Re: at91sam9x35 spidev error
PostPosted: Tue Aug 29, 2017 12:29 am 
Offline

Joined: Thu Apr 19, 2007 10:15 pm
Posts: 1478
Location: USA
nmmane wrote:
I have't seen in 'at91sam9x5cm.dtsi' , as i searched manually. Now i removed this section and now my spidev32766.0 mounded successfully.
A "manual search" should have involved every #include file.
A filesystem is mounted. Device nodes are created. spidev32766.0 is not a filesystem, but a device node.

nmmane wrote:
do you know any detailed document to study device tree structure and working for beginners.
https://events.linuxfoundation.org/sites/events/files/slides/petazzoni-device-tree-dummies.pdf

nmmane wrote:
But still i cant get output signals on CLK/CS/MOSI :( .
Any idea about how to trace why there is no signal on output lines.
Don't use Linux (especially with an unproven configuration) to debug your hardware.
Use a baremetal program (e.g. Atmel Software Package) or/and U-Boot to debug hardware.

Regards


Top
 Profile  
Reply with quote  
 Post subject: Re: at91sam9x35 spidev error
PostPosted: Thu Sep 07, 2017 1:23 pm 
Offline

Joined: Mon Aug 14, 2017 9:36 am
Posts: 10
After Debugging spi driver i found in spi-atmel.c

Code:
if (xfer->speed_hz)
          return -ENOPROTOOPT;


causing spi transfer error
so i replace this line with

Code:
if (xfer->speed_hz < spi->max_speed_hz)
return -ENOPROTOOPT;


So Cant allowed to lower tarnsfer speed than max speed.

now i got everything fine , i have tested upto 133MHz spi clk.

Thanks for Help :D .


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 9 posts ] 

All times are UTC + 1 hour [ DST ]


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to: