Skip to contentSkip to conversation

Incoming to hostme.bitkeeper.com:/ua/repos/p/ppc/linuxppc_2_4_devel

DISCUSSION Tom Rini 2 participants 4 messages Nov 8, 2001 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

Tom Rini

author
#1 lore raw
Quoted 2 lines · On Thu, Nov 08, 2001 at 11:30:06AM -0800, [email protected] wrote:

[email protected], 2001-11-08 12:29:36-07:00, [email protected]
Make serial_init (in wrapper) take two args.

I was thinking about this a bit. The problem is that we have multiple types of serial controllers we need to 'init' some how. We have the ns1655x style ones in most 6xx/7xx/74xx and 4xx boards, and the integrated controllers in 8xx and 8260 CPUs which have their own way of being init'ed. We can either a) have a 'serial_init' function which will do the right thing, even in the case of one file which can work on both. b) We kill the idea of one serial_init which always does the right thing. That lead to something like:

#ifdef CONFIG_4xx
	ns1655x_init(0); /* Use channel 0 from the table */

#else
mpc_serial_init(bp); /* Use the bd_t struct to init this */
#endif

Comments? Does the current (first) way rub anyone horribly wrong? Is there an even better idea out there?

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#2 lore raw
Quoted 2 lines · Tom Rini

I was thinking about this a bit. The problem is that we have multiple types of serial controllers we need to 'init' some how.

This is because I tried to use the same functions across a wide variety of boards. All we need to do is define a macro in a board specific file someplace that calls the proper init function.

	-- Dan

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

author
#3 lore raw
Quoted 9 lines · Dan Malek
Quoted 2 lines · Tom Rini

I was thinking about this a bit. The problem is that we have multiple types of serial controllers we need to 'init' some how.

This is because I tried to use the same functions across a wide variety of boards. All we need to do is define a macro in a board specific file someplace that calls the proper init function.

Yes, but then you end up with lots and lots of files with just a few lines, or:
#if defined(A) || defined(B) || defined(C) || ... || defined(W) #define serial_init(a) foo_init(a)
#endif

#if defined(X) || defined(Y) || ... || defined(Z)
#define serial_init(a) bar_init(a)
#endif

--
Tom Rini (TR1265)
http://gate.crashing.org/~trini/

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/

#4 lore raw
Quoted 1 line · Tom Rini

Yes, but then you end up....

Not what I had in mind :-).

For example, in include/asm-ppc/mpc8xx.h:

	#define piggy_serial_init()	mpc_serial_init(bp)

...and in include/asm-ppc/ibm4xx.h

	#define piggy_serial_init()	serial_init(0)

...and in misc-embedded.c change you list of #ifdefs to be:

	piggy_serial_init();

If the individual boards need some different initialization, just move the macro to a lower level include file.

	-- Dan

** Sent via the linuxppc-dev mail list. See http://lists.linuxppc.org/