linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
From: w.sang@pengutronix.de (Wolfram Sang)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 1/2] ARM: mxs: detect SoC by checking CHIPID register
Date: Fri, 6 Jan 2012 12:40:29 +0100	[thread overview]
Message-ID: <20120106114029.GB2610@pengutronix.de> (raw)
In-Reply-To: <1325817712-4573-2-git-send-email-shawn.guo@linaro.org>

On Fri, Jan 06, 2012 at 10:41:51AM +0800, Shawn Guo wrote:
> Both imx23 and imx28 have CHIPID register at address 0x8001c310, which
> can be used to identify the SoC.  This patch changes cpu_is_xxx and
> __arch_decomp_setup to use this CHIPID register than machine type to
> detect the chip between imx23 and imx28, so that we do not need to
> change these functions whenever a new board/machine gets added.
> 
> Suggested-by: Wolfram Sang <w.sang@pengutronix.de>
> Signed-off-by: Shawn Guo <shawn.guo@linaro.org>

[...]

> +
> +/*
> + * MXS CPU types
> + */
> +#define CHIPID	(MXS_IO_ADDRESS(MXS_DIGCTL_BASE_ADDR) + 0x310)

Hmm, in general I don't like accessing single registers this way. Since
we only read, it might work for now, but I think it will turn ugly the
more we use from DIGCTL (which is annoying to abstract, yes).

0x310 should not be hardcoded. CHIPID could be MXS_CHIPID.

> diff --git a/arch/arm/mach-mxs/include/mach/uncompress.h b/arch/arm/mach-mxs/include/mach/uncompress.h
> index 6777674..a8de26d 100644
> --- a/arch/arm/mach-mxs/include/mach/uncompress.h
> +++ b/arch/arm/mach-mxs/include/mach/uncompress.h
> @@ -55,16 +55,17 @@ static inline void flush(void)
>  
>  #define MX23_DUART_BASE_ADDR	0x80070000
>  #define MX28_DUART_BASE_ADDR	0x80074000
> +#define MXS_DIGCTL_CHIPID	0x8001c310
>  
>  static inline void __arch_decomp_setup(unsigned long arch_id)
>  {
> -	switch (arch_id) {
> -	case MACH_TYPE_MX23EVK:
> +	u16 chipid = (*(volatile unsigned long *) MXS_DIGCTL_CHIPID) >> 16;

Can't we use the cpu_is-functions here?

Regards,

   Wolfram

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120106/a5c81ef0/attachment.sig>

  reply	other threads:[~2012-01-06 11:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-06  2:41 [PATCH 0/2] ARM: mxs: use CHIPID hardware to detect SoC Shawn Guo
2012-01-06  2:41 ` [PATCH 1/2] ARM: mxs: detect SoC by checking CHIPID register Shawn Guo
2012-01-06 11:40   ` Wolfram Sang [this message]
2012-01-06 13:39     ` Shawn Guo
2012-01-06 13:43       ` Wolfram Sang
2012-01-06  2:41 ` [PATCH 2/2] ARM: mxs: Add initial support for Bluegiga APX4 Development Kit Shawn Guo
2012-01-06 11:26 ` [PATCH 0/2] ARM: mxs: use CHIPID hardware to detect SoC Lauri Hintsala

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=20120106114029.GB2610@pengutronix.de \
    --to=w.sang@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).