Skip to content

Commit

Permalink
ARM: Kirkwood: switch to DT clock providers
Browse files Browse the repository at this point in the history
With true DT clock providers available switch Kirkwood clock setup in
DT- enabled boards. While AUXDATA can be removed completely from bus
probing, some devices still don't know about DT. Therefore, some clkdev
aliases are created until these devices also move to DT.

Signed-off-by: Andrew Lunn <andrew@lunn.ch>
  • Loading branch information
Andrew Lunn authored and Thomas Petazzoni committed Nov 20, 2012
1 parent 5b03df9 commit 1611f87
Show file tree
Hide file tree
Showing 4 changed files with 83 additions and 13 deletions.
22 changes: 22 additions & 0 deletions arch/arm/boot/dts/kirkwood.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@
#address-cells = <1>;
#size-cells = <1>;

core_clk: core-clocks@10030 {
compatible = "marvell,kirkwood-core-clock";
reg = <0x10030 0x4>;
#clock-cells = <1>;
};

gpio0: gpio@10100 {
compatible = "marvell,orion-gpio";
#gpio-cells = <2>;
Expand All @@ -42,6 +48,7 @@
reg = <0x12000 0x100>;
reg-shift = <2>;
interrupts = <33>;
clocks = <&gate_clk 7>;
/* set clock-frequency in board dts */
status = "disabled";
};
Expand All @@ -51,6 +58,7 @@
reg = <0x12100 0x100>;
reg-shift = <2>;
interrupts = <34>;
clocks = <&gate_clk 7>;
/* set clock-frequency in board dts */
status = "disabled";
};
Expand All @@ -68,19 +76,30 @@
cell-index = <0>;
interrupts = <23>;
reg = <0x10600 0x28>;
clocks = <&gate_clk 7>;
status = "disabled";
};

gate_clk: clock-gating-control@2011c {
compatible = "marvell,kirkwood-gating-clock";
reg = <0x2011c 0x4>;
clocks = <&core_clk 0>;
#clock-cells = <1>;
};

wdt@20300 {
compatible = "marvell,orion-wdt";
reg = <0x20300 0x28>;
clocks = <&gate_clk 7>;
status = "okay";
};

sata@80000 {
compatible = "marvell,orion-sata";
reg = <0x80000 0x5000>;
interrupts = <21>;
clocks = <&gate_clk 14>, <&gate_clk 15>;
clock-names = "0", "1";
status = "disabled";
};

Expand All @@ -94,6 +113,7 @@
reg = <0x3000000 0x400>;
chip-delay = <25>;
/* set partition map and/or chip-delay in board dts */
clocks = <&gate_clk 7>;
status = "disabled";
};

Expand All @@ -104,6 +124,7 @@
#size-cells = <0>;
interrupts = <29>;
clock-frequency = <100000>;
clocks = <&gate_clk 7>;
status = "disabled";
};

Expand All @@ -113,6 +134,7 @@
<0xf5000000 0x800>;
reg-names = "regs", "sram";
interrupts = <22>;
clocks = <&gate_clk 17>;
status = "okay";
};
};
Expand Down
2 changes: 2 additions & 0 deletions arch/arm/mach-kirkwood/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ config MACH_GURUPLUG

config ARCH_KIRKWOOD_DT
bool "Marvell Kirkwood Flattened Device Tree"
select MVEBU_CLK_CORE
select MVEBU_CLK_GATING
select USE_OF
help
Say 'Y' here if you want your kernel to support the
Expand Down
71 changes: 58 additions & 13 deletions arch/arm/mach-kirkwood/board-dt.c
Original file line number Diff line number Diff line change
Expand Up @@ -14,28 +14,74 @@
#include <linux/init.h>
#include <linux/of.h>
#include <linux/of_platform.h>
#include <linux/clk-provider.h>
#include <linux/clk/mvebu.h>
#include <linux/kexec.h>
#include <asm/mach/arch.h>
#include <asm/mach/map.h>
#include <mach/bridge-regs.h>
#include <linux/platform_data/usb-ehci-orion.h>
#include <plat/irq.h>
#include <plat/common.h>
#include "common.h"

static struct of_device_id kirkwood_dt_match_table[] __initdata = {
{ .compatible = "simple-bus", },
{ }
};

struct of_dev_auxdata kirkwood_auxdata_lookup[] __initdata = {
OF_DEV_AUXDATA("marvell,orion-spi", 0xf1010600, "orion_spi.0", NULL),
OF_DEV_AUXDATA("marvell,mv64xxx-i2c", 0xf1011000, "mv64xxx_i2c.0",
NULL),
OF_DEV_AUXDATA("marvell,orion-wdt", 0xf1020300, "orion_wdt", NULL),
OF_DEV_AUXDATA("marvell,orion-sata", 0xf1080000, "sata_mv.0", NULL),
OF_DEV_AUXDATA("marvell,orion-nand", 0xf4000000, "orion_nand", NULL),
OF_DEV_AUXDATA("marvell,orion-crypto", 0xf1030000, "mv_crypto", NULL),
{},
};
/*
* There are still devices that doesn't know about DT yet. Get clock
* gates here and add a clock lookup alias, so that old platform
* devices still work.
*/

static void __init kirkwood_legacy_clk_init(void)
{

struct device_node *np = of_find_compatible_node(
NULL, NULL, "marvell,kirkwood-gating-clock");

struct of_phandle_args clkspec;

clkspec.np = np;
clkspec.args_count = 1;

clkspec.args[0] = CGC_BIT_GE0;
orion_clkdev_add(NULL, "mv643xx_eth_port.0",
of_clk_get_from_provider(&clkspec));

clkspec.args[0] = CGC_BIT_PEX0;
orion_clkdev_add("0", "pcie",
of_clk_get_from_provider(&clkspec));

clkspec.args[0] = CGC_BIT_USB0;
orion_clkdev_add(NULL, "orion-ehci.0",
of_clk_get_from_provider(&clkspec));

clkspec.args[0] = CGC_BIT_XOR0;
orion_clkdev_add(NULL, "mv_xor_shared.0",
of_clk_get_from_provider(&clkspec));

clkspec.args[0] = CGC_BIT_XOR1;
orion_clkdev_add(NULL, "mv_xor_shared.1",
of_clk_get_from_provider(&clkspec));

clkspec.args[0] = CGC_BIT_PEX1;
orion_clkdev_add("1", "pcie",
of_clk_get_from_provider(&clkspec));

clkspec.args[0] = CGC_BIT_GE1;
orion_clkdev_add(NULL, "mv643xx_eth_port.1",
of_clk_get_from_provider(&clkspec));

}

static void __init kirkwood_of_clk_init(void)
{
mvebu_clocks_init();
kirkwood_legacy_clk_init();
}

static void __init kirkwood_dt_init(void)
{
Expand All @@ -54,7 +100,7 @@ static void __init kirkwood_dt_init(void)
kirkwood_l2_init();

/* Setup root of clk tree */
kirkwood_clk_init();
kirkwood_of_clk_init();

/* internal devices that every board has */
kirkwood_xor0_init();
Expand Down Expand Up @@ -94,8 +140,7 @@ static void __init kirkwood_dt_init(void)
if (of_machine_is_compatible("keymile,km_kirkwood"))
km_kirkwood_init();

of_platform_populate(NULL, kirkwood_dt_match_table,
kirkwood_auxdata_lookup, NULL);
of_platform_populate(NULL, kirkwood_dt_match_table, NULL, NULL);
}

static const char *kirkwood_dt_board_compat[] = {
Expand Down
1 change: 1 addition & 0 deletions arch/arm/plat-orion/include/plat/common.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
#include <linux/mv643xx_eth.h>

struct dsa_platform_data;
struct mv_sata_platform_data;

void __init orion_uart0_init(void __iomem *membase,
resource_size_t mapbase,
Expand Down

0 comments on commit 1611f87

Please sign in to comment.