public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: David Wu <david.wu@rock-chips.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 1/2] arm: rockchip: rk3308: Initialize the iomux configuration
Date: Tue, 26 Nov 2019 09:06:42 +0800	[thread overview]
Message-ID: <20191126010643.7218-1-david.wu@rock-chips.com> (raw)

When we want to use plus iomux feature, we need to enable
them at spl.

Signed-off-by: David Wu <david.wu@rock-chips.com>
---
 arch/arm/mach-rockchip/rk3308/rk3308.c | 33 ++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)

diff --git a/arch/arm/mach-rockchip/rk3308/rk3308.c b/arch/arm/mach-rockchip/rk3308/rk3308.c
index f27f9e8c0b..bd99899094 100644
--- a/arch/arm/mach-rockchip/rk3308/rk3308.c
+++ b/arch/arm/mach-rockchip/rk3308/rk3308.c
@@ -72,6 +72,11 @@ enum {
 	UART2_IO_SEL_M1,
 	UART2_IO_SEL_USB,
 
+	GPIO2C0_SEL_SRC_CTRL_SHIFT	= 11,
+	GPIO2C0_SEL_SRC_CTRL_MASK	= BIT(11),
+	GPIO2C0_SEL_SRC_CTRL_IOMUX	= 0,
+	GPIO2C0_SEL_SRC_CTRL_SEL_PLUS,
+
 	GPIO3B3_SEL_SRC_CTRL_SHIFT	= 7,
 	GPIO3B3_SEL_SRC_CTRL_MASK	= BIT(7),
 	GPIO3B3_SEL_SRC_CTRL_IOMUX	= 0,
@@ -97,6 +102,18 @@ enum {
 	GPIO3B2_SEL_PLUS_EMMC_RSTN,
 	GPIO3B2_SEL_PLUS_SPI1_MISO,
 	GPIO3B2_SEL_PLUS_LCDC_D22_M1,
+
+	I2C3_IOFUNC_SRC_CTRL_SHIFT	= 10,
+	I2C3_IOFUNC_SRC_CTRL_MASK	= BIT(10),
+	I2C3_IOFUNC_SRC_CTRL_SEL_PLUS	= 1,
+
+	GPIO2A3_SEL_SRC_CTRL_SHIFT	= 7,
+	GPIO2A3_SEL_SRC_CTRL_MASK	= BIT(7),
+	GPIO2A3_SEL_SRC_CTRL_SEL_PLUS	= 1,
+
+	GPIO2A2_SEL_SRC_CTRL_SHIFT	= 3,
+	GPIO2A2_SEL_SRC_CTRL_MASK	= BIT(3),
+	GPIO2A2_SEL_SRC_CTRL_SEL_PLUS	= 1,
 };
 
 enum {
@@ -166,10 +183,26 @@ __weak void board_debug_uart_init(void)
 int arch_cpu_init(void)
 {
 	static struct rk3308_sgrf * const sgrf = (void *)SGRF_BASE;
+	static struct rk3308_grf * const grf = (void *)GRF_BASE;
 
 	/* Set CRYPTO SDMMC EMMC NAND SFC USB master bus to be secure access */
 	rk_clrreg(&sgrf->con_secure0, 0x2b83);
 
+
+	rk_clrsetreg(&grf->soc_con13,
+		     I2C3_IOFUNC_SRC_CTRL_MASK | GPIO2A3_SEL_SRC_CTRL_MASK |
+		     GPIO2A2_SEL_SRC_CTRL_MASK,
+		     I2C3_IOFUNC_SRC_CTRL_SEL_PLUS << I2C3_IOFUNC_SRC_CTRL_SHIFT |
+		     GPIO2A3_SEL_SRC_CTRL_SEL_PLUS << GPIO2A3_SEL_SRC_CTRL_SHIFT |
+		     GPIO2A2_SEL_SRC_CTRL_SEL_PLUS << GPIO2A2_SEL_SRC_CTRL_SHIFT);
+
+	rk_clrsetreg(&grf->soc_con15,
+		     GPIO2C0_SEL_SRC_CTRL_MASK | GPIO3B3_SEL_SRC_CTRL_MASK |
+		     GPIO3B2_SEL_SRC_CTRL_MASK,
+		     GPIO2C0_SEL_SRC_CTRL_SEL_PLUS << GPIO2C0_SEL_SRC_CTRL_SHIFT |
+		     GPIO3B3_SEL_SRC_CTRL_SEL_PLUS << GPIO3B3_SEL_SRC_CTRL_SHIFT |
+		     GPIO3B3_SEL_SRC_CTRL_SEL_PLUS << GPIO3B2_SEL_SRC_CTRL_SHIFT);
+
 	return 0;
 }
 #endif
-- 
2.19.1

             reply	other threads:[~2019-11-26  1:06 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-26  1:06 David Wu [this message]
2019-11-26  1:06 ` [U-Boot] [PATCH 2/2] pinctrl: rockchip: Add pinctrl support for rk3308 David Wu
2019-11-27  3:14   ` Kever Yang
2019-11-27  3:02 ` [U-Boot] [PATCH 1/2] arm: rockchip: rk3308: Initialize the iomux configuration Kever Yang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191126010643.7218-1-david.wu@rock-chips.com \
    --to=david.wu@rock-chips.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox