linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: leroy christophe <christophe.leroy@c-s.fr>
Cc: Mark Brown <broonie@kernel.org>,
	linuxppc-dev@lists.ozlabs.org, linux-kernel@vger.kernel.org,
	linux-spi@vger.kernel.org
Subject: Re: [PATCH v2 1/2] spi: fsl-spi: Fix parameter ram offset setup for CPM1
Date: Wed, 8 Oct 2014 11:30:27 -0500	[thread overview]
Message-ID: <1412785827.13320.532.camel@snotra.buserror.net> (raw)
In-Reply-To: <5435649F.5070908@c-s.fr>

On Wed, 2014-10-08 at 18:21 +0200, leroy christophe wrote:
> Le 07/10/2014 02:15, Scott Wood a écrit :
> > On Sat, 2014-10-04 at 14:02 +0200, christophe leroy wrote:
> >> What should it look like if that offset had to be in the device tree ?
> > If the offset is not relocatable or discoverable, it should stay in the
> > device tree.  If you have an old chip you wouldn't have
> > fsl,cpm1-spi-reloc and thus you'd still have "0x3d80 0x30" in reg.
> This index is from the start of the dual port RAM. It is 0x2000 above 
> the start of the CPM area.
> In the DTS, we have:
> 
>      soc@ff000000 {
>          compatible = "fsl,mpc885", "fsl,pq1-soc";
>          #address-cells = <1>;
>          #size-cells = <1>;
>          device_type = "soc";
>          ranges = <0x0 0xff000000 0x28000>;
>          bus-frequency = <0>;
>          clock-frequency = <0>;
> 
>          cpm@9c0 {
>              #address-cells = <1>;
>              #size-cells = <1>;
>              compatible = "fsl,mpc885-cpm", "fsl,cpm1";
>              ranges;
>              reg = <0x9c0 0x40>;
>              brg-frequency = <0>;
>              interrupts = <0>;    // cpm error interrupt
>              interrupt-parent = <&CPM_PIC>;
> 
>              muram@2000 {
>                  #address-cells = <1>;
>                  #size-cells = <1>;
>                  ranges = <0x0 0x2000 0x2000>;
> 
>                  data@0 {
>                      compatible = "fsl,cpm-muram-data";
>                      reg = <0x0 0x1c00>;
>                  };
>              };
> 
>              spi: spi@a80 {
>                  #address-cells = <1>;
>                  #size-cells = <0>;
>                  cell-index = <0>;
>                  compatible = "fsl,spi", "fsl,cpm1-spi";
>                  reg = <0xa80 0x30 0x3d80 0x30>;
>                  interrupts = <5>;
>                  interrupt-parent = <&CPM_PIC>;
>                  mode = "cpu";
> 
> 
> The binding allows me to do an of_iomap() on the parameter RAM, hence to 
> get access to the relocation index which is inside it.
> But if the relocation index is 0, I have to calculate it by myself 
> because the calling function expects it in return.
> The binding is also supposed to tell that the muram is at 0xff002000. 
> But I don't know how I can get this info and use it to calculate the 
> index of my param RAM ? I need to calculate the index which is 1d80 
> (0x3d80 - 0x2000)

What binding are you talking about?  There is no published binding for
this yet.

As for what the driver should do, it should do an of_iomap(), but what
it does with the resulting memory depends on the compatible.  For
fsl,cpm1-spi, the result would be the parameter RAM for the device.  For
fsl,cpm1-spi-reloc and fsl,cpm2-spi, it would be the relocation
register.  The driver would either read the contents of the register, or
write a different offset.

My understanding is that the relocation register would only be zero on
the chips where we'd use fsl,cpm1-spi, not fsl,cpm1-spi-reloc.

-Scott

      reply	other threads:[~2014-10-08 16:30 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-03 16:49 [PATCH v2 1/2] spi: fsl-spi: Fix parameter ram offset setup for CPM1 Christophe Leroy
2014-10-03 20:29 ` Scott Wood
2014-10-04 12:02   ` christophe leroy
2014-10-07  0:15     ` Scott Wood
2014-10-08 16:21       ` leroy christophe
2014-10-08 16:30         ` Scott Wood [this message]

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=1412785827.13320.532.camel@snotra.buserror.net \
    --to=scottwood@freescale.com \
    --cc=broonie@kernel.org \
    --cc=christophe.leroy@c-s.fr \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    /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;
as well as URLs for NNTP newsgroup(s).