All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 0/2] Fixes for MMC gates series
@ 2019-01-23  1:48 Andre Przywara
  2019-01-23  1:48 ` [U-Boot] [PATCH 1/2] sunxi: board: do MMC pinmux setup for DM_MMC builds Andre Przywara
  2019-01-23  1:48 ` [U-Boot] [PATCH 2/2] sunxi: clk: enable clk and reset for CCU devices Andre Przywara
  0 siblings, 2 replies; 3+ messages in thread
From: Andre Przywara @ 2019-01-23  1:48 UTC (permalink / raw)
  To: u-boot

Hi,

there were two issues mentioned on the ML with the MMC gates series
(many thanks to the diligent testers!):
1) When booting from SPI or via USB FEL, any MMC device (SD or eMMC) is
not working, as we miss the pinmux setup. Fix this is patch 1 in a
slightly hackish, but working way.

2) The odd MMC config clock in the A80 SoC has parent clocks and reset
gates of its own, which need to be enabled before this clocks is usable.
Simple scan for all listed clocks and reset gates in the generic CCU
probe function and enable all of them.

Jagan, can you please pick those two patches for the MMC gates series?
Patch 1 should come before enabling DM_MMC, patch 2 before the A80 MMC
clock patch.

Cheers,
Andre.

Andre Przywara (2):
  sunxi: board: do MMC pinmux setup for DM_MMC builds
  sunxi: clk: enable clk and reset for CCU devices

 board/sunxi/board.c           | 13 +++++++++++++
 drivers/clk/sunxi/clk_sunxi.c | 11 +++++++++++
 2 files changed, 24 insertions(+)

-- 
2.14.5

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

* [U-Boot] [PATCH 1/2] sunxi: board: do MMC pinmux setup for DM_MMC builds
  2019-01-23  1:48 [U-Boot] [PATCH 0/2] Fixes for MMC gates series Andre Przywara
@ 2019-01-23  1:48 ` Andre Przywara
  2019-01-23  1:48 ` [U-Boot] [PATCH 2/2] sunxi: clk: enable clk and reset for CCU devices Andre Przywara
  1 sibling, 0 replies; 3+ messages in thread
From: Andre Przywara @ 2019-01-23  1:48 UTC (permalink / raw)
  To: u-boot

Enabling DM_MMC skips the call to mmc_pinmux_setup() in board.c, as this
is supposed to be handled by the MMC driver, using DT information.

However we don't have a pinctrl driver yet, but would still like to keep
the working pinmux setup for our MMC devices. So bring this particular
call back to the DM_MMC code flow.

This worked so far when booting from either SD card or eMMC, as the SPL
does the setup for us, but booting from SPI or USB would have rendered
all SD devices unusable.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
 board/sunxi/board.c | 13 +++++++++++++
 1 file changed, 13 insertions(+)

diff --git a/board/sunxi/board.c b/board/sunxi/board.c
index ad14837291..8e978e5388 100644
--- a/board/sunxi/board.c
+++ b/board/sunxi/board.c
@@ -208,6 +208,8 @@ enum env_location env_get_location(enum env_operation op, int prio)
 }
 #endif
 
+static void mmc_pinmux_setup(int sdc);
+
 /* add board specific code here */
 int board_init(void)
 {
@@ -269,6 +271,17 @@ int board_init(void)
 	i2c_init_board();
 #endif
 
+#ifdef CONFIG_DM_MMC
+	/*
+	 * Temporary workaround for enabling MMC clocks until a sunxi DM
+	 * pinctrl driver lands.
+	 */
+	mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT);
+#if CONFIG_MMC_SUNXI_SLOT_EXTRA != -1
+	mmc_pinmux_setup(CONFIG_MMC_SUNXI_SLOT_EXTRA);
+#endif
+#endif	/* CONFIG_DM_MMC */
+
 	/* Uses dm gpio code so do this here and not in i2c_init_board() */
 	return soft_i2c_board_init();
 }
-- 
2.14.5

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

* [U-Boot] [PATCH 2/2] sunxi: clk: enable clk and reset for CCU devices
  2019-01-23  1:48 [U-Boot] [PATCH 0/2] Fixes for MMC gates series Andre Przywara
  2019-01-23  1:48 ` [U-Boot] [PATCH 1/2] sunxi: board: do MMC pinmux setup for DM_MMC builds Andre Przywara
@ 2019-01-23  1:48 ` Andre Przywara
  1 sibling, 0 replies; 3+ messages in thread
From: Andre Przywara @ 2019-01-23  1:48 UTC (permalink / raw)
  To: u-boot

Some Allwinner clock devices have parent clocks and reset gates
themselves, which need to be activated for them to work.

Add some code to just assert all resets and enable all clocks given.
This should enable the A80 MMC config clock, which requires both to be
activated. The full CCU devices typically don't require resets, and have
just fixed clocks as their parents. Since we treat both as optional and
enabling fixed clocks is a NOP, this works for all cases, without the need
to differentiate between those clock types.

Signed-off-by: Andre Przywara <andre.przywara@arm.com>
---
 drivers/clk/sunxi/clk_sunxi.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/drivers/clk/sunxi/clk_sunxi.c b/drivers/clk/sunxi/clk_sunxi.c
index 62ce2994e4..05c1297932 100644
--- a/drivers/clk/sunxi/clk_sunxi.c
+++ b/drivers/clk/sunxi/clk_sunxi.c
@@ -61,6 +61,9 @@ struct clk_ops sunxi_clk_ops = {
 int sunxi_clk_probe(struct udevice *dev)
 {
 	struct ccu_priv *priv = dev_get_priv(dev);
+	struct clk_bulk clk_bulk;
+	struct reset_bulk rst_bulk;
+	int ret;
 
 	priv->base = dev_read_addr_ptr(dev);
 	if (!priv->base)
@@ -70,5 +73,13 @@ int sunxi_clk_probe(struct udevice *dev)
 	if (!priv->desc)
 		return -EINVAL;
 
+	ret = clk_get_bulk(dev, &clk_bulk);
+	if (!ret)
+		clk_enable_bulk(&clk_bulk);
+
+	ret = reset_get_bulk(dev, &rst_bulk);
+	if (!ret)
+		reset_deassert_bulk(&rst_bulk);
+
 	return 0;
 }
-- 
2.14.5

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

end of thread, other threads:[~2019-01-23  1:48 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-01-23  1:48 [U-Boot] [PATCH 0/2] Fixes for MMC gates series Andre Przywara
2019-01-23  1:48 ` [U-Boot] [PATCH 1/2] sunxi: board: do MMC pinmux setup for DM_MMC builds Andre Przywara
2019-01-23  1:48 ` [U-Boot] [PATCH 2/2] sunxi: clk: enable clk and reset for CCU devices Andre Przywara

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.