All of lore.kernel.org
 help / color / mirror / Atom feed
From: Michael van der Westhuizen <michael@smart-africa.com>
To: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: linux-spi@vger.kernel.org, devicetree@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org,
	Steffen Trumtrar <s.trumtrar@pengutronix.de>,
	Thor Thayer <tthayer@opensource.altera.com>,
	Mark Brown <broonie@kernel.org>, Rob Herring <robh+dt@kernel.org>,
	Pawel Moll <pawel.moll@arm.com>,
	Mark Rutland <mark.rutland@arm.com>,
	Ian Campbell <ijc+devicetree@hellion.org.uk>,
	Kumar Gala <galak@codeaurora.org>
Subject: Re: [PATCH 1/2] spi: dw: Allow interface drivers to limit data I/O to word sizes
Date: Wed, 24 Jun 2015 18:11:04 +0200	[thread overview]
Message-ID: <4C67526B-0B28-4539-8E7F-7F2D6B8967EC@smart-africa.com> (raw)
In-Reply-To: <1435147064.10393.100.camel@linux.intel.com>

[-- Attachment #1: Type: text/plain, Size: 3150 bytes --]


> On 24 Jun 2015, at 1:57 PM, Andy Shevchenko <andriy.shevchenko@linux.intel.com> wrote:
> 
> On Fri, 2015-06-19 at 10:43 +0200, Michael van der Westhuizen wrote:
>> The commit dd11444327ce ("spi: dw-spi: Convert 16bit accesses to 
>> 32bit
>> accesses") changed all 16bit accesses in the DW_apb_ssi driver to 
>> 32bit.
>> This, unfortunately, breaks data register access on picoXcell, where 
>> the
>> DW IP needs data register accesses to be word accesses (all other
>> accesses appear to be OK).
> 
> Thanks for the patch. My comments below.
> 
>> 
>> This change introduces a new master variable to allow interface 
>> drivers
>> to specify that 16bit data transfer I/O is required.  This change 
>> also
>> introduces the ability to set this variable via device tree bindings 
>> in
>> the MMIO interface driver.
>> 
>> Before this change, on a picoXcell pc3x3:
>> spi_master spi32766: interrupt_transfer: fifo overrun/underrun
>> m25p80 spi32766.0: error -5 reading 9f
>> m25p80: probe of spi32766.0 failed with error -5
>> 
>> After this change:
>> m25p80 spi32766.0: m25p40 (512 Kbytes)
>> 
> 
> Please, add Fixes: tag as well.

OK.

> 
>> Signed-off-by: Michael van der Westhuizen <michael@smart-africa.com>
>> ---
>> drivers/spi/spi-dw-mmio.c |  5 +++++
>> drivers/spi/spi-dw.c      | 13 +++++++++++--
>> drivers/spi/spi-dw.h      | 11 +++++++++++
>> 3 files changed, 27 insertions(+), 2 deletions(-)
>> 
>> diff --git a/drivers/spi/spi-dw-mmio.c b/drivers/spi/spi-dw-mmio.c
>> index eb03e12..1397424 100644
>> --- a/drivers/spi/spi-dw-mmio.c
>> +++ b/drivers/spi/spi-dw-mmio.c
>> @@ -74,6 +74,11 @@ static int dw_spi_mmio_probe(struct 
>> platform_device *pdev)
>> 
>> 	dws->max_freq = clk_get_rate(dwsmmio->clk);
>> 
>> +	if (pdev->dev.of_node)
>> +		dws->data_io_16bit =
> 
> I don't like "flexibility" in the  DeviceTree data base and thus I
> would prefer to see what we already have in naming there, i.e.
> reg-io-width = 2 or 4.

Will update.

<snip>

>> @@ -145,11 +146,21 @@ static inline u32 dw_readl(struct dw_spi *dws, 
>> u32 offset)
>> 	return __raw_readl(dws->regs + offset);
>> }
>> 
>> +static inline u16 dw_readw(struct dw_spi *dws, u32 offset)
>> +{
>> +	return __raw_readw(dws->regs + offset);
>> +}
>> +
>> static inline void dw_writel(struct dw_spi *dws, u32 offset, u32 
>> val)
>> {
>> 	__raw_writel(val, dws->regs + offset);
>> }
>> 
>> +static inline void dw_writew(struct dw_spi *dws, u32 offset, u16 
>> val)
>> +{
>> +	__raw_writew(val, dws->regs + offset);
>> +}
>> +
>> static inline void spi_enable_chip(struct dw_spi *dws, int enable)
>> {
>> 	dw_writel(dws, DW_SPI_SSIENR, (enable ? 1 : 0));
> 
> Regarding to above comment what about something like
> 
> static inline u32 dw_read_reg(dws, offset)
> {
> switch (reg_io_width)
> case 2:
>  return dw_readw();
> case 4:
> default:
>  return dw_readl();
> }

Yes, that would be better.  Note that this will only be used for data
register access, as the other registers seem fine with 32 bit access.

I’ll update the series and resend.

Michael


[-- Attachment #2: Type: text/html, Size: 20765 bytes --]

  reply	other threads:[~2015-06-24 16:11 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-19  8:43 [PATCH 0/2] spi: dw: Reintroduce optional 16 bit data register I/O Michael van der Westhuizen
2015-06-19  8:43 ` Michael van der Westhuizen
     [not found] ` <1434703435-25198-1-git-send-email-michael-XrNoQAPr3WXM9gW82pYGhQ@public.gmane.org>
2015-06-19  8:43   ` [PATCH 2/2] dt: snps,dw-apb-ssi: Describe 16 bit data register usage limitations Michael van der Westhuizen
2015-06-19  8:43     ` [PATCH 2/2] dt: snps, dw-apb-ssi: " Michael van der Westhuizen
2015-06-19  8:43   ` [PATCH 1/2] spi: dw: Allow interface drivers to limit data I/O to word sizes Michael van der Westhuizen
2015-06-19  8:43     ` Michael van der Westhuizen
     [not found]     ` <1434703435-25198-3-git-send-email-michael-XrNoQAPr3WXM9gW82pYGhQ@public.gmane.org>
2015-06-24 11:57       ` Andy Shevchenko
2015-06-24 11:57         ` Andy Shevchenko
2015-06-24 16:11         ` Michael van der Westhuizen [this message]
2015-06-24 16:34   ` [PATCH v2 0/2] spi: dw: Reintroduce optional 16 bit data register I/O Michael van der Westhuizen
2015-06-24 16:34     ` Michael van der Westhuizen
     [not found]     ` <1435163696-14767-1-git-send-email-michael-XrNoQAPr3WXM9gW82pYGhQ@public.gmane.org>
2015-06-24 16:34       ` [PATCH v2 1/2] dt: snps,dw-apb-ssi: Document new I/O data register width property Michael van der Westhuizen
2015-06-24 16:34         ` [PATCH v2 1/2] dt: snps, dw-apb-ssi: " Michael van der Westhuizen
2015-06-24 16:34       ` [PATCH v2 2/2] spi: dw: Allow interface drivers to limit data I/O to word sizes Michael van der Westhuizen
2015-06-24 16:34         ` Michael van der Westhuizen
     [not found]         ` <1435163696-14767-3-git-send-email-michael-XrNoQAPr3WXM9gW82pYGhQ@public.gmane.org>
2015-06-25 14:41           ` Andy Shevchenko
2015-06-25 14:41             ` Andy Shevchenko
2015-07-24 15:30       ` [PATCH v2 0/2] spi: dw: Reintroduce optional 16 bit data register I/O Andy Shevchenko
2015-07-24 15:30         ` Andy Shevchenko
     [not found]         ` <1437751812.29746.74.camel-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-07-24 15:37           ` Mark Brown
2015-07-24 15:37             ` Mark Brown
     [not found]             ` <20150724153704.GM11162-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2015-07-27 10:58               ` Andy Shevchenko
2015-07-27 10:58                 ` Andy Shevchenko
     [not found]                 ` <1437994691.29746.80.camel-VuQAYsv1563Yd54FQh9/CA@public.gmane.org>
2015-07-27 11:19                   ` Mark Brown
2015-07-27 11:19                     ` Mark Brown
     [not found]                     ` <20150727111944.GW11162-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2015-07-27 11:38                       ` Michael van der Westhuizen
2015-07-27 11:38                         ` Michael van der Westhuizen
     [not found]                         ` <CCC70BC0-E1D0-4C27-A44D-2D16ED9B3049-XrNoQAPr3WXM9gW82pYGhQ@public.gmane.org>
2015-07-27 13:59                           ` Mark Brown
2015-07-27 13:59                             ` Mark Brown
     [not found]                             ` <20150727135915.GY11162-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2015-08-18 10:29                               ` Andy Shevchenko
2015-08-18 10:29                                 ` Andy Shevchenko
2015-07-27 11:37       ` [RESEND PATCH " Michael van der Westhuizen
2015-07-27 11:37         ` Michael van der Westhuizen
     [not found]         ` <1437997035-3046-1-git-send-email-michael-XrNoQAPr3WXM9gW82pYGhQ@public.gmane.org>
2015-07-27 11:37           ` [RESEND PATCH v2 1/2] dt: snps,dw-apb-ssi: Document new I/O data register width property Michael van der Westhuizen
2015-07-27 11:37             ` [RESEND PATCH v2 1/2] dt: snps, dw-apb-ssi: " Michael van der Westhuizen
     [not found]             ` <1437997035-3046-2-git-send-email-michael-XrNoQAPr3WXM9gW82pYGhQ@public.gmane.org>
2015-07-27 13:35               ` [RESEND PATCH v2 1/2] dt: snps,dw-apb-ssi: " Rob Herring
2015-07-27 13:35                 ` [RESEND PATCH v2 1/2] dt: snps, dw-apb-ssi: " Rob Herring
2015-07-27 11:37           ` [RESEND PATCH v2 2/2] spi: dw: Allow interface drivers to limit data I/O to word sizes Michael van der Westhuizen
2015-07-27 11:37             ` Michael van der Westhuizen
     [not found]             ` <1437997035-3046-3-git-send-email-michael-XrNoQAPr3WXM9gW82pYGhQ@public.gmane.org>
2015-08-18 10:36               ` Andy Shevchenko
2015-08-18 10:36                 ` 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=4C67526B-0B28-4539-8E7F-7F2D6B8967EC@smart-africa.com \
    --to=michael@smart-africa.com \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=galak@codeaurora.org \
    --cc=ijc+devicetree@hellion.org.uk \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=pawel.moll@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=s.trumtrar@pengutronix.de \
    --cc=tthayer@opensource.altera.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 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.