MPC885 SPI : Linux2.6.35

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MPC885 SPI : Linux2.6.35

Jump to solution
1,568 Views
sebastienblavie
Contributor I

Hello,

I've got a problem with SPI bus and MPC885. I'm stuck in driver (mpc8xxx.c) when i send data over the bus with spidev.

In first i configure th SPI in the DTS and the spi_mpc_8xxx fails due to cpm_muram_alloc_fixed function.

  • cpm_muram_alloc_fixed ko due to  rh_alloc_fixed =>no empty block (blk == null return line 563 rheap.c)

So i try to path the driver and replace spi_base_ofs = cpm_muram_alloc_fixed(iprop[2], 2); by spi_base_ofs = iprop[2]; in the function mpc8xxx_spi_cpm_get_pram

Now the driver is launched :

alloc irq_desc for 24 on node 0

alloc kstat_irqs on node 0

irq: irq 5 on host /soc@fa200000/cpm@9c0/interrupt-controller@930 mapped to virtual irq 24

mpc8xxx_spi fa200aa0.spi: Error fixed 1ssss: 6 4

mpc8xxx_spi fa200aa0.spi: at 0xc52a6aa0 (irq = 24), CPM1 mode

and i can see my spi device :

[/]# ls /dev/s*

  /dev/spidev32766.0

But when i try to send data with spidev my driver is sutck. no clock and data on ctrl pins no irq.

The driver wait on wait_for_completion(&mpc8xxx_spi->done);

  • ARCH setup:

{CPM_PORTB, 28, CPM_PIN_OUTPUT}, /* SPI MI */

{CPM_PORTB, 29, CPM_PIN_OUTPUT},  /* SPI MO */

{CPM_PORTB, 30, CPM_PIN_OUTPUT},  /* SPI CLK */ 

{CPM_PORTB, 31, CPM_PIN_OUTPUT | CPM_PIN_GPIO},  /* SPISEL : PBPAR == 0 */     

  • DTS :

spi@aa0 {

#address-cells = <1>;

#size-cells = <0>;

device_type = "spi";

compatible = "fsl,spi","fsl,cpm1-spi";

reg = <0xaa0 0x12 0x3d80 0x30>;

gpios = <&CPM1_PIO_B 18 0>;

interrupts = <5>;

interrupt-parent = <&CPM_PIC>;

max3421@0 {

compatible = "spi,spidev";

reg = <0>;

spi-max-frequency = <3000000>; /* 3 MHz */

}

Tags (3)
0 Kudos
Reply
1 Solution
1,239 Views
Pavel
NXP Employee
NXP Employee

Freescale does not have program example for the MPC885 SPI under Linux.

See attached file. It is simple standalone program example for the MPC885 SPI.

See the Section 36.2.1 of the MPC885 User’s Manual:

For SCC2, the serial ATM parameters extend into the SPI parameter RAM. However, the parameters for SPI can be relocated without the need for RAM-based microcode.

Out program example uses relocation the SPI parameter RAM.

Do you use relocation of the SPI parameter RAM?

Compare our program example and your driver code.


Have a great day,
Pavel

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

1 Reply
1,240 Views
Pavel
NXP Employee
NXP Employee

Freescale does not have program example for the MPC885 SPI under Linux.

See attached file. It is simple standalone program example for the MPC885 SPI.

See the Section 36.2.1 of the MPC885 User’s Manual:

For SCC2, the serial ATM parameters extend into the SPI parameter RAM. However, the parameters for SPI can be relocated without the need for RAM-based microcode.

Out program example uses relocation the SPI parameter RAM.

Do you use relocation of the SPI parameter RAM?

Compare our program example and your driver code.


Have a great day,
Pavel

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------