summaryrefslogtreecommitdiff
path: root/arch/arm/mach-kirkwood
diff options
context:
space:
mode:
authorJamie Lentin <jm@lentin.co.uk>2012-04-18 11:06:42 +0100
committerJason Cooper <jason@lakedaemon.net>2012-05-15 02:29:11 +0000
commit858156bd6c24f12c3fca94bceacb05fa9a2daef4 (patch)
tree909ff44b45a3362d917694513fc995b8419bb312 /arch/arm/mach-kirkwood
parenta0fabf722c9dc73a3eed24ce166476ddb00eda1e (diff)
kirkwood: Allow nand to be configured via. devicetree
Add default configuration for NAND, to be enabled in your board config. Ensure clock gating is set appropriately when the NAND is enabled. Acked-by: Jason Cooper <jason@lakedaemon.net> Signed-off-by: Jamie Lentin <jm@lentin.co.uk> Signed-off-by: Jason Cooper <jason@lakedaemon.net>
Diffstat (limited to 'arch/arm/mach-kirkwood')
-rw-r--r--arch/arm/mach-kirkwood/common.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/arch/arm/mach-kirkwood/common.c b/arch/arm/mach-kirkwood/common.c
index a02cae881f2f..3ad037385a5e 100644
--- a/arch/arm/mach-kirkwood/common.c
+++ b/arch/arm/mach-kirkwood/common.c
@@ -15,6 +15,7 @@
#include <linux/ata_platform.h>
#include <linux/mtd/nand.h>
#include <linux/dma-mapping.h>
+#include <linux/of.h>
#include <net/dsa.h>
#include <asm/page.h>
#include <asm/timex.h>
@@ -482,6 +483,9 @@ static int __init kirkwood_clock_gate(void)
unsigned int curr = readl(CLOCK_GATING_CTRL);
u32 dev, rev;
+#ifdef CONFIG_OF
+ struct device_node *np;
+#endif
kirkwood_pcie_id(&dev, &rev);
printk(KERN_DEBUG "Gating clock of unused units\n");
printk(KERN_DEBUG "before: 0x%08x\n", curr);
@@ -489,6 +493,14 @@ static int __init kirkwood_clock_gate(void)
/* Make sure those units are accessible */
writel(curr | CGC_SATA0 | CGC_SATA1 | CGC_PEX0 | CGC_PEX1, CLOCK_GATING_CTRL);
+#ifdef CONFIG_OF
+ np = of_find_compatible_node(NULL, NULL, "mrvl,orion-nand");
+ if (np && of_device_is_available(np)) {
+ kirkwood_clk_ctrl |= CGC_RUNIT;
+ of_node_put(np);
+ }
+#endif
+
/* For SATA: first shutdown the phy */
if (!(kirkwood_clk_ctrl & CGC_SATA0)) {
/* Disable PLL and IVREF */