linux-mips
[Top] [All Lists]

Re: [PATCH] MIPS: Add RTC support for loongson1B

To: Ralf Baechle <ralf@linux-mips.org>
Subject: Re: [PATCH] MIPS: Add RTC support for loongson1B
From: zhao zhang <zhzhl555@gmail.com>
Date: Fri, 9 Dec 2011 14:44:27 +0800
Cc: a.zummo@towertech.it, rtc-linux@googlegroups.com, linux-mips@linux-mips.org, linux-kernel@vger.kernel.org, keguang.zhang@gmail.com, wuzhangjin@gmail.com, r0bertz@gentoo.org
Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=yMmjZk3lJDxGN/zDeoK9iof7ArEnaB66jZ1dBxOdzB0=; b=KLihlJzyZ09SsE/GluPXBdxa0DgsThuIZrUNI2hKY59f65JwQTeZLPapL4WUwZC24H 396UH7yrYm/RkfF/gNeCUDTPfn++v+dhR17KICzJTc3dUk9EYzgySEf3b57ZLPKpOkOg dptSbLyYKPRS9RQxXKeM+iul8v5coUXpx10N8=
In-reply-to: <20111208130835.GC10113@linux-mips.org>
References: <1322729078-6141-1-git-send-email-zhzhl555@gmail.com> <20111208130835.GC10113@linux-mips.org>
Sender: linux-mips-bounce@linux-mips.org
Thanks for Ralf's replay.

Since the read address and the write address are different, so i am worry about
the out-of-order execution. I just want make sure the read instruction *not*
ahead of that write instruction.

I didn't know about the detail principle of out-of-order execution on this SOC, and
i didn't know the read for different address will also complete after all preceeding
writes have completed.




在 2011年12月8日 下午9:08,Ralf Baechle <ralf@linux-mips.org>写道:
On Thu, Dec 01, 2011 at 04:44:38PM +0800, zhzhl555@gmail.com wrote:

> +     writel(t, SYS_TOYWRITE1);
> +     __asm__ volatile ("sync");
> +     c = 0x10000;
> +     while ((readl(SYS_COUNTER_CNTRL) & SYS_CNTRL_TS) && --c)
> +             usleep_range(1000, 3000);

Why the SYNC instruction?  This is an uncached write and on all MIPS CPUs
the SYNC instruction will only make sure the write has left the CPU's
write buffers.  There is no guarantee that by the time the SYNC has completed
the write has actually reached its destination.  If that is what you want,
read something from device.  Reads will only complete after all preceeding
writes have completed.

In this driver all instances of SYNC instructions are followed by polling
loops reading from the RTC which means all SYNCs should be unnecessary.

Or?

 Ralf

<Prev in Thread] Current Thread [Next in Thread>