From: u.kleine-koenig@pengutronix.de (Uwe Kleine-König)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/6] arm/imx6q: add core definitions and low-level debug uart
Date: Mon, 12 Sep 2011 09:41:47 +0200 [thread overview]
Message-ID: <20110912074147.GE28624@pengutronix.de> (raw)
In-Reply-To: <20110912023000.GC1258@S2100-06.ap.freescale.net>
Hello Shawn,
On Mon, Sep 12, 2011 at 10:30:01AM +0800, Shawn Guo wrote:
> On Wed, Sep 07, 2011 at 02:36:35PM +0200, Uwe Kleine-K?nig wrote:
> > On Wed, Sep 07, 2011 at 07:00:02PM +0800, Shawn Guo wrote:
> > > On Tue, Sep 06, 2011 at 10:25:55PM +0200, Uwe Kleine-K?nig wrote:
> > > > On Tue, Sep 06, 2011 at 05:58:36PM +0800, Shawn Guo wrote:
>
> [...]
>
> > > > > diff --git a/arch/arm/plat-mxc/include/mach/mx6q.h b/arch/arm/plat-mxc/include/mach/mx6q.h
> > > > > new file mode 100644
> > > > > index 0000000..7432310
> > > > > --- /dev/null
> > > > > +++ b/arch/arm/plat-mxc/include/mach/mx6q.h
> > > > > @@ -0,0 +1,29 @@
> > > > > +/*
> > > > > + * Copyright 2011 Freescale Semiconductor, Inc. All Rights Reserved.
> > > > > + * Copyright 2011 Linaro Ltd.
> > > > > + *
> > > > > + * The code contained herein is licensed under the GNU General Public
> > > > > + * License. You may obtain a copy of the GNU General Public License
> > > > > + * Version 2 or later at the following locations:
> > > > > + *
> > > > > + * http://www.opensource.org/licenses/gpl-license.html
> > > > > + * http://www.gnu.org/copyleft/gpl.html
> > > > > + */
> > > > > +
> > > > > +#ifndef __MACH_MX6Q_H__
> > > > > +#define __MACH_MX6Q_H__
> > > > > +
> > > > > +/* static mappings */
> > > > > +#define IMX6Q_VA(x) (0xf4000000 + (x))
> > > > > +
> > > > > +#define MX6Q_SCU_BASE_ADDR 0x00a00000
> > > > > +#define MX6Q_CCM_BASE_ADDR 0x020c4000
> > > > > +#define MX6Q_ANATOP_BASE_ADDR 0x020c8000
> > > > > +#define MX6Q_UART4_BASE_ADDR 0x021f0000
> > > > > +
> > > > > +#define MX6Q_SCU_BASE_VADDR IMX6Q_VA(MX6Q_SCU_BASE_ADDR)
> > > > > +#define MX6Q_CCM_BASE_VADDR IMX6Q_VA(MX6Q_CCM_BASE_ADDR)
> > > > > +#define MX6Q_ANATOP_BASE_VADDR IMX6Q_VA(MX6Q_ANATOP_BASE_ADDR)
> > > > > +#define MX6Q_UART4_BASE_VADDR IMX6Q_VA(MX6Q_UART4_BASE_ADDR)
> > > > Depending on the sizes of these memory regions you can use the existing
> > > > IMX_IO_P2V here. The conditions are:
> > > >
> > > > SCU_SIZE <= 0x200000
> > Actually this should be 0x100000 as this is the size that is mapped in a
> > continous chunk.
> >
> > > > CCM_SIZE <= 0x4000
> > > > ANATOP_SIZE <= 0x28000
> > > > UART4 <= 0x100000
> > > >
> > > This is exactly what I dislike about IMX_IO_P2V(). We have to verify
> > > all these conditions manually. Looking at the static mapping below
> > I did it semi-manual, I just put your constants for imx6q into my script
> > (all with size=0x4000 for now) and it told me:
> >
> > ...
> > * mx6q:
> > * SCU 0x00a00000+0x004000 -> 0xf4000000+0x004000
> > * CCM 0x020c4000+0x004000 -> 0xf42c4000+0x004000
> > * ANATOP 0x020c8000+0x004000 -> 0xf42c8000+0x004000
> > * UART4 0x021f0000+0x004000 -> 0xf42f0000+0x004000
> > ...
> >
> > > (copied from arch/arm/plat-mxc/include/mach/hardware.h), do you think
> > > it's really scalable and easy to maintain for the long run?
> > At least it provides a way to verify the correctness of the mapping.
> > Before I introduced the mapping function there was a conflict IIRC.
> >
> > > /*
> > > * This is rather complicated for humans and ugly to verify, but for a machine
> > > * it's OK. Still more as it is usually only applied to constants. The upsides
> > > * on using this approach are:
> > > *
> > > * - same mapping on all i.MX machines
> > > * - works for assembler, too
> > > * - no need to nurture #defines for virtual addresses
> > > *
> > > * The downside it, it's hard to verify (but I have a script for that).
> > If you want I can provide you that script.
> >
> Yes, please. I would use IMX_IO_P2V() in the next post.
I just found a bug in the conflict detection code, so I put it in a
repository to prevent the broken script to enter the archives. You can
find it on
git://git.pengutronix.de/git/ukl/imx-iop2v.git
> [...]
>
> > > #define IMX_IO_P2V(x) ( \
> > > 0xf4000000 + \
> > > (((x) & 0x50000000) >> 6) + \
> > > (((x) & 0x0b000000) >> 4) + \
> > > (((x) & 0x000fffff)))
> > >
> > > > hmm, looking at patch 4 SCU_BASE is determined by a coprocessor
> > > > instruction?!
> > >
> > > Ah, yes. The SCU physical base address can be retrieved from
> > > coprocessor.
> > Is there an advantage in autodetecting the base address?
> >
> Any disadvantage for doing so?
It makes
#define MX6Q_SCU_BASE_ADDR 0x00a00000
superfluous. And in case the real address is different it might make
IMX_IO_P2V(real scu address) != scu_io_desc.virtual
which makes the scriptable check for conflicts kind of useless and might
come as a surprise.
Best regards
Uwe
--
Pengutronix e.K. | Uwe Kleine-K?nig |
Industrial Linux Solutions | http://www.pengutronix.de/ |
next prev parent reply other threads:[~2011-09-12 7:41 UTC|newest]
Thread overview: 69+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-09-06 9:58 [PATCH 0/6] add initial imx6q support Shawn Guo
2011-09-06 9:58 ` [PATCH 1/6] arm/imx6q: add device tree source Shawn Guo
2011-09-06 18:31 ` Arnd Bergmann
2011-09-07 11:16 ` Shawn Guo
2011-09-06 9:58 ` [PATCH 2/6] arm/imx6q: add core definitions and low-level debug uart Shawn Guo
2011-09-06 18:39 ` Arnd Bergmann
2011-09-07 8:50 ` Shawn Guo
2011-09-06 20:25 ` Uwe Kleine-König
2011-09-07 11:00 ` Shawn Guo
2011-09-07 12:36 ` Uwe Kleine-König
2011-09-07 14:23 ` Russell King - ARM Linux
2011-09-07 15:36 ` Nicolas Pitre
2011-09-08 14:56 ` Arnd Bergmann
2011-09-09 17:28 ` Tony Lindgren
2011-09-12 2:30 ` Shawn Guo
2011-09-12 7:41 ` Uwe Kleine-König [this message]
2011-09-12 8:43 ` Shawn Guo
2011-09-12 8:44 ` Sascha Hauer
2011-09-12 11:36 ` Shawn Guo
2011-09-12 14:14 ` Russell King - ARM Linux
2011-09-17 11:59 ` Russell King - ARM Linux
2011-09-15 1:24 ` Shawn Guo
2011-09-06 9:58 ` [PATCH 3/6] arm/imx6q: add core drivers clock, gpc, mmdc and src Shawn Guo
2011-09-06 19:14 ` Arnd Bergmann
2011-09-07 6:05 ` Shawn Guo
2011-09-07 7:56 ` Arnd Bergmann
2011-09-12 16:12 ` Shawn Guo
2011-09-12 19:40 ` Grant Likely
2011-09-12 20:28 ` Arnd Bergmann
2011-09-12 21:04 ` Grant Likely
2011-09-13 0:07 ` Shawn Guo
2011-09-07 12:43 ` Barry Song
2011-09-08 6:48 ` Shawn Guo
2011-09-11 2:28 ` Barry Song
2011-09-12 19:16 ` Grant Likely
2011-09-12 9:46 ` Sascha Hauer
2011-09-12 11:49 ` Shawn Guo
2011-09-12 12:36 ` Uwe Kleine-König
2011-09-12 12:40 ` Arnd Bergmann
2011-09-12 14:27 ` Shawn Guo
2011-09-15 1:26 ` Shawn Guo
2011-09-06 9:58 ` [PATCH 4/6] arm/imx6q: add smp and cpu hotplug support Shawn Guo
2011-09-06 18:53 ` Arnd Bergmann
2011-09-07 4:41 ` Shawn Guo
2011-09-07 5:08 ` Shilimkar, Santosh
2011-09-07 7:46 ` Shawn Guo
2011-09-06 9:58 ` [PATCH 5/6] arm/imx6q: add device tree machine support Shawn Guo
2011-09-06 18:55 ` Arnd Bergmann
2011-09-07 3:07 ` Shawn Guo
2011-09-07 7:26 ` Arnd Bergmann
2011-09-06 9:58 ` [PATCH 6/6] arm/imx6q: add suspend/resume support Shawn Guo
2011-09-06 18:56 ` Arnd Bergmann
2011-09-07 13:50 ` Barry Song
2011-09-08 6:23 ` Shawn Guo
2011-09-08 7:47 ` Russell King - ARM Linux
2011-09-08 15:22 ` Shawn Guo
2011-09-08 16:24 ` Russell King - ARM Linux
2011-09-08 17:09 ` Lorenzo Pieralisi
2011-09-09 7:40 ` Shawn Guo
2011-09-09 6:31 ` Barry Song
2011-09-09 7:32 ` Shawn Guo
2011-09-09 8:15 ` Russell King - ARM Linux
2011-09-09 10:15 ` Shawn Guo
2011-09-09 18:47 ` Russell King - ARM Linux
2011-09-06 18:28 ` [PATCH 0/6] add initial imx6q support Arnd Bergmann
2011-09-06 19:42 ` Uwe Kleine-König
2011-09-07 2:55 ` Shawn Guo
2011-09-07 9:39 ` Arnd Bergmann
2011-09-07 2:51 ` Shawn Guo
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=20110912074147.GE28624@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).