public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Lukasz Majewski <lukma@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL
Date: Thu, 22 Aug 2019 22:47:42 +0200	[thread overview]
Message-ID: <20190822224742.0116b4ed@jawa> (raw)
In-Reply-To: <AM5PR04MB32994988180CD34609D3EC24F5A50@AM5PR04MB3299.eurprd04.prod.outlook.com>

On Thu, 22 Aug 2019 01:56:48 +0000
Xiaowei Bao <xiaowei.bao@nxp.com> wrote:

> > -----Original Message-----
> > From: Lukasz Majewski <lukma@denx.de>
> > Sent: 2019年8月20日 17:50
> > To: Xiaowei Bao <xiaowei.bao@nxp.com>
> > Cc: wd at denx.de; Ruchika Gupta <ruchika.gupta@nxp.com>; Shengzhou Liu
> > <shengzhou.liu@nxp.com>; jagan at amarulasolutions.com; Prabhakar
> > Kushwaha <prabhakar.kushwaha@nxp.com>; u-boot at lists.denx.de; Jiafei
> > Pan <jiafei.pan@nxp.com>; Chuanhua Han <chuanhua.han@nxp.com>
> > Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash
> > for non-DM SPL
> > 
> > On Tue, 20 Aug 2019 09:00:40 +0000
> > Xiaowei Bao <xiaowei.bao@nxp.com> wrote:
> >   
> > > > -----Original Message-----
> > > > From: Lukasz Majewski <lukma@denx.de>
> > > > Sent: 2019年8月20日 16:20
> > > > To: Xiaowei Bao <xiaowei.bao@nxp.com>
> > > > Cc: wd at denx.de; Ruchika Gupta <ruchika.gupta@nxp.com>;
> > > > Shengzhou  
> > Liu  
> > > > <shengzhou.liu@nxp.com>; jagan at amarulasolutions.com; Prabhakar
> > > > Kushwaha <prabhakar.kushwaha@nxp.com>; u-boot at lists.denx.de;
> > > > Jiafei Pan <jiafei.pan@nxp.com>; Chuanhua Han
> > > > <chuanhua.han@nxp.com> Subject: Re: [U-Boot] [PATCH v5 1/5]
> > > > spl: dm: disable SPI DM flash for non-DM SPL
> > > >
> > > > On Tue, 20 Aug 2019 07:51:18 +0000
> > > > Xiaowei Bao <xiaowei.bao@nxp.com> wrote:
> > > >  
> > > > > > -----Original Message-----
> > > > > > From: Lukasz Majewski <lukma@denx.de>
> > > > > > Sent: 2019年8月20日 15:43
> > > > > > To: Xiaowei Bao <xiaowei.bao@nxp.com>
> > > > > > Cc: wd at denx.de; Ruchika Gupta <ruchika.gupta@nxp.com>;  
> > Shengzhou  
> > > > Liu  
> > > > > > <shengzhou.liu@nxp.com>; jagan at amarulasolutions.com;
> > > > > > Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>;
> > > > > > u-boot at lists.denx.de; Jiafei Pan <jiafei.pan@nxp.com>; Pan
> > > > > > Jiafei <Jiafei.Pan@freescale.com>; Chuanhua Han  
> > <chuanhua.han@nxp.com>  
> > > > > > Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM
> > > > > > flash for non-DM SPL
> > > > > >
> > > > > > On Tue, 20 Aug 2019 07:27:39 +0000 Xiaowei Bao
> > > > > > <xiaowei.bao@nxp.com> wrote:
> > > > > >  
> > > > > > > > -----Original Message-----
> > > > > > > > From: Lukasz Majewski <lukma@denx.de>
> > > > > > > > Sent: 2019年8月20日 15:14
> > > > > > > > To: Xiaowei Bao <xiaowei.bao@nxp.com>
> > > > > > > > Cc: wd at denx.de; Ruchika Gupta <ruchika.gupta@nxp.com>;  
> > > > Shengzhou  
> > > > > > Liu  
> > > > > > > > <shengzhou.liu@nxp.com>; jagan at amarulasolutions.com;
> > > > > > > > Prabhakar Kushwaha <prabhakar.kushwaha@nxp.com>;
> > > > > > > > u-boot at lists.denx.de; Jiafei Pan <jiafei.pan@nxp.com>;
> > > > > > > > Pan Jiafei <Jiafei.Pan@freescale.com>; Chuanhua Han  
> > > > <chuanhua.han@nxp.com>  
> > > > > > > > Subject: Re: [U-Boot] [PATCH v5 1/5] spl: dm: disable
> > > > > > > > SPI DM flash for non-DM SPL
> > > > > > > >
> > > > > > > > Hi Xiaowei,
> > > > > > > >  
> > > > > > > > > From: Chuanhua Han <chuanhua.han@nxp.com>
> > > > > > > > >
> > > > > > > > > This patch solves the problem that spiboot cannot be
> > > > > > > > > performed in non-DM SPL.  
> > > > > > > >
> > > > > > > > I've posted recently a set of patches to move setting of
> > > > > > > > DM_SPI_FLASH to Kconfig:
> > > > > > > > https://patchwork.ozlabs.org/cover/1146494/
> > > > > > > >
> > > > > > > > Please rebase your work on top of it.  
> > > > > > > Did this set of patches merge to the u-boot mainline?  
> > > > > >
> > > > > > Those patches were not yet accepted to mainline.
> > > > > >  
> > > > > > > Do I need to
> > > > > > > depend on your patches?  
> > > > > >
> > > > > > It would be best to avoid duplicating the effort.
> > > > > >  
> > > > > > > If yes, please provide the full patches link, I can't see
> > > > > > > the contents of this set of patches.  
> > > > > >
> > > > > > When you open the link:
> > > > > > https://patchwork.ozlabs.org/cover/1146494/
> > > > > >
> > > > > > On top left you have:
> > > > > > "Related" -> "show"
> > > > > >
> > > > > > After clicking on it you will see the list of patches.
> > > > > >
> > > > > > You may also want to use "Series" on top right and download
> > > > > > the whole patch series.  
> > > > > I have check these set of patches, it don't impact my
> > > > > patches, my patches implemented the ESPI DM driver of
> > > > > POWERPC.  
> > > >
> > > > But you add:
> > > >
> > > > +#undef CONFIG_DM_SPI_FLASH
> > > >
> > > > for SPL, Which is problematic as explained in the patch set.  
> > > Can I modify the patches like this?
> > > diff --git a/include/config_uncmd_spl.h
> > > b/include/config_uncmd_spl.h index da94b3d..c2f9735 100644
> > > --- a/include/config_uncmd_spl.h
> > > +++ b/include/config_uncmd_spl.h
> > > @@ -15,7 +15,6 @@
> > >  #undef CONFIG_DM_GPIO
> > >  #undef CONFIG_DM_I2C
> > >  #undef CONFIG_DM_SPI
> > > -#undef CONFIG_DM_SPI_FLASH
> > >  #endif
> > >
> > >  #undef CONFIG_DM_WARN
> > > diff --git a/include/configs/T208xQDS.h
> > > b/include/configs/T208xQDS.h index 98bb334..b45ec4a 100644
> > > --- a/include/configs/T208xQDS.h
> > > +++ b/include/configs/T208xQDS.h
> > > @@ -10,6 +10,13 @@
> > >  #ifndef __T208xQDS_H
> > >  #define __T208xQDS_H
> > >
> > > +/* SPI Flash Configs */
> > > +#if defined(CONFIG_SPL_BUILD)
> > > +#undef CONFIG_DM_SPI
> > > +#undef CONFIG_DM_SPI_FLASH
> > > +#undef CONFIG_SPI_FLASH_MTD
> > > +#endif  
> > 
> > The whole point is to avoid adding the above code.
> > 
> > The rationale for this can be found in the commit message:
> > https://patchwork.ozlabs.org/patch/1146375/  
> Hi Lukasz, thanks for your comments, ask a question, I modify my
> driver like this: diff --git a/drivers/spi/fsl_espi.c
> b/drivers/spi/fsl_espi.c index fd5ac97..54be036 100644
> --- a/drivers/spi/fsl_espi.c
> +++ b/drivers/spi/fsl_espi.c
> @@ -367,6 +367,7 @@ void espi_setup_slave(struct fsl_spi_slave *fsl)
>                                 * 10), spi_freq);/* Set eSPI BRG
> clock source */ }
> 
>  #ifndef CONFIG_DM_SPI
> +#if !CONFIG_IS_ENABLED(DM_SPI)
>  int spi_cs_is_valid(unsigned int bus, unsigned int cs)
>  {
> 
> diff --git a/configs/T2080QDS_SPIFLASH_defconfig
> b/configs/T2080QDS_SPIFLASH_defconfig index 7a1c580..cf53e54 100644
> --- a/configs/T2080QDS_SPIFLASH_defconfig
> +++ b/configs/T2080QDS_SPIFLASH_defconfig
> @@ -80,3 +80,5 @@ CONFIG_DM_SPI=y
>  CONFIG_DM_SPI_FLASH=y
> +CONFIG_SPL_DM_SPI=y
> +CONFIG_SPL_DM_SPI_FLASH=y
> 
> When I compile the driver with SPL mode, the DM or non DM mode cod
> will be compiled together, I think CONFIG_IS_ENABLED(DM_SPI) is 0 or
> 1, so the DM code or non DM code will be compiled, but not both, this
> make me confused, do I miss something, could you tell me the reason?
> Thanks a lot.

So the CONFIG_IS_ENABLED(FOO) is true if:

1. The CONFIG_FOO is defined in Kconfig files (if it is defined in
./include/configs/<board.h> then CONFIG_IS_ENABLED will return false,
which is wrong).

2. The CONFIG_IS_ENABLED(FOO) is true if in Kconfig you have defined
CONFIG_FOO

3. CONFIG_IS_ENABLED(FOO) is true if in Kconfig you have defined
CONFIG_SPL_FOO

So the CONFIG_IS_ENABLED(FOO) shall be used in conjunction with
CONFIG_DM_FOO (SPI in your case).


> 
> >   
> > > +  
> > > >  
> > > > > >  
> > > > > > > >  
> > > > > > > > >
> > > > > > > > > Signed-off-by: Pan Jiafei <Jiafei.Pan@freescale.com>
> > > > > > > > > Signed-off-by: Chuanhua Han <chuanhua.han@nxp.com>
> > > > > > > > > ---
> > > > > > > > > Changes in v5:
> > > > > > > > > 	- No change.
> > > > > > > > > Changes in v4:
> > > > > > > > > 	- No change.
> > > > > > > > > Changes in v3:
> > > > > > > > > 	- Add a cover-letter for this patch set.
> > > > > > > > > Changes in v2:
> > > > > > > > > 	- No change.
> > > > > > > > >
> > > > > > > > >  include/config_uncmd_spl.h | 1 +
> > > > > > > > >  1 file changed, 1 insertion(+)
> > > > > > > > >
> > > > > > > > > diff --git a/include/config_uncmd_spl.h
> > > > > > > > > b/include/config_uncmd_spl.h index c2f9735..da94b3d
> > > > > > > > > 100644 --- a/include/config_uncmd_spl.h
> > > > > > > > > +++ b/include/config_uncmd_spl.h
> > > > > > > > > @@ -15,6 +15,7 @@
> > > > > > > > >  #undef CONFIG_DM_GPIO
> > > > > > > > >  #undef CONFIG_DM_I2C
> > > > > > > > >  #undef CONFIG_DM_SPI
> > > > > > > > > +#undef CONFIG_DM_SPI_FLASH
> > > > > > > > >  #endif
> > > > > > > > >
> > > > > > > > >  #undef CONFIG_DM_WARN  
> > > > > > > >
> > > > > > > >
> > > > > > > >
> > > > > > > > Best regards,
> > > > > > > >
> > > > > > > > Lukasz Majewski
> > > > > > > >
> > > > > > > > --
> > > > > > > >
> > > > > > > > DENX Software Engineering GmbH,      Managing Director:
> > > > > > > >  
> > > > Wolfgang  
> > > > > > > > Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194
> > > > > > > > Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
> > > > > > > > (+49)-8142-66989-80 Email: lukma at denx.de  
> > > > > >
> > > > > >
> > > > > >
> > > > > > Best regards,
> > > > > >
> > > > > > Lukasz Majewski
> > > > > >
> > > > > > --
> > > > > >
> > > > > > DENX Software Engineering GmbH,      Managing Director:  
> > Wolfgang  
> > > > > > Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194
> > > > > > Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
> > > > > > (+49)-8142-66989-80 Email: lukma at denx.de  
> > > >
> > > >
> > > >
> > > > Best regards,
> > > >
> > > > Lukasz Majewski
> > > >
> > > > --
> > > >
> > > > DENX Software Engineering GmbH,      Managing Director: Wolfgang
> > > > Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194
> > > > Groebenzell, Germany Phone: (+49)-8142-66989-59 Fax:
> > > > (+49)-8142-66989-80 Email: lukma at denx.de  
> > 
> > 
> > 
> > Best regards,
> > 
> > Lukasz Majewski
> > 
> > --
> > 
> > DENX Software Engineering GmbH,      Managing Director: Wolfgang
> > Denk HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell,
> > Germany Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email:
> > lukma at denx.de  



Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma at denx.de
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 488 bytes
Desc: OpenPGP digital signature
URL: <http://lists.denx.de/pipermail/u-boot/attachments/20190822/e8069327/attachment.sig>

  reply	other threads:[~2019-08-22 20:47 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-20  6:59 [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL Xiaowei Bao
2019-08-20  6:59 ` [U-Boot] [PATCH v5 2/5] dm: spi: Convert Freescale ESPI driver to driver model Xiaowei Bao
2019-08-20 11:03   ` Joakim Tjernlund
2019-08-21  1:19     ` Xiaowei Bao
2019-08-21  7:51       ` Joakim Tjernlund
2019-08-21  9:46         ` Xiaowei Bao
2019-08-21 11:24           ` Joakim Tjernlund
2019-08-20  6:59 ` [U-Boot] [PATCH v5 3/5] powerpc: dts: t2080: add espi controller node support Xiaowei Bao
2019-08-20  6:59 ` [U-Boot] [PATCH v5 4/5] powerpc: dts: t2080qds: add espi slave nodes support Xiaowei Bao
2019-08-20  6:59 ` [U-Boot] [PATCH v5 5/5] configs: enable espi device module in T2080QDS Xiaowei Bao
2019-08-20  7:13 ` [U-Boot] [PATCH v5 1/5] spl: dm: disable SPI DM flash for non-DM SPL Lukasz Majewski
2019-08-20  7:27   ` Xiaowei Bao
2019-08-20  7:42     ` Lukasz Majewski
2019-08-20  7:51       ` Xiaowei Bao
2019-08-20  8:19         ` Lukasz Majewski
2019-08-20  9:00           ` Xiaowei Bao
2019-08-20  9:49             ` Lukasz Majewski
2019-08-22  1:56               ` Xiaowei Bao
2019-08-22 20:47                 ` Lukasz Majewski [this message]
2019-08-23  6:23                   ` Xiaowei Bao
2019-10-21  3:51                   ` Xiaowei Bao
     [not found]                     ` <AM5PR04MB3299E725CEF5540D8B44F76EF5680@AM5PR04MB3299.eurprd04.prod.outlook.com>
2019-10-22 12:20                       ` Lukasz Majewski
2019-10-22 13:03                         ` Schrempf Frieder
2019-10-23  3:25                           ` Xiaowei Bao
2019-12-24  3:01                             ` Xiaowei Bao
2020-01-07 11:31                               ` Schrempf Frieder

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=20190822224742.0116b4ed@jawa \
    --to=lukma@denx.de \
    --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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox