All of lore.kernel.org
 help / color / mirror / Atom feed
From: arnd@arndb.de (Arnd Bergmann)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC] arm: versatile: enable PCI I/O space
Date: Tue, 20 Jul 2010 13:09:35 +0200	[thread overview]
Message-ID: <201007201309.36898.arnd@arndb.de> (raw)
In-Reply-To: <20100720095940.GA32702@n2100.arm.linux.org.uk>

On Tuesday 20 July 2010, Russell King - ARM Linux wrote:
> On Tue, Jul 20, 2010 at 11:23:38AM +0200, Arnd Bergmann wrote:
> > -/* macro to get at IO space when running virtually */
> > +/* macro to get at MMIO space when running virtually */
> >  #define IO_ADDRESS(x)		(((x) & 0x0fffffff) + (((x) >> 4) & 0x0f000000) + 0xf0000000)
> >  
> > -#define __io_address(n)		__io(IO_ADDRESS(n))
> > +#define __io_address(n)		__typesafe_io(IO_ADDRESS(n))
> 
> Hmm, that's not a scenario that I forsaw __typesafe_io() being used -
> I'd prefer it to be restricted to only aliasing __io() to if it's
> appropriate.  Either add an IOMEM() definition or open-code the cast
> here.

Yes, that's what I thought, but I didn't want to change too much.
Thanks for the confirmation. The same pattern is also present in
other platforms, I'll follow up with a patch to fix them all.

> > diff --git a/arch/arm/mach-versatile/include/mach/io.h b/arch/arm/mach-versatile/include/mach/io.h
> > index f067c14..a276171 100644
> > --- a/arch/arm/mach-versatile/include/mach/io.h
> > +++ b/arch/arm/mach-versatile/include/mach/io.h
> > @@ -20,9 +20,12 @@
> >  #ifndef __ASM_ARM_ARCH_IO_H
> >  #define __ASM_ARM_ARCH_IO_H
> >  
> > -#define IO_SPACE_LIMIT 0xffffffff
> > +#include <mach/hardware.h>
> > +#include <mach/platform.h>
> >  
> > -#define __io(a)		__typesafe_io(a)
> > +#define IO_SPACE_LIMIT (VERSATILE_PCI_MEM_BASE0_SIZE - 1)
> > +
> > +#define __io(a)		(a + VERSATILE_PCI_VIRT_MEM_BASE0)
> 
> Not quite.  Have a look at arch/arm/mach-footbridge/include/mach/io.h to
> see how __io is defined there.

The result is basically the same. My idea was to only define
VERSATILE_PCI_VIRT_MEM_BASE0 in one place and use it in both the place
where it get mapped and in the place where it gets used.

If I use the same definition as footbridge (which looks sensible,
#define __io(a)     ((void __iomem *)(PCIO_BASE + (a))) ),
should I do 

a)
mach-versatile/include/mach/io.h:
#define PCIO_BASE                ((unsigned long)VERSATILE_PCI_VIRT_MEM_BASE0)
mach-versatile/include/mach/hardware.h:
#define VERSATILE_PCI_VIRT_MEM_BASE0 ((void __iomem *)0xeb000000ul)

or b)
mach-versatile/include/mach/io.h:
#define PCIO_BASE                0xeb000000ul
mach-versatile/include/mach/hardware.h:
#define VERSATILE_PCI_VIRT_MEM_BASE0 ((void __iomem *)PCIO_BASE)


Thanks for the review!

	Arnd

  reply	other threads:[~2010-07-20 11:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-20  9:23 [RFC] arm: versatile: enable PCI I/O space Arnd Bergmann
2010-07-20  9:55 ` Colin Tuckley
2010-07-20  9:59 ` Russell King - ARM Linux
2010-07-20 11:09   ` Arnd Bergmann [this message]
2010-07-20 21:22     ` [PATCH v2] " Arnd Bergmann
2010-07-21 16:36       ` [PATCH] arm: remove __io() abuses Arnd Bergmann
  -- strict thread matches above, loose matches on Subject: below --
2010-07-20 13:07 [RFC] arm: versatile: enable PCI I/O space Eric Miao
2010-07-20 21:12 ` Arnd Bergmann
2010-07-20 21:19   ` Russell King - ARM Linux

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=201007201309.36898.arnd@arndb.de \
    --to=arnd@arndb.de \
    --cc=linux-arm-kernel@lists.infradead.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.