linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Bert Vermeulen <bert-Nh2F35Ii2RQ@public.gmane.org>
To: Mark Brown <broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org>
Cc: ralf-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org,
	linux-mips-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	andy.shevchenko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org,
	jogo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org
Subject: Re: [PATCH v6] spi: Add SPI driver for Mikrotik RB4xx series boards
Date: Fri, 10 Apr 2015 17:31:15 +0200	[thread overview]
Message-ID: <5527ECC3.1000209@biot.com> (raw)
In-Reply-To: <20150409215047.GE6023-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>

On 04/09/2015 11:50 PM, Mark Brown wrote:
> On Thu, Apr 09, 2015 at 11:31:12PM +0200, Bert Vermeulen wrote:
>>  The m25p80-compatible boot flash and (some models) MMC use regular SPI,
>>  bitbanged as required by the SoC. However the SPI-connected CPLD has
>>  a "fast write" mode, in which two bits are transferred by SPI clock
>>  cycle. The second bit is transmitted with the SoC's CS2 pin.
> 
>>  Protocol drivers using this fast write facility signal this by setting
>>  the cs_change flag on transfers.
> 
>> The cs_change flag is used here instead of the openwrt version's
>> spi_transfer.fast_write flag. The CPLD driver sets this flag on a
>> per-transfer basis.
> 
> No, this is broken - it's abusing a standard API in a way that's
> completly incompatible with the meaning of that API which is obviously a
> very bad idea, especially since good practice is to offload the
> implementation of that standard API to the core.  It *sounds* like
> you're just trying to implement two wire mode which does have a standard
> API, please use that.

Can you please advise what kind of solution would be acceptable then? I need
to signal from an SPI protocol driver to an SPI master on a per-transfer basis.

Adding a flag to struct spi_transfer for this one driver, as openwrt does,
seems stupid -- I agree. And sure, using spi_transfer.cs_change is a little
dodgy. But I don't see a standard way to do it otherwise, and I don't really
want to keep trying things until you approve of one. So tell me how you
would do it, and I'll implement it that way. I just want to get this code in.

Also, I have no idea what you mean by two-wire mode. This "fast mode" is SPI
+ one extra pin.


-- 
Bert Vermeulen        bert-Nh2F35Ii2RQ@public.gmane.org          email/xmpp
--
To unsubscribe from this list: send the line "unsubscribe linux-spi" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2015-04-10 15:31 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-04-06  1:54 [PATCH v6] spi: Add SPI driver for Mikrotik RB4xx series boards Bert Vermeulen
2015-04-06  9:56 ` Andy Shevchenko
     [not found] ` <1428285263-15135-1-git-send-email-bert-Nh2F35Ii2RQ@public.gmane.org>
2015-04-06 16:39   ` Mark Brown
     [not found]     ` <20150406163905.GL6023-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2015-04-09 21:31       ` Bert Vermeulen
2015-04-09 21:50         ` Mark Brown
     [not found]           ` <20150409215047.GE6023-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2015-04-10 15:31             ` Bert Vermeulen [this message]
     [not found]               ` <5527ECC3.1000209-Nh2F35Ii2RQ@public.gmane.org>
2015-04-10 15:45                 ` Mark Brown

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=5527ECC3.1000209@biot.com \
    --to=bert-nh2f35ii2rq@public.gmane.org \
    --cc=andy.shevchenko-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=broonie-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org \
    --cc=jogo-p3rKhJxN3npAfugRpC6u6w@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-mips-6z/3iImG2C8G8FEW9MqTrA@public.gmane.org \
    --cc=linux-spi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=ralf-6z/3iImG2C8G8FEW9MqTrA@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 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).