public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Stephen Warren <swarren@nvidia.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 3/6] tegra: Add a function mux feature
Date: Mon, 28 Nov 2011 11:17:48 -0700	[thread overview]
Message-ID: <4ED3D04C.4030006@nvidia.com> (raw)
In-Reply-To: <1322089148-2810-4-git-send-email-sjg@chromium.org>

On 11/23/2011 03:59 PM, Simon Glass wrote:
> funcmux permits selection of config options for particular peripherals,
> such as the pins that are used for that peripheral, if there are several
> options.
> 
> Add UART selection to start with.

> +static void enable_uart(enum periph_id pid)
> +{
> +	/* Assert UART reset and enable clock */
> +	reset_set_enable(pid, 1);
> +	clock_enable(pid);
> +	clock_ll_set_source(pid, 0);	/* UARTx_CLK_SRC = 00, PLLP_OUT0 */
> +
> +	/* wait for 2us */
> +	udelay(2);
> +
> +	/* De-assert reset to UART */
> +	reset_set_enable(pid, 0);
> +}

That doesn't seem like anything to do with function muxing.

> +void funcmux_select(enum periph_id id, int func)

Parameter "func" doesn't appear to be used. Is it to support e.g. UART1
being routed to different sets of pins based on board design? If so, the
values of "func" should be defined by this patch too, and validated in
the code below, so that people don't start passing bogus data without
issue now, then suddenly get hit when we see boards with different
pinmux configurations.

> +{
> +	switch (id) {
> +	case PERIPH_ID_UART1:
> +		pinmux_set_func(PINGRP_IRRX, PMUX_FUNC_UARTA);
> +		pinmux_set_func(PINGRP_IRTX, PMUX_FUNC_UARTA);
> +		pinmux_tristate_disable(PINGRP_IRRX);
> +		pinmux_tristate_disable(PINGRP_IRTX);
> +		break;
> +
> +	case PERIPH_ID_UART2:
> +		pinmux_set_func(PINGRP_UAD, PMUX_FUNC_IRDA);
> +		pinmux_tristate_disable(PINGRP_UAD);
> +		break;
> +
> +	case PERIPH_ID_UART4:
> +		pinmux_set_func(PINGRP_GMC, PMUX_FUNC_UARTD);
> +		pinmux_tristate_disable(PINGRP_GMC);
> +		break;
> +
> +	default:
> +		debug("%s: invalid periph_id %d", __func__, id);
> +		break;
> +	}
> +}

I'm not entirely convinced that centralizing this in a function rather
than putting the board-specific muxing into the per-board files is the
right way to go. What's wrong with the kernel's approach of a single
table describing each board's complete pinmux settings? Eventually, all
this will come from DT anyway, won't it?

-- 
nvpublic

  parent reply	other threads:[~2011-11-28 18:17 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-11-23 22:59 [U-Boot] [PATCH 0/6] Introduce function mux library Simon Glass
2011-11-23 22:59 ` [U-Boot] [PATCH 1/6] tegra: Move cpu_init_cp15() to arch_cpu_init() Simon Glass
2011-11-23 23:34   ` Mike Frysinger
2011-11-28 19:00     ` Simon Glass
2011-11-28 18:12   ` Stephen Warren
2011-11-23 22:59 ` [U-Boot] [PATCH 2/6] tegra: Move clock_early_init() " Simon Glass
2011-11-28 18:12   ` Stephen Warren
2011-11-23 22:59 ` [U-Boot] [PATCH 3/6] tegra: Add a function mux feature Simon Glass
2011-11-23 23:36   ` Mike Frysinger
2011-11-28 18:17   ` Stephen Warren [this message]
2011-11-28 19:19     ` Simon Glass
2011-11-28 19:42       ` Stephen Warren
2011-11-28 22:57         ` Simon Glass
2011-11-23 22:59 ` [U-Boot] [PATCH 4/6] tegra: Add support for UART init in cpu board.c Simon Glass
2011-11-23 23:40   ` Mike Frysinger
2011-11-28 20:14     ` Simon Glass
2011-11-28 23:06       ` Mike Frysinger
2011-11-29  0:40         ` Simon Glass
2011-11-23 22:59 ` [U-Boot] [PATCH 5/6] tegra: Move boards over to use arch-level board UART function Simon Glass
2011-11-23 22:59 ` [U-Boot] [PATCH 6/6] tegra: Fix build error in plutux, medcom Simon Glass
2011-11-23 23:42   ` Mike Frysinger
2011-11-24 20:04   ` Thierry Reding
2011-11-28 18:18   ` Stephen Warren

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=4ED3D04C.4030006@nvidia.com \
    --to=swarren@nvidia.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