From mboxrd@z Thu Jan 1 00:00:00 1970 From: maxime.ripard@free-electrons.com (Maxime Ripard) Date: Thu, 12 Nov 2015 10:08:32 -0800 Subject: [PATCH] clocksource/drivers/timer_sun5i: Replace code by clocksource_mmio_init In-Reply-To: <1447348278-16277-1-git-send-email-daniel.lezcano@linaro.org> References: <1447348278-16277-1-git-send-email-daniel.lezcano@linaro.org> Message-ID: <20151112180832.GE32142@lukather> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org Hi Daniel, On Thu, Nov 12, 2015 at 06:11:18PM +0100, Daniel Lezcano wrote: > The current code to initialize, register and read the clocksource is > already factored out in mmio.c via the clocksource_mmio_init function. > > The only difference is the readl vs readl_relaxed. > > Factor out the code with the clocksource_mmio_init function. > > Signed-off-by: Daniel Lezcano > --- > drivers/clocksource/timer-sun5i.c | 16 ++-------------- > 1 file changed, 2 insertions(+), 14 deletions(-) > > diff --git a/drivers/clocksource/timer-sun5i.c b/drivers/clocksource/timer-sun5i.c > index bca9573..dc3793c 100644 > --- a/drivers/clocksource/timer-sun5i.c > +++ b/drivers/clocksource/timer-sun5i.c > @@ -152,13 +152,6 @@ static irqreturn_t sun5i_timer_interrupt(int irq, void *dev_id) > return IRQ_HANDLED; > } > > -static cycle_t sun5i_clksrc_read(struct clocksource *clksrc) > -{ > - struct sun5i_timer_clksrc *cs = to_sun5i_timer_clksrc(clksrc); > - > - return ~readl(cs->timer.base + TIMER_CNTVAL_LO_REG(1)); > -} > - > static int sun5i_rate_cb_clksrc(struct notifier_block *nb, > unsigned long event, void *data) > { > @@ -217,13 +210,8 @@ static int __init sun5i_setup_clocksource(struct device_node *node, > writel(TIMER_CTL_ENABLE | TIMER_CTL_RELOAD, > base + TIMER_CTL_REG(1)); > > - cs->clksrc.name = node->name; > - cs->clksrc.rating = 340; > - cs->clksrc.read = sun5i_clksrc_read; > - cs->clksrc.mask = CLOCKSOURCE_MASK(32); > - cs->clksrc.flags = CLOCK_SOURCE_IS_CONTINUOUS; > - > - ret = clocksource_register_hz(&cs->clksrc, rate); > + ret = clocksource_mmio_init(base + TIMER_CNTVAL_LO_REG(1), node->name, > + rate, 340, UINT_MAX, clocksource_mmio_readw_down); Shouldn't it be clocksource_mmio_readl_down? Thanks! Maxime -- Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 819 bytes Desc: Digital signature URL: From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754207AbbKLSIh (ORCPT ); Thu, 12 Nov 2015 13:08:37 -0500 Received: from down.free-electrons.com ([37.187.137.238]:52495 "EHLO mail.free-electrons.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751516AbbKLSIg (ORCPT ); Thu, 12 Nov 2015 13:08:36 -0500 Date: Thu, 12 Nov 2015 10:08:32 -0800 From: Maxime Ripard To: Daniel Lezcano Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org, "moderated list:ARM/Allwinner A1X..." Subject: Re: [PATCH] clocksource/drivers/timer_sun5i: Replace code by clocksource_mmio_init Message-ID: <20151112180832.GE32142@lukather> References: <1447348278-16277-1-git-send-email-daniel.lezcano@linaro.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Oiv9uiLrevHtW1RS" Content-Disposition: inline In-Reply-To: <1447348278-16277-1-git-send-email-daniel.lezcano@linaro.org> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --Oiv9uiLrevHtW1RS Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi Daniel, On Thu, Nov 12, 2015 at 06:11:18PM +0100, Daniel Lezcano wrote: > The current code to initialize, register and read the clocksource is > already factored out in mmio.c via the clocksource_mmio_init function. >=20 > The only difference is the readl vs readl_relaxed. >=20 > Factor out the code with the clocksource_mmio_init function. >=20 > Signed-off-by: Daniel Lezcano > --- > drivers/clocksource/timer-sun5i.c | 16 ++-------------- > 1 file changed, 2 insertions(+), 14 deletions(-) >=20 > diff --git a/drivers/clocksource/timer-sun5i.c b/drivers/clocksource/time= r-sun5i.c > index bca9573..dc3793c 100644 > --- a/drivers/clocksource/timer-sun5i.c > +++ b/drivers/clocksource/timer-sun5i.c > @@ -152,13 +152,6 @@ static irqreturn_t sun5i_timer_interrupt(int irq, vo= id *dev_id) > return IRQ_HANDLED; > } > =20 > -static cycle_t sun5i_clksrc_read(struct clocksource *clksrc) > -{ > - struct sun5i_timer_clksrc *cs =3D to_sun5i_timer_clksrc(clksrc); > - > - return ~readl(cs->timer.base + TIMER_CNTVAL_LO_REG(1)); > -} > - > static int sun5i_rate_cb_clksrc(struct notifier_block *nb, > unsigned long event, void *data) > { > @@ -217,13 +210,8 @@ static int __init sun5i_setup_clocksource(struct dev= ice_node *node, > writel(TIMER_CTL_ENABLE | TIMER_CTL_RELOAD, > base + TIMER_CTL_REG(1)); > =20 > - cs->clksrc.name =3D node->name; > - cs->clksrc.rating =3D 340; > - cs->clksrc.read =3D sun5i_clksrc_read; > - cs->clksrc.mask =3D CLOCKSOURCE_MASK(32); > - cs->clksrc.flags =3D CLOCK_SOURCE_IS_CONTINUOUS; > - > - ret =3D clocksource_register_hz(&cs->clksrc, rate); > + ret =3D clocksource_mmio_init(base + TIMER_CNTVAL_LO_REG(1), node->name, > + rate, 340, UINT_MAX, clocksource_mmio_readw_down); Shouldn't it be clocksource_mmio_readl_down? Thanks! Maxime --=20 Maxime Ripard, Free Electrons Embedded Linux, Kernel and Android engineering http://free-electrons.com --Oiv9uiLrevHtW1RS Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQIcBAEBAgAGBQJWRNWgAAoJEBx+YmzsjxAgDkkQAJ+HwQ4n6eu5zIWsh23zd7J5 uNPaVI0/BgiThYNXu2axF7YSHgqrTc3XFXJb1qtR5EN+zLuRdGOzqPUHQXP3tNPt jeU49wNLulMj85LV/QvJMq1/We+4SRPka0A99naZkx6y6YR4Xb7ZbO8u79+Mjn9Z 6e+pBAU1e2ZJs1CyuqgJ85PeKESvWY0OdZye0H2QGFnFt91nEIc1Bryxi4T8mCwU ph3IsD6EeEe7ucnav9OVipxAtX60OkVGhSRr16jhSBjtqD19DDevgvI6MxsgpkyV tqzCl/7AymlH/i3Tp6h6UE0SdiHjj2mKY04SW1poeLcy7jWdtDj63zA65lBPpG2s kxF9klbfItAkjLu1n2XYYuVpifP3W+8d4GgItg42jzvcQX+noBOYW5JaigEeMamn CIFZJve7sHhAgc/8kElVp04vcKWMyXqmnjZxFDJlvEpOCj5oU8HbU9eijGIjKOl1 I4mVqsCyhSTX4AZDebXfzXqABn1lM1uq23aBuZUx2mlT+3n1QnPfDYCBSzbaaLJz 1v4i5Si6pSNA8al2uP0lgDcU4puaTVVDPI9nvX6DkWqhqSHMXjK72elbrqomFVRM mBwHnTg7MwEbirJT+N2AqlOui3maPSiblua2URT0lIhlkWsPVXkPXL4bja910fO5 PUkMF1uJlqd+1yvXdhZe =Yt6Q -----END PGP SIGNATURE----- --Oiv9uiLrevHtW1RS--