From: Jonas Bonn <jonas-A9uVI2HLR7kOP4wsBPIw7w@public.gmane.org>
To: linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org
Subject: [PATCH 1/1] mtd: m25p80 -- parse partitions from OF tree
Date: Fri, 15 Oct 2010 14:53:28 +0200 [thread overview]
Message-ID: <1287147208-11588-1-git-send-email-jonas@southpole.se> (raw)
It needs to be possible to define the partitions of an MTD device from an OF
devicetree. This patch adds a call to of_mtd_parse_partitions if:
i) there are no commandline partitions defined
ii) there are no partitions set up by platform_data
iii) and an of_node is present on the device
This permits the following devicetree structure:
flash0: mtd@0 {
compatible = "st,m25p10";
reg = <0>;
spi-max-frequency = <100000000>;
#address-cells = <1>;
#size-cells = <1>;
partition@0 {
label = "bootloader";
reg = <0x00000000 0x00018000>;
read-only;
}
partition@18000 {
label = "data";
reg = <0x00018000 0x00008000>;
};
};
Signed-off-by: Jonas Bonn <jonas-A9uVI2HLR7kOP4wsBPIw7w@public.gmane.org>
---
drivers/mtd/devices/m25p80.c | 4 ++++
1 files changed, 4 insertions(+), 0 deletions(-)
diff --git a/drivers/mtd/devices/m25p80.c b/drivers/mtd/devices/m25p80.c
index 6f512b5..a349498 100644
--- a/drivers/mtd/devices/m25p80.c
+++ b/drivers/mtd/devices/m25p80.c
@@ -924,6 +924,10 @@ static int __devinit m25p_probe(struct spi_device *spi)
nr_parts = data->nr_parts;
}
+ if (nr_parts <= 0 && spi->dev.of_node) {
+ nr_parts = of_mtd_parse_partitions(&spi->dev, spi->dev.of_node, &parts);
+ }
+
if (nr_parts > 0) {
for (i = 0; i < nr_parts; i++) {
DEBUG(MTD_DEBUG_LEVEL2, "partitions[%d] = "
--
1.7.1
next reply other threads:[~2010-10-15 12:53 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-15 12:53 Jonas Bonn [this message]
[not found] ` <1287147208-11588-1-git-send-email-jonas-A9uVI2HLR7kOP4wsBPIw7w@public.gmane.org>
2010-10-15 15:31 ` [PATCH 1/1] mtd: m25p80 -- parse partitions from OF tree Grant Likely
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=1287147208-11588-1-git-send-email-jonas@southpole.se \
--to=jonas-a9uvi2hlr7kop4wsbpiw7w@public.gmane.org \
--cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \
--cc=linux-mtd-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \
/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