public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Mike Rapoport <mike.rapoport@gmail.com>
Cc: Mike Rapoport <mike@compulab.co.il>, linux-omap@vger.kernel.org
Subject: Re: [PATCH 3/5] omap: mux: Add new style pin multiplexing data for 34xx
Date: Tue, 3 Nov 2009 08:43:25 -0800	[thread overview]
Message-ID: <20091103164324.GE8981@atomide.com> (raw)
In-Reply-To: <f870da180911022310n65b63bffw9a425e4aeaa9187b@mail.gmail.com>

* Mike Rapoport <mike.rapoport@gmail.com> [091102 23:10]:
> On Mon, Nov 2, 2009 at 9:10 PM, Tony Lindgren <tony@atomide.com> wrote:
> > * Mike Rapoport <mike@compulab.co.il> [091101 02:30]:
> >>
> >>
> >> Tony Lindgren wrote:
> >> > Add new style mux data for 34xx. This should also
> >> > work with 3630 easily by adding the processor subset
> >> > and ball data.
> >> >
> >> > Note that this data is __initdata, and gets optimized
> >> > out if CONFIG_OMAP_MUX is not set. Also, the debug data
> >> > gets optimized out if CONFIG_DEBUG_FS is not set.
> >> >
> >> > Signed-off-by: Tony Lindgren <tony@atomide.com>
> >> > ---
> >> >  arch/arm/mach-omap2/Makefile  |    4
> >> >  arch/arm/mach-omap2/mux.h     |    2
> >> >  arch/arm/mach-omap2/mux34xx.c | 1552 +++++++++++++++++++++++++++++++++++++++++
> >> >  arch/arm/mach-omap2/mux34xx.h |  352 +++++++++
> >> >  4 files changed, 1910 insertions(+), 0 deletions(-)
> >> >  create mode 100644 arch/arm/mach-omap2/mux34xx.c
> >> >  create mode 100644 arch/arm/mach-omap2/mux34xx.h
> >> >
> 
> [ snip ]
> 
> >> > +
> >> > +#define OMAP3_CONTROL_PADCONF_MUX_SIZE                             \
> >> > +           (OMAP3_CONTROL_PADCONF_JTAG_TDO_OFFSET + 0x2)
> >>
> >> What about adding defines for each possible mode configuration, except, perhaps,
> >> GPIO?
> >
> > Yeah it would be nice to make it easy. How about someting like:
> >
> > int __init omap_mux_init_by_name(char *name, int flags);
> > ...
> >
> > omap_mux_init_by_name("i2c1_scl", OMAP_PIN_INPUT_PULLUP);
> >
> >> #define OMAP3_PIN_CAM_D0 OMAP3_MUX(CAM_D0, OMAP_PIN_MODE0 | OMAP_PIN_INPUT, 0)
> >> #define OMAP3_PIN_CAM_D0_CSI2_DX2 OMAP3_MUX(CAM_D0, OMAP_PIN_MODE2 | \
> >>                                           OMAP_PIN_INPUT, 0)
> >>
> >> And, I'm for adding OMAP_MUX_GPIO_{OUT,IN,IN_PU,IN_PD}(x) as well.
> >
> > And we could have also:
> >
> > int __init omap_mux_init_by_gpio(int gpio, int flags);
> > ...
> >
> > omap_mux_init_by_gpio(99, OMAP_PIN_INPUT);
> >
> > As the only thing we currently have for flags is the OMAP_MUX_DYNAMIC,
> > we could mask that too into flags and make it int instead of u16.
> 
> It seems we are thinking in really different directions :) You propose
> imporved and easy to use replacements of omap_cfg_reg while I'm aming
> nice tables descibing board pin configuration like, e.g,
> cm_x300_mfp_cfg in arch/arm/mach-pxa/cm-x300.c. Probably it's just too
> hard to me to break my PXA habbits, but I think such tables make the
> board code easier to write/maintain/understand.
> Besides, having both simple aliases for OMAP3_MUX(mode0, mux_value,
> mux_flags) for dedicated pins does not contadict having
> omap_mux_init_by_{name,gpio} helpers.

Agreed, we should make the pin muxing as easy as possible as it's
probably the biggest hurdle to anybody to start making changes to a
development board. And we should have easy to to read board specific
pin configuration tables like you're suggesting.

In the long run, we should probably start using the real signal names
as they seem to be more future proof across omaps than the register
names.

We can easily do something like this if we add char *muxname to
struct omap_board_mux (untested):

#define OMAP_MUX_SIGNAL(signal, mux_flags)				\
{									\
	.muxname	= #signal,					\
	.flags		= (mux_flags),					\
}

#define OMAP_MUX_GPIO(gpio, mux_flags)					\
{									\
	.muxname	= gpio_##signal,				\
	.flags		= (mux_flags),					\
}

#ifdef CONFIG_OMAP_MUX
static struct omap_board_mux board_mux[] __initdata = {
	OMAP_MUX_SIGNAL(i2c1_scl, OMAP_PIN_INPUT),
	OMAP_MUX_GPIO(98, OMAP_PIN_INPUT_PULLUP),
	OMAP_MUX_GPIO(99, OMAP_PIN_INPUT_PULLUP | OMAP_MUX_DYNAMIC),
	{ .reg_offset = OMAP_MUX_TERMINATOR },
};
#endif

Of course then we have to warn on potential duplicate signal names,
but those can be specified using the register offset + mode as
needed.

Is the above close enough to what you have in mind regarding the
board specific mux tables, or do you have still something else
in mind?

Regards,

Tony

--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2009-11-03 16:43 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-10-29 20:35 [PATCH 0/5] New mux code for 34xx Tony Lindgren
2009-10-29 20:36 ` [PATCH 1/5] omap2: mux: intoduce omap_mux_{read,write} Tony Lindgren
2009-10-29 20:36 ` [PATCH 2/5] omap: mux: Add new style pin multiplexing code for omap3 Tony Lindgren
2009-11-01 10:30   ` Mike Rapoport
2009-11-02 18:54     ` Tony Lindgren
2009-11-03  6:56       ` Mike Rapoport
2009-10-29 20:36 ` [PATCH 3/5] omap: mux: Add new style pin multiplexing data for 34xx Tony Lindgren
2009-11-01 10:30   ` Mike Rapoport
2009-11-02 19:10     ` Tony Lindgren
2009-11-03  7:10       ` Mike Rapoport
2009-11-03 16:43         ` Tony Lindgren [this message]
2009-11-03 22:55           ` [PATCH] omap: mux: Replace omap_cfg_reg() with new style signal or gpio functions (Re: [PATCH 3/5] omap: mux: Add new style pin multiplexing data for 34xx) Tony Lindgren
2009-11-04  7:14           ` [PATCH 3/5] omap: mux: Add new style pin multiplexing data for 34xx Mike Rapoport
2009-11-10 22:37             ` Tony Lindgren
2009-11-11  8:23               ` Mike Rapoport
2009-10-29 20:36 ` [PATCH 4/5] omap: mux: Add new style init functions to omap3 board-*.c files Tony Lindgren
2009-10-29 20:36 ` [PATCH 5/5] omap: mux: Add debugfs support for new mux code Tony Lindgren
2009-10-29 21:19 ` [PATCH 0/5] New mux code for 34xx Mike Rapoport
2009-10-29 21:59   ` Tony Lindgren
2009-11-01 10:29 ` Mike Rapoport
2009-11-02 18:56   ` Tony Lindgren
2009-11-03  6:42     ` Mike Rapoport
2009-11-03 16:46       ` Tony Lindgren

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=20091103164324.GE8981@atomide.com \
    --to=tony@atomide.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=mike.rapoport@gmail.com \
    --cc=mike@compulab.co.il \
    /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