All of lore.kernel.org
 help / color / mirror / Atom feed
* Suggestion regarding the ordering of GPIO MUX configurations
@ 2009-03-02  2:37 Kim Kyuwon
  2009-03-02 16:40 ` Tony Lindgren
  0 siblings, 1 reply; 5+ messages in thread
From: Kim Kyuwon @ 2009-03-02  2:37 UTC (permalink / raw)
  To: OMAP; +Cc: Tony Lindgren, David Brownell

Hi All.

The current order of GPIO mux configurations is not sorted. It seems
that all new GPIO MUX configurations are being inserted to the end as
shown in next code

/* arch/arm/plat-omap/include/mach/mux.h */
791         AH8_34XX_GPIO29,
792         J25_34XX_GPIO170,
793         AF26_34XX_GPIO0,
794         AF22_34XX_GPIO9,
795         L8_34XX_GPIO63,
796         AF6_34XX_GPIO140_UP,
797         AE6_34XX_GPIO141,
798         AF5_34XX_GPIO142,
799         AE5_34XX_GPIO143,
800         AG4_34XX_GPIO134,
801         U8_34XX_GPIO54,
802         AE4_34XX_GPIO136,


I wonder if we can sort the order of GPIO MUX configurations and then
insert new MUXs at right position. Can I ask your opinions?


Regards,

Kim Kyuwon.
-- 
Q1

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Suggestion regarding the ordering of GPIO MUX configurations
  2009-03-02  2:37 Suggestion regarding the ordering of GPIO MUX configurations Kim Kyuwon
@ 2009-03-02 16:40 ` Tony Lindgren
  2009-03-02 17:31   ` Peter Barada
  2009-03-02 19:41   ` David Brownell
  0 siblings, 2 replies; 5+ messages in thread
From: Tony Lindgren @ 2009-03-02 16:40 UTC (permalink / raw)
  To: Kim Kyuwon; +Cc: OMAP, David Brownell

* Kim Kyuwon <chammoru@gmail.com> [090301 18:37]:
> Hi All.
> 
> The current order of GPIO mux configurations is not sorted. It seems
> that all new GPIO MUX configurations are being inserted to the end as
> shown in next code
> 
> /* arch/arm/plat-omap/include/mach/mux.h */
> 791         AH8_34XX_GPIO29,
> 792         J25_34XX_GPIO170,
> 793         AF26_34XX_GPIO0,
> 794         AF22_34XX_GPIO9,
> 795         L8_34XX_GPIO63,
> 796         AF6_34XX_GPIO140_UP,
> 797         AE6_34XX_GPIO141,
> 798         AF5_34XX_GPIO142,
> 799         AE5_34XX_GPIO143,
> 800         AG4_34XX_GPIO134,
> 801         U8_34XX_GPIO54,
> 802         AE4_34XX_GPIO136,
> 
> 
> I wonder if we can sort the order of GPIO MUX configurations and then
> insert new MUXs at right position. Can I ask your opinions?

Yes, I was thinking about the same. I'll combine the pending mux patches
and merge them into a single patch for mainline tree. While doing that
I'll sort them by gpio number. Will post the patch here for testing
probably today.

Regards,

Tony

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Suggestion regarding the ordering of GPIO MUX configurations
  2009-03-02 16:40 ` Tony Lindgren
@ 2009-03-02 17:31   ` Peter Barada
  2009-03-02 17:47     ` Tony Lindgren
  2009-03-02 19:41   ` David Brownell
  1 sibling, 1 reply; 5+ messages in thread
From: Peter Barada @ 2009-03-02 17:31 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Kim Kyuwon, OMAP, David Brownell

On Mon, 2009-03-02 at 08:40 -0800, Tony Lindgren wrote:
> * Kim Kyuwon <chammoru@gmail.com> [090301 18:37]:
> > Hi All.
> > 
> > The current order of GPIO mux configurations is not sorted. It seems
> > that all new GPIO MUX configurations are being inserted to the end as
> > shown in next code
> > 
> > /* arch/arm/plat-omap/include/mach/mux.h */
> > 791         AH8_34XX_GPIO29,
> > 792         J25_34XX_GPIO170,
> > 793         AF26_34XX_GPIO0,
> > 794         AF22_34XX_GPIO9,
> > 795         L8_34XX_GPIO63,
> > 796         AF6_34XX_GPIO140_UP,
> > 797         AE6_34XX_GPIO141,
> > 798         AF5_34XX_GPIO142,
> > 799         AE5_34XX_GPIO143,
> > 800         AG4_34XX_GPIO134,
> > 801         U8_34XX_GPIO54,
> > 802         AE4_34XX_GPIO136,
> > 
> > 
> > I wonder if we can sort the order of GPIO MUX configurations and then
> > insert new MUXs at right position. Can I ask your opinions?
> 
> Yes, I was thinking about the same. I'll combine the pending mux patches
> and merge them into a single patch for mainline tree. While doing that
> I'll sort them by gpio number. Will post the patch here for testing
> probably today.

Thinking about this, I wonder if it would be better to remove the enum
entirely and just pass the pin name (as a string) to omap_cfg_reg() and
have it search the table for a matching entry.

1) This removes the necessary lockstep ordering in the enum and the
pinmux table - hence grouping pins by use/name/gpio number is easy.

2) allows for an optional mux table for each machine as part of the
initialization to override arch/arm/mach-omap2/mux.c definitions (think
of using external versus internal pullup/down registers) as well as
extend the mux table for that board(per-board GPIO pin mux definitions).

3) Setting up the pinmux is something that is done at startup, or rarely
changed afterwards - as far as I can see, its not time-critical.


Just a thought.

-- 
Peter Barada <peterb@logicpd.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Suggestion regarding the ordering of GPIO MUX configurations
  2009-03-02 17:31   ` Peter Barada
@ 2009-03-02 17:47     ` Tony Lindgren
  0 siblings, 0 replies; 5+ messages in thread
From: Tony Lindgren @ 2009-03-02 17:47 UTC (permalink / raw)
  To: Peter Barada; +Cc: Kim Kyuwon, OMAP, David Brownell

* Peter Barada <peterb@logicpd.com> [090302 09:31]:
> On Mon, 2009-03-02 at 08:40 -0800, Tony Lindgren wrote:
> > * Kim Kyuwon <chammoru@gmail.com> [090301 18:37]:
> > > Hi All.
> > > 
> > > The current order of GPIO mux configurations is not sorted. It seems
> > > that all new GPIO MUX configurations are being inserted to the end as
> > > shown in next code
> > > 
> > > /* arch/arm/plat-omap/include/mach/mux.h */
> > > 791         AH8_34XX_GPIO29,
> > > 792         J25_34XX_GPIO170,
> > > 793         AF26_34XX_GPIO0,
> > > 794         AF22_34XX_GPIO9,
> > > 795         L8_34XX_GPIO63,
> > > 796         AF6_34XX_GPIO140_UP,
> > > 797         AE6_34XX_GPIO141,
> > > 798         AF5_34XX_GPIO142,
> > > 799         AE5_34XX_GPIO143,
> > > 800         AG4_34XX_GPIO134,
> > > 801         U8_34XX_GPIO54,
> > > 802         AE4_34XX_GPIO136,
> > > 
> > > 
> > > I wonder if we can sort the order of GPIO MUX configurations and then
> > > insert new MUXs at right position. Can I ask your opinions?
> > 
> > Yes, I was thinking about the same. I'll combine the pending mux patches
> > and merge them into a single patch for mainline tree. While doing that
> > I'll sort them by gpio number. Will post the patch here for testing
> > probably today.
> 
> Thinking about this, I wonder if it would be better to remove the enum
> entirely and just pass the pin name (as a string) to omap_cfg_reg() and
> have it search the table for a matching entry.
> 
> 1) This removes the necessary lockstep ordering in the enum and the
> pinmux table - hence grouping pins by use/name/gpio number is easy.
> 
> 2) allows for an optional mux table for each machine as part of the
> initialization to override arch/arm/mach-omap2/mux.c definitions (think
> of using external versus internal pullup/down registers) as well as
> extend the mux table for that board(per-board GPIO pin mux definitions).
> 
> 3) Setting up the pinmux is something that is done at startup, or rarely
> changed afterwards - as far as I can see, its not time-critical.

Well for omap3 and later, we should probably just switch to defining the
pin registers, then pass the desired value to the function. The current
mux code is unnecessary complicated for current hardware. It works for
omap1 where the mux registers need to be changed at several locations.

Regards,

Tony

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: Suggestion regarding the ordering of GPIO MUX configurations
  2009-03-02 16:40 ` Tony Lindgren
  2009-03-02 17:31   ` Peter Barada
@ 2009-03-02 19:41   ` David Brownell
  1 sibling, 0 replies; 5+ messages in thread
From: David Brownell @ 2009-03-02 19:41 UTC (permalink / raw)
  To: Tony Lindgren; +Cc: Kim Kyuwon, OMAP

On Monday 02 March 2009, Tony Lindgren wrote:
> 
> > I wonder if we can sort the order of GPIO MUX configurations and then
> > insert new MUXs at right position. Can I ask your opinions?
> 
> Yes, I was thinking about the same. I'll combine the pending mux patches
> and merge them into a single patch for mainline tree. While doing that
> I'll sort them by gpio number. Will post the patch here for testing
> probably today.

Another thing to consider is eliminating the bugs that can
come from having the mux.c MUX_CFG_*() entries not match the
mux.h order; accidents happen.  The simplest fix changes

	MUX_CFG_X("string", ...)

		==> {
			.name = string,
			...
		},

to MUX_CFG_X(enum, ...)

		==> [enum] = {
			.name = #enum,
			...
		},

and adds a smidgeon of logic to verify a given mux table entry
has been initialized before using it.

- Dave



^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2009-03-02 19:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2009-03-02  2:37 Suggestion regarding the ordering of GPIO MUX configurations Kim Kyuwon
2009-03-02 16:40 ` Tony Lindgren
2009-03-02 17:31   ` Peter Barada
2009-03-02 17:47     ` Tony Lindgren
2009-03-02 19:41   ` David Brownell

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.