From: Wolfgang Grandegger <wg@grandegger.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] Added support for multiple serial for MPC8XX (resubmit)
Date: Fri, 15 Jun 2007 21:38:21 +0200 [thread overview]
Message-ID: <4672EAAD.70709@grandegger.com> (raw)
In-Reply-To: <m2ejkdtdat.fsf@sowhat.denx.de>
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.
next prev parent reply other threads:[~2007-06-15 19:38 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-05 12:47 [U-Boot-Users] [PATCH] Added support for multiple serial for MPC8XX Stefano Babic
2007-06-05 13:53 ` Wolfgang Denk
2007-06-05 19:39 ` Stefano Babic
2007-06-05 23:49 ` Wolfgang Denk
2007-06-06 5:08 ` Stefan Roese
2007-06-06 13:03 ` Stefano Babic
2007-06-06 13:13 ` Stefan Roese
2007-06-06 13:27 ` Stefano Babic
2007-06-06 13:55 ` Wolfgang Denk
2007-06-06 14:20 ` Stefano Babic
2007-06-06 21:35 ` [U-Boot-Users] [PATCH] Added support for multiple serial for MPC8XX (resubmit) Stefano Babic
2007-06-15 16:03 ` Detlev Zundel
2007-06-15 19:38 ` Wolfgang Grandegger [this message]
2007-06-17 13:31 ` Stefano Babic
2007-06-17 21:16 ` Wolfgang Denk
2007-06-18 5:18 ` Wolfgang Grandegger
2007-06-17 11:35 ` Stefano Babic
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=4672EAAD.70709@grandegger.com \
--to=wg@grandegger.com \
--cc=u-boot@lists.denx.de \
/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