ARM: orion5x: convert DT to use the mvebu-mbus driver

This commit switches the Orion5x Device Tree files to use the DT
representation and probing for the mvebu-mbus driver. The changes are
mainly:

 * Re-organize the DT to follow the same organization as the one used
   on Armada 370/XP, which is needed for mvebu-mbus to work: a
   top-level soc { ... } node, which corresponds to the MBus bus, and
   a sub-node internal-regs { ... } for all peripherals whose register
   sit only in the "Internal Register Window". This change re-indents
   by one level the definition of all nodes in the Device Tree, which
   explains the large change.

 * Use custom functions orion5x_dt_init_early() and
   orion5x_dt_init_time() instead of orion5x_init_early() and
   orion5x_timer_init() as we now want the MBus driver to be probed
   from the Device Tree. We still use the old-style timer
   initialization, but that will be changed in a followup commit.

Signed-off-by: Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
Acked-by: Sebastian Hesselbarth <sebastian.hesselbarth@gmail.com>
Link: https://lkml.kernel.org/r/1398202002-28530-14-git-send-email-thomas.petazzoni@free-electrons.com
Signed-off-by: Jason Cooper <jason@lakedaemon.net>
This commit is contained in:
Thomas Petazzoni 2014-04-22 23:26:17 +02:00 committed by Jason Cooper
parent 2a93474299
commit 5c69766485
4 changed files with 188 additions and 136 deletions

View File

@ -10,7 +10,7 @@
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/input/input.h>
#include "orion5x.dtsi"
#include "orion5x-mv88f5182.dtsi"
/ {
model = "LaCie Ethernet Disk mini V2";
@ -24,7 +24,11 @@
bootargs = "console=ttyS0,115200n8 earlyprintk";
};
ocp@f1000000 {
soc {
ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000>,
<MBUS_ID(0x09, 0x00) 0 0xf2200000 0x800>;
internal-regs {
serial@12000 {
clock-frequency = <166666667>;
status = "okay";
@ -35,6 +39,7 @@
nr-ports = <2>;
};
};
};
gpio_keys {
compatible = "gpio-keys";

View File

@ -0,0 +1,24 @@
/*
* Copyright (C) 2014 Thomas Petazzoni <thomas.petazzoni@free-electrons.com>
*
* This file is licensed under the terms of the GNU General Public
* License version 2. This program is licensed "as is" without any
* warranty of any kind, whether express or implied.
*/
#include "orion5x.dtsi"
/ {
compatible = "marvell,orion5x-88f5182", "marvell,orion5x";
soc {
compatible = "marvell,orion5x-88f5182-mbus", "simple-bus";
internal-regs {
mbusc: mbus-controller@20000 {
compatible = "marvell,mbus-controller";
reg = <0x20000 0x100>, <0x1500 0x20>;
};
};
};
};

View File

@ -8,6 +8,8 @@
#include "skeleton.dtsi"
#define MBUS_ID(target,attributes) (((target) << 24) | ((attributes) << 16))
/ {
model = "Marvell Orion5x SoC";
compatible = "marvell,orion5x";
@ -17,12 +19,16 @@
gpio0 = &gpio0;
};
ocp@f1000000 {
soc {
#address-cells = <2>;
#size-cells = <1>;
controller = <&mbusc>;
internal-regs {
compatible = "simple-bus";
ranges = <0x00000000 0xf1000000 0x4000000
0xf2200000 0xf2200000 0x0000800>;
#address-cells = <1>;
#size-cells = <1>;
ranges = <0 MBUS_ID(0xf0, 0x01) 0 0x100000>;
gpio0: gpio@10100 {
compatible = "marvell,orion-gpio";
@ -146,15 +152,6 @@
status = "disabled";
};
crypto@90000 {
compatible = "marvell,orion-crypto";
reg = <0x90000 0x10000>,
<0xf2200000 0x800>;
reg-names = "regs", "sram";
interrupts = <28>;
status = "okay";
};
ehci@a0000 {
compatible = "marvell,orion-ehci";
reg = <0xa0000 0x1000>;
@ -162,4 +159,14 @@
status = "disabled";
};
};
crypto@90000 {
compatible = "marvell,orion-crypto";
reg = <MBUS_ID(0xf0, 0x01) 0x90000 0x10000>,
<MBUS_ID(0x09, 0x00) 0x0 0x800>;
reg-names = "regs", "sram";
interrupts = <28>;
status = "okay";
};
};
};

View File

@ -15,10 +15,14 @@
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/cpu.h>
#include <linux/mbus.h>
#include <asm/system_misc.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <mach/orion5x.h>
#include <mach/bridge-regs.h>
#include <plat/irq.h>
#include <plat/time.h>
#include "common.h"
static struct of_dev_auxdata orion5x_auxdata_lookup[] __initdata = {
@ -31,6 +35,16 @@ static struct of_dev_auxdata orion5x_auxdata_lookup[] __initdata = {
{},
};
static void orion5x_dt_init_early(void)
{
orion_time_set_base(TIMER_VIRT_BASE);
}
static void orion5x_dt_init_time(void)
{
orion5x_timer_init();
}
static void __init orion5x_dt_init(void)
{
char *dev_name;
@ -39,6 +53,8 @@ static void __init orion5x_dt_init(void)
orion5x_id(&dev, &rev, &dev_name);
printk(KERN_INFO "Orion ID: %s. TCLK=%d.\n", dev_name, orion5x_tclk);
BUG_ON(mvebu_mbus_dt_init());
/*
* Setup Orion address map
*/
@ -71,9 +87,9 @@ static const char *orion5x_dt_compat[] = {
DT_MACHINE_START(ORION5X_DT, "Marvell Orion5x (Flattened Device Tree)")
/* Maintainer: Thomas Petazzoni <thomas.petazzoni@free-electrons.com> */
.map_io = orion5x_map_io,
.init_early = orion5x_init_early,
.init_early = orion5x_dt_init_early,
.init_irq = orion_dt_init_irq,
.init_time = orion5x_timer_init,
.init_time = orion5x_dt_init_time,
.init_machine = orion5x_dt_init,
.restart = orion5x_restart,
.dt_compat = orion5x_dt_compat,