public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Vignesh R <vigneshr@ti.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] omap3 spi registers
Date: Wed, 18 May 2016 14:14:12 +0530	[thread overview]
Message-ID: <573C2B5C.30308@ti.com> (raw)
In-Reply-To: <CAKmi1bVCawS0L=gx+CBshWCi7SXyW61qqz=OW5t4dEwMS=jzdg@mail.gmail.com>

Hi,

On 05/12/2016 06:14 PM, Martin Hejnfelt wrote:
> Hi,
> 
> I am working with a board based off the am335x CPU and I am going to
> use SPI through u-boot. I've therefore been fiddling with u-boot and
> enabling spi0 through devicetree and all, which works fine (at least
> probing and so on). I am using CONFIG_DM_SPI for this, and
> u-boot-2016.05-rc3.
> However when I try to access the SPI peripheral, u-boot hanged.
> 
> Debugging through this showed that the culprit lies within the
> spi_reset call inside omap3_spi.c when the SPI bus is being claimed.
> The function tries to write to the sysconfig register, based 0x110 off
> the BASE. Problem is that the base defined in device tree include I am
> basing myself off (am335x.dtsi) is 0x48030000, and the offset is
> defined to 0x10, which means the register being written to is
> 0x48030010 and not 0x48030110 as it is supposed to, again resulting in
> the hang due to the endless do-while loop in spi_reset. This I guess
> is due to this part priv->regs = (struct mcspi *)dev_get_addr(dev); of
> omap3_spi_probe as it reads the reg property off the device tree.
> 
> OK, so for my question, what is really the correct way to fix this?
> 0x48030000 is the "real" base of McSPI0, although the first 0x100 part
> is revision stuff according to the technical datasheet of the am335x.
> If I change the reg value of the device tree to 0x48030100 then it
> does not hang, reset seems to work fine, however I have no idea of the
> influences this will have (the device tree is also used in the kernel
> and so on), I would guess its not the "right" way.
> 
> Any input/output is appreciated.
> 

I think, the right to handle this is based on compatible as done in
kernel driver (drivers/spi/spi-omap2-mcspi.c)
Something like, if compatible is "ti,omap4-mcspi" then add offset 0x100
to regs property


-- 
Regards
Vignesh

  reply	other threads:[~2016-05-18  8:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-12 12:44 [U-Boot] omap3 spi registers Martin Hejnfelt
2016-05-18  8:44 ` Vignesh R [this message]
2016-05-18  9:10   ` Martin Hejnfelt
2016-05-18 11:51     ` Martin Hejnfelt

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=573C2B5C.30308@ti.com \
    --to=vigneshr@ti.com \
    --cc=u-boot@lists.denx.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