All of lore.kernel.org
 help / color / mirror / Atom feed
* adding bits_per_word to struct spi_board_info to mirror struct spi_device
@ 2007-04-25 10:05 Mike Frysinger
  2007-04-25 15:13 ` [spi-devel-general] " David Brownell
  0 siblings, 1 reply; 8+ messages in thread
From: Mike Frysinger @ 2007-04-25 10:05 UTC (permalink / raw)
  To: dbrownell; +Cc: spi-devel-general, Linux Kernel Mailing List, Wu, Bryan

the spi_device structure has a bits_per_word so that you can change
the value on a per-device setting, yet the spi_board_info structure
does not ... this means that the bus-specific structure has to have a
bits_per_word member which the spi bus driver will copy into the spi
device bits_per_word member

is there something obvious i'm missing ?  seems to me that if the
generic spi framework respects bits_per_word on a per-spi device
basis, then it should be exposed in the generic info structure so that
the setting can be tracked in the boards file ...
-mike

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [spi-devel-general] adding bits_per_word to struct spi_board_info to mirror struct spi_device
  2007-04-25 10:05 adding bits_per_word to struct spi_board_info to mirror struct spi_device Mike Frysinger
@ 2007-04-25 15:13 ` David Brownell
  2007-05-07 23:47   ` Mike Frysinger
  0 siblings, 1 reply; 8+ messages in thread
From: David Brownell @ 2007-04-25 15:13 UTC (permalink / raw)
  To: spi-devel-general; +Cc: Mike Frysinger, Wu, Bryan, Linux Kernel Mailing List

On Wednesday 25 April 2007, Mike Frysinger wrote:
> the spi_device structure has a bits_per_word so that you can change
> the value on a per-device setting, yet the spi_board_info structure
> does not ... this means that the bus-specific structure has to have a
> bits_per_word member which the spi bus driver will copy into the spi
> device bits_per_word member

Actually that's more likely a driver-specific characteristic than
something related to board wiring/configuration ... a characteristic
of the particular protocol requests being made.  That's why for
example bits_per_word has a per-transfer override, and drivers are
able to call spi_setup(spi).


> is there something obvious i'm missing ?  seems to me that if the
> generic spi framework respects bits_per_word on a per-spi device
> basis, then it should be exposed in the generic info structure so that
> the setting can be tracked in the boards file ...

The initial driver set didn't need it, that's all.  ISTR someone
else pointed out this quirk, but never provided a patch to resolve
the issue.

- Dave

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [spi-devel-general] adding bits_per_word to struct spi_board_info to mirror struct spi_device
  2007-04-25 15:13 ` [spi-devel-general] " David Brownell
@ 2007-05-07 23:47   ` Mike Frysinger
  2007-05-08  3:48     ` Bryan WU
  2007-05-08  4:53     ` David Brownell
  0 siblings, 2 replies; 8+ messages in thread
From: Mike Frysinger @ 2007-05-07 23:47 UTC (permalink / raw)
  To: David Brownell; +Cc: spi-devel-general, Wu, Bryan, Linux Kernel Mailing List

On 4/25/07, David Brownell <david-b@pacbell.net> wrote:
> On Wednesday 25 April 2007, Mike Frysinger wrote:
> > the spi_device structure has a bits_per_word so that you can change
> > the value on a per-device setting, yet the spi_board_info structure
> > does not ... this means that the bus-specific structure has to have a
> > bits_per_word member which the spi bus driver will copy into the spi
> > device bits_per_word member
>
> Actually that's more likely a driver-specific characteristic than
> something related to board wiring/configuration ... a characteristic
> of the particular protocol requests being made.  That's why for
> example bits_per_word has a per-transfer override, and drivers are
> able to call spi_setup(spi).

hmm, true ...

> > is there something obvious i'm missing ?  seems to me that if the
> > generic spi framework respects bits_per_word on a per-spi device
> > basis, then it should be exposed in the generic info structure so that
> > the setting can be tracked in the boards file ...
>
> The initial driver set didn't need it, that's all.  ISTR someone
> else pointed out this quirk, but never provided a patch to resolve
> the issue.

so which direction should it be ?  or should it be both ? :)

Blackfin at the moment is doing DMA/bits_per_word setup in the boards
... we could move these to the drivers and have each one just call
spi_setup() at init, or i could post a patch for the common framework
if you think that's an OK direction to [also] go ...
-mike

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [spi-devel-general] adding bits_per_word to struct spi_board_info to mirror struct spi_device
  2007-05-07 23:47   ` Mike Frysinger
@ 2007-05-08  3:48     ` Bryan WU
  2007-05-08  5:00       ` David Brownell
  2007-05-08  4:53     ` David Brownell
  1 sibling, 1 reply; 8+ messages in thread
From: Bryan WU @ 2007-05-08  3:48 UTC (permalink / raw)
  To: David Brownell, Mike Frysinger
  Cc: spi-devel-general, Linux Kernel Mailing List

On Mon, 2007-05-07 at 19:47 -0400, Mike Frysinger wrote:
> On 4/25/07, David Brownell <david-b@pacbell.net> wrote:
> > On Wednesday 25 April 2007, Mike Frysinger wrote:
> > > the spi_device structure has a bits_per_word so that you can change
> > > the value on a per-device setting, yet the spi_board_info structure
> > > does not ... this means that the bus-specific structure has to have a
> > > bits_per_word member which the spi bus driver will copy into the spi
> > > device bits_per_word member
> >
> > Actually that's more likely a driver-specific characteristic than
> > something related to board wiring/configuration ... a characteristic
> > of the particular protocol requests being made.  That's why for
> > example bits_per_word has a per-transfer override, and drivers are
> > able to call spi_setup(spi).
> 
> hmm, true ...
> 
> > > is there something obvious i'm missing ?  seems to me that if the
> > > generic spi framework respects bits_per_word on a per-spi device
> > > basis, then it should be exposed in the generic info structure so that
> > > the setting can be tracked in the boards file ...
> >
> > The initial driver set didn't need it, that's all.  ISTR someone
> > else pointed out this quirk, but never provided a patch to resolve
> > the issue.
> 
> so which direction should it be ?  or should it be both ? :)
> 
> Blackfin at the moment is doing DMA/bits_per_word setup in the boards
> ... we could move these to the drivers and have each one just call
> spi_setup() at init, or i could post a patch for the common framework
> if you think that's an OK direction to [also] go ...
> -mike

Yes, it is very common for spi_framework. DMA setting as well as
bits_per_word setup should be imported to spi_board_info struct. And
currently, there are some duplicated data members in spi_device struct
spi_board_info struct. This two structs are confused driver writers and
boards driver users.

Thanks
-Bryan Wu

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [spi-devel-general] adding bits_per_word to struct spi_board_info to mirror struct spi_device
  2007-05-07 23:47   ` Mike Frysinger
  2007-05-08  3:48     ` Bryan WU
@ 2007-05-08  4:53     ` David Brownell
  2007-05-08  5:24       ` Mike Frysinger
  1 sibling, 1 reply; 8+ messages in thread
From: David Brownell @ 2007-05-08  4:53 UTC (permalink / raw)
  To: Mike Frysinger; +Cc: spi-devel-general, Wu, Bryan, Linux Kernel Mailing List

On Monday 07 May 2007, Mike Frysinger wrote:
> On 4/25/07, David Brownell <david-b@pacbell.net> wrote:
> > On Wednesday 25 April 2007, Mike Frysinger wrote:
> 
> > > is there something obvious i'm missing ?  seems to me that if the
> > > generic spi framework respects bits_per_word on a per-spi device
> > > basis, then it should be exposed in the generic info structure so that
> > > the setting can be tracked in the boards file ...
> >
> > The initial driver set didn't need it, that's all.  ISTR someone
> > else pointed out this quirk, but never provided a patch to resolve
> > the issue.
> 
> so which direction should it be ?  or should it be both ? :)

Add bits_per_word to spi_board_info, and have the device creation
logic copy it into spi_device as it's created.


> Blackfin at the moment is doing DMA/bits_per_word setup in the boards
> ... we could move these to the drivers and have each one just call
> spi_setup() at init, or i could post a patch for the common framework
> if you think that's an OK direction to [also] go ...

I don't see what you're getting at here.  The SPI core doesn't
do anything with DMA, beyond passing DMA addresses through when
necessary.  (Needed to handle messages derived from scatterlists,
since I don't want lower layers to know scatterlists, but otherwise
uncommon.)

And when each spi_device is created, the core calls spi_setup()
with the data.  That seems like the natural place to set up
things like DMA and so forth...

The pxa2xx_spi driver uses spi_board_info.controller_data to pass
dma setup/tuning data from board init logic.  

- Dave

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [spi-devel-general] adding bits_per_word to struct spi_board_info to mirror struct spi_device
  2007-05-08  3:48     ` Bryan WU
@ 2007-05-08  5:00       ` David Brownell
  2007-05-08  7:31         ` Bryan WU
  0 siblings, 1 reply; 8+ messages in thread
From: David Brownell @ 2007-05-08  5:00 UTC (permalink / raw)
  To: Bryan WU; +Cc: Mike Frysinger, spi-devel-general, Linux Kernel Mailing List

On Monday 07 May 2007, Bryan WU wrote:

> currently, there are some duplicated data members in spi_device struct
> spi_board_info struct. This two structs are confused driver writers and
> boards driver users.

How would that confusion arise?  Only arch/.../board-xxx.c writers
normally even see spi_board_info; the exception is that someone who
writes an add-on board -- maybe a USB-to-SPI adapter -- would call the
rarely used spi_new_device() routine.

Developers writing a SPI drivers -- controller drivers touching some
SOC's serial controller hardware, or "struct spi_driver" protocol code
talking to a chip through such a controller -- never see board info.
They only see "struct spi_device".  So I don't see why they would have
a reason to be confused.

- Dave


^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [spi-devel-general] adding bits_per_word to struct spi_board_info to mirror struct spi_device
  2007-05-08  4:53     ` David Brownell
@ 2007-05-08  5:24       ` Mike Frysinger
  0 siblings, 0 replies; 8+ messages in thread
From: Mike Frysinger @ 2007-05-08  5:24 UTC (permalink / raw)
  To: David Brownell; +Cc: spi-devel-general, Wu, Bryan, Linux Kernel Mailing List

On 5/8/07, David Brownell <david-b@pacbell.net> wrote:
> On Monday 07 May 2007, Mike Frysinger wrote:
> > On 4/25/07, David Brownell <david-b@pacbell.net> wrote:
> > > On Wednesday 25 April 2007, Mike Frysinger wrote:
> > > > is there something obvious i'm missing ?  seems to me that if the
> > > > generic spi framework respects bits_per_word on a per-spi device
> > > > basis, then it should be exposed in the generic info structure so that
> > > > the setting can be tracked in the boards file ...
> > >
> > > The initial driver set didn't need it, that's all.  ISTR someone
> > > else pointed out this quirk, but never provided a patch to resolve
> > > the issue.
> >
> > so which direction should it be ?  or should it be both ? :)
>
> Add bits_per_word to spi_board_info, and have the device creation
> logic copy it into spi_device as it's created.

OK

> > Blackfin at the moment is doing DMA/bits_per_word setup in the boards
> > ... we could move these to the drivers and have each one just call
> > spi_setup() at init, or i could post a patch for the common framework
> > if you think that's an OK direction to [also] go ...
>
> I don't see what you're getting at here.  The SPI core doesn't
> do anything with DMA, beyond passing DMA addresses through when
> necessary.  (Needed to handle messages derived from scatterlists,
> since I don't want lower layers to know scatterlists, but otherwise
> uncommon.)

sorry, i didnt mean to confuse things ... i was referring to the only
things that we are configuring at the moment on a per-spi device basis
in Blackfin is bits_per_word and DMA status ... when i said posting a
patch for common framework, i was referring to just bits_per_word
-mike

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [spi-devel-general] adding bits_per_word to struct spi_board_info to mirror struct spi_device
  2007-05-08  5:00       ` David Brownell
@ 2007-05-08  7:31         ` Bryan WU
  0 siblings, 0 replies; 8+ messages in thread
From: Bryan WU @ 2007-05-08  7:31 UTC (permalink / raw)
  To: David Brownell
  Cc: Mike Frysinger, spi-devel-general, Linux Kernel Mailing List

On Mon, 2007-05-07 at 22:00 -0700, David Brownell wrote:
> On Monday 07 May 2007, Bryan WU wrote:
> 
> > currently, there are some duplicated data members in spi_device struct
> > spi_board_info struct. This two structs are confused driver writers and
> > boards driver users.
> 
> How would that confusion arise?  Only arch/.../board-xxx.c writers
> normally even see spi_board_info; the exception is that someone who
> writes an add-on board -- maybe a USB-to-SPI adapter -- would call the
> rarely used spi_new_device() routine.
> 
> Developers writing a SPI drivers -- controller drivers touching some
> SOC's serial controller hardware, or "struct spi_driver" protocol code
> talking to a chip through such a controller -- never see board info.
> They only see "struct spi_device".  So I don't see why they would have
> a reason to be confused.
> 
> - Dave

Yes, I agree with you.
spi_board_info ---> board writers.
spi_device ---> spi device driver writers.

It is very clear for me, a spi_master driver developer.

But how does a board writer know the capabilities which the target
spi_device driver supports? For example, a board writer use 16
bits_per_word in a spi_board_info, while the spi_device does not support
this. And maybe other special function spi_device driver can provide but
board writer doesn't know or doesn't know how to use this in
spi_board_info.

So can we just use one struct for both board writers and spi device
driver developers?

Thanks
-Bryan Wu


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-05-08  7:30 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-04-25 10:05 adding bits_per_word to struct spi_board_info to mirror struct spi_device Mike Frysinger
2007-04-25 15:13 ` [spi-devel-general] " David Brownell
2007-05-07 23:47   ` Mike Frysinger
2007-05-08  3:48     ` Bryan WU
2007-05-08  5:00       ` David Brownell
2007-05-08  7:31         ` Bryan WU
2007-05-08  4:53     ` David Brownell
2007-05-08  5:24       ` Mike Frysinger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.