From: Sascha Hauer <s.hauer@pengutronix.de>
To: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 3/7] smc911x: add 16bit bus width support
Date: Tue, 14 Aug 2012 22:21:36 +0200 [thread overview]
Message-ID: <20120814202136.GE1451@pengutronix.de> (raw)
In-Reply-To: <1344965540-31534-3-git-send-email-plagnioj@jcrosoft.com>
On Tue, Aug 14, 2012 at 07:32:16PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
> 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.
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
next prev parent reply other threads:[~2012-08-14 20:21 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-14 17:25 [PATCH 0/7] smsc911x: runtime configuration improvement Jean-Christophe PLAGNIOL-VILLARD
2012-08-14 17:32 ` [PATCH 1/7] smc911x: move register define to smc911x.h Jean-Christophe PLAGNIOL-VILLARD
2012-08-14 17:32 ` [PATCH 2/7] smc911x: introduce read/write ops Jean-Christophe PLAGNIOL-VILLARD
2012-08-14 17:32 ` [PATCH 3/7] smc911x: add 16bit bus width support Jean-Christophe PLAGNIOL-VILLARD
2012-08-14 20:21 ` Sascha Hauer [this message]
2012-08-15 4:30 ` Jean-Christophe PLAGNIOL-VILLARD
2012-08-27 14:20 ` Sascha Hauer
2012-08-14 17:32 ` [PATCH 4/7] smc911x: add support to pass the shift via platform data Jean-Christophe PLAGNIOL-VILLARD
2012-08-14 17:32 ` [PATCH 5/7] smc911x: improve detection handle Jean-Christophe PLAGNIOL-VILLARD
2012-08-14 17:32 ` [PATCH 6/7] smc911x: update chip detection Jean-Christophe PLAGNIOL-VILLARD
2012-08-14 17:32 ` [PATCH 7/7] smm911x: check if the device is ready before using it Jean-Christophe PLAGNIOL-VILLARD
2012-08-14 20:19 ` [PATCH 1/7] smc911x: move register define to smc911x.h Sascha Hauer
2012-08-15 4:34 ` Jean-Christophe PLAGNIOL-VILLARD
-- strict thread matches above, loose matches on Subject: below --
2012-08-29 4:27 [PATCH 0/7 2] smsc911x: runtime configuration improvement Jean-Christophe PLAGNIOL-VILLARD
2012-08-29 5:06 ` [PATCH 1/7] smc911x: move register define to smc911x.h Jean-Christophe PLAGNIOL-VILLARD
2012-08-29 5:06 ` [PATCH 3/7] smc911x: add 16bit bus width support Jean-Christophe PLAGNIOL-VILLARD
2012-09-01 8:47 [PATCH 0/7 v3] smsc911x: runtime configuration improvement Jean-Christophe PLAGNIOL-VILLARD
2012-09-01 8:52 ` [PATCH 1/7] smc911x: move register define to smc911x.h Jean-Christophe PLAGNIOL-VILLARD
2012-09-01 8:52 ` [PATCH 3/7] smc911x: add 16bit bus width support Jean-Christophe PLAGNIOL-VILLARD
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=20120814202136.GE1451@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=plagnioj@jcrosoft.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.