All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
To: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
Cc: spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.org,
	Jason Cooper <jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org>,
	linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH] ARM: Kirkwood: Add SPI_CHPA and SPI_CPOL support to spi-orion
Date: Thu, 6 Dec 2012 10:25:04 -0700	[thread overview]
Message-ID: <20121206172504.GB9676@obsidianresearch.com> (raw)
In-Reply-To: <20121206142521.4185A3E0948@localhost>

On Thu, Dec 06, 2012 at 02:25:21PM +0000, Grant Likely wrote:
> On Wed, 21 Nov 2012 12:23:35 -0700, Jason Gunthorpe <jgunthorpe-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org> wrote:
> > Support these transfer modes from the SPI layer by setting
> > the appropriate register bits before doing the transfer.
> > 
> > This was tested on the Marvell kirkwood SOC that uses this driver.
> 
> Woo! a note about how it was tested. I can't (and often don't) see
> enough of these.  :-)

Thanks for looking at this Grant,

But I think that Jason's comment (see
https://patchwork.kernel.org/patch/1782061/) is valid.

This will likely switch all current users from using 'whatever the
firmware left behind' to 'whatever the kernel default is' - which will
surely break something here and there??

I was thinking of a transitory patch that did:

reg = readl(spi_reg(orion_spi, ORION_SPI_IF_CONFIG_REG));
nreg = reg & ~ORION_SPI_MODE_MASK;
if (spi->mode & SPI_CPOL)
	nreg |= ORION_SPI_MODE_CPOL;
if (spi->mode & SPI_CPHA)
	nreg |= ORION_SPI_MODE_CPHA;
#ifdef TRANSITION
 if (nreg != reg)
        dev_error(..,"Not allowing a SPI mode change away from firmware
 defaults. Board support needs to be updated!");
#else
 writel(nreg, spi_reg(orion_spi, ORION_SPI_IF_CONFIG_REG));
#endif

At least that way there is a warning and the DTSs can be fixed up.

I haven't had a moment to look into that though..

But I'm not sure that is in line with kernel philosophy WRT to DT..

What do you think?

Regards,
Jason

------------------------------------------------------------------------------
LogMeIn Rescue: Anywhere, Anytime Remote support for IT. Free Trial
Remotely access PCs and mobile devices and provide instant support
Improve your efficiency, and focus on delivering more value-add services
Discover what IT Professionals Know. Rescue delivers
http://p.sf.net/sfu/logmein_12329d2d

WARNING: multiple messages have this Message-ID (diff)
From: jgunthorpe@obsidianresearch.com (Jason Gunthorpe)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] ARM: Kirkwood: Add SPI_CHPA and SPI_CPOL support to spi-orion
Date: Thu, 6 Dec 2012 10:25:04 -0700	[thread overview]
Message-ID: <20121206172504.GB9676@obsidianresearch.com> (raw)
In-Reply-To: <20121206142521.4185A3E0948@localhost>

On Thu, Dec 06, 2012 at 02:25:21PM +0000, Grant Likely wrote:
> On Wed, 21 Nov 2012 12:23:35 -0700, Jason Gunthorpe <jgunthorpe@obsidianresearch.com> wrote:
> > Support these transfer modes from the SPI layer by setting
> > the appropriate register bits before doing the transfer.
> > 
> > This was tested on the Marvell kirkwood SOC that uses this driver.
> 
> Woo! a note about how it was tested. I can't (and often don't) see
> enough of these.  :-)

Thanks for looking at this Grant,

But I think that Jason's comment (see
https://patchwork.kernel.org/patch/1782061/) is valid.

This will likely switch all current users from using 'whatever the
firmware left behind' to 'whatever the kernel default is' - which will
surely break something here and there??

I was thinking of a transitory patch that did:

reg = readl(spi_reg(orion_spi, ORION_SPI_IF_CONFIG_REG));
nreg = reg & ~ORION_SPI_MODE_MASK;
if (spi->mode & SPI_CPOL)
	nreg |= ORION_SPI_MODE_CPOL;
if (spi->mode & SPI_CPHA)
	nreg |= ORION_SPI_MODE_CPHA;
#ifdef TRANSITION
 if (nreg != reg)
        dev_error(..,"Not allowing a SPI mode change away from firmware
 defaults. Board support needs to be updated!");
#else
 writel(nreg, spi_reg(orion_spi, ORION_SPI_IF_CONFIG_REG));
#endif

At least that way there is a warning and the DTSs can be fixed up.

I haven't had a moment to look into that though..

But I'm not sure that is in line with kernel philosophy WRT to DT..

What do you think?

Regards,
Jason

  reply	other threads:[~2012-12-06 17:25 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-21 19:23 [PATCH] ARM: Kirkwood: Add SPI_CHPA and SPI_CPOL support to spi-orion Jason Gunthorpe
2012-11-21 19:23 ` Jason Gunthorpe
2012-11-21 19:35 ` Jason Cooper
2012-11-21 19:35   ` Jason Cooper
     [not found]   ` <20121121193552.GE15800-u4khhh1J0LxI1Ri9qeTfzeTW4wlIGRCZ@public.gmane.org>
2012-11-21 20:29     ` Jason Gunthorpe
2012-11-21 20:29       ` Jason Gunthorpe
     [not found] ` <20121121192335.GA14868-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2012-12-06 14:25   ` Grant Likely
2012-12-06 14:25     ` Grant Likely
2012-12-06 17:25     ` Jason Gunthorpe [this message]
2012-12-06 17:25       ` Jason Gunthorpe
     [not found]       ` <20121206172504.GB9676-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2012-12-06 23:23         ` Grant Likely
2012-12-06 23:23           ` Grant Likely
2012-12-06 23:49           ` Jason Gunthorpe
2012-12-06 23:49             ` Jason Gunthorpe
     [not found]             ` <20121206234917.GF25069-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2012-12-06 23:53               ` Jason Cooper
2012-12-06 23:53                 ` Jason Cooper
     [not found]                 ` <20121206235311.GB21694-u4khhh1J0LxI1Ri9qeTfzeTW4wlIGRCZ@public.gmane.org>
2012-12-07  0:14                   ` Jason Gunthorpe
2012-12-07  0:14                     ` Jason Gunthorpe
     [not found]                     ` <20121207001433.GG25069-ePGOBjL8dl3ta4EC/59zMFaTQe2KTcn/@public.gmane.org>
2012-12-07  0:49                       ` Jason Cooper
2012-12-07  0:49                         ` Jason Cooper
     [not found]                         ` <20121207004933.GC21694-u4khhh1J0LxI1Ri9qeTfzeTW4wlIGRCZ@public.gmane.org>
2012-12-07 14:05                           ` Grant Likely
2012-12-07 14:05                             ` Grant Likely
  -- strict thread matches above, loose matches on Subject: below --
2012-12-10 13:38 Andrew Lunn
2012-12-10 13:38 ` Andrew Lunn
     [not found] ` <20121210133800.GA20001-g2DYL2Zd6BY@public.gmane.org>
2012-12-10 22:06   ` Grant Likely
2012-12-10 22:06     ` Grant Likely

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=20121206172504.GB9676@obsidianresearch.com \
    --to=jgunthorpe-epgobjl8dl3ta4ec/59zmfatqe2ktcn/@public.gmane.org \
    --cc=grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org \
    --cc=jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org \
    --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
    --cc=spi-devel-general-5NWGOfrQmneRv+LV9MX5uipxlwaOVQ5f@public.gmane.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 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.