I have I problem writing to the spi controller of daVinci .I have four bytes I want to send on the bus using 8-bits words, but I only get the first out of the dm6446. Here is the routine I'm using in a kernel module. I think I'm missing some kind of synchronization but I don't understand what.

Can you give me a hint please?

static int
spimem_write (char *data, size_t size)
{
  int i;
  unsigned long control;

  for (i = 0; i < size; i++)
    {
      control = SPIDAT1_CSNR (0) | SPIDAT1_CSHOLD;
      control |= data[i];
      SPI_REG (SPIDAT1) = control;

      control = SPI_REG (SPIBUF);
      if (control & SPIBUF_RX_EMPTY)
        printk (KERN_INFO "no data received\n");
      else
        {
          while (1)
            {
              control = SPI_REG (SPIBUF);
              if (control & SPIBUF_TXFULL)
                continue;
              else
                break;
              printk (KERN_INFO "wait for data\n");
            }
          printk ("data: %04X\n", control & 0x0000FFFF);
        }
    }

  return i;
}


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.

_______________________________________________
Davinci-linux-open-source mailing list
[email protected]
http://linux.davincidsp.com/mailman/listinfo/davinci-linux-open-source

Reply via email to