2007-11-20 07:11:27     spi_master handling of spi-drivers with different values of CPHA

Document created by Aaronwu Employee on Aug 5, 2013
Version 1Show Document
  • View in full screen mode

2007-11-20 07:11:27     spi_master handling of spi-drivers with different values of CPHA

Mattias K (SWEDEN)

Message: 47106    Hi,

 

I think/know that there is a problem when there are spi drivers (using the spi framework) having different values of the CPHA bit. (different modes according to SPI framework)

 

The master (2007R1.1RC3) does not cope with this and I notice multiple cs activated when only accessing one device. I have made som changes in the driver for my system which works fine, but I'm pretty sure it doesn't handle all cases. Just want to start a discussion......

 

I think the problem is that both CPHA 1 and CPHA 0 uses the same cs_active and cs_deactive functions.

 

Before:

 

/* Chip select operation functions for cs_change flag */

static void cs_active(struct chip_data *chip)

{

        u16 flag = read_FLAG();

 

        flag |= chip->flag;

        flag &= ~(chip->flag << 8);

 

        write_FLAG(flag);

}

 

static void cs_deactive(struct chip_data *chip)

{

        u16 flag = read_FLAG();

      

        flag |= (chip->flag << 8);

 

        write_FLAG(flag);

}

 

////////////////////////////////////////////////////////////////

 

After changes:

 

/* Chip select operation functions for cs_change flag */

static void cs_active(struct chip_data *chip)

{

        u16 flag = read_FLAG();

 

        flag = chip->flag;

      

        write_FLAG(flag);

}

 

static void cs_deactive(struct chip_data *chip)

{

        u16 flag = read_FLAG();

      

        if (chip->ctl_reg & CPHA)

                flag |= (chip->flag << 8);

        else

                flag = 0xff00; //reset of FLAG register

      

        write_FLAG(flag);

}

 

I haven't looked in the trunk, maybe this is already solved.

 

regards,

 

/Mattias

QuoteReplyEditDelete

 

 

2007-11-20 11:06:47     Re: spi_master handling of spi-drivers with different values of CPHA

Mike Frysinger (UNITED STATES)

Message: 47112    the SPI MODE stuff did go through some fixes in trunk ... while developing a device driver that works in SPI MODE 3, i recall looking at the waveforms for the different modes and they should work in trunk ...

QuoteReplyEditDelete

 

 

2008-02-07 20:49:46     Re: spi_master handling of spi-drivers with different values of CPHA

Rob D (UNITED STATES)

Message: 50840    I can confirm that this issue isn't fixed when using the BF548 (2008R1-RC1).

 

When using SPI_MODE_0 with multiple slave devices, the slave select line of _both_ get asserted when writing to either device.

 

-Rob

Attachments

    Outcomes