All of lore.kernel.org
 help / color / mirror / Atom feed
* spi 3wire support for ST MEMs sensors
@ 2017-06-09  9:30 Lorenzo Bianconi
  2017-06-11 11:09 ` Jonathan Cameron
  0 siblings, 1 reply; 3+ messages in thread
From: Lorenzo Bianconi @ 2017-06-09  9:30 UTC (permalink / raw)
  To: linux-iio

Hi all,

I started working on supporting spi-3wire mode in some STM MEMs
drivers and I am facing a tricky issue. Let's consider the driver for
LSM303AGR accel device
(http://www.st.com/resource/en/datasheet/lsm303agr.pdf). The sensor is
configured by default in spi 4 wire mode (BIT 0 in register 0x23) but
the package does not export the MISO line for accelerometer. The only
way to support spi is to enable 3-wire at bootstrap. I am wondering
how to figure out the correct register address since it is not
possible to read the device whoami. The only way that come up to my
mind is to add a lookup table in st_accel_spi.c based on
spi_device_id. Is there something better? Or should I just remove the
spi support for LSM303AGR? Thanks

Regards,
Lorenzo

-- 
UNIX is Sexy: who | grep -i blonde | talk; cd ~; wine; talk; touch;
unzip; touch; strip; gasp; finger; gasp; mount; fsck; more; yes; gasp;
umount; make clean; sleep

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

* Re: spi 3wire support for ST MEMs sensors
  2017-06-09  9:30 spi 3wire support for ST MEMs sensors Lorenzo Bianconi
@ 2017-06-11 11:09 ` Jonathan Cameron
  2017-06-11 19:50   ` Lorenzo Bianconi
  0 siblings, 1 reply; 3+ messages in thread
From: Jonathan Cameron @ 2017-06-11 11:09 UTC (permalink / raw)
  To: Lorenzo Bianconi; +Cc: linux-iio

On Fri, 9 Jun 2017 11:30:00 +0200
Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> wrote:

> Hi all,
> 
> I started working on supporting spi-3wire mode in some STM MEMs
> drivers and I am facing a tricky issue. Let's consider the driver for
> LSM303AGR accel device
> (http://www.st.com/resource/en/datasheet/lsm303agr.pdf). The sensor is
> configured by default in spi 4 wire mode (BIT 0 in register 0x23) but
> the package does not export the MISO line for accelerometer. The only
> way to support spi is to enable 3-wire at bootstrap. I am wondering
> how to figure out the correct register address since it is not
> possible to read the device whoami. The only way that come up to my
> mind is to add a lookup table in st_accel_spi.c based on
> spi_device_id. Is there something better? Or should I just remove the
> spi support for LSM303AGR? Thanks
> 
> Regards,
> Lorenzo
> 

Hi Lorenzo,

Look up table is probably the best option when a device only supports
3 wire mode.

However, don't we need DT of ACPI to provide info on whether a 3 wire
bus is being used?  If so can we query it from the spi core?

Jonathan

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

* Re: spi 3wire support for ST MEMs sensors
  2017-06-11 11:09 ` Jonathan Cameron
@ 2017-06-11 19:50   ` Lorenzo Bianconi
  0 siblings, 0 replies; 3+ messages in thread
From: Lorenzo Bianconi @ 2017-06-11 19:50 UTC (permalink / raw)
  To: Jonathan Cameron; +Cc: linux-iio

> On Fri, 9 Jun 2017 11:30:00 +0200
> Lorenzo Bianconi <lorenzo.bianconi83@gmail.com> wrote:
>
>> Hi all,
>>
>> I started working on supporting spi-3wire mode in some STM MEMs
>> drivers and I am facing a tricky issue. Let's consider the driver for
>> LSM303AGR accel device
>> (http://www.st.com/resource/en/datasheet/lsm303agr.pdf). The sensor is
>> configured by default in spi 4 wire mode (BIT 0 in register 0x23) but
>> the package does not export the MISO line for accelerometer. The only
>> way to support spi is to enable 3-wire at bootstrap. I am wondering
>> how to figure out the correct register address since it is not
>> possible to read the device whoami. The only way that come up to my
>> mind is to add a lookup table in st_accel_spi.c based on
>> spi_device_id. Is there something better? Or should I just remove the
>> spi support for LSM303AGR? Thanks
>>
>> Regards,
>> Lorenzo
>>
>
> Hi Lorenzo,
>

Hi Jonathan,

> Look up table is probably the best option when a device only supports
> 3 wire mode.
>
> However, don't we need DT of ACPI to provide info on whether a 3 wire
> bus is being used?  If so can we query it from the spi core?
>

Right, the user has to request the 3-wire mode using the standard
spi-3wire property.

> Jonathan

Regards,
Lorenzo

-- 
UNIX is Sexy: who | grep -i blonde | talk; cd ~; wine; talk; touch;
unzip; touch; strip; gasp; finger; gasp; mount; fsck; more; yes; gasp;
umount; make clean; sleep

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

end of thread, other threads:[~2017-06-11 19:50 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-06-09  9:30 spi 3wire support for ST MEMs sensors Lorenzo Bianconi
2017-06-11 11:09 ` Jonathan Cameron
2017-06-11 19:50   ` Lorenzo Bianconi

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.