[U-Boot] [PATCH v2] board/p1010rdb: add pin mux and sdhc support in any boot

Andy Fleming afleming at gmail.com
Wed Jul 17 00:29:55 CEST 2013


On Sun, Jun 16, 2013 at 9:32 PM, Shengzhou Liu
<Shengzhou.Liu at freescale.com>wrote:

> SDHC pins are multiplexed with IFC and ULPI interfaces.
> This patch intends to enable SDHC function in case of
> NOR/NAND/SPI boot aside from SD boot.
>
> If "esdhc" is configured in hwconfig, u-boot will configure
> multiplexing pins from default IFC to SDHC at runtime to
> enable SD function. And add minimal necessary mux command for
> ifc/sdhc/ulpi to conveniently configure multiplexing pins
> without reboot or updating u-boot.
>
> Signed-off-by: Shengzhou Liu <Shengzhou.Liu at freescale.com>
> ---
> v2: updated description.
>
>  board/freescale/p1010rdb/p1010rdb.c | 128
> +++++++++++++++++++++++++++++++++---
>  include/configs/P1010RDB.h          |  11 ++--
>  2 files changed, 125 insertions(+), 14 deletions(-)
>
> diff --git a/board/freescale/p1010rdb/p1010rdb.c
> b/board/freescale/p1010rdb/p1010rdb.c
> index 0c30d76..5a2f1f0 100644
> --- a/board/freescale/p1010rdb/p1010rdb.c
> +++ b/board/freescale/p1010rdb/p1010rdb.c
>


> +static int pin_mux_cmd(cmd_tbl_t *cmdtp, int flag, int argc,
> +                                       char * const argv[])
> +{
> +       if (argc < 2)
> +               return CMD_RET_USAGE;
> +       if (strcmp(argv[1], "ifc") == 0)
> +               config_pin_mux(MUX_TYPE_IFC);
> +       else if (strcmp(argv[1], "sdhc") == 0)
> +               config_pin_mux(MUX_TYPE_SDHC);
> +       else if (strcmp(argv[1], "ulpi") == 0)
> +               config_pin_mux(MUX_TYPE_ULPI);
> +       else
> +               return CMD_RET_USAGE;
> +       return 0;
> +}
> +
> +U_BOOT_CMD(
> +       mux, 2, 0, pin_mux_cmd,
> +       "configure multiplexing pin for IFC/SDHC/ULPI buses",
> +       "bus_type[ifc/sdhc/ulpi] (e.g. mux sdhc)"
>


This command name is very generic, but the command is highly-specific to
this board. Ideally, you'd come up with code that could be reused by other
boards that have similar issues. It should be fairly straightforward to
implement a version of this code which allowed arbitrary pin muxing code to
register with a name. It would require some discussion on the list. If
you're not willing to do that, at least rename the command so it's clear it
is just for this board.


Andy


More information about the U-Boot mailing list