Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751916AbbDUJzy (ORCPT ); Tue, 21 Apr 2015 05:55:54 -0400 Received: from www.linutronix.de ([62.245.132.108]:57206 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750775AbbDUJzw (ORCPT ); Tue, 21 Apr 2015 05:55:52 -0400 Date: Tue, 21 Apr 2015 11:56:06 +0200 (CEST) From: Thomas Gleixner To: Peter Griffin cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, srinivas.kandagatla@gmail.com, maxime.coquelin@st.com, patrice.chotard@st.com, daniel.lezcano@linaro.org, lee.jones@linaro.org, devicetree@vger.kernel.org, Ajit Pal Singh Subject: Re: [PATCH 1/5] clocksource: st_lpc: Add LPC timer as a clocksource. In-Reply-To: <1429267823-8879-2-git-send-email-peter.griffin@linaro.org> Message-ID: References: <1429267823-8879-1-git-send-email-peter.griffin@linaro.org> <1429267823-8879-2-git-send-email-peter.griffin@linaro.org> User-Agent: Alpine 2.11 (DEB 23 2013-08-11) MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1200 Lines: 44 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? 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/