diff mbox

[v4,06/12] memory: mvebu-devbus: Remove address decoding window workaround

Message ID 1371672446-21583-7-git-send-email-ezequiel.garcia@free-electrons.com (mailing list archive)
State New, archived
Headers show

Commit Message

Ezequiel Garcia June 19, 2013, 8:07 p.m. UTC
Now that mbus device tree binding has been introduced, remove the address
decoding window management from this driver.
A suitable 'ranges' entry should be added to the devbus-compatible node in
the device tree, as described by the mbus binding documentation.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
---
Greg,

I'm Ccing you, since you're carrying the mvebu-devbus driver in your trees.
This patch should be applied only after the MBus DT binding is accepted
and/or merged; although I doubt we will see that happening any time soon.

 drivers/memory/mvebu-devbus.c | 64 ++-----------------------------------------
 1 file changed, 2 insertions(+), 62 deletions(-)

Comments

Jason Cooper June 19, 2013, 8:18 p.m. UTC | #1
On Wed, Jun 19, 2013 at 05:07:20PM -0300, Ezequiel Garcia wrote:
> Now that mbus device tree binding has been introduced, remove the address
> decoding window management from this driver.
> A suitable 'ranges' entry should be added to the devbus-compatible node in
> the device tree, as described by the mbus binding documentation.
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> ---
> Greg,
> 
> I'm Ccing you, since you're carrying the mvebu-devbus driver in your trees.
> This patch should be applied only after the MBus DT binding is accepted
> and/or merged; although I doubt we will see that happening any time soon.
> 
>  drivers/memory/mvebu-devbus.c | 64 ++-----------------------------------------
>  1 file changed, 2 insertions(+), 62 deletions(-)

Since this MBus series is most likely for v3.12, Greg's tree will be
merged by then.  At which time, we can decide if it's best to keep the
series together or continue to send devbus changes through him.  I'm
fine either way, and but I have a preference for keeping the series
together.

thx,

Jason.
Greg KH June 19, 2013, 10:16 p.m. UTC | #2
On Wed, Jun 19, 2013 at 04:18:05PM -0400, Jason Cooper wrote:
> On Wed, Jun 19, 2013 at 05:07:20PM -0300, Ezequiel Garcia wrote:
> > Now that mbus device tree binding has been introduced, remove the address
> > decoding window management from this driver.
> > A suitable 'ranges' entry should be added to the devbus-compatible node in
> > the device tree, as described by the mbus binding documentation.
> > 
> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Signed-off-by: Ezequiel Garcia <ezequiel.garcia@free-electrons.com>
> > ---
> > Greg,
> > 
> > I'm Ccing you, since you're carrying the mvebu-devbus driver in your trees.
> > This patch should be applied only after the MBus DT binding is accepted
> > and/or merged; although I doubt we will see that happening any time soon.
> > 
> >  drivers/memory/mvebu-devbus.c | 64 ++-----------------------------------------
> >  1 file changed, 2 insertions(+), 62 deletions(-)
> 
> Since this MBus series is most likely for v3.12, Greg's tree will be
> merged by then.  At which time, we can decide if it's best to keep the
> series together or continue to send devbus changes through him.  I'm
> fine either way, and but I have a preference for keeping the series
> together.

Ok, I'll ignore this then, as it shouldn't go into 3.11, and I don't
have trees that go beyond that at this point in time.

thanks,

greg k-h
diff mbox

Patch

diff --git a/drivers/memory/mvebu-devbus.c b/drivers/memory/mvebu-devbus.c
index 978e8e3..94c9248 100644
--- a/drivers/memory/mvebu-devbus.c
+++ b/drivers/memory/mvebu-devbus.c
@@ -208,16 +208,11 @@  static int mvebu_devbus_probe(struct platform_device *pdev)
 {
 	struct device *dev = &pdev->dev;
 	struct device_node *node = pdev->dev.of_node;
-	struct device_node *parent;
 	struct devbus *devbus;
 	struct resource *res;
 	struct clk *clk;
 	unsigned long rate;
-	const __be32 *ranges;
-	int err, cs;
-	int addr_cells, p_addr_cells, size_cells;
-	int ranges_len, tuple_len;
-	u32 base, size;
+	int err;
 
 	devbus = devm_kzalloc(&pdev->dev, sizeof(struct devbus), GFP_KERNEL);
 	if (!devbus)
@@ -248,68 +243,13 @@  static int mvebu_devbus_probe(struct platform_device *pdev)
 		return err;
 
 	/*
-	 * Allocate an address window for this device.
-	 * If the device probing fails, then we won't be able to
-	 * remove the allocated address decoding window.
-	 *
-	 * FIXME: This is only a temporary hack! We need to do this here
-	 * because we still don't have device tree bindings for mbus.
-	 * Once that support is added, we will declare these address windows
-	 * statically in the device tree, and remove the window configuration
-	 * from here.
-	 */
-
-	/*
-	 * Get the CS to choose the window string.
-	 * This is a bit hacky, but it will be removed once the
-	 * address windows are declared in the device tree.
-	 */
-	cs = (((unsigned long)devbus->base) % 0x400) / 8;
-
-	/*
-	 * Parse 'ranges' property to obtain a (base,size) window tuple.
-	 * This will be removed once the address windows
-	 * are declared in the device tree.
-	 */
-	parent = of_get_parent(node);
-	if (!parent)
-		return -EINVAL;
-
-	p_addr_cells = of_n_addr_cells(parent);
-	of_node_put(parent);
-
-	addr_cells = of_n_addr_cells(node);
-	size_cells = of_n_size_cells(node);
-	tuple_len = (p_addr_cells + addr_cells + size_cells) * sizeof(__be32);
-
-	ranges = of_get_property(node, "ranges", &ranges_len);
-	if (ranges == NULL || ranges_len != tuple_len)
-		return -EINVAL;
-
-	base = of_translate_address(node, ranges + addr_cells);
-	if (base == OF_BAD_ADDR)
-		return -EINVAL;
-	size = of_read_number(ranges + addr_cells + p_addr_cells, size_cells);
-
-	/*
-	 * Create an mbus address windows.
-	 * FIXME: Remove this, together with the above code, once the
-	 * address windows are declared in the device tree.
-	 */
-	err = mvebu_mbus_add_window(devbus_wins[cs], base, size);
-	if (err < 0)
-		return err;
-
-	/*
 	 * We need to create a child device explicitly from here to
 	 * guarantee that the child will be probed after the timing
 	 * parameters for the bus are written.
 	 */
 	err = of_platform_populate(node, NULL, NULL, dev);
-	if (err < 0) {
-		mvebu_mbus_del_window(base, size);
+	if (err < 0)
 		return err;
-	}
 
 	return 0;
 }