Re: [U-Boot] [EXT] Re: [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
> -Original Message- > From: Lukasz Majewski > Sent: 2019年8月15日 15:54 > To: Chuanhua Han > Cc: Jagan Teki ; Xiaowei Bao > ; U-Boot-Denx ; Pan Jiafei > ; Jagan Teki ; Ruchika > Gupta > 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 + > Chuanhua Han wrote: > > > > -Original Message- > > > From: Lukasz Majewski > > > Sent: 2019年8月15日 15:15 > > > To: Chuanhua Han > > > Cc: Jagan Teki ; Xiaowei Bao > > > ; U-Boot-Denx ; Pan > > > Jiafei ; Jagan Teki ; > > > Ruchika Gupta > > > 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 wrote: > > > > > > > > -Original Message- > > > > > From: Lukasz Majewski > > > > > Sent: 2019年8月14日 19:39 > > > > > To: Chuanhua Han > > > > > Cc: Jagan Teki ; Xiaowei Bao > > > > > ; U-Boot-Denx ; Pan > > > > > Jiafei ; Jagan Teki > > > > > ; Ruchika Gupta > > > > > 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 + Chuanhua Han > > > > > wrote: > > > > > > > > > > > > -Original Message- > > > > > > > From: Lukasz Majewski > > > > > > > Sent: 2019年8月14日 18:53 > > > > > > > To: Chuanhua Han > > > > > > > Cc: Jagan Teki ; Xiaowei Bao > > > > > > > ; U-Boot-Denx ; > > > > > > > Pan Jiafei ; Jagan Teki > > > > > > > ; Ruchika Gupta > > > > > > > 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 + Chuanhua Han > > > > > > > wrote: > > > > > > > > > > > > > > > > -----Original Message- > > > > > > > > > From: Lukasz Majewski > > > > > > > > > Sent: 2019年8月14日 16:57 > > > > > > > > > To: Chuanhua Han > > > > > > > > > Cc: Jagan Teki ; Xiaowei Bao > > > > > > > > > ; U-Boot-Denx > > > > > > > > > ; Pan Jiafei > > > > > > > > > ; Jagan Teki > > > > > > > > > ; Ruchika Gupta > > > > > > > > > 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 > > > > > > > > > > > Sent: 2019年8月14日 15:45 > > > > > > > > > > > To: Chuanhua Han > > > > > > > > > > > Cc: Wolfgang Denk ; Shengzhou Liu > > > > > > > > > > > ; Ruchika Gupta > > > > > > > > > > > ; Jagan Teki > > > > > > > > > > > ; Simon Glass > > > > > > > > > > > ; Prabhakar Kushwaha > > > > > > > > > > > ; U-Boot-Denx > > > > > > > > > > > ; Pan Jiafei > > > > > > > > > > > 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 > > > > > > > > > > > wrote: > > > > > > > > > > > > > > > > > > > > > > > > This patch solves the problem that spiboot c
Re: [U-Boot] [EXT] Re: [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
> -Original Message- > From: Lukasz Majewski > Sent: 2019年8月15日 15:15 > To: Chuanhua Han > Cc: Jagan Teki ; Xiaowei Bao > ; U-Boot-Denx ; Pan Jiafei > ; Jagan Teki ; Ruchika > Gupta > 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 + > Chuanhua Han wrote: > > > > -Original Message- > > > From: Lukasz Majewski > > > Sent: 2019年8月14日 19:39 > > > To: Chuanhua Han > > > Cc: Jagan Teki ; Xiaowei Bao > > > ; U-Boot-Denx ; Pan > > > Jiafei ; Jagan Teki ; > > > Ruchika Gupta > > > 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 wrote: > > > > > > > > -Original Message- > > > > > From: Lukasz Majewski > > > > > Sent: 2019年8月14日 18:53 > > > > > To: Chuanhua Han > > > > > Cc: Jagan Teki ; Xiaowei Bao > > > > > ; U-Boot-Denx ; Pan > > > > > Jiafei ; Jagan Teki > > > > > ; Ruchika Gupta > > > > > 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 + Chuanhua Han > > > > > wrote: > > > > > > > > > > > > -Original Message- > > > > > > > From: Lukasz Majewski > > > > > > > Sent: 2019年8月14日 16:57 > > > > > > > To: Chuanhua Han > > > > > > > Cc: Jagan Teki ; Xiaowei Bao > > > > > > > ; U-Boot-Denx ; > > > > > > > Pan Jiafei ; Jagan Teki > > > > > > > ; Ruchika Gupta > > > > > > > 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 > > > > > > > > > Sent: 2019年8月14日 15:45 > > > > > > > > > To: Chuanhua Han > > > > > > > > > Cc: Wolfgang Denk ; Shengzhou Liu > > > > > > > > > ; Ruchika Gupta > > > > > > > > > ; Jagan Teki > > > > > > > > > ; Simon Glass ; > > > > > > > > > Prabhakar Kushwaha ; > > > > > > > > > U-Boot-Denx ; Pan Jiafei > > > > > > > > > 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 > > > > > > > > > wrote: > > > > > > > > > > > > > > > > > > > > This patch solves the problem that spiboot cannot be > > > > > > > > > > performed in non-DM SPL. > > > > > > > > > > > > > > > > > > > > Signed-off-by: Pan Jiafei > > > > > > > > > > Signed-off-by: Chuanhua Han > > > > > > > > > > --- > > > > > > > > > > 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 --- >
Re: [U-Boot] [EXT] Re: [PATCH v4 2/5] dm: spi: Convert Freescale ESPI driver to driver model
> -Original Message- > From: Jagan Teki > Sent: 2019年8月15日 2:03 > To: Chuanhua Han > Cc: Wolfgang Denk ; Shengzhou Liu ; > Ruchika Gupta ; Jagan Teki ; > Simon Glass ; Prabhakar Kushwaha > ; U-Boot-Denx ; > Xiaowei Bao > 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 > wrote: > > > > > > > > > -Original Message----- > > > From: Jagan Teki > > > Sent: 2019年8月14日 15:38 > > > To: Chuanhua Han > > > Cc: Wolfgang Denk ; Shengzhou Liu > > > ; Ruchika Gupta ; > > > Jagan Teki ; Simon Glass ; > > > Prabhakar Kushwaha ; U-Boot-Denx > > > > > > 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 > > > 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 > > > > --- > > > > 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...@freescale.com) > > > > + *Chuanhua Han (chuanhua@nxp.com) > > > > */ > > > > > > > > #include > > > > - > > > > #include > > > > #include > > > > #include > > > > +#include > > > > +#include > > > > +#include > > > > +#include > > > > > > > > struct fsl_spi_slave { > > > > struct spi_slave slave; > > > > ccsr_espi_t *espi; > > > > + u32 speed_hz; > > > > + unsigned int cs; >
Re: [U-Boot] [EXT] Re: [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
> -Original Message- > From: Lukasz Majewski > Sent: 2019年8月14日 19:39 > To: Chuanhua Han > Cc: Jagan Teki ; Xiaowei Bao > ; U-Boot-Denx ; Pan Jiafei > ; Jagan Teki ; Ruchika > Gupta > 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 + > Chuanhua Han wrote: > > > > -Original Message- > > > From: Lukasz Majewski > > > Sent: 2019年8月14日 18:53 > > > To: Chuanhua Han > > > Cc: Jagan Teki ; Xiaowei Bao > > > ; U-Boot-Denx ; Pan > > > Jiafei ; Jagan Teki ; > > > Ruchika Gupta > > > 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 wrote: > > > > > > > > -Original Message- > > > > > From: Lukasz Majewski > > > > > Sent: 2019年8月14日 16:57 > > > > > To: Chuanhua Han > > > > > Cc: Jagan Teki ; Xiaowei Bao > > > > > ; U-Boot-Denx ; Pan > > > > > Jiafei ; Jagan Teki > > > > > ; Ruchika Gupta > > > > > 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 > > > > > > > Sent: 2019年8月14日 15:45 > > > > > > > To: Chuanhua Han > > > > > > > Cc: Wolfgang Denk ; Shengzhou Liu > > > > > > > ; Ruchika Gupta > > > > > > > ; Jagan Teki ; > > > > > > > Simon Glass ; Prabhakar Kushwaha > > > > > > > ; U-Boot-Denx > > > > > > > ; Pan Jiafei > > > > > > > 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 > > > > > > > wrote: > > > > > > > > > > > > > > > > This patch solves the problem that spiboot cannot be > > > > > > > > performed in non-DM SPL. > > > > > > > > > > > > > > > > Signed-off-by: Pan Jiafei > > > > > > > > Signed-off-by: Chuanhua Han > > > > > > > > --- > > > > > > > > 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_S
Re: [U-Boot] [EXT] Re: [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
> -Original Message- > From: Lukasz Majewski > Sent: 2019年8月14日 18:53 > To: Chuanhua Han > Cc: Jagan Teki ; Xiaowei Bao > ; U-Boot-Denx ; Pan Jiafei > ; Jagan Teki ; Ruchika > Gupta > 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 + > Chuanhua Han wrote: > > > > -Original Message- > > > From: Lukasz Majewski > > > Sent: 2019年8月14日 16:57 > > > To: Chuanhua Han > > > Cc: Jagan Teki ; Xiaowei Bao > > > ; U-Boot-Denx ; Pan > > > Jiafei ; Jagan Teki ; > > > Ruchika Gupta > > > 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 > > > > > Sent: 2019年8月14日 15:45 > > > > > To: Chuanhua Han > > > > > Cc: Wolfgang Denk ; Shengzhou Liu > > > > > ; Ruchika Gupta ; > > > > > Jagan Teki ; Simon Glass ; > > > > > Prabhakar Kushwaha ; U-Boot-Denx > > > > > ; Pan Jiafei > > > > > 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 > > > > > wrote: > > > > > > > > > > > > This patch solves the problem that spiboot cannot be performed > > > > > > in non-DM SPL. > > > > > > > > > > > > Signed-off-by: Pan Jiafei > > > > > > Signed-off-by: Chuanhua Han > > > > > > --- > > > > > > 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: > > > lu...@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: > lu...@denx.de ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [EXT] Re: [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
> -Original Message- > From: Lukasz Majewski > Sent: 2019年8月14日 16:57 > To: Chuanhua Han > Cc: Jagan Teki ; Xiaowei Bao > ; U-Boot-Denx ; Pan Jiafei > ; Jagan Teki ; Ruchika > Gupta > 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 > > > Sent: 2019年8月14日 15:45 > > > To: Chuanhua Han > > > Cc: Wolfgang Denk ; Shengzhou Liu > > > ; Ruchika Gupta ; > > > Jagan Teki ; Simon Glass ; > > > Prabhakar Kushwaha ; U-Boot-Denx > > > ; Pan Jiafei > > > 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 > > > wrote: > > > > > > > > This patch solves the problem that spiboot cannot be performed in > > > > non-DM SPL. > > > > > > > > Signed-off-by: Pan Jiafei > > > > Signed-off-by: Chuanhua Han > > > > --- > > > > 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: > lu...@denx.de ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [EXT] Re: [PATCH v4 2/5] dm: spi: Convert Freescale ESPI driver to driver model
> -Original Message- > From: Jagan Teki > Sent: 2019年8月14日 15:38 > To: Chuanhua Han > Cc: Wolfgang Denk ; Shengzhou Liu ; > Ruchika Gupta ; Jagan Teki ; > Simon Glass ; Prabhakar Kushwaha > ; U-Boot-Denx > 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 > 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 > > --- > > 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...@freescale.com) > > + *Chuanhua Han (chuanhua@nxp.com) > > */ > > > > #include > > - > > #include > > #include > > #include > > +#include > > +#include > > +#include > > +#include > > > > struct fsl_spi_slave { > > struct spi_slave slave; > > ccsr_espi_t *espi; > > + u32 speed_hz; > > + unsigned int cs; > > unsigned intdiv16; > > unsigned intpm; > > 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 100UL > > > > +/* default SCK frequency, unit: HZ */ > > +#define FSL_ESPI_DEFAULT_SCK_FREQ 1000 > > + > > #define ESPI_MAX_CS_NUM4 > > #define ESPI_FIFO_WIDTH_BIT32 > > > > @@ -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; >
Re: [U-Boot] [EXT] Re: [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
> -Original Message- > From: Lukasz Majewski > Sent: 2019年8月14日 16:57 > To: Chuanhua Han > Cc: Jagan Teki ; Xiaowei Bao > ; U-Boot-Denx ; Pan Jiafei > ; Jagan Teki ; Ruchika > Gupta > 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 > > > Sent: 2019年8月14日 15:45 > > > To: Chuanhua Han > > > Cc: Wolfgang Denk ; Shengzhou Liu > > > ; Ruchika Gupta ; > > > Jagan Teki ; Simon Glass ; > > > Prabhakar Kushwaha ; U-Boot-Denx > > > ; Pan Jiafei > > > 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 > > > wrote: > > > > > > > > This patch solves the problem that spiboot cannot be performed in > > > > non-DM SPL. > > > > > > > > Signed-off-by: Pan Jiafei > > > > Signed-off-by: Chuanhua Han > > > > --- > > > > 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: lu...@denx.de ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [EXT] Re: [PATCH v4 1/5] spl: dm: disable SPI DM flash for non-DM SPL
> -Original Message- > From: Jagan Teki > Sent: 2019年8月14日 15:45 > To: Chuanhua Han > Cc: Wolfgang Denk ; Shengzhou Liu ; > Ruchika Gupta ; Jagan Teki ; > Simon Glass ; Prabhakar Kushwaha > ; U-Boot-Denx ; Pan > Jiafei > 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 > wrote: > > > > This patch solves the problem that spiboot cannot be performed in > > non-DM SPL. > > > > Signed-off-by: Pan Jiafei > > Signed-off-by: Chuanhua Han > > --- > > 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 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2] armv8: fsl-layerscape: Correct I2C clock divider for some of the plarforms
By default, i2c input clock is platform clk / 2, but this is not correct for all the platforms, so correct I2C clock divider's default values for LS1012A, LS1028A, LX2160A and LS1088A. Signed-off-by: Chuanhua Han --- Changes in v2: - Modify subject and submit information. arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 4 1 file changed, 4 insertions(+) diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig index 3f6c983..034c0ac 100644 --- a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig +++ b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig @@ -513,6 +513,10 @@ config SYS_FSL_DUART_CLK_DIV config SYS_FSL_I2C_CLK_DIV int "I2C clock divider" default 1 if ARCH_LS1043A + default 4 if ARCH_LS1012A + default 4 if ARCH_LS1028A + default 8 if ARCH_LX2160A + default 8 if ARCH_LS1088A default 2 help This is the divider that is used to derive I2C clock from Platform -- 2.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [EXT] Re: [PATCH v3 2/5] dm: spi: Convert Freescale ESPI driver to driver model
Hi, Jagan Teki Please review and merge patch v4: https://patchwork.ozlabs.org/project/uboot/list/?series=115242 Thanks, Chuanhua > -Original Message- > From: Jagan Teki > Sent: 2019年6月12日 16:15 > To: Chuanhua Han > Cc: Jagan Teki ; Wolfgang Denk ; > Shengzhou Liu ; Ruchika Gupta > ; U-Boot-Denx ; Jiafei Pan > ; Yinbo Zhu > Subject: [EXT] Re: [U-Boot] [PATCH v3 2/5] dm: spi: Convert Freescale ESPI > driver > to driver model > > Caution: EXT Email > > On Fri, May 24, 2019 at 5:50 PM Chuanhua Han > 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 > > --- > > 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 | 454 > > + > > 1 file changed, 320 insertions(+), 134 deletions(-) > > > > diff --git a/drivers/spi/fsl_espi.c b/drivers/spi/fsl_espi.c index > > 7444ae1a06..a2f4027fca 100644 > > --- a/drivers/spi/fsl_espi.c > > +++ b/drivers/spi/fsl_espi.c > > @@ -4,17 +4,27 @@ > > * > > * Copyright 2010-2011 Freescale Semiconductor, Inc. > > * Author: Mingkai Hu (mingkai...@freescale.com) > > + *Chuanhua Han (chuanhua@nxp.com) > > */ > > > > #include > > - > > #include > > #include > > #include > > +#include > > +#include > > +#include > > + > > +struct fsl_espi_platdata { > > + uint flags; > > + uint speed_hz; > > + uint num_chipselect; > > + fdt_addr_t regs_addr; > > +}; > > Move this into include/dm/platform_data/ (refer > drivers/spi/davinci_spi.c) also use the same variable types as been used in > private struct. > > > > > -struct fsl_spi_slave { > > - struct spi_slave slave; > > +struct fsl_espi_priv { > > ccsr_espi_t *espi; > > + u32 speed_hz; > > unsigned intdiv16; > > unsigned intpm; > > int tx_timeout; > > @@ -25,9 +35,18 @@ struct fsl_spi_slave { > > unsigned intmax_transfer_length; > > }; > > > > +struct fsl_spi_slave { > > + struct spi_slave slave; > > + struct fsl_espi_priv priv; > > +}; > > Better hanlde it in one structure. > > > + > > #define to_fsl_spi_slave(s) container_of(s, struct fsl_spi_slave, > > slave) > > +#define to_fsl_spi_priv(p) container_of(p, struct fsl_spi_slave, > > +priv) > > #define US_PER_SECOND 100UL > > > > +/* default SCK frequency, unit: HZ */ > > +#define FSL_ESPI_DEFAULT_SCK_FREQ 1000 > > + > > #define ESPI_MAX_CS_NUM4 > > #define ESPI_FIFO_WIDTH_BIT32 > > > > @@ -62,121 +81,46 @@ 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_lengt
[U-Boot] [PATCH] kconfig: Fix some platforms incorrect I2C clock divider
By default, i2c input clock is platform clk / 2, but some of the platform of i2c clock divider does not meet this kind of circumstance, so alone to set default values for these platforms. Signed-off-by: Chuanhua Han --- arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 4 1 file changed, 4 insertions(+) diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig index 20f62c5..f011a62 100644 --- a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig +++ b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig @@ -503,6 +503,10 @@ config SYS_FSL_DUART_CLK_DIV config SYS_FSL_I2C_CLK_DIV int "I2C clock divider" default 1 if ARCH_LS1043A + default 4 if ARCH_LS1012A + default 4 if ARCH_LS1028A + default 8 if ARCH_LX2160A + default 8 if ARCH_LS1088A default 2 help This is the divider that is used to derive I2C clock from Platform -- 2.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] armv8: ls1088aqds: support DSPI mode by hwconfig
BRDCFG4[USBOSC] and BRDCFG5[SPR] register field of Qixis device is used to control SPI and other IP signal routing. USBOSC: 0= SPI_CLK used as external USB REFCLK input driven with 24.000 MHz. SPI devices are unusable in this mode. 1= SPI_CLK used as SPI clock. SPI devices are usable in this mode. USB block is clocked from internal sources SPR[3:2]: SPI_CS / SDHC_DAT4:7 Routing (schematic net CFG_SPI_ROUTE[3:2]): 00= SDHC/eMMC 8-bit 01= SD Card Rev 2.0/3.0 10= SPI on-board memory 11= TDM Riser / SPI off-board connector. The default value is 00 if an SDCard/eMMC card is selected as the boot device. SPR[1:0]: SPI_SIN/SOUT/SCK Routing (schematic net CFG_SPI_ROUTE[1:0]): 00= SDHC Sync loop 01= TDM Riser / SPI off-board connector. 10= SPI on-board memory. 11= SPI off-board connector. By default, the SPI feature is not available, so we need to configure the above register fields to select the route to the SPI feature. Signed-off-by: Chuanhua Han --- board/freescale/ls1088a/ls1088a.c | 26 ++ board/freescale/ls1088a/ls1088a_qixis.h | 11 +++ include/configs/ls1088aqds.h| 2 ++ 3 files changed, 39 insertions(+) diff --git a/board/freescale/ls1088a/ls1088a.c b/board/freescale/ls1088a/ls1088a.c index a7af77d..12cc363 100644 --- a/board/freescale/ls1088a/ls1088a.c +++ b/board/freescale/ls1088a/ls1088a.c @@ -590,6 +590,32 @@ int misc_init_r(void) QIXIS_WRITE(brdcfg[5], brdcfg5); } #endif + +#ifdef CONFIG_TARGET_LS1088AQDS +u8 brdcfg4, brdcfg5; + + if (hwconfig("dspi-on-board")) { + brdcfg4 = QIXIS_READ(brdcfg[4]); + brdcfg4 &= ~BRDCFG4_USBOSC_MASK; + brdcfg4 |= BRDCFG4_SPI; + QIXIS_WRITE(brdcfg[4], brdcfg4); + + brdcfg5 = QIXIS_READ(brdcfg[5]); + brdcfg5 &= ~BRDCFG5_SPR_MASK; + brdcfg5 |= BRDCFG5_SPI_ON_BOARD; + QIXIS_WRITE(brdcfg[5], brdcfg5); + } else if (hwconfig("dspi-off-board")) { + brdcfg4 = QIXIS_READ(brdcfg[4]); + brdcfg4 &= ~BRDCFG4_USBOSC_MASK; + brdcfg4 |= BRDCFG4_SPI; + QIXIS_WRITE(brdcfg[4], brdcfg4); + + brdcfg5 = QIXIS_READ(brdcfg[5]); + brdcfg5 &= ~BRDCFG5_SPR_MASK; + brdcfg5 |= BRDCFG5_SPI_OFF_BOARD; + QIXIS_WRITE(brdcfg[5], brdcfg5); + } +#endif return 0; } #endif diff --git a/board/freescale/ls1088a/ls1088a_qixis.h b/board/freescale/ls1088a/ls1088a_qixis.h index c588526..e3502eb 100644 --- a/board/freescale/ls1088a/ls1088a_qixis.h +++ b/board/freescale/ls1088a/ls1088a_qixis.h @@ -41,4 +41,15 @@ #define BRDCFG5_SPISDHC_MASK 0x0C #define BRDCFG5_FORCE_SD 0x08 +/* Definitions of QIXIS Registers for LS1088AQDS */ + +/* BRDCFG4 */ +#define BRDCFG4_USBOSC_MASK 0x01 +#define BRDCFG4_SPI 0x01 + +/* BRDCFG5 */ +#define BRDCFG5_SPR_MASK 0x0f +#define BRDCFG5_SPI_ON_BOARD 0x0a +#define BRDCFG5_SPI_OFF_BOARD 0x0f + #endif diff --git a/include/configs/ls1088aqds.h b/include/configs/ls1088aqds.h index 8b62bbe..85e2061 100644 --- a/include/configs/ls1088aqds.h +++ b/include/configs/ls1088aqds.h @@ -17,6 +17,8 @@ unsigned long get_board_ddr_clk(void); #ifdef CONFIG_TFABOOT #define CONFIG_SYS_MMC_ENV_DEV 0 +#define CONFIG_MISC_INIT_R + #define CONFIG_ENV_SIZE0x2 #define CONFIG_ENV_OFFSET 0x50 #define CONFIG_ENV_ADDR(CONFIG_SYS_FLASH_BASE + \ -- 2.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 2/3] armv8: ls1088aqds : Add pcf2127 node
This patch adds the pcf2127-rtc node under the i2c0->i2c-mux@77->i2c@3 for ls1088aqds boards. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=110856 - http://patchwork.ozlabs.org/project/uboot/list/?series=109459 - http://patchwork.ozlabs.org/project/uboot/list/?series=120936 Changes in v2: - Change the order of the config and device tree patch files. arch/arm/dts/fsl-ls1088a-qds.dts | 23 +++ 1 file changed, 23 insertions(+) diff --git a/arch/arm/dts/fsl-ls1088a-qds.dts b/arch/arm/dts/fsl-ls1088a-qds.dts index 8fbb52f..f07d0c6 100644 --- a/arch/arm/dts/fsl-ls1088a-qds.dts +++ b/arch/arm/dts/fsl-ls1088a-qds.dts @@ -18,6 +18,29 @@ }; }; +&i2c0 { + status = "okay"; + u-boot,dm-pre-reloc; + + i2c-mux@77 { + compatible = "nxp,pca9547"; + reg = <0x77>; + #address-cells = <1>; + #size-cells = <0>; + + i2c@3 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0x3>; + + rtc@51 { + compatible = "pcf2127-rtc"; + reg = <0x51>; + }; + }; + }; +}; + &ifc { #address-cells = <2>; #size-cells = <1>; -- 2.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 3/3] configs: ls1088aqds: Enable DM support for pcf2127 rtc
Enable related configs on all ls1088aqds boards to support pcf2127 rtc DM function. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=110856 - http://patchwork.ozlabs.org/project/uboot/list/?series=109459 - http://patchwork.ozlabs.org/project/uboot/list/?series=120936 Changes in v2: - Change the order of the config and device tree patch files. configs/ls1088aqds_tfa_defconfig | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/configs/ls1088aqds_tfa_defconfig b/configs/ls1088aqds_tfa_defconfig index ff820a5..ed9783e 100644 --- a/configs/ls1088aqds_tfa_defconfig +++ b/configs/ls1088aqds_tfa_defconfig @@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_TARGET_LS1088AQDS=y +CONFIG_SYS_MALLOC_F_LEN=0x6000 CONFIG_SYS_TEXT_BASE=0x8200 CONFIG_QSPI_AHB_INIT=y CONFIG_TFABOOT=y @@ -8,7 +9,6 @@ CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y CONFIG_SEC_FIRMWARE_ARMV8_PSCI=y CONFIG_AHCI=y CONFIG_DISTRO_DEFAULTS=y -# CONFIG_SYS_MALLOC_F is not set CONFIG_FIT_VERBOSE=y CONFIG_OF_BOARD_SETUP=y CONFIG_OF_STDOUT_VIA_ALIAS=y @@ -66,3 +66,11 @@ CONFIG_USB_XHCI_DWC3=y CONFIG_USB_DWC3=y CONFIG_USB_GADGET=y CONFIG_EFI_LOADER_BOUNCE_BUFFER=y +CONFIG_DM_I2C=y +CONFIG_I2C_SET_DEFAULT_BUS_NUM=y +CONFIG_I2C_DEFAULT_BUS_NUMBER=0 +CONFIG_DM_GPIO=y +CONFIG_DM_RTC=y +CONFIG_RTC_PCF2127=y +CONFIG_I2C_MUX=y +CONFIG_I2C_MUX_PCA954x=y -- 2.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 1/3] armv8: ls1088aqds: The ls1088aqds board supports the I2C driver model.
This patch is updating ls1088aqds board init code to support DM_I2C. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=110856 - http://patchwork.ozlabs.org/project/uboot/list/?series=109459 - http://patchwork.ozlabs.org/project/uboot/list/?series=120936 Changes in v2: - Simplify i2c_write related function calls and reduce the amount of code by using circular iteration - Place the variable definitions for udevice at the beginning of the function board/freescale/ls1088a/eth_ls1088aqds.c | 149 +-- include/configs/ls1088aqds.h | 4 +- 2 files changed, 104 insertions(+), 49 deletions(-) diff --git a/board/freescale/ls1088a/eth_ls1088aqds.c b/board/freescale/ls1088a/eth_ls1088aqds.c index f16b78c..6fb671f 100644 --- a/board/freescale/ls1088a/eth_ls1088aqds.c +++ b/board/freescale/ls1088a/eth_ls1088aqds.c @@ -80,11 +80,16 @@ struct ls1088a_qds_mdio { struct mii_dev *realbus; }; +struct reg_pair { + uint addr; + u8 *val; +}; + static void sgmii_configure_repeater(int dpmac) { struct mii_dev *bus; uint8_t a = 0xf; - int i, j, ret; + int i, j, k, ret; unsigned short value; const char *dev = "LS1088A_QDS_MDIO2"; int i2c_addr[] = {0x58, 0x59, 0x5a, 0x5b}; @@ -96,8 +101,28 @@ static void sgmii_configure_repeater(int dpmac) uint8_t ch_b_eq[] = {0x1, 0x2, 0x3, 0x7}; uint8_t ch_b_ctl2[] = {0x81, 0x82, 0x83, 0x84}; + u8 reg_val[6] = {0x18, 0x38, 0x4, 0x14, 0xb5, 0x20}; + struct reg_pair reg_pair[10] = { + {6, ®_val[0]}, {4, ®_val[1]}, + {8, ®_val[2]}, {0xf, NULL}, + {0x11, NULL}, {0x16, NULL}, + {0x18, NULL}, {0x23, ®_val[3]}, + {0x2d, ®_val[4]}, {4, ®_val[5]}, + }; +#ifdef CONFIG_DM_I2C + struct udevice *udev; +#endif + /* Set I2c to Slot 1 */ - i2c_write(0x77, 0, 0, &a, 1); +#ifndef CONFIG_DM_I2C + ret = i2c_write(0x77, 0, 0, &a, 1); +#else + ret = i2c_get_chip_for_busnum(0, 0x77, 1, &udev); + if (!ret) + ret = dm_i2c_write(udev, 0, &a, 1); +#endif + if (ret) + goto error; switch (dpmac) { case 1: @@ -143,31 +168,34 @@ static void sgmii_configure_repeater(int dpmac) return; } +#ifdef CONFIG_DM_I2C + i2c_get_chip_for_busnum(0, i2c_phy_addr, 1, &udev); +#endif + for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { - a = 0x18; - i2c_write(i2c_phy_addr, 6, 1, &a, 1); - a = 0x38; - i2c_write(i2c_phy_addr, 4, 1, &a, 1); - a = 0x4; - i2c_write(i2c_phy_addr, 8, 1, &a, 1); - - i2c_write(i2c_phy_addr, 0xf, 1, - &ch_a_eq[i], 1); - i2c_write(i2c_phy_addr, 0x11, 1, - &ch_a_ctl2[j], 1); - - i2c_write(i2c_phy_addr, 0x16, 1, - &ch_b_eq[i], 1); - i2c_write(i2c_phy_addr, 0x18, 1, - &ch_b_ctl2[j], 1); - - a = 0x14; - i2c_write(i2c_phy_addr, 0x23, 1, &a, 1); - a = 0xb5; - i2c_write(i2c_phy_addr, 0x2d, 1, &a, 1); - a = 0x20; - i2c_write(i2c_phy_addr, 4, 1, &a, 1); + reg_pair[3].val = &ch_a_eq[i]; + reg_pair[4].val = &ch_a_ctl2[j]; + reg_pair[5].val = &ch_b_eq[i]; + reg_pair[6].val = &ch_b_ctl2[j]; + for (k = 0; k < 10; k++) { +#ifndef CONFIG_DM_I2C + ret = i2c_write(i2c_phy_addr, + reg_pair[k].addr, + 1, reg_pair[k].val, 1); +#else + ret = i2c_get_chip_for_busnum(0, + i2c_phy_addr, + 1, &udev); + if (!ret) + ret = dm_i2c_write(udev, + reg_pair[k].addr, + reg_pair[k].val, 1); +#endif + if (ret) + goto error; + } + mdelay(100); ret = miiphy_read(dev, phy_addr, 0x11, &value); if (ret > 0) @@ -202,7 +230,7 @@ error: static v
[U-Boot] [PATCH v4 4/4] configs: ls2088aqds: Enable DM support for ds3231 rtc
Enable related configs on all ls2088aqds boards to support ds3231 rtc DM function. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=118772 - http://patchwork.ozlabs.org/project/uboot/list/?series=117226 Changes in v4: - No change. Changes in v3: - Change the order of the config and device tree patch files Changes in v2: - No change. configs/ls2088aqds_tfa_defconfig | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/configs/ls2088aqds_tfa_defconfig b/configs/ls2088aqds_tfa_defconfig index e798c59..caa3425 100644 --- a/configs/ls2088aqds_tfa_defconfig +++ b/configs/ls2088aqds_tfa_defconfig @@ -1,12 +1,12 @@ CONFIG_ARM=y CONFIG_TARGET_LS2080AQDS=y +CONFIG_SYS_MALLOC_F_LEN=0x6000 CONFIG_SYS_TEXT_BASE=0x8200 CONFIG_TFABOOT=y CONFIG_NR_DRAM_BANKS=3 CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y CONFIG_SEC_FIRMWARE_ARMV8_PSCI=y CONFIG_AHCI=y -# CONFIG_SYS_MALLOC_F is not set CONFIG_FIT_VERBOSE=y CONFIG_OF_BOARD_SETUP=y CONFIG_OF_STDOUT_VIA_ALIAS=y @@ -63,3 +63,10 @@ CONFIG_DM_USB=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_DWC3=y CONFIG_EFI_LOADER_BOUNCE_BUFFER=y +CONFIG_DM_I2C=y +CONFIG_I2C_SET_DEFAULT_BUS_NUM=y +CONFIG_I2C_DEFAULT_BUS_NUMBER=0 +CONFIG_DM_GPIO=y +CONFIG_I2C_MUX=y +CONFIG_I2C_MUX_PCA954x=y +CONFIG_DM_RTC=y -- 2.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v4 3/4] armv8: ls2088aqds : Add ds3232 node
This patch adds the ds3232-rtc node under the i2c0->i2c-mux@77->i2c@0 for ls2088aqds boards. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=118772 - http://patchwork.ozlabs.org/project/uboot/list/?series=117226 Changes in v4: - No change. Changes in v3: - Change the order of the config and device tree patch files Changes in v2: - No change. arch/arm/dts/fsl-ls2080a-qds.dts | 19 +++ 1 file changed, 19 insertions(+) diff --git a/arch/arm/dts/fsl-ls2080a-qds.dts b/arch/arm/dts/fsl-ls2080a-qds.dts index 2a0a528..13461b5 100644 --- a/arch/arm/dts/fsl-ls2080a-qds.dts +++ b/arch/arm/dts/fsl-ls2080a-qds.dts @@ -19,6 +19,25 @@ }; }; +&i2c0 { + status = "okay"; + pca9547@77 { + compatible = "nxp,pca9547"; + reg = <0x77>; + #address-cells = <1>; + #size-cells = <0>; + i2c@0 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0x00>; + rtc@68 { + compatible = "dallas,ds3232"; + reg = <0x68>; + }; + }; + }; +}; + &dspi { bus-num = <0>; status = "okay"; -- 2.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v4 2/4] armv8: ls2088aqds: The ls2088aqds board supports the I2C driver model.
This patch is updating ls2088aqds board init code to support DM_I2C. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=118772 - http://patchwork.ozlabs.org/project/uboot/list/?series=117226 Changes in v4: - Simplify i2c_write related function calls and reduce the amount of code by using circular iteration - Place the variable definitions for udevice at the beginning of the function Changes in v3: - Delete something about DS3231_BUS_NUM - Modify the interface and definition of rtc_enable_32khz_output function Changes in v2: - No change. board/freescale/ls2080aqds/eth.c| 151 ++-- board/freescale/ls2080aqds/ls2080aqds.c | 16 include/configs/ls2080aqds.h| 3 + 3 files changed, 123 insertions(+), 47 deletions(-) diff --git a/board/freescale/ls2080aqds/eth.c b/board/freescale/ls2080aqds/eth.c index f706fd4..baf031a 100644 --- a/board/freescale/ls2080aqds/eth.c +++ b/board/freescale/ls2080aqds/eth.c @@ -89,11 +89,16 @@ struct ls2080a_qds_mdio { struct mii_dev *realbus; }; +struct reg_pair { + uint addr; + u8 *val; +}; + static void sgmii_configure_repeater(int serdes_port) { struct mii_dev *bus; uint8_t a = 0xf; - int i, j, ret; + int i, j, k, ret; int dpmac_id = 0, dpmac, mii_bus = 0; unsigned short value; char dev[2][20] = {"LS2080A_QDS_MDIO0", "LS2080A_QDS_MDIO3"}; @@ -104,10 +109,30 @@ static void sgmii_configure_repeater(int serdes_port) uint8_t ch_b_eq[] = {0x1, 0x2, 0x3, 0x7}; uint8_t ch_b_ctl2[] = {0x81, 0x82, 0x83, 0x84}; + u8 reg_val[6] = {0x18, 0x38, 0x4, 0x14, 0xb5, 0x20}; + struct reg_pair reg_pair[10] = { + {6, ®_val[0]}, {4, ®_val[1]}, + {8, ®_val[2]}, {0xf, NULL}, + {0x11, NULL}, {0x16, NULL}, + {0x18, NULL}, {0x23, ®_val[3]}, + {0x2d, ®_val[4]}, {4, ®_val[5]}, + }; + int *riser_phy_addr = &xqsgii_riser_phy_addr[0]; +#ifdef CONFIG_DM_I2C + struct udevice *udev; +#endif /* Set I2c to Slot 1 */ - i2c_write(0x77, 0, 0, &a, 1); +#ifndef CONFIG_DM_I2C + ret = i2c_write(0x77, 0, 0, &a, 1); +#else + ret = i2c_get_chip_for_busnum(0, 0x77, 1, &udev); + if (!ret) + ret = dm_i2c_write(udev, 0, &a, 1); +#endif + if (ret) + goto error; for (dpmac = 0; dpmac < 8; dpmac++) { /* Check the PHY status */ @@ -120,7 +145,15 @@ static void sgmii_configure_repeater(int serdes_port) mii_bus = 1; dpmac_id = dpmac + 9; a = 0xb; - i2c_write(0x76, 0, 0, &a, 1); +#ifndef CONFIG_DM_I2C + ret = i2c_write(0x76, 0, 0, &a, 1); +#else + ret = i2c_get_chip_for_busnum(0, 0x76, 1, &udev); + if (!ret) + ret = dm_i2c_write(udev, 0, &a, 1); +#endif + if (ret) + goto error; break; } @@ -153,29 +186,29 @@ static void sgmii_configure_repeater(int serdes_port) for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { - a = 0x18; - i2c_write(i2c_addr[dpmac], 6, 1, &a, 1); - a = 0x38; - i2c_write(i2c_addr[dpmac], 4, 1, &a, 1); - a = 0x4; - i2c_write(i2c_addr[dpmac], 8, 1, &a, 1); - - i2c_write(i2c_addr[dpmac], 0xf, 1, - &ch_a_eq[i], 1); - i2c_write(i2c_addr[dpmac], 0x11, 1, - &ch_a_ctl2[j], 1); - - i2c_write(i2c_addr[dpmac], 0x16, 1, - &ch_b_eq[i], 1); - i2c_write(i2c_addr[dpmac], 0x18, 1, - &ch_b_ctl2[j], 1); - - a = 0x14; - i2c_write(i2c_addr[dpmac], 0x23, 1, &a, 1); - a = 0xb5; - i2c_write(i2c_addr[dpmac], 0x2d, 1, &a, 1); - a = 0x20; - i2c_write(i2c_addr[dpmac], 4, 1, &a, 1); + reg_pair[3].val = &ch_a_eq[i]; + reg_pair[4].val = &ch_a_ctl2[j]; + reg_pair[5].val = &ch_b_eq[i]; +
[U-Boot] [PATCH v4 1/4] rtc: ds3232/ds3231: Add support to generate 32KHz output for driver module
This patch add an implementation of the rtc_enable_32khz_output() that uses the driver model i2c APIs. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=118772 - http://patchwork.ozlabs.org/project/uboot/list/?series=117226 Changes in v4: - No change. Changes in v3: - Delete something about DS3231_BUS_NUM - Modify the interface and definition of rtc_enable_32khz_output function Changes in v2: - No change. drivers/rtc/Kconfig | 6 ++ drivers/rtc/ds3231.c | 17 + include/rtc.h| 6 ++ 3 files changed, 29 insertions(+) diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index fd0009b..cf15914 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -31,6 +31,12 @@ config TPL_DM_RTC drivers to perform the actual functions. See rtc.h for a description of the API. +config RTC_ENABLE_32KHZ_OUTPUT + bool "Enable RTC 32Khz output" + help + Some real-time clocks support the output of 32kHz square waves (such as ds3231), + the config symbol choose Real Time Clock device 32Khz output feature. + config RTC_PCF2127 bool "Enable PCF2127 driver" depends on DM_RTC diff --git a/drivers/rtc/ds3231.c b/drivers/rtc/ds3231.c index 79b026a..fde4d86 100644 --- a/drivers/rtc/ds3231.c +++ b/drivers/rtc/ds3231.c @@ -148,11 +148,13 @@ void rtc_reset (void) /* * Enable 32KHz output */ +#ifdef CONFIG_RTC_ENABLE_32KHZ_OUTPUT void rtc_enable_32khz_output(void) { rtc_write(RTC_STAT_REG_ADDR, RTC_STAT_BIT_BB32KHZ | RTC_STAT_BIT_EN32KHZ); } +#endif /* * Helper functions @@ -251,6 +253,21 @@ static int ds3231_probe(struct udevice *dev) return 0; } +#ifdef CONFIG_RTC_ENABLE_32KHZ_OUTPUT +int rtc_enable_32khz_output(int busnum, int chip_addr) +{ + int ret; + struct udevice *dev; + + ret = i2c_get_chip_for_busnum(busnum, chip_addr, 1, &dev); + if (!ret) + ret = dm_i2c_reg_write(dev, RTC_STAT_REG_ADDR, + RTC_STAT_BIT_BB32KHZ | + RTC_STAT_BIT_EN32KHZ); + return ret; +} +#endif + static const struct rtc_ops ds3231_rtc_ops = { .get = ds3231_rtc_get, .set = ds3231_rtc_set, diff --git a/include/rtc.h b/include/rtc.h index b255bdc..7386d52 100644 --- a/include/rtc.h +++ b/include/rtc.h @@ -166,11 +166,17 @@ int rtc_read32(struct udevice *dev, unsigned int reg, u32 *valuep); */ int rtc_write32(struct udevice *dev, unsigned int reg, u32 value); +#ifdef CONFIG_RTC_ENABLE_32KHZ_OUTPUT +int rtc_enable_32khz_output(int busnum, int chip_addr); +#endif + #else int rtc_get (struct rtc_time *); int rtc_set (struct rtc_time *); void rtc_reset (void); +#ifdef CONFIG_RTC_ENABLE_32KHZ_OUTPUT void rtc_enable_32khz_output(void); +#endif /** * rtc_read8() - Read an 8-bit register -- 2.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [EXT] Re: [PATCH v3 2/4] armv8: ls2088aqds: The ls2088aqds board supports the I2C driver model.
Hi, Wolfgang Denk > -Original Message- > From: Wolfgang Denk > Sent: 2019年7月26日 14:34 > To: Chuanhua Han > Cc: albert.u.b...@aribaud.net; Prabhakar Kushwaha > ; Rajesh Bhagat ; > Priyanka Jain ; u-boot@lists.denx.de; > lu...@denx.de; tr...@konsulko.com > Subject: [EXT] Re: [PATCH v3 2/4] armv8: ls2088aqds: The ls2088aqds board > supports the I2C driver model. > > Caution: EXT Email > > Dear Chuanhua Han, > > In message <20190726032729.14381-2-chuanhua@nxp.com> you wrote: > > > > /* Set I2c to Slot 1 */ > > - i2c_write(0x77, 0, 0, &a, 1); > > +#ifndef CONFIG_DM_I2C > > + ret = i2c_write(0x77, 0, 0, &a, 1); #else > > + ret = i2c_get_chip_for_busnum(0, 0x77, 1, &udev); > > + if (!ret) > > + ret = dm_i2c_write(udev, 0, &a, 1); #endif > > See my other comment. You should add error checking for the i2c_write(), > too. > > > + ret = i2c_write(i2c_addr[dpmac], 6, 1, &a, > 1); > > + if (ret) > > + goto error; > > a = 0x38; > > - i2c_write(i2c_addr[dpmac], 4, 1, &a, 1); > > + ret = i2c_write(i2c_addr[dpmac], 4, 1, &a, > 1); > > + if (ret) > > + goto error; > > a = 0x4; > > - i2c_write(i2c_addr[dpmac], 8, 1, &a, 1); > > + ret = i2c_write(i2c_addr[dpmac], 8, 1, &a, > 1); > > + if (ret) > > + goto error; > > > > - i2c_write(i2c_addr[dpmac], 0xf, 1, > > - &ch_a_eq[i], 1); > > - i2c_write(i2c_addr[dpmac], 0x11, 1, > > - &ch_a_ctl2[j], 1); > > + ret = i2c_write(i2c_addr[dpmac], 0xf, > > + 1, &ch_a_eq[i], 1); > > + if (ret) > > + goto error; > > + ret = i2c_write(i2c_addr[dpmac], 0x11, > > + 1, &ch_a_ctl2[j], 1); > > + if (ret) > > + goto error; > > > > - i2c_write(i2c_addr[dpmac], 0x16, 1, > > - &ch_b_eq[i], 1); > > - i2c_write(i2c_addr[dpmac], 0x18, 1, > > - &ch_b_ctl2[j], 1); > > + ret = i2c_write(i2c_addr[dpmac], 0x16, > > + 1, &ch_b_eq[i], 1); > > + if (ret) > > + goto error; > > + ret = i2c_write(i2c_addr[dpmac], 0x18, > > + 1, &ch_b_ctl2[j], 1); > > + if (ret) > > + goto error; > > > > a = 0x14; > > - i2c_write(i2c_addr[dpmac], 0x23, 1, &a, > 1); > > + ret = i2c_write(i2c_addr[dpmac], > > + 0x23, 1, &a, 1); > > + if (ret) > > + goto error; > > a = 0xb5; > > - i2c_write(i2c_addr[dpmac], 0x2d, 1, &a, > 1); > > + ret = i2c_write(i2c_addr[dpmac], > > + 0x2d, 1, &a, 1); > > + if (ret) > > + goto error; > > a = 0x20; > > - i2c_write(i2c_addr[dpmac], 4, 1, &a, 1); > > + ret = i2c_write(i2c_addr[dpmac], 4, 1, &a, > 1); > > + if (ret) > > + goto error; #else > > + ret = i2c_get_chip_for_busnum(0, > > + > i2c_addr[dpmac], > > + 1, > &udev); > > + if (!ret) { > &
Re: [U-Boot] [EXT] Re: [PATCH 1/3] armv8: ls1088aqds: The ls1088aqds board supports the I2C driver model.
> -Original Message- > From: Wolfgang Denk > Sent: 2019年7月26日 14:24 > To: Chuanhua Han > Cc: albert.u.b...@aribaud.net; Prabhakar Kushwaha > ; Ashish Kumar ; > Rajesh Bhagat ; u-boot@lists.denx.de > Subject: [EXT] Re: [U-Boot] [PATCH 1/3] armv8: ls1088aqds: The ls1088aqds > board supports the I2C driver model. > > Caution: EXT Email > > Dear Chuanhua Han, > > In message <20190725084400.4035-1-chuanhua@nxp.com> you wrote: > > This patch is updating ls1088aqds board init code to support DM_I2C. > > > > Signed-off-by: Chuanhua Han > > --- > > depends on: > > - > https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatchwor > k.ozlabs.org%2Fproject%2Fuboot%2Flist%2F%3Fseries%3D110856&data= > 02%7C01%7Cchuanhua.han%40nxp.com%7Cf736cff780674f915ca208d71191db > c7%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C636997190469571 > 724&sdata=LpVQJERj1Mc%2BEZpck8eYs69Lh43PBPqri%2FPl7%2BJsLks%3 > D&reserved=0 > > - > https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatchwor > k.ozlabs.org%2Fproject%2Fuboot%2Flist%2F%3Fseries%3D109459&data= > 02%7C01%7Cchuanhua.han%40nxp.com%7Cf736cff780674f915ca208d71191db > c7%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C636997190469571 > 724&sdata=50UYLFRdy8NjujZ0GARa%2BlY6Qxt%2BORc8xwMI%2Fvw3Ao > E%3D&reserved=0 > > - > > https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatch > > > work.ozlabs.org%2Fproject%2Fuboot%2Flist%2F%3Fseries%3D120936&da > ta > > > =02%7C01%7Cchuanhua.han%40nxp.com%7Cf736cff780674f915ca208d71191d > bc7%7 > > > C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C636997190469571724& > amp;sda > > ta=kdEbfqA0JJTeFf9bmnz7qj3E8T2ETAEXD3JmSkt0YF4%3D&reserved=0 > > Is this patch version 3? Or soemthign new? You should explan what you No,version 1 > changed... > > > board/freescale/ls1088a/eth_ls1088aqds.c | 74 > > > include/configs/ls1088aqds.h | 4 +- > > 2 files changed, 76 insertions(+), 2 deletions(-) > > > > diff --git a/board/freescale/ls1088a/eth_ls1088aqds.c > > b/board/freescale/ls1088a/eth_ls1088aqds.c > > index f16b78c..3b83d5b 100644 > > --- a/board/freescale/ls1088a/eth_ls1088aqds.c > > +++ b/board/freescale/ls1088a/eth_ls1088aqds.c > > @@ -97,7 +97,16 @@ static void sgmii_configure_repeater(int dpmac) > > uint8_t ch_b_ctl2[] = {0x81, 0x82, 0x83, 0x84}; > > > > /* Set I2c to Slot 1 */ > > +#ifndef CONFIG_DM_I2C > > i2c_write(0x77, 0, 0, &a, 1); > > +#else > > + struct udevice *udev; > > + > > + ret = i2c_get_chip_for_busnum(0, 0x77, 1, &udev); > > + if (!ret) > > + dm_i2c_write(udev, 0, &a, 1); #endif > > I asked you before to get rid of the declaration (struct udevice) in the > middle of > code (after the i2c_write()). > > I also explained that you shoudl check error codes. When you change this > here, > you could as well do it for i2c_write(), like this: OK,I will modify it > > #ifndef CONFIG_DM_I2C > ret = i2c_write(0x77, 0, 0, &a, 1); #else > ret = i2c_get_chip_for_busnum(0, 0x77, 1, &udev); #endif > if (!ret) > ... > > > + a = 0x18; > > + dm_i2c_write(udev, 6, &a, 1); > > + a = 0x38; > > + dm_i2c_write(udev, 4, &a, 1); > > + a = 0x4; > > + dm_i2c_write(udev, 8, &a, 1); > > + > > + dm_i2c_write(udev, 0xf, &ch_a_eq[i], 1); > > + dm_i2c_write(udev, 0x11, &ch_a_ctl2[j], 1); > > + > > + dm_i2c_write(udev, 0x16, &ch_b_eq[i], 1); > > + dm_i2c_write(udev, 0x18, &ch_b_ctl2[j], 1); > > + > > + a = 0x14; > > + dm_i2c_write(udev, 0x23, &a, 1); > > + a = 0xb5; > > + dm_i2c_write(udev, 0x2d, &a, 1); > > + a = 0x20; > > + dm_i2c_write(udev, 4, &a, 1); > > + > > Error checking missing. And you really want to change this into a loop > iterating > over a set of data instead of repeting the same code again and again. OK I will Check,Thanks! > > Best regards, > > Wolfgang Denk > > -- > DENX Software Engineering GmbH, Managing Director: Wolfgang Denk > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany > Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de > Contrary to popular belief, thinking does not cause brain damage. ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [EXT] Re: [PATCH v2 4/4] armv8: ls2088aqds : Add ds3232 node
> -Original Message- > From: Wolfgang Denk > Sent: 2019年7月26日 14:26 > To: Chuanhua Han > Cc: albert.u.b...@aribaud.net; Prabhakar Kushwaha > ; Priyanka Jain ; > Rajesh Bhagat ; u-boot@lists.denx.de; > lu...@denx.de; tr...@konsulko.com > Subject: Re: [EXT] Re: [PATCH v2 4/4] armv8: ls2088aqds : Add ds3232 node > > Caution: EXT Email > > Dear Chuanhua Han, > > In message > d04.prod.outlook.com> you wrote: > > > > > Is this bisectable? You first enable the feature in the code, and > > > only later add the needed property to the DT? Should it not be reversed? > > This should not matter because they are in the same patch set > > You completely miss the point what bisecting means!! > > Yes, of course it _does_ matter, as bisecting may apply only parts of your > patch > series, and omit the rest. If it selects the commit before the last, the > code will > break. > > Please fix this! The latest version has been revised > > > Best regards, > > Wolfgang Denk > > -- > DENX Software Engineering GmbH, Managing Director: Wolfgang Denk > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany > Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de If > there was anything that depressed him more than his own cynicism, it was > that quite often it still wasn't as cynical as real life. > - Terry Pratchett, _Guards! Guards!_ ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 2/4] armv8: ls2088aqds: The ls2088aqds board supports the I2C driver model.
This patch is updating ls2088aqds board init code to support DM_I2C. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=118772 - http://patchwork.ozlabs.org/project/uboot/list/?series=117226 Changes in v3: - Delete something about DS3231_BUS_NUM - Modify the interface and definition of rtc_enable_32khz_output function Changes in v2: - No change. board/freescale/ls2080aqds/eth.c| 236 board/freescale/ls2080aqds/ls2080aqds.c | 16 +++ include/configs/ls2080aqds.h| 3 + 3 files changed, 228 insertions(+), 27 deletions(-) diff --git a/board/freescale/ls2080aqds/eth.c b/board/freescale/ls2080aqds/eth.c index f706fd4..710f075 100644 --- a/board/freescale/ls2080aqds/eth.c +++ b/board/freescale/ls2080aqds/eth.c @@ -105,9 +105,20 @@ static void sgmii_configure_repeater(int serdes_port) uint8_t ch_b_ctl2[] = {0x81, 0x82, 0x83, 0x84}; int *riser_phy_addr = &xqsgii_riser_phy_addr[0]; +#ifdef CONFIG_DM_I2C + struct udevice *udev; +#endif /* Set I2c to Slot 1 */ - i2c_write(0x77, 0, 0, &a, 1); +#ifndef CONFIG_DM_I2C + ret = i2c_write(0x77, 0, 0, &a, 1); +#else + ret = i2c_get_chip_for_busnum(0, 0x77, 1, &udev); + if (!ret) + ret = dm_i2c_write(udev, 0, &a, 1); +#endif + if (ret) + goto error; for (dpmac = 0; dpmac < 8; dpmac++) { /* Check the PHY status */ @@ -120,7 +131,15 @@ static void sgmii_configure_repeater(int serdes_port) mii_bus = 1; dpmac_id = dpmac + 9; a = 0xb; - i2c_write(0x76, 0, 0, &a, 1); +#ifndef CONFIG_DM_I2C + ret = i2c_write(0x76, 0, 0, &a, 1); +#else + ret = i2c_get_chip_for_busnum(0, 0x76, 1, &udev); + if (!ret) + ret = dm_i2c_write(udev, 0, &a, 1); +#endif + if (ret) + goto error; break; } @@ -153,29 +172,102 @@ static void sgmii_configure_repeater(int serdes_port) for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { +#ifndef CONFIG_DM_I2C a = 0x18; - i2c_write(i2c_addr[dpmac], 6, 1, &a, 1); + ret = i2c_write(i2c_addr[dpmac], 6, 1, &a, 1); + if (ret) + goto error; a = 0x38; - i2c_write(i2c_addr[dpmac], 4, 1, &a, 1); + ret = i2c_write(i2c_addr[dpmac], 4, 1, &a, 1); + if (ret) + goto error; a = 0x4; - i2c_write(i2c_addr[dpmac], 8, 1, &a, 1); + ret = i2c_write(i2c_addr[dpmac], 8, 1, &a, 1); + if (ret) + goto error; - i2c_write(i2c_addr[dpmac], 0xf, 1, - &ch_a_eq[i], 1); - i2c_write(i2c_addr[dpmac], 0x11, 1, - &ch_a_ctl2[j], 1); + ret = i2c_write(i2c_addr[dpmac], 0xf, + 1, &ch_a_eq[i], 1); + if (ret) + goto error; + ret = i2c_write(i2c_addr[dpmac], 0x11, + 1, &ch_a_ctl2[j], 1); + if (ret) + goto error; - i2c_write(i2c_addr[dpmac], 0x16, 1, - &ch_b_eq[i], 1); - i2c_write(i2c_addr[dpmac], 0x18, 1, - &ch_b_ctl2[j], 1); + ret = i2c_write(i2c_addr[dpmac], 0x16, + 1, &ch_b_eq[i], 1); + if (ret) + goto error; + ret = i2c_write(i2c_addr[dpmac], 0x18, + 1, &ch_b_ctl2[j], 1); + if (ret) + goto error; a = 0x14; - i2c_write(i2c_addr[dpmac], 0x23, 1, &a, 1); + ret = i2c_write(i2c_addr[dpmac],
[U-Boot] [PATCH v3 3/4] armv8: ls2088aqds : Add ds3232 node
This patch adds the ds3232-rtc node under the i2c0->i2c-mux@77->i2c@0 for ls2088aqds boards. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=118772 - http://patchwork.ozlabs.org/project/uboot/list/?series=117226 Changes in v3: - Change the order of the config and device tree patch files Changes in v2: - No change. arch/arm/dts/fsl-ls2080a-qds.dts | 19 +++ 1 file changed, 19 insertions(+) diff --git a/arch/arm/dts/fsl-ls2080a-qds.dts b/arch/arm/dts/fsl-ls2080a-qds.dts index 2a0a528..13461b5 100644 --- a/arch/arm/dts/fsl-ls2080a-qds.dts +++ b/arch/arm/dts/fsl-ls2080a-qds.dts @@ -19,6 +19,25 @@ }; }; +&i2c0 { + status = "okay"; + pca9547@77 { + compatible = "nxp,pca9547"; + reg = <0x77>; + #address-cells = <1>; + #size-cells = <0>; + i2c@0 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0x00>; + rtc@68 { + compatible = "dallas,ds3232"; + reg = <0x68>; + }; + }; + }; +}; + &dspi { bus-num = <0>; status = "okay"; -- 2.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 4/4] configs: ls2088aqds: Enable DM support for ds3231 rtc
Enable related configs on all ls2088aqds boards to support ds3231 rtc DM function. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=118772 - http://patchwork.ozlabs.org/project/uboot/list/?series=117226 Changes in v3: - Change the order of the config and device tree patch files Changes in v2: - No change. configs/ls2088aqds_tfa_defconfig | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/configs/ls2088aqds_tfa_defconfig b/configs/ls2088aqds_tfa_defconfig index e798c59..caa3425 100644 --- a/configs/ls2088aqds_tfa_defconfig +++ b/configs/ls2088aqds_tfa_defconfig @@ -1,12 +1,12 @@ CONFIG_ARM=y CONFIG_TARGET_LS2080AQDS=y +CONFIG_SYS_MALLOC_F_LEN=0x6000 CONFIG_SYS_TEXT_BASE=0x8200 CONFIG_TFABOOT=y CONFIG_NR_DRAM_BANKS=3 CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y CONFIG_SEC_FIRMWARE_ARMV8_PSCI=y CONFIG_AHCI=y -# CONFIG_SYS_MALLOC_F is not set CONFIG_FIT_VERBOSE=y CONFIG_OF_BOARD_SETUP=y CONFIG_OF_STDOUT_VIA_ALIAS=y @@ -63,3 +63,10 @@ CONFIG_DM_USB=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_DWC3=y CONFIG_EFI_LOADER_BOUNCE_BUFFER=y +CONFIG_DM_I2C=y +CONFIG_I2C_SET_DEFAULT_BUS_NUM=y +CONFIG_I2C_DEFAULT_BUS_NUMBER=0 +CONFIG_DM_GPIO=y +CONFIG_I2C_MUX=y +CONFIG_I2C_MUX_PCA954x=y +CONFIG_DM_RTC=y -- 2.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 1/4] rtc: ds3232/ds3231: Add support to generate 32KHz output for driver module
This patch add an implementation of the rtc_enable_32khz_output() that uses the driver model i2c APIs. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=118772 - http://patchwork.ozlabs.org/project/uboot/list/?series=117226 Changes in v3: - Delete something about DS3231_BUS_NUM - Modify the interface and definition of rtc_enable_32khz_output function Changes in v2: - No change. drivers/rtc/Kconfig | 6 ++ drivers/rtc/ds3231.c | 17 + include/rtc.h| 6 ++ 3 files changed, 29 insertions(+) diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index fd0009b..cf15914 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -31,6 +31,12 @@ config TPL_DM_RTC drivers to perform the actual functions. See rtc.h for a description of the API. +config RTC_ENABLE_32KHZ_OUTPUT + bool "Enable RTC 32Khz output" + help + Some real-time clocks support the output of 32kHz square waves (such as ds3231), + the config symbol choose Real Time Clock device 32Khz output feature. + config RTC_PCF2127 bool "Enable PCF2127 driver" depends on DM_RTC diff --git a/drivers/rtc/ds3231.c b/drivers/rtc/ds3231.c index 79b026a..fde4d86 100644 --- a/drivers/rtc/ds3231.c +++ b/drivers/rtc/ds3231.c @@ -148,11 +148,13 @@ void rtc_reset (void) /* * Enable 32KHz output */ +#ifdef CONFIG_RTC_ENABLE_32KHZ_OUTPUT void rtc_enable_32khz_output(void) { rtc_write(RTC_STAT_REG_ADDR, RTC_STAT_BIT_BB32KHZ | RTC_STAT_BIT_EN32KHZ); } +#endif /* * Helper functions @@ -251,6 +253,21 @@ static int ds3231_probe(struct udevice *dev) return 0; } +#ifdef CONFIG_RTC_ENABLE_32KHZ_OUTPUT +int rtc_enable_32khz_output(int busnum, int chip_addr) +{ + int ret; + struct udevice *dev; + + ret = i2c_get_chip_for_busnum(busnum, chip_addr, 1, &dev); + if (!ret) + ret = dm_i2c_reg_write(dev, RTC_STAT_REG_ADDR, + RTC_STAT_BIT_BB32KHZ | + RTC_STAT_BIT_EN32KHZ); + return ret; +} +#endif + static const struct rtc_ops ds3231_rtc_ops = { .get = ds3231_rtc_get, .set = ds3231_rtc_set, diff --git a/include/rtc.h b/include/rtc.h index b255bdc..7386d52 100644 --- a/include/rtc.h +++ b/include/rtc.h @@ -166,11 +166,17 @@ int rtc_read32(struct udevice *dev, unsigned int reg, u32 *valuep); */ int rtc_write32(struct udevice *dev, unsigned int reg, u32 value); +#ifdef CONFIG_RTC_ENABLE_32KHZ_OUTPUT +int rtc_enable_32khz_output(int busnum, int chip_addr); +#endif + #else int rtc_get (struct rtc_time *); int rtc_set (struct rtc_time *); void rtc_reset (void); +#ifdef CONFIG_RTC_ENABLE_32KHZ_OUTPUT void rtc_enable_32khz_output(void); +#endif /** * rtc_read8() - Read an 8-bit register -- 2.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [EXT] Re: [PATCH v2 2/4] armv8: ls2088aqds: The ls2088aqds board supports the I2C driver model.
> -Original Message- > From: Wolfgang Denk > Sent: 2019年7月25日 15:40 > To: Chuanhua Han > Cc: albert.u.b...@aribaud.net; Prabhakar Kushwaha > ; Priyanka Jain ; > Rajesh Bhagat ; u-boot@lists.denx.de; > lu...@denx.de; tr...@konsulko.com > Subject: [EXT] Re: [PATCH v2 2/4] armv8: ls2088aqds: The ls2088aqds board > supports the I2C driver model. > > Caution: EXT Email > > Dear Chuanhua Han, > > In message <20190725043934.30236-2-chuanhua@nxp.com> you wrote: > > This patch is updating ls2088aqds board init code to support DM_I2C. > > > a = 0x18; > > - i2c_write(i2c_addr[dpmac], 6, 1, &a, 1); > > + ret = i2c_write(i2c_addr[dpmac], 6, 1, > &a, 1); > > + if (ret) > > + goto error; > > a = 0x38; > > - i2c_write(i2c_addr[dpmac], 4, 1, &a, 1); > > + ret = i2c_write(i2c_addr[dpmac], 4, 1, > &a, 1); > > + if (ret) > > + goto error; > > a = 0x4; > > - i2c_write(i2c_addr[dpmac], 8, 1, &a, 1); > > + ret = i2c_write(i2c_addr[dpmac], 8, 1, > &a, 1); > > + if (ret) > > + goto error; > > > > - i2c_write(i2c_addr[dpmac], 0xf, 1, > > - &ch_a_eq[i], 1); > > - i2c_write(i2c_addr[dpmac], 0x11, 1, > > - &ch_a_ctl2[j], 1); > > + ret = i2c_write(i2c_addr[dpmac], 0xf, > > + 1, &ch_a_eq[i], 1); > > + if (ret) > > + goto error; > > + ret = i2c_write(i2c_addr[dpmac], 0x11, > > + 1, &ch_a_ctl2[j], 1); > > + if (ret) > > + goto error; > > > > - i2c_write(i2c_addr[dpmac], 0x16, 1, > > - &ch_b_eq[i], 1); > > - i2c_write(i2c_addr[dpmac], 0x18, 1, > > - &ch_b_ctl2[j], 1); > > + ret = i2c_write(i2c_addr[dpmac], 0x16, > > + 1, &ch_b_eq[i], 1); > > + if (ret) > > + goto error; > > + ret = i2c_write(i2c_addr[dpmac], 0x18, > > + 1, &ch_b_ctl2[j], 1); > > + if (ret) > > + goto error; > > > > a = 0x14; > > - i2c_write(i2c_addr[dpmac], 0x23, 1, &a, > 1); > > + ret = i2c_write(i2c_addr[dpmac], > > + 0x23, 1, &a, 1); > > + if (ret) > > + goto error; > > a = 0xb5; > > - i2c_write(i2c_addr[dpmac], 0x2d, 1, &a, > 1); > > + ret = i2c_write(i2c_addr[dpmac], > > + 0x2d, 1, &a, 1); > > + if (ret) > > + goto error; > > a = 0x20; > > - i2c_write(i2c_addr[dpmac], 4, 1, &a, 1); > > + ret = i2c_write(i2c_addr[dpmac], 4, 1, > &a, 1); > > + if (ret) > > + goto error; #else > > + ret = i2c_get_chip_for_busnum(0, > > + > i2c_addr[dpmac], > > + 1, > &udev); > > + if (!ret) { > > + a = 0x18; > > + ret = dm_i2c_write(udev, 6, > &a, 1); > > + if (ret) > > +
Re: [U-Boot] [EXT] Re: [PATCH v2 1/4] rtc: ds3232/ds3231: Add support to generate 32KHz output for driver module
> -Original Message- > From: Wolfgang Denk > Sent: 2019年7月25日 15:34 > To: Chuanhua Han > Cc: albert.u.b...@aribaud.net; Prabhakar Kushwaha > ; Priyanka Jain ; > Rajesh Bhagat ; u-boot@lists.denx.de; > lu...@denx.de; tr...@konsulko.com > Subject: [EXT] Re: [PATCH v2 1/4] rtc: ds3232/ds3231: Add support to generate > 32KHz output for driver module > > Caution: EXT Email > > Dear Chuanhua Han, > > In message <20190725043934.30236-1-chuanhua@nxp.com> you wrote: > > This patch add an implementation of the rtc_enable_32khz_output() that > > uses the driver model i2c APIs. > ... > > +config DS3231_BUS_NUM > > + hex "I2C bus of the DS3231 device" > > + default 0 > > + > > I know this is likely just an academic question - buit what happens if we have > two such devices on different busses? Ah, that really needs to be considered! Then the method I came up with is: take the rtc_enable_32khz_output function with the udeice parameter to uniquely determine the specific RTC device, and then set the register. I wonder if this method is feasible? > > Best regards, > > Wolfgang Denk > > -- > DENX Software Engineering GmbH, Managing Director: Wolfgang Denk > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany > Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de > "Beware of bugs in the above code; I have only proved it correct, not > tried it." - Donald Knuth ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [EXT] Re: [PATCH v2 4/4] armv8: ls2088aqds : Add ds3232 node
> -Original Message- > From: Wolfgang Denk > Sent: 2019年7月25日 15:41 > To: Chuanhua Han > Cc: albert.u.b...@aribaud.net; Prabhakar Kushwaha > ; Priyanka Jain ; > Rajesh Bhagat ; u-boot@lists.denx.de; > lu...@denx.de; tr...@konsulko.com > Subject: [EXT] Re: [PATCH v2 4/4] armv8: ls2088aqds : Add ds3232 node > > Caution: EXT Email > > Dear Chuanhua Han, > > In message <20190725043934.30236-4-chuanhua@nxp.com> you wrote: > > This patch adds the ds3232-rtc node under the i2c0->i2c-mux@77->i2c@0 > > for ls2088aqds boards. > > Is this bisectable? You first enable the feature in the code, and only later > add > the needed property to the DT? Should it not be reversed? This should not matter because they are in the same patch set > > > Best regards, > > Wolfgang Denk > > -- > DENX Software Engineering GmbH, Managing Director: Wolfgang Denk > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany > Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de > Why don't you have a Linux partition installed so you can be working in a > programmer-friendly environment instead of a keep-gates'-bank- > account-happy one? :-)-- Tom Christiansen ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 1/3] armv8: ls1088aqds: The ls1088aqds board supports the I2C driver model.
This patch is updating ls1088aqds board init code to support DM_I2C. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=110856 - http://patchwork.ozlabs.org/project/uboot/list/?series=109459 - http://patchwork.ozlabs.org/project/uboot/list/?series=120936 board/freescale/ls1088a/eth_ls1088aqds.c | 74 include/configs/ls1088aqds.h | 4 +- 2 files changed, 76 insertions(+), 2 deletions(-) diff --git a/board/freescale/ls1088a/eth_ls1088aqds.c b/board/freescale/ls1088a/eth_ls1088aqds.c index f16b78c..3b83d5b 100644 --- a/board/freescale/ls1088a/eth_ls1088aqds.c +++ b/board/freescale/ls1088a/eth_ls1088aqds.c @@ -97,7 +97,16 @@ static void sgmii_configure_repeater(int dpmac) uint8_t ch_b_ctl2[] = {0x81, 0x82, 0x83, 0x84}; /* Set I2c to Slot 1 */ +#ifndef CONFIG_DM_I2C i2c_write(0x77, 0, 0, &a, 1); +#else + struct udevice *udev; + + ret = i2c_get_chip_for_busnum(0, 0x77, 1, &udev); + if (!ret) + dm_i2c_write(udev, 0, &a, 1); +#endif + switch (dpmac) { case 1: @@ -143,8 +152,13 @@ static void sgmii_configure_repeater(int dpmac) return; } +#ifdef CONFIG_DM_I2C + i2c_get_chip_for_busnum(0, i2c_phy_addr, 1, &udev); +#endif + for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { +#ifndef CONFIG_DM_I2C a = 0x18; i2c_write(i2c_phy_addr, 6, 1, &a, 1); a = 0x38; @@ -168,6 +182,28 @@ static void sgmii_configure_repeater(int dpmac) i2c_write(i2c_phy_addr, 0x2d, 1, &a, 1); a = 0x20; i2c_write(i2c_phy_addr, 4, 1, &a, 1); +#else + a = 0x18; + dm_i2c_write(udev, 6, &a, 1); + a = 0x38; + dm_i2c_write(udev, 4, &a, 1); + a = 0x4; + dm_i2c_write(udev, 8, &a, 1); + + dm_i2c_write(udev, 0xf, &ch_a_eq[i], 1); + dm_i2c_write(udev, 0x11, &ch_a_ctl2[j], 1); + + dm_i2c_write(udev, 0x16, &ch_b_eq[i], 1); + dm_i2c_write(udev, 0x18, &ch_b_ctl2[j], 1); + + a = 0x14; + dm_i2c_write(udev, 0x23, &a, 1); + a = 0xb5; + dm_i2c_write(udev, 0x2d, &a, 1); + a = 0x20; + dm_i2c_write(udev, 4, &a, 1); + +#endif mdelay(100); ret = miiphy_read(dev, phy_addr, 0x11, &value); if (ret > 0) @@ -217,7 +253,16 @@ static void qsgmii_configure_repeater(int dpmac) unsigned short value; /* Set I2c to Slot 1 */ +#ifndef CONFIG_DM_I2C i2c_write(0x77, 0, 0, &a, 1); +#else + struct udevice *udev; + + ret = i2c_get_chip_for_busnum(0, 0x77, 1, &udev); + if (!ret) + dm_i2c_write(udev, 0, &a, 1); +#endif + switch (dpmac) { case 7: @@ -251,8 +296,13 @@ static void qsgmii_configure_repeater(int dpmac) return; } +#ifdef CONFIG_DM_I2C + i2c_get_chip_for_busnum(0, i2c_phy_addr, 1, &udev); +#endif + for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { +#ifndef CONFIG_DM_I2C a = 0x18; i2c_write(i2c_phy_addr, 6, 1, &a, 1); a = 0x38; @@ -273,6 +323,30 @@ static void qsgmii_configure_repeater(int dpmac) a = 0x20; i2c_write(i2c_phy_addr, 4, 1, &a, 1); mdelay(100); +#else + a = 0x18; + dm_i2c_write(udev, 6, &a, 1); + a = 0x38; + dm_i2c_write(udev, 4, &a, 1); + a = 0x4; + dm_i2c_write(udev, 8, &a, 1); + + dm_i2c_write(udev, 0xf, &ch_a_eq[i], 1); + dm_i2c_write(udev, 0x11, &ch_a_ctl2[j], 1); + + dm_i2c_write(udev, 0x16, &ch_b_eq[i], 1); + dm_i2c_write(udev, 0x18, &ch_b_ctl2[j], 1); + + a = 0x14; + dm_i2c_write(udev, 0x23, &a, 1); + a = 0xb5; + dm_i2c_write(udev, 0x2d, &a, 1); + a = 0x20; + dm_i2c_write(udev, 4, &a, 1); + mdelay(100); + +#endif + ret = miiphy_read(dev, phy_addr, 0x11, &value); if (ret > 0) goto
[U-Boot] [PATCH 3/3] armv8: ls1088aqds : Add pcf2127 node
This patch adds the pcf2127-rtc node under the i2c0->i2c-mux@77->i2c@3 for ls1088aqds boards. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=110856 - http://patchwork.ozlabs.org/project/uboot/list/?series=109459 - http://patchwork.ozlabs.org/project/uboot/list/?series=120936 arch/arm/dts/fsl-ls1088a-qds.dts | 23 +++ 1 file changed, 23 insertions(+) diff --git a/arch/arm/dts/fsl-ls1088a-qds.dts b/arch/arm/dts/fsl-ls1088a-qds.dts index 8fbb52f..f07d0c6 100644 --- a/arch/arm/dts/fsl-ls1088a-qds.dts +++ b/arch/arm/dts/fsl-ls1088a-qds.dts @@ -18,6 +18,29 @@ }; }; +&i2c0 { + status = "okay"; + u-boot,dm-pre-reloc; + + i2c-mux@77 { + compatible = "nxp,pca9547"; + reg = <0x77>; + #address-cells = <1>; + #size-cells = <0>; + + i2c@3 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0x3>; + + rtc@51 { + compatible = "pcf2127-rtc"; + reg = <0x51>; + }; + }; + }; +}; + &ifc { #address-cells = <2>; #size-cells = <1>; -- 2.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 2/3] configs: ls1088aqds: Enable DM support for pcf2127 rtc
Enable related configs on all ls1088aqds boards to support pcf2127 rtc DM function. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=110856 - http://patchwork.ozlabs.org/project/uboot/list/?series=109459 - http://patchwork.ozlabs.org/project/uboot/list/?series=120936 configs/ls1088aqds_tfa_defconfig | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/configs/ls1088aqds_tfa_defconfig b/configs/ls1088aqds_tfa_defconfig index ff820a5..ed9783e 100644 --- a/configs/ls1088aqds_tfa_defconfig +++ b/configs/ls1088aqds_tfa_defconfig @@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_TARGET_LS1088AQDS=y +CONFIG_SYS_MALLOC_F_LEN=0x6000 CONFIG_SYS_TEXT_BASE=0x8200 CONFIG_QSPI_AHB_INIT=y CONFIG_TFABOOT=y @@ -8,7 +9,6 @@ CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y CONFIG_SEC_FIRMWARE_ARMV8_PSCI=y CONFIG_AHCI=y CONFIG_DISTRO_DEFAULTS=y -# CONFIG_SYS_MALLOC_F is not set CONFIG_FIT_VERBOSE=y CONFIG_OF_BOARD_SETUP=y CONFIG_OF_STDOUT_VIA_ALIAS=y @@ -66,3 +66,11 @@ CONFIG_USB_XHCI_DWC3=y CONFIG_USB_DWC3=y CONFIG_USB_GADGET=y CONFIG_EFI_LOADER_BOUNCE_BUFFER=y +CONFIG_DM_I2C=y +CONFIG_I2C_SET_DEFAULT_BUS_NUM=y +CONFIG_I2C_DEFAULT_BUS_NUMBER=0 +CONFIG_DM_GPIO=y +CONFIG_DM_RTC=y +CONFIG_RTC_PCF2127=y +CONFIG_I2C_MUX=y +CONFIG_I2C_MUX_PCA954x=y -- 2.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 4/4] armv8: ls2088aqds : Add ds3232 node
This patch adds the ds3232-rtc node under the i2c0->i2c-mux@77->i2c@0 for ls2088aqds boards. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=118772 - http://patchwork.ozlabs.org/project/uboot/list/?series=117226 Changes in v2: - No change. arch/arm/dts/fsl-ls2080a-qds.dts | 19 +++ 1 file changed, 19 insertions(+) diff --git a/arch/arm/dts/fsl-ls2080a-qds.dts b/arch/arm/dts/fsl-ls2080a-qds.dts index 2a0a528..13461b5 100644 --- a/arch/arm/dts/fsl-ls2080a-qds.dts +++ b/arch/arm/dts/fsl-ls2080a-qds.dts @@ -19,6 +19,25 @@ }; }; +&i2c0 { + status = "okay"; + pca9547@77 { + compatible = "nxp,pca9547"; + reg = <0x77>; + #address-cells = <1>; + #size-cells = <0>; + i2c@0 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0x00>; + rtc@68 { + compatible = "dallas,ds3232"; + reg = <0x68>; + }; + }; + }; +}; + &dspi { bus-num = <0>; status = "okay"; -- 2.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 2/4] armv8: ls2088aqds: The ls2088aqds board supports the I2C driver model.
This patch is updating ls2088aqds board init code to support DM_I2C. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=118772 - http://patchwork.ozlabs.org/project/uboot/list/?series=117226 Changes in v2: - Move the variable declaration in the middle of the code to the beginning of the function. - Check the return value for the API of the i2c function call. board/freescale/ls2080aqds/eth.c| 236 board/freescale/ls2080aqds/ls2080aqds.c | 8 ++ include/configs/ls2080aqds.h| 3 + 3 files changed, 220 insertions(+), 27 deletions(-) diff --git a/board/freescale/ls2080aqds/eth.c b/board/freescale/ls2080aqds/eth.c index f706fd4..710f075 100644 --- a/board/freescale/ls2080aqds/eth.c +++ b/board/freescale/ls2080aqds/eth.c @@ -105,9 +105,20 @@ static void sgmii_configure_repeater(int serdes_port) uint8_t ch_b_ctl2[] = {0x81, 0x82, 0x83, 0x84}; int *riser_phy_addr = &xqsgii_riser_phy_addr[0]; +#ifdef CONFIG_DM_I2C + struct udevice *udev; +#endif /* Set I2c to Slot 1 */ - i2c_write(0x77, 0, 0, &a, 1); +#ifndef CONFIG_DM_I2C + ret = i2c_write(0x77, 0, 0, &a, 1); +#else + ret = i2c_get_chip_for_busnum(0, 0x77, 1, &udev); + if (!ret) + ret = dm_i2c_write(udev, 0, &a, 1); +#endif + if (ret) + goto error; for (dpmac = 0; dpmac < 8; dpmac++) { /* Check the PHY status */ @@ -120,7 +131,15 @@ static void sgmii_configure_repeater(int serdes_port) mii_bus = 1; dpmac_id = dpmac + 9; a = 0xb; - i2c_write(0x76, 0, 0, &a, 1); +#ifndef CONFIG_DM_I2C + ret = i2c_write(0x76, 0, 0, &a, 1); +#else + ret = i2c_get_chip_for_busnum(0, 0x76, 1, &udev); + if (!ret) + ret = dm_i2c_write(udev, 0, &a, 1); +#endif + if (ret) + goto error; break; } @@ -153,29 +172,102 @@ static void sgmii_configure_repeater(int serdes_port) for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { +#ifndef CONFIG_DM_I2C a = 0x18; - i2c_write(i2c_addr[dpmac], 6, 1, &a, 1); + ret = i2c_write(i2c_addr[dpmac], 6, 1, &a, 1); + if (ret) + goto error; a = 0x38; - i2c_write(i2c_addr[dpmac], 4, 1, &a, 1); + ret = i2c_write(i2c_addr[dpmac], 4, 1, &a, 1); + if (ret) + goto error; a = 0x4; - i2c_write(i2c_addr[dpmac], 8, 1, &a, 1); + ret = i2c_write(i2c_addr[dpmac], 8, 1, &a, 1); + if (ret) + goto error; - i2c_write(i2c_addr[dpmac], 0xf, 1, - &ch_a_eq[i], 1); - i2c_write(i2c_addr[dpmac], 0x11, 1, - &ch_a_ctl2[j], 1); + ret = i2c_write(i2c_addr[dpmac], 0xf, + 1, &ch_a_eq[i], 1); + if (ret) + goto error; + ret = i2c_write(i2c_addr[dpmac], 0x11, + 1, &ch_a_ctl2[j], 1); + if (ret) + goto error; - i2c_write(i2c_addr[dpmac], 0x16, 1, - &ch_b_eq[i], 1); - i2c_write(i2c_addr[dpmac], 0x18, 1, - &ch_b_ctl2[j], 1); + ret = i2c_write(i2c_addr[dpmac], 0x16, + 1, &ch_b_eq[i], 1); + if (ret) + goto error; + ret = i2c_write(i2c_addr[dpmac], 0x18, + 1, &ch_b_ctl2[j], 1); + if (ret) + goto error; a = 0x14; - i2c_write(i2c_addr[dpmac], 0x23, 1, &a, 1); + ret = i2c_write(i2c_addr[dpmac],
[U-Boot] [PATCH v2 3/4] configs: ls2088aqds: Enable DM support for ds3231 rtc
Enable related configs on all ls2088aqds boards to support ds3231 rtc DM function. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=118772 - http://patchwork.ozlabs.org/project/uboot/list/?series=117226 Changes in v2: - No change. configs/ls2088aqds_tfa_defconfig | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/configs/ls2088aqds_tfa_defconfig b/configs/ls2088aqds_tfa_defconfig index e798c59..95921b0 100644 --- a/configs/ls2088aqds_tfa_defconfig +++ b/configs/ls2088aqds_tfa_defconfig @@ -1,12 +1,12 @@ CONFIG_ARM=y CONFIG_TARGET_LS2080AQDS=y +CONFIG_SYS_MALLOC_F_LEN=0x6000 CONFIG_SYS_TEXT_BASE=0x8200 CONFIG_TFABOOT=y CONFIG_NR_DRAM_BANKS=3 CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y CONFIG_SEC_FIRMWARE_ARMV8_PSCI=y CONFIG_AHCI=y -# CONFIG_SYS_MALLOC_F is not set CONFIG_FIT_VERBOSE=y CONFIG_OF_BOARD_SETUP=y CONFIG_OF_STDOUT_VIA_ALIAS=y @@ -63,3 +63,11 @@ CONFIG_DM_USB=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_DWC3=y CONFIG_EFI_LOADER_BOUNCE_BUFFER=y +CONFIG_DM_I2C=y +CONFIG_I2C_SET_DEFAULT_BUS_NUM=y +CONFIG_I2C_DEFAULT_BUS_NUMBER=0 +CONFIG_DM_GPIO=y +CONFIG_I2C_MUX=y +CONFIG_I2C_MUX_PCA954x=y +CONFIG_DM_RTC=y +CONFIG_DS3231_BUS_NUM=0 -- 2.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 1/4] rtc: ds3232/ds3231: Add support to generate 32KHz output for driver module
This patch add an implementation of the rtc_enable_32khz_output() that uses the driver model i2c APIs. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=118772 - http://patchwork.ozlabs.org/project/uboot/list/?series=117226 Changes in v2: - No change. drivers/rtc/Kconfig | 10 ++ drivers/rtc/ds3231.c | 21 + include/rtc.h| 6 ++ 3 files changed, 37 insertions(+) diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index fd0009b..040d241 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -31,6 +31,12 @@ config TPL_DM_RTC drivers to perform the actual functions. See rtc.h for a description of the API. +config RTC_ENABLE_32KHZ_OUTPUT + bool "Enable RTC 32Khz output" + help + Some real-time clocks support the output of 32kHz square waves (such as ds3231), + the config symbol choose Real Time Clock device 32Khz output feature. + config RTC_PCF2127 bool "Enable PCF2127 driver" depends on DM_RTC @@ -41,6 +47,10 @@ config RTC_PCF2127 has a selectable I2C-bus or SPI-bus, a backup battery switch-over circuit, a programmable watchdog function, a timestamp function, and many other features. +config DS3231_BUS_NUM + hex "I2C bus of the DS3231 device" + default 0 + config RTC_DS1307 bool "Enable DS1307 driver" depends on DM_RTC diff --git a/drivers/rtc/ds3231.c b/drivers/rtc/ds3231.c index 79b026a..dbd77a6 100644 --- a/drivers/rtc/ds3231.c +++ b/drivers/rtc/ds3231.c @@ -148,11 +148,13 @@ void rtc_reset (void) /* * Enable 32KHz output */ +#ifdef CONFIG_RTC_ENABLE_32KHZ_OUTPUT void rtc_enable_32khz_output(void) { rtc_write(RTC_STAT_REG_ADDR, RTC_STAT_BIT_BB32KHZ | RTC_STAT_BIT_EN32KHZ); } +#endif /* * Helper functions @@ -251,6 +253,25 @@ static int ds3231_probe(struct udevice *dev) return 0; } +#ifdef CONFIG_RTC_ENABLE_32KHZ_OUTPUT +void rtc_enable_32khz_output(void) +{ + int ret; + struct udevice *dev; + +#ifdef CONFIG_DS3231_BUS_NUM + ret = i2c_get_chip_for_busnum(CONFIG_DS3231_BUS_NUM, + CONFIG_SYS_I2C_RTC_ADDR, 1, &dev); +#else + ret = i2c_get_chip_for_busnum(0, CONFIG_SYS_I2C_RTC_ADDR, 1, &dev); +#endif + if (!ret) + dm_i2c_reg_write(dev, RTC_STAT_REG_ADDR, +RTC_STAT_BIT_BB32KHZ | +RTC_STAT_BIT_EN32KHZ); +} +#endif + static const struct rtc_ops ds3231_rtc_ops = { .get = ds3231_rtc_get, .set = ds3231_rtc_set, diff --git a/include/rtc.h b/include/rtc.h index b255bdc..df7de09 100644 --- a/include/rtc.h +++ b/include/rtc.h @@ -166,11 +166,17 @@ int rtc_read32(struct udevice *dev, unsigned int reg, u32 *valuep); */ int rtc_write32(struct udevice *dev, unsigned int reg, u32 value); +#ifdef CONFIG_RTC_ENABLE_32KHZ_OUTPUT +void rtc_enable_32khz_output(void); +#endif + #else int rtc_get (struct rtc_time *); int rtc_set (struct rtc_time *); void rtc_reset (void); +#ifdef CONFIG_RTC_ENABLE_32KHZ_OUTPUT void rtc_enable_32khz_output(void); +#endif /** * rtc_read8() - Read an 8-bit register -- 2.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [EXT] Re: [PATCH 2/4] armv8: ls2088aqds: The ls2088aqds board supports the I2C driver model.
> -Original Message- > From: Wolfgang Denk > Sent: 2019年7月24日 14:55 > To: Chuanhua Han > Cc: albert.u.b...@aribaud.net; Prabhakar Kushwaha > ; Priyanka Jain ; > Rajesh Bhagat ; u-boot@lists.denx.de; > lu...@denx.de; tr...@konsulko.com > Subject: [EXT] Re: [PATCH 2/4] armv8: ls2088aqds: The ls2088aqds board > supports the I2C driver model. > > Caution: EXT Email > > Dear Chuanhua, > > In message <20190724025904.469-2-chuanhua@nxp.com> you wrote: > > This patch is updating ls2088aqds board init code to support DM_I2C. > > I have a generic question about error handling in your code: > > > + a = 0x18; > > + dm_i2c_write(udev, 6, &a, 1); > > + a = 0x38; > > + dm_i2c_write(udev, 4, &a, 1); > > + a = 0x4; > > + dm_i2c_write(udev, 8, &a, 1); > > + > > + dm_i2c_write(udev, 0xf, &ch_a_eq[i], 1); > > + dm_i2c_write(udev, 0x11, &ch_a_ctl2[j], > > + 1); > > + > > + dm_i2c_write(udev, 0x16, &ch_b_eq[i], > 1); > > + dm_i2c_write(udev, 0x18, &ch_b_ctl2[j], > > + 1); > > + > > + a = 0x14; > > + dm_i2c_write(udev, 0x23, &a, 1); > > + a = 0xb5; > > + dm_i2c_write(udev, 0x2d, &a, 1); > > + a = 0x20; > > + dm_i2c_write(udev, 4, &a, 1); > ... > > i2c_write(0x77, 0, 0, &a, 1); > ... > > You use a large number of functions without ever checking their return codes. > But all these functions can fail for a number of reasons. Should you not > always > check for errors? yes,should to check for errors! > > Best regards, > > Wolfgang Denk > > -- > DENX Software Engineering GmbH, Managing Director: Wolfgang Denk > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany > Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de He > had quite a powerful intellect, but it was as powerful like a locomotive, > and ran on rails and was therefore almost impossible to > steer. - Terry Pratchett, _Lords and Ladies_ ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 2/4] armv8: ls2088aqds: The ls2088aqds board supports the I2C driver model.
This patch is updating ls2088aqds board init code to support DM_I2C. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=118772 - http://patchwork.ozlabs.org/project/uboot/list/?series=117226 board/freescale/ls2080aqds/eth.c| 75 + board/freescale/ls2080aqds/ls2080aqds.c | 8 include/configs/ls2080aqds.h| 3 ++ 3 files changed, 86 insertions(+) diff --git a/board/freescale/ls2080aqds/eth.c b/board/freescale/ls2080aqds/eth.c index f706fd4..b1d6827 100644 --- a/board/freescale/ls2080aqds/eth.c +++ b/board/freescale/ls2080aqds/eth.c @@ -107,7 +107,16 @@ static void sgmii_configure_repeater(int serdes_port) int *riser_phy_addr = &xqsgii_riser_phy_addr[0]; /* Set I2c to Slot 1 */ +#ifndef CONFIG_DM_I2C i2c_write(0x77, 0, 0, &a, 1); +#else + struct udevice *udev; + + ret = i2c_get_chip_for_busnum(0, 0x77, 1, &udev); + if (!ret) + dm_i2c_write(udev, 0, &a, 1); +#endif + for (dpmac = 0; dpmac < 8; dpmac++) { /* Check the PHY status */ @@ -120,7 +129,14 @@ static void sgmii_configure_repeater(int serdes_port) mii_bus = 1; dpmac_id = dpmac + 9; a = 0xb; +#ifndef CONFIG_DM_I2C i2c_write(0x76, 0, 0, &a, 1); +#else + ret = i2c_get_chip_for_busnum(0, 0x76, 1, &udev); + if (!ret) + dm_i2c_write(udev, 0, &a, 1); +#endif + break; } @@ -153,6 +169,7 @@ static void sgmii_configure_repeater(int serdes_port) for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { +#ifndef CONFIG_DM_I2C a = 0x18; i2c_write(i2c_addr[dpmac], 6, 1, &a, 1); a = 0x38; @@ -176,6 +193,31 @@ static void sgmii_configure_repeater(int serdes_port) i2c_write(i2c_addr[dpmac], 0x2d, 1, &a, 1); a = 0x20; i2c_write(i2c_addr[dpmac], 4, 1, &a, 1); +#else + i2c_get_chip_for_busnum(0, i2c_addr[dpmac], + 1, &udev); + + a = 0x18; + dm_i2c_write(udev, 6, &a, 1); + a = 0x38; + dm_i2c_write(udev, 4, &a, 1); + a = 0x4; + dm_i2c_write(udev, 8, &a, 1); + + dm_i2c_write(udev, 0xf, &ch_a_eq[i], 1); + dm_i2c_write(udev, 0x11, &ch_a_ctl2[j], 1); + + dm_i2c_write(udev, 0x16, &ch_b_eq[i], 1); + dm_i2c_write(udev, 0x18, &ch_b_ctl2[j], 1); + + a = 0x14; + dm_i2c_write(udev, 0x23, &a, 1); + a = 0xb5; + dm_i2c_write(udev, 0x2d, &a, 1); + a = 0x20; + dm_i2c_write(udev, 4, &a, 1); + +#endif mdelay(100); ret = miiphy_read(dev[mii_bus], riser_phy_addr[dpmac], @@ -231,7 +273,15 @@ static void qsgmii_configure_repeater(int dpmac) unsigned short value; /* Set I2c to Slot 1 */ +#ifndef CONFIG_DM_I2C i2c_write(0x77, 0, 0, &a, 1); +#else + struct udevice *udev; + + ret = i2c_get_chip_for_busnum(0, 0x77, 1, &udev); + if (!ret) + dm_i2c_write(udev, 0, &a, 1); +#endif switch (dpmac) { case 1: @@ -282,6 +332,7 @@ static void qsgmii_configure_repeater(int dpmac) for (i = 0; i < 4; i++) { for (j = 0; j < 4; j++) { +#ifndef CONFIG_DM_I2C a = 0x18; i2c_write(i2c_phy_addr, 6, 1, &a, 1); a = 0x38; @@ -301,6 +352,30 @@ static void qsgmii_configure_repeater(int dpmac) i2c_write(i2c_phy_addr, 0x2d, 1, &a, 1); a = 0x20; i2c_write(i2c_phy_addr, 4, 1, &a, 1); +#else + i2c_get_chip_for_busnum(0, i2c_phy_addr, 1, &udev); + a = 0x18; + dm_i2c_write(udev, 6, &a, 1); + a = 0x38; + dm_i2c_write(udev, 4, &a, 1); + a = 0x4; + dm_i2c_write(udev, 8, &
[U-Boot] [PATCH 3/4] configs: ls2088aqds: Enable DM support for ds3231 rtc
Enable related configs on all ls2088aqds boards to support ds3231 rtc DM function. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=118772 - http://patchwork.ozlabs.org/project/uboot/list/?series=117226 configs/ls2088aqds_tfa_defconfig | 10 +- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/configs/ls2088aqds_tfa_defconfig b/configs/ls2088aqds_tfa_defconfig index e798c59..95921b0 100644 --- a/configs/ls2088aqds_tfa_defconfig +++ b/configs/ls2088aqds_tfa_defconfig @@ -1,12 +1,12 @@ CONFIG_ARM=y CONFIG_TARGET_LS2080AQDS=y +CONFIG_SYS_MALLOC_F_LEN=0x6000 CONFIG_SYS_TEXT_BASE=0x8200 CONFIG_TFABOOT=y CONFIG_NR_DRAM_BANKS=3 CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y CONFIG_SEC_FIRMWARE_ARMV8_PSCI=y CONFIG_AHCI=y -# CONFIG_SYS_MALLOC_F is not set CONFIG_FIT_VERBOSE=y CONFIG_OF_BOARD_SETUP=y CONFIG_OF_STDOUT_VIA_ALIAS=y @@ -63,3 +63,11 @@ CONFIG_DM_USB=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_DWC3=y CONFIG_EFI_LOADER_BOUNCE_BUFFER=y +CONFIG_DM_I2C=y +CONFIG_I2C_SET_DEFAULT_BUS_NUM=y +CONFIG_I2C_DEFAULT_BUS_NUMBER=0 +CONFIG_DM_GPIO=y +CONFIG_I2C_MUX=y +CONFIG_I2C_MUX_PCA954x=y +CONFIG_DM_RTC=y +CONFIG_DS3231_BUS_NUM=0 -- 2.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 4/4] armv8: ls2088aqds : Add ds3232 node
This patch adds the ds3232-rtc node under the i2c0->i2c-mux@77->i2c@0 for ls2088aqds boards. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=118772 - http://patchwork.ozlabs.org/project/uboot/list/?series=117226 arch/arm/dts/fsl-ls2080a-qds.dts | 19 +++ 1 file changed, 19 insertions(+) diff --git a/arch/arm/dts/fsl-ls2080a-qds.dts b/arch/arm/dts/fsl-ls2080a-qds.dts index 2a0a528..13461b5 100644 --- a/arch/arm/dts/fsl-ls2080a-qds.dts +++ b/arch/arm/dts/fsl-ls2080a-qds.dts @@ -19,6 +19,25 @@ }; }; +&i2c0 { + status = "okay"; + pca9547@77 { + compatible = "nxp,pca9547"; + reg = <0x77>; + #address-cells = <1>; + #size-cells = <0>; + i2c@0 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0x00>; + rtc@68 { + compatible = "dallas,ds3232"; + reg = <0x68>; + }; + }; + }; +}; + &dspi { bus-num = <0>; status = "okay"; -- 2.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 1/4] rtc: ds3232/ds3231: Add support to generate 32KHz output for driver module
This patch add an implementation of the rtc_enable_32khz_output() that uses the driver model i2c APIs. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=118772 - http://patchwork.ozlabs.org/project/uboot/list/?series=117226 drivers/rtc/Kconfig | 10 ++ drivers/rtc/ds3231.c | 21 + include/rtc.h| 6 ++ 3 files changed, 37 insertions(+) diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index fd0009b..040d241 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -31,6 +31,12 @@ config TPL_DM_RTC drivers to perform the actual functions. See rtc.h for a description of the API. +config RTC_ENABLE_32KHZ_OUTPUT + bool "Enable RTC 32Khz output" + help + Some real-time clocks support the output of 32kHz square waves (such as ds3231), + the config symbol choose Real Time Clock device 32Khz output feature. + config RTC_PCF2127 bool "Enable PCF2127 driver" depends on DM_RTC @@ -41,6 +47,10 @@ config RTC_PCF2127 has a selectable I2C-bus or SPI-bus, a backup battery switch-over circuit, a programmable watchdog function, a timestamp function, and many other features. +config DS3231_BUS_NUM + hex "I2C bus of the DS3231 device" + default 0 + config RTC_DS1307 bool "Enable DS1307 driver" depends on DM_RTC diff --git a/drivers/rtc/ds3231.c b/drivers/rtc/ds3231.c index 79b026a..dbd77a6 100644 --- a/drivers/rtc/ds3231.c +++ b/drivers/rtc/ds3231.c @@ -148,11 +148,13 @@ void rtc_reset (void) /* * Enable 32KHz output */ +#ifdef CONFIG_RTC_ENABLE_32KHZ_OUTPUT void rtc_enable_32khz_output(void) { rtc_write(RTC_STAT_REG_ADDR, RTC_STAT_BIT_BB32KHZ | RTC_STAT_BIT_EN32KHZ); } +#endif /* * Helper functions @@ -251,6 +253,25 @@ static int ds3231_probe(struct udevice *dev) return 0; } +#ifdef CONFIG_RTC_ENABLE_32KHZ_OUTPUT +void rtc_enable_32khz_output(void) +{ + int ret; + struct udevice *dev; + +#ifdef CONFIG_DS3231_BUS_NUM + ret = i2c_get_chip_for_busnum(CONFIG_DS3231_BUS_NUM, + CONFIG_SYS_I2C_RTC_ADDR, 1, &dev); +#else + ret = i2c_get_chip_for_busnum(0, CONFIG_SYS_I2C_RTC_ADDR, 1, &dev); +#endif + if (!ret) + dm_i2c_reg_write(dev, RTC_STAT_REG_ADDR, +RTC_STAT_BIT_BB32KHZ | +RTC_STAT_BIT_EN32KHZ); +} +#endif + static const struct rtc_ops ds3231_rtc_ops = { .get = ds3231_rtc_get, .set = ds3231_rtc_set, diff --git a/include/rtc.h b/include/rtc.h index b255bdc..df7de09 100644 --- a/include/rtc.h +++ b/include/rtc.h @@ -166,11 +166,17 @@ int rtc_read32(struct udevice *dev, unsigned int reg, u32 *valuep); */ int rtc_write32(struct udevice *dev, unsigned int reg, u32 value); +#ifdef CONFIG_RTC_ENABLE_32KHZ_OUTPUT +void rtc_enable_32khz_output(void); +#endif + #else int rtc_get (struct rtc_time *); int rtc_set (struct rtc_time *); void rtc_reset (void); +#ifdef CONFIG_RTC_ENABLE_32KHZ_OUTPUT void rtc_enable_32khz_output(void); +#endif /** * rtc_read8() - Read an 8-bit register -- 2.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [EXT] Re: [PATCH v2] rtc: ds3232/ds3231: Add support to generate 32KHz output for driver module
Dear Wolfgang Denk > -Original Message- > From: Wolfgang Denk > Sent: 2019年7月23日 23:05 > To: Chuanhua Han > Cc: lu...@denx.de; tr...@konsulko.com; Prabhakar Kushwaha > ; u-boot@lists.denx.de > Subject: [EXT] Re: [PATCH v2] rtc: ds3232/ds3231: Add support to generate > 32KHz output for driver module > > Caution: EXT Email > > Dear Chuanhua Han, > > In message <20190723095745.37138-1-chuanhua@nxp.com> you wrote: > > This patch add an implementation of the rtc_enable_32khz_output() that > > uses the driver model i2c APIs. > > > > Signed-off-by: Chuanhua Han > > --- > > Change in v2: > > - Add RTC_ENABLE_32KHZ_OUTPUT option so this code compiles > only > > in that cases where it is really useful. > > So when exactly is it useful? > > If I understand correctly, there are no users of this code in mainline. > Should > the patch then not be part of a patch series that adds such users? > > Adding potentially "useful" code just on speculation is not nice > maintenance-wise. > > I recommend to withdraw this patch and submit it together with some real > consumer of this feature. Ok, I will send the current patch together with the one that actually uses this function. Thanks for your advice! > > Thanks. > > Best regards, > > Wolfgang Denk > > -- > DENX Software Engineering GmbH, Managing Director: Wolfgang Denk > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany > Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de > "The question of whether a computer can think is no more interesting than > the question of whether a submarine can swim" > - Edsgar W. Dijkstra ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 3/5] configs: ls1088a: enable DM support for pcf2127 rtc
Enable related configs to support pcf2127 rtc DM feature for ls1088ardb board. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=110856 - http://patchwork.ozlabs.org/project/uboot/list/?series=109459 Changes in v3: - Add configuration options for i2c dm to set default bus number Settings. Changes in v2: - No change. configs/ls1088ardb_tfa_SECURE_BOOT_defconfig |10 +- configs/ls1088ardb_tfa_defconfig |10 +- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/configs/ls1088ardb_tfa_SECURE_BOOT_defconfig b/configs/ls1088ardb_tfa_SECURE_BOOT_defconfig index 3c4437d..364fc59 100644 --- a/configs/ls1088ardb_tfa_SECURE_BOOT_defconfig +++ b/configs/ls1088ardb_tfa_SECURE_BOOT_defconfig @@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_TARGET_LS1088ARDB=y +CONFIG_SYS_MALLOC_F_LEN=0x6000 CONFIG_SYS_TEXT_BASE=0x8200 CONFIG_SECURE_BOOT=y CONFIG_QSPI_AHB_INIT=y @@ -9,7 +10,6 @@ CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y CONFIG_SEC_FIRMWARE_ARMV8_PSCI=y CONFIG_AHCI=y CONFIG_DISTRO_DEFAULTS=y -# CONFIG_SYS_MALLOC_F is not set CONFIG_FIT_VERBOSE=y CONFIG_OF_BOARD_SETUP=y CONFIG_OF_STDOUT_VIA_ALIAS=y @@ -63,3 +63,11 @@ CONFIG_RSA=y CONFIG_SPL_RSA=y CONFIG_RSA_SOFTWARE_EXP=y CONFIG_EFI_LOADER_BOUNCE_BUFFER=y +CONFIG_DM_I2C=y +CONFIG_I2C_SET_DEFAULT_BUS_NUM=y +CONFIG_I2C_DEFAULT_BUS_NUMBER=0 +CONFIG_DM_RTC=y +CONFIG_DM_GPIO=y +CONFIG_RTC_PCF2127=y +CONFIG_I2C_MUX=y +CONFIG_I2C_MUX_PCA954x=y diff --git a/configs/ls1088ardb_tfa_defconfig b/configs/ls1088ardb_tfa_defconfig index 8cea8c7..eb35782 100644 --- a/configs/ls1088ardb_tfa_defconfig +++ b/configs/ls1088ardb_tfa_defconfig @@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_TARGET_LS1088ARDB=y +CONFIG_SYS_MALLOC_F_LEN=0x6000 CONFIG_SYS_TEXT_BASE=0x8200 CONFIG_QSPI_AHB_INIT=y CONFIG_TFABOOT=y @@ -8,7 +9,6 @@ CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y CONFIG_SEC_FIRMWARE_ARMV8_PSCI=y CONFIG_AHCI=y CONFIG_DISTRO_DEFAULTS=y -# CONFIG_SYS_MALLOC_F is not set CONFIG_FIT_VERBOSE=y CONFIG_OF_BOARD_SETUP=y CONFIG_OF_STDOUT_VIA_ALIAS=y @@ -61,3 +61,11 @@ CONFIG_USB_XHCI_DWC3=y CONFIG_USB_DWC3=y CONFIG_USB_GADGET=y CONFIG_EFI_LOADER_BOUNCE_BUFFER=y +CONFIG_DM_I2C=y +CONFIG_I2C_SET_DEFAULT_BUS_NUM=y +CONFIG_I2C_DEFAULT_BUS_NUMBER=0 +CONFIG_DM_RTC=y +CONFIG_DM_GPIO=y +CONFIG_RTC_PCF2127=y +CONFIG_I2C_MUX=y +CONFIG_I2C_MUX_PCA954x=y -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 5/5] armv8: dts: ls1088ardb: Add slave nodes under the i2c0 controller
This patch adds some slave nodes to support the i2c dm on the device side under the i2c0 controller. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=110856 - http://patchwork.ozlabs.org/project/uboot/list/?series=109459 Change in v3: - No change. Change in v2: - Delete unnecessary i2c slave nodes. arch/arm/dts/fsl-ls1088a-rdb.dts | 23 +++ 1 files changed, 23 insertions(+), 0 deletions(-) diff --git a/arch/arm/dts/fsl-ls1088a-rdb.dts b/arch/arm/dts/fsl-ls1088a-rdb.dts index 765d1e3..0fe3519 100644 --- a/arch/arm/dts/fsl-ls1088a-rdb.dts +++ b/arch/arm/dts/fsl-ls1088a-rdb.dts @@ -17,6 +17,29 @@ }; }; +&i2c0 { + status = "okay"; + u-boot,dm-pre-reloc; + + i2c-mux@77 { + compatible = "nxp,pca9547"; + reg = <0x77>; + #address-cells = <1>; + #size-cells = <0>; + + i2c@3 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0x3>; + + rtc@51 { + compatible = "pcf2127-rtc"; + reg = <0x51>; + }; + }; + }; +}; + &qspi { bus-num = <0>; status = "okay"; -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 4/5] armv8: dts: fsl-ls1088a: add I2C node support
One ls1088a, there is four I2C controllers. This patch is to add I2C node for ls1088a. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=110856 - http://patchwork.ozlabs.org/project/uboot/list/?series=109459 Changes in v3: - No change. Changes in v2: - No change. arch/arm/dts/fsl-ls1088a.dtsi | 32 1 files changed, 32 insertions(+), 0 deletions(-) diff --git a/arch/arm/dts/fsl-ls1088a.dtsi b/arch/arm/dts/fsl-ls1088a.dtsi index 7c70585..4be1ab8 100644 --- a/arch/arm/dts/fsl-ls1088a.dtsi +++ b/arch/arm/dts/fsl-ls1088a.dtsi @@ -34,6 +34,38 @@ <1 10 0x8>; /* Hypervisor PPI, active-low */ }; + i2c0: i2c@200 { + compatible = "fsl,vf610-i2c"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x0 0x200 0x0 0x1>; + interrupts = <0 34 4>; + }; + + i2c1: i2c@201 { + compatible = "fsl,vf610-i2c"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x0 0x201 0x0 0x1>; + interrupts = <0 34 4>; + }; + + i2c2: i2c@202 { + compatible = "fsl,vf610-i2c"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x0 0x202 0x0 0x1>; + interrupts = <0 35 4>; + }; + + i2c3: i2c@203 { + compatible = "fsl,vf610-i2c"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x0 0x203 0x0 0x1>; + interrupts = <0 35 4>; + }; + serial0: serial@21c0500 { device_type = "serial"; compatible = "fsl,ns16550", "ns16550a"; -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 2/5] gpio: do not include on ARCH_LS1088A
As no gpio.h is defined for this architecture, to avoid compilation failure, do not include for arch ls1088a. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=110856 - http://patchwork.ozlabs.org/project/uboot/list/?series=109459 Changes in v3: - No change. Changes in v2: - No change. arch/arm/include/asm/gpio.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/arm/include/asm/gpio.h b/arch/arm/include/asm/gpio.h index f78b976..0ca15c9 100644 --- a/arch/arm/include/asm/gpio.h +++ b/arch/arm/include/asm/gpio.h @@ -1,7 +1,7 @@ #if !defined(CONFIG_ARCH_UNIPHIER) && !defined(CONFIG_ARCH_STI) && \ !defined(CONFIG_ARCH_K3) && !defined(CONFIG_ARCH_BCM6858) && \ !defined(CONFIG_ARCH_BCM63158) && !defined(CONFIG_ARCH_ROCKCHIP) && \ - !defined(CONFIG_ARCH_LX2160A) + !defined(CONFIG_ARCH_LX2160A) && !defined(CONFIG_ARCH_LS1088A) #include #endif #include -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 1/5] armv8: ls1088a: The ls1088a platform supports the I2C driver model.
DM_I2C_COMPAT is a compatibility layer that allows using the non-DM I2C API when DM_I2C is used.When DM_I2C_COMPAT is not enabled for compilation, a compilation error will be generated. This patch solves the problem that the i2c-related api of the ls1088a platform does not support dm. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=110856 - http://patchwork.ozlabs.org/project/uboot/list/?series=109459 Changes in v3: - Change the Kconfig file to !TFABOOT. - Define the use of CONFIG_SYS_I2C for non-dm. Changes in v2: - No change. arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 8 +- board/freescale/ls1088a/ls1088a.c | 148 ++ include/configs/ls1088a_common.h | 3 + include/configs/ls1088ardb.h | 2 - 4 files changed, 155 insertions(+), 6 deletions(-) diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig index ffda02a..b2768ed 100644 --- a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig +++ b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig @@ -155,10 +155,10 @@ config ARCH_LS1088A select ARCH_EARLY_INIT_R select BOARD_EARLY_INIT_F select SYS_I2C_MXC - select SYS_I2C_MXC_I2C1 - select SYS_I2C_MXC_I2C2 - select SYS_I2C_MXC_I2C3 - select SYS_I2C_MXC_I2C4 + select SYS_I2C_MXC_I2C1 if !TFABOOT + select SYS_I2C_MXC_I2C2 if !TFABOOT + select SYS_I2C_MXC_I2C3 if !TFABOOT + select SYS_I2C_MXC_I2C4 if !TFABOOT imply SCSI imply PANIC_HANG diff --git a/board/freescale/ls1088a/ls1088a.c b/board/freescale/ls1088a/ls1088a.c index 6d11a13..2bac070 100644 --- a/board/freescale/ls1088a/ls1088a.c +++ b/board/freescale/ls1088a/ls1088a.c @@ -373,7 +373,15 @@ int select_i2c_ch_pca9547(u8 ch) { int ret; +#ifndef CONFIG_DM_I2C ret = i2c_write(I2C_MUX_PCA_ADDR_PRI, 0, 1, &ch, 1); +#else + struct udevice *dev; + + ret = i2c_get_chip_for_busnum(0, I2C_MUX_PCA_ADDR_PRI, 1, &dev); + if (!ret) + ret = dm_i2c_write(dev, 0, &ch, 1); +#endif if (ret) { puts("PCA: failed to select proper channel\n"); return ret; @@ -392,38 +400,89 @@ void board_retimer_init(void) /* Access to Control/Shared register */ reg = 0x0; +#ifndef CONFIG_DM_I2C i2c_write(I2C_RETIMER_ADDR, 0xff, 1, ®, 1); +#else + struct udevice *dev; + + i2c_get_chip_for_busnum(0, I2C_RETIMER_ADDR, 1, &dev); + dm_i2c_write(dev, 0xff, ®, 1); +#endif /* Read device revision and ID */ +#ifndef CONFIG_DM_I2C i2c_read(I2C_RETIMER_ADDR, 1, 1, ®, 1); +#else + dm_i2c_read(dev, 1, ®, 1); +#endif debug("Retimer version id = 0x%x\n", reg); /* Enable Broadcast. All writes target all channel register sets */ reg = 0x0c; +#ifndef CONFIG_DM_I2C i2c_write(I2C_RETIMER_ADDR, 0xff, 1, ®, 1); +#else + dm_i2c_write(dev, 0xff, ®, 1); +#endif /* Reset Channel Registers */ +#ifndef CONFIG_DM_I2C i2c_read(I2C_RETIMER_ADDR, 0, 1, ®, 1); +#else + dm_i2c_read(dev, 0, ®, 1); +#endif reg |= 0x4; +#ifndef CONFIG_DM_I2C i2c_write(I2C_RETIMER_ADDR, 0, 1, ®, 1); +#else + dm_i2c_write(dev, 0, ®, 1); +#endif /* Set data rate as 10.3125 Gbps */ reg = 0x90; +#ifndef CONFIG_DM_I2C i2c_write(I2C_RETIMER_ADDR, 0x60, 1, ®, 1); +#else + dm_i2c_write(dev, 0x60, ®, 1); +#endif reg = 0xb3; +#ifndef CONFIG_DM_I2C i2c_write(I2C_RETIMER_ADDR, 0x61, 1, ®, 1); +#else + dm_i2c_write(dev, 0x61, ®, 1); +#endif reg = 0x90; +#ifndef CONFIG_DM_I2C i2c_write(I2C_RETIMER_ADDR, 0x62, 1, ®, 1); +#else + dm_i2c_write(dev, 0x62, ®, 1); +#endif reg = 0xb3; +#ifndef CONFIG_DM_I2C i2c_write(I2C_RETIMER_ADDR, 0x63, 1, ®, 1); +#else + dm_i2c_write(dev, 0x63, ®, 1); +#endif reg = 0xcd; +#ifndef CONFIG_DM_I2C i2c_write(I2C_RETIMER_ADDR, 0x64, 1, ®, 1); +#else + dm_i2c_write(dev, 0x64, ®, 1); +#endif /* Select VCO Divider to full rate (000) */ +#ifndef CONFIG_DM_I2C i2c_read(I2C_RETIMER_ADDR, 0x2F, 1, ®, 1); +#else + dm_i2c_read(dev, 0x2F, ®, 1); +#endif reg &= 0x0f; reg |= 0x70; +#ifndef CONFIG_DM_I2C i2c_write(I2C_RETIMER_ADDR, 0x2F, 1, ®, 1); +#else + dm_i2c_write(dev, 0x2F, ®, 1); +#endif #ifdef CONFIG_TARGET_LS1088AQDS /* Retimer is connected to I2C1_CH5 */ @@ -431,38 +490,88 @@ void board_retimer_init(void) /* Access to Control/Shared register */ reg = 0x0; +#ifndef CONFIG_DM_I2C i2c_write(I2C_RETIMER_ADDR2, 0xff, 1, ®, 1); +#else + i2c_get_chip_for_busnum(0, I2C_RETIMER_ADDR2, 1, &dev); + dm_i2c_write(dev, 0xff, ®, 1); +#endif /* Read device revision and I
[U-Boot] [PATCH v2] rtc: ds3232/ds3231: Add support to generate 32KHz output for driver module
This patch add an implementation of the rtc_enable_32khz_output() that uses the driver model i2c APIs. Signed-off-by: Chuanhua Han --- Change in v2: - Add RTC_ENABLE_32KHZ_OUTPUT option so this code compiles only in that cases where it is really useful. drivers/rtc/Kconfig | 10 ++ drivers/rtc/ds3231.c | 21 + include/rtc.h| 6 ++ 3 files changed, 37 insertions(+) diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index fd0009b..040d241 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig @@ -31,6 +31,12 @@ config TPL_DM_RTC drivers to perform the actual functions. See rtc.h for a description of the API. +config RTC_ENABLE_32KHZ_OUTPUT + bool "Enable RTC 32Khz output" + help + Some real-time clocks support the output of 32kHz square waves (such as ds3231), + the config symbol choose Real Time Clock device 32Khz output feature. + config RTC_PCF2127 bool "Enable PCF2127 driver" depends on DM_RTC @@ -41,6 +47,10 @@ config RTC_PCF2127 has a selectable I2C-bus or SPI-bus, a backup battery switch-over circuit, a programmable watchdog function, a timestamp function, and many other features. +config DS3231_BUS_NUM + hex "I2C bus of the DS3231 device" + default 0 + config RTC_DS1307 bool "Enable DS1307 driver" depends on DM_RTC diff --git a/drivers/rtc/ds3231.c b/drivers/rtc/ds3231.c index 79b026a..dbd77a6 100644 --- a/drivers/rtc/ds3231.c +++ b/drivers/rtc/ds3231.c @@ -148,11 +148,13 @@ void rtc_reset (void) /* * Enable 32KHz output */ +#ifdef CONFIG_RTC_ENABLE_32KHZ_OUTPUT void rtc_enable_32khz_output(void) { rtc_write(RTC_STAT_REG_ADDR, RTC_STAT_BIT_BB32KHZ | RTC_STAT_BIT_EN32KHZ); } +#endif /* * Helper functions @@ -251,6 +253,25 @@ static int ds3231_probe(struct udevice *dev) return 0; } +#ifdef CONFIG_RTC_ENABLE_32KHZ_OUTPUT +void rtc_enable_32khz_output(void) +{ + int ret; + struct udevice *dev; + +#ifdef CONFIG_DS3231_BUS_NUM + ret = i2c_get_chip_for_busnum(CONFIG_DS3231_BUS_NUM, + CONFIG_SYS_I2C_RTC_ADDR, 1, &dev); +#else + ret = i2c_get_chip_for_busnum(0, CONFIG_SYS_I2C_RTC_ADDR, 1, &dev); +#endif + if (!ret) + dm_i2c_reg_write(dev, RTC_STAT_REG_ADDR, +RTC_STAT_BIT_BB32KHZ | +RTC_STAT_BIT_EN32KHZ); +} +#endif + static const struct rtc_ops ds3231_rtc_ops = { .get = ds3231_rtc_get, .set = ds3231_rtc_set, diff --git a/include/rtc.h b/include/rtc.h index b255bdc..df7de09 100644 --- a/include/rtc.h +++ b/include/rtc.h @@ -166,11 +166,17 @@ int rtc_read32(struct udevice *dev, unsigned int reg, u32 *valuep); */ int rtc_write32(struct udevice *dev, unsigned int reg, u32 value); +#ifdef CONFIG_RTC_ENABLE_32KHZ_OUTPUT +void rtc_enable_32khz_output(void); +#endif + #else int rtc_get (struct rtc_time *); int rtc_set (struct rtc_time *); void rtc_reset (void); +#ifdef CONFIG_RTC_ENABLE_32KHZ_OUTPUT void rtc_enable_32khz_output(void); +#endif /** * rtc_read8() - Read an 8-bit register -- 2.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 5/5] armv8: dts: ls2088ardb: Add slave nodes under the i2c0 controller
This patch adds some slave nodes to support the i2c dm on the device side under the i2c0 controller. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=109459 - http://patchwork.ozlabs.org/project/uboot/list/?series=113103 Change in v3: - No change. Change in v2: - Delete unnecessary i2c slave nodes. arch/arm/dts/fsl-ls2088a-rdb-qspi.dts | 22 ++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/arch/arm/dts/fsl-ls2088a-rdb-qspi.dts b/arch/arm/dts/fsl-ls2088a-rdb-qspi.dts index bf97d13..72b2177 100644 --- a/arch/arm/dts/fsl-ls2088a-rdb-qspi.dts +++ b/arch/arm/dts/fsl-ls2088a-rdb-qspi.dts @@ -57,6 +57,28 @@ }; }; +&i2c0 { + status = "okay"; + u-boot,dm-pre-reloc; + + pca9547@75 { + compatible = "nxp,pca9547"; + reg = <0x75>; + #address-cells = <1>; + #size-cells = <0>; + +i2c@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0x01>; + rtc@68 { + compatible = "dallas,ds3232"; + reg = <0x68>; + }; + }; + }; +}; + &sata { status = "okay"; }; -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 4/5] armv8: dts: fsl-ls2088a: add i2c node support
From: chuanhua han One ls2088a, there is four I2C controllers. This patch is to add I2C node for ls2088a. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=109459 - http://patchwork.ozlabs.org/project/uboot/list/?series=113103 Change in v3: - No change. Change in v2: - No change. arch/arm/dts/fsl-ls2080a.dtsi | 36 1 files changed, 36 insertions(+), 0 deletions(-) diff --git a/arch/arm/dts/fsl-ls2080a.dtsi b/arch/arm/dts/fsl-ls2080a.dtsi index 5c0769b..99ed33a 100644 --- a/arch/arm/dts/fsl-ls2080a.dtsi +++ b/arch/arm/dts/fsl-ls2080a.dtsi @@ -56,6 +56,42 @@ <0x 0x0834 0 0x4>; /* MC control reg */ }; + i2c0: i2c@200 { + status = "disabled"; + compatible = "fsl,vf610-i2c"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x0 0x200 0x0 0x1>; + interrupts = <0 34 0x4>; /* Level high type */ + }; + + i2c1: i2c@201 { + status = "disabled"; + compatible = "fsl,vf610-i2c"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x0 0x201 0x0 0x1>; + interrupts = <0 34 0x4>; /* Level high type */ + }; + + i2c2: i2c@202 { + status = "disabled"; + compatible = "fsl,vf610-i2c"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x0 0x202 0x0 0x1>; + interrupts = <0 35 0x4>; /* Level high type */ + }; + + i2c3: i2c@203 { + status = "disabled"; + compatible = "fsl,vf610-i2c"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x0 0x203 0x0 0x1>; + interrupts = <0 35 0x4>; /* Level high type */ + }; + dspi: dspi@210 { compatible = "fsl,vf610-dspi"; #address-cells = <1>; -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 3/5] configs: ls2088a: enable DM support for rtc
Enable related configs to support rtc DM feature for ls2088ardb board. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=109459 - http://patchwork.ozlabs.org/project/uboot/list/?series=113103 Change in v3: - Add configuration options for i2c dm to set default bus number Settings. Change in v2: - No change. configs/ls2088ardb_tfa_SECURE_BOOT_defconfig |9 - configs/ls2088ardb_tfa_defconfig |9 - 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/configs/ls2088ardb_tfa_SECURE_BOOT_defconfig b/configs/ls2088ardb_tfa_SECURE_BOOT_defconfig index d3312c6..abc608f 100644 --- a/configs/ls2088ardb_tfa_SECURE_BOOT_defconfig +++ b/configs/ls2088ardb_tfa_SECURE_BOOT_defconfig @@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_TARGET_LS2080ARDB=y +CONFIG_SYS_MALLOC_F_LEN=0x6000 CONFIG_SYS_TEXT_BASE=0x8200 CONFIG_SECURE_BOOT=y CONFIG_QSPI_AHB_INIT=y @@ -8,7 +9,6 @@ CONFIG_NR_DRAM_BANKS=3 CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y CONFIG_SEC_FIRMWARE_ARMV8_PSCI=y CONFIG_AHCI=y -# CONFIG_SYS_MALLOC_F is not set CONFIG_FIT_VERBOSE=y CONFIG_OF_BOARD_SETUP=y CONFIG_OF_STDOUT_VIA_ALIAS=y @@ -69,3 +69,10 @@ CONFIG_RSA=y CONFIG_SPL_RSA=y CONFIG_RSA_SOFTWARE_EXP=y CONFIG_EFI_LOADER_BOUNCE_BUFFER=y +CONFIG_DM_I2C=y +CONFIG_I2C_SET_DEFAULT_BUS_NUM=y +CONFIG_I2C_DEFAULT_BUS_NUMBER=0 +CONFIG_DM_GPIO=y +CONFIG_I2C_MUX=y +CONFIG_I2C_MUX_PCA954x=y +CONFIG_DM_RTC=y diff --git a/configs/ls2088ardb_tfa_defconfig b/configs/ls2088ardb_tfa_defconfig index 1aa8dd9..c273a75 100644 --- a/configs/ls2088ardb_tfa_defconfig +++ b/configs/ls2088ardb_tfa_defconfig @@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_TARGET_LS2080ARDB=y +CONFIG_SYS_MALLOC_F_LEN=0x6000 CONFIG_SYS_TEXT_BASE=0x8200 CONFIG_QSPI_AHB_INIT=y CONFIG_TFABOOT=y @@ -7,7 +8,6 @@ CONFIG_NR_DRAM_BANKS=3 CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y CONFIG_SEC_FIRMWARE_ARMV8_PSCI=y CONFIG_AHCI=y -# CONFIG_SYS_MALLOC_F is not set CONFIG_FIT_VERBOSE=y CONFIG_OF_BOARD_SETUP=y CONFIG_OF_STDOUT_VIA_ALIAS=y @@ -70,3 +70,10 @@ CONFIG_DM_USB=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_DWC3=y CONFIG_EFI_LOADER_BOUNCE_BUFFER=y +CONFIG_DM_I2C=y +CONFIG_I2C_SET_DEFAULT_BUS_NUM=y +CONFIG_I2C_DEFAULT_BUS_NUMBER=0 +CONFIG_DM_GPIO=y +CONFIG_I2C_MUX=y +CONFIG_I2C_MUX_PCA954x=y +CONFIG_DM_RTC=y -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 2/5] gpio: do not include on ARCH_LS2080A
As no gpio.h is defined for this architecture, to avoid compilation failure, do not include for arch ls2080a. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=109459 - http://patchwork.ozlabs.org/project/uboot/list/?series=113103 Change in v3: - No change. Change in v2: - No change. arch/arm/include/asm/gpio.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/arm/include/asm/gpio.h b/arch/arm/include/asm/gpio.h index f78b976..292adfa 100644 --- a/arch/arm/include/asm/gpio.h +++ b/arch/arm/include/asm/gpio.h @@ -1,7 +1,7 @@ #if !defined(CONFIG_ARCH_UNIPHIER) && !defined(CONFIG_ARCH_STI) && \ !defined(CONFIG_ARCH_K3) && !defined(CONFIG_ARCH_BCM6858) && \ !defined(CONFIG_ARCH_BCM63158) && !defined(CONFIG_ARCH_ROCKCHIP) && \ - !defined(CONFIG_ARCH_LX2160A) + !defined(CONFIG_ARCH_LX2160A) && !defined(CONFIG_ARCH_LS2080A) #include #endif #include -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 1/5] armv8: ls2088a: The ls2088a platform supports the I2C driver model.
DM_I2C_COMPAT is a compatibility layer that allows using the non-DM I2C API when DM_I2C is used.When DM_I2C_COMPAT is not enabled for compilation, a compilation error will be generated. This patch solves the problem that the i2c-related api of the ls2088a platform does not support dm. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=109459 - http://patchwork.ozlabs.org/project/uboot/list/?series=113103 Change in v3: - Change the Kconfig file to !TFABOOT. - Define the use of CONFIG_SYS_I2C for non-dm. - Qualified RDB boards that are not dm are used CONFIG_SYS_I2C_EARLY_INIT. Change in v2: - No change. arch/arm/cpu/armv8/fsl-layerscape/Kconfig | 8 board/freescale/ls2080ardb/ls2080ardb.c | 9 + include/configs/ls2080a_common.h | 2 ++ include/configs/ls2080ardb.h | 2 ++ 4 files changed, 17 insertions(+), 4 deletions(-) diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig index ffda02a..d285565 100644 --- a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig +++ b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig @@ -205,10 +205,10 @@ config ARCH_LS2080A select ARCH_EARLY_INIT_R select BOARD_EARLY_INIT_F select SYS_I2C_MXC - select SYS_I2C_MXC_I2C1 - select SYS_I2C_MXC_I2C2 - select SYS_I2C_MXC_I2C3 - select SYS_I2C_MXC_I2C4 + select SYS_I2C_MXC_I2C1 if !TFABOOT + select SYS_I2C_MXC_I2C2 if !TFABOOT + select SYS_I2C_MXC_I2C3 if !TFABOOT + select SYS_I2C_MXC_I2C4 if !TFABOOT imply DISTRO_DEFAULTS imply PANIC_HANG diff --git a/board/freescale/ls2080ardb/ls2080ardb.c b/board/freescale/ls2080ardb/ls2080ardb.c index ce419df..8833ed3 100644 --- a/board/freescale/ls2080ardb/ls2080ardb.c +++ b/board/freescale/ls2080ardb/ls2080ardb.c @@ -163,7 +163,16 @@ int select_i2c_ch_pca9547(u8 ch) { int ret; +#ifndef CONFIG_DM_I2C ret = i2c_write(I2C_MUX_PCA_ADDR_PRI, 0, 1, &ch, 1); +#else + struct udevice *dev; + + ret = i2c_get_chip_for_busnum(0, I2C_MUX_PCA_ADDR_PRI, 1, &dev); + if (!ret) + ret = dm_i2c_write(dev, 0, &ch, 1); +#endif + if (ret) { puts("PCA: failed to select proper channel\n"); return ret; diff --git a/include/configs/ls2080a_common.h b/include/configs/ls2080a_common.h index c7d8a3b..6be581a 100644 --- a/include/configs/ls2080a_common.h +++ b/include/configs/ls2080a_common.h @@ -75,7 +75,9 @@ #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 2048 * 1024) /* I2C */ +#ifndef CONFIG_DM_I2C #define CONFIG_SYS_I2C +#endif /* Serial Port */ #define CONFIG_SYS_NS16550_SERIAL diff --git a/include/configs/ls2080ardb.h b/include/configs/ls2080ardb.h index bfb54be..2bf8217 100644 --- a/include/configs/ls2080ardb.h +++ b/include/configs/ls2080ardb.h @@ -13,8 +13,10 @@ #ifdef CONFIG_TARGET_LS2081ARDB #define CONFIG_QIXIS_I2C_ACCESS #endif +#ifndef CONFIG_DM_I2C #define CONFIG_SYS_I2C_EARLY_INIT #endif +#endif #define I2C_MUX_CH_VOL_MONITOR 0xa #define I2C_VOL_MONITOR_ADDR 0x38 -- 2.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH] rtc: ds3232/ds3231: Add support to generate 32KHz output for driver module
This patch add an implementation of the rtc_enable_32khz_output() that uses the driver model i2c APIs. Signed-off-by: Chuanhua Han --- drivers/rtc/ds3231.c | 17 + include/rtc.h| 1 + 2 files changed, 18 insertions(+) diff --git a/drivers/rtc/ds3231.c b/drivers/rtc/ds3231.c index 79b026a..2f7bbc2 100644 --- a/drivers/rtc/ds3231.c +++ b/drivers/rtc/ds3231.c @@ -251,6 +251,23 @@ static int ds3231_probe(struct udevice *dev) return 0; } +void rtc_enable_32khz_output(void) +{ + int ret; + struct udevice *dev; + +#ifdef CONFIG_DS3231_BUS_NUM + ret = i2c_get_chip_for_busnum(CONFIG_DS3231_BUS_NUM, + CONFIG_SYS_I2C_RTC_ADDR, 1, &dev); +#else + ret = i2c_get_chip_for_busnum(0, CONFIG_SYS_I2C_RTC_ADDR, 1, &dev); +#endif + if (!ret) + dm_i2c_reg_write(dev, RTC_STAT_REG_ADDR, +RTC_STAT_BIT_BB32KHZ | +RTC_STAT_BIT_EN32KHZ); +} + static const struct rtc_ops ds3231_rtc_ops = { .get = ds3231_rtc_get, .set = ds3231_rtc_set, diff --git a/include/rtc.h b/include/rtc.h index b255bdc..690391e 100644 --- a/include/rtc.h +++ b/include/rtc.h @@ -166,6 +166,7 @@ int rtc_read32(struct udevice *dev, unsigned int reg, u32 *valuep); */ int rtc_write32(struct udevice *dev, unsigned int reg, u32 value); +void rtc_enable_32khz_output(void); #else int rtc_get (struct rtc_time *); int rtc_set (struct rtc_time *); -- 2.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [EXT] Re: [PATCH v4] rtc: Add DM support to ds3231
Hi,tom and Lukasz > -Original Message- > From: Lukasz Majewski > Sent: 2019年7月16日 15:07 > To: Chuanhua Han > Cc: Prabhakar Kushwaha ; > u-boot@lists.denx.de; Tom Rini > Subject: Re: [EXT] Re: [PATCH v4] rtc: Add DM support to ds3231 > > Hi Chuanhua, > > > Hi, Lukasz Majewski > > > > > -Original Message- > > > From: Lukasz Majewski > > > Sent: 2019年6月21日 19:33 > > > To: Chuanhua Han > > > Cc: Prabhakar Kushwaha ; > > > u-boot@lists.denx.de > > > Subject: [EXT] Re: [PATCH v4] rtc: Add DM support to ds3231 > > > > > > On Fri, 21 Jun 2019 16:21:53 +0800 > > > Chuanhua Han wrote: > > > > > > > Add an implementation of the ds3231 driver that uses the driver > > > > model i2c APIs. > > > > > > > > Signed-off-by: Chuanhua Han > > > > --- > > > > Changes in v4: > > > > - Delete the original 'rel' variable in the ds3231_rtc_get > > > > function, return 0 successfully, and return -EINVAL directly when > > > > the RTC oscillator is stopped. > > > > Changes in v3: > > > > - Update copyright information. > > > > Changes in v2: > > > > - Replace "#ifndef CONFIG_DM_RTC" with "#if > > > > !CONFIG_IS_ENABLED(DM_RTC)". > > > > > > > > drivers/rtc/ds3231.c | 107 > > > > +++ 1 file changed, > 107 > > > > insertions(+) > > > > > > > > diff --git a/drivers/rtc/ds3231.c b/drivers/rtc/ds3231.c index > > > > 9352ff87a2..79b026af4b 100644 > > > > --- a/drivers/rtc/ds3231.c > > > > +++ b/drivers/rtc/ds3231.c > > > > @@ -2,6 +2,9 @@ > > > > /* > > > > * (C) Copyright 2006 > > > > * Markus Klotzbuecher, m...@denx.de > > > > + * > > > > + * (C) Copyright 2019 NXP > > > > + * Chuanhua Han > > > > */ > > > > > > > > /* > > > > @@ -13,6 +16,7 @@ > > > > > > > > #include > > > > #include > > > > +#include > > > > #include > > > > #include > > > > > > > > @@ -50,6 +54,7 @@ > > > > #define RTC_STAT_BIT_EN32KHZ 0x8 /* Enable 32KHz > > > > Output */ > > > > > > > > +#if !CONFIG_IS_ENABLED(DM_RTC) > > > > static uchar rtc_read (uchar reg); static void rtc_write (uchar > > > > reg, uchar val); > > > > > > > > @@ -164,3 +169,105 @@ static void rtc_write (uchar reg, uchar > > > > val) { i2c_reg_write (CONFIG_SYS_I2C_RTC_ADDR, reg, val); } > > > > +#else > > > > +static int ds3231_rtc_get(struct udevice *dev, struct rtc_time > > > > *tmp) +{ > > > > + uchar sec, min, hour, mday, wday, mon_cent, year, status; > > > > + > > > > + status = dm_i2c_reg_read(dev, RTC_STAT_REG_ADDR); > > > > + sec = dm_i2c_reg_read(dev, RTC_SEC_REG_ADDR); > > > > + min = dm_i2c_reg_read(dev, RTC_MIN_REG_ADDR); > > > > + hour = dm_i2c_reg_read(dev, RTC_HR_REG_ADDR); > > > > + wday = dm_i2c_reg_read(dev, RTC_DAY_REG_ADDR); > > > > + mday = dm_i2c_reg_read(dev, RTC_DATE_REG_ADDR); > > > > + mon_cent = dm_i2c_reg_read(dev, RTC_MON_REG_ADDR); > > > > + year = dm_i2c_reg_read(dev, RTC_YR_REG_ADDR); > > > > + > > > > + if (status & RTC_STAT_BIT_OSF) { > > > > + printf("### Warning: RTC oscillator has > > > > stopped\n"); > > > > + /* clear the OSF flag */ > > > > + dm_i2c_reg_write(dev, RTC_STAT_REG_ADDR, > > > > +dm_i2c_reg_read(dev, > > > > RTC_STAT_REG_ADDR) > > > > + & > > > > ~RTC_STAT_BIT_OSF); > > > > + return -EINVAL; > > > > + } > > > > + > > > > + tmp->tm_sec = bcd2bin(sec & 0x7F); > > > > + tmp->tm_min = bcd2bin(min & 0x7F); > > > > + tmp->tm_hour = bcd2bin(hour & 0x3F); > > > > + tmp->tm_mday = bcd2bin(mday & 0x3F); > > > > + tmp->tm_mon = bcd2bin(mon_cent & 0x1F); > > > > + tmp->tm_year
Re: [U-Boot] [EXT] Re: [PATCH v4] rtc: Add DM support to ds3231
Hi, Lukasz Majewski > -Original Message- > From: Lukasz Majewski > Sent: 2019年6月21日 19:33 > To: Chuanhua Han > Cc: Prabhakar Kushwaha ; > u-boot@lists.denx.de > Subject: [EXT] Re: [PATCH v4] rtc: Add DM support to ds3231 > > On Fri, 21 Jun 2019 16:21:53 +0800 > Chuanhua Han wrote: > > > Add an implementation of the ds3231 driver that uses the driver model > > i2c APIs. > > > > Signed-off-by: Chuanhua Han > > --- > > Changes in v4: > > - Delete the original 'rel' variable in the ds3231_rtc_get function, > > return 0 successfully, and return -EINVAL directly when the RTC > > oscillator is stopped. > > Changes in v3: > > - Update copyright information. > > Changes in v2: > > - Replace "#ifndef CONFIG_DM_RTC" with "#if > > !CONFIG_IS_ENABLED(DM_RTC)". > > > > drivers/rtc/ds3231.c | 107 > > +++ 1 file changed, 107 > > insertions(+) > > > > diff --git a/drivers/rtc/ds3231.c b/drivers/rtc/ds3231.c index > > 9352ff87a2..79b026af4b 100644 > > --- a/drivers/rtc/ds3231.c > > +++ b/drivers/rtc/ds3231.c > > @@ -2,6 +2,9 @@ > > /* > > * (C) Copyright 2006 > > * Markus Klotzbuecher, m...@denx.de > > + * > > + * (C) Copyright 2019 NXP > > + * Chuanhua Han > > */ > > > > /* > > @@ -13,6 +16,7 @@ > > > > #include > > #include > > +#include > > #include > > #include > > > > @@ -50,6 +54,7 @@ > > #define RTC_STAT_BIT_EN32KHZ 0x8 /* Enable 32KHz > > Output */ > > > > +#if !CONFIG_IS_ENABLED(DM_RTC) > > static uchar rtc_read (uchar reg); > > static void rtc_write (uchar reg, uchar val); > > > > @@ -164,3 +169,105 @@ static void rtc_write (uchar reg, uchar val) { > > i2c_reg_write (CONFIG_SYS_I2C_RTC_ADDR, reg, val); } > > +#else > > +static int ds3231_rtc_get(struct udevice *dev, struct rtc_time *tmp) > > +{ > > + uchar sec, min, hour, mday, wday, mon_cent, year, status; > > + > > + status = dm_i2c_reg_read(dev, RTC_STAT_REG_ADDR); > > + sec = dm_i2c_reg_read(dev, RTC_SEC_REG_ADDR); > > + min = dm_i2c_reg_read(dev, RTC_MIN_REG_ADDR); > > + hour = dm_i2c_reg_read(dev, RTC_HR_REG_ADDR); > > + wday = dm_i2c_reg_read(dev, RTC_DAY_REG_ADDR); > > + mday = dm_i2c_reg_read(dev, RTC_DATE_REG_ADDR); > > + mon_cent = dm_i2c_reg_read(dev, RTC_MON_REG_ADDR); > > + year = dm_i2c_reg_read(dev, RTC_YR_REG_ADDR); > > + > > + if (status & RTC_STAT_BIT_OSF) { > > + printf("### Warning: RTC oscillator has stopped\n"); > > + /* clear the OSF flag */ > > + dm_i2c_reg_write(dev, RTC_STAT_REG_ADDR, > > +dm_i2c_reg_read(dev, > > RTC_STAT_REG_ADDR) > > + & ~RTC_STAT_BIT_OSF); > > + return -EINVAL; > > + } > > + > > + tmp->tm_sec = bcd2bin(sec & 0x7F); > > + tmp->tm_min = bcd2bin(min & 0x7F); > > + tmp->tm_hour = bcd2bin(hour & 0x3F); > > + tmp->tm_mday = bcd2bin(mday & 0x3F); > > + tmp->tm_mon = bcd2bin(mon_cent & 0x1F); > > + tmp->tm_year = bcd2bin(year) + ((mon_cent & 0x80) ? 2000 : > > 1900); > > + tmp->tm_wday = bcd2bin((wday - 1) & 0x07); > > + tmp->tm_yday = 0; > > + tmp->tm_isdst = 0; > > + > > + debug("Get DATE: %4d-%02d-%02d (wday=%d) TIME: > > %2d:%02d:%02d\n", > > + tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday, > > + tmp->tm_hour, tmp->tm_min, tmp->tm_sec); > > + > > + return 0; > > +} > > + > > +static int ds3231_rtc_set(struct udevice *dev, const struct rtc_time > > *tmp) +{ > > + uchar century; > > + > > + debug("Set DATE: %4d-%02d-%02d (wday=%d) TIME: > > %2d:%02d:%02d\n", > > + tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday, > > + tmp->tm_hour, tmp->tm_min, tmp->tm_sec); > > + > > + dm_i2c_reg_write(dev, RTC_YR_REG_ADDR, bin2bcd(tmp->tm_year > > % 100)); + > > + century = (tmp->tm_year >= 2000) ? 0x80 : 0; > > + dm_i2c_reg_write(dev, RTC_MON_REG_ADDR, bin2bcd(tmp->tm_mon) > > | century); + > > + dm_i2c_reg_write(dev, RTC_DAY_REG_ADDR, bin2bcd(tmp->tm_wday > 1)); > > + dm_i2c_reg_write(dev, RTC_DATE_REG_ADDR, > > bin2bcd(tmp->tm_mday)); &
Re: [U-Boot] [EXT] Re: [PATCH 2/4] configs: ls1028aqds: Enable DM support for pcf2127 rtc
> -Original Message- > From: Alex Marginean > Sent: 2019年7月15日 16:09 > To: Chuanhua Han ; Prabhakar Kushwaha > ; albert.u.b...@aribaud.net; Andy Tang > ; Sudhanshu Gupta ; > Harninder Rai ; Rajesh Bhagat > > Cc: u-boot@lists.denx.de > Subject: Re: [EXT] Re: [U-Boot] [PATCH 2/4] configs: ls1028aqds: Enable DM > support for pcf2127 rtc > > Caution: EXT Email > > On 7/15/2019 10:20 AM, Chuanhua Han wrote: > > > >> -Original Message- > >> From: Alex Marginean > >> Sent: 2019年7月15日 15:16 > [...] > >> > >> On 7/10/2019 10:48 AM, Chuanhua Han wrote: > >>> Enable related configs on all ls1028aqds boards to support pcf2127 > >>> rtc DM function. > >>> > >>> Signed-off-by: Chuanhua Han > >>> --- > [...] > >>>configs/ls1028aqds_tfa_SECURE_BOOT_defconfig | 11 ++- > >>>configs/ls1028aqds_tfa_defconfig | 11 ++- > >>>2 files changed, 20 insertions(+), 2 deletions(-) > >>> > >> date command doesn't seem to work at my end: > >> => date > >> wait_for_sr_state: Arbitration lost sr=92 cr=0 state=2020 > >> i2c_init_transfer: failed for chip 0x51 retry=0 > >> wait_for_sr_state: Arbitration lost sr=92 cr=0 state=2020 > >> i2c_init_transfer: failed for chip 0x51 retry=1 > >> wait_for_sr_state: Arbitration lost sr=92 cr=0 state=2020 > >> i2c_init_transfer: failed for chip 0x51 retry=2 > >> i2c_init_transfer: give up i2c_regs=0x201 ## Get date failed > > No, You need to apply the fix pcf2127-rtc patch first. > > https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatch > > > work.ozlabs.org%2Fpatch%2F1128859%2F&data=02%7C01%7Cchuanhu > a.han%4 > > > 0nxp.com%7C690e3343c4594b1b974208d708fbb5a3%7C686ea1d3bc2b4c6f > a92cd99c > > > 5c301635%7C0%7C0%7C636987749492274084&sdata=F732QTXsPutbe > 7JZCSf%2F > > dII2lDJC9CdIyTLYAeGnsxY%3D&reserved=0 > > I do have it applied: > $ git log | grep "rtc: pcf2127:" > rtc: pcf2127: Fixed bug with rtc settings and getting error time > > In fact the fix was merged: > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgitlab.d > enx.de%2Fu-boot%2Fu-boot%2Fcommit%2Fef6c26d338a168110b7688b07e3 > 19ff46c73748d&data=02%7C01%7Cchuanhua.han%40nxp.com%7C690e > 3343c4594b1b974208d708fbb5a3%7C686ea1d3bc2b4c6fa92cd99c5c301635 > %7C0%7C0%7C636987749492274084&sdata=fwWYzMv18hJakNOLDHTr > AdaxTAGWfPZviRaRtyCCbdg%3D&reserved=0 > > Anyway, it could be an issue on my side, I just noticed it and thought I > should > let you know. You can use openstream tree. > > Thanks! > Alex > > > > >> other than that it looks OK. > >> > >> Reviewed-by: Alex Marginean > >> Tested-by: Alex Marginean ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [EXT] Re: [PATCH 2/4] configs: ls1028aqds: Enable DM support for pcf2127 rtc
> -Original Message- > From: Alex Marginean > Sent: 2019年7月15日 15:16 > To: Chuanhua Han ; Prabhakar Kushwaha > ; albert.u.b...@aribaud.net; Andy Tang > ; Sudhanshu Gupta ; > Harninder Rai ; Rajesh Bhagat > > Cc: u-boot@lists.denx.de > Subject: [EXT] Re: [U-Boot] [PATCH 2/4] configs: ls1028aqds: Enable DM > support for pcf2127 rtc > > Caution: EXT Email > > On 7/10/2019 10:48 AM, Chuanhua Han wrote: > > Enable related configs on all ls1028aqds boards to support pcf2127 rtc > > DM function. > > > > Signed-off-by: Chuanhua Han > > --- > > depends on: > > - > https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatchwo > rk.ozlabs.org%2Fproject%2Fuboot%2Flist%2F%3Fseries%3D117203&data > =02%7C01%7Cchuanhua.han%40nxp.com%7C817d847ff0354fbe1aad08d708f > 44625%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C6369877175 > 48591048&sdata=opbvJeeagqt4bcMU6afno3a6d6QwSFphkfTs2324eDI% > 3D&reserved=0 > > - > https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatchwo > rk.ozlabs.org%2Fproject%2Fuboot%2Flist%2F%3Fseries%3D117224&data > =02%7C01%7Cchuanhua.han%40nxp.com%7C817d847ff0354fbe1aad08d708f > 44625%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C6369877175 > 48601042&sdata=3JzYgVuNprnWXXg41y%2Bpb4GJTVzmbt4McAwJnZx2v > tY%3D&reserved=0 > > - > > https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fpatch > > > work.ozlabs.org%2Fproject%2Fuboot%2Flist%2F%3Fseries%3D118231&d > ata > > > =02%7C01%7Cchuanhua.han%40nxp.com%7C817d847ff0354fbe1aad08d708f > 44625%7 > > > C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C63698771754860104 > 2&sda > > > ta=ilmiN7mqR8pyUEzLLhnwWPpSfm0uV%2BQBbxyCZESXkpA%3D&reser > ved=0 > > > > configs/ls1028aqds_tfa_SECURE_BOOT_defconfig | 11 ++- > > configs/ls1028aqds_tfa_defconfig | 11 ++- > > 2 files changed, 20 insertions(+), 2 deletions(-) > > > > date command doesn't seem to work at my end: > => date > wait_for_sr_state: Arbitration lost sr=92 cr=0 state=2020 > i2c_init_transfer: failed for chip 0x51 retry=0 > wait_for_sr_state: Arbitration lost sr=92 cr=0 state=2020 > i2c_init_transfer: failed for chip 0x51 retry=1 > wait_for_sr_state: Arbitration lost sr=92 cr=0 state=2020 > i2c_init_transfer: failed for chip 0x51 retry=2 > i2c_init_transfer: give up i2c_regs=0x201 ## Get date failed No, You need to apply the fix pcf2127-rtc patch first. http://patchwork.ozlabs.org/patch/1128859/ > > other than that it looks OK. > > Reviewed-by: Alex Marginean > Tested-by: Alex Marginean ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [EXT] Re: [PATCH 1/2] armv8: ls1028aqds: switch LS1028A QDS board to I2C DM
Hi, I have already sent the patch set of ls1028aqds i2c dm. Please check the patchwork link below: https://patchwork.ozlabs.org/project/uboot/list/?series=1187093 Thanks, Chuanhua > -Original Message- > From: Bin Meng > Sent: 2019年7月13日 11:47 > To: Alexandru Marginean > Cc: U-Boot Mailing List ; Chuanhua Han > > Subject: [EXT] Re: [U-Boot] [PATCH 1/2] armv8: ls1028aqds: switch LS1028A QDS > board to I2C DM > > Caution: EXT Email > > On Fri, Jul 12, 2019 at 7:25 PM Alex Marginean > wrote: > > > > Replace legacy I2C_EARLY_INIT with dm-pre-reloc dts property. > > > > Signed-off-by: Alex Marginean > > --- > > > > Depends on this patch series: > > https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fpatc > > > hwork.ozlabs.org%2Fproject%2Fuboot%2Flist%2F%3Fseries%3D118778&d > at > > > a=02%7C01%7Cchuanhua.han%40nxp.com%7C1cfa23cba36241e0876208d707 > 44cdd6% > > > 7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C636985864401799867 > &sd > > > ata=Uv7WjXfc7wlcJ9kNb1soveXOFH4MkTmVjL2nsBlrac0%3D&reserved=0 > > > > arch/arm/dts/fsl-ls1028a-qds.dts | 1 + > > include/configs/ls1028aqds.h | 1 - > > 2 files changed, 1 insertion(+), 1 deletion(-) > > > > Reviewed-by: Bin Meng > > Maybe we need another separate patch to remove i2c_early_init_f() call in > board_early_init_f() in board/freescale/ls1028a/ls1028a.c? > > Regards, > Bin ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [PATCH 2/2] configs: ls1028aqds: enable I2C and GPIO DM
Hi,Alex I have already sent the patch set of ls1028aqds i2c dm. Please check the patchwork link below: https://patchwork.ozlabs.org/project/uboot/list/?series=118709 thanks, Chaunhua > -Original Message- > From: Alex Marginean > Sent: 2019年7月12日 19:23 > To: u-boot@lists.denx.de > Cc: Chuanhua Han ; Prabhakar Kushwaha > ; Alex Marginean > Subject: [PATCH 2/2] configs: ls1028aqds: enable I2C and GPIO DM > > LS1028A was already converted to I2C/GPIO DM, move the QDS board over too. > > Signed-off-by: Alex Marginean > --- > configs/ls1028aqds_tfa_SECURE_BOOT_defconfig | 5 - > configs/ls1028aqds_tfa_defconfig | 5 - > 2 files changed, 8 insertions(+), 2 deletions(-) > > diff --git a/configs/ls1028aqds_tfa_SECURE_BOOT_defconfig > b/configs/ls1028aqds_tfa_SECURE_BOOT_defconfig > index 4a2b354008..76c9af5ef3 100644 > --- a/configs/ls1028aqds_tfa_SECURE_BOOT_defconfig > +++ b/configs/ls1028aqds_tfa_SECURE_BOOT_defconfig > @@ -1,5 +1,6 @@ > CONFIG_ARM=y > CONFIG_TARGET_LS1028AQDS=y > +CONFIG_SYS_MALLOC_F_LEN=0x6000 > CONFIG_SECURE_BOOT=y > CONFIG_SYS_FSL_SDHC_CLK_DIV=1 > CONFIG_TFABOOT=y > @@ -8,7 +9,6 @@ CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y > CONFIG_SEC_FIRMWARE_ARMV8_PSCI=y > CONFIG_AHCI=y > CONFIG_DISTRO_DEFAULTS=y > -# CONFIG_SYS_MALLOC_F is not set > CONFIG_FIT_VERBOSE=y > CONFIG_OF_BOARD_SETUP=y > CONFIG_OF_STDOUT_VIA_ALIAS=y > @@ -31,6 +31,9 @@ CONFIG_NETCONSOLE=y > CONFIG_DM=y > CONFIG_SCSI_AHCI=y > CONFIG_SATA_CEVA=y > +CONFIG_DM_GPIO=y > +CONFIG_DM_I2C=y > +CONFIG_I2C_SET_DEFAULT_BUS_NUM=y > CONFIG_DM_MMC=y > CONFIG_FSL_ESDHC=y > CONFIG_DM_SPI_FLASH=y > diff --git a/configs/ls1028aqds_tfa_defconfig > b/configs/ls1028aqds_tfa_defconfig > index b315910414..7c98474d73 100644 > --- a/configs/ls1028aqds_tfa_defconfig > +++ b/configs/ls1028aqds_tfa_defconfig > @@ -1,5 +1,6 @@ > CONFIG_ARM=y > CONFIG_TARGET_LS1028AQDS=y > +CONFIG_SYS_MALLOC_F_LEN=0x6000 > CONFIG_SYS_FSL_SDHC_CLK_DIV=1 > CONFIG_TFABOOT=y > CONFIG_NR_DRAM_BANKS=2 > @@ -7,7 +8,6 @@ CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y > CONFIG_SEC_FIRMWARE_ARMV8_PSCI=y > CONFIG_AHCI=y > CONFIG_DISTRO_DEFAULTS=y > -# CONFIG_SYS_MALLOC_F is not set > CONFIG_FIT_VERBOSE=y > CONFIG_OF_BOARD_SETUP=y > CONFIG_OF_STDOUT_VIA_ALIAS=y > @@ -34,6 +34,9 @@ CONFIG_DM=y > CONFIG_SCSI_AHCI=y > CONFIG_SATA_CEVA=y > CONFIG_FSL_CAAM=y > +CONFIG_DM_GPIO=y > +CONFIG_DM_I2C=y > +CONFIG_I2C_SET_DEFAULT_BUS_NUM=y > CONFIG_DM_MMC=y > CONFIG_FSL_ESDHC=y > CONFIG_DM_SPI_FLASH=y > -- > 2.17.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v4 4/4] armv8: dts: ls1028ardb: Add slave nodes under the i2c0 controller
This patch adds some slave nodes to support the i2c dm on the device side under the i2c0 controller. Signed-off-by: Chuanhua Han --- depends on: - https://patchwork.ozlabs.org/project/uboot/list/?series=113364 - https://patchwork.ozlabs.org/project/uboot/list/?series=110856 - https://patchwork.ozlabs.org/project/uboot/list/?series=109677 Changes in v4: - No change. Changes in v3: - Delete unnecessary i2c slave nodes. Changes in v2: - Delete unnecessary aliases about i2c. arch/arm/dts/fsl-ls1028a-rdb.dts | 20 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/arch/arm/dts/fsl-ls1028a-rdb.dts b/arch/arm/dts/fsl-ls1028a-rdb.dts index 932cfa2..541c9bf 100644 --- a/arch/arm/dts/fsl-ls1028a-rdb.dts +++ b/arch/arm/dts/fsl-ls1028a-rdb.dts @@ -37,6 +37,26 @@ &i2c0 { status = "okay"; + u-boot,dm-pre-reloc; + +i2c-mux@77 { + + compatible = "nxp,pca9547"; + reg = <0x77>; + #address-cells = <1>; + #size-cells = <0>; + + i2c@3 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0x3>; + + rtc@51 { + compatible = "pcf2127-rtc"; + reg = <0x51>; + }; + }; + }; }; &i2c1 { -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v4 3/4] configs: ls1028a: enable DM support for pcf2127 rtc
Enable related configs to support pcf2127 rtc DM feature for ls1028ardb board. Signed-off-by: Chuanhua Han --- depends on: - https://patchwork.ozlabs.org/project/uboot/list/?series=113364 - https://patchwork.ozlabs.org/project/uboot/list/?series=110856 - https://patchwork.ozlabs.org/project/uboot/list/?series=109677 Changes in v4: - Add configuration options for i2c dm to set default bus number Settings. Changes in v3: - No change. Changes in v2: - Enable secure boot defconfig to support pcf2127 rtc DM feature for ls1028ardb board. configs/ls1028ardb_tfa_SECURE_BOOT_defconfig |11 ++- configs/ls1028ardb_tfa_defconfig |11 ++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/configs/ls1028ardb_tfa_SECURE_BOOT_defconfig b/configs/ls1028ardb_tfa_SECURE_BOOT_defconfig index 3432f90..c101a33 100644 --- a/configs/ls1028ardb_tfa_SECURE_BOOT_defconfig +++ b/configs/ls1028ardb_tfa_SECURE_BOOT_defconfig @@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_TARGET_LS1028ARDB=y +CONFIG_SYS_MALLOC_F_LEN=0x6000 CONFIG_SECURE_BOOT=y CONFIG_SYS_FSL_SDHC_CLK_DIV=1 CONFIG_TFABOOT=y @@ -8,7 +9,6 @@ CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y CONFIG_SEC_FIRMWARE_ARMV8_PSCI=y CONFIG_AHCI=y CONFIG_DISTRO_DEFAULTS=y -# CONFIG_SYS_MALLOC_F is not set CONFIG_FIT_VERBOSE=y CONFIG_OF_BOARD_SETUP=y CONFIG_OF_STDOUT_VIA_ALIAS=y @@ -60,3 +60,12 @@ CONFIG_WDT=y CONFIG_WDT_SP805=y CONFIG_RSA=y CONFIG_EFI_LOADER_BOUNCE_BUFFER=y +CONFIG_DM_I2C=y +CONFIG_I2C_SET_DEFAULT_BUS_NUM=y +CONFIG_I2C_DEFAULT_BUS_NUMBER=0 +CONFIG_DM_RTC=y +CONFIG_DM_GPIO=y +CONFIG_CMD_DATE=y +CONFIG_RTC_PCF2127=y +CONFIG_I2C_MUX=y +CONFIG_I2C_MUX_PCA954x=y diff --git a/configs/ls1028ardb_tfa_defconfig b/configs/ls1028ardb_tfa_defconfig index c65e37d..a2fe8d6 100644 --- a/configs/ls1028ardb_tfa_defconfig +++ b/configs/ls1028ardb_tfa_defconfig @@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_TARGET_LS1028ARDB=y +CONFIG_SYS_MALLOC_F_LEN=0x6000 CONFIG_SYS_FSL_SDHC_CLK_DIV=1 CONFIG_TFABOOT=y CONFIG_NR_DRAM_BANKS=2 @@ -7,7 +8,6 @@ CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y CONFIG_SEC_FIRMWARE_ARMV8_PSCI=y CONFIG_AHCI=y CONFIG_DISTRO_DEFAULTS=y -# CONFIG_SYS_MALLOC_F is not set CONFIG_FIT_VERBOSE=y CONFIG_OF_BOARD_SETUP=y CONFIG_OF_STDOUT_VIA_ALIAS=y @@ -63,3 +63,12 @@ CONFIG_USB_XHCI_DWC3=y CONFIG_WDT=y CONFIG_WDT_SP805=y CONFIG_EFI_LOADER_BOUNCE_BUFFER=y +CONFIG_DM_I2C=y +CONFIG_I2C_SET_DEFAULT_BUS_NUM=y +CONFIG_I2C_DEFAULT_BUS_NUMBER=0 +CONFIG_DM_RTC=y +CONFIG_DM_GPIO=y +CONFIG_CMD_DATE=y +CONFIG_RTC_PCF2127=y +CONFIG_I2C_MUX=y +CONFIG_I2C_MUX_PCA954x=y -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v4 2/4] gpio: do not include on ARCH_LS1028A
As no gpio.h is defined for this architecture, to avoid compilation failure, do not include for arch ls1028a. Signed-off-by: Chuanhua Han --- depends on: - https://patchwork.ozlabs.org/project/uboot/list/?series=113364 - https://patchwork.ozlabs.org/project/uboot/list/?series=110856 - https://patchwork.ozlabs.org/project/uboot/list/?series=109677 Changes in v4: - No change. Changes in v3: - No change. Changes in v2: - No change. arch/arm/include/asm/gpio.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/arm/include/asm/gpio.h b/arch/arm/include/asm/gpio.h index f78b976..b5adf5c 100644 --- a/arch/arm/include/asm/gpio.h +++ b/arch/arm/include/asm/gpio.h @@ -1,7 +1,7 @@ #if !defined(CONFIG_ARCH_UNIPHIER) && !defined(CONFIG_ARCH_STI) && \ !defined(CONFIG_ARCH_K3) && !defined(CONFIG_ARCH_BCM6858) && \ !defined(CONFIG_ARCH_BCM63158) && !defined(CONFIG_ARCH_ROCKCHIP) && \ - !defined(CONFIG_ARCH_LX2160A) + !defined(CONFIG_ARCH_LX2160A) && !defined(CONFIG_ARCH_LS1028A) #include #endif #include -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v4 1/4] armv8: ls1028a: The ls1028a platform supports the I2C driver model
DM_I2C_COMPAT is a compatibility layer that allows using the non-DM I2C API when DM_I2C is used.When DM_I2C_COMPAT is not enabled for compilation, a compilation error will be generated. This patch solves the problem that the i2c-related api of the ls1028a platform does not support dm. Signed-off-by: Chuanhua Han --- depends on: - https://patchwork.ozlabs.org/project/uboot/list/?series=113364 - https://patchwork.ozlabs.org/project/uboot/list/?series=110856 - https://patchwork.ozlabs.org/project/uboot/list/?series=109677 Changes in v4: - No change. Changes in v3: - No change. Changes in v2: - No change. arch/arm/cpu/armv8/fsl-layerscape/Kconfig |8 board/freescale/ls1028a/ls1028a.c |8 include/configs/ls1028a_common.h |3 --- include/configs/ls1028ardb.h |1 - 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig index ffda02a..d6ef7fc 100644 --- a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig +++ b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig @@ -40,14 +40,6 @@ config ARCH_LS1028A select ARCH_EARLY_INIT_R select BOARD_EARLY_INIT_F select SYS_I2C_MXC - select SYS_I2C_MXC_I2C1 - select SYS_I2C_MXC_I2C2 - select SYS_I2C_MXC_I2C3 - select SYS_I2C_MXC_I2C4 - select SYS_I2C_MXC_I2C5 - select SYS_I2C_MXC_I2C6 - select SYS_I2C_MXC_I2C7 - select SYS_I2C_MXC_I2C8 select SYS_FSL_ERRATUM_A008997 select SYS_FSL_ERRATUM_A009007 select SYS_FSL_ERRATUM_A008514 if !TFABOOT diff --git a/board/freescale/ls1028a/ls1028a.c b/board/freescale/ls1028a/ls1028a.c index e5de4eb..49a9292 100644 --- a/board/freescale/ls1028a/ls1028a.c +++ b/board/freescale/ls1028a/ls1028a.c @@ -73,7 +73,15 @@ int board_init(void) #if defined(CONFIG_TARGET_LS1028ARDB) u8 val = I2C_MUX_CH_DEFAULT; +#ifndef CONFIG_DM_I2C i2c_write(I2C_MUX_PCA_ADDR_PRI, 0x0b, 1, &val, 1); +#else + struct udevice *dev; + + if (!i2c_get_chip_for_busnum(0, I2C_MUX_PCA_ADDR_PRI, 1, &dev)) + dm_i2c_write(dev, 0x0b, &val, 1); +#endif + #endif return 0; } diff --git a/include/configs/ls1028a_common.h b/include/configs/ls1028a_common.h index d3d787f..0fa5095 100644 --- a/include/configs/ls1028a_common.h +++ b/include/configs/ls1028a_common.h @@ -41,9 +41,6 @@ /* Size of malloc() pool */ #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 2048 * 1024) -/* I2C */ -#define CONFIG_SYS_I2C - /* Serial Port */ #define CONFIG_CONS_INDEX 1 #define CONFIG_SYS_NS16550_SERIAL diff --git a/include/configs/ls1028ardb.h b/include/configs/ls1028ardb.h index 10791be..b77c36d 100644 --- a/include/configs/ls1028ardb.h +++ b/include/configs/ls1028ardb.h @@ -22,7 +22,6 @@ #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE #define CONFIG_QIXIS_I2C_ACCESS -#define CONFIG_SYS_I2C_EARLY_INIT /* * QIXIS Definitions -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 1/2] configs: lx2160aqds: enable DM support for pcf2127 rtc
Enable related configs on all lx2160aqds boards to support pcf2127 rtc DM function. Signed-off-by: Chuanhua Han --- depends on: - https://patchwork.ozlabs.org/project/uboot/list/?series=117203 - https://patchwork.ozlabs.org/project/uboot/list/?series=114242 Changes in v3: - Add configuration options for i2c dm to set default bus number Settings. Changes in v2: - Add dependency patch links. configs/lx2160aqds_tfa_SECURE_BOOT_defconfig |9 + configs/lx2160aqds_tfa_defconfig |9 + 2 files changed, 18 insertions(+), 0 deletions(-) diff --git a/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig b/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig index a6a253f..949b00d 100644 --- a/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig +++ b/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig @@ -61,3 +61,12 @@ CONFIG_RSA=y CONFIG_SPL_RSA=y CONFIG_RSA_SOFTWARE_EXP=y CONFIG_EFI_LOADER_BOUNCE_BUFFER=y +CONFIG_DM_I2C=y +CONFIG_I2C_SET_DEFAULT_BUS_NUM=y +CONFIG_I2C_DEFAULT_BUS_NUMBER=0 +CONFIG_DM_RTC=y +CONFIG_DM_GPIO=y +CONFIG_CMD_DATE=y +CONFIG_RTC_PCF2127=y +CONFIG_I2C_MUX=y +CONFIG_I2C_MUX_PCA954x=y diff --git a/configs/lx2160aqds_tfa_defconfig b/configs/lx2160aqds_tfa_defconfig index d68b40d..395fc0b 100644 --- a/configs/lx2160aqds_tfa_defconfig +++ b/configs/lx2160aqds_tfa_defconfig @@ -57,3 +57,12 @@ CONFIG_DM_USB=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_DWC3=y CONFIG_EFI_LOADER_BOUNCE_BUFFER=y +CONFIG_DM_I2C=y +CONFIG_I2C_SET_DEFAULT_BUS_NUM=y +CONFIG_I2C_DEFAULT_BUS_NUMBER=0 +CONFIG_DM_RTC=y +CONFIG_DM_GPIO=y +CONFIG_CMD_DATE=y +CONFIG_RTC_PCF2127=y +CONFIG_I2C_MUX=y +CONFIG_I2C_MUX_PCA954x=y -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 2/2] armv8: lx2160aqds : Add pcf2127 node
This patch adds the pcf2127-rtc node under the i2c0->i2c-mux@77->i2c@3 for lx2160aqds boards. Signed-off-by: Chuanhua Han --- depends on: - https://patchwork.ozlabs.org/project/uboot/list/?series=117203 - https://patchwork.ozlabs.org/project/uboot/list/?series=114242 Changes in v3: - No change. Changes in v2: - Add dependency patch links. arch/arm/dts/fsl-lx2160a-qds.dts | 23 +++ 1 files changed, 23 insertions(+), 0 deletions(-) diff --git a/arch/arm/dts/fsl-lx2160a-qds.dts b/arch/arm/dts/fsl-lx2160a-qds.dts index 99836c4..34df0f5 100644 --- a/arch/arm/dts/fsl-lx2160a-qds.dts +++ b/arch/arm/dts/fsl-lx2160a-qds.dts @@ -23,6 +23,29 @@ status = "okay"; }; +&i2c0 { + status = "okay"; + u-boot,dm-pre-reloc; + + i2c-mux@77 { + compatible = "nxp,pca9547"; + reg = <0x77>; + #address-cells = <1>; + #size-cells = <0>; + + i2c@3 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0x3>; + + rtc@51 { + compatible = "pcf2127-rtc"; + reg = <0x51>; + }; + }; + }; +}; + &sata0 { status = "okay"; }; -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v4 3/7] drivers: i2c: mxc: Solve the compiler error when using i2c dm mode
This patch solved the following compilation error: 1.Remove the definition of CONFIG_SYS_I2C to solve the following compilation issue: In file included from include/config.h:8:0, from include/common.h:20: include/config_fallbacks.h:51:4: error: #error "Cannot define CONFIG_SYS_I2C when CONFIG_DM_I2C is used" # error "Cannot define CONFIG_SYS_I2C when CONFIG_DM_I2C is used" ^ In file included from include/config.h:8:0, from include/common.h:20: include/config_fallbacks.h:51:4: error: #error "Cannot define CONFIG_SYS_I2C when CONFIG_DM_I2C is used" # error "Cannot define CONFIG_SYS_I2C when CONFIG_DM_I2C is used" ^ 2.Remove the definition of CONFIG_SYS_I2C_EARLY_INIT to solve the following compilation issue: board/freescale/lx2160a/lx2160a.c: In function 'board_early_init_f': board/freescale/lx2160a/lx2160a.c:108:2: warning: implicit declaration of function 'i2c_early_init_f'; did you mean 'arch_early_init_r'? [-Wimplicit-function-declaration] i2c_early_init_f(); ^~~~ arch_early_init_r 3.Move the enable_i2c_clk function definition to resolve the following compilation issues: drivers/i2c/mxc_i2c.c: In function 'mxc_i2c_probe': drivers/i2c/mxc_i2c.c:824:8: warning: implicit declaration of function 'enable_i2c_clk'; did you mean 'enable_irq_wake'? [-Wimplicit-function-declaration] ret = enable_i2c_clk(1, bus->seq); ^~ enable_irq_wake Signed-off-by: Chuanhua Han --- Changes in v4: - No change. Changes in v3: - No change. Changes in v2: - No change. arch/arm/include/asm/arch-fsl-layerscape/config.h |2 -- drivers/i2c/mxc_i2c.c | 15 --- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/arch/arm/include/asm/arch-fsl-layerscape/config.h b/arch/arm/include/asm/arch-fsl-layerscape/config.h index eb21c09..5f87499 100644 --- a/arch/arm/include/asm/arch-fsl-layerscape/config.h +++ b/arch/arm/include/asm/arch-fsl-layerscape/config.h @@ -178,8 +178,6 @@ #elif defined(CONFIG_ARCH_LX2160A) #define TZPC_BASE 0x0220 #define TZPCDECPROT_0_SET_BASE (TZPC_BASE + 0x804) -#define CONFIG_SYS_I2C -#define CONFIG_SYS_I2C_EARLY_INIT #define SRDS_MAX_LANES 8 #ifndef L1_CACHE_BYTES #define L1_CACHE_SHIFT 6 diff --git a/drivers/i2c/mxc_i2c.c b/drivers/i2c/mxc_i2c.c index 23119cc..73b9807 100644 --- a/drivers/i2c/mxc_i2c.c +++ b/drivers/i2c/mxc_i2c.c @@ -558,6 +558,14 @@ static int i2c_read_data(struct mxc_i2c_bus *i2c_bus, uchar chip, uchar *buf, return 0; } +int __enable_i2c_clk(unsigned char enable, unsigned int i2c_num) +{ + return 1; +} + +int enable_i2c_clk(unsigned char enable, unsigned int i2c_num) + __attribute__((weak, alias("__enable_i2c_clk"))); + #ifndef CONFIG_DM_I2C /* * Read data from I2C device @@ -723,13 +731,6 @@ static int mxc_i2c_probe(struct i2c_adapter *adap, uint8_t chip) return bus_i2c_write(i2c_get_base(adap), chip, 0, 0, NULL, 0); } -int __enable_i2c_clk(unsigned char enable, unsigned i2c_num) -{ - return 1; -} -int enable_i2c_clk(unsigned char enable, unsigned i2c_num) - __attribute__((weak, alias("__enable_i2c_clk"))); - void bus_i2c_init(int index, int speed, int unused, int (*idle_bus_fn)(void *p), void *idle_bus_data) { -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v4 5/7] armv8: dts: fsl-lx2160a: add i2c controller and gpio DT nodes
In lx2160a soc, there are eight i2c controllers, this patch adds i2c nodes for lx2160a, and the gpio2 nodes on which the i2c4 controller depends. Signed-off-by: Chuanhua Han --- Changes in v4: - No change. Changes in v3: - No change. Changes in v2: - Delete unnecessary clockgen related attributes in the i2c controller node arch/arm/dts/fsl-lx2160a.dtsi | 85 + 1 files changed, 85 insertions(+), 0 deletions(-) diff --git a/arch/arm/dts/fsl-lx2160a.dtsi b/arch/arm/dts/fsl-lx2160a.dtsi index 2822078..a189333 100644 --- a/arch/arm/dts/fsl-lx2160a.dtsi +++ b/arch/arm/dts/fsl-lx2160a.dtsi @@ -49,6 +49,80 @@ <1 10 0x8>; /* Hypervisor PPI, active-low */ }; + i2c0: i2c@200 { + compatible = "fsl,vf610-i2c"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x0 0x200 0x0 0x1>; + interrupts = <0 34 4>; + scl-gpio = <&gpio2 15 0>; + status = "disabled"; + }; + + i2c1: i2c@201 { + compatible = "fsl,vf610-i2c"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x0 0x201 0x0 0x1>; + interrupts = <0 34 4>; + status = "disabled"; + }; + + i2c2: i2c@202 { + compatible = "fsl,vf610-i2c"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x0 0x202 0x0 0x1>; + interrupts = <0 35 4>; + status = "disabled"; + }; + + i2c3: i2c@203 { + compatible = "fsl,vf610-i2c"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x0 0x203 0x0 0x1>; + interrupts = <0 35 4>; + status = "disabled"; + }; + + i2c4: i2c@204 { + compatible = "fsl,vf610-i2c"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x0 0x204 0x0 0x1>; + interrupts = <0 74 4>; + scl-gpio = <&gpio2 16 0>; + status = "disabled"; + }; + + i2c5: i2c@205 { + compatible = "fsl,vf610-i2c"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x0 0x205 0x0 0x1>; + interrupts = <0 74 4>; + status = "disabled"; + }; + + i2c6: i2c@206 { + compatible = "fsl,vf610-i2c"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x0 0x206 0x0 0x1>; + interrupts = <0 75 4>; + status = "disabled"; + }; + + i2c7: i2c@207 { + compatible = "fsl,vf610-i2c"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x0 0x207 0x0 0x1>; + interrupts = <0 75 4>; + status = "disabled"; + }; + uart0: serial@21c { compatible = "arm,pl011"; reg = <0x0 0x21c 0x0 0x1000>; @@ -102,6 +176,17 @@ num-cs = <6>; }; + gpio2: gpio@232 { + compatible = "fsl,qoriq-gpio"; + reg = <0x0 0x232 0x0 0x1>; + interrupts = <0 37 4>; + gpio-controller; + little-endian; + #gpio-cells = <2>; + interrupt-controller; + #interrupt-cells = <2>; + }; + usb0: usb3@310 { compatible = "fsl,layerscape-dwc3"; reg = <0x0 0x310 0x0 0x1>; -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v4 4/7] gpio: do not include on ARCH_LX2160A
As no gpio.h is defined for this architecture, to avoid compilation failure, do not include for arch ls2160a. Signed-off-by: Chuanhua Han --- Changes in v4: - No change. Changes in v3: - No change. Changes in v2: - No change. arch/arm/include/asm/gpio.h |3 ++- 1 files changed, 2 insertions(+), 1 deletions(-) diff --git a/arch/arm/include/asm/gpio.h b/arch/arm/include/asm/gpio.h index 370031f..f78b976 100644 --- a/arch/arm/include/asm/gpio.h +++ b/arch/arm/include/asm/gpio.h @@ -1,6 +1,7 @@ #if !defined(CONFIG_ARCH_UNIPHIER) && !defined(CONFIG_ARCH_STI) && \ !defined(CONFIG_ARCH_K3) && !defined(CONFIG_ARCH_BCM6858) && \ - !defined(CONFIG_ARCH_BCM63158) && !defined(CONFIG_ARCH_ROCKCHIP) + !defined(CONFIG_ARCH_BCM63158) && !defined(CONFIG_ARCH_ROCKCHIP) && \ + !defined(CONFIG_ARCH_LX2160A) #include #endif #include -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v4 7/7] armv8: lx2160ardb : Add the "u-boot, dm-pre-reloc" property for i2c0 node
Lx2160ardb need to use i2c0 before relocation, so we also need to set u-boot,dm-pre-reloc to initialize node before relocation. Signed-off-by: Chuanhua Han --- Changes in v4: - No change. Changes in v3: - Delete unnecessary i2c slave nodes. - Modify the subject and submission information of the patch Changes in v2: - Add "u-boot,dm-pre-reloc" attribute to i2c0 node. arch/arm/dts/fsl-lx2160a-rdb.dts |5 + 1 files changed, 5 insertions(+), 0 deletions(-) diff --git a/arch/arm/dts/fsl-lx2160a-rdb.dts b/arch/arm/dts/fsl-lx2160a-rdb.dts index 8180b86..7b6608b 100644 --- a/arch/arm/dts/fsl-lx2160a-rdb.dts +++ b/arch/arm/dts/fsl-lx2160a-rdb.dts @@ -27,6 +27,11 @@ status = "okay"; }; +&i2c0 { + status = "okay"; + u-boot,dm-pre-reloc; +}; + &i2c4 { status = "okay"; -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v4 6/7] armv8: lx2160ardb: Add pcf2127 node
This patch adds the pcf2127-rtc node under the i2c4 node for lx2160ardb boards. Signed-off-by: Chuanhua Han --- Changes in v4: - No change. Changes in v3: - Modify the submission information of the patch. Changes in v2: - Delete unnecessary aliases about i2c. arch/arm/dts/fsl-lx2160a-rdb.dts |9 + 1 files changed, 9 insertions(+), 0 deletions(-) diff --git a/arch/arm/dts/fsl-lx2160a-rdb.dts b/arch/arm/dts/fsl-lx2160a-rdb.dts index 4b52644..8180b86 100644 --- a/arch/arm/dts/fsl-lx2160a-rdb.dts +++ b/arch/arm/dts/fsl-lx2160a-rdb.dts @@ -27,6 +27,15 @@ status = "okay"; }; +&i2c4 { + status = "okay"; + + rtc@51 { + compatible = "pcf2127-rtc"; + reg = <0x51>; + }; +}; + &sata0 { status = "okay"; }; -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v4 1/7] armv8: lx2160a: The lx2160a platform supports the I2C driver model.
DM_I2C_COMPAT is a compatibility layer that allows using the non-DM I2C API when DM_I2C is used.When DM_I2C_COMPAT is not enabled for compilation, a compilation error will be generated. This patch solves the problem that the i2c-related api of the lx2160a platform does not support dm. Signed-off-by: Chuanhua Han --- Changes in v4: - No change. Changes in v3: - No change. Changes in v2: - No change. arch/arm/cpu/armv8/fsl-layerscape/Kconfig |8 --- board/freescale/common/emc2305.c | 21 +++ board/freescale/common/qixis.c| 17 ++ board/freescale/common/sys_eeprom.c | 84 +++-- board/freescale/common/vid.c | 84 + board/freescale/lx2160a/lx2160a.c |8 +++ drivers/ddr/fsl/main.c| 36 - 7 files changed, 245 insertions(+), 13 deletions(-) diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig index 3f6c983..ffda02a 100644 --- a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig +++ b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig @@ -235,14 +235,6 @@ config ARCH_LX2160A select ARCH_EARLY_INIT_R select BOARD_EARLY_INIT_F select SYS_I2C_MXC - select SYS_I2C_MXC_I2C1 - select SYS_I2C_MXC_I2C2 - select SYS_I2C_MXC_I2C3 - select SYS_I2C_MXC_I2C4 - select SYS_I2C_MXC_I2C5 - select SYS_I2C_MXC_I2C6 - select SYS_I2C_MXC_I2C7 - select SYS_I2C_MXC_I2C8 imply DISTRO_DEFAULTS imply PANIC_HANG imply SCSI diff --git a/board/freescale/common/emc2305.c b/board/freescale/common/emc2305.c index 8523084..b1ca051 100644 --- a/board/freescale/common/emc2305.c +++ b/board/freescale/common/emc2305.c @@ -24,10 +24,22 @@ void set_fan_speed(u8 data) I2C_EMC2305_FAN5}; for (index = 0; index < NUM_OF_FANS; index++) { +#ifndef CONFIG_DM_I2C if (i2c_write(I2C_EMC2305_ADDR, Fan[index], 1, &data, 1) != 0) { printf("Error: failed to change fan speed @%x\n", Fan[index]); } +#else + struct udevice *dev; + + if (i2c_get_chip_for_busnum(0, I2C_EMC2305_ADDR, 1, &dev)) + continue; + + if (dm_i2c_write(dev, Fan[index], &data, 1) != 0) { + printf("Error: failed to change fan speed @%x\n", + Fan[index]); + } +#endif } } @@ -36,6 +48,15 @@ void emc2305_init(void) u8 data; data = I2C_EMC2305_CMD; +#ifndef CONFIG_DM_I2C if (i2c_write(I2C_EMC2305_ADDR, I2C_EMC2305_CONF, 1, &data, 1) != 0) printf("Error: failed to configure EMC2305\n"); +#else + struct udevice *dev; + + if (!i2c_get_chip_for_busnum(0, I2C_EMC2305_ADDR, 1, &dev)) + if (dm_i2c_write(dev, I2C_EMC2305_CONF, &data, 1)) + printf("Error: failed to configure EMC2305\n"); +#endif + } diff --git a/board/freescale/common/qixis.c b/board/freescale/common/qixis.c index f1b98bc..2c4c4ae 100644 --- a/board/freescale/common/qixis.c +++ b/board/freescale/common/qixis.c @@ -24,13 +24,30 @@ #ifdef CONFIG_SYS_I2C_FPGA_ADDR u8 qixis_read_i2c(unsigned int reg) { +#ifndef CONFIG_DM_I2C return i2c_reg_read(CONFIG_SYS_I2C_FPGA_ADDR, reg); +#else + struct udevice *dev; + + if (i2c_get_chip_for_busnum(0, CONFIG_SYS_I2C_FPGA_ADDR, 1, &dev)) + return 0xff; + + return dm_i2c_reg_read(dev, reg); +#endif } void qixis_write_i2c(unsigned int reg, u8 value) { u8 val = value; +#ifndef CONFIG_DM_I2C i2c_reg_write(CONFIG_SYS_I2C_FPGA_ADDR, reg, val); +#else + struct udevice *dev; + + if (!i2c_get_chip_for_busnum(0, CONFIG_SYS_I2C_FPGA_ADDR, 1, &dev)) + dm_i2c_reg_write(dev, reg, val); +#endif + } #endif diff --git a/board/freescale/common/sys_eeprom.c b/board/freescale/common/sys_eeprom.c index ab0fe0b..ff76cef 100644 --- a/board/freescale/common/sys_eeprom.c +++ b/board/freescale/common/sys_eeprom.c @@ -148,23 +148,42 @@ static int read_eeprom(void) { int ret; #ifdef CONFIG_SYS_EEPROM_BUS_NUM +#ifndef CONFIG_DM_I2C unsigned int bus; #endif +#endif if (has_been_read) return 0; #ifdef CONFIG_SYS_EEPROM_BUS_NUM +#ifndef CONFIG_DM_I2C bus = i2c_get_bus_num(); i2c_set_bus_num(CONFIG_SYS_EEPROM_BUS_NUM); #endif +#endif - ret = i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, CONFIG_SYS_I2C_EEPROM_ADDR_LEN, - (void *)&e, sizeof(e)); +#ifndef CONFIG_DM_I2C + ret = i2c_read(CONFIG_SYS_I2C_EEPROM_ADDR, 0, + CONFIG_SYS_I2C_EEPROM_ADDR_LEN, + (void *)&e, sizeof(e))
[U-Boot] [PATCH v4 2/7] configs: lx2160ardb: enable DM support for pcf2127 rtc
Enable related configs on all lx2160ardb boards to support pcf2127 rtc DM feature. Signed-off-by: Chuanhua Han Signed-off-by: Biwen Li --- Changes in v4: - Add configuration options for i2c dm to set default bus number Settings. Changes in v3: - Modify the subject and submission information of the patch. Changes in v2: - No change. configs/lx2160ardb_tfa_SECURE_BOOT_defconfig |7 +++ configs/lx2160ardb_tfa_defconfig |7 +++ 2 files changed, 14 insertions(+), 0 deletions(-) diff --git a/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig b/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig index 5cb29fd..d56aa6d 100644 --- a/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig +++ b/configs/lx2160ardb_tfa_SECURE_BOOT_defconfig @@ -58,3 +58,10 @@ CONFIG_RSA=y CONFIG_SPL_RSA=y CONFIG_RSA_SOFTWARE_EXP=y CONFIG_EFI_LOADER_BOUNCE_BUFFER=y +CONFIG_DM_I2C=y +CONFIG_I2C_SET_DEFAULT_BUS_NUM=y +CONFIG_I2C_DEFAULT_BUS_NUMBER=0 +CONFIG_DM_RTC=y +CONFIG_DM_GPIO=y +CONFIG_CMD_DATE=y +CONFIG_RTC_PCF2127=y diff --git a/configs/lx2160ardb_tfa_defconfig b/configs/lx2160ardb_tfa_defconfig index 94f58a8..059e877 100644 --- a/configs/lx2160ardb_tfa_defconfig +++ b/configs/lx2160ardb_tfa_defconfig @@ -57,3 +57,10 @@ CONFIG_DM_USB=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_DWC3=y CONFIG_EFI_LOADER_BOUNCE_BUFFER=y +CONFIG_DM_I2C=y +CONFIG_I2C_SET_DEFAULT_BUS_NUM=y +CONFIG_I2C_DEFAULT_BUS_NUMBER=0 +CONFIG_DM_RTC=y +CONFIG_DM_GPIO=y +CONFIG_CMD_DATE=y +CONFIG_RTC_PCF2127=y -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 4/4] armv8: dts: ls1028aqds: Add pcf2127 node under i2c1
This patch adds the pcf2127-rtc node under the i2c1 for ls1028aqds boards. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=117203 - http://patchwork.ozlabs.org/project/uboot/list/?series=117224 - http://patchwork.ozlabs.org/project/uboot/list/?series=118231 arch/arm/dts/fsl-ls1028a-qds.dts | 5 + 1 file changed, 5 insertions(+) diff --git a/arch/arm/dts/fsl-ls1028a-qds.dts b/arch/arm/dts/fsl-ls1028a-qds.dts index dde45d6..54b0791 100644 --- a/arch/arm/dts/fsl-ls1028a-qds.dts +++ b/arch/arm/dts/fsl-ls1028a-qds.dts @@ -49,6 +49,11 @@ &i2c1 { status = "okay"; + + rtc@51 { + compatible = "pcf2127-rtc"; + reg = <0x51>; + }; }; &i2c2 { -- 2.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 3/4] armv8: dts: ls1028aqds: Add pca9547 node under the i2c0 controller
This patch adds pca9547 node to support i2c multiplexer under the i2c0 controller for ls1028aqds boards. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=117203 - http://patchwork.ozlabs.org/project/uboot/list/?series=117224 - http://patchwork.ozlabs.org/project/uboot/list/?series=118231 arch/arm/dts/fsl-ls1028a-qds.dts | 8 1 file changed, 8 insertions(+) diff --git a/arch/arm/dts/fsl-ls1028a-qds.dts b/arch/arm/dts/fsl-ls1028a-qds.dts index 46a0419..dde45d6 100644 --- a/arch/arm/dts/fsl-ls1028a-qds.dts +++ b/arch/arm/dts/fsl-ls1028a-qds.dts @@ -37,6 +37,14 @@ &i2c0 { status = "okay"; + u-boot,dm-pre-reloc; + + i2c-mux@77 { + compatible = "nxp,pca9547"; + reg = <0x77>; + #address-cells = <1>; + #size-cells = <0>; + }; }; &i2c1 { -- 2.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 2/4] configs: ls1028aqds: Enable DM support for pcf2127 rtc
Enable related configs on all ls1028aqds boards to support pcf2127 rtc DM function. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=117203 - http://patchwork.ozlabs.org/project/uboot/list/?series=117224 - http://patchwork.ozlabs.org/project/uboot/list/?series=118231 configs/ls1028aqds_tfa_SECURE_BOOT_defconfig | 11 ++- configs/ls1028aqds_tfa_defconfig | 11 ++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/configs/ls1028aqds_tfa_SECURE_BOOT_defconfig b/configs/ls1028aqds_tfa_SECURE_BOOT_defconfig index 7cd2f59..5f66b55 100644 --- a/configs/ls1028aqds_tfa_SECURE_BOOT_defconfig +++ b/configs/ls1028aqds_tfa_SECURE_BOOT_defconfig @@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_TARGET_LS1028AQDS=y +CONFIG_SYS_MALLOC_F_LEN=0x6000 CONFIG_SECURE_BOOT=y CONFIG_SYS_FSL_SDHC_CLK_DIV=1 CONFIG_TFABOOT=y @@ -8,7 +9,6 @@ CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y CONFIG_SEC_FIRMWARE_ARMV8_PSCI=y CONFIG_AHCI=y CONFIG_DISTRO_DEFAULTS=y -# CONFIG_SYS_MALLOC_F is not set CONFIG_FIT_VERBOSE=y CONFIG_OF_BOARD_SETUP=y CONFIG_OF_STDOUT_VIA_ALIAS=y @@ -60,3 +60,12 @@ CONFIG_WDT=y CONFIG_WDT_SP805=y CONFIG_RSA=y CONFIG_EFI_LOADER_BOUNCE_BUFFER=y +CONFIG_DM_I2C=y +CONFIG_I2C_SET_DEFAULT_BUS_NUM=y +CONFIG_I2C_DEFAULT_BUS_NUMBER=0 +CONFIG_DM_RTC=y +CONFIG_DM_GPIO=y +CONFIG_CMD_DATE=y +CONFIG_RTC_PCF2127=y +CONFIG_I2C_MUX=y +CONFIG_I2C_MUX_PCA954x=y diff --git a/configs/ls1028aqds_tfa_defconfig b/configs/ls1028aqds_tfa_defconfig index 7982ce4..d221624 100644 --- a/configs/ls1028aqds_tfa_defconfig +++ b/configs/ls1028aqds_tfa_defconfig @@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_TARGET_LS1028AQDS=y +CONFIG_SYS_MALLOC_F_LEN=0x6000 CONFIG_SYS_FSL_SDHC_CLK_DIV=1 CONFIG_TFABOOT=y CONFIG_NR_DRAM_BANKS=2 @@ -7,7 +8,6 @@ CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y CONFIG_SEC_FIRMWARE_ARMV8_PSCI=y CONFIG_AHCI=y CONFIG_DISTRO_DEFAULTS=y -# CONFIG_SYS_MALLOC_F is not set CONFIG_FIT_VERBOSE=y CONFIG_OF_BOARD_SETUP=y CONFIG_OF_STDOUT_VIA_ALIAS=y @@ -63,3 +63,12 @@ CONFIG_USB_XHCI_DWC3=y CONFIG_WDT=y CONFIG_WDT_SP805=y CONFIG_EFI_LOADER_BOUNCE_BUFFER=y +CONFIG_DM_I2C=y +CONFIG_I2C_SET_DEFAULT_BUS_NUM=y +CONFIG_I2C_DEFAULT_BUS_NUMBER=0 +CONFIG_DM_RTC=y +CONFIG_DM_GPIO=y +CONFIG_CMD_DATE=y +CONFIG_RTC_PCF2127=y +CONFIG_I2C_MUX=y +CONFIG_I2C_MUX_PCA954x=y -- 2.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 1/4] armv8: ls1028aqds: Remove the definition of CONFIG_SYS_I2C_EARLY_INIT
Since i2c uses dm mode, i2 controller will be initialized when reading and writing devices on i2c bus. So there is no need for the original non-dm mode i2c early initialization function call, this patch removed the definition of CONFIG_SYS_I2C_EARLY_INIT. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=117203 - http://patchwork.ozlabs.org/project/uboot/list/?series=117224 - http://patchwork.ozlabs.org/project/uboot/list/?series=118231 include/configs/ls1028aqds.h | 1 - 1 file changed, 1 deletion(-) diff --git a/include/configs/ls1028aqds.h b/include/configs/ls1028aqds.h index be018ef..b0e9441 100644 --- a/include/configs/ls1028aqds.h +++ b/include/configs/ls1028aqds.h @@ -16,7 +16,6 @@ #define CONFIG_DIMM_SLOTS_PER_CTLR 2 #define CONFIG_QIXIS_I2C_ACCESS -#define CONFIG_SYS_I2C_EARLY_INIT /* * QIXIS Definitions -- 2.9.5 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [EXT] Re: [PATCH v5] rtc: pcf2127: Fixed bug with rtc settings and getting error time
> -Original Message- > From: Heiko Schocher > Sent: 2019年7月9日 16:50 > To: Chuanhua Han > Cc: lu...@denx.de; Prabhakar Kushwaha ; > Biwen Li ; s...@chromium.org; u-boot@lists.denx.de > Subject: [EXT] Re: [PATCH v5] rtc: pcf2127: Fixed bug with rtc settings and > getting error time > > Caution: EXT Email > > Hello Chuanhua Han, > > Am 08.07.2019 um 05:45 schrieb Chuanhua Han: > > The previous pcf2127 RTC chip could not read and set the correct time. > > When reading the data of internal registers, the read address was the > > value of register plus 1. This is because this chip requires the host > > to send a stop signal after setting the register address and before > > reading the register data. > > > > This patch sets the register address using dm_i2c_write and reads the > > register data using the original dm_i2c_xfer in order to generate a > > stop signal after the register address is set, and fixes the bug of > > the original read and write time. > > > > Signed-off-by: Biwen Li > > Signed-off-by: Chuanhua Han > > Reviewed-by: Lukasz Majewski > > --- > > Changes in v5: > > - The modification made by i2c core layer is removed, and the > > RTC time bug is fixed in pcf2127 driver using dm_i2c_xfer. > > Changes in v4: > > - Replace DM_I2C_CHIP_RD_NO_I2C_SETUP_OFFSET with > > DM_I2C_CHIP_ADDR_STOP. > > Changes in v3: > > - When the rtc time is obtained, the address of the set register > > is separated from the read data. > > Changes in v2: > > - Split the original patch into 3 patches > > - Add detailed description information for each patch > > > > drivers/rtc/pcf2127.c | 33 - > > 1 files changed, 24 insertions(+), 9 deletions(-) > > Looks good to me now, many thanks! Thank you very much for your advice! > > Reviewed-by: Heiko Schocher > > bye, > Heiko > -- > -- > DENX Software Engineering GmbH, Managing Director: Wolfgang Denk > HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany > Phone: +49-8142-66989-52 Fax: +49-8142-66989-80 Email: h...@denx.de ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [EXT] Re: [PATCH v4] rtc: Add DM support to ds3231
> -Original Message- > From: Lukasz Majewski > Sent: 2019年6月21日 19:33 > To: Chuanhua Han > Cc: Prabhakar Kushwaha ; > u-boot@lists.denx.de > Subject: [EXT] Re: [PATCH v4] rtc: Add DM support to ds3231 > > On Fri, 21 Jun 2019 16:21:53 +0800 > Chuanhua Han wrote: > > > Add an implementation of the ds3231 driver that uses the driver model > > i2c APIs. > > > > Signed-off-by: Chuanhua Han > > --- > > Changes in v4: > > - Delete the original 'rel' variable in the ds3231_rtc_get function, > > return 0 successfully, and return -EINVAL directly when the RTC > > oscillator is stopped. > > Changes in v3: > > - Update copyright information. > > Changes in v2: > > - Replace "#ifndef CONFIG_DM_RTC" with "#if > > !CONFIG_IS_ENABLED(DM_RTC)". > > > > drivers/rtc/ds3231.c | 107 > > +++ 1 file changed, 107 > > insertions(+) > > > > diff --git a/drivers/rtc/ds3231.c b/drivers/rtc/ds3231.c index > > 9352ff87a2..79b026af4b 100644 > > --- a/drivers/rtc/ds3231.c > > +++ b/drivers/rtc/ds3231.c > > @@ -2,6 +2,9 @@ > > /* > > * (C) Copyright 2006 > > * Markus Klotzbuecher, m...@denx.de > > + * > > + * (C) Copyright 2019 NXP > > + * Chuanhua Han > > */ > > > > /* > > @@ -13,6 +16,7 @@ > > > > #include > > #include > > +#include > > #include > > #include > > > > @@ -50,6 +54,7 @@ > > #define RTC_STAT_BIT_EN32KHZ 0x8 /* Enable 32KHz > > Output */ > > > > +#if !CONFIG_IS_ENABLED(DM_RTC) > > static uchar rtc_read (uchar reg); > > static void rtc_write (uchar reg, uchar val); > > > > @@ -164,3 +169,105 @@ static void rtc_write (uchar reg, uchar val) { > > i2c_reg_write (CONFIG_SYS_I2C_RTC_ADDR, reg, val); } > > +#else > > +static int ds3231_rtc_get(struct udevice *dev, struct rtc_time *tmp) > > +{ > > + uchar sec, min, hour, mday, wday, mon_cent, year, status; > > + > > + status = dm_i2c_reg_read(dev, RTC_STAT_REG_ADDR); > > + sec = dm_i2c_reg_read(dev, RTC_SEC_REG_ADDR); > > + min = dm_i2c_reg_read(dev, RTC_MIN_REG_ADDR); > > + hour = dm_i2c_reg_read(dev, RTC_HR_REG_ADDR); > > + wday = dm_i2c_reg_read(dev, RTC_DAY_REG_ADDR); > > + mday = dm_i2c_reg_read(dev, RTC_DATE_REG_ADDR); > > + mon_cent = dm_i2c_reg_read(dev, RTC_MON_REG_ADDR); > > + year = dm_i2c_reg_read(dev, RTC_YR_REG_ADDR); > > + > > + if (status & RTC_STAT_BIT_OSF) { > > + printf("### Warning: RTC oscillator has stopped\n"); > > + /* clear the OSF flag */ > > + dm_i2c_reg_write(dev, RTC_STAT_REG_ADDR, > > +dm_i2c_reg_read(dev, > > RTC_STAT_REG_ADDR) > > + & ~RTC_STAT_BIT_OSF); > > + return -EINVAL; > > + } > > + > > + tmp->tm_sec = bcd2bin(sec & 0x7F); > > + tmp->tm_min = bcd2bin(min & 0x7F); > > + tmp->tm_hour = bcd2bin(hour & 0x3F); > > + tmp->tm_mday = bcd2bin(mday & 0x3F); > > + tmp->tm_mon = bcd2bin(mon_cent & 0x1F); > > + tmp->tm_year = bcd2bin(year) + ((mon_cent & 0x80) ? 2000 : > > 1900); > > + tmp->tm_wday = bcd2bin((wday - 1) & 0x07); > > + tmp->tm_yday = 0; > > + tmp->tm_isdst = 0; > > + > > + debug("Get DATE: %4d-%02d-%02d (wday=%d) TIME: > > %2d:%02d:%02d\n", > > + tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday, > > + tmp->tm_hour, tmp->tm_min, tmp->tm_sec); > > + > > + return 0; > > +} > > + > > +static int ds3231_rtc_set(struct udevice *dev, const struct rtc_time > > *tmp) +{ > > + uchar century; > > + > > + debug("Set DATE: %4d-%02d-%02d (wday=%d) TIME: > > %2d:%02d:%02d\n", > > + tmp->tm_year, tmp->tm_mon, tmp->tm_mday, tmp->tm_wday, > > + tmp->tm_hour, tmp->tm_min, tmp->tm_sec); > > + > > + dm_i2c_reg_write(dev, RTC_YR_REG_ADDR, bin2bcd(tmp->tm_year > > % 100)); + > > + century = (tmp->tm_year >= 2000) ? 0x80 : 0; > > + dm_i2c_reg_write(dev, RTC_MON_REG_ADDR, bin2bcd(tmp->tm_mon) > > | century); + > > + dm_i2c_reg_write(dev, RTC_DAY_REG_ADDR, bin2bcd(tmp->tm_wday > 1)); > > + dm_i2c_reg_write(dev, RTC_DATE_REG_ADDR, > > bin2bcd(tmp->tm_mday)); > > + dm_i2c_reg_wri
[U-Boot] [PATCH v5] rtc: pcf2127: Fixed bug with rtc settings and getting error time
The previous pcf2127 RTC chip could not read and set the correct time. When reading the data of internal registers, the read address was the value of register plus 1. This is because this chip requires the host to send a stop signal after setting the register address and before reading the register data. This patch sets the register address using dm_i2c_write and reads the register data using the original dm_i2c_xfer in order to generate a stop signal after the register address is set, and fixes the bug of the original read and write time. Signed-off-by: Biwen Li Signed-off-by: Chuanhua Han Reviewed-by: Lukasz Majewski --- Changes in v5: - The modification made by i2c core layer is removed, and the RTC time bug is fixed in pcf2127 driver using dm_i2c_xfer. Changes in v4: - Replace DM_I2C_CHIP_RD_NO_I2C_SETUP_OFFSET with DM_I2C_CHIP_ADDR_STOP. Changes in v3: - When the rtc time is obtained, the address of the set register is separated from the read data. Changes in v2: - Split the original patch into 3 patches - Add detailed description information for each patch drivers/rtc/pcf2127.c | 33 - 1 files changed, 24 insertions(+), 9 deletions(-) diff --git a/drivers/rtc/pcf2127.c b/drivers/rtc/pcf2127.c index dcf0340..f695350 100644 --- a/drivers/rtc/pcf2127.c +++ b/drivers/rtc/pcf2127.c @@ -22,14 +22,32 @@ #define PCF2127_REG_MO 0x08 #define PCF2127_REG_YR 0x09 +static int pcf2127_read_reg(struct udevice *dev, uint offset, + u8 *buffer, int len) +{ + struct dm_i2c_chip *chip = dev_get_parent_platdata(dev); + struct i2c_msg msg; + int ret; + + /* Set the address of the start register to be read */ + ret = dm_i2c_write(dev, offset, NULL, 0); + if (ret < 0) + return ret; + + /* Read register's data */ + msg.addr = chip->chip_addr; + msg.flags |= I2C_M_RD; + msg.len = len; + msg.buf = buffer; + + return dm_i2c_xfer(dev, &msg, 1); +} + static int pcf2127_rtc_set(struct udevice *dev, const struct rtc_time *tm) { - uchar buf[8]; + uchar buf[7] = {0}; int i = 0, ret; - /* start register address */ - buf[i++] = PCF2127_REG_SC; - /* hours, minutes and seconds */ buf[i++] = bin2bcd(tm->tm_sec); buf[i++] = bin2bcd(tm->tm_min); @@ -44,7 +62,7 @@ static int pcf2127_rtc_set(struct udevice *dev, const struct rtc_time *tm) buf[i++] = bin2bcd(tm->tm_year % 100); /* write register's data */ - ret = dm_i2c_write(dev, PCF2127_REG_CTRL1, buf, sizeof(buf)); + ret = dm_i2c_write(dev, PCF2127_REG_SC, buf, i); return ret; } @@ -54,10 +72,7 @@ static int pcf2127_rtc_get(struct udevice *dev, struct rtc_time *tm) int ret = 0; uchar buf[10] = { PCF2127_REG_CTRL1 }; - ret = dm_i2c_write(dev, PCF2127_REG_CTRL1, buf, 1); - if (ret < 0) - return ret; - ret = dm_i2c_read(dev, PCF2127_REG_CTRL1, buf, sizeof(buf)); + ret = pcf2127_read_reg(dev, PCF2127_REG_CTRL1, buf, sizeof(buf)); if (ret < 0) return ret; -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
Re: [U-Boot] [EXT] Re: [PATCH 1/2] dm: i2c: Add a flag that need generate stop bit
> -Original Message- > From: Simon Glass > Sent: 2019年7月7日 1:17 > To: Chuanhua Han > Cc: Lukasz Majewski ; h...@denx.de; Biwen Li > ; u-boot@lists.denx.de > Subject: Re: [EXT] Re: [PATCH 1/2] dm: i2c: Add a flag that need generate stop > bit > > Caution: EXT Email > > Hi Chuanhua, > > On Sun, 23 Jun 2019 at 22:48, Chuanhua Han > wrote: > > > > + Simon Glass > > > > > -Original Message----- > > > From: Lukasz Majewski > > > Sent: 2019年6月18日 16:07 > > > To: Chuanhua Han > > > Cc: h...@denx.de; s...@chromium.org; Biwen Li ; > > > u-boot@lists.denx.de > > > Subject: [EXT] Re: [PATCH 1/2] dm: i2c: Add a flag that need > > > generate stop bit > > > > > > On Mon, 17 Jun 2019 21:12:40 +0800 > > > Chuanhua Han wrote: > > > > > > > Usually the i2c bus needs to write the address of the register > > > > before reading the internal register data of the device (ignoring > > > > the transmission of the slave address). > > > > > > > > Generally, the stop signal is not needed before the register is > > > > read, but there is a special chip that needs this stop signal > > > > (such as pcf2127). However, in the current i2c general code, the > > > > dm_i2c_read api encapsulates two messages, the first time is to > > > > set the register address message, the second time is a message to > > > > read the register data, so that no stop signal is generated. > > > > > > > > This patch uses the DM_I2C_CHIP_ADDR_STOP flag for specific i2c > > > > chips, so if the i2c slave requires a stop signal, chips driver > > > > can set this flag, then call the dm_i2c_write to set the register > > > > address (a stop signal is generated after this API call), then > > > > call dm_i2c_read to read the register data. > > > > > > > > Signed-off-by: Chuanhua Han > > > > > > Reviewed-by: Lukasz Majewski > > I already asked why you cannot use dm_i2c_xfer() to do what you want, but I > did not see your response. Can you please send your response again here on > this thread? The dm_i2c_xfer() function is designed to handle any sorts of > quirk that are needed. I'd like to avoid quirks in the core code if possible. > > If you really want to add a quirk, then I would like to put it behind a > CONFIG_I2C_QUIRKS option, and use: > > if (IS_ENABLED(CONFIG_I2C_QUIRKS) || !(chip->flags & > DM_I2C_CHIP_ADDR_STOP)) { >if (!i2c_setup_offset(chip, offset, offset_buf, ptr)) >ptr++; > > so we don't affect code size on other platforms. After all this feature is > just for > one broken chip and should not negatively affect everyone else that follows > the > spec correctly. > > I am worried about all the SPL-affecting changing that add a few bytes here > and there, but really add up. > > But my first preference would be to use i2c_xfer() if possible. OK,thanks,I will send next version! > > Regards, > Simon ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 4/5] armv8: dts: fsl-ls2088a: add i2c node support
From: chuanhua han One ls2088a, there is four I2C controllers. This patch is to add I2C node for ls2088a. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=109459 - http://patchwork.ozlabs.org/project/uboot/list/?series=113103 Change in v2: - No change. arch/arm/dts/fsl-ls2080a.dtsi | 36 1 files changed, 36 insertions(+), 0 deletions(-) diff --git a/arch/arm/dts/fsl-ls2080a.dtsi b/arch/arm/dts/fsl-ls2080a.dtsi index 5c0769b..99ed33a 100644 --- a/arch/arm/dts/fsl-ls2080a.dtsi +++ b/arch/arm/dts/fsl-ls2080a.dtsi @@ -56,6 +56,42 @@ <0x 0x0834 0 0x4>; /* MC control reg */ }; + i2c0: i2c@200 { + status = "disabled"; + compatible = "fsl,vf610-i2c"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x0 0x200 0x0 0x1>; + interrupts = <0 34 0x4>; /* Level high type */ + }; + + i2c1: i2c@201 { + status = "disabled"; + compatible = "fsl,vf610-i2c"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x0 0x201 0x0 0x1>; + interrupts = <0 34 0x4>; /* Level high type */ + }; + + i2c2: i2c@202 { + status = "disabled"; + compatible = "fsl,vf610-i2c"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x0 0x202 0x0 0x1>; + interrupts = <0 35 0x4>; /* Level high type */ + }; + + i2c3: i2c@203 { + status = "disabled"; + compatible = "fsl,vf610-i2c"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x0 0x203 0x0 0x1>; + interrupts = <0 35 0x4>; /* Level high type */ + }; + dspi: dspi@210 { compatible = "fsl,vf610-dspi"; #address-cells = <1>; -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 5/5] armv8: dts: ls2088ardb: Add slave nodes under the i2c0 controller
This patch adds some slave nodes to support the i2c dm on the device side under the i2c0 controller. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=109459 - http://patchwork.ozlabs.org/project/uboot/list/?series=113103 Change in v2: - Delete unnecessary i2c slave nodes. arch/arm/dts/fsl-ls2088a-rdb-qspi.dts | 22 ++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/arch/arm/dts/fsl-ls2088a-rdb-qspi.dts b/arch/arm/dts/fsl-ls2088a-rdb-qspi.dts index bf97d13..72b2177 100644 --- a/arch/arm/dts/fsl-ls2088a-rdb-qspi.dts +++ b/arch/arm/dts/fsl-ls2088a-rdb-qspi.dts @@ -57,6 +57,28 @@ }; }; +&i2c0 { + status = "okay"; + u-boot,dm-pre-reloc; + + pca9547@75 { + compatible = "nxp,pca9547"; + reg = <0x75>; + #address-cells = <1>; + #size-cells = <0>; + +i2c@1 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0x01>; + rtc@68 { + compatible = "dallas,ds3232"; + reg = <0x68>; + }; + }; + }; +}; + &sata { status = "okay"; }; -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 3/5] configs: ls2088a: enable DM support for rtc
Enable related configs to support rtc DM feature for ls2088ardb board. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=109459 - http://patchwork.ozlabs.org/project/uboot/list/?series=113103 Change in v2: - No change. configs/ls2088ardb_tfa_SECURE_BOOT_defconfig |7 ++- configs/ls2088ardb_tfa_defconfig |7 ++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/configs/ls2088ardb_tfa_SECURE_BOOT_defconfig b/configs/ls2088ardb_tfa_SECURE_BOOT_defconfig index d3312c6..abc608f 100644 --- a/configs/ls2088ardb_tfa_SECURE_BOOT_defconfig +++ b/configs/ls2088ardb_tfa_SECURE_BOOT_defconfig @@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_TARGET_LS2080ARDB=y +CONFIG_SYS_MALLOC_F_LEN=0x6000 CONFIG_SYS_TEXT_BASE=0x8200 CONFIG_SECURE_BOOT=y CONFIG_QSPI_AHB_INIT=y @@ -8,7 +9,6 @@ CONFIG_NR_DRAM_BANKS=3 CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y CONFIG_SEC_FIRMWARE_ARMV8_PSCI=y CONFIG_AHCI=y -# CONFIG_SYS_MALLOC_F is not set CONFIG_FIT_VERBOSE=y CONFIG_OF_BOARD_SETUP=y CONFIG_OF_STDOUT_VIA_ALIAS=y @@ -69,3 +69,8 @@ CONFIG_RSA=y CONFIG_SPL_RSA=y CONFIG_RSA_SOFTWARE_EXP=y CONFIG_EFI_LOADER_BOUNCE_BUFFER=y +CONFIG_DM_I2C=y +CONFIG_DM_GPIO=y +CONFIG_I2C_MUX=y +CONFIG_I2C_MUX_PCA954x=y +CONFIG_DM_RTC=y diff --git a/configs/ls2088ardb_tfa_defconfig b/configs/ls2088ardb_tfa_defconfig index 1aa8dd9..c273a75 100644 --- a/configs/ls2088ardb_tfa_defconfig +++ b/configs/ls2088ardb_tfa_defconfig @@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_TARGET_LS2080ARDB=y +CONFIG_SYS_MALLOC_F_LEN=0x6000 CONFIG_SYS_TEXT_BASE=0x8200 CONFIG_QSPI_AHB_INIT=y CONFIG_TFABOOT=y @@ -7,7 +8,6 @@ CONFIG_NR_DRAM_BANKS=3 CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y CONFIG_SEC_FIRMWARE_ARMV8_PSCI=y CONFIG_AHCI=y -# CONFIG_SYS_MALLOC_F is not set CONFIG_FIT_VERBOSE=y CONFIG_OF_BOARD_SETUP=y CONFIG_OF_STDOUT_VIA_ALIAS=y @@ -70,3 +70,8 @@ CONFIG_DM_USB=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_DWC3=y CONFIG_EFI_LOADER_BOUNCE_BUFFER=y +CONFIG_DM_I2C=y +CONFIG_DM_GPIO=y +CONFIG_I2C_MUX=y +CONFIG_I2C_MUX_PCA954x=y +CONFIG_DM_RTC=y -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 2/5] gpio: do not include on ARCH_LS2080A
As no gpio.h is defined for this architecture, to avoid compilation failure, do not include for arch ls2080a. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=109459 - http://patchwork.ozlabs.org/project/uboot/list/?series=113103 Change in v2: - No change. arch/arm/include/asm/gpio.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/arm/include/asm/gpio.h b/arch/arm/include/asm/gpio.h index f78b976..292adfa 100644 --- a/arch/arm/include/asm/gpio.h +++ b/arch/arm/include/asm/gpio.h @@ -1,7 +1,7 @@ #if !defined(CONFIG_ARCH_UNIPHIER) && !defined(CONFIG_ARCH_STI) && \ !defined(CONFIG_ARCH_K3) && !defined(CONFIG_ARCH_BCM6858) && \ !defined(CONFIG_ARCH_BCM63158) && !defined(CONFIG_ARCH_ROCKCHIP) && \ - !defined(CONFIG_ARCH_LX2160A) + !defined(CONFIG_ARCH_LX2160A) && !defined(CONFIG_ARCH_LS2080A) #include #endif #include -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 1/5] armv8: ls2088a: The ls2088a platform supports the I2C driver model.
DM_I2C_COMPAT is a compatibility layer that allows using the non-DM I2C API when DM_I2C is used.When DM_I2C_COMPAT is not enabled for compilation, a compilation error will be generated. This patch solves the problem that the i2c-related api of the ls2088a platform does not support dm. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=109459 - http://patchwork.ozlabs.org/project/uboot/list/?series=113103 Change in v2: - No change. arch/arm/cpu/armv8/fsl-layerscape/Kconfig |4 board/freescale/ls2080ardb/ls2080ardb.c |9 + include/configs/ls2080a_common.h |3 --- include/configs/ls2080ardb.h |1 - 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig index ffda02a..8a69af4 100644 --- a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig +++ b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig @@ -205,10 +205,6 @@ config ARCH_LS2080A select ARCH_EARLY_INIT_R select BOARD_EARLY_INIT_F select SYS_I2C_MXC - select SYS_I2C_MXC_I2C1 - select SYS_I2C_MXC_I2C2 - select SYS_I2C_MXC_I2C3 - select SYS_I2C_MXC_I2C4 imply DISTRO_DEFAULTS imply PANIC_HANG diff --git a/board/freescale/ls2080ardb/ls2080ardb.c b/board/freescale/ls2080ardb/ls2080ardb.c index ce419df..8833ed3 100644 --- a/board/freescale/ls2080ardb/ls2080ardb.c +++ b/board/freescale/ls2080ardb/ls2080ardb.c @@ -163,7 +163,16 @@ int select_i2c_ch_pca9547(u8 ch) { int ret; +#ifndef CONFIG_DM_I2C ret = i2c_write(I2C_MUX_PCA_ADDR_PRI, 0, 1, &ch, 1); +#else + struct udevice *dev; + + ret = i2c_get_chip_for_busnum(0, I2C_MUX_PCA_ADDR_PRI, 1, &dev); + if (!ret) + ret = dm_i2c_write(dev, 0, &ch, 1); +#endif + if (ret) { puts("PCA: failed to select proper channel\n"); return ret; diff --git a/include/configs/ls2080a_common.h b/include/configs/ls2080a_common.h index c7d8a3b..e776b5c 100644 --- a/include/configs/ls2080a_common.h +++ b/include/configs/ls2080a_common.h @@ -74,9 +74,6 @@ /* Size of malloc() pool */ #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 2048 * 1024) -/* I2C */ -#define CONFIG_SYS_I2C - /* Serial Port */ #define CONFIG_SYS_NS16550_SERIAL #define CONFIG_SYS_NS16550_REG_SIZE 1 diff --git a/include/configs/ls2080ardb.h b/include/configs/ls2080ardb.h index bfb54be..db22f59 100644 --- a/include/configs/ls2080ardb.h +++ b/include/configs/ls2080ardb.h @@ -13,7 +13,6 @@ #ifdef CONFIG_TARGET_LS2081ARDB #define CONFIG_QIXIS_I2C_ACCESS #endif -#define CONFIG_SYS_I2C_EARLY_INIT #endif #define I2C_MUX_CH_VOL_MONITOR 0xa -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 4/5] armv8: dts: fsl-ls1088a: add I2C node support
One ls1088a, there is four I2C controllers. This patch is to add I2C node for ls1088a. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=110856 - http://patchwork.ozlabs.org/project/uboot/list/?series=109459 Changes in v2: - No change. arch/arm/dts/fsl-ls1088a.dtsi | 32 1 files changed, 32 insertions(+), 0 deletions(-) diff --git a/arch/arm/dts/fsl-ls1088a.dtsi b/arch/arm/dts/fsl-ls1088a.dtsi index 7c70585..4be1ab8 100644 --- a/arch/arm/dts/fsl-ls1088a.dtsi +++ b/arch/arm/dts/fsl-ls1088a.dtsi @@ -34,6 +34,38 @@ <1 10 0x8>; /* Hypervisor PPI, active-low */ }; + i2c0: i2c@200 { + compatible = "fsl,vf610-i2c"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x0 0x200 0x0 0x1>; + interrupts = <0 34 4>; + }; + + i2c1: i2c@201 { + compatible = "fsl,vf610-i2c"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x0 0x201 0x0 0x1>; + interrupts = <0 34 4>; + }; + + i2c2: i2c@202 { + compatible = "fsl,vf610-i2c"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x0 0x202 0x0 0x1>; + interrupts = <0 35 4>; + }; + + i2c3: i2c@203 { + compatible = "fsl,vf610-i2c"; + #address-cells = <1>; + #size-cells = <0>; + reg = <0x0 0x203 0x0 0x1>; + interrupts = <0 35 4>; + }; + serial0: serial@21c0500 { device_type = "serial"; compatible = "fsl,ns16550", "ns16550a"; -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 5/5] armv8: dts: ls1088ardb: Add slave nodes under the i2c0 controller
This patch adds some slave nodes to support the i2c dm on the device side under the i2c0 controller. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=110856 - http://patchwork.ozlabs.org/project/uboot/list/?series=109459 Changes in v2: - Delete unnecessary i2c slave nodes. arch/arm/dts/fsl-ls1088a-rdb.dts | 23 +++ 1 files changed, 23 insertions(+), 0 deletions(-) diff --git a/arch/arm/dts/fsl-ls1088a-rdb.dts b/arch/arm/dts/fsl-ls1088a-rdb.dts index 765d1e3..0fe3519 100644 --- a/arch/arm/dts/fsl-ls1088a-rdb.dts +++ b/arch/arm/dts/fsl-ls1088a-rdb.dts @@ -17,6 +17,29 @@ }; }; +&i2c0 { + status = "okay"; + u-boot,dm-pre-reloc; + + i2c-mux@77 { + compatible = "nxp,pca9547"; + reg = <0x77>; + #address-cells = <1>; + #size-cells = <0>; + + i2c@3 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0x3>; + + rtc@51 { + compatible = "pcf2127-rtc"; + reg = <0x51>; + }; + }; + }; +}; + &qspi { bus-num = <0>; status = "okay"; -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 3/5] configs: ls1088a: enable DM support for pcf2127 rtc
Enable related configs to support pcf2127 rtc DM feature for ls1088ardb board. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=110856 - http://patchwork.ozlabs.org/project/uboot/list/?series=109459 Changes in v2: -No change. configs/ls1088ardb_tfa_SECURE_BOOT_defconfig |8 +++- configs/ls1088ardb_tfa_defconfig |8 +++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/configs/ls1088ardb_tfa_SECURE_BOOT_defconfig b/configs/ls1088ardb_tfa_SECURE_BOOT_defconfig index 3c4437d..364fc59 100644 --- a/configs/ls1088ardb_tfa_SECURE_BOOT_defconfig +++ b/configs/ls1088ardb_tfa_SECURE_BOOT_defconfig @@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_TARGET_LS1088ARDB=y +CONFIG_SYS_MALLOC_F_LEN=0x6000 CONFIG_SYS_TEXT_BASE=0x8200 CONFIG_SECURE_BOOT=y CONFIG_QSPI_AHB_INIT=y @@ -9,7 +10,6 @@ CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y CONFIG_SEC_FIRMWARE_ARMV8_PSCI=y CONFIG_AHCI=y CONFIG_DISTRO_DEFAULTS=y -# CONFIG_SYS_MALLOC_F is not set CONFIG_FIT_VERBOSE=y CONFIG_OF_BOARD_SETUP=y CONFIG_OF_STDOUT_VIA_ALIAS=y @@ -63,3 +63,9 @@ CONFIG_RSA=y CONFIG_SPL_RSA=y CONFIG_RSA_SOFTWARE_EXP=y CONFIG_EFI_LOADER_BOUNCE_BUFFER=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y +CONFIG_DM_GPIO=y +CONFIG_RTC_PCF2127=y +CONFIG_I2C_MUX=y +CONFIG_I2C_MUX_PCA954x=y diff --git a/configs/ls1088ardb_tfa_defconfig b/configs/ls1088ardb_tfa_defconfig index 8cea8c7..eb35782 100644 --- a/configs/ls1088ardb_tfa_defconfig +++ b/configs/ls1088ardb_tfa_defconfig @@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_TARGET_LS1088ARDB=y +CONFIG_SYS_MALLOC_F_LEN=0x6000 CONFIG_SYS_TEXT_BASE=0x8200 CONFIG_QSPI_AHB_INIT=y CONFIG_TFABOOT=y @@ -8,7 +9,6 @@ CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y CONFIG_SEC_FIRMWARE_ARMV8_PSCI=y CONFIG_AHCI=y CONFIG_DISTRO_DEFAULTS=y -# CONFIG_SYS_MALLOC_F is not set CONFIG_FIT_VERBOSE=y CONFIG_OF_BOARD_SETUP=y CONFIG_OF_STDOUT_VIA_ALIAS=y @@ -61,3 +61,9 @@ CONFIG_USB_XHCI_DWC3=y CONFIG_USB_DWC3=y CONFIG_USB_GADGET=y CONFIG_EFI_LOADER_BOUNCE_BUFFER=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y +CONFIG_DM_GPIO=y +CONFIG_RTC_PCF2127=y +CONFIG_I2C_MUX=y +CONFIG_I2C_MUX_PCA954x=y -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 2/5] gpio: do not include on ARCH_LS1088A
As no gpio.h is defined for this architecture, to avoid compilation failure, do not include for arch ls1088a. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=110856 - http://patchwork.ozlabs.org/project/uboot/list/?series=109459 Changes in v2: - No change. arch/arm/include/asm/gpio.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/arm/include/asm/gpio.h b/arch/arm/include/asm/gpio.h index f78b976..0ca15c9 100644 --- a/arch/arm/include/asm/gpio.h +++ b/arch/arm/include/asm/gpio.h @@ -1,7 +1,7 @@ #if !defined(CONFIG_ARCH_UNIPHIER) && !defined(CONFIG_ARCH_STI) && \ !defined(CONFIG_ARCH_K3) && !defined(CONFIG_ARCH_BCM6858) && \ !defined(CONFIG_ARCH_BCM63158) && !defined(CONFIG_ARCH_ROCKCHIP) && \ - !defined(CONFIG_ARCH_LX2160A) + !defined(CONFIG_ARCH_LX2160A) && !defined(CONFIG_ARCH_LS1088A) #include #endif #include -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 1/5] armv8: ls1088a: The ls1088a platform supports the I2C driver model.
DM_I2C_COMPAT is a compatibility layer that allows using the non-DM I2C API when DM_I2C is used.When DM_I2C_COMPAT is not enabled for compilation, a compilation error will be generated. This patch solves the problem that the i2c-related api of the ls1088a platform does not support dm. Signed-off-by: Chuanhua Han --- depends on: - http://patchwork.ozlabs.org/project/uboot/list/?series=110856 - http://patchwork.ozlabs.org/project/uboot/list/?series=109459 Changes in v2: - No change. arch/arm/cpu/armv8/fsl-layerscape/Kconfig |4 - board/freescale/ls1088a/ls1088a.c | 148 + include/configs/ls1088a_common.h |3 - include/configs/ls1088ardb.h |2 - 4 files changed, 148 insertions(+), 9 deletions(-) diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig index ffda02a..568756d 100644 --- a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig +++ b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig @@ -155,10 +155,6 @@ config ARCH_LS1088A select ARCH_EARLY_INIT_R select BOARD_EARLY_INIT_F select SYS_I2C_MXC - select SYS_I2C_MXC_I2C1 - select SYS_I2C_MXC_I2C2 - select SYS_I2C_MXC_I2C3 - select SYS_I2C_MXC_I2C4 imply SCSI imply PANIC_HANG diff --git a/board/freescale/ls1088a/ls1088a.c b/board/freescale/ls1088a/ls1088a.c index 6d11a13..2bac070 100644 --- a/board/freescale/ls1088a/ls1088a.c +++ b/board/freescale/ls1088a/ls1088a.c @@ -373,7 +373,15 @@ int select_i2c_ch_pca9547(u8 ch) { int ret; +#ifndef CONFIG_DM_I2C ret = i2c_write(I2C_MUX_PCA_ADDR_PRI, 0, 1, &ch, 1); +#else + struct udevice *dev; + + ret = i2c_get_chip_for_busnum(0, I2C_MUX_PCA_ADDR_PRI, 1, &dev); + if (!ret) + ret = dm_i2c_write(dev, 0, &ch, 1); +#endif if (ret) { puts("PCA: failed to select proper channel\n"); return ret; @@ -392,38 +400,89 @@ void board_retimer_init(void) /* Access to Control/Shared register */ reg = 0x0; +#ifndef CONFIG_DM_I2C i2c_write(I2C_RETIMER_ADDR, 0xff, 1, ®, 1); +#else + struct udevice *dev; + + i2c_get_chip_for_busnum(0, I2C_RETIMER_ADDR, 1, &dev); + dm_i2c_write(dev, 0xff, ®, 1); +#endif /* Read device revision and ID */ +#ifndef CONFIG_DM_I2C i2c_read(I2C_RETIMER_ADDR, 1, 1, ®, 1); +#else + dm_i2c_read(dev, 1, ®, 1); +#endif debug("Retimer version id = 0x%x\n", reg); /* Enable Broadcast. All writes target all channel register sets */ reg = 0x0c; +#ifndef CONFIG_DM_I2C i2c_write(I2C_RETIMER_ADDR, 0xff, 1, ®, 1); +#else + dm_i2c_write(dev, 0xff, ®, 1); +#endif /* Reset Channel Registers */ +#ifndef CONFIG_DM_I2C i2c_read(I2C_RETIMER_ADDR, 0, 1, ®, 1); +#else + dm_i2c_read(dev, 0, ®, 1); +#endif reg |= 0x4; +#ifndef CONFIG_DM_I2C i2c_write(I2C_RETIMER_ADDR, 0, 1, ®, 1); +#else + dm_i2c_write(dev, 0, ®, 1); +#endif /* Set data rate as 10.3125 Gbps */ reg = 0x90; +#ifndef CONFIG_DM_I2C i2c_write(I2C_RETIMER_ADDR, 0x60, 1, ®, 1); +#else + dm_i2c_write(dev, 0x60, ®, 1); +#endif reg = 0xb3; +#ifndef CONFIG_DM_I2C i2c_write(I2C_RETIMER_ADDR, 0x61, 1, ®, 1); +#else + dm_i2c_write(dev, 0x61, ®, 1); +#endif reg = 0x90; +#ifndef CONFIG_DM_I2C i2c_write(I2C_RETIMER_ADDR, 0x62, 1, ®, 1); +#else + dm_i2c_write(dev, 0x62, ®, 1); +#endif reg = 0xb3; +#ifndef CONFIG_DM_I2C i2c_write(I2C_RETIMER_ADDR, 0x63, 1, ®, 1); +#else + dm_i2c_write(dev, 0x63, ®, 1); +#endif reg = 0xcd; +#ifndef CONFIG_DM_I2C i2c_write(I2C_RETIMER_ADDR, 0x64, 1, ®, 1); +#else + dm_i2c_write(dev, 0x64, ®, 1); +#endif /* Select VCO Divider to full rate (000) */ +#ifndef CONFIG_DM_I2C i2c_read(I2C_RETIMER_ADDR, 0x2F, 1, ®, 1); +#else + dm_i2c_read(dev, 0x2F, ®, 1); +#endif reg &= 0x0f; reg |= 0x70; +#ifndef CONFIG_DM_I2C i2c_write(I2C_RETIMER_ADDR, 0x2F, 1, ®, 1); +#else + dm_i2c_write(dev, 0x2F, ®, 1); +#endif #ifdef CONFIG_TARGET_LS1088AQDS /* Retimer is connected to I2C1_CH5 */ @@ -431,38 +490,88 @@ void board_retimer_init(void) /* Access to Control/Shared register */ reg = 0x0; +#ifndef CONFIG_DM_I2C i2c_write(I2C_RETIMER_ADDR2, 0xff, 1, ®, 1); +#else + i2c_get_chip_for_busnum(0, I2C_RETIMER_ADDR2, 1, &dev); + dm_i2c_write(dev, 0xff, ®, 1); +#endif /* Read device revision and ID */ +#ifndef CONFIG_DM_I2C i2c_read(I2C_RETIMER_ADDR2, 1, 1, ®, 1); +#else + dm_i2c_read(dev, 1, ®, 1); +#endif debug("Retimer version id = 0x%x\n", reg); /* Enable Broadcast. All writes target all channel register sets */ reg = 0x0c; +#if
[U-Boot] [PATCH v3 3/4] configs: ls1028a: enable DM support for pcf2127 rtc
Enable related configs to support pcf2127 rtc DM feature for ls1028ardb board. Signed-off-by: Chuanhua Han --- depends on: - https://patchwork.ozlabs.org/project/uboot/list/?series=113364 - https://patchwork.ozlabs.org/project/uboot/list/?series=110856 - https://patchwork.ozlabs.org/project/uboot/list/?series=109677 Changes in v3: - No change. Changes in v2: - Enable secure boot defconfig to support pcf2127 rtc DM feature for ls1028ardb board. configs/ls1028ardb_tfa_SECURE_BOOT_defconfig |9 - configs/ls1028ardb_tfa_defconfig |9 - 2 files changed, 16 insertions(+), 2 deletions(-) diff --git a/configs/ls1028ardb_tfa_SECURE_BOOT_defconfig b/configs/ls1028ardb_tfa_SECURE_BOOT_defconfig index 3432f90..c101a33 100644 --- a/configs/ls1028ardb_tfa_SECURE_BOOT_defconfig +++ b/configs/ls1028ardb_tfa_SECURE_BOOT_defconfig @@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_TARGET_LS1028ARDB=y +CONFIG_SYS_MALLOC_F_LEN=0x6000 CONFIG_SECURE_BOOT=y CONFIG_SYS_FSL_SDHC_CLK_DIV=1 CONFIG_TFABOOT=y @@ -8,7 +9,6 @@ CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y CONFIG_SEC_FIRMWARE_ARMV8_PSCI=y CONFIG_AHCI=y CONFIG_DISTRO_DEFAULTS=y -# CONFIG_SYS_MALLOC_F is not set CONFIG_FIT_VERBOSE=y CONFIG_OF_BOARD_SETUP=y CONFIG_OF_STDOUT_VIA_ALIAS=y @@ -60,3 +60,10 @@ CONFIG_WDT=y CONFIG_WDT_SP805=y CONFIG_RSA=y CONFIG_EFI_LOADER_BOUNCE_BUFFER=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y +CONFIG_DM_GPIO=y +CONFIG_CMD_DATE=y +CONFIG_RTC_PCF2127=y +CONFIG_I2C_MUX=y +CONFIG_I2C_MUX_PCA954x=y diff --git a/configs/ls1028ardb_tfa_defconfig b/configs/ls1028ardb_tfa_defconfig index c65e37d..a2fe8d6 100644 --- a/configs/ls1028ardb_tfa_defconfig +++ b/configs/ls1028ardb_tfa_defconfig @@ -1,5 +1,6 @@ CONFIG_ARM=y CONFIG_TARGET_LS1028ARDB=y +CONFIG_SYS_MALLOC_F_LEN=0x6000 CONFIG_SYS_FSL_SDHC_CLK_DIV=1 CONFIG_TFABOOT=y CONFIG_NR_DRAM_BANKS=2 @@ -7,7 +8,6 @@ CONFIG_ARMV8_SEC_FIRMWARE_SUPPORT=y CONFIG_SEC_FIRMWARE_ARMV8_PSCI=y CONFIG_AHCI=y CONFIG_DISTRO_DEFAULTS=y -# CONFIG_SYS_MALLOC_F is not set CONFIG_FIT_VERBOSE=y CONFIG_OF_BOARD_SETUP=y CONFIG_OF_STDOUT_VIA_ALIAS=y @@ -63,3 +63,10 @@ CONFIG_USB_XHCI_DWC3=y CONFIG_WDT=y CONFIG_WDT_SP805=y CONFIG_EFI_LOADER_BOUNCE_BUFFER=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y +CONFIG_DM_GPIO=y +CONFIG_CMD_DATE=y +CONFIG_RTC_PCF2127=y +CONFIG_I2C_MUX=y +CONFIG_I2C_MUX_PCA954x=y -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 2/4] gpio: do not include on ARCH_LS1028A
As no gpio.h is defined for this architecture, to avoid compilation failure, do not include for arch ls1028a. Signed-off-by: Chuanhua Han --- depends on: - https://patchwork.ozlabs.org/project/uboot/list/?series=113364 - https://patchwork.ozlabs.org/project/uboot/list/?series=110856 - https://patchwork.ozlabs.org/project/uboot/list/?series=109677 Changes in v3: - No change. Changes in v2: - No change. arch/arm/include/asm/gpio.h |2 +- 1 files changed, 1 insertions(+), 1 deletions(-) diff --git a/arch/arm/include/asm/gpio.h b/arch/arm/include/asm/gpio.h index f78b976..b5adf5c 100644 --- a/arch/arm/include/asm/gpio.h +++ b/arch/arm/include/asm/gpio.h @@ -1,7 +1,7 @@ #if !defined(CONFIG_ARCH_UNIPHIER) && !defined(CONFIG_ARCH_STI) && \ !defined(CONFIG_ARCH_K3) && !defined(CONFIG_ARCH_BCM6858) && \ !defined(CONFIG_ARCH_BCM63158) && !defined(CONFIG_ARCH_ROCKCHIP) && \ - !defined(CONFIG_ARCH_LX2160A) + !defined(CONFIG_ARCH_LX2160A) && !defined(CONFIG_ARCH_LS1028A) #include #endif #include -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 4/4] armv8: dts: ls1028ardb: Add slave nodes under the i2c0 controller
This patch adds some slave nodes to support the i2c dm on the device side under the i2c0 controller. Signed-off-by: Chuanhua Han --- depends on: - https://patchwork.ozlabs.org/project/uboot/list/?series=113364 - https://patchwork.ozlabs.org/project/uboot/list/?series=110856 - https://patchwork.ozlabs.org/project/uboot/list/?series=109677 Changes in v3: - Delete unnecessary i2c slave nodes. Changes in v2: - Delete unnecessary aliases about i2c. arch/arm/dts/fsl-ls1028a-rdb.dts | 20 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/arch/arm/dts/fsl-ls1028a-rdb.dts b/arch/arm/dts/fsl-ls1028a-rdb.dts index 932cfa2..541c9bf 100644 --- a/arch/arm/dts/fsl-ls1028a-rdb.dts +++ b/arch/arm/dts/fsl-ls1028a-rdb.dts @@ -37,6 +37,26 @@ &i2c0 { status = "okay"; + u-boot,dm-pre-reloc; + +i2c-mux@77 { + + compatible = "nxp,pca9547"; + reg = <0x77>; + #address-cells = <1>; + #size-cells = <0>; + + i2c@3 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0x3>; + + rtc@51 { + compatible = "pcf2127-rtc"; + reg = <0x51>; + }; + }; + }; }; &i2c1 { -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v3 1/4] armv8: ls1028a: The ls1028a platform supports the I2C driver model
DM_I2C_COMPAT is a compatibility layer that allows using the non-DM I2C API when DM_I2C is used.When DM_I2C_COMPAT is not enabled for compilation, a compilation error will be generated. This patch solves the problem that the i2c-related api of the ls1028a platform does not support dm. Signed-off-by: Chuanhua Han --- depends on: - https://patchwork.ozlabs.org/project/uboot/list/?series=113364 - https://patchwork.ozlabs.org/project/uboot/list/?series=110856 - https://patchwork.ozlabs.org/project/uboot/list/?series=109677 Changes in v3: - No change. Changes in v2: - No change. arch/arm/cpu/armv8/fsl-layerscape/Kconfig |8 board/freescale/ls1028a/ls1028a.c |8 include/configs/ls1028a_common.h |3 --- include/configs/ls1028ardb.h |1 - 4 files changed, 8 insertions(+), 12 deletions(-) diff --git a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig index ffda02a..d6ef7fc 100644 --- a/arch/arm/cpu/armv8/fsl-layerscape/Kconfig +++ b/arch/arm/cpu/armv8/fsl-layerscape/Kconfig @@ -40,14 +40,6 @@ config ARCH_LS1028A select ARCH_EARLY_INIT_R select BOARD_EARLY_INIT_F select SYS_I2C_MXC - select SYS_I2C_MXC_I2C1 - select SYS_I2C_MXC_I2C2 - select SYS_I2C_MXC_I2C3 - select SYS_I2C_MXC_I2C4 - select SYS_I2C_MXC_I2C5 - select SYS_I2C_MXC_I2C6 - select SYS_I2C_MXC_I2C7 - select SYS_I2C_MXC_I2C8 select SYS_FSL_ERRATUM_A008997 select SYS_FSL_ERRATUM_A009007 select SYS_FSL_ERRATUM_A008514 if !TFABOOT diff --git a/board/freescale/ls1028a/ls1028a.c b/board/freescale/ls1028a/ls1028a.c index e5de4eb..49a9292 100644 --- a/board/freescale/ls1028a/ls1028a.c +++ b/board/freescale/ls1028a/ls1028a.c @@ -73,7 +73,15 @@ int board_init(void) #if defined(CONFIG_TARGET_LS1028ARDB) u8 val = I2C_MUX_CH_DEFAULT; +#ifndef CONFIG_DM_I2C i2c_write(I2C_MUX_PCA_ADDR_PRI, 0x0b, 1, &val, 1); +#else + struct udevice *dev; + + if (!i2c_get_chip_for_busnum(0, I2C_MUX_PCA_ADDR_PRI, 1, &dev)) + dm_i2c_write(dev, 0x0b, &val, 1); +#endif + #endif return 0; } diff --git a/include/configs/ls1028a_common.h b/include/configs/ls1028a_common.h index d3d787f..0fa5095 100644 --- a/include/configs/ls1028a_common.h +++ b/include/configs/ls1028a_common.h @@ -41,9 +41,6 @@ /* Size of malloc() pool */ #define CONFIG_SYS_MALLOC_LEN (CONFIG_ENV_SIZE + 2048 * 1024) -/* I2C */ -#define CONFIG_SYS_I2C - /* Serial Port */ #define CONFIG_CONS_INDEX 1 #define CONFIG_SYS_NS16550_SERIAL diff --git a/include/configs/ls1028ardb.h b/include/configs/ls1028ardb.h index 10791be..b77c36d 100644 --- a/include/configs/ls1028ardb.h +++ b/include/configs/ls1028ardb.h @@ -22,7 +22,6 @@ #define CONFIG_SYS_MONITOR_BASE CONFIG_SYS_TEXT_BASE #define CONFIG_QIXIS_I2C_ACCESS -#define CONFIG_SYS_I2C_EARLY_INIT /* * QIXIS Definitions -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 2/2] armv8: lx2160aqds : Add pcf2127 node
This patch adds the pcf2127-rtc node under the i2c0->i2c-mux@77->i2c@3 for lx2160aqds boards. Signed-off-by: Chuanhua Han --- depends on: - https://patchwork.ozlabs.org/project/uboot/list/?series=117203 - https://patchwork.ozlabs.org/project/uboot/list/?series=114242 Changes in v2: - Add dependency patch links. arch/arm/dts/fsl-lx2160a-qds.dts | 23 +++ 1 files changed, 23 insertions(+), 0 deletions(-) diff --git a/arch/arm/dts/fsl-lx2160a-qds.dts b/arch/arm/dts/fsl-lx2160a-qds.dts index 99836c4..34df0f5 100644 --- a/arch/arm/dts/fsl-lx2160a-qds.dts +++ b/arch/arm/dts/fsl-lx2160a-qds.dts @@ -23,6 +23,29 @@ status = "okay"; }; +&i2c0 { + status = "okay"; + u-boot,dm-pre-reloc; + + i2c-mux@77 { + compatible = "nxp,pca9547"; + reg = <0x77>; + #address-cells = <1>; + #size-cells = <0>; + + i2c@3 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0x3>; + + rtc@51 { + compatible = "pcf2127-rtc"; + reg = <0x51>; + }; + }; + }; +}; + &sata0 { status = "okay"; }; -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH v2 1/2] configs: lx2160aqds: enable DM support for pcf2127 rtc
Enable related configs on all lx2160aqds boards to support pcf2127 rtc DM function. Signed-off-by: Chuanhua Han --- depends on: - https://patchwork.ozlabs.org/project/uboot/list/?series=117203 - https://patchwork.ozlabs.org/project/uboot/list/?series=114242 Changes in v2: - Add dependency patch links. configs/lx2160aqds_tfa_SECURE_BOOT_defconfig |7 +++ configs/lx2160aqds_tfa_defconfig |7 +++ 2 files changed, 14 insertions(+), 0 deletions(-) diff --git a/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig b/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig index a6a253f..949b00d 100644 --- a/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig +++ b/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig @@ -61,3 +61,10 @@ CONFIG_RSA=y CONFIG_SPL_RSA=y CONFIG_RSA_SOFTWARE_EXP=y CONFIG_EFI_LOADER_BOUNCE_BUFFER=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y +CONFIG_DM_GPIO=y +CONFIG_CMD_DATE=y +CONFIG_RTC_PCF2127=y +CONFIG_I2C_MUX=y +CONFIG_I2C_MUX_PCA954x=y diff --git a/configs/lx2160aqds_tfa_defconfig b/configs/lx2160aqds_tfa_defconfig index d68b40d..395fc0b 100644 --- a/configs/lx2160aqds_tfa_defconfig +++ b/configs/lx2160aqds_tfa_defconfig @@ -57,3 +57,10 @@ CONFIG_DM_USB=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_DWC3=y CONFIG_EFI_LOADER_BOUNCE_BUFFER=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y +CONFIG_DM_GPIO=y +CONFIG_CMD_DATE=y +CONFIG_RTC_PCF2127=y +CONFIG_I2C_MUX=y +CONFIG_I2C_MUX_PCA954x=y -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 2/2] armv8: lx2160aqds : Add pcf2127 node
This patch adds the pcf2127-rtc node under the i2c0->i2c-mux@77->i2c@3 for lx2160aqds boards. Signed-off-by: Chuanhua Han --- arch/arm/dts/fsl-lx2160a-qds.dts | 23 +++ 1 files changed, 23 insertions(+), 0 deletions(-) diff --git a/arch/arm/dts/fsl-lx2160a-qds.dts b/arch/arm/dts/fsl-lx2160a-qds.dts index 99836c4..34df0f5 100644 --- a/arch/arm/dts/fsl-lx2160a-qds.dts +++ b/arch/arm/dts/fsl-lx2160a-qds.dts @@ -23,6 +23,29 @@ status = "okay"; }; +&i2c0 { + status = "okay"; + u-boot,dm-pre-reloc; + + i2c-mux@77 { + compatible = "nxp,pca9547"; + reg = <0x77>; + #address-cells = <1>; + #size-cells = <0>; + + i2c@3 { + #address-cells = <1>; + #size-cells = <0>; + reg = <0x3>; + + rtc@51 { + compatible = "pcf2127-rtc"; + reg = <0x51>; + }; + }; + }; +}; + &sata0 { status = "okay"; }; -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot
[U-Boot] [PATCH 1/2] configs: lx2160aqds: enable DM support for pcf2127 rtc
Enable related configs on all lx2160aqds boards to support pcf2127 rtc DM function. Signed-off-by: Chuanhua Han --- configs/lx2160aqds_tfa_SECURE_BOOT_defconfig |7 +++ configs/lx2160aqds_tfa_defconfig |7 +++ 2 files changed, 14 insertions(+), 0 deletions(-) diff --git a/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig b/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig index a6a253f..949b00d 100644 --- a/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig +++ b/configs/lx2160aqds_tfa_SECURE_BOOT_defconfig @@ -61,3 +61,10 @@ CONFIG_RSA=y CONFIG_SPL_RSA=y CONFIG_RSA_SOFTWARE_EXP=y CONFIG_EFI_LOADER_BOUNCE_BUFFER=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y +CONFIG_DM_GPIO=y +CONFIG_CMD_DATE=y +CONFIG_RTC_PCF2127=y +CONFIG_I2C_MUX=y +CONFIG_I2C_MUX_PCA954x=y diff --git a/configs/lx2160aqds_tfa_defconfig b/configs/lx2160aqds_tfa_defconfig index d68b40d..395fc0b 100644 --- a/configs/lx2160aqds_tfa_defconfig +++ b/configs/lx2160aqds_tfa_defconfig @@ -57,3 +57,10 @@ CONFIG_DM_USB=y CONFIG_USB_XHCI_HCD=y CONFIG_USB_XHCI_DWC3=y CONFIG_EFI_LOADER_BOUNCE_BUFFER=y +CONFIG_DM_I2C=y +CONFIG_DM_RTC=y +CONFIG_DM_GPIO=y +CONFIG_CMD_DATE=y +CONFIG_RTC_PCF2127=y +CONFIG_I2C_MUX=y +CONFIG_I2C_MUX_PCA954x=y -- 1.7.1 ___ U-Boot mailing list U-Boot@lists.denx.de https://lists.denx.de/listinfo/u-boot