mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Philippe Rétornaz" <philippe.retornaz@epfl.ch>
To: marc@cpdesign.com.au
Cc: "Fabio Estevam" <festevam@gmail.com>,
	"Shawn Guo" <shawn.guo@freescale.com>,
	"Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>,
	"Mark Brown" <broonie@opensource.wolfsonmicro.com>,
	"Samuel Ortiz" <sameo@linux.intel.com>,
	"Sascha Hauer" <kernel@pengutronix.de>,
	linux-kernel <linux-kernel@vger.kernel.org>
Subject: Re: mc13xxx-core: kernel hangs after 'regmap_read'
Date: Thu, 24 May 2012 18:16:50 +0200	[thread overview]
Message-ID: <5844466.kI7qR0Os9A@laptop> (raw)
In-Reply-To: <201205242338.41420.marc@cpdesign.com.au>

> > Still reading 0x810 for all registers (0x810000 is the value of
> > register 0 , btw).
> 
> This could mean that all the registers are being sent as 0 and the value is
> shifted by 12 bits. (which is a bit weird). It's also a strange that Shawn's
> board seems to work.
> 
> Do you have any other devices on that SPI that you can verify are working
> correctly? (you said it worked from the bootloader, I'm running out of
> ideas... :| )


Well, I think I found out why it's not working on mc13783.
With regmap, each transfert is done with 8bits words. The SPI hardware assert 
the SS signal only during 8 bits "register" transfert then deassert the SS. 
Then the SS is asserted and 24bits (3 bytes) are transfered (datas).
This clearly violate the datasheet which say SS must be asserted for the 
*whole* transfert: register + data.

This is why the old code used a 32bits word transfert, it ensured that the SPI 
hardware was keeping SS asserted without interruptions.

Is there any way to tell regmap to use 32bits transfert with the following 
configuration (or doing it in a single shot 4x8bits):
To read register 0x42 we need to "write" to SPI:

0x42 << 24

and the mc13783 will answer immediatly in the low-24 bits of the _same_ spi 
exchange.

to write register 0x42 we need to "write" to SPI:

(0x80 | 0x42) << 24  | data

I have an oscilloscope screenshot of a transfert if needed.

Regards,

Philippe





  reply	other threads:[~2012-05-24 16:16 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-21 16:06 Fabio Estevam
2012-05-22  0:53 ` Marc Reilly
2012-05-22  9:25   ` Mark Brown
2012-05-22 11:40     ` Fabio Estevam
2012-05-22 12:48       ` Philippe Rétornaz
2012-05-22 14:45     ` Fabio Estevam
2012-05-23  1:12   ` Fabio Estevam
2012-05-23  2:05     ` Fabio Estevam
2012-05-23  8:49       ` Mark Brown
2012-05-23 14:18         ` Fabio Estevam
2012-05-23 15:29           ` Fabio Estevam
2012-05-23 17:36           ` Mark Brown
2012-05-23 19:32             ` Fabio Estevam
2012-05-23 16:42         ` Shawn Guo
2012-05-23 16:34           ` Fabio Estevam
2012-05-24  0:48             ` Shawn Guo
2012-05-24  4:07               ` Fabio Estevam
2012-05-24  6:04                 ` Shawn Guo
2012-05-24  6:39                 ` Shawn Guo
2012-05-24  6:46                   ` Uwe Kleine-König
2012-05-24  7:33                     ` Shawn Guo
2012-05-24  9:08                       ` Marc Reilly
2012-05-24 10:37                         ` Mark Brown
2012-05-24 11:22                           ` Marc Reilly
2012-05-24 12:14                             ` Mark Brown
2012-05-24 13:06                               ` Marc Reilly
2012-05-24 16:37                                 ` Mark Brown
2012-05-24 13:01                         ` Fabio Estevam
2012-05-24 13:38                           ` Marc Reilly
2012-05-24 16:16                             ` Philippe Rétornaz [this message]
2012-05-24 16:36                               ` Mark Brown
2012-05-24 16:41                                 ` Uwe Kleine-König
2012-05-24 17:39                                   ` Fabio Estevam
2012-05-24 18:03                                     ` Mark Brown
2012-05-24 19:42                                       ` philippe.retornaz
2012-05-24 22:21                                         ` Mark Brown
2012-05-25  8:56                         ` Shawn Guo

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5844466.kI7qR0Os9A@laptop \
    --to=philippe.retornaz@epfl.ch \
    --cc=broonie@opensource.wolfsonmicro.com \
    --cc=festevam@gmail.com \
    --cc=kernel@pengutronix.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marc@cpdesign.com.au \
    --cc=sameo@linux.intel.com \
    --cc=shawn.guo@freescale.com \
    --cc=u.kleine-koenig@pengutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®