linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: u.kleine-koenig@pengutronix.de (Uwe Kleine-König)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/3] imx: make IMX_IO_ADDRESS assembly compatible
Date: Tue, 16 Mar 2010 09:52:12 +0100	[thread overview]
Message-ID: <20100316085212.GA29005@pengutronix.de> (raw)
In-Reply-To: <f5e757c320c6ba285c43f296013c2937ad8aa460.1268721011.git.baruch@tkos.co.il>

Hello Baruch,

On Tue, Mar 16, 2010 at 08:35:37AM +0200, Baruch Siach wrote:
> The IMX_IO_ADDRESS macro may be used directly on indirectly in assembly code.
> Make it assembly compatible by using the IOMEM helper macro.
> 
> Signed-off-by: Baruch Siach <baruch@tkos.co.il>
> ---
>  arch/arm/plat-mxc/include/mach/hardware.h |   16 ++++++++++++----
>  1 files changed, 12 insertions(+), 4 deletions(-)
> 
> diff --git a/arch/arm/plat-mxc/include/mach/hardware.h b/arch/arm/plat-mxc/include/mach/hardware.h
> index ebadf4a..f75a5cc 100644
> --- a/arch/arm/plat-mxc/include/mach/hardware.h
> +++ b/arch/arm/plat-mxc/include/mach/hardware.h
> @@ -22,10 +22,18 @@
>  
>  #include <asm/sizes.h>
>  
> -#define IMX_IO_ADDRESS(addr, module)					\
> -	((void __force __iomem *)					\
> -	 (((unsigned long)((addr) - (module ## _BASE_ADDR)) < module ## _SIZE) ?\
> -	 (addr) - (module ## _BASE_ADDR) + (module ## _BASE_ADDR_VIRT) : 0))
> +#ifdef __ASSEMBLER__
> +#define IOMEM(addr,base,size,virt)	((addr) - (base) + (virt))
> +#else
> +#define IOMEM(addr,base,size,virt)			\
> +	((void __force __iomem *)			\
> +	((unsigned long) ((addr) - (base)) < size) ?	\
> +	(addr) - (base) + (virt) : 0)
> +#endif
> +
> +#define IMX_IO_ADDRESS(addr, module)				\
> +	IOMEM(addr, module ## _BASE_ADDR, module ## _SIZE,	\
> +	module ## _BASE_ADDR_VIRT)
hmmm, the construct used to define MX27_IO_ADDRESS et al. does only work
without __ASSEMBLER__ anyhow, still I think it might be at least
surprising that e.g.

	IOMEM(MX27_WDOG_BASE_ADDR, MX27_SAHB1_BASE_ADDR, MX27_SAHB1_SIZE, MX27_SAHB1_BASE_ADDR_VIRT)

evaluates to 0x84102000 if __ASSEMBLER__ is defined but 0 if not.

I tend to think we should use a different solution.

IMHO it would be great to have a macro that maps physical to virtual
addresses for both assembler and C.  E.g. ns9xxx has something like
that[1], other probably, too, but for imx it would be harder as the used
addresses differ and are spread over the whole address space.  Some time
ago I found a function that would do the task, but Sascha didn't agree
to use it because it involved too much magic.

Best regards
Uwe

[1] io_p2v defined in arch/arm/mach-ns9xxx/include/mach/hardware.h

-- 
Pengutronix e.K.                           | Uwe Kleine-K?nig            |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

  parent reply	other threads:[~2010-03-16  8:52 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-03-09 10:12 [PATCH 1/2] mx1: fix build when DEBUG_LL is enabled Baruch Siach
2010-03-09 10:12 ` [PATCH 2/2] mx25: " Baruch Siach
2010-03-11 10:39 ` [PATCH 1/2] mx1: " Uwe Kleine-König
2010-03-11 10:56   ` Russell King - ARM Linux
2010-03-15  6:22     ` Baruch Siach
2010-03-16  6:35     ` [PATCH 0/3] imx: fix build of assembly code using P2V macros Baruch Siach
2010-03-16  6:35     ` [PATCH 1/3] imx: make IMX_IO_ADDRESS assembly compatible Baruch Siach
2010-03-16  8:41       ` [PATCH, RESEND] " Baruch Siach
2010-03-16 10:05         ` Russell King - ARM Linux
2010-03-16  8:52       ` Uwe Kleine-König [this message]
2010-03-16  9:41         ` [PATCH 1/3] " Baruch Siach
2010-03-16 10:30           ` Uwe Kleine-König
2010-10-22 17:57             ` Uwe Kleine-König
2010-10-26  8:49               ` [PATCH 1/7] mx3: fix the last users of IMX_NEEDS_DEPRECATED_SYMBOLS Uwe Kleine-König
2010-10-26  8:49               ` [PATCH 2/7] imx: refactor the io mapping macro Uwe Kleine-König
2010-10-26  8:49               ` [PATCH 3/7] imx: use MXxy_IO_P2V macros to setup static mappings Uwe Kleine-König
2010-10-26 13:50                 ` Nguyen Dinh-R00091
2010-10-26 13:56                   ` Uwe Kleine-König
2010-10-26  8:49               ` [PATCH 4/7] imx: remove last explicit users of virtual base address defines Uwe Kleine-König
2010-10-26  8:49               ` [PATCH 5/7] RFC/RFT: imx: change static io mapping to use a function Uwe Kleine-König
2010-10-26  8:49               ` [PATCH 6/7] imx/debug-macro: rework using the new io mapping macro Uwe Kleine-König
2010-10-26  8:53                 ` Uwe Kleine-König
2010-10-26  8:49               ` [PATCH 7/7] imx: remove deprecated symbols as all users are gone now Uwe Kleine-König
2010-03-16  6:35     ` [PATCH 2/3] mx1: fix build when DEBUG_LL is enabled Baruch Siach
2010-03-16  6:35     ` [PATCH 3/3] mx25: " Baruch Siach

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=20100316085212.GA29005@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).