From: Tony Lindgren <tony@atomide.com>
To: David Brownell <david-b@pacbell.net>
Cc: linux-omap@vger.kernel.org, felipe.balbi@nokia.com
Subject: Re: [PATCH 1/5] CF: Change omap_cf.c to use omap_readw/writew instead of __REG for multi-omap
Date: Fri, 16 May 2008 14:49:09 -0700 [thread overview]
Message-ID: <20080516214909.GC23002@atomide.com> (raw)
In-Reply-To: <200805161426.18409.david-b@pacbell.net>
* David Brownell <david-b@pacbell.net> [080516 14:26]:
> On Friday 16 May 2008, Tony Lindgren wrote:
> > @@ -38,19 +38,19 @@
> > #define CF_BASE 0xfffe2800
> >
> > /* status; read after IRQ */
> > -#define CF_STATUS_REG __REG16(CF_BASE + 0x00)
> > +#define CF_STATUS (CF_BASE + 0x00)
> > # define CF_STATUS_BAD_READ (1 << 2)
> > # define CF_STATUS_BAD_WRITE (1 << 1)
> > # define CF_STATUS_CARD_DETECT (1 << 0)
> >
> > /* which chipselect (CS0..CS3) is used for CF (active low) */
> > -#define CF_CFG_REG __REG16(CF_BASE + 0x02)
> > +#define CF_CFG (CF_BASE + 0x02)
> >
> > ...
>
> Trying to understand the plan here. This first patches
> are to remove __REG*() access, we hillater patches will
> be needed to convert things to omap_readl(BASE + OFFSET)
> style accessors? (BASE being SOC-specific, and passed
> down from system init code.)
>
> Not that CF is a good example of that. I don't think
> it exists on current chips. ;)
Well ideally we would set the base offset during driver init, then
just use __raw_read/write().
But that's lot of work, so it's easier first to convert __REG access
to use omap_read/write(). I'll post multi-omap series as soon as I have
it booting.. But to give you and idea, we can have something like following
work for multi-omap.
In arch/arm/Makefile:
arch-$(CONFIG_MULTI_OMAP) :=-D__LINUX_ARM_ARCH__=5 $(call cc-option,-march=armv5te -Wa$(comma)-march=armv7a,-march=armv6,-march=armv5t)
This works for 926, arm11 and cortex.
Then in io.h:
#if defined(MULTI_OMAP)
extern unsigned long io_p2v(u32 pa);
extern unsigned long io_v2p(u32 va);
extern unsigned char omap_readb(void __iomem *a);
extern unsigned short omap_readw(void __iomem *a);
extern unsigned long omap_readl(void __iomem *a);
...
#else
#ifdef CONFIG_ARCH_OMAP1
#define io_p2v(pa) OMAP1_IO_ADDRESS(pa)
#define io_v2p(va) ((va) + OMAP1_IO_OFFSET)
#define omap_readb(a) (*(volatile unsigned char *)OMAP1_IO_ADDRESS(a))
#define omap_readw(a) (*(volatile unsigned short *)OMAP1_IO_ADDRESS(a))
#define omap_readl(a) (*(volatile unsigned int *)OMAP1_IO_ADDRESS(a))
...
#elif defined(CONFIG_ARCH_OMAP2) || defined(CONFIG_ARCH_OMAP3)
#define io_p2v(pa) OMAP2_IO_ADDRESS(pa)
#define io_v2p(va) ((va) + OMAP2_IO_OFFSET)
#define omap_readb(a) (*(volatile unsigned char*)OMAP2_IO_ADDRESS(a))
#define omap_readw(a) (*(volatile unsigned short *)OMAP2_IO_ADDRESS(a))
#define omap_readl(a) (*(volatile unsigned int *)OMAP2_IO_ADDRESS(a))
...
#endif
#endif
Then in io.c:
unsigned long io_p2v(u32 pa)
{
if (cpu_class_is_omap1())
return OMAP1_IO_ADDRESS(pa);
else
return OMAP2_IO_ADDRESS(pa);
}
unsigned long io_v2p(u32 va)
{
if (cpu_class_is_omap1())
return va + OMAP1_IO_OFFSET;
else
return va + OMAP2_IO_OFFSET;
}
unsigned char omap_readb(void __iomem *a)
{
if (cpu_class_is_omap1())
return __raw_readb(OMAP1_IO_ADDRESS(a));
else if (cpu_is_omap24xx())
return __raw_readb(OMAP24XX_IO_ADDRESS(a));
else if (cpu_is_omap34xx())
return __raw_readb(OMAP34XX_IO_ADDRESS(a));
...
Regards,
Tony
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
next prev parent reply other threads:[~2008-05-16 21:49 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-05-16 21:07 [PATCH 0/5] Remove __REG macro access for multi-omap Tony Lindgren
2008-05-16 21:07 ` [PATCH 1/5] CF: Change omap_cf.c to use omap_readw/writew instead of __REG " Tony Lindgren
2008-05-16 21:07 ` [PATCH 2/5] USB: Change omap USB code to use omap_read/write " Tony Lindgren
2008-05-16 21:07 ` [PATCH 3/5] ARM: OMAP: Change __REG access to omap/read write for traffic controller Tony Lindgren
2008-05-16 21:07 ` [PATCH 4/5] musb_hdrc: Change __REG access to omap_read/write for multi-boot Tony Lindgren
2008-05-16 21:07 ` [PATCH 5/5] ARM: OMAP: Remove __REG access for multi-omap Tony Lindgren
2008-05-17 10:19 ` [PATCH 2/5] USB: Change omap USB code to use omap_read/write instead of __REG " Felipe Balbi
2008-05-16 21:26 ` [PATCH 1/5] CF: Change omap_cf.c to use omap_readw/writew " David Brownell
2008-05-16 21:49 ` Tony Lindgren [this message]
2008-05-28 0:51 ` [PATCH] Misc fixes to this series (CF: Change omap_cf.c to use omap_readw/writew instead of __REG for multi-omap) Tony Lindgren
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=20080516214909.GC23002@atomide.com \
--to=tony@atomide.com \
--cc=david-b@pacbell.net \
--cc=felipe.balbi@nokia.com \
--cc=linux-omap@vger.kernel.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