public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Mike Rapoport <mike@compulab.co.il>
Cc: linux-omap@vger.kernel.org, mike.rapoport@gmail.com
Subject: Re: [PATCH 3/5] omap: mux: Add new style pin multiplexing data for 34xx
Date: Mon, 2 Nov 2009 11:10:19 -0800	[thread overview]
Message-ID: <20091102191018.GD6692@atomide.com> (raw)
In-Reply-To: <4AED6330.8020007@compulab.co.il>

* 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
> > 
> > diff --git a/arch/arm/mach-omap2/Makefile b/arch/arm/mach-omap2/Makefile
> > index 03cb4fc..4b6d7b9 100644
> > --- a/arch/arm/mach-omap2/Makefile
> > +++ b/arch/arm/mach-omap2/Makefile
> > @@ -23,6 +23,10 @@ obj-$(CONFIG_ARCH_OMAP2420)		+= sram242x.o
> >  obj-$(CONFIG_ARCH_OMAP2430)		+= sram243x.o
> >  obj-$(CONFIG_ARCH_OMAP3)		+= sram34xx.o
> >  
> > +ifeq ($(CONFIG_OMAP_MUX),y)
> > +obj-$(CONFIG_ARCH_OMAP3)		+= mux34xx.o
> > +endif
> > +
> >  # SMS/SDRC
> >  obj-$(CONFIG_ARCH_OMAP2)		+= sdrc2xxx.o
> >  # obj-$(CONFIG_ARCH_OMAP3)		+= sdrc3xxx.o
> > diff --git a/arch/arm/mach-omap2/mux.h b/arch/arm/mach-omap2/mux.h
> > index a8453f5..0d52318 100644
> > --- a/arch/arm/mach-omap2/mux.h
> > +++ b/arch/arm/mach-omap2/mux.h
> > @@ -7,6 +7,8 @@
> >   * published by the Free Software Foundation.
> >   */
> >  
> > +#include "mux34xx.h"
> > +
> >  #define OMAP_MUX_TERMINATOR	0xffff
> >  
> >  /* 34xx mux mode options for each pin. See TRM for options */
> > diff --git a/arch/arm/mach-omap2/mux34xx.c b/arch/arm/mach-omap2/mux34xx.c
> > new file mode 100644
> > index 0000000..62c2b6a
> > --- /dev/null
> > +++ b/arch/arm/mach-omap2/mux34xx.c
> > @@ -0,0 +1,1552 @@
> > +/*
> > + * Copyright (C) 2009 Nokia
> > + * Copyright (C) 2009 Texas Instruments
> > + *
> > + * This program is free software; you can redistribute it and/or modify
> > + * it under the terms of the GNU General Public License version 2 as
> > + * published by the Free Software Foundation.
> > + */
> > +
> > +#include <linux/module.h>
> > +#include <linux/init.h>
> > +
> > +#include "mux.h"
> > +
> > +#ifdef CONFIG_DEBUG_FS
> > +
> > +#define _OMAP3_MUXENTRY(M0, g, m0, m1, m2, m3, m4, m5, m6, m7)		\
> > +{									\
> > +	.reg_offset	= (OMAP3_CONTROL_PADCONF_##M0##_OFFSET),	\
> > +	.gpio		= (g),						\
> > +	.muxnames	= { m0, m1, m2, m3, m4, m5, m6, m7 },		\
> > +}
> > +
> > +#else
> > +
> > +#define _OMAP3_MUXENTRY(M0, g, m0, m1, m2, m3, m4, m5, m6, m7)		\
> > +{									\
> > +	.reg_offset	= (OMAP3_CONTROL_PADCONF_##M0##_OFFSET),	\
> > +	.gpio		= (g),						\
> > +}
> > +
> > +#endif
> > +
> > +#define _OMAP3_BALLENTRY(M0, bb, bt)					\
> > +{									\
> > +	.reg_offset	= (OMAP3_CONTROL_PADCONF_##M0##_OFFSET),	\
> > +	.balls		= { bb, bt },					\
> > +}
> > +
> > +/*
> > + * Superset of all mux modes, same as the CBC package
> > + */
> > +static struct omap_mux __initdata omap3_muxmodes[] = {
> 
> Is the CBS package for sure will be superset of all possible OMAP3
> variants/packages?

Not necessarily, but a single superset works for all omap3.
I'll remove the CBC comment, as with 3630 it will be the superset.
 
> > +	_OMAP3_MUXENTRY(CAM_D0, 99,
> > +		"cam_d0", NULL, NULL, NULL,
> > +		"gpio_99", NULL, NULL, "safe_mode"),
> 
> [ snip ]
> 
> > +	{ .reg_offset = OMAP_MUX_TERMINATOR },
> > +};
> > +
> > +/*
> > + * Pins different on CBC package comapared to CBC package
> > + */
> > +struct omap_mux __initdata omap3_cbc_subset[] = {
> > +	{ .reg_offset = OMAP_MUX_TERMINATOR },
> > +};
> > +
> > +/*
> > + * Balls for CBC package
> > + * 515-pin s-PBGA Package, 0.65mm Ball Pitch (Top), 0.50mm Ball Pitch (Bottom)
> > + *
> > + * FIXME: What's up with the outdated TI documentation? See:
> > + *
> > + * http://wiki.davincidsp.com/index.php/Datasheet_Errata_for_OMAP35x_CBC_Package
> > + * http://community.ti.com/forums/t/10982.aspx
> > + */
> > +#ifdef CONFIG_DEBUG_FS
> > +struct omap_ball __initdata omap3_cbc_ball[] = {
> > +	_OMAP3_BALLENTRY(CAM_D0, "ae16", NULL),
> 
> [ snip ]
> 
> > +	{ .reg_offset = OMAP_MUX_TERMINATOR },
> > +};
> > +#else
> > +#define omap3_cbc_ball	 NULL
> > +#endif
> > +
> > +/*
> > + * Pins different on CUS package comapared to CBC package
> > + */
> 
> Maybe we'll just add the entire package rather than its difference to the CBC
> package?

IMHO it makes maintenance harder because of duplicating the data
like I commented earlier. Currently the duplicate data would be
for the 3 existing packages + whatever 36xx packages will be
introduces.

<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.

Regards,

Tony

  reply	other threads:[~2009-11-02 19:10 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 [this message]
2009-11-03  7:10       ` Mike Rapoport
2009-11-03 16:43         ` Tony Lindgren
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=20091102191018.GD6692@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