ARM: Kirkwood: Add support for DNS-320 and DNS-325 using devicetree
Subsystems (5)
v5 cover ARM: Kirkwood: Add support for DNS-320 and DNS-325 using devicetree
Reworked patch for latest feedback. I'm still basing this on Jason Cooper's tree, given how much time has passed should I be rebasing against something else or is this still fine?
One thing I noticed is that with only the first patch applied (which no longer calls kirkwood_nand_init) the device either locks up or serial console dies at "Gating clock of unused units", presumably as CGC_RUNIT isn't set. Is this something known or is it worth further investigation?
Thanks again to everyone reviewing.
Changes since v4: Convert DNS-325 & DNS-320 to access nand via devicetree
* Add initial support patch back in to address following comments ** One MACH_DLINK_KIRKWOOD_DT for all dtb files [Grant Likely, Jason Cooper] ** Drop brain-dead select "select CONFIG_MTD_OF_PARTS" [Grant Likely] ** Don't add NAND support then throw it away immediately after [Grant Likely]
* WARN when bank-width is out of range [Andrew Lunn]
* Describe purpose of MPP 41, 42 & 49
Changes since v3: Add support for DNS-320 and DNS-325 using devicetree
* Remove patches that are already merged
* Add documentation on orion_nand devicetree bindings
* Convert bank-width to be in bytes to match other properties
* Make defaults more explicit
Changes since v2: Add support for DNS-320 and DNS-325 using devicetree
* Split patches further, separating orion_nand and kirkwood changes
* dts renames: "bank-width", not "width". "okay", not "ok"
* Separate documentation out into separate patch, add references to partition.txt to all mtd bindings.
Changes since v1: Add support for DNS-320 and DNS-325 using devicetree
* Rebase against kirkwood_dt_for_3.4, removing premature devicetree ports.
* Move additions into a separate board-dnskw.c. It could be separated further into a board-dns320.c and board-dns325.c but it probably isn't worth it.
* s/marvell,/mrvl,/g
* Include an example dtb partition in documentation
* Copy structure of serial nodes to allow common options for NAND to be set in kirkwood.dtsi
* Simplifications in orion-nand.c
Jamie Lentin (4):
ARM: kirkwood: Basic support for DNS-320 and DNS-325
mtd: Add orion_nand devicetree bindings
kirkwood: Allow nand to be configured via. devicetree
ARM: kirkwood: Define DNS-320/DNS-325 NAND in fdt
.../devicetree/bindings/mtd/orion-nand.txt | 50 ++++ arch/arm/boot/dts/kirkwood-dns320.dts | 64 +++++ arch/arm/boot/dts/kirkwood-dns325.dts | 59 +++++ arch/arm/boot/dts/kirkwood.dtsi | 15 +- arch/arm/mach-kirkwood/Kconfig | 8 + arch/arm/mach-kirkwood/Makefile | 1 + arch/arm/mach-kirkwood/Makefile.boot | 2 + arch/arm/mach-kirkwood/board-dnskw.c | 275 ++++++++++++++++++++ arch/arm/mach-kirkwood/board-dt.c | 5 + arch/arm/mach-kirkwood/common.c | 12 + arch/arm/mach-kirkwood/common.h | 6 + drivers/mtd/nand/orion_nand.c | 45 +++- 12 files changed, 539 insertions(+), 3 deletions(-) create mode 100644 Documentation/devicetree/bindings/mtd/orion-nand.txt create mode 100644 arch/arm/boot/dts/kirkwood-dns320.dts create mode 100644 arch/arm/boot/dts/kirkwood-dns325.dts create mode 100644 arch/arm/mach-kirkwood/board-dnskw.c
Signature · 1 line
1.7.9.1
PATCH v5 1/4 ARM: kirkwood: Basic support for DNS-320 and DNS-325
Add support for the DNS-320 and DNS-325. Describe as much as currently possible in the devicetree files, create a board-dnskw.c for everything else.
Changes since last submission (V3) [Addressing comments by]:-
* One MACH_DLINK_KIRKWOOD_DT for all dtb files [Grant Likely, Jason Cooper]
* Drop brain-dead select "select CONFIG_MTD_OF_PARTS" [Grant Likely]
* Don't add NAND support then throw it away immediately after [Grant Likely]
* Describe purpose of MPP 41, 42 & 49
Changes since last submission (V2):-
* Use IEEE-compliant "okay", rather than "ok" [Scott Wood]
--- arch/arm/boot/dts/kirkwood-dns320.dts | 29 ++++ arch/arm/boot/dts/kirkwood-dns325.dts | 24 +++ arch/arm/mach-kirkwood/Kconfig | 8 + arch/arm/mach-kirkwood/Makefile | 1 + arch/arm/mach-kirkwood/Makefile.boot | 2 + arch/arm/mach-kirkwood/board-dnskw.c | 275 +++++++++++++++++++++++++++++++++ arch/arm/mach-kirkwood/board-dt.c | 5 + arch/arm/mach-kirkwood/common.h | 6 + 8 files changed, 350 insertions(+), 0 deletions(-) create mode 100644 arch/arm/boot/dts/kirkwood-dns320.dts create mode 100644 arch/arm/boot/dts/kirkwood-dns325.dts create mode 100644 arch/arm/mach-kirkwood/board-dnskw.c
arch/arm/boot/dts/kirkwood-dns320.dts new file +29 -0
@@ -0,0 +1,29 @@ +/dts-v1/; + +/include/ "kirkwood.dtsi" + +/ { + model = "D-Link DNS-320 NAS (Rev A1)"; + compatible = "dlink,dns-320-a1", "dlink,dns-320", "dlink,dns-kirkwood", "mrvl,kirkwood-88f6281", "mrvl,kirkwood"; + + memory { + device_type = "memory"; + reg = <0x00000000 0x8000000>; + }; + + chosen { + bootargs = "console=ttyS0,115200n8 earlyprintk"; + }; + + ocp at f1000000 { + serial at 12000 { + clock-frequency = <166666667>; + status = "okay"; + }; + + serial at 12100 { + clock-frequency = <166666667>; + status = "okay"; + }; + }; +};
arch/arm/boot/dts/kirkwood-dns325.dts new file +24 -0
@@ -0,0 +1,24 @@ +/dts-v1/; + +/include/ "kirkwood.dtsi" + +/ { + model = "D-Link DNS-325 NAS (Rev A1)"; + compatible = "dlink,dns-325-a1", "dlink,dns-325", "dlink,dns-kirkwood", "mrvl,kirkwood-88f6281", "mrvl,kirkwood"; + + memory { + device_type = "memory"; + reg = <0x00000000 0x10000000>; + }; + + chosen { + bootargs = "console=ttyS0,115200n8 earlyprintk"; + }; + + ocp at f1000000 { + serial at 12000 { + clock-frequency = <200000000>; + status = "okay"; + }; + }; +};
arch/arm/mach-kirkwood/Kconfig +8 -0
@@ -58,6 +58,14 @@ config MACH_DREAMPLUG_DT Say 'Y' here if you want your kernel to support the Marvell DreamPlug (Flattened Device Tree). +config MACH_DLINK_KIRKWOOD_DT + bool "D-Link Kirkwood-based NAS (Flattened Device Tree)" + select ARCH_KIRKWOOD_DT + help + Say 'Y' here if you want your kernel to support the + Kirkwood-based D-Link NASes such as DNS-320 & DNS-325, + using Flattened Device Tree. + config MACH_TS219 bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS" help
arch/arm/mach-kirkwood/Makefile +1 -0
@@ -22,3 +22,4 @@ obj-$(CONFIG_MACH_T5325) += t5325-setup.o obj-$(CONFIG_CPU_IDLE) += cpuidle.o obj-$(CONFIG_ARCH_KIRKWOOD_DT) += board-dt.o obj-$(CONFIG_MACH_DREAMPLUG_DT) += board-dreamplug.o +obj-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += board-dnskw.o
arch/arm/mach-kirkwood/Makefile.boot +2 -0
@@ -3,3 +3,5 @@ params_phys-y := 0x00000100 initrd_phys-y := 0x00800000 dtb-$(CONFIG_MACH_DREAMPLUG_DT) += kirkwood-dreamplug.dtb +dtb-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += kirkwood-dns320.dtb +dtb-$(CONFIG_MACH_DLINK_KIRKWOOD_DT) += kirkwood-dns325.dtb
arch/arm/mach-kirkwood/board-dnskw.c new file +275 -0
275 lines not on this page · raw message
arch/arm/mach-kirkwood/board-dt.c +5 -0
@@ -55,11 +55,16 @@ static void __init kirkwood_dt_init(void)if (of_machine_is_compatible ("globalscale,dreamplug" ))dreamplug_init (); +if (of_machine_is_compatible ("dlink,dns-kirkwood" )) +dnskw_init (); +of_platform_populate (NULL , kirkwood_dt_match_table,NULL ,NULL ); }static const char *kirkwood_dt_board_compat[] = {"globalscale,dreamplug" , +"dlink,dns-320" , +"dlink,dns-325" ,NULL };
arch/arm/mach-kirkwood/common.h +6 -0
@@ -58,6 +58,12 @@ void dreamplug_init(void);static inline void dreamplug_init (void ) {};#endif +#ifdef CONFIG_MACH_DLINK_KIRKWOOD_DT +void dnskw_init (void ); +#else +static inline void dnskw_init (void ) {}; +#endif +/* early init functions not converted to fdt yet */ char *kirkwood_id (void );void kirkwood_l2_init (void );
Signature · 1 line
1.7.9.1
PATCH v5 2/4 mtd: Add orion_nand devicetree bindings
In reply to Jamie LentinAllow a NAND chip using the orion_nand driver to be described using devicetree.
Changes since last submission (V4) [Addressing comments by]:-
* WARN when bank-width is out of range [Andrew Lunn]
Changes since last submission (V3):-
* Document all parameters [Grant Likely]
* Convert bank-width to be in bytes
* Add explicit defaults for cle, ale and bank-width
--- .../devicetree/bindings/mtd/orion-nand.txt | 50 ++++++++++++++++++++ drivers/mtd/nand/orion_nand.c | 45 +++++++++++++++++- 2 files changed, 93 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/mtd/orion-nand.txt
Documentation/devicetree/bindings/mtd/orion-nand.txt new file +50 -0
@@ -0,0 +1,50 @@ +NAND support for Marvell Orion SoC platforms + +Required properties: +- compatible : "mrvl,orion-nand". +- reg : Base physical address of the NAND and length of memory mapped + region + +Optional properties: +- cle : Address line number connected to CLE. Default is 0 +- ale : Address line number connected to ALE. Default is 1 +- bank-width : Width in bytes of the device. Default is 1 +- chip-delay : Chip dependent delay for transferring data from array to read + registers in usecs + +The device tree may optionally contain sub-nodes describing partitions of the +address space. See partition.txt for more detail. + +Example: + +nand at f4000000 { + #address-cells = <1>; + #size-cells = <1>; + cle = <0>; + ale = <1>; + bank-width = <1>; + chip-delay = <25>; + compatible = "mrvl,orion-nand"; + reg = <0xf4000000 0x400>; + + partition at 0 { + label = "u-boot"; + reg = <0x0000000 0x100000>; + read-only; + }; + + partition at 100000 { + label = "uImage"; + reg = <0x0100000 0x200000>; + }; + + partition at 300000 { + label = "dtb"; + reg = <0x0300000 0x100000>; + }; + + partition at 400000 { + label = "root"; + reg = <0x0400000 0x7d00000>; + }; +};
drivers/mtd/nand/orion_nand.c +43 -2
91 lines not on this page · raw message
Signature · 1 line
1.7.9.1
PATCH v5 3/4 kirkwood: Allow nand to be configured via. devicetree
In reply to Jamie LentinAdd default configuration for NAND, to be enabled in your board config. Ensure clock gating is set appropriately when the NAND is enabled.
--- arch/arm/boot/dts/kirkwood.dtsi | 15 ++++++++++++++- arch/arm/mach-kirkwood/common.c | 12 ++++++++++++ 2 files changed, 26 insertions(+), 1 deletions(-)
arch/arm/boot/dts/kirkwood.dtsi +14 -1
@@ -5,7 +5,7 @@ ocp at f1000000 { compatible = "simple-bus"; - ranges = <0 0xf1000000 0x1000000>; + ranges = <0 0xf1000000 0x4000000>; #address-cells = <1>; #size-cells = <1>;
@@ -32,5 +32,18 @@ reg = <0x10300 0x20>; interrupts = <53>; }; + + nand at 3000000 { + #address-cells = <1>; + #size-cells = <1>; + cle = <0>; + ale = <1>; + bank-width = <1>; + compatible = "mrvl,orion-nand"; + reg = <0x3000000 0x400>; + chip-delay = <25>; + /* set partition map and/or chip-delay in board dts */ + status = "disabled"; + }; }; };
arch/arm/mach-kirkwood/common.c +12 -0
@@ -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 */
Signature · 1 line
1.7.9.1
PATCH v5 4/4 ARM: kirkwood: Define DNS-320/DNS-325 NAND in fdt
In reply to Jamie LentinUse devicetree to define NAND partitions. Use D-link partition scheme by default, to be vaguely compatible with their userland.
Changes since last submission (V4):-
* Don't add NAND support then throw it away immediately after [Grant Likely]
--- arch/arm/boot/dts/kirkwood-dns320.dts | 35 +++++++++++++++++++++++++++++++++ arch/arm/boot/dts/kirkwood-dns325.dts | 35 +++++++++++++++++++++++++++++++++ 2 files changed, 70 insertions(+), 0 deletions(-)
arch/arm/boot/dts/kirkwood-dns320.dts +35 -0
@@ -25,5 +25,40 @@ clock-frequency = <166666667>; status = "okay"; }; + + nand at 3000000 { + status = "okay"; + + partition at 0 { + label = "u-boot"; + reg = <0x0000000 0x100000>; + read-only; + }; + + partition at 100000 { + label = "uImage"; + reg = <0x0100000 0x500000>; + }; + + partition at 600000 { + label = "ramdisk"; + reg = <0x0600000 0x500000>; + }; + + partition at b00000 { + label = "image"; + reg = <0x0b00000 0x6600000>; + }; + + partition at 7100000 { + label = "mini firmware"; + reg = <0x7100000 0xa00000>; + }; + + partition at 7b00000 { + label = "config"; + reg = <0x7b00000 0x500000>; + }; + }; }; };
arch/arm/boot/dts/kirkwood-dns325.dts +35 -0
@@ -20,5 +20,40 @@ clock-frequency = <200000000>; status = "okay"; }; + + nand at 3000000 { + status = "okay"; + + partition at 0 { + label = "u-boot"; + reg = <0x0000000 0x100000>; + read-only; + }; + + partition at 100000 { + label = "uImage"; + reg = <0x0100000 0x500000>; + }; + + partition at 600000 { + label = "ramdisk"; + reg = <0x0600000 0x500000>; + }; + + partition at b00000 { + label = "image"; + reg = <0x0b00000 0x6600000>; + }; + + partition at 7100000 { + label = "mini firmware"; + reg = <0x7100000 0xa00000>; + }; + + partition at 7b00000 { + label = "config"; + reg = <0x7b00000 0x500000>; + }; + }; }; };
Signature · 1 line
1.7.9.1
v5 cover ARM: Kirkwood: Add support for DNS-320 and DNS-325 using devicetree
In reply to Jamie LentinQuoted 3 lines · Jamie Lentin
Reworked patch for latest feedback. I'm still basing this on Jason Cooper's tree, given how much time has passed should I be rebasing against something else or is this still fine?
Typically, work should be based against a stable tag. In this case, the changes in my branch were merged in for 3.4-rc1, so you could base from there.
It's fine the way it is, I'll let you know if I run into any problems.
Quoted 4 lines
One thing I noticed is that with only the first patch applied (which no longer calls
kirkwood_nand_init) the device either locks up or serial console dies at "Gating clock of unused units", presumably asCGC_RUNITisn't set. Is this something known or is it worth further investigation?
That could potentially mess up a future bisect. However, it would only crop up for dnskw boards. I'll let Grant weigh in on this since he's the one who asked that the nand init be removed.
thx,
Jason.
v5 cover ARM: Kirkwood: Add support for DNS-320 and DNS-325 using devicetree
Quoted 6 lines
Quoted 2 lines
dies at "Gating clock of unused units", presumably as
CGC_RUNITisn't set. Is this something known or is it worth further investigation?That could potentially mess up a future bisect. However, it would only crop up for dnskw boards. I'll let Grant weigh in on this since he's the one who asked that the nand init be removed.
Turning off RUNIT is bad. Both the NAND and SPI controllers use this clock. You can only safely turn it off if none of these are active.
Andrew
v5 cover ARM: Kirkwood: Add support for DNS-320 and DNS-325 using devicetree
Quoted 9 lines · Andrew Lunn
Quoted 6 lines
Quoted 2 lines
dies at "Gating clock of unused units", presumably as
CGC_RUNITisn't set. Is this something known or is it worth further investigation?That could potentially mess up a future bisect. However, it would only crop up for dnskw boards. I'll let Grant weigh in on this since he's the one who asked that the nand init be removed.
Turning off RUNIT is bad. Both the NAND and SPI controllers use this clock. You can only safely turn it off if none of these are active.
Jamie,
If we hear no objections, call kirkwood_nand_init() with no partition entries, then put the partition entries in the commandline in the dts. This is what Arnaud Patard is doing with the Iomega iConnect:
mtdparts=orion_nand:0xc0000 at 0x0(uboot),0x20000 at 0xa0000(env),0x300000 at 0x100000(zImage),0x300000 at 0x540000(initrd)...
Then, in the last patch remove the mtdparts from the commandline in the dts and add the partition entries appropriately.
thx,
Jason.
v5 cover ARM: Kirkwood: Add support for DNS-320 and DNS-325 using devicetree
Quoted 5 lines · Jason Cooper
Quoted 4 lines · Andrew Lunn
Quoted 1 line
Quoted 1 line
dies at "Gating clock of unused units", presumably as
CGC_RUNITisn't set.
Quoted 2 lines
Quoted 1 line
Is this something known or is it worth further investigation?
Quoted 7 lines
Quoted 7 lines
Quoted 1 line
That could potentially mess up a future bisect. However, it would
only
Quoted 2 lines
crop up for dnskw boards. I'll let Grant weigh in on this since he's the one who asked that the nand init be removed.
Turning off RUNIT is bad. Both the NAND and SPI controllers use this clock. You can only safely turn it off if none of these are active.
So would u-boot using the NAND count as the controller being active in this case?
Quoted 8 lines
If we hear no objections, call
kirkwood_nand_init()with no partition entries, then put the partition entries in the commandline in the dts. This is what Arnaud Patard is doing with the Iomega iConnect:mtdparts=orion_nand:0xc0000 at 0x0(uboot),0x20000 at 0xa0000(env),0x300000 at 0x100000(zImage),0x300000 at 0x540000(initrd)...
Then, in the last patch remove the mtdparts from the commandline in the dts and add the partition entries appropriately.
Certainly can do, although I'm not entirely convinced it addresses Grant's comment. Another option would be to change the patch order and add DNS-320 support after all NAND support patches are merged, although that would go against the initial advice of how to layout the patchset. Will do whatever is considered best though.
Quoted 4 lines
thx,
Jason.
Signature · 1 line
Jamie Lentin