linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Thor Thayer <tthayer@opensource.altera.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: <broonie@kernel.org>, <grant.likely@linaro.org>,
	<jkosina@suse.cz>, <pawel.moll@arm.com>, <robh+dt@kernel.org>,
	<mark.rutland@arm.com>, <ijc+devicetree@hellion.org.uk>,
	<dinguyen@opensource.altera.com>, <linux-doc@vger.kernel.org>,
	<linux-spi@vger.kernel.org>, <devicetree@vger.kernel.org>,
	<tthayer.linux@gmail.com>, <axel.lin@ingics.com>,
	<baruch@tkos.co.il>, <jg1.han@samsung.com>,
	<galak@codeaurora.org>
Subject: Re: [RFC/PATCH 0/2] spi: spi-dw: Select 16b or 32b register access
Date: Fri, 6 Mar 2015 17:06:00 -0600	[thread overview]
Message-ID: <54FA32D8.8010704@opensource.altera.com> (raw)
In-Reply-To: <1425592455.14897.193.camel@linux.intel.com>



On 03/05/2015 03:54 PM, Andy Shevchenko wrote:
> On Thu, 2015-03-05 at 14:41 -0600, Thor Thayer wrote:
>> Hi Andy,
>>
>> On 03/05/2015 04:43 AM, Andy Shevchenko wrote:
>>> On Wed, 2015-03-04 at 16:01 -0600, Thor Thayer wrote:
>>>> Hi Andy,
>>>>
>>>> On 03/04/2015 02:44 PM, Andy Shevchenko wrote:
>>>>> On Wed, 2015-03-04 at 14:31 -0600, tthayer@opensource.altera.com wrote:
>>>>>> From: Thor Thayer <tthayer@opensource.altera.com>
>>>>>>
>>>>>> The Altera Arria10 SoC requires 32 bit accesses to peripherals. The
>>>>>> DesignWare SPI peripheral registers are on 32bit boundaries so this
>>>>>> patch is minimal. Function pointers are used to select 32bit access
>>>>>> or 16bit accesses.
>>>>>
>>>>>
>>>>> So, what is exactly the issue when we read only half of the register?
>>>>> Bus lock, or what?
>>>>>
>>>>
>>>> The read actually works on our chip but I changed both read and write to
>>>> be consistent. For Arria10, on a 16 bit write the data isn't written
>>>> into the DesignWare register.
>>>
>>> How did you exactly check this?
>>>
>>
>> Sorry, I should have been more clear. The architecture of the Arria10
>> SoC enforces 32 bit writes - even for the APB bus. The Arria10's
>> interconnect only allows 32 bit writes.
>
> Hmm… So, reads are okay, but writes are 32 bit only? Have you any link
> to the documentation where I could read this?
>

Currently Table 7-6 in the Arria10 Technical Reference Manual [1] on 
page 141 shows SPI Master as a 32 bit wide interface but it doesn't 
explicitly note the 32bit write requirement. We're adding a note to 
table 7-6 as a result of this discussion.

[1] http://www.altera.com/literature/hb/arria-10/a10_5v4.pdf

>> As a result, the solution below doesn't work for us.
>
> My thought was about post writes. That's why I was wondering and still
> wonder if something to clarify in the documentation.
>
>>
>> I do have a much cleaner patch to re-submit but I haven't applied it on
>> top of your patches yet & tested yet.
>
> Okay, please, apply the above as a part of commit message.
> I also would like to test it on Intel Medfield.
>
>>
>>>>
>>>> In reply to your other email, yes it does support the DW_apb_ssi but the
>>>> Arria10 architecture requires 32 bit access (actually as you point out,
>>>> 32 bit writes). We're using the original driver on our older chips but
>>>> Arria10 requires upstream changes.
>>>
>>> Can you check if the following helps in your case:
>>>
>>> --- a/drivers/spi/spi-dw.h
>>> +++ b/drivers/spi/spi-dw.h
>>> @@ -170,6 +170,8 @@ static inline u16 dw_readw(struct dw_spi *dws, u32 offset)
>>>    static inline void dw_writew(struct dw_spi *dws, u32 offset, u16 val)
>>>    {
>>>           __raw_writew(val, dws->regs + offset);
>>> +       mmiowb():
>>> +       __raw_readw(dws->regs + offset);
>>>    }
>>>
>>>    static inline void spi_enable_chip(struct dw_spi *dws, int enable)
>>>
>
>

  reply	other threads:[~2015-03-06 23:06 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-04 20:31 [RFC/PATCH 0/2] spi: spi-dw: Select 16b or 32b register access tthayer-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx
2015-03-04 20:31 ` [RFC/PATCH 2/2] spi: dw-spi: Pointers select 16b vs. 32b DesignWare access tthayer
2015-03-04 20:55   ` Andy Shevchenko
     [not found]     ` <1425502525.14897.185.camel-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-03-04 22:07       ` Thor Thayer
     [not found] ` <1425501075-17081-1-git-send-email-tthayer-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org>
2015-03-04 20:31   ` [RFC/PATCH 1/2] dt-binding: spi: spi-dw: Select 16b or 32b access for Designware SPI tthayer-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx
2015-03-04 20:44   ` [RFC/PATCH 0/2] spi: spi-dw: Select 16b or 32b register access Andy Shevchenko
2015-03-04 22:01     ` Thor Thayer
     [not found]       ` <54F7809E.2010307-yzvPICuk2ABMcg4IHK0kFoH6Mc4MB0Vx@public.gmane.org>
2015-03-05 10:43         ` Andy Shevchenko
     [not found]           ` <1425552233.14897.189.camel-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-03-05 20:41             ` Thor Thayer
2015-03-05 21:54               ` Andy Shevchenko
2015-03-06 23:06                 ` Thor Thayer [this message]
2015-03-04 21:02 ` Andy Shevchenko

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=54FA32D8.8010704@opensource.altera.com \
    --to=tthayer@opensource.altera.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=axel.lin@ingics.com \
    --cc=baruch@tkos.co.il \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dinguyen@opensource.altera.com \
    --cc=galak@codeaurora.org \
    --cc=grant.likely@linaro.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=jg1.han@samsung.com \
    --cc=jkosina@suse.cz \
    --cc=linux-doc@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=tthayer.linux@gmail.com \
    /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).