*** PROBABLY SPAM *** No Clock on SPI

Laurent Pinchart laurent.pinchart at tbox.biz
Wed Aug 16 23:22:36 EST 2006

Hi Fred,

> I´m writing a Driver for SPI. That is not working now.
> I have a MPC8260 using Linux 2.6.14 (rheap patch).
> Did someone else write a driver for SPI on this µC or an other driver? So I
> can see what i did wrong?

I'm working on an SPI driver for the MPC8248. I'll try to send a patch in a 
few days.

> My SPCOM[STR] flag isn´t cleared automatically after one clock cycle.
> What here going wrong ? ( I know this register is write only)
> There is also no Clock on my SPICLK.

Make sure you programmed the SPMODE register correctly.

> How I have to allocate the Memory for the BD´s and the buffer for the BD´s?

The buffer descriptors should be allocated from CPM DPRAM using cpm_dpalloc(). 
The buffers can be allocated from any DMA-able memory (all system memory).

> Is there something special when I allocate Memory for my Parameter Ram?

You don't need to allocate memory for the parameter RAM. I declared PROFF_SPI 
equal to 192 (I2C parameter RAM is at 128) in include/asm-ppc/cpm2.h:

#define PROFF_SMC1      (0)
#define PROFF_SMC2      (64)
#define PROFF_I2C       (128)
#define PROFF_SPI       (192)

Don't forget to set CPM_DATAONLY_BASE to 256 instead of 128 in the same file.

Then, set

*(u16 *)(&immap->im_dprambase[PROFF_SPI_BASE]) = PROFF_SPI;

in your driver code, and set the SPI pram resource to

.name   = "pram",
.start  = 0x00c0,
.end    = 0x00ff,

in arch/ppc/syslib/pq2_devices.c

> Is something wrong with the 2.6 Kernel so i have to use the 2.4 Kernel ?

You should not use 2.4. 2.6 is the way to go.

Laurent Pinchart

More information about the Linuxppc-embedded mailing list