From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from metis.ext.pengutronix.de ([2001:6f8:1178:4:290:27ff:fe1d:cc33]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1T60BL-0007vK-De for barebox@lists.infradead.org; Mon, 27 Aug 2012 14:20:49 +0000 Date: Mon, 27 Aug 2012 16:20:43 +0200 From: Sascha Hauer Message-ID: <20120827142043.GL26594@pengutronix.de> References: <20120814172555.GP6271@game.jcrosoft.org> <1344965540-31534-1-git-send-email-plagnioj@jcrosoft.com> <1344965540-31534-3-git-send-email-plagnioj@jcrosoft.com> <20120814202136.GE1451@pengutronix.de> <20120815043055.GQ6271@game.jcrosoft.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20120815043055.GQ6271@game.jcrosoft.org> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: barebox-bounces@lists.infradead.org Errors-To: barebox-bounces+u.kleine-koenig=pengutronix.de@lists.infradead.org Subject: Re: [PATCH 3/7] smc911x: add 16bit bus width support To: Jean-Christophe PLAGNIOL-VILLARD Cc: barebox@lists.infradead.org On Wed, Aug 15, 2012 at 06:30:55AM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote: > On 22:21 Tue 14 Aug , Sascha Hauer wrote: > > On Tue, Aug 14, 2012 at 07:32:16PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote: > > > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD > > > --- > > > drivers/net/smc911x.c | 20 ++++++++++++++++++-- > > > 1 file changed, 18 insertions(+), 2 deletions(-) > > > > > > diff --git a/drivers/net/smc911x.c b/drivers/net/smc911x.c > > > index 2583235..c74ed52 100644 > > > --- a/drivers/net/smc911x.c > > > +++ b/drivers/net/smc911x.c > > > @@ -47,6 +47,8 @@ struct smc911x_priv { > > > struct mii_device miidev; > > > void __iomem *base; > > > > > > + u32 width; > > > + > > > u32 (*reg_read)(struct smc911x_priv *priv, u32 reg); > > > void (*reg_write)(struct smc911x_priv *priv, u32 reg, u32 val); > > > }; > > > @@ -78,7 +80,11 @@ static inline u32 smc911x_reg_read(struct smc911x_priv *priv, u32 reg) > > > > > > static inline u32 __smc911x_reg_read(struct smc911x_priv *priv, u32 reg) > > > { > > > - return readl(priv->base + reg); > > > + if (priv->width) > > > + return readl(priv->base + reg); > > > + else > > > + return ((readw(priv->base + reg) & 0xFFFF) | > > > + ((readw(priv->base + reg + 2) & 0xFFFF) << 16)); > > > } > > > > If you introduce function pointers for the read/write functions, then > > please use them to implement 16bit support. > this what this patch do No, it doesn't. If it would, there would be a function for 16bit access and another one for 32bit access. Sascha -- Pengutronix e.K. | | Industrial Linux Solutions | http://www.pengutronix.de/ | Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 | Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 | _______________________________________________ barebox mailing list barebox@lists.infradead.org http://lists.infradead.org/mailman/listinfo/barebox