mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Lucas Stach <l.stach@pengutronix.de>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: match of_modaliases
Date: Fri, 07 Feb 2014 12:52:19 +0100	[thread overview]
Message-ID: <1391773939.5116.6.camel@weser.hi.pengutronix.de> (raw)
In-Reply-To: <1391762000-19451-1-git-send-email-s.hauer@pengutronix.de>

Am Freitag, den 07.02.2014, 09:33 +0100 schrieb Sascha Hauer:
> Right now barebox does not match the "vendor,device" compatible entries
> in the devicetree. Implement this and also let the m25p80 driver match
> to the different flash types, not only "m25p80".
> 
This needs the attached minor tweak in the m25p80 driver to actually
work for the non-jedec compatible devices.

Otherwise
Tested-by: Lucas Stach <l.stach@pengutronix.de>

This removes the need for "spi: m25p80: detect non-jedec chips by using
DT compatible"

--------------------------------->8---------------------------------
From 53121d1eae60dbef3515f36c15a415cf736480d7 Mon Sep 17 00:00:00 2001
From: Lucas Stach <l.stach@pengutronix.de>
Date: Fri, 7 Feb 2014 12:45:21 +0100
Subject: [PATCH] spi: m25p80: make DT probing work

Just use the previously matched id_entry.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
---
 drivers/mtd/devices/m25p80.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index e6d8c05e904b..3efdd359a824 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -825,6 +825,7 @@ static int m25p_probe(struct device_d *dev)
 	unsigned			i;
 	unsigned			do_jdec_probe = 1;
 	char				*flashname = NULL;
+	const char			*typename = NULL;
 	int				device_id;
 
 	/* Platform data helps sort out which chip type we have, as
@@ -833,12 +834,17 @@ static int m25p_probe(struct device_d *dev)
 	 * newer chips, even if we don't recognize the particular chip.
 	 */
 	data = dev->platform_data;
-	if (data && data->type) {
+	if (data && data->type)
+		typename = data->type;
+	else if (dev->id_entry)
+		typename = dev->id_entry->name;
+
+	if (typename) {
 		const struct platform_device_id *plat_id;
 
 		for (i = 0; i < ARRAY_SIZE(m25p_ids) - 1; i++) {
 			plat_id = &m25p_ids[i];
-			if (strcmp(data->type, plat_id->name))
+			if (strcmp(typename, plat_id->name))
 				continue;
 			break;
 		}
@@ -851,7 +857,7 @@ static int m25p_probe(struct device_d *dev)
 			if (!info->jedec_id)
 				do_jdec_probe = 0;
 		} else
-			dev_warn(&spi->dev, "unrecognized id %s\n", data->type);
+			dev_warn(&spi->dev, "unrecognized id %s\n", typename);
 	}
 
 	if (do_jdec_probe) {
-- 
1.8.5.3

-- 
Pengutronix e.K.                           | Lucas Stach                 |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-5076 |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

      parent reply	other threads:[~2014-02-07 11:52 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-02-07  8:33 Sascha Hauer
2014-02-07  8:33 ` [PATCH 1/2] i2c/spi: " Sascha Hauer
2014-02-07  8:33 ` [PATCH 2/2] mtd: m25p80: set driver id_table Sascha Hauer
2014-02-07 11:52 ` Lucas Stach [this message]

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=1391773939.5116.6.camel@weser.hi.pengutronix.de \
    --to=l.stach@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@pengutronix.de \
    /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