[U-Boot] [PATCH v4 0/5] dm: spi: Convert Freescale ESPI driver to driver

In order to convert the Freescale ESPI driver to the driver model, there are 5 related patches in the current patch set:
0001-spl-dm-disable-SPI-DM-flash-for-non-DM-SPL.patch 0002-dm-spi-Convert-Freescale-ESPI-driver-to-driver-model.patch 0003-powerpc-dts-t2080-add-espi-controller-node-support.patch 0004-powerpc-dts-t2080qds-add-espi-slave-nodes-support.patch 0005-configs-enable-espi-device-module-in-T2080QDS.patch
The first patch is to solve the problem that spl can't work when spiboot, and this is required for SPI boot.
The other four patches are supported by the driver model. This patchset already supports the full dm mode, and fsl_espi driver support both OF_CONTROL and PLATDATA.
Chuanhua Han (5): spl: dm: disable SPI DM flash for non-DM SPL dm: spi: Convert Freescale ESPI driver to driver model powerpc: dts: t2080: add espi controller node support powerpc: dts: t2080qds: add espi slave nodes support configs: enable espi device module in T2080QDS
arch/powerpc/dts/t2080.dtsi | 10 + arch/powerpc/dts/t2080qds.dts | 33 ++ configs/T2080QDS_NAND_defconfig | 2 + configs/T2080QDS_SDCARD_defconfig | 2 + configs/T2080QDS_SECURE_BOOT_defconfig | 2 + configs/T2080QDS_SPIFLASH_defconfig | 2 + configs/T2080QDS_SRIO_PCIE_BOOT_defconfig | 2 + configs/T2080QDS_defconfig | 2 + drivers/spi/fsl_espi.c | 444 ++++++++++++++++------ include/config_uncmd_spl.h | 1 + include/dm/platform_data/fsl_espi.h | 16 + 11 files changed, 395 insertions(+), 121 deletions(-) create mode 100644 include/dm/platform_data/fsl_espi.h

This patch solves the problem that spiboot cannot be performed in non-DM SPL.
Signed-off-by: Pan Jiafei Jiafei.Pan@freescale.com Signed-off-by: Chuanhua Han chuanhua.han@nxp.com --- 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 c2f9735ce7..da94b3d9df 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

On Fri, Jun 21, 2019 at 7:51 AM Chuanhua Han chuanhua.han@nxp.com wrote:
This patch solves the problem that spiboot cannot be performed in non-DM SPL.
Signed-off-by: Pan Jiafei Jiafei.Pan@freescale.com Signed-off-by: Chuanhua Han chuanhua.han@nxp.com
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 c2f9735ce7..da94b3d9df 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
Have you made any Travis-CI run?

-----Original Message----- From: Jagan Teki jagan@amarulasolutions.com Sent: 2019年8月14日 15:45 To: Chuanhua Han chuanhua.han@nxp.com Cc: Wolfgang Denk wd@denx.de; Shengzhou Liu shengzhou.liu@nxp.com; Ruchika Gupta ruchika.gupta@nxp.com; Jagan Teki jagan@openedev.com; Simon Glass sjg@chromium.org; Prabhakar Kushwaha prabhakar.kushwaha@nxp.com; U-Boot-Denx u-boot@lists.denx.de; Pan Jiafei Jiafei.Pan@freescale.com Subject: [EXT] Re: [U-Boot] [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
Caution: EXT Email
On Fri, Jun 21, 2019 at 7:51 AM Chuanhua Han chuanhua.han@nxp.com wrote:
This patch solves the problem that spiboot cannot be performed in non-DM SPL.
Signed-off-by: Pan Jiafei Jiafei.Pan@freescale.com Signed-off-by: Chuanhua Han chuanhua.han@nxp.com
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 c2f9735ce7..da94b3d9df 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
Have you made any Travis-CI run?
I tested it with a local board

Hi Chuanhua,
-----Original Message----- From: Jagan Teki jagan@amarulasolutions.com Sent: 2019年8月14日 15:45 To: Chuanhua Han chuanhua.han@nxp.com Cc: Wolfgang Denk wd@denx.de; Shengzhou Liu shengzhou.liu@nxp.com; Ruchika Gupta ruchika.gupta@nxp.com; Jagan Teki jagan@openedev.com; Simon Glass sjg@chromium.org; Prabhakar Kushwaha prabhakar.kushwaha@nxp.com; U-Boot-Denx u-boot@lists.denx.de; Pan Jiafei Jiafei.Pan@freescale.com Subject: [EXT] Re: [U-Boot] [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
Caution: EXT Email
On Fri, Jun 21, 2019 at 7:51 AM Chuanhua Han chuanhua.han@nxp.com wrote:
This patch solves the problem that spiboot cannot be performed in non-DM SPL.
Signed-off-by: Pan Jiafei Jiafei.Pan@freescale.com Signed-off-by: Chuanhua Han chuanhua.han@nxp.com
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 c2f9735ce7..da94b3d9df 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
Have you made any Travis-CI run?
I tested it with a local board
Could you be so kind and also test following patchset (parts from Layerscape also needs testing): https://patchwork.ozlabs.org/cover/1146494/
Which allows removal of #undef CONFIG_DM_SPI #undef CONFIG_DM_SPI_FLASH
and have the same configuration done via Kconfig ?
U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
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@denx.de

-----Original Message----- From: Lukasz Majewski lukma@denx.de Sent: 2019年8月14日 16:57 To: Chuanhua Han chuanhua.han@nxp.com Cc: Jagan Teki jagan@amarulasolutions.com; Xiaowei Bao xiaowei.bao@nxp.com; U-Boot-Denx u-boot@lists.denx.de; Pan Jiafei Jiafei.Pan@freescale.com; Jagan Teki jagan@openedev.com; Ruchika Gupta ruchika.gupta@nxp.com Subject: Re: [U-Boot] [EXT] Re: [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
Hi Chuanhua,
-----Original Message----- From: Jagan Teki jagan@amarulasolutions.com Sent: 2019年8月14日 15:45 To: Chuanhua Han chuanhua.han@nxp.com Cc: Wolfgang Denk wd@denx.de; Shengzhou Liu shengzhou.liu@nxp.com; Ruchika Gupta ruchika.gupta@nxp.com; Jagan Teki jagan@openedev.com; Simon Glass sjg@chromium.org; Prabhakar Kushwaha prabhakar.kushwaha@nxp.com; U-Boot-Denx u-boot@lists.denx.de; Pan Jiafei Jiafei.Pan@freescale.com Subject: [EXT] Re: [U-Boot] [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
Caution: EXT Email
On Fri, Jun 21, 2019 at 7:51 AM Chuanhua Han chuanhua.han@nxp.com wrote:
This patch solves the problem that spiboot cannot be performed in non-DM SPL.
Signed-off-by: Pan Jiafei Jiafei.Pan@freescale.com Signed-off-by: Chuanhua Han chuanhua.han@nxp.com
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 c2f9735ce7..da94b3d9df 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
Have you made any Travis-CI run?
I tested it with a local board
Could you be so kind and also test following patchset (parts from Layerscape also needs testing): https://patchwork.ozlabs.org/cover/1146494/
Which allows removal of #undef CONFIG_DM_SPI #undef CONFIG_DM_SPI_FLASH
and have the same configuration done via Kconfig ?
OK I will test
U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
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@denx.de

-----Original Message----- From: Lukasz Majewski lukma@denx.de Sent: 2019年8月14日 16:57 To: Chuanhua Han chuanhua.han@nxp.com Cc: Jagan Teki jagan@amarulasolutions.com; Xiaowei Bao xiaowei.bao@nxp.com; U-Boot-Denx u-boot@lists.denx.de; Pan Jiafei Jiafei.Pan@freescale.com; Jagan Teki jagan@openedev.com; Ruchika Gupta ruchika.gupta@nxp.com Subject: Re: [U-Boot] [EXT] Re: [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
Hi Chuanhua,
-----Original Message----- From: Jagan Teki jagan@amarulasolutions.com Sent: 2019年8月14日 15:45 To: Chuanhua Han chuanhua.han@nxp.com Cc: Wolfgang Denk wd@denx.de; Shengzhou Liu shengzhou.liu@nxp.com; Ruchika Gupta ruchika.gupta@nxp.com; Jagan Teki jagan@openedev.com; Simon Glass sjg@chromium.org; Prabhakar Kushwaha prabhakar.kushwaha@nxp.com; U-Boot-Denx u-boot@lists.denx.de; Pan Jiafei Jiafei.Pan@freescale.com Subject: [EXT] Re: [U-Boot] [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
Caution: EXT Email
On Fri, Jun 21, 2019 at 7:51 AM Chuanhua Han chuanhua.han@nxp.com wrote:
This patch solves the problem that spiboot cannot be performed in non-DM SPL.
Signed-off-by: Pan Jiafei Jiafei.Pan@freescale.com Signed-off-by: Chuanhua Han chuanhua.han@nxp.com
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 c2f9735ce7..da94b3d9df 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
Have you made any Travis-CI run?
I tested it with a local board
Could you be so kind and also test following patchset (parts from Layerscape also needs testing): https://patchwork.ozlabs.org/cover/1146494/
I don't quite understand this patch. How can I test it?
Which allows removal of #undef CONFIG_DM_SPI #undef CONFIG_DM_SPI_FLASH
and have the same configuration done via Kconfig ?
U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
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@denx.de

On Wed, 14 Aug 2019 10:41:32 +0000 Chuanhua Han chuanhua.han@nxp.com wrote:
-----Original Message----- From: Lukasz Majewski lukma@denx.de Sent: 2019年8月14日 16:57 To: Chuanhua Han chuanhua.han@nxp.com Cc: Jagan Teki jagan@amarulasolutions.com; Xiaowei Bao xiaowei.bao@nxp.com; U-Boot-Denx u-boot@lists.denx.de; Pan Jiafei Jiafei.Pan@freescale.com; Jagan Teki jagan@openedev.com; Ruchika Gupta ruchika.gupta@nxp.com Subject: Re: [U-Boot] [EXT] Re: [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
Hi Chuanhua,
-----Original Message----- From: Jagan Teki jagan@amarulasolutions.com Sent: 2019年8月14日 15:45 To: Chuanhua Han chuanhua.han@nxp.com Cc: Wolfgang Denk wd@denx.de; Shengzhou Liu shengzhou.liu@nxp.com; Ruchika Gupta ruchika.gupta@nxp.com; Jagan Teki jagan@openedev.com; Simon Glass sjg@chromium.org; Prabhakar Kushwaha prabhakar.kushwaha@nxp.com; U-Boot-Denx u-boot@lists.denx.de; Pan Jiafei Jiafei.Pan@freescale.com Subject: [EXT] Re: [U-Boot] [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
Caution: EXT Email
On Fri, Jun 21, 2019 at 7:51 AM Chuanhua Han chuanhua.han@nxp.com wrote:
This patch solves the problem that spiboot cannot be performed in non-DM SPL.
Signed-off-by: Pan Jiafei Jiafei.Pan@freescale.com Signed-off-by: Chuanhua Han chuanhua.han@nxp.com
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 c2f9735ce7..da94b3d9df 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
Have you made any Travis-CI run?
I tested it with a local board
Could you be so kind and also test following patchset (parts from Layerscape also needs testing): https://patchwork.ozlabs.org/cover/1146494/
I don't quite understand this patch. How can I test it?
You need to apply it first to -master branch.
Then apply your board code (or if it is already in mainline just remove the #undef(s) from include/config_uncmd_spl.h)
As a last step - run make menuconfig and enable SPL_DM_SPI* flags.
Which allows removal of #undef CONFIG_DM_SPI #undef CONFIG_DM_SPI_FLASH
and have the same configuration done via Kconfig ?
U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
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@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@denx.de

-----Original Message----- From: Lukasz Majewski lukma@denx.de Sent: 2019年8月14日 18:53 To: Chuanhua Han chuanhua.han@nxp.com Cc: Jagan Teki jagan@amarulasolutions.com; Xiaowei Bao xiaowei.bao@nxp.com; U-Boot-Denx u-boot@lists.denx.de; Pan Jiafei Jiafei.Pan@freescale.com; Jagan Teki jagan@openedev.com; Ruchika Gupta ruchika.gupta@nxp.com Subject: Re: [U-Boot] [EXT] Re: [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
On Wed, 14 Aug 2019 10:41:32 +0000 Chuanhua Han chuanhua.han@nxp.com wrote:
-----Original Message----- From: Lukasz Majewski lukma@denx.de Sent: 2019年8月14日 16:57 To: Chuanhua Han chuanhua.han@nxp.com Cc: Jagan Teki jagan@amarulasolutions.com; Xiaowei Bao xiaowei.bao@nxp.com; U-Boot-Denx u-boot@lists.denx.de; Pan Jiafei Jiafei.Pan@freescale.com; Jagan Teki jagan@openedev.com; Ruchika Gupta ruchika.gupta@nxp.com Subject: Re: [U-Boot] [EXT] Re: [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
Hi Chuanhua,
-----Original Message----- From: Jagan Teki jagan@amarulasolutions.com Sent: 2019年8月14日 15:45 To: Chuanhua Han chuanhua.han@nxp.com Cc: Wolfgang Denk wd@denx.de; Shengzhou Liu shengzhou.liu@nxp.com; Ruchika Gupta ruchika.gupta@nxp.com; Jagan Teki jagan@openedev.com; Simon Glass sjg@chromium.org; Prabhakar Kushwaha prabhakar.kushwaha@nxp.com; U-Boot-Denx u-boot@lists.denx.de; Pan Jiafei Jiafei.Pan@freescale.com Subject: [EXT] Re: [U-Boot] [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
Caution: EXT Email
On Fri, Jun 21, 2019 at 7:51 AM Chuanhua Han chuanhua.han@nxp.com wrote:
This patch solves the problem that spiboot cannot be performed in non-DM SPL.
Signed-off-by: Pan Jiafei Jiafei.Pan@freescale.com Signed-off-by: Chuanhua Han chuanhua.han@nxp.com
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 c2f9735ce7..da94b3d9df 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
Have you made any Travis-CI run?
I tested it with a local board
Could you be so kind and also test following patchset (parts from Layerscape also needs testing): https://patchwork.ozlabs.org/cover/1146494/
I don't quite understand this patch. How can I test it?
You need to apply it first to -master branch.
Then apply your board code (or if it is already in mainline just remove the #undef(s) from include/config_uncmd_spl.h)
As a last step - run make menuconfig and enable SPL_DM_SPI* flags.
Currently, it is in the master, and SPI* in the #undef(s) from include/ uncmd_spl.h has been deleted, but an error was reported: CC spl/lib/display_options.o drivers/spi/spi.c: In function 'spi_do_alloc_slave': drivers/spi/spi.c:34:8: error: 'struct spi_slave' has no member named 'bus' slave->bus = bus; ^~ drivers/spi/spi.c:35:8: error: 'struct spi_slave' has no member named 'cs' slave->cs = cs; ^~ make[3]: *** [spl/drivers/spi/spi.o] Error 1 make[3]: *** Waiting for unfinished jobs.... make[2]: *** [spl/drivers/spi] Error 2 make[1]: *** [spl/drivers] Error 2 make[1]: *** Waiting for unfinished jobs.... LD spl/lib/built-in.o make: *** [spl/u-boot-spl] Error 2
Do I need to modify a lot of files?
Which allows removal of #undef CONFIG_DM_SPI #undef CONFIG_DM_SPI_FLASH
and have the same configuration done via Kconfig ?
U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
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@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@denx.de

On Wed, 14 Aug 2019 11:10:46 +0000 Chuanhua Han chuanhua.han@nxp.com wrote:
-----Original Message----- From: Lukasz Majewski lukma@denx.de Sent: 2019年8月14日 18:53 To: Chuanhua Han chuanhua.han@nxp.com Cc: Jagan Teki jagan@amarulasolutions.com; Xiaowei Bao xiaowei.bao@nxp.com; U-Boot-Denx u-boot@lists.denx.de; Pan Jiafei Jiafei.Pan@freescale.com; Jagan Teki jagan@openedev.com; Ruchika Gupta ruchika.gupta@nxp.com Subject: Re: [U-Boot] [EXT] Re: [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
On Wed, 14 Aug 2019 10:41:32 +0000 Chuanhua Han chuanhua.han@nxp.com wrote:
-----Original Message----- From: Lukasz Majewski lukma@denx.de Sent: 2019年8月14日 16:57 To: Chuanhua Han chuanhua.han@nxp.com Cc: Jagan Teki jagan@amarulasolutions.com; Xiaowei Bao xiaowei.bao@nxp.com; U-Boot-Denx u-boot@lists.denx.de; Pan Jiafei Jiafei.Pan@freescale.com; Jagan Teki jagan@openedev.com; Ruchika Gupta ruchika.gupta@nxp.com Subject: Re: [U-Boot] [EXT] Re: [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
Hi Chuanhua,
-----Original Message----- From: Jagan Teki jagan@amarulasolutions.com Sent: 2019年8月14日 15:45 To: Chuanhua Han chuanhua.han@nxp.com Cc: Wolfgang Denk wd@denx.de; Shengzhou Liu shengzhou.liu@nxp.com; Ruchika Gupta ruchika.gupta@nxp.com; Jagan Teki jagan@openedev.com; Simon Glass sjg@chromium.org; Prabhakar Kushwaha prabhakar.kushwaha@nxp.com; U-Boot-Denx u-boot@lists.denx.de; Pan Jiafei Jiafei.Pan@freescale.com Subject: [EXT] Re: [U-Boot] [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
Caution: EXT Email
On Fri, Jun 21, 2019 at 7:51 AM Chuanhua Han chuanhua.han@nxp.com wrote: > > This patch solves the problem that spiboot cannot be > performed in non-DM SPL. > > Signed-off-by: Pan Jiafei Jiafei.Pan@freescale.com > Signed-off-by: Chuanhua Han chuanhua.han@nxp.com > --- > 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 c2f9735ce7..da94b3d9df > 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
Have you made any Travis-CI run?
I tested it with a local board
Could you be so kind and also test following patchset (parts from Layerscape also needs testing): https://patchwork.ozlabs.org/cover/1146494/
I don't quite understand this patch. How can I test it?
You need to apply it first to -master branch.
Then apply your board code (or if it is already in mainline just remove the #undef(s) from include/config_uncmd_spl.h)
As a last step - run make menuconfig and enable SPL_DM_SPI* flags.
Currently, it is in the master, and SPI* in the #undef(s) from include/ uncmd_spl.h has been deleted, but an error was reported: CC spl/lib/display_options.o drivers/spi/spi.c: In function 'spi_do_alloc_slave': drivers/spi/spi.c:34:8: error: 'struct spi_slave' has no member named 'bus' slave->bus = bus; ^~ drivers/spi/spi.c:35:8: error: 'struct spi_slave' has no member named 'cs' slave->cs = cs; ^~ make[3]: *** [spl/drivers/spi/spi.o] Error 1 make[3]: *** Waiting for unfinished jobs.... make[2]: *** [spl/drivers/spi] Error 2 make[1]: *** [spl/drivers] Error 2 make[1]: *** Waiting for unfinished jobs.... LD spl/lib/built-in.o make: *** [spl/u-boot-spl] Error 2
If your board is in mainline (master branch) it shall build without issues:
Applied on top of -master branch: 'commit feb5a02f869d ("Merge branch 'master' of git://git.denx.de/u-boot-sh")' Travis-CI (clean build): https://travis-ci.org/lmajewski/u-boot-dfu/builds/570594278
The patch itself: https://patchwork.ozlabs.org/patch/1146377/
Do I need to modify a lot of files?
Which allows removal of #undef CONFIG_DM_SPI #undef CONFIG_DM_SPI_FLASH
and have the same configuration done via Kconfig ?
U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
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@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@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@denx.de

-----Original Message----- From: Lukasz Majewski lukma@denx.de Sent: 2019年8月14日 19:39 To: Chuanhua Han chuanhua.han@nxp.com Cc: Jagan Teki jagan@amarulasolutions.com; Xiaowei Bao xiaowei.bao@nxp.com; U-Boot-Denx u-boot@lists.denx.de; Pan Jiafei Jiafei.Pan@freescale.com; Jagan Teki jagan@openedev.com; Ruchika Gupta ruchika.gupta@nxp.com Subject: Re: [U-Boot] [EXT] Re: [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
On Wed, 14 Aug 2019 11:10:46 +0000 Chuanhua Han chuanhua.han@nxp.com wrote:
-----Original Message----- From: Lukasz Majewski lukma@denx.de Sent: 2019年8月14日 18:53 To: Chuanhua Han chuanhua.han@nxp.com Cc: Jagan Teki jagan@amarulasolutions.com; Xiaowei Bao xiaowei.bao@nxp.com; U-Boot-Denx u-boot@lists.denx.de; Pan Jiafei Jiafei.Pan@freescale.com; Jagan Teki jagan@openedev.com; Ruchika Gupta ruchika.gupta@nxp.com Subject: Re: [U-Boot] [EXT] Re: [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
On Wed, 14 Aug 2019 10:41:32 +0000 Chuanhua Han chuanhua.han@nxp.com wrote:
-----Original Message----- From: Lukasz Majewski lukma@denx.de Sent: 2019年8月14日 16:57 To: Chuanhua Han chuanhua.han@nxp.com Cc: Jagan Teki jagan@amarulasolutions.com; Xiaowei Bao xiaowei.bao@nxp.com; U-Boot-Denx u-boot@lists.denx.de; Pan Jiafei Jiafei.Pan@freescale.com; Jagan Teki jagan@openedev.com; Ruchika Gupta ruchika.gupta@nxp.com Subject: Re: [U-Boot] [EXT] Re: [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
Hi Chuanhua,
> -----Original Message----- > From: Jagan Teki jagan@amarulasolutions.com > Sent: 2019年8月14日 15:45 > To: Chuanhua Han chuanhua.han@nxp.com > Cc: Wolfgang Denk wd@denx.de; Shengzhou Liu > shengzhou.liu@nxp.com; Ruchika Gupta > ruchika.gupta@nxp.com; Jagan Teki jagan@openedev.com; > Simon Glass sjg@chromium.org; Prabhakar Kushwaha > prabhakar.kushwaha@nxp.com; U-Boot-Denx > u-boot@lists.denx.de; Pan Jiafei > Jiafei.Pan@freescale.com Subject: [EXT] Re: [U-Boot] > [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL > > Caution: EXT Email > > On Fri, Jun 21, 2019 at 7:51 AM Chuanhua Han > chuanhua.han@nxp.com wrote: > > > > This patch solves the problem that spiboot cannot be > > performed in non-DM SPL. > > > > Signed-off-by: Pan Jiafei Jiafei.Pan@freescale.com > > Signed-off-by: Chuanhua Han chuanhua.han@nxp.com > > --- > > 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 c2f9735ce7..da94b3d9df > > 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 > > Have you made any Travis-CI run? I tested it with a local board
Could you be so kind and also test following patchset (parts from Layerscape also needs testing): https://patchwork.ozlabs.org/cover/1146494/
I don't quite understand this patch. How can I test it?
You need to apply it first to -master branch.
Then apply your board code (or if it is already in mainline just remove the #undef(s) from include/config_uncmd_spl.h)
As a last step - run make menuconfig and enable SPL_DM_SPI* flags.
Currently, it is in the master, and SPI* in the #undef(s) from include/ uncmd_spl.h has been deleted, but an error was reported: CC spl/lib/display_options.o drivers/spi/spi.c: In function 'spi_do_alloc_slave': drivers/spi/spi.c:34:8: error: 'struct spi_slave' has no member named 'bus' slave->bus = bus; ^~ drivers/spi/spi.c:35:8: error: 'struct spi_slave' has no member named 'cs' slave->cs = cs; ^~ make[3]: *** [spl/drivers/spi/spi.o] Error 1 make[3]: *** Waiting for unfinished jobs.... make[2]: *** [spl/drivers/spi] Error 2 make[1]: *** [spl/drivers] Error 2 make[1]: *** Waiting for unfinished jobs.... LD spl/lib/built-in.o make: *** [spl/u-boot-spl] Error 2
If your board is in mainline (master branch) it shall build without issues:
Applied on top of -master branch: 'commit feb5a02f869d ("Merge branch 'master' of git://git.denx.de/u-boot-sh")' Travis-CI (clean build): https://travis-ci.org/lmajewski/u-boot-dfu/builds/570594278
The patch itself: https://patchwork.ozlabs.org/patch/1146377/
1. I git reset to this commit: feb5a02f869d 2. Your patch has been applied(https://patchwork.ozlabs.org/patch/1146377/) 3. Apply my current patch set 4. Include/uncmd_uncmd_spl.h file is deleted as follows: - # undef CONFIG_DM_SPI - # undef CONFIG_DM_SPI_FLASH 5. In include/configs/T208xQDS.h file: +/* SPI Flash Configs */ + # if defined (CONFIG_SPL_BUILD) + # undef CONFIG_DM_SPI + # undef CONFIG_DM_SPI_FLASH + # undef CONFIG_SPI_FLASH_MTD + # endif 6. Make menuconfig: Configuration CONFIG_SPL_DM_SPI = y CONFIG_SPL_DM_SPI_FLASH = y 7. Compilation errors still occur: LD spl/lib/built-in.o LD spl/u-boot-spl drivers/built-in.o: In function `ofnode_read_u32': /home/hanch/uboot/uboot-upstream/u-boot/drivers/core/ofnode.c:29: undefined reference to `fdt_getprop' drivers/built-in.o: In function `ofnode_get_property': /home/hanch/uboot/uboot-upstream/u-boot/drivers/core/ofnode.c:528: undefined reference to `fdt_getprop' drivers/built-in.o: In function `blk_post_probe': /home/hanch/uboot/uboot-upstream/u-boot/drivers/block/blk-uclass.c:655: undefined reference to `part_init' drivers/built-in.o:(.u_boot_list_2_uclass_2_spi+0x8): undefined reference to `dm_scan_fdt_dev' make[1]: *** [spl/u-boot-spl] Error 1 make: *** [spl/u-boot-spl] Error 2
Do I need to modify a lot of files?
Which allows removal of #undef CONFIG_DM_SPI #undef CONFIG_DM_SPI_FLASH
and have the same configuration done via Kconfig ?
U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
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@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@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@denx.de

On Thu, 15 Aug 2019 03:35:28 +0000 Chuanhua Han chuanhua.han@nxp.com wrote:
-----Original Message----- From: Lukasz Majewski lukma@denx.de Sent: 2019年8月14日 19:39 To: Chuanhua Han chuanhua.han@nxp.com Cc: Jagan Teki jagan@amarulasolutions.com; Xiaowei Bao xiaowei.bao@nxp.com; U-Boot-Denx u-boot@lists.denx.de; Pan Jiafei Jiafei.Pan@freescale.com; Jagan Teki jagan@openedev.com; Ruchika Gupta ruchika.gupta@nxp.com Subject: Re: [U-Boot] [EXT] Re: [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
On Wed, 14 Aug 2019 11:10:46 +0000 Chuanhua Han chuanhua.han@nxp.com wrote:
-----Original Message----- From: Lukasz Majewski lukma@denx.de Sent: 2019年8月14日 18:53 To: Chuanhua Han chuanhua.han@nxp.com Cc: Jagan Teki jagan@amarulasolutions.com; Xiaowei Bao xiaowei.bao@nxp.com; U-Boot-Denx u-boot@lists.denx.de; Pan Jiafei Jiafei.Pan@freescale.com; Jagan Teki jagan@openedev.com; Ruchika Gupta ruchika.gupta@nxp.com Subject: Re: [U-Boot] [EXT] Re: [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
On Wed, 14 Aug 2019 10:41:32 +0000 Chuanhua Han chuanhua.han@nxp.com wrote:
-----Original Message----- From: Lukasz Majewski lukma@denx.de Sent: 2019年8月14日 16:57 To: Chuanhua Han chuanhua.han@nxp.com Cc: Jagan Teki jagan@amarulasolutions.com; Xiaowei Bao xiaowei.bao@nxp.com; U-Boot-Denx u-boot@lists.denx.de; Pan Jiafei Jiafei.Pan@freescale.com; Jagan Teki jagan@openedev.com; Ruchika Gupta ruchika.gupta@nxp.com Subject: Re: [U-Boot] [EXT] Re: [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
Hi Chuanhua,
> > -----Original Message----- > > From: Jagan Teki jagan@amarulasolutions.com > > Sent: 2019年8月14日 15:45 > > To: Chuanhua Han chuanhua.han@nxp.com > > Cc: Wolfgang Denk wd@denx.de; Shengzhou Liu > > shengzhou.liu@nxp.com; Ruchika Gupta > > ruchika.gupta@nxp.com; Jagan Teki > > jagan@openedev.com; Simon Glass sjg@chromium.org; > > Prabhakar Kushwaha prabhakar.kushwaha@nxp.com; > > U-Boot-Denx u-boot@lists.denx.de; Pan Jiafei > > Jiafei.Pan@freescale.com Subject: [EXT] Re: [U-Boot] > > [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM > > SPL > > > > Caution: EXT Email > > > > On Fri, Jun 21, 2019 at 7:51 AM Chuanhua Han > > chuanhua.han@nxp.com wrote: > > > > > > This patch solves the problem that spiboot cannot be > > > performed in non-DM SPL. > > > > > > Signed-off-by: Pan Jiafei Jiafei.Pan@freescale.com > > > Signed-off-by: Chuanhua Han chuanhua.han@nxp.com > > > --- > > > 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 > > > c2f9735ce7..da94b3d9df 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 > > > > Have you made any Travis-CI run? > I tested it with a local board
Could you be so kind and also test following patchset (parts from Layerscape also needs testing): https://patchwork.ozlabs.org/cover/1146494/
I don't quite understand this patch. How can I test it?
You need to apply it first to -master branch.
Then apply your board code (or if it is already in mainline just remove the #undef(s) from include/config_uncmd_spl.h)
As a last step - run make menuconfig and enable SPL_DM_SPI* flags.
Currently, it is in the master, and SPI* in the #undef(s) from include/ uncmd_spl.h has been deleted, but an error was reported: CC spl/lib/display_options.o drivers/spi/spi.c: In function 'spi_do_alloc_slave': drivers/spi/spi.c:34:8: error: 'struct spi_slave' has no member named 'bus' slave->bus = bus; ^~ drivers/spi/spi.c:35:8: error: 'struct spi_slave' has no member named 'cs' slave->cs = cs; ^~ make[3]: *** [spl/drivers/spi/spi.o] Error 1 make[3]: *** Waiting for unfinished jobs.... make[2]: *** [spl/drivers/spi] Error 2 make[1]: *** [spl/drivers] Error 2 make[1]: *** Waiting for unfinished jobs.... LD spl/lib/built-in.o make: *** [spl/u-boot-spl] Error 2
If your board is in mainline (master branch) it shall build without issues:
Applied on top of -master branch: 'commit feb5a02f869d ("Merge branch 'master' of git://git.denx.de/u-boot-sh")' Travis-CI (clean build): https://travis-ci.org/lmajewski/u-boot-dfu/builds/570594278
The patch itself: https://patchwork.ozlabs.org/patch/1146377/
- I git reset to this commit: feb5a02f869d
- Your patch has been
Could you check if your board (the code which is now in mainline) compiles without issues at this step?
- Apply my
current patch set 4. Include/uncmd_uncmd_spl.h file is deleted as follows:
- # undef CONFIG_DM_SPI
- # undef CONFIG_DM_SPI_FLASH
- In include/configs/T208xQDS.h file:
+/* SPI Flash Configs */
- # if defined (CONFIG_SPL_BUILD)
- # undef CONFIG_DM_SPI
- # undef CONFIG_DM_SPI_FLASH
- # undef CONFIG_SPI_FLASH_MTD
- # endif
- Make menuconfig:
Configuration CONFIG_SPL_DM_SPI = y CONFIG_SPL_DM_SPI_FLASH = y 7. Compilation errors still occur: LD spl/lib/built-in.o LD spl/u-boot-spl drivers/built-in.o: In function `ofnode_read_u32': /home/hanch/uboot/uboot-upstream/u-boot/drivers/core/ofnode.c:29: undefined reference to `fdt_getprop' drivers/built-in.o: In function `ofnode_get_property': /home/hanch/uboot/uboot-upstream/u-boot/drivers/core/ofnode.c:528: undefined reference to `fdt_getprop' drivers/built-in.o: In function `blk_post_probe': /home/hanch/uboot/uboot-upstream/u-boot/drivers/block/blk-uclass.c:655: undefined reference to `part_init' drivers/built-in.o:(.u_boot_list_2_uclass_2_spi+0x8): undefined reference to `dm_scan_fdt_dev' make[1]: *** [spl/u-boot-spl] Error 1 make: *** [spl/u-boot-spl] Error 2
Do I need to modify a lot of files?
Which allows removal of #undef CONFIG_DM_SPI #undef CONFIG_DM_SPI_FLASH
and have the same configuration done via Kconfig ?
> _______________________________________________ > U-Boot mailing list > U-Boot@lists.denx.de > https://lists.denx.de/listinfo/u-boot
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@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@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@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@denx.de

-----Original Message----- From: Lukasz Majewski lukma@denx.de Sent: 2019年8月15日 15:15 To: Chuanhua Han chuanhua.han@nxp.com Cc: Jagan Teki jagan@amarulasolutions.com; Xiaowei Bao xiaowei.bao@nxp.com; U-Boot-Denx u-boot@lists.denx.de; Pan Jiafei Jiafei.Pan@freescale.com; Jagan Teki jagan@openedev.com; Ruchika Gupta ruchika.gupta@nxp.com Subject: Re: [U-Boot] [EXT] Re: [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
On Thu, 15 Aug 2019 03:35:28 +0000 Chuanhua Han chuanhua.han@nxp.com wrote:
-----Original Message----- From: Lukasz Majewski lukma@denx.de Sent: 2019年8月14日 19:39 To: Chuanhua Han chuanhua.han@nxp.com Cc: Jagan Teki jagan@amarulasolutions.com; Xiaowei Bao xiaowei.bao@nxp.com; U-Boot-Denx u-boot@lists.denx.de; Pan Jiafei Jiafei.Pan@freescale.com; Jagan Teki jagan@openedev.com; Ruchika Gupta ruchika.gupta@nxp.com Subject: Re: [U-Boot] [EXT] Re: [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
On Wed, 14 Aug 2019 11:10:46 +0000 Chuanhua Han chuanhua.han@nxp.com wrote:
-----Original Message----- From: Lukasz Majewski lukma@denx.de Sent: 2019年8月14日 18:53 To: Chuanhua Han chuanhua.han@nxp.com Cc: Jagan Teki jagan@amarulasolutions.com; Xiaowei Bao xiaowei.bao@nxp.com; U-Boot-Denx u-boot@lists.denx.de; Pan Jiafei Jiafei.Pan@freescale.com; Jagan Teki jagan@openedev.com; Ruchika Gupta ruchika.gupta@nxp.com Subject: Re: [U-Boot] [EXT] Re: [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
On Wed, 14 Aug 2019 10:41:32 +0000 Chuanhua Han chuanhua.han@nxp.com wrote:
> -----Original Message----- > From: Lukasz Majewski lukma@denx.de > Sent: 2019年8月14日 16:57 > To: Chuanhua Han chuanhua.han@nxp.com > Cc: Jagan Teki jagan@amarulasolutions.com; Xiaowei Bao > xiaowei.bao@nxp.com; U-Boot-Denx u-boot@lists.denx.de; > Pan Jiafei Jiafei.Pan@freescale.com; Jagan Teki > jagan@openedev.com; Ruchika Gupta ruchika.gupta@nxp.com > Subject: Re: [U-Boot] [EXT] Re: [PATCH v4 1/5] spl: dm: > disable SPI DM flash for non-DM SPL > > Hi Chuanhua, > > > > -----Original Message----- > > > From: Jagan Teki jagan@amarulasolutions.com > > > Sent: 2019年8月14日 15:45 > > > To: Chuanhua Han chuanhua.han@nxp.com > > > Cc: Wolfgang Denk wd@denx.de; Shengzhou Liu > > > shengzhou.liu@nxp.com; Ruchika Gupta > > > ruchika.gupta@nxp.com; Jagan Teki > > > jagan@openedev.com; Simon Glass sjg@chromium.org; > > > Prabhakar Kushwaha prabhakar.kushwaha@nxp.com; > > > U-Boot-Denx u-boot@lists.denx.de; Pan Jiafei > > > Jiafei.Pan@freescale.com Subject: [EXT] Re: [U-Boot] > > > [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM > > > SPL > > > > > > Caution: EXT Email > > > > > > On Fri, Jun 21, 2019 at 7:51 AM Chuanhua Han > > > chuanhua.han@nxp.com wrote: > > > > > > > > This patch solves the problem that spiboot cannot be > > > > performed in non-DM SPL. > > > > > > > > Signed-off-by: Pan Jiafei Jiafei.Pan@freescale.com > > > > Signed-off-by: Chuanhua Han chuanhua.han@nxp.com > > > > --- > > > > 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 > > > > c2f9735ce7..da94b3d9df 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 > > > > > > Have you made any Travis-CI run? > > I tested it with a local board > > Could you be so kind and also test following patchset (parts > from Layerscape also needs testing): > https://patchwork.ozlabs.org/cover/1146494/ I don't quite understand this patch. How can I test it?
You need to apply it first to -master branch.
Then apply your board code (or if it is already in mainline just remove the #undef(s) from include/config_uncmd_spl.h)
As a last step - run make menuconfig and enable SPL_DM_SPI* flags.
Currently, it is in the master, and SPI* in the #undef(s) from include/ uncmd_spl.h has been deleted, but an error was reported: CC spl/lib/display_options.o drivers/spi/spi.c: In function 'spi_do_alloc_slave': drivers/spi/spi.c:34:8: error: 'struct spi_slave' has no member named 'bus' slave->bus = bus; ^~ drivers/spi/spi.c:35:8: error: 'struct spi_slave' has no member named 'cs' slave->cs = cs; ^~ make[3]: *** [spl/drivers/spi/spi.o] Error 1 make[3]: *** Waiting for unfinished jobs.... make[2]: *** [spl/drivers/spi] Error 2 make[1]: *** [spl/drivers] Error 2 make[1]: *** Waiting for unfinished jobs.... LD spl/lib/built-in.o make: *** [spl/u-boot-spl] Error 2
If your board is in mainline (master branch) it shall build without issues:
Applied on top of -master branch: 'commit feb5a02f869d ("Merge branch 'master' of git://git.denx.de/u-boot-sh")' Travis-CI (clean build): https://travis-ci.org/lmajewski/u-boot-dfu/builds/570594278
The patch itself: https://patchwork.ozlabs.org/patch/1146377/
- I git reset to this commit: feb5a02f869d 2. Your patch has been
Could you check if your board (the code which is now in mainline) compiles without issues at this step?
Yes,.no issue!(because this commit not support espi dm mode)
- Apply my
current patch set 4. Include/uncmd_uncmd_spl.h file is deleted as follows:
- # undef CONFIG_DM_SPI
- # undef CONFIG_DM_SPI_FLASH
- In include/configs/T208xQDS.h file:
+/* SPI Flash Configs */
- # if defined (CONFIG_SPL_BUILD)
- # undef CONFIG_DM_SPI
- # undef CONFIG_DM_SPI_FLASH
- # undef CONFIG_SPI_FLASH_MTD
- # endif
- Make menuconfig:
Configuration CONFIG_SPL_DM_SPI = y CONFIG_SPL_DM_SPI_FLASH = y 7. Compilation errors still occur: LD spl/lib/built-in.o LD spl/u-boot-spl drivers/built-in.o: In function `ofnode_read_u32': /home/hanch/uboot/uboot-upstream/u-boot/drivers/core/ofnode.c:29: undefined reference to `fdt_getprop' drivers/built-in.o: In function `ofnode_get_property': /home/hanch/uboot/uboot-upstream/u-boot/drivers/core/ofnode.c:528: undefined reference to `fdt_getprop' drivers/built-in.o: In function `blk_post_probe': /home/hanch/uboot/uboot-upstream/u-boot/drivers/block/blk-uclass.c:655: undefined reference to `part_init' drivers/built-in.o:(.u_boot_list_2_uclass_2_spi+0x8): undefined reference to `dm_scan_fdt_dev' make[1]: *** [spl/u-boot-spl] Error 1 make: *** [spl/u-boot-spl] Error 2
Do I need to modify a lot of files?
> > Which allows removal of > #undef CONFIG_DM_SPI > #undef CONFIG_DM_SPI_FLASH > > and have the same configuration done via Kconfig ?
> > > _______________________________________________ > > U-Boot mailing list > > U-Boot@lists.denx.de > > https://lists.denx.de/listinfo/u-boot > > > > 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@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@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@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@denx.de

On Thu, 15 Aug 2019 07:39:45 +0000 Chuanhua Han chuanhua.han@nxp.com wrote:
-----Original Message----- From: Lukasz Majewski lukma@denx.de Sent: 2019年8月15日 15:15 To: Chuanhua Han chuanhua.han@nxp.com Cc: Jagan Teki jagan@amarulasolutions.com; Xiaowei Bao xiaowei.bao@nxp.com; U-Boot-Denx u-boot@lists.denx.de; Pan Jiafei Jiafei.Pan@freescale.com; Jagan Teki jagan@openedev.com; Ruchika Gupta ruchika.gupta@nxp.com Subject: Re: [U-Boot] [EXT] Re: [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
On Thu, 15 Aug 2019 03:35:28 +0000 Chuanhua Han chuanhua.han@nxp.com wrote:
-----Original Message----- From: Lukasz Majewski lukma@denx.de Sent: 2019年8月14日 19:39 To: Chuanhua Han chuanhua.han@nxp.com Cc: Jagan Teki jagan@amarulasolutions.com; Xiaowei Bao xiaowei.bao@nxp.com; U-Boot-Denx u-boot@lists.denx.de; Pan Jiafei Jiafei.Pan@freescale.com; Jagan Teki jagan@openedev.com; Ruchika Gupta ruchika.gupta@nxp.com Subject: Re: [U-Boot] [EXT] Re: [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
On Wed, 14 Aug 2019 11:10:46 +0000 Chuanhua Han chuanhua.han@nxp.com wrote:
-----Original Message----- From: Lukasz Majewski lukma@denx.de Sent: 2019年8月14日 18:53 To: Chuanhua Han chuanhua.han@nxp.com Cc: Jagan Teki jagan@amarulasolutions.com; Xiaowei Bao xiaowei.bao@nxp.com; U-Boot-Denx u-boot@lists.denx.de; Pan Jiafei Jiafei.Pan@freescale.com; Jagan Teki jagan@openedev.com; Ruchika Gupta ruchika.gupta@nxp.com Subject: Re: [U-Boot] [EXT] Re: [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
On Wed, 14 Aug 2019 10:41:32 +0000 Chuanhua Han chuanhua.han@nxp.com wrote:
> > -----Original Message----- > > From: Lukasz Majewski lukma@denx.de > > Sent: 2019年8月14日 16:57 > > To: Chuanhua Han chuanhua.han@nxp.com > > Cc: Jagan Teki jagan@amarulasolutions.com; Xiaowei Bao > > xiaowei.bao@nxp.com; U-Boot-Denx > > u-boot@lists.denx.de; Pan Jiafei > > Jiafei.Pan@freescale.com; Jagan Teki > > jagan@openedev.com; Ruchika Gupta > > ruchika.gupta@nxp.com Subject: Re: [U-Boot] [EXT] Re: > > [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM > > SPL > > > > Hi Chuanhua, > > > > > > -----Original Message----- > > > > From: Jagan Teki jagan@amarulasolutions.com > > > > Sent: 2019年8月14日 15:45 > > > > To: Chuanhua Han chuanhua.han@nxp.com > > > > Cc: Wolfgang Denk wd@denx.de; Shengzhou Liu > > > > shengzhou.liu@nxp.com; Ruchika Gupta > > > > ruchika.gupta@nxp.com; Jagan Teki > > > > jagan@openedev.com; Simon Glass > > > > sjg@chromium.org; Prabhakar Kushwaha > > > > prabhakar.kushwaha@nxp.com; U-Boot-Denx > > > > u-boot@lists.denx.de; Pan Jiafei > > > > Jiafei.Pan@freescale.com Subject: [EXT] Re: > > > > [U-Boot] [PATCH v4 1/5] spl: dm: disable SPI DM > > > > flash for non-DM SPL > > > > > > > > Caution: EXT Email > > > > > > > > On Fri, Jun 21, 2019 at 7:51 AM Chuanhua Han > > > > chuanhua.han@nxp.com wrote: > > > > > > > > > > This patch solves the problem that spiboot cannot > > > > > be performed in non-DM SPL. > > > > > > > > > > Signed-off-by: Pan Jiafei > > > > > Jiafei.Pan@freescale.com Signed-off-by: > > > > > Chuanhua Han chuanhua.han@nxp.com --- > > > > > 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 > > > > > c2f9735ce7..da94b3d9df 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 > > > > > > > > Have you made any Travis-CI run? > > > I tested it with a local board > > > > Could you be so kind and also test following patchset > > (parts from Layerscape also needs testing): > > https://patchwork.ozlabs.org/cover/1146494/ > I don't quite understand this patch. How can I test it?
You need to apply it first to -master branch.
Then apply your board code (or if it is already in mainline just remove the #undef(s) from include/config_uncmd_spl.h)
As a last step - run make menuconfig and enable SPL_DM_SPI* flags.
Currently, it is in the master, and SPI* in the #undef(s) from include/ uncmd_spl.h has been deleted, but an error was reported: CC spl/lib/display_options.o drivers/spi/spi.c: In function 'spi_do_alloc_slave': drivers/spi/spi.c:34:8: error: 'struct spi_slave' has no member named 'bus' slave->bus = bus; ^~ drivers/spi/spi.c:35:8: error: 'struct spi_slave' has no member named 'cs' slave->cs = cs; ^~ make[3]: *** [spl/drivers/spi/spi.o] Error 1 make[3]: *** Waiting for unfinished jobs.... make[2]: *** [spl/drivers/spi] Error 2 make[1]: *** [spl/drivers] Error 2 make[1]: *** Waiting for unfinished jobs.... LD spl/lib/built-in.o make: *** [spl/u-boot-spl] Error 2
If your board is in mainline (master branch) it shall build without issues:
Applied on top of -master branch: 'commit feb5a02f869d ("Merge branch 'master' of git://git.denx.de/u-boot-sh")' Travis-CI (clean build): https://travis-ci.org/lmajewski/u-boot-dfu/builds/570594278
The patch itself: https://patchwork.ozlabs.org/patch/1146377/
- I git reset to this commit: feb5a02f869d 2. Your patch has been
Could you check if your board (the code which is now in mainline) compiles without issues at this step?
Yes,.no issue!(because this commit not support espi dm mode)
Ok.
- Apply my
current patch set 4. Include/uncmd_uncmd_spl.h file is deleted as follows:
- # undef CONFIG_DM_SPI
- # undef CONFIG_DM_SPI_FLASH
- In include/configs/T208xQDS.h file:
+/* SPI Flash Configs */
- # if defined (CONFIG_SPL_BUILD)
- # undef CONFIG_DM_SPI
- # undef CONFIG_DM_SPI_FLASH
- # undef CONFIG_SPI_FLASH_MTD
Setting #undef in config file causes !CONFIG_IS_ENABLED(FOO), to malfunction as the FOO is not set in .config.
- # endif
- Make menuconfig:
Configuration CONFIG_SPL_DM_SPI = y CONFIG_SPL_DM_SPI_FLASH = y 7. Compilation errors still occur: LD spl/lib/built-in.o LD spl/u-boot-spl drivers/built-in.o: In function `ofnode_read_u32': /home/hanch/uboot/uboot-upstream/u-boot/drivers/core/ofnode.c:29: undefined reference to `fdt_getprop' drivers/built-in.o: In function `ofnode_get_property': /home/hanch/uboot/uboot-upstream/u-boot/drivers/core/ofnode.c:528: undefined reference to `fdt_getprop' drivers/built-in.o: In function `blk_post_probe': /home/hanch/uboot/uboot-upstream/u-boot/drivers/block/blk-uclass.c:655: undefined reference to `part_init' drivers/built-in.o:(.u_boot_list_2_uclass_2_spi+0x8): undefined reference to `dm_scan_fdt_dev' make[1]: *** [spl/u-boot-spl] Error 1 make: *** [spl/u-boot-spl] Error 2
Do I need to modify a lot of files?
> > > > Which allows removal of > > #undef CONFIG_DM_SPI > > #undef CONFIG_DM_SPI_FLASH > > > > and have the same configuration done via Kconfig ? > > > > > > _______________________________________________ > > > U-Boot mailing list > > > U-Boot@lists.denx.de > > > https://lists.denx.de/listinfo/u-boot > > > > > > > > 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@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@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@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@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@denx.de

-----Original Message----- From: Lukasz Majewski lukma@denx.de Sent: 2019年8月15日 15:54 To: Chuanhua Han chuanhua.han@nxp.com Cc: Jagan Teki jagan@amarulasolutions.com; Xiaowei Bao xiaowei.bao@nxp.com; U-Boot-Denx u-boot@lists.denx.de; Pan Jiafei Jiafei.Pan@freescale.com; Jagan Teki jagan@openedev.com; Ruchika Gupta ruchika.gupta@nxp.com Subject: Re: [U-Boot] [EXT] Re: [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
On Thu, 15 Aug 2019 07:39:45 +0000 Chuanhua Han chuanhua.han@nxp.com wrote:
-----Original Message----- From: Lukasz Majewski lukma@denx.de Sent: 2019年8月15日 15:15 To: Chuanhua Han chuanhua.han@nxp.com Cc: Jagan Teki jagan@amarulasolutions.com; Xiaowei Bao xiaowei.bao@nxp.com; U-Boot-Denx u-boot@lists.denx.de; Pan Jiafei Jiafei.Pan@freescale.com; Jagan Teki jagan@openedev.com; Ruchika Gupta ruchika.gupta@nxp.com Subject: Re: [U-Boot] [EXT] Re: [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
On Thu, 15 Aug 2019 03:35:28 +0000 Chuanhua Han chuanhua.han@nxp.com wrote:
-----Original Message----- From: Lukasz Majewski lukma@denx.de Sent: 2019年8月14日 19:39 To: Chuanhua Han chuanhua.han@nxp.com Cc: Jagan Teki jagan@amarulasolutions.com; Xiaowei Bao xiaowei.bao@nxp.com; U-Boot-Denx u-boot@lists.denx.de; Pan Jiafei Jiafei.Pan@freescale.com; Jagan Teki jagan@openedev.com; Ruchika Gupta ruchika.gupta@nxp.com Subject: Re: [U-Boot] [EXT] Re: [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
On Wed, 14 Aug 2019 11:10:46 +0000 Chuanhua Han chuanhua.han@nxp.com wrote:
> -----Original Message----- > From: Lukasz Majewski lukma@denx.de > Sent: 2019年8月14日 18:53 > To: Chuanhua Han chuanhua.han@nxp.com > Cc: Jagan Teki jagan@amarulasolutions.com; Xiaowei Bao > xiaowei.bao@nxp.com; U-Boot-Denx u-boot@lists.denx.de; > Pan Jiafei Jiafei.Pan@freescale.com; Jagan Teki > jagan@openedev.com; Ruchika Gupta ruchika.gupta@nxp.com > Subject: Re: [U-Boot] [EXT] Re: [PATCH v4 1/5] spl: dm: > disable SPI DM flash for non-DM SPL > > On Wed, 14 Aug 2019 10:41:32 +0000 Chuanhua Han > chuanhua.han@nxp.com wrote: > > > > -----Original Message----- > > > From: Lukasz Majewski lukma@denx.de > > > Sent: 2019年8月14日 16:57 > > > To: Chuanhua Han chuanhua.han@nxp.com > > > Cc: Jagan Teki jagan@amarulasolutions.com; Xiaowei Bao > > > xiaowei.bao@nxp.com; U-Boot-Denx > > > u-boot@lists.denx.de; Pan Jiafei > > > Jiafei.Pan@freescale.com; Jagan Teki > > > jagan@openedev.com; Ruchika Gupta > > > ruchika.gupta@nxp.com Subject: Re: [U-Boot] [EXT] Re: > > > [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM > > > SPL > > > > > > Hi Chuanhua, > > > > > > > > -----Original Message----- > > > > > From: Jagan Teki jagan@amarulasolutions.com > > > > > Sent: 2019年8月14日 15:45 > > > > > To: Chuanhua Han chuanhua.han@nxp.com > > > > > Cc: Wolfgang Denk wd@denx.de; Shengzhou Liu > > > > > shengzhou.liu@nxp.com; Ruchika Gupta > > > > > ruchika.gupta@nxp.com; Jagan Teki > > > > > jagan@openedev.com; Simon Glass > > > > > sjg@chromium.org; Prabhakar Kushwaha > > > > > prabhakar.kushwaha@nxp.com; U-Boot-Denx > > > > > u-boot@lists.denx.de; Pan Jiafei > > > > > Jiafei.Pan@freescale.com Subject: [EXT] Re: > > > > > [U-Boot] [PATCH v4 1/5] spl: dm: disable SPI DM > > > > > flash for non-DM SPL > > > > > > > > > > Caution: EXT Email > > > > > > > > > > On Fri, Jun 21, 2019 at 7:51 AM Chuanhua Han > > > > > chuanhua.han@nxp.com wrote: > > > > > > > > > > > > This patch solves the problem that spiboot cannot > > > > > > be performed in non-DM SPL. > > > > > > > > > > > > Signed-off-by: Pan Jiafei > > > > > > Jiafei.Pan@freescale.com Signed-off-by: > > > > > > Chuanhua Han chuanhua.han@nxp.com --- 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 > > > > > > c2f9735ce7..da94b3d9df 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 > > > > > > > > > > Have you made any Travis-CI run? > > > > I tested it with a local board > > > > > > Could you be so kind and also test following patchset > > > (parts from Layerscape also needs testing): > > > https://patchwork.ozlabs.org/cover/1146494/ > > I don't quite understand this patch. How can I test it? > > You need to apply it first to -master branch. > > Then apply your board code (or if it is already in mainline > just remove the #undef(s) from include/config_uncmd_spl.h) > > As a last step - run make menuconfig and enable SPL_DM_SPI* > flags. Currently, it is in the master, and SPI* in the #undef(s) from include/ uncmd_spl.h has been deleted, but an error was reported: CC spl/lib/display_options.o drivers/spi/spi.c: In function 'spi_do_alloc_slave': drivers/spi/spi.c:34:8: error: 'struct spi_slave' has no member named 'bus' slave->bus = bus; ^~ drivers/spi/spi.c:35:8: error: 'struct spi_slave' has no member named 'cs' slave->cs = cs; ^~ make[3]: *** [spl/drivers/spi/spi.o] Error 1 make[3]: *** Waiting for unfinished jobs.... make[2]: *** [spl/drivers/spi] Error 2 make[1]: *** [spl/drivers] Error 2 make[1]: *** Waiting for unfinished jobs.... LD spl/lib/built-in.o make: *** [spl/u-boot-spl] Error 2
If your board is in mainline (master branch) it shall build without issues:
Applied on top of -master branch: 'commit feb5a02f869d ("Merge branch 'master' of git://git.denx.de/u-boot-sh")' Travis-CI (clean build): https://travis-ci.org/lmajewski/u-boot-dfu/builds/570594278
The patch itself: https://patchwork.ozlabs.org/patch/1146377/
- I git reset to this commit: feb5a02f869d 2. Your patch has been
Could you check if your board (the code which is now in mainline) compiles without issues at this step?
Yes,.no issue!(because this commit not support espi dm mode)
Ok.
- Apply my
current patch set 4. Include/uncmd_uncmd_spl.h file is deleted as follows:
- # undef CONFIG_DM_SPI
- # undef CONFIG_DM_SPI_FLASH
- In include/configs/T208xQDS.h file:
+/* SPI Flash Configs */
- # if defined (CONFIG_SPL_BUILD)
- # undef CONFIG_DM_SPI
- # undef CONFIG_DM_SPI_FLASH
- # undef CONFIG_SPI_FLASH_MTD
Setting #undef in config file causes !CONFIG_IS_ENABLED(FOO), to malfunction as the FOO is not set in .config.
So I need to put these #undef's in a Kconfig file, right?
- # endif
- Make menuconfig:
Configuration CONFIG_SPL_DM_SPI = y CONFIG_SPL_DM_SPI_FLASH = y 7. Compilation errors still occur: LD spl/lib/built-in.o LD spl/u-boot-spl drivers/built-in.o: In function `ofnode_read_u32': /home/hanch/uboot/uboot-upstream/u-boot/drivers/core/ofnode.c:29: undefined reference to `fdt_getprop' drivers/built-in.o: In function `ofnode_get_property': /home/hanch/uboot/uboot-upstream/u-boot/drivers/core/ofnode.c:528: undefined reference to `fdt_getprop' drivers/built-in.o: In function `blk_post_probe':
/home/hanch/uboot/uboot-upstream/u-boot/drivers/block/blk-uclass.c:655:
undefined reference to `part_init' drivers/built-in.o:(.u_boot_list_2_uclass_2_spi+0x8): undefined reference to `dm_scan_fdt_dev' make[1]: *** [spl/u-boot-spl] Error 1 make: *** [spl/u-boot-spl] Error 2
Do I need to modify a lot of files? > > > > > > > Which allows removal of > > > #undef CONFIG_DM_SPI > > > #undef CONFIG_DM_SPI_FLASH > > > > > > and have the same configuration done via Kconfig ? > > > > > > > > > _______________________________________________ > > > > U-Boot mailing list > > > > U-Boot@lists.denx.de > > > > https://lists.denx.de/listinfo/u-boot > > > > > > > > > > > > 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@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@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@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@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@denx.de

On Thu, 15 Aug 2019 07:57:00 +0000 Chuanhua Han chuanhua.han@nxp.com wrote:
-----Original Message----- From: Lukasz Majewski lukma@denx.de Sent: 2019年8月15日 15:54 To: Chuanhua Han chuanhua.han@nxp.com Cc: Jagan Teki jagan@amarulasolutions.com; Xiaowei Bao xiaowei.bao@nxp.com; U-Boot-Denx u-boot@lists.denx.de; Pan Jiafei Jiafei.Pan@freescale.com; Jagan Teki jagan@openedev.com; Ruchika Gupta ruchika.gupta@nxp.com Subject: Re: [U-Boot] [EXT] Re: [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
On Thu, 15 Aug 2019 07:39:45 +0000 Chuanhua Han chuanhua.han@nxp.com wrote:
-----Original Message----- From: Lukasz Majewski lukma@denx.de Sent: 2019年8月15日 15:15 To: Chuanhua Han chuanhua.han@nxp.com Cc: Jagan Teki jagan@amarulasolutions.com; Xiaowei Bao xiaowei.bao@nxp.com; U-Boot-Denx u-boot@lists.denx.de; Pan Jiafei Jiafei.Pan@freescale.com; Jagan Teki jagan@openedev.com; Ruchika Gupta ruchika.gupta@nxp.com Subject: Re: [U-Boot] [EXT] Re: [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
On Thu, 15 Aug 2019 03:35:28 +0000 Chuanhua Han chuanhua.han@nxp.com wrote:
-----Original Message----- From: Lukasz Majewski lukma@denx.de Sent: 2019年8月14日 19:39 To: Chuanhua Han chuanhua.han@nxp.com Cc: Jagan Teki jagan@amarulasolutions.com; Xiaowei Bao xiaowei.bao@nxp.com; U-Boot-Denx u-boot@lists.denx.de; Pan Jiafei Jiafei.Pan@freescale.com; Jagan Teki jagan@openedev.com; Ruchika Gupta ruchika.gupta@nxp.com Subject: Re: [U-Boot] [EXT] Re: [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
On Wed, 14 Aug 2019 11:10:46 +0000 Chuanhua Han chuanhua.han@nxp.com wrote:
> > -----Original Message----- > > From: Lukasz Majewski lukma@denx.de > > Sent: 2019年8月14日 18:53 > > To: Chuanhua Han chuanhua.han@nxp.com > > Cc: Jagan Teki jagan@amarulasolutions.com; Xiaowei Bao > > xiaowei.bao@nxp.com; U-Boot-Denx > > u-boot@lists.denx.de; Pan Jiafei > > Jiafei.Pan@freescale.com; Jagan Teki > > jagan@openedev.com; Ruchika Gupta > > ruchika.gupta@nxp.com Subject: Re: [U-Boot] [EXT] Re: > > [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM > > SPL > > > > On Wed, 14 Aug 2019 10:41:32 +0000 Chuanhua Han > > chuanhua.han@nxp.com wrote: > > > > > > -----Original Message----- > > > > From: Lukasz Majewski lukma@denx.de > > > > Sent: 2019年8月14日 16:57 > > > > To: Chuanhua Han chuanhua.han@nxp.com > > > > Cc: Jagan Teki jagan@amarulasolutions.com; > > > > Xiaowei Bao xiaowei.bao@nxp.com; U-Boot-Denx > > > > u-boot@lists.denx.de; Pan Jiafei > > > > Jiafei.Pan@freescale.com; Jagan Teki > > > > jagan@openedev.com; Ruchika Gupta > > > > ruchika.gupta@nxp.com Subject: Re: [U-Boot] [EXT] > > > > Re: [PATCH v4 1/5] spl: dm: disable SPI DM flash > > > > for non-DM SPL > > > > > > > > Hi Chuanhua, > > > > > > > > > > -----Original Message----- > > > > > > From: Jagan Teki jagan@amarulasolutions.com > > > > > > Sent: 2019年8月14日 15:45 > > > > > > To: Chuanhua Han chuanhua.han@nxp.com > > > > > > Cc: Wolfgang Denk wd@denx.de; Shengzhou Liu > > > > > > shengzhou.liu@nxp.com; Ruchika Gupta > > > > > > ruchika.gupta@nxp.com; Jagan Teki > > > > > > jagan@openedev.com; Simon Glass > > > > > > sjg@chromium.org; Prabhakar Kushwaha > > > > > > prabhakar.kushwaha@nxp.com; U-Boot-Denx > > > > > > u-boot@lists.denx.de; Pan Jiafei > > > > > > Jiafei.Pan@freescale.com Subject: [EXT] Re: > > > > > > [U-Boot] [PATCH v4 1/5] spl: dm: disable SPI DM > > > > > > flash for non-DM SPL > > > > > > > > > > > > Caution: EXT Email > > > > > > > > > > > > On Fri, Jun 21, 2019 at 7:51 AM Chuanhua Han > > > > > > chuanhua.han@nxp.com wrote: > > > > > > > > > > > > > > This patch solves the problem that spiboot > > > > > > > cannot be performed in non-DM SPL. > > > > > > > > > > > > > > Signed-off-by: Pan Jiafei > > > > > > > Jiafei.Pan@freescale.com Signed-off-by: > > > > > > > Chuanhua Han chuanhua.han@nxp.com --- > > > > > > > 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 > > > > > > > c2f9735ce7..da94b3d9df 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 > > > > > > > > > > > > Have you made any Travis-CI run? > > > > > I tested it with a local board > > > > > > > > Could you be so kind and also test following > > > > patchset (parts from Layerscape also needs testing): > > > > https://patchwork.ozlabs.org/cover/1146494/ > > > I don't quite understand this patch. How can I test > > > it? > > > > You need to apply it first to -master branch. > > > > Then apply your board code (or if it is already in > > mainline just remove the #undef(s) from > > include/config_uncmd_spl.h) > > > > As a last step - run make menuconfig and enable > > SPL_DM_SPI* flags. > Currently, it is in the master, and SPI* in the #undef(s) > from include/ uncmd_spl.h has been deleted, but an error > was reported: CC spl/lib/display_options.o > drivers/spi/spi.c: In function 'spi_do_alloc_slave': > drivers/spi/spi.c:34:8: error: 'struct spi_slave' has no > member named 'bus' slave->bus = bus; ^~ > drivers/spi/spi.c:35:8: error: 'struct spi_slave' has no > member named 'cs' slave->cs = cs; > ^~ > make[3]: *** [spl/drivers/spi/spi.o] Error 1 > make[3]: *** Waiting for unfinished jobs.... > make[2]: *** [spl/drivers/spi] Error 2 > make[1]: *** [spl/drivers] Error 2 > make[1]: *** Waiting for unfinished jobs.... > LD spl/lib/built-in.o > make: *** [spl/u-boot-spl] Error 2
If your board is in mainline (master branch) it shall build without issues:
Applied on top of -master branch: 'commit feb5a02f869d ("Merge branch 'master' of git://git.denx.de/u-boot-sh")' Travis-CI (clean build): https://travis-ci.org/lmajewski/u-boot-dfu/builds/570594278
The patch itself: https://patchwork.ozlabs.org/patch/1146377/
- I git reset to this commit: feb5a02f869d 2. Your patch has
been applied(https://patchwork.ozlabs.org/patch/1146377/)
Could you check if your board (the code which is now in mainline) compiles without issues at this step?
Yes,.no issue!(because this commit not support espi dm mode)
Ok.
- Apply my
current patch set 4. Include/uncmd_uncmd_spl.h file is deleted as follows:
- # undef CONFIG_DM_SPI
- # undef CONFIG_DM_SPI_FLASH
- In include/configs/T208xQDS.h file:
+/* SPI Flash Configs */
- # if defined (CONFIG_SPL_BUILD)
- # undef CONFIG_DM_SPI
- # undef CONFIG_DM_SPI_FLASH
- # undef CONFIG_SPI_FLASH_MTD
Setting #undef in config file causes !CONFIG_IS_ENABLED(FOO), to malfunction as the FOO is not set in .config.
So I need to put these #undef's in a Kconfig file, right?
The patchset which I've posted does exactly that. Just try to adjust your code on top of it.
- # endif
- Make menuconfig:
Configuration CONFIG_SPL_DM_SPI = y CONFIG_SPL_DM_SPI_FLASH = y 7. Compilation errors still occur: LD spl/lib/built-in.o LD spl/u-boot-spl drivers/built-in.o: In function `ofnode_read_u32': /home/hanch/uboot/uboot-upstream/u-boot/drivers/core/ofnode.c:29: undefined reference to `fdt_getprop' drivers/built-in.o: In function `ofnode_get_property': /home/hanch/uboot/uboot-upstream/u-boot/drivers/core/ofnode.c:528: undefined reference to `fdt_getprop' drivers/built-in.o: In function `blk_post_probe':
/home/hanch/uboot/uboot-upstream/u-boot/drivers/block/blk-uclass.c:655:
undefined reference to `part_init' drivers/built-in.o:(.u_boot_list_2_uclass_2_spi+0x8): undefined reference to `dm_scan_fdt_dev' make[1]: *** [spl/u-boot-spl] Error 1 make: *** [spl/u-boot-spl] Error 2
> > Do I need to modify a lot of files? > > > > > > > > > > Which allows removal of > > > > #undef CONFIG_DM_SPI > > > > #undef CONFIG_DM_SPI_FLASH > > > > > > > > and have the same configuration done via Kconfig ? > > > > > > > > > > > > _______________________________________________ > > > > > U-Boot mailing list > > > > > U-Boot@lists.denx.de > > > > > https://lists.denx.de/listinfo/u-boot > > > > > > > > > > > > > > > > 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@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@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@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@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@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@denx.de

Modify the Freescale ESPI driver to support the driver model. Also resolved the following problems:
===================== WARNING ====================== This board does not use CONFIG_DM_SPI. Please update the board before v2019.04 for no dm conversion and v2019.07 for partially dm converted drivers. Failure to update can lead to driver/board removal See doc/driver-model/MIGRATION.txt for more info. ==================================================== ===================== WARNING ====================== This board does not use CONFIG_DM_SPI_FLASH. Please update the board to use CONFIG_SPI_FLASH before the v2019.07 release. Failure to update by the deadline may result in board removal. See doc/driver-model/MIGRATION.txt for more info. ====================================================
Signed-off-by: Chuanhua Han chuanhua.han@nxp.com --- Changes in v4: - Update copyright information. - Move the fsl_espi_platdata data structure to the include/dm/platform_data/. - Merge the contents of the fsl_espi_priv structure into the fsl_spi_slave structure. - Implement the fsl_espi_set_speed function. - Implement the fsl_espi_set_mode function. - Implement the espi_release_bus function. - Remove unwanted fsl_espi_bind functions. - Implement the fsl_espi_child_pre_probe function as needed. - Use #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA). Changes in v3: - Add a cover-letter for this patch set. Changes in v2: - The fsl_espi driver support both OF_CONTROL and PLATDATA.
drivers/spi/fsl_espi.c | 444 ++++++++++++++++++++-------- include/dm/platform_data/fsl_espi.h | 16 + 2 files changed, 339 insertions(+), 121 deletions(-) create mode 100644 include/dm/platform_data/fsl_espi.h
diff --git a/drivers/spi/fsl_espi.c b/drivers/spi/fsl_espi.c index 7444ae1a06..849f65f0e6 100644 --- a/drivers/spi/fsl_espi.c +++ b/drivers/spi/fsl_espi.c @@ -3,18 +3,25 @@ * eSPI controller driver. * * Copyright 2010-2011 Freescale Semiconductor, Inc. + * Copyright 2019 NXP * Author: Mingkai Hu (Mingkai.hu@freescale.com) + * Chuanhua Han (chuanhua.han@nxp.com) */
#include <common.h> - #include <malloc.h> #include <spi.h> #include <asm/immap_85xx.h> +#include <dm.h> +#include <errno.h> +#include <fdtdec.h> +#include <dm/platform_data/fsl_espi.h>
struct fsl_spi_slave { struct spi_slave slave; ccsr_espi_t *espi; + u32 speed_hz; + unsigned int cs; unsigned int div16; unsigned int pm; int tx_timeout; @@ -28,6 +35,9 @@ struct fsl_spi_slave { #define to_fsl_spi_slave(s) container_of(s, struct fsl_spi_slave, slave) #define US_PER_SECOND 1000000UL
+/* default SCK frequency, unit: HZ */ +#define FSL_ESPI_DEFAULT_SCK_FREQ 10000000 + #define ESPI_MAX_CS_NUM 4 #define ESPI_FIFO_WIDTH_BIT 32
@@ -62,116 +72,32 @@ struct fsl_spi_slave {
#define ESPI_MAX_DATA_TRANSFER_LEN 0xFFF0
-struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, - unsigned int max_hz, unsigned int mode) -{ - struct fsl_spi_slave *fsl; - sys_info_t sysinfo; - unsigned long spibrg = 0; - unsigned long spi_freq = 0; - unsigned char pm = 0; - - if (!spi_cs_is_valid(bus, cs)) - return NULL; - - fsl = spi_alloc_slave(struct fsl_spi_slave, bus, cs); - if (!fsl) - return NULL; - - fsl->espi = (void *)(CONFIG_SYS_MPC85xx_ESPI_ADDR); - fsl->mode = mode; - fsl->max_transfer_length = ESPI_MAX_DATA_TRANSFER_LEN; - - /* Set eSPI BRG clock source */ - get_sys_info(&sysinfo); - spibrg = sysinfo.freq_systembus / 2; - fsl->div16 = 0; - if ((spibrg / max_hz) > 32) { - fsl->div16 = ESPI_CSMODE_DIV16; - pm = spibrg / (max_hz * 16 * 2); - if (pm > 16) { - pm = 16; - debug("Requested speed is too low: %d Hz, %ld Hz " - "is used.\n", max_hz, spibrg / (32 * 16)); - } - } else - pm = spibrg / (max_hz * 2); - if (pm) - pm--; - fsl->pm = pm; - - if (fsl->div16) - spi_freq = spibrg / ((pm + 1) * 2 * 16); - else - spi_freq = spibrg / ((pm + 1) * 2); - - /* set tx_timeout to 10 times of one espi FIFO entry go out */ - fsl->tx_timeout = DIV_ROUND_UP((US_PER_SECOND * ESPI_FIFO_WIDTH_BIT - * 10), spi_freq); - - return &fsl->slave; -} - -void spi_free_slave(struct spi_slave *slave) +void spi_cs_activate(struct spi_slave *slave) { struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave); - free(fsl); + ccsr_espi_t *espi = fsl->espi; + unsigned int com = 0; + size_t data_len = fsl->data_len; + uint cs; +#ifndef CONFIG_DM_SPI + cs = slave->cs; +#else + cs = fsl->cs; +#endif + com &= ~(ESPI_COM_CS(0x3) | ESPI_COM_TRANLEN(0xFFFF)); + com |= ESPI_COM_CS(cs); + com |= ESPI_COM_TRANLEN(data_len - 1); + out_be32(&espi->com, com); }
-int spi_claim_bus(struct spi_slave *slave) +void spi_cs_deactivate(struct spi_slave *slave) { struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave); ccsr_espi_t *espi = fsl->espi; - unsigned char pm = fsl->pm; - unsigned int cs = slave->cs; - unsigned int mode = fsl->mode; - unsigned int div16 = fsl->div16; - int i; - - debug("%s: bus:%i cs:%i\n", __func__, slave->bus, cs); - - /* Enable eSPI interface */ - out_be32(&espi->mode, ESPI_MODE_RXTHR(3) - | ESPI_MODE_TXTHR(4) | ESPI_MODE_EN); - - out_be32(&espi->event, 0xffffffff); /* Clear all eSPI events */ - out_be32(&espi->mask, 0x00000000); /* Mask all eSPI interrupts */ - - /* Init CS mode interface */ - for (i = 0; i < ESPI_MAX_CS_NUM; i++) - out_be32(&espi->csmode[i], ESPI_CSMODE_INIT_VAL); - - out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs]) & - ~(ESPI_CSMODE_PM(0xF) | ESPI_CSMODE_DIV16 - | ESPI_CSMODE_CI_INACTIVEHIGH | ESPI_CSMODE_CP_BEGIN_EDGCLK - | ESPI_CSMODE_REV_MSB_FIRST | ESPI_CSMODE_LEN(0xF))); - - /* Set eSPI BRG clock source */ - out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs]) - | ESPI_CSMODE_PM(pm) | div16); - - /* Set eSPI mode */ - if (mode & SPI_CPHA) - out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs]) - | ESPI_CSMODE_CP_BEGIN_EDGCLK); - if (mode & SPI_CPOL) - out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs]) - | ESPI_CSMODE_CI_INACTIVEHIGH); - - /* Character bit order: msb first */ - out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs]) - | ESPI_CSMODE_REV_MSB_FIRST); - - /* Character length in bits, between 0x3~0xf, i.e. 4bits~16bits */ - out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs]) - | ESPI_CSMODE_LEN(7)); - - return 0; -} - -void spi_release_bus(struct spi_slave *slave) -{
+ /* clear the RXCNT and TXCNT */ + out_be32(&espi->mode, in_be32(&espi->mode) & (~ESPI_MODE_EN)); + out_be32(&espi->mode, in_be32(&espi->mode) | ESPI_MODE_EN); }
static void fsl_espi_tx(struct fsl_spi_slave *fsl, const void *dout) @@ -204,7 +130,8 @@ static void fsl_espi_tx(struct fsl_spi_slave *fsl, const void *dout) debug("***spi_xfer:...Tx timeout! event = %08x\n", event); }
-static int fsl_espi_rx(struct fsl_spi_slave *fsl, void *din, unsigned int bytes) +static int fsl_espi_rx(struct fsl_spi_slave *fsl, void *din, + unsigned int bytes) { ccsr_espi_t *espi = fsl->espi; unsigned int tmpdin, rx_times; @@ -236,10 +163,17 @@ static int fsl_espi_rx(struct fsl_spi_slave *fsl, void *din, unsigned int bytes) return bytes; }
-int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *data_out, - void *data_in, unsigned long flags) +void espi_release_bus(struct fsl_spi_slave *fsl) { - struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave); + /* Disable the SPI hardware */ + out_be32(&fsl->espi->mode, + in_be32(&fsl->espi->mode) & (~ESPI_MODE_EN)); +} + +int espi_xfer(struct fsl_spi_slave *fsl, uint cs, unsigned int bitlen, + const void *data_out, void *data_in, unsigned long flags) +{ + struct spi_slave *slave = &fsl->slave; ccsr_espi_t *espi = fsl->espi; unsigned int event, rx_bytes; const void *dout = NULL; @@ -258,7 +192,8 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *data_out, max_tran_len = fsl->max_transfer_length; switch (flags) { case SPI_XFER_BEGIN: - cmd_len = fsl->cmd_len = data_len; + cmd_len = data_len; + fsl->cmd_len = cmd_len; memcpy(cmd_buf, data_out, cmd_len); return 0; case 0: @@ -354,30 +289,297 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *data_out, return 0; }
+void espi_claim_bus(struct fsl_spi_slave *fsl, unsigned int cs) +{ + ccsr_espi_t *espi = fsl->espi; + unsigned char pm = fsl->pm; + unsigned int mode = fsl->mode; + unsigned int div16 = fsl->div16; + int i; + + /* Enable eSPI interface */ + out_be32(&espi->mode, ESPI_MODE_RXTHR(3) + | ESPI_MODE_TXTHR(4) | ESPI_MODE_EN); + + out_be32(&espi->event, 0xffffffff); /* Clear all eSPI events */ + out_be32(&espi->mask, 0x00000000); /* Mask all eSPI interrupts */ + + /* Init CS mode interface */ + for (i = 0; i < ESPI_MAX_CS_NUM; i++) + out_be32(&espi->csmode[i], ESPI_CSMODE_INIT_VAL); + + out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs]) & + ~(ESPI_CSMODE_PM(0xF) | ESPI_CSMODE_DIV16 + | ESPI_CSMODE_CI_INACTIVEHIGH | ESPI_CSMODE_CP_BEGIN_EDGCLK + | ESPI_CSMODE_REV_MSB_FIRST | ESPI_CSMODE_LEN(0xF))); + + /* Set eSPI BRG clock source */ + out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs]) + | ESPI_CSMODE_PM(pm) | div16); + + /* Set eSPI mode */ + if (mode & SPI_CPHA) + out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs]) + | ESPI_CSMODE_CP_BEGIN_EDGCLK); + if (mode & SPI_CPOL) + out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs]) + | ESPI_CSMODE_CI_INACTIVEHIGH); + + /* Character bit order: msb first */ + out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs]) + | ESPI_CSMODE_REV_MSB_FIRST); + + /* Character length in bits, between 0x3~0xf, i.e. 4bits~16bits */ + out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs]) + | ESPI_CSMODE_LEN(7)); +} + +void espi_setup_slave(struct fsl_spi_slave *fsl) +{ + unsigned int max_hz; + sys_info_t sysinfo; + unsigned long spibrg = 0; + unsigned long spi_freq = 0; + unsigned char pm = 0; + + max_hz = fsl->speed_hz; + + get_sys_info(&sysinfo); + spibrg = sysinfo.freq_systembus / 2; + fsl->div16 = 0; + if ((spibrg / max_hz) > 32) { + fsl->div16 = ESPI_CSMODE_DIV16; + pm = spibrg / (max_hz * 16 * 2); + if (pm > 16) { + pm = 16; + debug("max_hz is too low: %d Hz, %ld Hz is used.\n", + max_hz, spibrg / (32 * 16)); + } + } else { + pm = spibrg / (max_hz * 2); + } + if (pm) + pm--; + fsl->pm = pm; + + if (fsl->div16) + spi_freq = spibrg / ((pm + 1) * 2 * 16); + else + spi_freq = spibrg / ((pm + 1) * 2); + + /* set tx_timeout to 10 times of one espi FIFO entry go out */ + fsl->tx_timeout = DIV_ROUND_UP((US_PER_SECOND * ESPI_FIFO_WIDTH_BIT + * 10), spi_freq);/* Set eSPI BRG clock source */ +} + +#ifndef CONFIG_DM_SPI int spi_cs_is_valid(unsigned int bus, unsigned int cs) { return bus == 0 && cs < ESPI_MAX_CS_NUM; }
-void spi_cs_activate(struct spi_slave *slave) +struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs, + unsigned int max_hz, unsigned int mode) +{ + struct fsl_spi_slave *fsl; + + if (!spi_cs_is_valid(bus, cs)) + return NULL; + + fsl = spi_alloc_slave(struct fsl_spi_slave, bus, cs); + if (!fsl) + return NULL; + + fsl->espi = (void *)(CONFIG_SYS_MPC85xx_ESPI_ADDR); + fsl->mode = mode; + fsl->max_transfer_length = ESPI_MAX_DATA_TRANSFER_LEN; + fsl->speed_hz = max_hz; + + espi_setup_slave(fsl); + + return &fsl->slave; +} + +void spi_free_slave(struct spi_slave *slave) { struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave); - ccsr_espi_t *espi = fsl->espi; - unsigned int com = 0; - size_t data_len = fsl->data_len;
- com &= ~(ESPI_COM_CS(0x3) | ESPI_COM_TRANLEN(0xFFFF)); - com |= ESPI_COM_CS(slave->cs); - com |= ESPI_COM_TRANLEN(data_len - 1); - out_be32(&espi->com, com); + free(fsl); }
-void spi_cs_deactivate(struct spi_slave *slave) +int spi_claim_bus(struct spi_slave *slave) { struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave); - ccsr_espi_t *espi = fsl->espi;
- /* clear the RXCNT and TXCNT */ - out_be32(&espi->mode, in_be32(&espi->mode) & (~ESPI_MODE_EN)); - out_be32(&espi->mode, in_be32(&espi->mode) | ESPI_MODE_EN); + espi_claim_bus(fsl, slave->cs); + + return 0; } + +void spi_release_bus(struct spi_slave *slave) +{ + struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave); + + espi_release_bus(fsl); +} + +int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout, + void *din, unsigned long flags) +{ + struct fsl_spi_slave *fsl = (struct fsl_spi_slave *)slave; + + return espi_xfer(fsl, slave->cs, bitlen, dout, din, flags); +} +#else +static void __espi_set_speed(struct fsl_spi_slave *fsl) +{ + espi_setup_slave(fsl); + + /* Set eSPI BRG clock source */ + out_be32(&fsl->espi->csmode[fsl->cs], + in_be32(&fsl->espi->csmode[fsl->cs]) + | ESPI_CSMODE_PM(fsl->pm) | fsl->div16); +} + +static void __espi_set_mode(struct fsl_spi_slave *fsl) +{ + /* Set eSPI mode */ + if (fsl->mode & SPI_CPHA) + out_be32(&fsl->espi->csmode[fsl->cs], + in_be32(&fsl->espi->csmode[fsl->cs]) + | ESPI_CSMODE_CP_BEGIN_EDGCLK); + if (fsl->mode & SPI_CPOL) + out_be32(&fsl->espi->csmode[fsl->cs], + in_be32(&fsl->espi->csmode[fsl->cs]) + | ESPI_CSMODE_CI_INACTIVEHIGH); +} + +static int fsl_espi_claim_bus(struct udevice *dev) +{ + struct udevice *bus = dev->parent; + struct fsl_spi_slave *fsl = dev_get_priv(bus); + + espi_claim_bus(fsl, fsl->cs); + + return 0; +} + +static int fsl_espi_release_bus(struct udevice *dev) +{ + struct udevice *bus = dev->parent; + struct fsl_spi_slave *fsl = dev_get_priv(bus); + + espi_release_bus(fsl); + + return 0; +} + +static int fsl_espi_xfer(struct udevice *dev, unsigned int bitlen, + const void *dout, void *din, unsigned long flags) +{ + struct udevice *bus = dev->parent; + struct fsl_spi_slave *fsl = dev_get_priv(bus); + + return espi_xfer(fsl, fsl->cs, bitlen, dout, din, flags); +} + +static int fsl_espi_set_speed(struct udevice *bus, uint speed) +{ + struct fsl_spi_slave *fsl = dev_get_priv(bus); + + debug("%s speed %u\n", __func__, speed); + fsl->speed_hz = speed; + + __espi_set_speed(fsl); + + return 0; +} + +static int fsl_espi_set_mode(struct udevice *bus, uint mode) +{ + struct fsl_spi_slave *fsl = dev_get_priv(bus); + + debug("%s mode %u\n", __func__, mode); + fsl->mode = mode; + + __espi_set_mode(fsl); + + return 0; +} + +static int fsl_espi_child_pre_probe(struct udevice *dev) +{ + struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev); + struct udevice *bus = dev->parent; + struct fsl_spi_slave *fsl = dev_get_priv(bus); + + debug("%s cs %u\n", __func__, slave_plat->cs); + fsl->cs = slave_plat->cs; + + return 0; +} + +static int fsl_espi_probe(struct udevice *bus) +{ + struct fsl_espi_platdata *plat = dev_get_platdata(bus); + struct fsl_spi_slave *fsl = dev_get_priv(bus); + + fsl->espi = (ccsr_espi_t *)((u32)plat->regs_addr); + fsl->max_transfer_length = ESPI_MAX_DATA_TRANSFER_LEN; + fsl->speed_hz = plat->speed_hz; + + debug("%s probe done, bus-num %d.\n", bus->name, bus->seq); + + return 0; +} + +static const struct dm_spi_ops fsl_espi_ops = { + .claim_bus = fsl_espi_claim_bus, + .release_bus = fsl_espi_release_bus, + .xfer = fsl_espi_xfer, + .set_speed = fsl_espi_set_speed, + .set_mode = fsl_espi_set_mode, +}; + +#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +static int fsl_espi_ofdata_to_platdata(struct udevice *bus) +{ + fdt_addr_t addr; + struct fsl_espi_platdata *plat = bus->platdata; + const void *blob = gd->fdt_blob; + int node = dev_of_offset(bus); + + addr = dev_read_addr(bus); + if (addr == FDT_ADDR_T_NONE) + return -EINVAL; + + plat->regs_addr = lower_32_bits(addr); + plat->speed_hz = fdtdec_get_int(blob, node, "spi-max-frequency", + FSL_ESPI_DEFAULT_SCK_FREQ); + + debug("ESPI: regs=%p, max-frequency=%d\n", + &plat->regs_addr, plat->speed_hz); + + return 0; +} + +static const struct udevice_id fsl_espi_ids[] = { + { .compatible = "fsl,mpc8536-espi" }, + { } +}; +#endif + +U_BOOT_DRIVER(fsl_espi) = { + .name = "fsl_espi", + .id = UCLASS_SPI, +#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) + .of_match = fsl_espi_ids, + .ofdata_to_platdata = fsl_espi_ofdata_to_platdata, +#endif + .ops = &fsl_espi_ops, + .platdata_auto_alloc_size = sizeof(struct fsl_espi_platdata), + .priv_auto_alloc_size = sizeof(struct fsl_spi_slave), + .probe = fsl_espi_probe, + .child_pre_probe = fsl_espi_child_pre_probe, +}; +#endif diff --git a/include/dm/platform_data/fsl_espi.h b/include/dm/platform_data/fsl_espi.h new file mode 100644 index 0000000000..e03cdb60c3 --- /dev/null +++ b/include/dm/platform_data/fsl_espi.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/* + * Copyright 2019 NXP + */ + +#ifndef __fsl_espi_h +#define __fsl_espi_h + +struct fsl_espi_platdata { + uint flags; + uint speed_hz; + uint num_chipselect; + fdt_addr_t regs_addr; +}; + +#endif /* __fsl_espi_h */

+ Simon Glass
-----Original Message----- From: Chuanhua Han chuanhua.han@nxp.com Sent: 2019年6月21日 10:22 To: wd@denx.de; Shengzhou Liu shengzhou.liu@nxp.com; Ruchika Gupta ruchika.gupta@nxp.com; jagan@openedev.com; sjg@chromium.org; Prabhakar Kushwaha prabhakar.kushwaha@nxp.com Cc: u-boot@lists.denx.de; Chuanhua Han chuanhua.han@nxp.com Subject: [PATCH v4 2/5] dm: spi: Convert Freescale ESPI driver to driver model
Modify the Freescale ESPI driver to support the driver model. Also resolved the following problems:
===================== WARNING ====================== This board does not use CONFIG_DM_SPI. Please update the board before v2019.04 for no dm conversion and v2019.07 for partially dm converted drivers. Failure to update can lead to driver/board removal See doc/driver-model/MIGRATION.txt for more info. ==================================================== ===================== WARNING ====================== This board does not use CONFIG_DM_SPI_FLASH. Please update the board to use CONFIG_SPI_FLASH before the v2019.07 release. Failure to update by the deadline may result in board removal. See doc/driver-model/MIGRATION.txt for more info. ====================================================
Signed-off-by: Chuanhua Han chuanhua.han@nxp.com
Changes in v4:
- Update copyright information.
- Move the fsl_espi_platdata data structure to the
include/dm/platform_data/.
- Merge the contents of the fsl_espi_priv structure into the fsl_spi_slave
structure.
- Implement the fsl_espi_set_speed function.
- Implement the fsl_espi_set_mode function.
- Implement the espi_release_bus function.
- Remove unwanted fsl_espi_bind functions.
- Implement the fsl_espi_child_pre_probe function as needed.
- Use #if CONFIG_IS_ENABLED(OF_CONTROL)
&& !CONFIG_IS_ENABLED(OF_PLATDATA). Changes in v3:
- Add a cover-letter for this patch set.
Changes in v2:
- The fsl_espi driver support both OF_CONTROL and PLATDATA.
drivers/spi/fsl_espi.c | 444 ++++++++++++++++++++-------- include/dm/platform_data/fsl_espi.h | 16 + 2 files changed, 339 insertions(+), 121 deletions(-) create mode 100644 include/dm/platform_data/fsl_espi.h
diff --git a/drivers/spi/fsl_espi.c b/drivers/spi/fsl_espi.c index 7444ae1a06..849f65f0e6 100644 --- a/drivers/spi/fsl_espi.c +++ b/drivers/spi/fsl_espi.c @@ -3,18 +3,25 @@
- eSPI controller driver.
- Copyright 2010-2011 Freescale Semiconductor, Inc.
- Copyright 2019 NXP
- Author: Mingkai Hu (Mingkai.hu@freescale.com)
*/
Chuanhua Han (chuanhua.han@nxp.com)
#include <common.h>
#include <malloc.h> #include <spi.h> #include <asm/immap_85xx.h> +#include <dm.h> +#include <errno.h> +#include <fdtdec.h> +#include <dm/platform_data/fsl_espi.h>
struct fsl_spi_slave { struct spi_slave slave; ccsr_espi_t *espi;
- u32 speed_hz;
- unsigned int cs; unsigned int div16; unsigned int pm; int tx_timeout;
@@ -28,6 +35,9 @@ struct fsl_spi_slave { #define to_fsl_spi_slave(s) container_of(s, struct fsl_spi_slave, slave) #define US_PER_SECOND 1000000UL
+/* default SCK frequency, unit: HZ */ +#define FSL_ESPI_DEFAULT_SCK_FREQ 10000000
#define ESPI_MAX_CS_NUM 4 #define ESPI_FIFO_WIDTH_BIT 32
@@ -62,116 +72,32 @@ struct fsl_spi_slave {
#define ESPI_MAX_DATA_TRANSFER_LEN 0xFFF0
-struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
unsigned int max_hz, unsigned int mode)
-{
- struct fsl_spi_slave *fsl;
- sys_info_t sysinfo;
- unsigned long spibrg = 0;
- unsigned long spi_freq = 0;
- unsigned char pm = 0;
- if (!spi_cs_is_valid(bus, cs))
return NULL;
- fsl = spi_alloc_slave(struct fsl_spi_slave, bus, cs);
- if (!fsl)
return NULL;
- fsl->espi = (void *)(CONFIG_SYS_MPC85xx_ESPI_ADDR);
- fsl->mode = mode;
- fsl->max_transfer_length = ESPI_MAX_DATA_TRANSFER_LEN;
- /* Set eSPI BRG clock source */
- get_sys_info(&sysinfo);
- spibrg = sysinfo.freq_systembus / 2;
- fsl->div16 = 0;
- if ((spibrg / max_hz) > 32) {
fsl->div16 = ESPI_CSMODE_DIV16;
pm = spibrg / (max_hz * 16 * 2);
if (pm > 16) {
pm = 16;
debug("Requested speed is too low: %d Hz, %ld Hz "
"is used.\n", max_hz, spibrg / (32 * 16));
}
- } else
pm = spibrg / (max_hz * 2);
- if (pm)
pm--;
- fsl->pm = pm;
- if (fsl->div16)
spi_freq = spibrg / ((pm + 1) * 2 * 16);
- else
spi_freq = spibrg / ((pm + 1) * 2);
- /* set tx_timeout to 10 times of one espi FIFO entry go out */
- fsl->tx_timeout = DIV_ROUND_UP((US_PER_SECOND *
ESPI_FIFO_WIDTH_BIT
* 10), spi_freq);
- return &fsl->slave;
-}
-void spi_free_slave(struct spi_slave *slave) +void spi_cs_activate(struct spi_slave *slave) { struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave);
- free(fsl);
- ccsr_espi_t *espi = fsl->espi;
- unsigned int com = 0;
- size_t data_len = fsl->data_len;
- uint cs;
+#ifndef CONFIG_DM_SPI
- cs = slave->cs;
+#else
- cs = fsl->cs;
+#endif
- com &= ~(ESPI_COM_CS(0x3) | ESPI_COM_TRANLEN(0xFFFF));
- com |= ESPI_COM_CS(cs);
- com |= ESPI_COM_TRANLEN(data_len - 1);
- out_be32(&espi->com, com);
}
-int spi_claim_bus(struct spi_slave *slave) +void spi_cs_deactivate(struct spi_slave *slave) { struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave); ccsr_espi_t *espi = fsl->espi;
- unsigned char pm = fsl->pm;
- unsigned int cs = slave->cs;
- unsigned int mode = fsl->mode;
- unsigned int div16 = fsl->div16;
- int i;
- debug("%s: bus:%i cs:%i\n", __func__, slave->bus, cs);
- /* Enable eSPI interface */
- out_be32(&espi->mode, ESPI_MODE_RXTHR(3)
| ESPI_MODE_TXTHR(4) | ESPI_MODE_EN);
- out_be32(&espi->event, 0xffffffff); /* Clear all eSPI events */
- out_be32(&espi->mask, 0x00000000); /* Mask all eSPI interrupts */
- /* Init CS mode interface */
- for (i = 0; i < ESPI_MAX_CS_NUM; i++)
out_be32(&espi->csmode[i], ESPI_CSMODE_INIT_VAL);
- out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs]) &
~(ESPI_CSMODE_PM(0xF) | ESPI_CSMODE_DIV16
| ESPI_CSMODE_CI_INACTIVEHIGH |
ESPI_CSMODE_CP_BEGIN_EDGCLK
| ESPI_CSMODE_REV_MSB_FIRST | ESPI_CSMODE_LEN(0xF)));
- /* Set eSPI BRG clock source */
- out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs])
| ESPI_CSMODE_PM(pm) | div16);
- /* Set eSPI mode */
- if (mode & SPI_CPHA)
out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs])
| ESPI_CSMODE_CP_BEGIN_EDGCLK);
- if (mode & SPI_CPOL)
out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs])
| ESPI_CSMODE_CI_INACTIVEHIGH);
- /* Character bit order: msb first */
- out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs])
| ESPI_CSMODE_REV_MSB_FIRST);
- /* Character length in bits, between 0x3~0xf, i.e. 4bits~16bits */
- out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs])
| ESPI_CSMODE_LEN(7));
- return 0;
-}
-void spi_release_bus(struct spi_slave *slave) -{
- /* clear the RXCNT and TXCNT */
- out_be32(&espi->mode, in_be32(&espi->mode) & (~ESPI_MODE_EN));
- out_be32(&espi->mode, in_be32(&espi->mode) | ESPI_MODE_EN);
}
static void fsl_espi_tx(struct fsl_spi_slave *fsl, const void *dout) @@ -204,7 +130,8 @@ static void fsl_espi_tx(struct fsl_spi_slave *fsl, const void *dout) debug("***spi_xfer:...Tx timeout! event = %08x\n", event); }
-static int fsl_espi_rx(struct fsl_spi_slave *fsl, void *din, unsigned int bytes) +static int fsl_espi_rx(struct fsl_spi_slave *fsl, void *din,
unsigned int bytes)
{ ccsr_espi_t *espi = fsl->espi; unsigned int tmpdin, rx_times; @@ -236,10 +163,17 @@ static int fsl_espi_rx(struct fsl_spi_slave *fsl, void *din, unsigned int bytes) return bytes; }
-int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *data_out,
void *data_in, unsigned long flags)
+void espi_release_bus(struct fsl_spi_slave *fsl) {
- struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave);
- /* Disable the SPI hardware */
out_be32(&fsl->espi->mode,
in_be32(&fsl->espi->mode) & (~ESPI_MODE_EN)); }
+int espi_xfer(struct fsl_spi_slave *fsl, uint cs, unsigned int bitlen,
const void *data_out, void *data_in, unsigned long flags) {
- struct spi_slave *slave = &fsl->slave; ccsr_espi_t *espi = fsl->espi; unsigned int event, rx_bytes; const void *dout = NULL;
@@ -258,7 +192,8 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *data_out, max_tran_len = fsl->max_transfer_length; switch (flags) { case SPI_XFER_BEGIN:
cmd_len = fsl->cmd_len = data_len;
cmd_len = data_len;
memcpy(cmd_buf, data_out, cmd_len); return 0; case 0:fsl->cmd_len = cmd_len;
@@ -354,30 +289,297 @@ int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *data_out, return 0; }
+void espi_claim_bus(struct fsl_spi_slave *fsl, unsigned int cs) {
- ccsr_espi_t *espi = fsl->espi;
- unsigned char pm = fsl->pm;
- unsigned int mode = fsl->mode;
- unsigned int div16 = fsl->div16;
- int i;
- /* Enable eSPI interface */
- out_be32(&espi->mode, ESPI_MODE_RXTHR(3)
| ESPI_MODE_TXTHR(4) | ESPI_MODE_EN);
- out_be32(&espi->event, 0xffffffff); /* Clear all eSPI events */
- out_be32(&espi->mask, 0x00000000); /* Mask all eSPI interrupts */
- /* Init CS mode interface */
- for (i = 0; i < ESPI_MAX_CS_NUM; i++)
out_be32(&espi->csmode[i], ESPI_CSMODE_INIT_VAL);
- out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs]) &
~(ESPI_CSMODE_PM(0xF) | ESPI_CSMODE_DIV16
| ESPI_CSMODE_CI_INACTIVEHIGH |
ESPI_CSMODE_CP_BEGIN_EDGCLK
| ESPI_CSMODE_REV_MSB_FIRST | ESPI_CSMODE_LEN(0xF)));
- /* Set eSPI BRG clock source */
- out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs])
| ESPI_CSMODE_PM(pm) | div16);
- /* Set eSPI mode */
- if (mode & SPI_CPHA)
out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs])
| ESPI_CSMODE_CP_BEGIN_EDGCLK);
- if (mode & SPI_CPOL)
out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs])
| ESPI_CSMODE_CI_INACTIVEHIGH);
- /* Character bit order: msb first */
- out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs])
| ESPI_CSMODE_REV_MSB_FIRST);
- /* Character length in bits, between 0x3~0xf, i.e. 4bits~16bits */
- out_be32(&espi->csmode[cs], in_be32(&espi->csmode[cs])
| ESPI_CSMODE_LEN(7));
+}
+void espi_setup_slave(struct fsl_spi_slave *fsl) {
- unsigned int max_hz;
- sys_info_t sysinfo;
- unsigned long spibrg = 0;
- unsigned long spi_freq = 0;
- unsigned char pm = 0;
- max_hz = fsl->speed_hz;
- get_sys_info(&sysinfo);
- spibrg = sysinfo.freq_systembus / 2;
- fsl->div16 = 0;
- if ((spibrg / max_hz) > 32) {
fsl->div16 = ESPI_CSMODE_DIV16;
pm = spibrg / (max_hz * 16 * 2);
if (pm > 16) {
pm = 16;
debug("max_hz is too low: %d Hz, %ld Hz is used.\n",
max_hz, spibrg / (32 * 16));
}
- } else {
pm = spibrg / (max_hz * 2);
- }
- if (pm)
pm--;
- fsl->pm = pm;
- if (fsl->div16)
spi_freq = spibrg / ((pm + 1) * 2 * 16);
- else
spi_freq = spibrg / ((pm + 1) * 2);
- /* set tx_timeout to 10 times of one espi FIFO entry go out */
- fsl->tx_timeout = DIV_ROUND_UP((US_PER_SECOND *
ESPI_FIFO_WIDTH_BIT
* 10), spi_freq);/* Set eSPI BRG clock source */ }
+#ifndef CONFIG_DM_SPI int spi_cs_is_valid(unsigned int bus, unsigned int cs) { return bus == 0 && cs < ESPI_MAX_CS_NUM; }
-void spi_cs_activate(struct spi_slave *slave) +struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
unsigned int max_hz, unsigned int mode) {
- struct fsl_spi_slave *fsl;
- if (!spi_cs_is_valid(bus, cs))
return NULL;
- fsl = spi_alloc_slave(struct fsl_spi_slave, bus, cs);
- if (!fsl)
return NULL;
- fsl->espi = (void *)(CONFIG_SYS_MPC85xx_ESPI_ADDR);
- fsl->mode = mode;
- fsl->max_transfer_length = ESPI_MAX_DATA_TRANSFER_LEN;
- fsl->speed_hz = max_hz;
- espi_setup_slave(fsl);
- return &fsl->slave;
+}
+void spi_free_slave(struct spi_slave *slave) { struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave);
ccsr_espi_t *espi = fsl->espi;
unsigned int com = 0;
size_t data_len = fsl->data_len;
com &= ~(ESPI_COM_CS(0x3) | ESPI_COM_TRANLEN(0xFFFF));
com |= ESPI_COM_CS(slave->cs);
com |= ESPI_COM_TRANLEN(data_len - 1);
out_be32(&espi->com, com);
- free(fsl);
}
-void spi_cs_deactivate(struct spi_slave *slave) +int spi_claim_bus(struct spi_slave *slave) { struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave);
ccsr_espi_t *espi = fsl->espi;
/* clear the RXCNT and TXCNT */
out_be32(&espi->mode, in_be32(&espi->mode) & (~ESPI_MODE_EN));
out_be32(&espi->mode, in_be32(&espi->mode) | ESPI_MODE_EN);
- espi_claim_bus(fsl, slave->cs);
- return 0;
}
+void spi_release_bus(struct spi_slave *slave) {
- struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave);
- espi_release_bus(fsl);
+}
+int spi_xfer(struct spi_slave *slave, unsigned int bitlen, const void *dout,
void *din, unsigned long flags)
+{
- struct fsl_spi_slave *fsl = (struct fsl_spi_slave *)slave;
- return espi_xfer(fsl, slave->cs, bitlen, dout, din, flags); } #else
+static void __espi_set_speed(struct fsl_spi_slave *fsl) {
- espi_setup_slave(fsl);
- /* Set eSPI BRG clock source */
- out_be32(&fsl->espi->csmode[fsl->cs],
in_be32(&fsl->espi->csmode[fsl->cs])
| ESPI_CSMODE_PM(fsl->pm) | fsl->div16); }
+static void __espi_set_mode(struct fsl_spi_slave *fsl) {
- /* Set eSPI mode */
- if (fsl->mode & SPI_CPHA)
out_be32(&fsl->espi->csmode[fsl->cs],
in_be32(&fsl->espi->csmode[fsl->cs])
| ESPI_CSMODE_CP_BEGIN_EDGCLK);
- if (fsl->mode & SPI_CPOL)
out_be32(&fsl->espi->csmode[fsl->cs],
in_be32(&fsl->espi->csmode[fsl->cs])
| ESPI_CSMODE_CI_INACTIVEHIGH);
+}
+static int fsl_espi_claim_bus(struct udevice *dev) {
- struct udevice *bus = dev->parent;
- struct fsl_spi_slave *fsl = dev_get_priv(bus);
- espi_claim_bus(fsl, fsl->cs);
- return 0;
+}
+static int fsl_espi_release_bus(struct udevice *dev) {
- struct udevice *bus = dev->parent;
- struct fsl_spi_slave *fsl = dev_get_priv(bus);
- espi_release_bus(fsl);
- return 0;
+}
+static int fsl_espi_xfer(struct udevice *dev, unsigned int bitlen,
const void *dout, void *din, unsigned long flags) {
- struct udevice *bus = dev->parent;
- struct fsl_spi_slave *fsl = dev_get_priv(bus);
- return espi_xfer(fsl, fsl->cs, bitlen, dout, din, flags); }
+static int fsl_espi_set_speed(struct udevice *bus, uint speed) {
- struct fsl_spi_slave *fsl = dev_get_priv(bus);
- debug("%s speed %u\n", __func__, speed);
- fsl->speed_hz = speed;
- __espi_set_speed(fsl);
- return 0;
+}
+static int fsl_espi_set_mode(struct udevice *bus, uint mode) {
- struct fsl_spi_slave *fsl = dev_get_priv(bus);
- debug("%s mode %u\n", __func__, mode);
- fsl->mode = mode;
- __espi_set_mode(fsl);
- return 0;
+}
+static int fsl_espi_child_pre_probe(struct udevice *dev) {
- struct dm_spi_slave_platdata *slave_plat = dev_get_parent_platdata(dev);
- struct udevice *bus = dev->parent;
- struct fsl_spi_slave *fsl = dev_get_priv(bus);
- debug("%s cs %u\n", __func__, slave_plat->cs);
- fsl->cs = slave_plat->cs;
- return 0;
+}
+static int fsl_espi_probe(struct udevice *bus) {
- struct fsl_espi_platdata *plat = dev_get_platdata(bus);
- struct fsl_spi_slave *fsl = dev_get_priv(bus);
- fsl->espi = (ccsr_espi_t *)((u32)plat->regs_addr);
- fsl->max_transfer_length = ESPI_MAX_DATA_TRANSFER_LEN;
- fsl->speed_hz = plat->speed_hz;
- debug("%s probe done, bus-num %d.\n", bus->name, bus->seq);
- return 0;
+}
+static const struct dm_spi_ops fsl_espi_ops = {
- .claim_bus = fsl_espi_claim_bus,
- .release_bus = fsl_espi_release_bus,
- .xfer = fsl_espi_xfer,
- .set_speed = fsl_espi_set_speed,
- .set_mode = fsl_espi_set_mode,
+};
+#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA) +static int fsl_espi_ofdata_to_platdata(struct udevice *bus) {
- fdt_addr_t addr;
- struct fsl_espi_platdata *plat = bus->platdata;
- const void *blob = gd->fdt_blob;
- int node = dev_of_offset(bus);
- addr = dev_read_addr(bus);
- if (addr == FDT_ADDR_T_NONE)
return -EINVAL;
- plat->regs_addr = lower_32_bits(addr);
- plat->speed_hz = fdtdec_get_int(blob, node, "spi-max-frequency",
FSL_ESPI_DEFAULT_SCK_FREQ);
- debug("ESPI: regs=%p, max-frequency=%d\n",
&plat->regs_addr, plat->speed_hz);
- return 0;
+}
+static const struct udevice_id fsl_espi_ids[] = {
- { .compatible = "fsl,mpc8536-espi" },
- { }
+}; +#endif
+U_BOOT_DRIVER(fsl_espi) = {
- .name = "fsl_espi",
- .id = UCLASS_SPI,
+#if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA)
- .of_match = fsl_espi_ids,
- .ofdata_to_platdata = fsl_espi_ofdata_to_platdata, #endif
- .ops = &fsl_espi_ops,
- .platdata_auto_alloc_size = sizeof(struct fsl_espi_platdata),
- .priv_auto_alloc_size = sizeof(struct fsl_spi_slave),
- .probe = fsl_espi_probe,
- .child_pre_probe = fsl_espi_child_pre_probe, }; #endif
diff --git a/include/dm/platform_data/fsl_espi.h b/include/dm/platform_data/fsl_espi.h new file mode 100644 index 0000000000..e03cdb60c3 --- /dev/null +++ b/include/dm/platform_data/fsl_espi.h @@ -0,0 +1,16 @@ +/* SPDX-License-Identifier: GPL-2.0+ */ +/*
- Copyright 2019 NXP
- */
+#ifndef __fsl_espi_h +#define __fsl_espi_h
+struct fsl_espi_platdata {
- uint flags;
- uint speed_hz;
- uint num_chipselect;
- fdt_addr_t regs_addr;
+};
+#endif /* __fsl_espi_h */
2.17.1

On Fri, Jun 21, 2019 at 7:52 AM Chuanhua Han chuanhua.han@nxp.com wrote:
Modify the Freescale ESPI driver to support the driver model. Also resolved the following problems:
===================== WARNING ====================== This board does not use CONFIG_DM_SPI. Please update the board before v2019.04 for no dm conversion and v2019.07 for partially dm converted drivers. Failure to update can lead to driver/board removal See doc/driver-model/MIGRATION.txt for more info. ==================================================== ===================== WARNING ====================== This board does not use CONFIG_DM_SPI_FLASH. Please update the board to use CONFIG_SPI_FLASH before the v2019.07 release. Failure to update by the deadline may result in board removal. See doc/driver-model/MIGRATION.txt for more info. ====================================================
Signed-off-by: Chuanhua Han chuanhua.han@nxp.com
Changes in v4: - Update copyright information. - Move the fsl_espi_platdata data structure to the include/dm/platform_data/. - Merge the contents of the fsl_espi_priv structure into the fsl_spi_slave structure. - Implement the fsl_espi_set_speed function. - Implement the fsl_espi_set_mode function. - Implement the espi_release_bus function. - Remove unwanted fsl_espi_bind functions. - Implement the fsl_espi_child_pre_probe function as needed. - Use #if CONFIG_IS_ENABLED(OF_CONTROL) && !CONFIG_IS_ENABLED(OF_PLATDATA). Changes in v3: - Add a cover-letter for this patch set. Changes in v2: - The fsl_espi driver support both OF_CONTROL and PLATDATA.
drivers/spi/fsl_espi.c | 444 ++++++++++++++++++++-------- include/dm/platform_data/fsl_espi.h | 16 + 2 files changed, 339 insertions(+), 121 deletions(-) create mode 100644 include/dm/platform_data/fsl_espi.h
diff --git a/drivers/spi/fsl_espi.c b/drivers/spi/fsl_espi.c index 7444ae1a06..849f65f0e6 100644 --- a/drivers/spi/fsl_espi.c +++ b/drivers/spi/fsl_espi.c @@ -3,18 +3,25 @@
- eSPI controller driver.
- Copyright 2010-2011 Freescale Semiconductor, Inc.
- Copyright 2019 NXP
- Author: Mingkai Hu (Mingkai.hu@freescale.com)
*/
Chuanhua Han (chuanhua.han@nxp.com)
#include <common.h>
#include <malloc.h> #include <spi.h> #include <asm/immap_85xx.h> +#include <dm.h> +#include <errno.h> +#include <fdtdec.h> +#include <dm/platform_data/fsl_espi.h>
struct fsl_spi_slave { struct spi_slave slave; ccsr_espi_t *espi;
u32 speed_hz;
unsigned int cs; unsigned int div16; unsigned int pm; int tx_timeout;
@@ -28,6 +35,9 @@ struct fsl_spi_slave { #define to_fsl_spi_slave(s) container_of(s, struct fsl_spi_slave, slave) #define US_PER_SECOND 1000000UL
+/* default SCK frequency, unit: HZ */ +#define FSL_ESPI_DEFAULT_SCK_FREQ 10000000
#define ESPI_MAX_CS_NUM 4 #define ESPI_FIFO_WIDTH_BIT 32
@@ -62,116 +72,32 @@ struct fsl_spi_slave {
#define ESPI_MAX_DATA_TRANSFER_LEN 0xFFF0
-struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
unsigned int max_hz, unsigned int mode)
-{
struct fsl_spi_slave *fsl;
sys_info_t sysinfo;
unsigned long spibrg = 0;
unsigned long spi_freq = 0;
unsigned char pm = 0;
if (!spi_cs_is_valid(bus, cs))
return NULL;
fsl = spi_alloc_slave(struct fsl_spi_slave, bus, cs);
if (!fsl)
return NULL;
fsl->espi = (void *)(CONFIG_SYS_MPC85xx_ESPI_ADDR);
fsl->mode = mode;
fsl->max_transfer_length = ESPI_MAX_DATA_TRANSFER_LEN;
/* Set eSPI BRG clock source */
get_sys_info(&sysinfo);
spibrg = sysinfo.freq_systembus / 2;
fsl->div16 = 0;
if ((spibrg / max_hz) > 32) {
fsl->div16 = ESPI_CSMODE_DIV16;
pm = spibrg / (max_hz * 16 * 2);
if (pm > 16) {
pm = 16;
debug("Requested speed is too low: %d Hz, %ld Hz "
"is used.\n", max_hz, spibrg / (32 * 16));
}
} else
pm = spibrg / (max_hz * 2);
if (pm)
pm--;
fsl->pm = pm;
if (fsl->div16)
spi_freq = spibrg / ((pm + 1) * 2 * 16);
else
spi_freq = spibrg / ((pm + 1) * 2);
/* set tx_timeout to 10 times of one espi FIFO entry go out */
fsl->tx_timeout = DIV_ROUND_UP((US_PER_SECOND * ESPI_FIFO_WIDTH_BIT
* 10), spi_freq);
return &fsl->slave;
-}
-void spi_free_slave(struct spi_slave *slave) +void spi_cs_activate(struct spi_slave *slave) { struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave);
free(fsl);
ccsr_espi_t *espi = fsl->espi;
unsigned int com = 0;
size_t data_len = fsl->data_len;
uint cs;
+#ifndef CONFIG_DM_SPI
cs = slave->cs;
+#else
cs = fsl->cs;
+#endif
Preserve cs in private struct and resuse it w/o this ifdef.

-----Original Message----- From: Jagan Teki jagan@amarulasolutions.com Sent: 2019年8月14日 15:38 To: Chuanhua Han chuanhua.han@nxp.com Cc: Wolfgang Denk wd@denx.de; Shengzhou Liu shengzhou.liu@nxp.com; Ruchika Gupta ruchika.gupta@nxp.com; Jagan Teki jagan@openedev.com; Simon Glass sjg@chromium.org; Prabhakar Kushwaha prabhakar.kushwaha@nxp.com; U-Boot-Denx u-boot@lists.denx.de Subject: [EXT] Re: [U-Boot] [PATCH v4 2/5] dm: spi: Convert Freescale ESPI driver to driver model
Caution: EXT Email
On Fri, Jun 21, 2019 at 7:52 AM Chuanhua Han chuanhua.han@nxp.com wrote:
Modify the Freescale ESPI driver to support the driver model. Also resolved the following problems:
===================== WARNING ====================== This board
does
not use CONFIG_DM_SPI. Please update the board before v2019.04 for no dm conversion and v2019.07 for partially dm converted drivers. Failure to update can lead to driver/board removal See doc/driver-model/MIGRATION.txt for more info. ==================================================== ===================== WARNING ====================== This board
does
not use CONFIG_DM_SPI_FLASH. Please update the board to use CONFIG_SPI_FLASH before the v2019.07 release. Failure to update by the deadline may result in board removal. See doc/driver-model/MIGRATION.txt for more info. ====================================================
Signed-off-by: Chuanhua Han chuanhua.han@nxp.com
Changes in v4: - Update copyright information. - Move the fsl_espi_platdata data structure to the include/dm/platform_data/. - Merge the contents of the fsl_espi_priv structure into the fsl_spi_slave structure. - Implement the fsl_espi_set_speed function. - Implement the fsl_espi_set_mode function. - Implement the espi_release_bus function. - Remove unwanted fsl_espi_bind functions. - Implement the fsl_espi_child_pre_probe function as needed. - Use #if CONFIG_IS_ENABLED(OF_CONTROL)
&& !CONFIG_IS_ENABLED(OF_PLATDATA).
Changes in v3: - Add a cover-letter for this patch set. Changes in v2: - The fsl_espi driver support both OF_CONTROL and PLATDATA.
drivers/spi/fsl_espi.c | 444 ++++++++++++++++++++-------- include/dm/platform_data/fsl_espi.h | 16 + 2 files changed, 339 insertions(+), 121 deletions(-) create mode 100644 include/dm/platform_data/fsl_espi.h
diff --git a/drivers/spi/fsl_espi.c b/drivers/spi/fsl_espi.c index 7444ae1a06..849f65f0e6 100644 --- a/drivers/spi/fsl_espi.c +++ b/drivers/spi/fsl_espi.c @@ -3,18 +3,25 @@
- eSPI controller driver.
- Copyright 2010-2011 Freescale Semiconductor, Inc.
- Copyright 2019 NXP
- Author: Mingkai Hu (Mingkai.hu@freescale.com)
*/
Chuanhua Han (chuanhua.han@nxp.com)
#include <common.h>
#include <malloc.h> #include <spi.h> #include <asm/immap_85xx.h> +#include <dm.h> +#include <errno.h> +#include <fdtdec.h> +#include <dm/platform_data/fsl_espi.h>
struct fsl_spi_slave { struct spi_slave slave; ccsr_espi_t *espi;
u32 speed_hz;
unsigned int cs; unsigned int div16; unsigned int pm; int tx_timeout;
@@ -28,6 +35,9 @@ struct fsl_spi_slave { #define to_fsl_spi_slave(s) container_of(s, struct fsl_spi_slave, slave) #define US_PER_SECOND 1000000UL
+/* default SCK frequency, unit: HZ */ +#define FSL_ESPI_DEFAULT_SCK_FREQ 10000000
#define ESPI_MAX_CS_NUM 4 #define ESPI_FIFO_WIDTH_BIT 32
@@ -62,116 +72,32 @@ struct fsl_spi_slave {
#define ESPI_MAX_DATA_TRANSFER_LEN 0xFFF0
-struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
unsigned int max_hz, unsigned int mode)
-{
struct fsl_spi_slave *fsl;
sys_info_t sysinfo;
unsigned long spibrg = 0;
unsigned long spi_freq = 0;
unsigned char pm = 0;
if (!spi_cs_is_valid(bus, cs))
return NULL;
fsl = spi_alloc_slave(struct fsl_spi_slave, bus, cs);
if (!fsl)
return NULL;
fsl->espi = (void *)(CONFIG_SYS_MPC85xx_ESPI_ADDR);
fsl->mode = mode;
fsl->max_transfer_length = ESPI_MAX_DATA_TRANSFER_LEN;
/* Set eSPI BRG clock source */
get_sys_info(&sysinfo);
spibrg = sysinfo.freq_systembus / 2;
fsl->div16 = 0;
if ((spibrg / max_hz) > 32) {
fsl->div16 = ESPI_CSMODE_DIV16;
pm = spibrg / (max_hz * 16 * 2);
if (pm > 16) {
pm = 16;
debug("Requested speed is too low: %d Hz, %ld
Hz "
"is used.\n", max_hz, spibrg / (32 * 16));
}
} else
pm = spibrg / (max_hz * 2);
if (pm)
pm--;
fsl->pm = pm;
if (fsl->div16)
spi_freq = spibrg / ((pm + 1) * 2 * 16);
else
spi_freq = spibrg / ((pm + 1) * 2);
/* set tx_timeout to 10 times of one espi FIFO entry go out */
fsl->tx_timeout = DIV_ROUND_UP((US_PER_SECOND *
ESPI_FIFO_WIDTH_BIT
* 10), spi_freq);
return &fsl->slave;
-}
-void spi_free_slave(struct spi_slave *slave) +void spi_cs_activate(struct spi_slave *slave) { struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave);
free(fsl);
ccsr_espi_t *espi = fsl->espi;
unsigned int com = 0;
size_t data_len = fsl->data_len;
uint cs;
+#ifndef CONFIG_DM_SPI
cs = slave->cs;
+#else
cs = fsl->cs;
+#endif
Preserve cs in private struct and resuse it w/o this ifdef.
What does that mean? Private data, do you mean struct spi_slave? What does w/o mean?

On Wed, Aug 14, 2019 at 3:31 PM Chuanhua Han chuanhua.han@nxp.com wrote:
-----Original Message----- From: Jagan Teki jagan@amarulasolutions.com Sent: 2019年8月14日 15:38 To: Chuanhua Han chuanhua.han@nxp.com Cc: Wolfgang Denk wd@denx.de; Shengzhou Liu shengzhou.liu@nxp.com; Ruchika Gupta ruchika.gupta@nxp.com; Jagan Teki jagan@openedev.com; Simon Glass sjg@chromium.org; Prabhakar Kushwaha prabhakar.kushwaha@nxp.com; U-Boot-Denx u-boot@lists.denx.de Subject: [EXT] Re: [U-Boot] [PATCH v4 2/5] dm: spi: Convert Freescale ESPI driver to driver model
Caution: EXT Email
On Fri, Jun 21, 2019 at 7:52 AM Chuanhua Han chuanhua.han@nxp.com wrote:
Modify the Freescale ESPI driver to support the driver model. Also resolved the following problems:
===================== WARNING ====================== This board
does
not use CONFIG_DM_SPI. Please update the board before v2019.04 for no dm conversion and v2019.07 for partially dm converted drivers. Failure to update can lead to driver/board removal See doc/driver-model/MIGRATION.txt for more info. ==================================================== ===================== WARNING ====================== This board
does
not use CONFIG_DM_SPI_FLASH. Please update the board to use CONFIG_SPI_FLASH before the v2019.07 release. Failure to update by the deadline may result in board removal. See doc/driver-model/MIGRATION.txt for more info. ====================================================
Signed-off-by: Chuanhua Han chuanhua.han@nxp.com
Changes in v4: - Update copyright information. - Move the fsl_espi_platdata data structure to the include/dm/platform_data/. - Merge the contents of the fsl_espi_priv structure into the fsl_spi_slave structure. - Implement the fsl_espi_set_speed function. - Implement the fsl_espi_set_mode function. - Implement the espi_release_bus function. - Remove unwanted fsl_espi_bind functions. - Implement the fsl_espi_child_pre_probe function as needed. - Use #if CONFIG_IS_ENABLED(OF_CONTROL)
&& !CONFIG_IS_ENABLED(OF_PLATDATA).
Changes in v3: - Add a cover-letter for this patch set. Changes in v2: - The fsl_espi driver support both OF_CONTROL and PLATDATA.
drivers/spi/fsl_espi.c | 444 ++++++++++++++++++++-------- include/dm/platform_data/fsl_espi.h | 16 + 2 files changed, 339 insertions(+), 121 deletions(-) create mode 100644 include/dm/platform_data/fsl_espi.h
diff --git a/drivers/spi/fsl_espi.c b/drivers/spi/fsl_espi.c index 7444ae1a06..849f65f0e6 100644 --- a/drivers/spi/fsl_espi.c +++ b/drivers/spi/fsl_espi.c @@ -3,18 +3,25 @@
- eSPI controller driver.
- Copyright 2010-2011 Freescale Semiconductor, Inc.
- Copyright 2019 NXP
- Author: Mingkai Hu (Mingkai.hu@freescale.com)
*/
Chuanhua Han (chuanhua.han@nxp.com)
#include <common.h>
#include <malloc.h> #include <spi.h> #include <asm/immap_85xx.h> +#include <dm.h> +#include <errno.h> +#include <fdtdec.h> +#include <dm/platform_data/fsl_espi.h>
struct fsl_spi_slave { struct spi_slave slave; ccsr_espi_t *espi;
u32 speed_hz;
unsigned int cs; unsigned int div16; unsigned int pm; int tx_timeout;
@@ -28,6 +35,9 @@ struct fsl_spi_slave { #define to_fsl_spi_slave(s) container_of(s, struct fsl_spi_slave, slave) #define US_PER_SECOND 1000000UL
+/* default SCK frequency, unit: HZ */ +#define FSL_ESPI_DEFAULT_SCK_FREQ 10000000
#define ESPI_MAX_CS_NUM 4 #define ESPI_FIFO_WIDTH_BIT 32
@@ -62,116 +72,32 @@ struct fsl_spi_slave {
#define ESPI_MAX_DATA_TRANSFER_LEN 0xFFF0
-struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
unsigned int max_hz, unsigned int mode)
-{
struct fsl_spi_slave *fsl;
sys_info_t sysinfo;
unsigned long spibrg = 0;
unsigned long spi_freq = 0;
unsigned char pm = 0;
if (!spi_cs_is_valid(bus, cs))
return NULL;
fsl = spi_alloc_slave(struct fsl_spi_slave, bus, cs);
if (!fsl)
return NULL;
fsl->espi = (void *)(CONFIG_SYS_MPC85xx_ESPI_ADDR);
fsl->mode = mode;
fsl->max_transfer_length = ESPI_MAX_DATA_TRANSFER_LEN;
/* Set eSPI BRG clock source */
get_sys_info(&sysinfo);
spibrg = sysinfo.freq_systembus / 2;
fsl->div16 = 0;
if ((spibrg / max_hz) > 32) {
fsl->div16 = ESPI_CSMODE_DIV16;
pm = spibrg / (max_hz * 16 * 2);
if (pm > 16) {
pm = 16;
debug("Requested speed is too low: %d Hz, %ld
Hz "
"is used.\n", max_hz, spibrg / (32 * 16));
}
} else
pm = spibrg / (max_hz * 2);
if (pm)
pm--;
fsl->pm = pm;
if (fsl->div16)
spi_freq = spibrg / ((pm + 1) * 2 * 16);
else
spi_freq = spibrg / ((pm + 1) * 2);
/* set tx_timeout to 10 times of one espi FIFO entry go out */
fsl->tx_timeout = DIV_ROUND_UP((US_PER_SECOND *
ESPI_FIFO_WIDTH_BIT
* 10), spi_freq);
return &fsl->slave;
-}
-void spi_free_slave(struct spi_slave *slave) +void spi_cs_activate(struct spi_slave *slave) { struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave);
free(fsl);
ccsr_espi_t *espi = fsl->espi;
unsigned int com = 0;
size_t data_len = fsl->data_len;
uint cs;
+#ifndef CONFIG_DM_SPI
cs = slave->cs;
+#else
cs = fsl->cs;
+#endif
Preserve cs in private struct and resuse it w/o this ifdef.
What does that mean? Private data, do you mean struct spi_slave? What does w/o mean?
Add cs variable in struct and assign it in dm and non-dm codes.

-----Original Message----- From: Jagan Teki jagan@amarulasolutions.com Sent: 2019年8月15日 2:03 To: Chuanhua Han chuanhua.han@nxp.com Cc: Wolfgang Denk wd@denx.de; Shengzhou Liu shengzhou.liu@nxp.com; Ruchika Gupta ruchika.gupta@nxp.com; Jagan Teki jagan@openedev.com; Simon Glass sjg@chromium.org; Prabhakar Kushwaha prabhakar.kushwaha@nxp.com; U-Boot-Denx u-boot@lists.denx.de; Xiaowei Bao xiaowei.bao@nxp.com Subject: Re: [EXT] Re: [U-Boot] [PATCH v4 2/5] dm: spi: Convert Freescale ESPI driver to driver model
Caution: EXT Email
On Wed, Aug 14, 2019 at 3:31 PM Chuanhua Han chuanhua.han@nxp.com wrote:
-----Original Message----- From: Jagan Teki jagan@amarulasolutions.com Sent: 2019年8月14日 15:38 To: Chuanhua Han chuanhua.han@nxp.com Cc: Wolfgang Denk wd@denx.de; Shengzhou Liu shengzhou.liu@nxp.com; Ruchika Gupta ruchika.gupta@nxp.com; Jagan Teki jagan@openedev.com; Simon Glass sjg@chromium.org; Prabhakar Kushwaha prabhakar.kushwaha@nxp.com; U-Boot-Denx u-boot@lists.denx.de Subject: [EXT] Re: [U-Boot] [PATCH v4 2/5] dm: spi: Convert Freescale ESPI driver to driver model
Caution: EXT Email
On Fri, Jun 21, 2019 at 7:52 AM Chuanhua Han chuanhua.han@nxp.com wrote:
Modify the Freescale ESPI driver to support the driver model. Also resolved the following problems:
===================== WARNING ====================== This
board
does
not use CONFIG_DM_SPI. Please update the board before v2019.04 for no dm conversion and v2019.07 for partially dm converted drivers. Failure to update can lead to driver/board removal See doc/driver-model/MIGRATION.txt for more info. ==================================================== ===================== WARNING ====================== This
board
does
not use CONFIG_DM_SPI_FLASH. Please update the board to use CONFIG_SPI_FLASH before the v2019.07 release. Failure to update by the deadline may result in board removal. See doc/driver-model/MIGRATION.txt for more info. ====================================================
Signed-off-by: Chuanhua Han chuanhua.han@nxp.com
Changes in v4: - Update copyright information. - Move the fsl_espi_platdata data structure to the include/dm/platform_data/. - Merge the contents of the fsl_espi_priv structure into the fsl_spi_slave structure. - Implement the fsl_espi_set_speed function. - Implement the fsl_espi_set_mode function. - Implement the espi_release_bus function. - Remove unwanted fsl_espi_bind functions. - Implement the fsl_espi_child_pre_probe function as needed. - Use #if CONFIG_IS_ENABLED(OF_CONTROL)
&& !CONFIG_IS_ENABLED(OF_PLATDATA).
Changes in v3: - Add a cover-letter for this patch set. Changes in v2: - The fsl_espi driver support both OF_CONTROL and PLATDATA.
drivers/spi/fsl_espi.c | 444
++++++++++++++++++++--------
include/dm/platform_data/fsl_espi.h | 16 + 2 files changed, 339 insertions(+), 121 deletions(-) create mode 100644 include/dm/platform_data/fsl_espi.h
diff --git a/drivers/spi/fsl_espi.c b/drivers/spi/fsl_espi.c index 7444ae1a06..849f65f0e6 100644 --- a/drivers/spi/fsl_espi.c +++ b/drivers/spi/fsl_espi.c @@ -3,18 +3,25 @@
- eSPI controller driver.
- Copyright 2010-2011 Freescale Semiconductor, Inc.
- Copyright 2019 NXP
- Author: Mingkai Hu (Mingkai.hu@freescale.com)
*/
Chuanhua Han (chuanhua.han@nxp.com)
#include <common.h>
#include <malloc.h> #include <spi.h> #include <asm/immap_85xx.h> +#include <dm.h> +#include <errno.h> +#include <fdtdec.h> +#include <dm/platform_data/fsl_espi.h>
struct fsl_spi_slave { struct spi_slave slave; ccsr_espi_t *espi;
u32 speed_hz;
unsigned int cs; unsigned int div16; unsigned int pm; int tx_timeout;
@@ -28,6 +35,9 @@ struct fsl_spi_slave { #define to_fsl_spi_slave(s) container_of(s, struct fsl_spi_slave, slave) #define US_PER_SECOND 1000000UL
+/* default SCK frequency, unit: HZ */ +#define FSL_ESPI_DEFAULT_SCK_FREQ 10000000
#define ESPI_MAX_CS_NUM 4 #define ESPI_FIFO_WIDTH_BIT 32
@@ -62,116 +72,32 @@ struct fsl_spi_slave {
#define ESPI_MAX_DATA_TRANSFER_LEN 0xFFF0
-struct spi_slave *spi_setup_slave(unsigned int bus, unsigned int cs,
unsigned int max_hz, unsigned int mode)
-{
struct fsl_spi_slave *fsl;
sys_info_t sysinfo;
unsigned long spibrg = 0;
unsigned long spi_freq = 0;
unsigned char pm = 0;
if (!spi_cs_is_valid(bus, cs))
return NULL;
fsl = spi_alloc_slave(struct fsl_spi_slave, bus, cs);
if (!fsl)
return NULL;
fsl->espi = (void *)(CONFIG_SYS_MPC85xx_ESPI_ADDR);
fsl->mode = mode;
fsl->max_transfer_length = ESPI_MAX_DATA_TRANSFER_LEN;
/* Set eSPI BRG clock source */
get_sys_info(&sysinfo);
spibrg = sysinfo.freq_systembus / 2;
fsl->div16 = 0;
if ((spibrg / max_hz) > 32) {
fsl->div16 = ESPI_CSMODE_DIV16;
pm = spibrg / (max_hz * 16 * 2);
if (pm > 16) {
pm = 16;
debug("Requested speed is too low: %d
Hz, %ld
Hz "
"is used.\n", max_hz, spibrg / (32 *
16));
}
} else
pm = spibrg / (max_hz * 2);
if (pm)
pm--;
fsl->pm = pm;
if (fsl->div16)
spi_freq = spibrg / ((pm + 1) * 2 * 16);
else
spi_freq = spibrg / ((pm + 1) * 2);
/* set tx_timeout to 10 times of one espi FIFO entry go out */
fsl->tx_timeout = DIV_ROUND_UP((US_PER_SECOND *
ESPI_FIFO_WIDTH_BIT
* 10), spi_freq);
return &fsl->slave;
-}
-void spi_free_slave(struct spi_slave *slave) +void spi_cs_activate(struct spi_slave *slave) { struct fsl_spi_slave *fsl = to_fsl_spi_slave(slave);
free(fsl);
ccsr_espi_t *espi = fsl->espi;
unsigned int com = 0;
size_t data_len = fsl->data_len;
uint cs;
+#ifndef CONFIG_DM_SPI
cs = slave->cs;
+#else
cs = fsl->cs;
+#endif
Preserve cs in private struct and resuse it w/o this ifdef.
What does that mean? Private data, do you mean struct spi_slave? What does
w/o mean?
Add cs variable in struct and assign it in dm and non-dm codes.
Struct fsl_spi_slave structures already contain cs variables, and cs values have been obtained earlier, which can be directly applied later

Add espi controller node to support t2080.
Signed-off-by: Chuanhua Han chuanhua.han@nxp.com --- depends on: - https://patchwork.ozlabs.org/project/uboot/list/?series=99439
Changes in v4: - No change. Changes in v3: - Add a cover-letter for this patch set. Changes in v2: - No change.
arch/powerpc/dts/t2080.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/arch/powerpc/dts/t2080.dtsi b/arch/powerpc/dts/t2080.dtsi index d2bebb08b6..e3970d3590 100644 --- a/arch/powerpc/dts/t2080.dtsi +++ b/arch/powerpc/dts/t2080.dtsi @@ -69,6 +69,16 @@ voltage-ranges = <1800 1800 3300 3300>; };
+ espi0: spi@110000 { + #address-cells = <1>; + #size-cells = <0>; + compatible = "fsl,mpc8536-espi"; + reg = <0x110000 0x1000>; + interrupts = <53 0x2 0 0>; + fsl,espi-num-chipselects = <4>; + status = "disabled"; + }; + usb0: usb@210000 { compatible = "fsl-usb2-mph"; reg = <0x210000 0x1000>;

-----Original Message----- From: Chuanhua Han chuanhua.han@nxp.com Sent: Friday, June 21, 2019 7:52 AM To: wd@denx.de; Shengzhou Liu shengzhou.liu@nxp.com; Ruchika Gupta ruchika.gupta@nxp.com; jagan@openedev.com; sjg@chromium.org; Prabhakar Kushwaha prabhakar.kushwaha@nxp.com Cc: u-boot@lists.denx.de; Chuanhua Han chuanhua.han@nxp.com Subject: [PATCH v4 3/5] powerpc: dts: t2080: add espi controller node support
Add espi controller node to support t2080.
Signed-off-by: Chuanhua Han chuanhua.han@nxp.com
depends on: - https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatch work.ozlabs.org%2Fproject%2Fuboot%2Flist%2F%3Fseries%3D99439&d ata=02%7C01%7Cprabhakar.kushwaha%40nxp.com%7Cc3450ace13cf4318200 508d6f5ef0763%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C63696 6804303104798&sdata=D%2BWYX3LJDQ5DYUHgtCSVXGb3F9GblfDhGZw No8BEldI%3D&reserved=0
Changes in v4:
- No change.
Changes in v3:
- Add a cover-letter for this patch set.
Changes in v2:
- No change.
arch/powerpc/dts/t2080.dtsi | 10 ++++++++++ 1 file changed, 10 insertions(+)
Acked-by: Prabhakar Kushwaha prabhakar.kushwaha@nxp.com

Add espi slave nodes to support t2080qds.
Signed-off-by: Chuanhua Han chuanhua.han@nxp.com --- depends on: - https://patchwork.ozlabs.org/project/uboot/list/?series=99439
Changes in v4: - Modify the spi-max-frequency attribute value of the flash@x node of the device tree. Changes in v3: - Add a cover-letter for this patch set. Changes in v2: - No change.
arch/powerpc/dts/t2080qds.dts | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
diff --git a/arch/powerpc/dts/t2080qds.dts b/arch/powerpc/dts/t2080qds.dts index 1819a081dd..f9e786b239 100644 --- a/arch/powerpc/dts/t2080qds.dts +++ b/arch/powerpc/dts/t2080qds.dts @@ -14,4 +14,37 @@ #address-cells = <2>; #size-cells = <2>; interrupt-parent = <&mpic>; + + aliases { + spi0 = &espi0; + }; +}; + +&espi0 { + + status = "okay"; + flash@0 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "micron,n25q128a11", "jedec,spi-nor"; /* 16MB */ + reg = <0>; + spi-max-frequency = <10000000>; + }; + + flash@1 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "sst,sst25wf040", "jedec,spi-nor"; + reg = <1>; + spi-max-frequency = <10000000>; + }; + + flash@2 { + #address-cells = <1>; + #size-cells = <1>; + compatible = "eon,en25s64", "jedec,spi-nor"; + reg = <2>; + spi-max-frequency = <10000000>; + }; + };

-----Original Message----- From: Chuanhua Han chuanhua.han@nxp.com Sent: Friday, June 21, 2019 7:52 AM To: wd@denx.de; Shengzhou Liu shengzhou.liu@nxp.com; Ruchika Gupta ruchika.gupta@nxp.com; jagan@openedev.com; sjg@chromium.org; Prabhakar Kushwaha prabhakar.kushwaha@nxp.com Cc: u-boot@lists.denx.de; Chuanhua Han chuanhua.han@nxp.com Subject: [PATCH v4 4/5] powerpc: dts: t2080qds: add espi slave nodes support
Add espi slave nodes to support t2080qds.
Signed-off-by: Chuanhua Han chuanhua.han@nxp.com
depends on: - https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatch work.ozlabs.org%2Fproject%2Fuboot%2Flist%2F%3Fseries%3D99439&d ata=02%7C01%7Cprabhakar.kushwaha%40nxp.com%7C60e8147b84eb47e543 2608d6f5ef09ac%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C63696 6804334431322&sdata=l%2BXzp5DoxG0%2BPKbhOhgEeTmQvn%2FM1Z r0qNVVGyckBEc%3D&reserved=0
Changes in v4:
- Modify the spi-max-frequency attribute value of the flash@x node
of the device tree. Changes in v3:
- Add a cover-letter for this patch set.
Changes in v2:
- No change.
arch/powerpc/dts/t2080qds.dts | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+)
Acked-by: Prabhakar Kushwaha prabhakar.kushwaha@nxp.com

This patch is to enable espi DM for T2080QDS in uboot
Signed-off-by: Chuanhua Han chuanhua.han@nxp.com --- depends on: - https://patchwork.ozlabs.org/project/uboot/list/?series=99439
Changes in v4: - No change. Changes in v3: - Add a cover-letter for this patch set. Changes in v2: - No change.
configs/T2080QDS_NAND_defconfig | 2 ++ configs/T2080QDS_SDCARD_defconfig | 2 ++ configs/T2080QDS_SECURE_BOOT_defconfig | 2 ++ configs/T2080QDS_SPIFLASH_defconfig | 2 ++ configs/T2080QDS_SRIO_PCIE_BOOT_defconfig | 2 ++ configs/T2080QDS_defconfig | 2 ++ 6 files changed, 12 insertions(+)
diff --git a/configs/T2080QDS_NAND_defconfig b/configs/T2080QDS_NAND_defconfig index 72a6e8772b..1f8ae64294 100644 --- a/configs/T2080QDS_NAND_defconfig +++ b/configs/T2080QDS_NAND_defconfig @@ -66,3 +66,5 @@ CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_STORAGE=y +CONFIG_DM_SPI=y +CONFIG_DM_SPI_FLASH=y diff --git a/configs/T2080QDS_SDCARD_defconfig b/configs/T2080QDS_SDCARD_defconfig index 2e3a51aa0a..668a92b49c 100644 --- a/configs/T2080QDS_SDCARD_defconfig +++ b/configs/T2080QDS_SDCARD_defconfig @@ -65,3 +65,5 @@ CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_STORAGE=y +CONFIG_DM_SPI=y +CONFIG_DM_SPI_FLASH=y diff --git a/configs/T2080QDS_SECURE_BOOT_defconfig b/configs/T2080QDS_SECURE_BOOT_defconfig index 6cb36ebbb3..8e317d8e4e 100644 --- a/configs/T2080QDS_SECURE_BOOT_defconfig +++ b/configs/T2080QDS_SECURE_BOOT_defconfig @@ -58,3 +58,5 @@ CONFIG_USB_STORAGE=y CONFIG_RSA=y CONFIG_SPL_RSA=y CONFIG_RSA_SOFTWARE_EXP=y +CONFIG_DM_SPI=y +CONFIG_DM_SPI_FLASH=y diff --git a/configs/T2080QDS_SPIFLASH_defconfig b/configs/T2080QDS_SPIFLASH_defconfig index 9d17a99198..5da8c3a060 100644 --- a/configs/T2080QDS_SPIFLASH_defconfig +++ b/configs/T2080QDS_SPIFLASH_defconfig @@ -66,3 +66,5 @@ CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_STORAGE=y +CONFIG_DM_SPI=y +CONFIG_DM_SPI_FLASH=y diff --git a/configs/T2080QDS_SRIO_PCIE_BOOT_defconfig b/configs/T2080QDS_SRIO_PCIE_BOOT_defconfig index 560ae143a1..2fa6ccc8d1 100644 --- a/configs/T2080QDS_SRIO_PCIE_BOOT_defconfig +++ b/configs/T2080QDS_SRIO_PCIE_BOOT_defconfig @@ -48,3 +48,5 @@ CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_STORAGE=y +CONFIG_DM_SPI=y +CONFIG_DM_SPI_FLASH=y diff --git a/configs/T2080QDS_defconfig b/configs/T2080QDS_defconfig index 4d6314b1cf..8c5735aede 100644 --- a/configs/T2080QDS_defconfig +++ b/configs/T2080QDS_defconfig @@ -55,3 +55,5 @@ CONFIG_FSL_ESPI=y CONFIG_USB=y CONFIG_DM_USB=y CONFIG_USB_STORAGE=y +CONFIG_DM_SPI=y +CONFIG_DM_SPI_FLASH=y

Hi Jagan,
-----Original Message----- From: Chuanhua Han chuanhua.han@nxp.com Sent: Friday, June 21, 2019 7:52 AM To: wd@denx.de; Shengzhou Liu shengzhou.liu@nxp.com; Ruchika Gupta ruchika.gupta@nxp.com; jagan@openedev.com; sjg@chromium.org; Prabhakar Kushwaha prabhakar.kushwaha@nxp.com Cc: u-boot@lists.denx.de; Chuanhua Han chuanhua.han@nxp.com Subject: [PATCH v4 0/5] dm: spi: Convert Freescale ESPI driver to driver
In order to convert the Freescale ESPI driver to the driver model, there are 5 related patches in the current patch set:
0001-spl-dm-disable-SPI-DM-flash-for-non-DM-SPL.patch 0002-dm-spi-Convert-Freescale-ESPI-driver-to-driver-model.patch 0003-powerpc-dts-t2080-add-espi-controller-node-support.patch 0004-powerpc-dts-t2080qds-add-espi-slave-nodes-support.patch 0005-configs-enable-espi-device-module-in-T2080QDS.patch
The first patch is to solve the problem that spl can't work when spiboot, and this is required for SPI boot.
The other four patches are supported by the driver model. This patchset already supports the full dm mode, and fsl_espi driver support both OF_CONTROL and PLATDATA.
Chuanhua Han (5): spl: dm: disable SPI DM flash for non-DM SPL dm: spi: Convert Freescale ESPI driver to driver model powerpc: dts: t2080: add espi controller node support powerpc: dts: t2080qds: add espi slave nodes support configs: enable espi device module in T2080QDS
Is there slight possibility of accepting this patch-series for v2019.07-RC5.
Once this patch accepted, All pre-requirement of PowerPC DM migration will merge in v2019.07 u-boot. And we can target PowerPC DM migration for next u-boot release.
--pk

Dear Jagan,
-----Original Message----- From: Chuanhua Han chuanhua.han@nxp.com Sent: Friday, June 21, 2019 7:52 AM To: wd@denx.de; Shengzhou Liu shengzhou.liu@nxp.com; Ruchika Gupta ruchika.gupta@nxp.com; jagan@openedev.com; sjg@chromium.org; Prabhakar Kushwaha prabhakar.kushwaha@nxp.com Cc: u-boot@lists.denx.de; Chuanhua Han chuanhua.han@nxp.com Subject: [PATCH v4 0/5] dm: spi: Convert Freescale ESPI driver to driver
In order to convert the Freescale ESPI driver to the driver model, there are 5 related patches in the current patch set:
0001-spl-dm-disable-SPI-DM-flash-for-non-DM-SPL.patch 0002-dm-spi-Convert-Freescale-ESPI-driver-to-driver-model.patch 0003-powerpc-dts-t2080-add-espi-controller-node-support.patch 0004-powerpc-dts-t2080qds-add-espi-slave-nodes-support.patch 0005-configs-enable-espi-device-module-in-T2080QDS.patch
The first patch is to solve the problem that spl can't work when spiboot, and this is required for SPI boot.
The other four patches are supported by the driver model. This patchset already supports the full dm mode, and fsl_espi driver support both OF_CONTROL and PLATDATA.
Chuanhua Han (5): spl: dm: disable SPI DM flash for non-DM SPL dm: spi: Convert Freescale ESPI driver to driver model powerpc: dts: t2080: add espi controller node support powerpc: dts: t2080qds: add espi slave nodes support configs: enable espi device module in T2080QDS
If there is no review comments, can you please pick this series via your tree I am delegating this patch-set to you.
--pk
participants (4)
-
Chuanhua Han
-
Jagan Teki
-
Lukasz Majewski
-
Prabhakar Kushwaha