All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] armv8: ls1088ardb: support force SDHC mode by hwconfig
@ 2017-11-27  7:40 Yangbo Lu
  2017-11-29 19:42 ` York Sun
  2017-12-19 16:01 ` York Sun
  0 siblings, 2 replies; 4+ messages in thread
From: Yangbo Lu @ 2017-11-27  7:40 UTC (permalink / raw)
  To: u-boot

The BRDCFG5[SPISDHC] register field of Qixis device is used
to control SPI and SDHC signal routing.

10 = Force SDHC Mode
  - SPI_CS[0] is routed to CPLD for SDHC_VS use.
  - SPI_CS[1] is unused.
  - SPI_CS[2:3] are routed to the TDMRiser slot.

11 = Force eMMC Mode
  - SPI_CS[0:3] are routed to the eMMC card.

0X = Auto Mode
  - If SDHC_CS_B=0 (SDHC card installed): Use SDHC mode
    described above.
  - Else SDHC_CS_B=1 (no SDHC card installed): Use eMMC
    mode described above.

In default the hardware uses auto mode, but sometimes we need
to use force SDHC mode to support SD card hotplug, or SD sleep
waking up in kernel. This patch is to support force SDHC mode
by hwconfig.

Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
---
 board/freescale/ls1088a/ls1088a.c       | 18 ++++++++++++++++++
 board/freescale/ls1088a/ls1088a_qixis.h |  6 ++++++
 include/configs/ls1088ardb.h            |  2 ++
 3 files changed, 26 insertions(+)

diff --git a/board/freescale/ls1088a/ls1088a.c b/board/freescale/ls1088a/ls1088a.c
index 96d9ae7f1d..60f40edb5a 100644
--- a/board/freescale/ls1088a/ls1088a.c
+++ b/board/freescale/ls1088a/ls1088a.c
@@ -18,6 +18,7 @@
 #include <environment.h>
 #include <asm/arch-fsl-layerscape/soc.h>
 #include <asm/arch/ppa.h>
+#include <hwconfig.h>
 
 #include "../common/qixis.h"
 #include "ls1088a_qixis.h"
@@ -296,6 +297,23 @@ void board_retimer_init(void)
 	select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT);
 }
 
+#ifdef CONFIG_MISC_INIT_R
+int misc_init_r(void)
+{
+#ifdef CONFIG_TARGET_LS1088ARDB
+	u8 brdcfg5;
+
+	if (hwconfig("esdhc-force-sd")) {
+		brdcfg5 = QIXIS_READ(brdcfg[5]);
+		brdcfg5 &= ~BRDCFG5_SPISDHC_MASK;
+		brdcfg5 |= BRDCFG5_FORCE_SD;
+		QIXIS_WRITE(brdcfg[5], brdcfg5);
+	}
+#endif
+	return 0;
+}
+#endif
+
 int board_init(void)
 {
 	init_final_memctl_regs();
diff --git a/board/freescale/ls1088a/ls1088a_qixis.h b/board/freescale/ls1088a/ls1088a_qixis.h
index 4790461b47..6cad396cff 100644
--- a/board/freescale/ls1088a/ls1088a_qixis.h
+++ b/board/freescale/ls1088a/ls1088a_qixis.h
@@ -36,4 +36,10 @@
 #define BRDCFG9_SFPTX_MASK		0x10
 #define BRDCFG9_SFPTX_SHIFT		4
 
+/* Definitions of QIXIS Registers for LS1088ARDB */
+
+/* BRDCFG5 */
+#define BRDCFG5_SPISDHC_MASK		0x0C
+#define BRDCFG5_FORCE_SD		0x08
+
 #endif
diff --git a/include/configs/ls1088ardb.h b/include/configs/ls1088ardb.h
index e6bf2b8d87..f7b502d1b0 100644
--- a/include/configs/ls1088ardb.h
+++ b/include/configs/ls1088ardb.h
@@ -11,6 +11,8 @@
 
 #define CONFIG_DISPLAY_BOARDINFO_LATE
 
+#define CONFIG_MISC_INIT_R
+
 #if defined(CONFIG_QSPI_BOOT)
 #define CONFIG_ENV_SIZE			0x2000          /* 8KB */
 #define CONFIG_ENV_OFFSET		0x300000        /* 3MB */
-- 
2.14.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] armv8: ls1088ardb: support force SDHC mode by hwconfig
  2017-11-27  7:40 [U-Boot] [PATCH] armv8: ls1088ardb: support force SDHC mode by hwconfig Yangbo Lu
@ 2017-11-29 19:42 ` York Sun
  2017-11-30  4:22   ` Y.b. Lu
  2017-12-19 16:01 ` York Sun
  1 sibling, 1 reply; 4+ messages in thread
From: York Sun @ 2017-11-29 19:42 UTC (permalink / raw)
  To: u-boot

On 11/26/2017 11:59 PM, Yangbo Lu wrote:
> The BRDCFG5[SPISDHC] register field of Qixis device is used
> to control SPI and SDHC signal routing.
> 
> 10 = Force SDHC Mode
>   - SPI_CS[0] is routed to CPLD for SDHC_VS use.
>   - SPI_CS[1] is unused.
>   - SPI_CS[2:3] are routed to the TDMRiser slot.
> 
> 11 = Force eMMC Mode
>   - SPI_CS[0:3] are routed to the eMMC card.
> 
> 0X = Auto Mode
>   - If SDHC_CS_B=0 (SDHC card installed): Use SDHC mode
>     described above.
>   - Else SDHC_CS_B=1 (no SDHC card installed): Use eMMC
>     mode described above.
> 
> In default the hardware uses auto mode, but sometimes we need
> to use force SDHC mode to support SD card hotplug, or SD sleep
> waking up in kernel. This patch is to support force SDHC mode
> by hwconfig.


Help me understand this. When you eject the SD card, does the CPLD logic
detect the SDHC_CS_B and change the signal routing? Are you trying to
fix the signal routing by forcing the mode?

> 
> Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
> ---
>  board/freescale/ls1088a/ls1088a.c       | 18 ++++++++++++++++++
>  board/freescale/ls1088a/ls1088a_qixis.h |  6 ++++++
>  include/configs/ls1088ardb.h            |  2 ++
>  3 files changed, 26 insertions(+)
> 
> diff --git a/board/freescale/ls1088a/ls1088a.c b/board/freescale/ls1088a/ls1088a.c
> index 96d9ae7f1d..60f40edb5a 100644
> --- a/board/freescale/ls1088a/ls1088a.c
> +++ b/board/freescale/ls1088a/ls1088a.c
> @@ -18,6 +18,7 @@
>  #include <environment.h>
>  #include <asm/arch-fsl-layerscape/soc.h>
>  #include <asm/arch/ppa.h>
> +#include <hwconfig.h>
>  
>  #include "../common/qixis.h"
>  #include "ls1088a_qixis.h"
> @@ -296,6 +297,23 @@ void board_retimer_init(void)
>  	select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT);
>  }
>  
> +#ifdef CONFIG_MISC_INIT_R
> +int misc_init_r(void)
> +{
> +#ifdef CONFIG_TARGET_LS1088ARDB
> +	u8 brdcfg5;
> +
> +	if (hwconfig("esdhc-force-sd")) {
> +		brdcfg5 = QIXIS_READ(brdcfg[5]);
> +		brdcfg5 &= ~BRDCFG5_SPISDHC_MASK;
> +		brdcfg5 |= BRDCFG5_FORCE_SD;
> +		QIXIS_WRITE(brdcfg[5], brdcfg5);
> +	}
> +#endif

Would it be appropriate to check if eMMC is used before taking the
forced value?

York

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] armv8: ls1088ardb: support force SDHC mode by hwconfig
  2017-11-29 19:42 ` York Sun
@ 2017-11-30  4:22   ` Y.b. Lu
  0 siblings, 0 replies; 4+ messages in thread
From: Y.b. Lu @ 2017-11-30  4:22 UTC (permalink / raw)
  To: u-boot

Hi York,

See my comments inline.
Thanks a lot.

Best regards,
Yangbo Lu

> -----Original Message-----
> From: York Sun
> Sent: 2017年11月30日 3:43
> To: Y.b. Lu <yangbo.lu@nxp.com>; u-boot at lists.denx.de
> Subject: Re: [PATCH] armv8: ls1088ardb: support force SDHC mode by
> hwconfig
> 
> On 11/26/2017 11:59 PM, Yangbo Lu wrote:
> > The BRDCFG5[SPISDHC] register field of Qixis device is used to control
> > SPI and SDHC signal routing.
> >
> > 10 = Force SDHC Mode
> >   - SPI_CS[0] is routed to CPLD for SDHC_VS use.
> >   - SPI_CS[1] is unused.
> >   - SPI_CS[2:3] are routed to the TDMRiser slot.
> >
> > 11 = Force eMMC Mode
> >   - SPI_CS[0:3] are routed to the eMMC card.
> >
> > 0X = Auto Mode
> >   - If SDHC_CS_B=0 (SDHC card installed): Use SDHC mode
> >     described above.
> >   - Else SDHC_CS_B=1 (no SDHC card installed): Use eMMC
> >     mode described above.
> >
> > In default the hardware uses auto mode, but sometimes we need to use
> > force SDHC mode to support SD card hotplug, or SD sleep waking up in
> > kernel. This patch is to support force SDHC mode by hwconfig.
> 
> 
> Help me understand this. When you eject the SD card, does the CPLD logic
> detect the SDHC_CS_B and change the signal routing? Are you trying to fix the
> signal routing by forcing the mode?
> 

[Y.b. Lu] In default auto mode, signals would be switched automatically. (Actually I found signals routing issue, I will explain it later.)
When there is a SD card hotplug, it means there also is a eMMC hotplug.
For kernel, there is no way to detect eMMC hotplug which is a non-removable device. So kernel couldn’t handle SD/eMMC automatic switching case.
With the auto mode, we couldn’t support SD hotplug and SD waking up for sleep such cases.
So I added this hwconfig to use force SD mode.

Let's see the signals routing issue I mentioned above.
Actually I found SDHC_CD signal and SDHC_WP signal were mixed up in auto mode.
The SDHC_CD signal of chip was routed to SDHC_WP signal of card slot in default auto mode. The SDHC_WP couldn’t work as expect either.
In force SD mode, the SDHC_CD worked well. I will add you into the email about this issue.

Anyway, hwconfig for force SD mode enabling is needed.
Thanks a lot.

> >
> > Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
> > ---
> >  board/freescale/ls1088a/ls1088a.c       | 18 ++++++++++++++++++
> >  board/freescale/ls1088a/ls1088a_qixis.h |  6 ++++++
> >  include/configs/ls1088ardb.h            |  2 ++
> >  3 files changed, 26 insertions(+)
> >
> > diff --git a/board/freescale/ls1088a/ls1088a.c
> > b/board/freescale/ls1088a/ls1088a.c
> > index 96d9ae7f1d..60f40edb5a 100644
> > --- a/board/freescale/ls1088a/ls1088a.c
> > +++ b/board/freescale/ls1088a/ls1088a.c
> > @@ -18,6 +18,7 @@
> >  #include <environment.h>
> >  #include <asm/arch-fsl-layerscape/soc.h>  #include <asm/arch/ppa.h>
> > +#include <hwconfig.h>
> >
> >  #include "../common/qixis.h"
> >  #include "ls1088a_qixis.h"
> > @@ -296,6 +297,23 @@ void board_retimer_init(void)
> >  	select_i2c_ch_pca9547(I2C_MUX_CH_DEFAULT);
> >  }
> >
> > +#ifdef CONFIG_MISC_INIT_R
> > +int misc_init_r(void)
> > +{
> > +#ifdef CONFIG_TARGET_LS1088ARDB
> > +	u8 brdcfg5;
> > +
> > +	if (hwconfig("esdhc-force-sd")) {
> > +		brdcfg5 = QIXIS_READ(brdcfg[5]);
> > +		brdcfg5 &= ~BRDCFG5_SPISDHC_MASK;
> > +		brdcfg5 |= BRDCFG5_FORCE_SD;
> > +		QIXIS_WRITE(brdcfg[5], brdcfg5);
> > +	}
> > +#endif
> 
> Would it be appropriate to check if eMMC is used before taking the forced
> value?
> 
> York

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [U-Boot] [PATCH] armv8: ls1088ardb: support force SDHC mode by hwconfig
  2017-11-27  7:40 [U-Boot] [PATCH] armv8: ls1088ardb: support force SDHC mode by hwconfig Yangbo Lu
  2017-11-29 19:42 ` York Sun
@ 2017-12-19 16:01 ` York Sun
  1 sibling, 0 replies; 4+ messages in thread
From: York Sun @ 2017-12-19 16:01 UTC (permalink / raw)
  To: u-boot

On 11/26/2017 11:59 PM, Yangbo Lu wrote:
> The BRDCFG5[SPISDHC] register field of Qixis device is used
> to control SPI and SDHC signal routing.
> 
> 10 = Force SDHC Mode
>   - SPI_CS[0] is routed to CPLD for SDHC_VS use.
>   - SPI_CS[1] is unused.
>   - SPI_CS[2:3] are routed to the TDMRiser slot.
> 
> 11 = Force eMMC Mode
>   - SPI_CS[0:3] are routed to the eMMC card.
> 
> 0X = Auto Mode
>   - If SDHC_CS_B=0 (SDHC card installed): Use SDHC mode
>     described above.
>   - Else SDHC_CS_B=1 (no SDHC card installed): Use eMMC
>     mode described above.
> 
> In default the hardware uses auto mode, but sometimes we need
> to use force SDHC mode to support SD card hotplug, or SD sleep
> waking up in kernel. This patch is to support force SDHC mode
> by hwconfig.
> 
> Signed-off-by: Yangbo Lu <yangbo.lu@nxp.com>
> ---

Applied to fsl-qoriq master. Thanks.

York

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-12-19 16:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-11-27  7:40 [U-Boot] [PATCH] armv8: ls1088ardb: support force SDHC mode by hwconfig Yangbo Lu
2017-11-29 19:42 ` York Sun
2017-11-30  4:22   ` Y.b. Lu
2017-12-19 16:01 ` York Sun

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.