Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1031764AbbD2Psy (ORCPT ); Wed, 29 Apr 2015 11:48:54 -0400 Received: from mx07-00178001.pphosted.com ([62.209.51.94]:47754 "EHLO mx07-00178001.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1031718AbbD2Psu (ORCPT ); Wed, 29 Apr 2015 11:48:50 -0400 Message-ID: <5540FD3B.1040702@st.com> Date: Wed, 29 Apr 2015 17:48:11 +0200 From: Maxime Coquelin User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.6.0 MIME-Version: 1.0 To: Thomas Gleixner , Peter Griffin CC: , , , , , , , Ajit Pal Singh Subject: Re: [PATCH 1/5] clocksource: st_lpc: Add LPC timer as a clocksource. References: <1429267823-8879-1-git-send-email-peter.griffin@linaro.org> <1429267823-8879-2-git-send-email-peter.griffin@linaro.org> In-Reply-To: Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [10.201.23.80] X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:5.13.68,1.0.33,0.0.0000 definitions=2015-04-29_05:2015-04-29,2015-04-29,1970-01-01 signatures=0 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1661 Lines: 60 Hello Thomas, On 04/21/2015 11:56 AM, Thomas Gleixner wrote: > On Fri, 17 Apr 2015, Peter Griffin wrote: >> +/* Low Power Timer */ >> +#define LPC_LPT_LSB_OFF 0x400 >> +#define LPC_LPT_MSB_OFF 0x404 >> +#define LPC_LPT_START_OFF 0x408 >> + >> +struct st_lpc { >> + struct clk *clk; >> + void __iomem *iomem_cs; >> +}; >> + >> +static struct st_lpc *st_lpc; >> + >> +static u64 notrace st_lpc_counter_read(void) >> +{ >> + u64 counter; >> + u32 lower; >> + u32 upper, old_upper; >> + >> + upper = readl_relaxed(st_lpc->iomem_cs + LPC_LPT_MSB_OFF); >> + do { >> + old_upper = upper; >> + lower = readl_relaxed(st_lpc->iomem_cs + LPC_LPT_LSB_OFF); >> + upper = readl_relaxed(st_lpc->iomem_cs + LPC_LPT_MSB_OFF); >> + } while (upper != old_upper); >> + >> + counter = upper; >> + counter <<= 32; >> + counter |= lower; >> + return counter; > > What's the point of this exercise? The kernel can handle 32bit > clocksources nicely. So why do you want to artificially expand them to > 64bit by adding useless loops and hoops to a hotpath? I agree we should use only the lower 32 bits. This timer is moreover clocked at a slow rate (30MHz), so we won't have too much interrupts. Peter, doing that, you could use something like this directly: clocksource_mmio_init(st_lpc->iomem_cs + LPC_LPT_LSB_OFF, "st_lpc_timer", rate, 200, 24, clocksource_mmio_readl_down); Thanks, Maxime > > Thanks, > > tglx -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/