public inbox for linuxppc-dev@ozlabs.org 
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell•net>
To: Andrei Konovalov <akonovalov@ru•mvista.com>
Cc: spi-devel-general@lists•sourceforge.net, linuxppc-embedded@ozlabs•org
Subject: Re: [spi-devel-general] [PATCH] Simple driver for Xilinx SPI controler.
Date: Thu, 7 Jun 2007 12:21:00 -0700	[thread overview]
Message-ID: <200706071221.00571.david-b@pacbell.net> (raw)
In-Reply-To: <466850FB.5030505@ru.mvista.com>

On Thursday 07 June 2007, Andrei Konovalov wrote:

> >> +/* Simple macros to get the code more readable */
> >> +#define xspi_in16(addr)		in_be16((u16 __iomem *)(addr))
> >> +#define xspi_in32(addr)		in_be32((u32 __iomem *)(addr))
> >> +#define xspi_out16(addr, value)	out_be16((u16 __iomem *)(addr), (value))
> >> +#define xspi_out32(addr, value)	out_be32((u32 __iomem *)(addr), (value))
> > 
> > I'm rather used to seeing I/O addressses passed around as "void __iomem *"
> > so those sorts of cast are not needed...  :)
> 
> I've decided to make the base_address (u8 __iomem *) to make it easier to
> add the register offsets to the base. Like that:

Adding register offsets works with "void __iomem *" too ...


> > You should not need an abort primitive.  ...
> 
> I am paranoid enough not to rely 100% on the spi_device's and the spi_bitbang
> doing all that :)
> Agreed, xspi_abort_transfer is bad name here. But I still would like to
> leave these two writes:
> 
> +	/* Deselect the slave on the SPI bus */
> +	xspi_out32(regs_base + XSPI_SSR_OFFSET, 0xffff);
> +	/* Disable the transmitter */
> +	xspi_out16(regs_base + XSPI_CR_OFFSET,
> +		   XSPI_CR_TRANS_INHIBIT | XSPI_CR_MANUAL_SSELECT);
> 
> in xilinx_spi_remove(). Just in case :)

What happens when you add a BUG_ON to catch the device still being active?

Really, you need to rely on the rest of the system working correctly.



> > I take it you can't support SPI_CS_HIGH??
> 
> There is no clear indication in the SPI controller docs that SPI_CS_HIGH
> would work. I suspect it would as we don't use the ability of the controller
> to generate the chip selects automatically (the auto mode doesn't support SPI_CS_HIGH).
> But it is more safe to advertise SPI_CS_HIGH is not supported.

If you don't explicitly support it, it's unlikely to work.  :)

- Dave

  reply	other threads:[~2007-06-07 19:27 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-06-06 14:05 [PATCH] Simple driver for Xilinx SPI controler Andrei Konovalov
2007-06-06 16:03 ` Stephen Neuendorffer
2007-06-06 17:57   ` Andrei Konovalov
2007-06-06 18:06     ` Stephen Neuendorffer
2007-06-06 19:00       ` Grant Likely
2007-06-06 19:06         ` Stephen Neuendorffer
2007-06-06 19:55           ` Grant Likely
2007-06-07 13:50             ` Andrei Konovalov
2007-06-06 20:49         ` Wolfgang Reissnegger
2007-06-06 20:55           ` Grant Likely
2007-06-07  5:09 ` [spi-devel-general] " David Brownell
2007-06-07 18:39   ` Andrei Konovalov
2007-06-07 19:21     ` David Brownell [this message]
2007-06-09 16:58   ` Andrei Konovalov
2007-06-12 16:28     ` David Brownell
2007-06-13 14:55       ` Andrei Konovalov

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=200706071221.00571.david-b@pacbell.net \
    --to=david-b@pacbell$(echo .)net \
    --cc=akonovalov@ru$(echo .)mvista.com \
    --cc=linuxppc-embedded@ozlabs$(echo .)org \
    --cc=spi-devel-general@lists$(echo .)sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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