From: Sergei Shtylyov <sshtylyov@mvista.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH V2] mvsata_ide: adjust port init sequence
Date: Tue, 07 Sep 2010 13:23:27 +0400 [thread overview]
Message-ID: <4C86048F.4020503@mvista.com> (raw)
In-Reply-To: <1283814151-8440-1-git-send-email-albert.aribaud@free.fr>
Hello.
On 07-09-2010 3:02, Albert Aribaud wrote:
> mvsata_ide_initialize_port(): adjust init sequence (SStatus
> should be checked only after all writes to SControl) and
> return success/failure to ide_preinit().
> Also, as some tests showed init durations in the hundreds
> of us, raise the time-out to 10 ms to be on the safe side.
> Signed-off-by: Albert Aribaud<albert.aribaud@free.fr>
[...]
> diff --git a/drivers/block/mvsata_ide.c b/drivers/block/mvsata_ide.c
> index 077b278..470659d 100644
> --- a/drivers/block/mvsata_ide.c
> +++ b/drivers/block/mvsata_ide.c
> @@ -97,23 +97,27 @@ struct mvsata_port_registers {
> * DET back to "no action".
> */
>
> -static void mvsata_ide_initialize_port(struct mvsata_port_registers *port)
> +static int mvsata_ide_initialize_port(struct mvsata_port_registers *port)
> {
> u32 control;
> u32 status;
> - u32 tout = 50; /* wait at most 50 us for SATA reset to complete */
> + u32 tout = 10000; /* wait at most 10 ms for SATA reset to complete */
>
> + /* Set control IPM to 3 (no low power) and DET to 1 (initialize) */
> control = readl(&port->scontrol);
> control = (control& ~MVSATA_SCONTROL_MASK) | MVSATA_PORT_INIT;
> writel(control,&port->scontrol);
> + /* Toggle control DET back to 0 (normal operation) */
> + control = (control& ~MVSATA_SCONTROL_MASK) | MVSATA_PORT_USE;
> + writel(control,&port->scontrol);
> + /* wait for status DET to become 3 (device and communication OK) */
> while (--tout) {
> status = readl(&port->sstatus)& MVSATA_SSTATUS_DET_MASK;
> if (status == MVSATA_SSTATUS_DET_DEVCOMM)
> break;
> udelay(1);
> }
> - control = (control& ~MVSATA_SCONTROL_MASK) | MVSATA_PORT_USE;
> - writel(control,&port->scontrol);
> + return (tout? 0: 1);
Weren't you going to replace this with '!tout'? And anyway, you omitted
space before '?' this time, not only before ':'.
WBR, Sergei
prev parent reply other threads:[~2010-09-07 9:23 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-09-06 23:02 [U-Boot] [PATCH V2] mvsata_ide: adjust port init sequence Albert Aribaud
2010-09-07 6:42 ` Prafulla Wadaskar
2010-09-07 11:23 ` Albert ARIBAUD
2010-09-07 13:32 ` Prafulla Wadaskar
2010-09-07 14:06 ` Wolfgang Denk
2010-09-07 17:32 ` Albert ARIBAUD
2010-09-07 19:00 ` Wolfgang Denk
2010-09-07 21:14 ` Albert ARIBAUD
2010-09-07 9:23 ` Sergei Shtylyov [this message]
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=4C86048F.4020503@mvista.com \
--to=sshtylyov@mvista.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