All of lore.kernel.org
 help / color / mirror / Atom feed
From: Zhiqiang Hou <zhiqiang.hou@nxp.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/5] fsl: serdes: ensure accessing the initialized maps of serdes protocol
Date: Wed, 20 Jul 2016 09:38:38 +0000	[thread overview]
Message-ID: <AMSPR04MB195F0625CA5BC62797F335884080@AMSPR04MB195.eurprd04.prod.outlook.com> (raw)
In-Reply-To: <AM4PR0401MB1732D18E35A863FBC15F874F9A370@AM4PR0401MB1732.eurprd04.prod.outlook.com>

Hi York,

Thanks for your comments!

> -----Original Message-----
> From: york sun
> Sent: 2016?7?19? 23:46
> To: Zhiqiang Hou <zhiqiang.hou@nxp.com>; u-boot at lists.denx.de;
> albert.u.boot at aribaud.net; wd at denx.de; Prabhakar Kushwaha
> <prabhakar.kushwaha@nxp.com>; alison.wang at freescale.com;
> Mingkai.Hu at freescale.com
> Cc: yao.yuan at freescale.com; Qianyu.Gong at freescale.com;
> bmeng.cn at gmail.com; Shengzhou Liu <shengzhou.liu@nxp.com>
> Subject: Re: [PATCH 1/5] fsl: serdes: ensure accessing the initialized maps of serdes
> protocol
> 
> On 07/03/2016 11:39 PM, Zhiqiang Hou wrote:
> > From: Hou Zhiqiang <Zhiqiang.Hou@nxp.com>
> >
> > Up to now, the function is_serdes_configed() doesn't check if the map
> > of serdes protocol is initialized before accessing it. The function
> > is_serdes_configed() will get wrong result when it was called before
> > the serdes protocol maps initialized. As the first eliment of the map
> 
> s/eliment/element
 
Will fix my spelling mistakes next version, thanks a lot!

> > isn't used for any device, so use it as the flag to indicate if the
> > map has been initialized.
> 
> I am not sure it is safe to presume the first element is always not used. Take
> LS2080A as an example, the serdes map array is initialized by serdes_init(), which
> calls serdes_get_prtcl() to get the index of the array. With normal condition, the
> index shouldn't be zero. Zero is used as an error but it is not checked before setting
> 
> serdes_prtcl_map[lane_prtcl] = 1;
> 

The first element of enum srds_prtcl 'NONE' is aim to describe a lane isn't assigned to
any device, and the array serdesn_prtcl_map is used to check if the specified device
selected by the current serdes protocol, right? Nobody will check if the device 'NONE'
has been configured, right? So it can be used to indicate if the serdes_prtcl_map has
been initialized.
Don't care whether the function serdes_get_prtcl() will return zero, just focus if the
serdes protocol map has been filled. For example, if the serdes protocol value read from
RCW doesn't match with any entry of the serdes_cfg_tbl, then all lane will be assigned to
'NONE'. It still means the serdes protocol map has been filled, even if there is only the
serdesn_prtcl_map[NONE] was set to 1.

> If you presumption is correct, and you want to use the first one as a flag, you
> probably need to check all of them to make sure errors are handled correctly,
> instead of setting the flag unexpected. Also it is important to document this idea
> so future platform code follows the same.
> 

Is it necessary to add it to a document, if add a comment to the serdesn_prtcl_map make it?

Thanks,
Zhiqiang

  reply	other threads:[~2016-07-20  9:38 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-07-04  6:28 [U-Boot] [PATCH 1/5] fsl: serdes: ensure accessing the initialized maps of serdes protocol Zhiqiang Hou
2016-07-04  6:28 ` [U-Boot] [PATCH 2/5] arm: fsl-layerscape: move forward the non-secure access permission setup Zhiqiang Hou
2016-07-04  6:28 ` [U-Boot] [PATCH 3/5] fsl: csu: add an API to set individual device access permission Zhiqiang Hou
2016-07-21  4:38   ` Prabhakar Kushwaha
2016-07-21  7:55     ` Zhiqiang Hou
2016-07-04  6:28 ` [U-Boot] [PATCH 4/5] fsl: csu: add an API to disable all R/W permission to PCIe Zhiqiang Hou
2016-07-04  6:28 ` [U-Boot] [PATCH 5/5] fsl-layerscape: Add workaround for PCIe erratum A010315 Zhiqiang Hou
2016-07-19 16:01   ` york sun
2016-07-20 10:04     ` Zhiqiang Hou
2016-07-19  7:04 ` [U-Boot] [PATCH 1/5] fsl: serdes: ensure accessing the initialized maps of serdes protocol Zhiqiang Hou
2016-07-19 15:45 ` york sun
2016-07-20  9:38   ` Zhiqiang Hou [this message]
2016-07-20 21:15     ` york sun
2016-07-21  2:42       ` Zhiqiang Hou
2016-07-21  4:28       ` Prabhakar Kushwaha
2016-07-21  7:40         ` Zhiqiang Hou

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=AMSPR04MB195F0625CA5BC62797F335884080@AMSPR04MB195.eurprd04.prod.outlook.com \
    --to=zhiqiang.hou@nxp.com \
    --cc=u-boot@lists.denx.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.