[U-Boot] [PATCH 3/6] rockchip: evb-rk3328: set uart2 and sdmmc io routing
Simon Glass
sjg at chromium.org
Sat May 20 02:29:24 UTC 2017
Hi Kever,
On 16 May 2017 at 21:44, Kever Yang <kever.yang at 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.
>
> We should set these IO routing in board file.
>
> Signed-off-by: Kever Yang <kever.yang at rock-chips.com>
> ---
>
> board/rockchip/evb_rk3328/evb-rk3328.c | 12 ++++++++++++
> 1 file changed, 12 insertions(+)
>
> diff --git a/board/rockchip/evb_rk3328/evb-rk3328.c b/board/rockchip/evb_rk3328/evb-rk3328.c
> index a7895cb..d9dc782 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,15 @@ 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_SDMMC_MASK,
> + IOMUX_SEL_UART2_M1 << IOMUX_SEL_UART2_SHIFT |
> + IOMUX_SEL_SDMMC_M1 << IOMUX_SEL_SDMMC_SHIFT);
> +
> return 0;
> }
This needs to be done via a call to some sort of driver. The above
hack is OK in SPL but not in U-Boot proper.
See my comments elsewhere about using a misc driver with an IOCTL
interface to do this sort of thing. Although here I wonder why you
cannot use pinctrl?
Regards,
Simon
More information about the U-Boot
mailing list