[U-Boot] [PATCH v2 1/4] rockchip: evb-rk3328: set uart2 io routing to M1

In rk3328, some function pin may have more than one choice, and muxed with more than one IO, for example, the UART2 controller IO, TX and RX, have 3 choice(setting in com_iomux): - M0 which mux with GPIO1A0/GPIO1A1 - M1 which mux with GPIO2A0/GPIO2A1 - usb2phy which mux with USB2.0 DP/DM pin.
This suppose to be set in SPL, but the U-Boot is also design to co-work with Rockchip SPL(miniloader) which may not setting this config, let's set this config to make sure the UART2 TX/RX working in U-Boot.
Signed-off-by: Kever Yang kever.yang@rock-chips.com ---
Changes in v2: - remove SDMMC io routing
board/rockchip/evb_rk3328/evb-rk3328.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/board/rockchip/evb_rk3328/evb-rk3328.c b/board/rockchip/evb_rk3328/evb-rk3328.c index 0a26ed5..823c5da 100644 --- a/board/rockchip/evb_rk3328/evb-rk3328.c +++ b/board/rockchip/evb_rk3328/evb-rk3328.c @@ -5,7 +5,10 @@ */
#include <common.h> +#include <asm/arch/hardware.h> +#include <asm/arch/grf_rk3328.h> #include <asm/armv8/mmu.h> +#include <asm/io.h> #include <dwc3-uboot.h> #include <usb.h>
@@ -13,6 +16,13 @@ DECLARE_GLOBAL_DATA_PTR;
int board_init(void) { +#define GRF_BASE 0xff100000 + struct rk3328_grf_regs * const grf = (void *)GRF_BASE; + + /* uart2 select m1, sdcard select m1*/ + rk_clrsetreg(&grf->com_iomux, IOMUX_SEL_UART2_MASK, + IOMUX_SEL_UART2_M1 << IOMUX_SEL_UART2_SHIFT); + return 0; }

SDMMC-PWREN is a pin to control voltage for SDMMC IO, it may be high active or low active, the dwmmc driver always assume the sdmmc-pwren as high active.
Kernel treat this pin as fixed regulator instead of a pin from controller, and then it can set in dts file upon board schematic, that's a good solution, we can also do this in u-boot.
Signed-off-by: Kever Yang kever.yang@rock-chips.com Acked-by: Simon Glass sjg@chromium.org ---
Changes in v2: None
drivers/pinctrl/rockchip/pinctrl_rk3328.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
diff --git a/drivers/pinctrl/rockchip/pinctrl_rk3328.c b/drivers/pinctrl/rockchip/pinctrl_rk3328.c index d0ffeb1..f3e7eec 100644 --- a/drivers/pinctrl/rockchip/pinctrl_rk3328.c +++ b/drivers/pinctrl/rockchip/pinctrl_rk3328.c @@ -184,13 +184,11 @@ static void pinctrl_rk3328_sdmmc_config(struct rk3328_grf_regs *grf, if (com_iomux & IOMUX_SEL_SDMMC_MASK) rk_clrsetreg(&grf->gpio0d_iomux, GPIO0D6_SEL_MASK, - GPIO0D6_SDMMC0_PWRENM1 - << GPIO0D6_SEL_SHIFT); + GPIO0D6_GPIO << GPIO0D6_SEL_SHIFT); else rk_clrsetreg(&grf->gpio2a_iomux, GPIO2A7_SEL_MASK, - GPIO2A7_SDMMC0_PWRENM0 - << GPIO2A7_SEL_SHIFT); + GPIO2A7_GPIO << GPIO2A7_SEL_SHIFT); rk_clrsetreg(&grf->gpio1a_iomux, GPIO1A0_SEL_MASK, GPIO1A0_CARD_DATA_CLK_CMD_DETN

SDMMC-PWREN is a pin to control voltage for SDMMC IO, it may be high active or low active, the dwmmc driver always assume the sdmmc-pwren as high active.
Kernel treat this pin as fixed regulator instead of a pin from controller, and then it can set in dts file upon board schematic, that's a good solution, we can also do this in u-boot.
Signed-off-by: Kever Yang kever.yang@rock-chips.com Acked-by: Simon Glass sjg@chromium.org
Changes in v2: None
drivers/pinctrl/rockchip/pinctrl_rk3328.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

SDMMC-PWREN is a pin to control voltage for SDMMC IO, it may be high active or low active, the dwmmc driver always assume the sdmmc-pwren as high active.
Kernel treat this pin as fixed regulator instead of a pin from controller, and then it can set in dts file upon board schematic, that's a good solution, we can also do this in u-boot.
Signed-off-by: Kever Yang kever.yang@rock-chips.com Acked-by: Simon Glass sjg@chromium.org Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
Changes in v2: None
drivers/pinctrl/rockchip/pinctrl_rk3328.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

SDMMC-PWREN is a pin to control voltage for SDMMC IO, it may be high active or low active, the dwmmc driver always assume the sdmmc-pwren as high active.
Kernel treat this pin as fixed regulator instead of a pin from controller, and then it can set in dts file upon board schematic, that's a good solution, we can also do this in u-boot.
Signed-off-by: Kever Yang kever.yang@rock-chips.com Acked-by: Simon Glass sjg@chromium.org Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
Changes in v2: None
drivers/pinctrl/rockchip/pinctrl_rk3328.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-)
Applied to u-boot-rockchip/next, thanks!

Enable all the boot-on regulator in default.
Signed-off-by: Kever Yang kever.yang@rock-chips.com Acked-by: Simon Glass sjg@chromium.org ---
Changes in v2: None
board/rockchip/evb_rk3328/evb-rk3328.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/board/rockchip/evb_rk3328/evb-rk3328.c b/board/rockchip/evb_rk3328/evb-rk3328.c index 823c5da..cabc959 100644 --- a/board/rockchip/evb_rk3328/evb-rk3328.c +++ b/board/rockchip/evb_rk3328/evb-rk3328.c @@ -10,12 +10,14 @@ #include <asm/armv8/mmu.h> #include <asm/io.h> #include <dwc3-uboot.h> +#include <power/regulator.h> #include <usb.h>
DECLARE_GLOBAL_DATA_PTR;
int board_init(void) { + int ret; #define GRF_BASE 0xff100000 struct rk3328_grf_regs * const grf = (void *)GRF_BASE;
@@ -23,7 +25,11 @@ int board_init(void) rk_clrsetreg(&grf->com_iomux, IOMUX_SEL_UART2_MASK, IOMUX_SEL_UART2_M1 << IOMUX_SEL_UART2_SHIFT);
- return 0; + ret = regulators_enable_boot_on(false); + if (ret) + debug("%s: Cannot enable boot on regulator\n", __func__); + + return ret; }
int dram_init(void)

Enable all the boot-on regulator in default.
Signed-off-by: Kever Yang kever.yang@rock-chips.com Acked-by: Simon Glass sjg@chromium.org
Changes in v2: None
board/rockchip/evb_rk3328/evb-rk3328.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

Enable all the boot-on regulator in default.
Signed-off-by: Kever Yang kever.yang@rock-chips.com Acked-by: Simon Glass sjg@chromium.org Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
Changes in v2: None
board/rockchip/evb_rk3328/evb-rk3328.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

Enable all the boot-on regulator in default.
Signed-off-by: Kever Yang kever.yang@rock-chips.com Acked-by: Simon Glass sjg@chromium.org Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
Changes in v2: None
board/rockchip/evb_rk3328/evb-rk3328.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
Applied to u-boot-rockchip/next, thanks!

Use fixed regulator for sdmmc-pwren for sdmmc power.
Signed-off-by: Kever Yang kever.yang@rock-chips.com Acked-by: Simon Glass sjg@chromium.org ---
Changes in v2: None
arch/arm/dts/rk3328-evb.dts | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/arch/arm/dts/rk3328-evb.dts b/arch/arm/dts/rk3328-evb.dts index b807bc5..c08868a 100644 --- a/arch/arm/dts/rk3328-evb.dts +++ b/arch/arm/dts/rk3328-evb.dts @@ -14,6 +14,14 @@ chosen { stdout-path = &uart2; }; + + vcc3v3_sdmmc: sdmmc-pwren { + compatible = "regulator-fixed"; + regulator-name = "vcc3v3"; + gpio = <&gpio0 30 GPIO_ACTIVE_LOW>; + regulator-always-on; + regulator-boot-on; + }; };
&uart2 {

Use fixed regulator for sdmmc-pwren for sdmmc power.
Signed-off-by: Kever Yang kever.yang@rock-chips.com Acked-by: Simon Glass sjg@chromium.org
Changes in v2: None
arch/arm/dts/rk3328-evb.dts | 8 ++++++++ 1 file changed, 8 insertions(+)
Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

Use fixed regulator for sdmmc-pwren for sdmmc power.
Signed-off-by: Kever Yang kever.yang@rock-chips.com Acked-by: Simon Glass sjg@chromium.org Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
Changes in v2: None
arch/arm/dts/rk3328-evb.dts | 8 ++++++++ 1 file changed, 8 insertions(+)
Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com

Use fixed regulator for sdmmc-pwren for sdmmc power.
Signed-off-by: Kever Yang kever.yang@rock-chips.com Acked-by: Simon Glass sjg@chromium.org Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com Reviewed-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
Changes in v2: None
arch/arm/dts/rk3328-evb.dts | 8 ++++++++ 1 file changed, 8 insertions(+)
Applied to u-boot-rockchip/next, thanks!

On 08 Jun 2017, at 09:32, Kever Yang kever.yang@rock-chips.com wrote:
In rk3328, some function pin may have more than one choice, and muxed with more than one IO, for example, the UART2 controller IO, TX and RX, have 3 choice(setting in com_iomux):
- M0 which mux with GPIO1A0/GPIO1A1
- M1 which mux with GPIO2A0/GPIO2A1
- usb2phy which mux with USB2.0 DP/DM pin.
This suppose to be set in SPL, but the U-Boot is also design to co-work with Rockchip SPL(miniloader) which may not setting this config, let's set this config to make sure the UART2 TX/RX working in U-Boot.
Signed-off-by: Kever Yang kever.yang@rock-chips.com
Changes in v2:
- remove SDMMC io routing
board/rockchip/evb_rk3328/evb-rk3328.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
diff --git a/board/rockchip/evb_rk3328/evb-rk3328.c b/board/rockchip/evb_rk3328/evb-rk3328.c index 0a26ed5..823c5da 100644 --- a/board/rockchip/evb_rk3328/evb-rk3328.c +++ b/board/rockchip/evb_rk3328/evb-rk3328.c @@ -5,7 +5,10 @@ */
#include <common.h> +#include <asm/arch/hardware.h> +#include <asm/arch/grf_rk3328.h> #include <asm/armv8/mmu.h> +#include <asm/io.h> #include <dwc3-uboot.h> #include <usb.h>
@@ -13,6 +16,13 @@ DECLARE_GLOBAL_DATA_PTR;
int board_init(void) { +#define GRF_BASE 0xff100000
- struct rk3328_grf_regs * const grf = (void *)GRF_BASE;
- /* uart2 select m1, sdcard select m1*/
- rk_clrsetreg(&grf->com_iomux, IOMUX_SEL_UART2_MASK,
IOMUX_SEL_UART2_M1 << IOMUX_SEL_UART2_SHIFT);
- return 0;
}
Is there a good reason not to do this through the pinctrl framework, using pinctrl_request_noflags() or similar?
Regards, Philipp.

In rk3328, some function pin may have more than one choice, and muxed with more than one IO, for example, the UART2 controller IO, TX and RX, have 3 choice(setting in com_iomux):
- M0 which mux with GPIO1A0/GPIO1A1
- M1 which mux with GPIO2A0/GPIO2A1
- usb2phy which mux with USB2.0 DP/DM pin.
This suppose to be set in SPL, but the U-Boot is also design to co-work with Rockchip SPL(miniloader) which may not setting this config, let's set this config to make sure the UART2 TX/RX working in U-Boot.
Signed-off-by: Kever Yang kever.yang@rock-chips.com
Changes in v2:
- remove SDMMC io routing
board/rockchip/evb_rk3328/evb-rk3328.c | 10 ++++++++++ 1 file changed, 10 insertions(+)
Acked-by: Philipp Tomsich philipp.tomsich@theobroma-systems.com
participants (3)
-
Dr. Philipp Tomsich
-
Kever Yang
-
Philipp Tomsich