From: Stephen Street <stephen@streetfiresound.com>
To: Nicolas Pitre <nico@cam.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
dvrabel@arcom.com, David Brownell <david-b@pacbell.net>,
spi-devel-general@lists.sourceforge.net,
Andrew Morton <akpm@osdl.org>
Subject: Re: [PATCH] spi: Updated PXA2xx SSP SPI Driver
Date: Fri, 10 Feb 2006 14:19:41 -0800 [thread overview]
Message-ID: <1139609981.30189.84.camel@ststephen.streetfiresound.com> (raw)
In-Reply-To: <Pine.LNX.4.64.0602101102520.5397@localhost.localdomain>
On Fri, 2006-02-10 at 12:40 -0500, Nicolas Pitre wrote:
> [...]
>
> +#define SSP_REG(x) (*((volatile unsigned long *)x))
>
> Don't do that. Instead, please use:
>
> #define DEFINE_SSP_REG(reg, off) \
> static inline u32 read_##reg(void *p) { return __raw_readl(p + (off)); \
> static inline void write_##reg(u32 v, void *p) { __raw_writel(v, p + (off)); }
>
> DEFINE_SSP_REG(SSCR0, 0x00)
> DEFINE_SSP_REG(SSCR1, 0x04)
> DEFINE_SSP_REG(SSSR, 0x08)
> DEFINE_SSP_REG(SSITR, 0x0c)
> DEFINE_SSP_REG(SSDR, 0x10)
> DEFINE_SSP_REG(SSTO, 0x28)
> DEFINE_SSP_REG(SSPSP, 0x2c)
>
Ok, I'll do this (Andrew made a similar comment). But...
I modeled my SSP_REG on the contents of include/asm-
arm/arch_pxa/pxa_reg.h which makes extensive use of __REG defined in
include/asm-arm/arch_pxa/hardware.h as
#define __REG(x) (*((volatile u32 *)io_p2v(x)))
which is effectively my SSP_REG without the io_p2v because I preloaded
the virtual SSP register addresses in the pxa2xx_spi_probe function.
For my education:
Why are __raw_readl and friends better than exploiting the memory map
I/O nature of the PXA2xx and other SOCs?
Especially since something like
SSP_REG(sscr1) &= ~SSCR1_TIE;
becomes
write_SSCR1(read_SSCR1(reg) & ~SSCR_TIE, reg);
Further what should I do with the DMA register accesses (i.e. DCSR,
DCMD, etc)?
> +static void dma_handler(int channel, void *data, struct pt_regs *regs)
> +{
> + struct driver_data *drv_data = (struct driver_data *)data;
> + struct spi_message *msg = drv_data->cur_msg;
> + u32 sssr = drv_data->sssr;
> + u32 sscr1 = drv_data->sscr1;
> + u32 ssto = drv_data->sscr1;
> ^^^^^^^^^^^^^^^^^^^^^^^^^^
>
Definitely wrong, harmless in this case but bad none the less. Thanks
great eyes!
Stephen
next prev parent reply other threads:[~2006-02-10 22:19 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-02-07 3:06 [PATCH] spi: Add " stephen
2006-02-07 4:22 ` [PATCH] pxa2xx_spi, board support for Lubbock David Brownell
2006-02-07 11:50 ` [PATCH] spi: Add PXA2xx SSP SPI Driver David Vrabel
2006-02-07 15:05 ` David Vrabel
2006-02-07 21:27 ` Stephen Street
2006-02-07 21:17 ` Stephen Street
2006-02-10 1:38 ` [PATCH] spi: Updated " Stephen Street
2006-02-10 2:18 ` Andrew Morton
2006-02-10 23:07 ` Stephen Street
2006-02-10 23:49 ` Andrew Morton
2006-02-10 17:40 ` Nicolas Pitre
2006-02-10 22:19 ` Stephen Street [this message]
2006-02-10 22:45 ` Nicolas Pitre
2006-02-10 23:22 ` Stephen Street
2006-02-14 1:35 ` [PATCH] spi: Code Review " Stephen Street
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=1139609981.30189.84.camel@ststephen.streetfiresound.com \
--to=stephen@streetfiresound.com \
--cc=akpm@osdl.org \
--cc=david-b@pacbell.net \
--cc=dvrabel@arcom.com \
--cc=linux-kernel@vger.kernel.org \
--cc=nico@cam.org \
--cc=spi-devel-general@lists.sourceforge.net \
/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
all inboxes | Powered by JetHome®