linux-mips
[Top] [All Lists]

Re: [PATCH] TXx9 SPI controller driver

To: ralf@linux-mips.org
Subject: Re: [PATCH] TXx9 SPI controller driver
From: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Date: Mon, 25 Jun 2007 01:15:33 +0900 (JST)
Cc: linux-mips@linux-mips.org, david-b@pacbell.net, sshtylyov@ru.mvista.com, mlachwani@mvista.com, spi-devel-general@lists.sourceforge.net
In-reply-to: <200706221103.19761.david-b@pacbell.net>
Original-recipient: rfc822;linux-mips@linux-mips.org
References: <20070622.232111.36926005.anemo@mba.ocn.ne.jp> <200706221103.19761.david-b@pacbell.net>
Sender: linux-mips-bounce@linux-mips.org
On Fri, 22 Jun 2007 11:03:18 -0700, David Brownell <david-b@pacbell.net> wrote:
> > +   if (res->start >= TXX9_DIRECTMAP_BASE)
> > +           c->membase = (void __iomem *)(unsigned long)(int)res->start;
> > +   else {
> > +           c->membase = ioremap(res->start, res->end - res->start + 1);
> > +           c->mapped = 1;
> > +   }
> 
> That looks plain wrong.  Maybe it reflects a platform-level bug,
> but ioremap(res->start) should Just Work even when it performs
> an identity mapping on a given system.  Remove this ugly code.
> Always map.

Ralf, (as I said some time ago) TX39XX and TX49XX have "reserved"
segment in CKSEG3 area.  0xff000000-0xff3fffff on TX49XX and
0xff000000-0xfffeffff on TX39XX are reserved (unmapped, uncached).
Controllers on these SoCs are placed in this segment.

If ioremap()/iounmap() could handle these special case, I can remove
this hack in this driver.

Is something like this acceptable?

include/asm-mips/io.h:
static inline void __iomem * __ioremap_mode(phys_t offset, unsigned long size,
        unsigned long flags)
{
        void __iomem *addr = plat_ioremap(offset, size, flags);
        if (addr)
                return addr;
        ...
}

static inline void iounmap(const volatile void __iomem *addr)
{
        if (plat_iounmap(addr))
                returnl
        ...
}

include/asm-mips/mach-generic/ioremap.h:
static inline void __iomem *plat_ioremap(phys_t offset, unsigned long size,
        unsigned long flags)
{
        return NULL;
}

static inline int plat_iounmap(const volatile void __iomem *addr)
{
        return 0;
}

---
Atsushi Nemoto

<Prev in Thread] Current Thread [Next in Thread>