mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
To: Qiang Zhao <qiang.zhao@nxp.com>, Leo Li <leoyang.li@nxp.com>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Valentin Longchamp <valentin.longchamp@keymile.com>,
	Scott Wood <oss@buserror.net>,
	Rasmus Villemoes <Rasmus.Villemoes@prevas.se>
Subject: Re: [RFC PATCH] soc/fsl/qe: support MPC8309
Date: Thu, 28 Feb 2019 08:11:28 +0000	[thread overview]
Message-ID: <338677b2-ef74-2afc-4542-c66f1acdb7e5@prevas.dk> (raw)
In-Reply-To: <VI1PR04MB32475CFE4827D2141262D34E91750@VI1PR04MB3247.eurprd04.prod.outlook.com>

On 28/02/2019 08.14, Qiang Zhao wrote:
> On Tue, Feb 26, 2019 at 2:49 AM Rasmus Villemoes <rasmus.villemoes@prevas.dk> wrote:
>> -----Original Message-----
>> From: Rasmus Villemoes <rasmus.villemoes@prevas.dk>
>> Sent: 2019年2月26日 16:48
>> To: Qiang Zhao <qiang.zhao@nxp.com>; Leo Li <leoyang.li@nxp.com>
>> Cc: linux-kernel@vger.kernel.org; Valentin Longchamp
>> <valentin.longchamp@keymile.com>; Scott Wood <oss@buserror.net>;
>> Rasmus Villemoes <Rasmus.Villemoes@prevas.se>
>> Subject: [RFC PATCH] soc/fsl/qe: support MPC8309
>>
>> Currently, when device tree specifies fsl,qe-num-snums = 28 (which a number
>> of in-tree .dts files do, and which is the default when that property is missing),
>> qe_snums_init() ends up using the first 28 elements of the snum_init_46[]
>> array.
>>
>> The situation is quite messy. This patch may break existing setups that for
>> some reason work with specifying fsl,qe-num-snums = 28 and using the
>> existing snum_init_46 array. OTOH, the current code certainly does not work
>> for the MPC8309-based board we're working on, since the first 14 of the
>> elements in snum_init_46 are "Not available on
>> MPC8306/MPC8306S/MPC8309" according to the QUICC Engine Reference
>> Manual (Table 4-30) - and indeed, without this patch (or something to the
>> same effect), we get
> 
> According to the QUICC Engine Reference Manual (Table 4-30), the number of snums used for 
> " MPC8306/MPC8306S/MPC8309" should be 14 instead of 28, so maybe we should assign "fsl,qe-num-snums = 14"
> And define a new snum_init_14 array, meanwhile, modify the minimum value of "num_of_snums" to 14 in function "qe_get_num_of_snums"
> (I mean: " if ((num_of_snums < 14) || (num_of_snums > QE_NUM_OF_SNUM)) {")

Perhaps, but it's completely unclear to me why the code would contain a
comment /* No QE ever has fewer than 28 SNUMs */ when that then appears
to be wrong. It is also far from clear why the snums such as 0x08, 0x09
etc. that appear in table 4-30 without any assigned meaning do appear in
the existing snum_init_46 table - but of course, those elements of that
array don't currently happen to be used when qe_get_num_of_snums==28
(but they do get used for e.g. mpc8569 which specifies fsl,qe-num-snums=46).

Altogether, I think it's a completely wrong approach to pretend that the
_set of valid snums_ is a function of the _number of snums_ alone - the
footnotes to table 4-30 make it abundantly clear that one really cannot
expect such a simple relationship.

So, I suggest deprecating the fsl,qe-num-snums binding, in favor of a
more sensible

fsl,qe-snums = /bits/ 8 <0x88 0x89 0x98 0x99 ...>

which will automatically encode both the number of snums as well as the
concrete values to be used.

Rasmus

  reply	other threads:[~2019-02-28  8:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-26  8:48 Rasmus Villemoes
2019-02-28  7:14 ` Qiang Zhao
2019-02-28  8:11   ` Rasmus Villemoes [this message]
2019-02-28 10:30     ` [PATCH 0/4] soc/fsl/qe: qe.c: cleanups and support for MPC8309 Rasmus Villemoes
2019-02-28 10:30       ` [PATCH 1/4] soc/fsl/qe: qe.c: drop useless static qualifier Rasmus Villemoes
2019-02-28 10:30       ` [PATCH 2/4] soc/fsl/qe: qe.c: reduce static memory footprint by 1.7K Rasmus Villemoes
2019-02-28 10:30       ` [PATCH 3/4] soc/fsl/qe: qe.c: introduce qe_get_device_node helper Rasmus Villemoes
2019-02-28 10:30       ` [PATCH 4/4] soc/fsl/qe: qe.c: support fsl,qe-snums property Rasmus Villemoes
2019-03-01  3:36         ` Qiang Zhao
2019-03-01  7:50           ` Rasmus Villemoes
2019-03-01  9:43             ` Qiang Zhao
2019-03-01 10:21               ` Rasmus Villemoes
2019-03-01 14:57                 ` [PATCH 5/4] soc/fsl/qe: qe.c: fold qe_get_num_of_snums into qe_snums_init Rasmus Villemoes

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=338677b2-ef74-2afc-4542-c66f1acdb7e5@prevas.dk \
    --to=rasmus.villemoes@prevas.dk \
    --cc=Rasmus.Villemoes@prevas.se \
    --cc=leoyang.li@nxp.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=oss@buserror.net \
    --cc=qiang.zhao@nxp.com \
    --cc=valentin.longchamp@keymile.com \
    /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

all inboxes | Powered by JetHome®