public inbox for devicetree@vger.kernel.org
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd-r2nGTMty4D4@public.gmane.org>
To: Thomas Petazzoni
	<thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
Cc: "jonsmirl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org"
	<jonsmirl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>,
	"devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>
Subject: Re: CPU revision IDs
Date: Fri, 13 Jun 2014 14:56:06 +0200	[thread overview]
Message-ID: <4285095.l6sVUI20tQ@wuerfel> (raw)
In-Reply-To: <20140613144355.20412fa6-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>

On Friday 13 June 2014 14:43:55 Thomas Petazzoni wrote:
> On Fri, 13 Jun 2014 08:29:41 -0400, jonsmirl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org wrote:
> > How are CPU revision IDs encoded into the device tree? It is not
> > reasonable to ask people to manually identify their revision and then
> > use the right device tree. For example a heat sink may obscure the
> > markings. The CPU ID is needed for device driver quirks.
> > 
> > I was thinking of doing something like adding code at early boot that
> > fixes up the root compatible string. The revision is a
> > property of the CPU.
> > 
> > Code changes this:
> >  compatible = "cubietech,cubietruck", "allwinner,sun7i-a20"
> > to:
> >  compatible = "cubietech,cubietruck",  "allwinner,sun7i-a20a",
> > "allwinner,sun7i-a20"
> > 
> > Alternatively this could be done in uboot.
> > 
> > Browsing around the kernel code there seems to be multiple solutions
> > to this problem.  For example this Marvell code modifies the device
> > driver compatible string.
> > 
> > http://lxr.free-electrons.com/source/arch/arm/mach-mvebu/board-v7.c#L71
> 
> Yes, the way we handle that on Marvell EBU platforms is that we runtime
> detect the revision of the SoC, and use this information to adjust the
> Device Tree information for this or that device that is known to have
> issues/differences. For example, early revisions of Armada XP
> processors have an issue in the I2C controller which prevents an
> optimization feature from being used, so the code in board-v7.c detects
> this early revision, and changes the Device Tree compatible string used
> to probe the I2C controller, to a different compatible string that lets
> the driver know that the feature shouldn't be used.

I think the best approach always depends on the specific situation, in
particular what the differences are between revisions and how easy to
detect the revision is.

Ideally all knowledge about different versions of an on-chip device
are kept inside of the driver for that device. E.g. if they fixed a
bug in the audio component, the audio driver should first try to find
out the revision by looking at its own registers. If that doesn't work,
the compatible strings for that device should be different for each
revision and hardcoded in dts sources per board. This was problematic
for the mvebu i2c controller as well, because one board was known to
come in multiple revisions, so a hack was added in the platform code.

Hanging driver specifics off the top-level compatible string however
doesn't feel right. If the boot loader is going to fix it up, it should
patch both the top-level strings and the devices that are actually
different.

	Arnd
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2014-06-13 12:56 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-13 12:29 CPU revision IDs jonsmirl-Re5JQEeQqe8AvxtiuMwx3w
     [not found] ` <CAKON4OwNULPeQFHwRhRfri86yexMvvKfrw_dthim4_oPWvMD3g-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-06-13 12:43   ` Thomas Petazzoni
     [not found]     ` <20140613144355.20412fa6-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.org>
2014-06-13 12:56       ` Arnd Bergmann [this message]
2014-06-13 13:05         ` jonsmirl-Re5JQEeQqe8AvxtiuMwx3w
     [not found]           ` <CAKON4OxzJ7UoKnMgf+sckksjG-rx8NG1tUvPj2qaHNsda0j3jQ-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-06-13 13:08             ` Arnd Bergmann
2014-06-13 13:14               ` jonsmirl-Re5JQEeQqe8AvxtiuMwx3w
     [not found]                 ` <CAKON4Ox+tCgiu6N988ds7ED2KbECw=60Y6BRqV_2UcM+vshw4Q-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-06-13 13:20                   ` Maxime Ripard
2014-06-13 13:34                     ` jonsmirl-Re5JQEeQqe8AvxtiuMwx3w
     [not found]                       ` <CAKON4OxZLaL9sJFPjnUhec_LMZKGvGXrKyUjW-whHzY6byVUxw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-06-13 13:58                         ` Maxime Ripard
2014-06-13 14:37                           ` jonsmirl-Re5JQEeQqe8AvxtiuMwx3w
     [not found]                             ` <CAKON4Oz44X7G+yM2R-XX_D_6FV4ekWiOKY2t_p0Y3+gUXJ17iw-JsoAwUIsXosN+BqQ9rBEUg@public.gmane.org>
2014-06-18  8:07                               ` Maxime Ripard

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=4285095.l6sVUI20tQ@wuerfel \
    --to=arnd-r2ngtmty4d4@public.gmane.org \
    --cc=devicetree-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=jonsmirl-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org \
    --cc=thomas.petazzoni-wi1+55ScJUtKEb57/3fJTNBPR1lH4CV8@public.gmane.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