linux-rtc.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jinke Fan <fanjinke@hygon.cn>
To: Alexandre Belloni <alexandre.belloni@bootlin.com>
Cc: "a.zummo@towertech.it" <a.zummo@towertech.it>,
	Wen Pu <puwen@hygon.cn>,
	"thomas.lendacky@amd.com" <thomas.lendacky@amd.com>,
	"kim.phillips@amd.com" <kim.phillips@amd.com>,
	"linux-rtc@vger.kernel.org" <linux-rtc@vger.kernel.org>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [RESEND RFC PATCH v3] rtc: Fix the AltCentury value on AMD/Hygon platform
Date: Mon, 21 Oct 2019 03:08:50 +0000	[thread overview]
Message-ID: <26fee8c9-695d-7703-bac9-5582ab560ae5@hygon.cn> (raw)
In-Reply-To: <20191019220456.GP3125@piout.net>

On 2019/10/20 6:04, Alexandre Belloni wrote:
> On 15/10/2019 16:08:27+0800, Jinke Fan wrote:
>>   	save_freq_select = CMOS_READ(RTC_FREQ_SELECT);
>> -	CMOS_WRITE((save_freq_select|RTC_DIV_RESET2), RTC_FREQ_SELECT);
>> +
>> +#ifdef CONFIG_X86
>> +	if (boot_cpu_data.x86_vendor == X86_VENDOR_AMD ||
>> +	    boot_cpu_data.x86_vendor == X86_VENDOR_HYGON)
>> +		CMOS_WRITE((save_freq_select & (~RTC_DV0)), RTC_FREQ_SELECT);
> 
> This should probably use ~RTC_DIV_RESET2.

Yes, ~RTC_DIV_RESET2 can actually achieve the same effect, because of
bit5-bit6 is defined as reserved.

>> +	else
>> +		CMOS_WRITE((save_freq_select | RTC_DIV_RESET2), RTC_FREQ_SELECT);
>> +#else
>> +	CMOS_WRITE((save_freq_select | RTC_DIV_RESET2), RTC_FREQ_SELECT);
>> +#endif
> 
> Also, later you have:
> 
> CMOS_WRITE(save_freq_select, RTC_FREQ_SELECT);
> 
> This may write bit4 again which would make mc146818_get_time fail so you
> probably want to update save_freq_select.

Yes, thanks for reminding me.

-- 
Best Regards,
Jinke Fan.

      reply	other threads:[~2019-10-21  3:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-15  8:08 [RESEND RFC PATCH v3] rtc: Fix the AltCentury value on AMD/Hygon platform Jinke Fan
2019-10-15  8:27 ` Alexandre Belloni
2019-10-15 10:08   ` Jinke Fan
2019-10-19 22:04 ` Alexandre Belloni
2019-10-21  3:08   ` Jinke Fan [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=26fee8c9-695d-7703-bac9-5582ab560ae5@hygon.cn \
    --to=fanjinke@hygon.cn \
    --cc=a.zummo@towertech.it \
    --cc=alexandre.belloni@bootlin.com \
    --cc=kim.phillips@amd.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-rtc@vger.kernel.org \
    --cc=puwen@hygon.cn \
    --cc=thomas.lendacky@amd.com \
    /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).