Re: svn commit: r238965 - head/sys/dev/spibus

2012-08-01 Thread Aleksandr Rybalko
On Wed, 1 Aug 2012 01:18:36 + (UTC)
Warner Losh  wrote:

>> Author: imp
>> Date: Wed Aug  1 01:18:36 2012
>> New Revision: 238965
>> URL: http://svn.freebsd.org/changeset/base/238965
>> 
>> Log:
>>   Add the chip select glue.
>> 
>> Modified:
>>   head/sys/dev/spibus/spi.h
>>   head/sys/dev/spibus/spibus.c
>> 
>> Modified: head/sys/dev/spibus/spi.h
>> ==
>> --- head/sys/dev/spibus/spi.hWed Aug  1 00:36:12 2012
>> (r238964) +++ head/sys/dev/spibus/spi.h  Wed Aug  1 01:18:36
>> 2012 (r238965) @@ -1,6 +1,7 @@
>>  /* $FreeBSD$ */
>>  
>>  struct spi_command {
>> +int cs;
>>  void*tx_cmd;
>>  uint32_t tx_cmd_sz;
>>  void*rx_cmd;
>> @@ -10,3 +11,5 @@ struct spi_command {
>>  void*rx_data;
>>  uint32_t rx_data_sz;
>>  };
>> +
>> +#define SPI_CHIP_SELECT_HIGH0x1 /*
>> Chip select high (else low) */
>> 
>> Modified: head/sys/dev/spibus/spibus.c
>> ==
>> --- head/sys/dev/spibus/spibus.c Wed Aug  1 00:36:12
>> 2012 (r238964) +++ head/sys/dev/spibus/spibus.c  Wed
>> Aug  1 01:18:36 2012 (r238965) @@ -158,6 +158,9 @@
>> spibus_hinted_child(device_t bus, const static int
>>  spibus_transfer_impl(device_t dev, device_t child, struct
>> spi_command *cmd) {
>> +/* Maybe set flags too? spi mode? */
>> +spibus_get_cs(dev, &cmd->cs);
>> +
>>  return (SPIBUS_TRANSFER(device_get_parent(dev), child,
>> cmd)); }
>>  

Hi Warner,

why don't get cs from IVARs in the SPIBUS_TRANSFER method?
In many spi drivers it's done this way.
For example in sys/mips/atheros/ar71xx_spi.c.

WBW
-- 
Alexandr Rybalko  
aka Alex RAY 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r238965 - head/sys/dev/spibus

2012-07-31 Thread Warner Losh
Author: imp
Date: Wed Aug  1 01:18:36 2012
New Revision: 238965
URL: http://svn.freebsd.org/changeset/base/238965

Log:
  Add the chip select glue.

Modified:
  head/sys/dev/spibus/spi.h
  head/sys/dev/spibus/spibus.c

Modified: head/sys/dev/spibus/spi.h
==
--- head/sys/dev/spibus/spi.h   Wed Aug  1 00:36:12 2012(r238964)
+++ head/sys/dev/spibus/spi.h   Wed Aug  1 01:18:36 2012(r238965)
@@ -1,6 +1,7 @@
 /* $FreeBSD$ */
 
 struct spi_command {
+   int cs;
void*tx_cmd;
uint32_t tx_cmd_sz;
void*rx_cmd;
@@ -10,3 +11,5 @@ struct spi_command {
void*rx_data;
uint32_t rx_data_sz;
 };
+
+#defineSPI_CHIP_SELECT_HIGH0x1 /* Chip select high 
(else low) */

Modified: head/sys/dev/spibus/spibus.c
==
--- head/sys/dev/spibus/spibus.cWed Aug  1 00:36:12 2012
(r238964)
+++ head/sys/dev/spibus/spibus.cWed Aug  1 01:18:36 2012
(r238965)
@@ -158,6 +158,9 @@ spibus_hinted_child(device_t bus, const 
 static int
 spibus_transfer_impl(device_t dev, device_t child, struct spi_command *cmd)
 {
+   /* Maybe set flags too? spi mode? */
+   spibus_get_cs(dev, &cmd->cs);
+
return (SPIBUS_TRANSFER(device_get_parent(dev), child, cmd));
 }
 
___
svn-src-head@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"