linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: "Grant Likely" <grant.likely@secretlab.ca>
To: "René Bürgel" <r.buergel@unicontrol.de>
Cc: linuxppc-dev@ozlabs.org
Subject: Re: [PATCH] workaround for mpc52xx erratum #364 (serial may not be reset in break state)
Date: Mon, 3 Nov 2008 13:55:10 -0700	[thread overview]
Message-ID: <fa686aa40811031255w3d9a065dgb0eb7ad4b26c9651@mail.gmail.com> (raw)
In-Reply-To: <490F51E7.3020309@unicontrol.de>

On Mon, Nov 3, 2008 at 12:32 PM, Ren=E9 B=FCrgel <r.buergel@unicontrol.de> =
wrote:
> Hi
>
> This patch is a workaround for bug #364 found in the MPC52xx processor.
> The errata document can be found under
> http://www.freescale.com/files/32bit/doc/errata/MPC5200E.pdf?fpsp=3D1&WT_=
TYPE=3DErrata&WT_VENDOR=3DFREESCALE&WT_FILE_FORMAT=3Dpdf&WT_ASSET=3DDocumen=
tation
>

This is an MPC5200 errata.  It doesn't exist on the MPC5200B.  The
bugfix code should be enabled at runtime only if running on the
original MPC5200.  You can use the value of the compatible property to
determine whether or not to enable it.  Optionally you can further
reduce impact by checking if CONFIG_PPC_MPC5200_BUGFIX is defined.

More comments below

> diff --git a/drivers/serial/mpc52xx_uart.c b/drivers/serial/mpc52xx_uart.=
c
> index 6117d3d..929524b 100644
> --- a/drivers/serial/mpc52xx_uart.c
> +++ b/drivers/serial/mpc52xx_uart.c
> @@ -496,6 +496,27 @@ mpc52xx_uart_break_ctl(struct uart_port *port, int c=
tl)
>        spin_unlock_irqrestore(&port->lock, flags);
>  }
>
> +/* macro with helper macros to safely reset rx which mustn't be done in
> break state.
> + * This is a workaround for processor bug #364 described in MPC5200 (L25=
R)
> Errata.
> + *
> + * The workaround resets the baudrate to 4800, waits for a stable state =
and
> resets break state repeatedly if necessary
> + * optionally it can release the lock while waiting.
> + * 1 character at 4800 baud takes 2ms, 3ms should be enough for 1 charac=
ter
> at higher speed and 1 char at lowest
> + * works only with longer delays
> + */
> +#define LOCK(code) code
> +#define DONT_LOCK(code)
> +#define mpc52xx_uart_reset_rx(LOCK)
>                    \
> +       out_8(&psc->ctur,0x01);
>                     \
> +       out_8(&psc->ctlr,0xae);
>                     \
> +       do {
>                    \
> +               out_8(&psc->command,MPC52xx_PSC_RST_ERR_STAT);
>                    \
> +               LOCK(disable_irq(port->irq);
> spin_unlock_irqrestore(&port->lock, flags));       \
> +               mdelay(10);
>                     \
> +               LOCK(spin_lock_irqsave(&port->lock, flags);
> enable_irq(port->irq));             \
> +       } while ((in_be16(&psc->mpc52xx_psc_status)) & MPC52xx_PSC_SR_RB)=
;
>                    \
> +       out_8(&psc->command,MPC52xx_PSC_RST_RX);
> +

ick.  ugly.  Don't mess about with a macro here, just write a
function.  Let the compiler decide if it should be inlined.

g.

--=20
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.

  reply	other threads:[~2008-11-03 20:55 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-11-03 19:32 [PATCH] workaround for mpc52xx erratum #364 (serial may not be reset in break state) René Bürgel
2008-11-03 20:55 ` Grant Likely [this message]
2008-11-03 21:57   ` Matt Sealey
2008-11-03 22:15     ` Wolfram Sang
2008-11-03 22:55       ` Grant Likely
2008-11-04 18:18       ` Matt Sealey
2008-11-04 10:43   ` [PATCH V2] " René Bürgel
2008-11-04 11:15     ` Wolfram Sang
2008-11-04 14:13       ` René Bürgel
2008-11-04 19:40       ` [PATCH V3] " René Bürgel
2008-11-04 21:21         ` Wolfram Sang
2008-11-06  8:11           ` [PATCH V4] " René Bürgel
2008-11-14 19:09             ` Grant Likely
2008-11-04 18:23     ` [PATCH V2] " Matt Sealey
2008-11-06 17:01       ` René Bürgel
2008-11-06 22:41         ` Matt Sealey

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=fa686aa40811031255w3d9a065dgb0eb7ad4b26c9651@mail.gmail.com \
    --to=grant.likely@secretlab.ca \
    --cc=linuxppc-dev@ozlabs.org \
    --cc=r.buergel@unicontrol.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;
as well as URLs for NNTP newsgroup(s).