All of lore.kernel.org
 help / color / mirror / Atom feed
From: Timothy Pearson <tpearson@raptorengineering.com>
To: linux-mtd@lists.infradead.org
Subject: [PATCH] mtd/powernv_flash: Enable partition support
Date: Sun, 25 Mar 2018 15:05:01 -0500 (CDT)	[thread overview]
Message-ID: <746862757.61253.1522008301855.JavaMail.zimbra@raptorengineeringinc.com> (raw)

On certain systems, such as the Talos II, skiboot emits a partition
table for the main PNOR MTD device in the generated device tree.

Allow this partition table to be parsed and the partitions to be
exposed via MTD device partition nodes.
---
 drivers/mtd/devices/powernv_flash.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/drivers/mtd/devices/powernv_flash.c b/drivers/mtd/devices/powernv_flash.c
index 26f9feaa5d17..f76045f78221 100644
--- a/drivers/mtd/devices/powernv_flash.c
+++ b/drivers/mtd/devices/powernv_flash.c
@@ -2,6 +2,7 @@
  * OPAL PNOR flash MTD abstraction
  *
  * Copyright IBM 2015
+ * Copyright Raptor Engineering, LLC 2018
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -47,6 +48,8 @@ enum flash_op {
 	FLASH_OP_ERASE,
 };
 
+static char const * const part_probes[] = { "ofpart", NULL };
+
 /*
  * Don't return -ERESTARTSYS if we can't get a token, the MTD core
  * might have split up the call from userspace and called into the
@@ -267,9 +270,14 @@ static int powernv_flash_probe(struct platform_device *pdev)
 	/*
 	 * The current flash that skiboot exposes is one contiguous flash chip
 	 * with an ffs partition at the start, it should prove easier for users
-	 * to deal with partitions or not as they see fit
+	 * to deal with partitions or not as they see fit.  skitboot places this
+	 * on the first MTD partition.
+	 *
+	 * Certain partitions may also be exposed to the host, such as the boot
+	 * kernel firmware partition.
 	 */
-	return mtd_device_register(&data->mtd, NULL, 0);
+	mtd_set_of_node(&data->mtd, dev->of_node);
+	return mtd_device_parse_register(&data->mtd, part_probes, NULL, NULL, 0);
 }
 
 /**
-- 
2.16.1

             reply	other threads:[~2018-03-25 20:05 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-25 20:05 Timothy Pearson [this message]
2018-03-29  5:29 ` [PATCH] mtd/powernv_flash: Enable partition support Rafał Miłecki
2018-03-29 21:43   ` Timothy Pearson
2018-03-29 22:11     ` Rafał Miłecki
2018-03-29 22:25       ` Timothy Pearson
  -- strict thread matches above, loose matches on Subject: below --
2018-07-23  9:02 Timothy Pearson
2018-07-23 10:14 ` Rafał Miłecki
2018-07-23 18:19   ` Timothy Pearson

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=746862757.61253.1522008301855.JavaMail.zimbra@raptorengineeringinc.com \
    --to=tpearson@raptorengineering.com \
    --cc=linux-mtd@lists.infradead.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 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.