From: Sascha Hauer <s.hauer@pengutronix.de>
To: zzs213@126.com
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH] fix IORESOURCE_MEM_xxx usage in dm9k driver
Date: Mon, 27 Jun 2016 09:47:48 +0200 [thread overview]
Message-ID: <20160627074748.GX20657@pengutronix.de> (raw)
In-Reply-To: <1466826780-23656-1-git-send-email-zzs213@126.com>
On Sat, Jun 25, 2016 at 11:53:00AM +0800, zzs213@126.com wrote:
> From: 张忠山 <zzs213@126.com>
>
> Because the const used in dm9k driver unmatch the new IORESOURCE_MEM_xxx
> macro. So whenever the driver start probe, the flowwing error message
> appear:
>
> Wrong io resource size
>
> This patch fix this.
>
> Signed-off-by: 张忠山 <zzs213@126.com>
> ---
> drivers/net/dm9k.c | 14 +++++---------
> 1 file changed, 5 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/net/dm9k.c b/drivers/net/dm9k.c
> index ad402e3..7a41868 100644
> --- a/drivers/net/dm9k.c
> +++ b/drivers/net/dm9k.c
> @@ -732,14 +732,10 @@ static int dm9k_init_dev(struct eth_device *edev)
> static int dm9000_setup_buswidth(struct device_d *dev, struct dm9k *priv, uint32_t width)
> {
> switch (width) {
> - case 1:
> - priv->buswidth = IORESOURCE_MEM_8BIT;
> - break;
> - case 2:
> - priv->buswidth = IORESOURCE_MEM_16BIT;
> - break;
> - case 4:
> - priv->buswidth = IORESOURCE_MEM_32BIT;
> + case IORESOURCE_MEM_8BIT:
> + case IORESOURCE_MEM_16BIT:
> + case IORESOURCE_MEM_32BIT:
> + priv->buswidth = width;
> break;
> default:
> dev_err(dev, "Wrong io resource size\n");
This seems to fix platform data based probe but breaks device tree
support. The culprit is in:
d818f02 net: dm9k: add device tree support
I believe this should be like the attached patch. Could you confirm this
works for you?
Sascha
-----------------------------------8<-----------------------------
From 14d10daa084eb70afe96b044c58272fc991f94f3 Mon Sep 17 00:00:00 2001
From: Sascha Hauer <s.hauer@pengutronix.de>
Date: Mon, 27 Jun 2016 09:12:53 +0200
Subject: [PATCH] net: dm9k: Fix buswidth setting for platform data probe
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
priv->buswidth expects IORESOURCE_MEM_* macros which are not
identical to the integer byte bus width, so calling
dm9000_setup_buswidth() for the platform_data case is wrong.
fixes: d818f02 net: dm9k: add device tree support
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reported by: 张忠山 <zzs213@126.com>
---
drivers/net/dm9k.c | 42 ++++++++++++++++++------------------------
1 file changed, 18 insertions(+), 24 deletions(-)
diff --git a/drivers/net/dm9k.c b/drivers/net/dm9k.c
index acc0abb..25f0860 100644
--- a/drivers/net/dm9k.c
+++ b/drivers/net/dm9k.c
@@ -729,26 +729,6 @@ static int dm9k_init_dev(struct eth_device *edev)
return 0;
}
-static int dm9000_setup_buswidth(struct device_d *dev, struct dm9k *priv, uint32_t width)
-{
- switch (width) {
- case 1:
- priv->buswidth = IORESOURCE_MEM_8BIT;
- break;
- case 2:
- priv->buswidth = IORESOURCE_MEM_16BIT;
- break;
- case 4:
- priv->buswidth = IORESOURCE_MEM_32BIT;
- break;
- default:
- dev_err(dev, "Wrong io resource size\n");
- return -EINVAL;
- }
-
- return 0;
-}
-
static int dm9000_parse_dt(struct device_d *dev, struct dm9k *priv)
{
struct device_node *np = dev->device_node;
@@ -768,19 +748,33 @@ static int dm9000_parse_dt(struct device_d *dev, struct dm9k *priv)
prop = 1;
}
- return dm9000_setup_buswidth(dev, priv, prop);
+ switch (prop) {
+ case 1:
+ priv->buswidth = IORESOURCE_MEM_8BIT;
+ break;
+ case 2:
+ priv->buswidth = IORESOURCE_MEM_16BIT;
+ break;
+ case 4:
+ priv->buswidth = IORESOURCE_MEM_32BIT;
+ break;
+ default:
+ dev_err(dev, "Wrong io resource size\n");
+ return -EINVAL;
+ }
+
+ return 0;
}
static int dm9000_parse_pdata(struct device_d *dev, struct dm9k *priv)
{
struct dm9000_platform_data *pdata = dev->platform_data;
- uint32_t width;
priv->srom = pdata->srom;
- width = dev->resource[0].flags & IORESOURCE_MEM_TYPE_MASK;
+ priv->buswidth = dev->resource[0].flags & IORESOURCE_MEM_TYPE_MASK;
- return dm9000_setup_buswidth(dev, priv, width);
+ return 0;
}
static int dm9k_probe(struct device_d *dev)
--
2.8.1
--
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:[~2016-06-27 7:48 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-25 3:53 zzs213
2016-06-27 7:47 ` Sascha Hauer [this message]
2016-06-27 8:18 ` 张忠山
2016-06-27 8:20 ` 张忠山
2016-06-27 8:21 ` 张忠山
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=20160627074748.GX20657@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=barebox@lists.infradead.org \
--cc=zzs213@126.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox