
Detlev Zundel wrote:
Hi Stefano,
The following patch provides support for multiple interface on MPC8xx based boards as already provided for other cpus (ppc4xx,MPC5200).
More information in doc/README.serial_multi
In the patch there is also a minor problem solved for the IP860 board (CONFIG_IP86x missing), that does not allow u-boot 1.2 to run.
Signed-off-by: stefano babic sbabic@denx.de
I am not able to apply this patch, it seems it got mangled by your mailer. Can you please repost as an inline attachment?
Apart from that, does anyone expect problems if I apply that to the repository?
It does not compile for MPC823. Stefano, could you please build it for TQM823L as well. To fix it, I changed in cpu/mpc8xx/serial.c:
#if (!defined(CONFIG_8xx_CONS_SMC1)) && (defined(CONFIG_MPC823) || defined(CONFIG_MPC850)) volatile iop8xx_t *ip = (iop8xx_t *)&(im->im_ioport); #endif
into
#if defined(CONFIG_8xx_CONS_SMC2) && (defined(CONFIG_MPC823) || defined(CONFIG_MPC850)) volatile iop8xx_t *ip = (iop8xx_t *)&(im->im_ioport); #endif
Furthermore, to get reduce the #ifdef mess, I would use another method to handle compile and run time selection of the serial port. Instead of:
#ifdef CONFIG_SERIAL_MULTI if (smc_index == SMC1_INDEX) { #endif #if defined(CONFIG_8xx_CONS_SMC1) /* Use Port B for SMC1 instead of other functions. */ cp->cp_pbpar |= 0x000000c0; cp->cp_pbdir &= ~0x000000c0; cp->cp_pbodr &= ~0x000000c0; #endif #ifdef CONFIG_SERIAL_MULTI } #endif
you could simple write:
if (smc_index == SMC1_INDEX) { /* Use Port B for SMC1 instead of other functions. */ cp->cp_pbpar |= 0x000000c0; cp->cp_pbdir &= ~0x000000c0; cp->cp_pbodr &= ~0x000000c0; }
For the static case, just define smc_index somewhere in a header file:
#ifndef CONFIG_SERIAL_MULTI #if defined(CONFIG_8xx_CONS_SMC1) #define smc_index SMC1_INDEX #elif defined(CONFIG_8xx_CONS_SMC2) #define smc_index SMC2_INDEX #endif
The optimizer will then eliminate the unused code. This makes the code much more readable, apart from checking the syntax.
Any comments?
Wolfgang.