Add support for DNS-320 and DNS-325 using devicetree
Subsystems (6)
v3 cover Add support for DNS-320 and DNS-325 using devicetree
Thanks again to Arnd, Jason & Scott. The differences here are fairly minor. Apart from documentation, I'm guessing that the changes aren't significant enough to revoke Acked-by, please flame me if I'm wrong!
Changes since v2:
* 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:
* 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 (5):
ARM: kirkwood: Basic support for DNS-320 and DNS-325
mtd: Add orion_nand devicetree bindings
ARM: kirkwood: Allow nand to be configured via. devicetree
ARM: kirkwood: Define DNS-320/DNS-325 NAND in fdt
mtd: Move fdt partition documentation to a seperate file
.../devicetree/bindings/mtd/arm-versatile.txt | 4 +- .../devicetree/bindings/mtd/atmel-dataflash.txt | 3 + .../devicetree/bindings/mtd/fsl-upm-nand.txt | 4 + .../devicetree/bindings/mtd/gpio-control-nand.txt | 3 + .../devicetree/bindings/mtd/mtd-physmap.txt | 23 +-- .../devicetree/bindings/mtd/orion-nand.txt | 49 ++++ .../devicetree/bindings/mtd/partition.txt | 38 +++ 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 | 23 ++ 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 | 35 +++- 18 files changed, 595 insertions(+), 26 deletions(-) create mode 100644 Documentation/devicetree/bindings/mtd/orion-nand.txt create mode 100644 Documentation/devicetree/bindings/mtd/partition.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 v3 1/5 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.
Use IEEE-compliant "okay", rather than "ok"
--- arch/arm/boot/dts/kirkwood-dns320.dts | 29 +++ arch/arm/boot/dts/kirkwood-dns325.dts | 24 +++ arch/arm/mach-kirkwood/Kconfig | 23 +++ arch/arm/mach-kirkwood/Makefile | 1 + arch/arm/mach-kirkwood/Makefile.boot | 2 + arch/arm/mach-kirkwood/board-dnskw.c | 306 +++++++++++++++++++++++++++++++++ arch/arm/mach-kirkwood/board-dt.c | 5 + arch/arm/mach-kirkwood/common.h | 6 + 8 files changed, 396 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 +23 -0
@@ -58,6 +58,29 @@ config MACH_DREAMPLUG_DT Say 'Y' here if you want your kernel to support the Marvell DreamPlug (Flattened Device Tree). +config MACH_DNSKW_DT + bool + +config MACH_DNS320_DT + bool "D-Link DNS-320 (Flattened Device Tree)" + select ARCH_KIRKWOOD_DT + select MACH_DNSKW_DT + select CONFIG_MTD_OF_PARTS + select CONFIG_SERIAL_OF_PLATFORM + help + Say 'Y' here if you want your kernel to support the + D-Link DNS-320 NAS, using Flattened Device Tree. + +config MACH_DNS325_DT + bool "D-Link DNS-325 (Flattened Device Tree)" + select ARCH_KIRKWOOD_DT + select MACH_DNSKW_DT + select CONFIG_MTD_OF_PARTS + select CONFIG_SERIAL_OF_PLATFORM + help + Say 'Y' here if you want your kernel to support the + D-Link DNS-325 NAS, 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_DNSKW_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_DNS320_DT) += kirkwood-dns320.dtb +dtb-$(CONFIG_MACH_DNS325_DT) += kirkwood-dns325.dtb
arch/arm/mach-kirkwood/board-dnskw.c new file +306 -0
306 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_DNSKW_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 v3 1/5 ARM: kirkwood: Basic support for DNS-320 and DNS-325
Quoted 9 lines · Jamie Lentin
Add support for the DNS-320 and DNS-325. Describe as much as currently possible in the devicetree files, create a
board-dnskw.cfor everything else.Use IEEE-compliant "okay", rather than "ok"
Acked-by Arnd Bergmann <[email protected]>Acked-by Jason Cooper <[email protected]>Signed-off-by Jamie Lentin <[email protected]>---
One small note about changeset comments: The part about differences from the previous version of the same patch normally goes below the '---' line, in front of the diffstat, to prevent it from going into the git changelog. Otherwise people will have no idea what it's about.
Arnd
PATCH v3 1/5 ARM: kirkwood: Basic support for DNS-320 and DNS-325
Quoted 11 lines · Arnd Bergmann
Quoted 9 lines · Jamie Lentin
Add support for the DNS-320 and DNS-325. Describe as much as currently possible in the devicetree files, create a
board-dnskw.cfor everything else.Use IEEE-compliant "okay", rather than "ok"
Acked-by Arnd Bergmann <[email protected]>Acked-by Jason Cooper <[email protected]>Signed-off-by Jamie Lentin <[email protected]>---
Quoted 4 lines
One small note about changeset comments: The part about differences from the previous version of the same patch normally goes below the '---' line, in front of the diffstat, to prevent it from going into the git changelog. Otherwise people will have no idea what it's about.
Counter point on that. I ask submitters to put the changelog before the --- because I want it in the commit text. It is actually helpful when trying to determine exactly which iteration of a patch series got committed.
But, different maintainers have different policies so there really isn't much submitters can do here except ask the maintainer they are submitting to which approach they prefer.
g.
Signature · 2 lines
Grant Likely, B.Sc, P.Eng. Secret Lab Technologies,Ltd.
PATCH v3 1/5 ARM: kirkwood: Basic support for DNS-320 and DNS-325
Quoted 17 lines · Grant Likely
Quoted 11 lines · Arnd Bergmann
Quoted 9 lines · Jamie Lentin
Add support for the DNS-320 and DNS-325. Describe as much as currently possible in the devicetree files, create a
board-dnskw.cfor everything else.Use IEEE-compliant "okay", rather than "ok"
Acked-by Arnd Bergmann <[email protected]>Acked-by Jason Cooper <[email protected]>Signed-off-by Jamie Lentin <[email protected]>---
Quoted 4 lines
One small note about changeset comments: The part about differences from the previous version of the same patch normally goes below the '---' line, in front of the diffstat, to prevent it from going into the git changelog. Otherwise people will have no idea what it's about.
Quoted 4 lines
Counter point on that. I ask submitters to put the changelog before the --- because I want it in the commit text. It is actually helpful when trying to determine exactly which iteration of a patch series got committed.
Fair enough, but I think in this case it was written in a confusing way. I don't mind if a list of review comments are included and more text is usally better in the changeset comment, but it would be nice to give some background, either by prefixing it with something "Addressed review comments from xxx:" or changing it to 'This version uses the IEEE-compliant "okay", rather than "ok"'.
Arnd
PATCH v3 1/5 ARM: kirkwood: Basic support for DNS-320 and DNS-325
Quoted 23 lines · Arnd Bergmann
Quoted 17 lines · Grant Likely
Quoted 11 lines · Arnd Bergmann
Quoted 9 lines · Jamie Lentin
Add support for the DNS-320 and DNS-325. Describe as much as currently possible in the devicetree files, create a
board-dnskw.cfor everything else.Use IEEE-compliant "okay", rather than "ok"
Acked-by Arnd Bergmann <[email protected]>Acked-by Jason Cooper <[email protected]>Signed-off-by Jamie Lentin <[email protected]>---
Quoted 4 lines
One small note about changeset comments: The part about differences from the previous version of the same patch normally goes below the '---' line, in front of the diffstat, to prevent it from going into the git changelog. Otherwise people will have no idea what it's about.
Quoted 4 lines
Counter point on that. I ask submitters to put the changelog before the --- because I want it in the commit text. It is actually helpful when trying to determine exactly which iteration of a patch series got committed.
Quoted 6 lines
Fair enough, but I think in this case it was written in a confusing way. I don't mind if a list of review comments are included and more text is usally better in the changeset comment, but it would be nice to give some background, either by prefixing it with something "Addressed review comments from xxx:" or changing it to 'This version uses the IEEE-compliant "okay", rather than "ok"'.
Re-reading, it really isn't obvious I meant "Use IEEE-compliant..." as a changelog of sorts. Maybe this would have been a better commit message?
---------
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 (V2):-
* Use IEEE-compliant "okay", rather than "ok" (adressing comments from Scott Wood)
---------
Quoted 2 lines
Arnd
Signature · 1 line
Jamie Lentin
PATCH v3 1/5 ARM: kirkwood: Basic support for DNS-320 and DNS-325
Quoted 9 lines · Jamie Lentin
Add support for the DNS-320 and DNS-325. Describe as much as currently possible in the devicetree files, create a
board-dnskw.cfor everything else.Changes since last submission (V2):-
* Use IEEE-compliant "okay", rather than "ok" (adressing comments from Scott Wood)
Looks great, yes.
Arnd
PATCH v3 1/5 ARM: kirkwood: Basic support for DNS-320 and DNS-325
In reply to Jamie LentinQuoted 8 lines · Jamie Lentin
Add support for the DNS-320 and DNS-325. Describe as much as currently possible in the devicetree files, create a
board-dnskw.cfor everything else.Use IEEE-compliant "okay", rather than "ok"
Acked-by Arnd Bergmann <[email protected]>Acked-by Jason Cooper <[email protected]>Signed-off-by Jamie Lentin <[email protected]>
Quoted 13 lines
--- arch/arm/boot/dts/kirkwood-dns320.dts | 29 +++ arch/arm/boot/dts/kirkwood-dns325.dts | 24 +++ arch/arm/mach-kirkwood/Kconfig | 23 +++ arch/arm/mach-kirkwood/Makefile | 1 + arch/arm/mach-kirkwood/Makefile.boot | 2 + arch/arm/mach-kirkwood/board-dnskw.c | 306 +++++++++++++++++++++++++++++++++ arch/arm/mach-kirkwood/board-dt.c | 5 + arch/arm/mach-kirkwood/common.h | 6 + 8 files changed, 396 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
Jamie,
I've applied this locally, thanks. Looks like Grant took #5 through his tree. As #3 and #4 depend on #2, I'll wait for the next version of #2 incorporating Grant's comments before I apply #2-#4.
thx,
Jason.
PATCH v3 1/5 ARM: kirkwood: Basic support for DNS-320 and DNS-325
In reply to Jamie LentinQuoted 94 lines · Jamie Lentin
Add support for the DNS-320 and DNS-325. Describe as much as currently possible in the devicetree files, create a
board-dnskw.cfor everything else.Use IEEE-compliant "okay", rather than "ok"
Acked-by Arnd Bergmann <[email protected]>Acked-by Jason Cooper <[email protected]>Signed-off-by Jamie Lentin <[email protected]>--- arch/arm/boot/dts/kirkwood-dns320.dts | 29 +++ arch/arm/boot/dts/kirkwood-dns325.dts | 24 +++ arch/arm/mach-kirkwood/Kconfig | 23 +++ arch/arm/mach-kirkwood/Makefile | 1 + arch/arm/mach-kirkwood/Makefile.boot | 2 + arch/arm/mach-kirkwood/board-dnskw.c | 306 +++++++++++++++++++++++++++++++++ arch/arm/mach-kirkwood/board-dt.c | 5 + arch/arm/mach-kirkwood/common.h | 6 + 8 files changed, 396 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.carch/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 +0
-0@@ -58,6 +58,29 @@ config MACH_DREAMPLUG_DT Say 'Y' here if you want your kernel to support the Marvell DreamPlug (Flattened Device Tree).
arch/arm/mach-kirkwood/Kconfig config MACH_DREAMPLUG_DT · line 69
Quoted 10 lines
arch/arm/mach-kirkwood/Kconfig +9
-0+config MACH_DNSKW_DT + bool + +config MACH_DNS320_DT + bool "D-Link DNS-320 (Flattened Device Tree)" + select ARCH_KIRKWOOD_DT + select MACH_DNSKW_DT + select CONFIG_MTD_OF_PARTS + select CONFIG_SERIAL_OF_PLATFORM
These two lines are dangerous. It is not safe to 'select' Kconfig symbols that have 'depends' constraints. Otherwise, the symbol will get forced on without it's dependencies.
Typically other code handles this by creating blank "HAVE_*" symbols that the needed symbol can do something like "default y if HAVE_*"
Quoted 4 lines
arch/arm/mach-kirkwood/Kconfig +4
-0+ help + Say 'Y' here if you want your kernel to support the + D-Link DNS-320 NAS, using Flattened Device Tree. +
arch/arm/mach-kirkwood/Kconfig config MACH_DREAMPLUG_DT · line 83
Quoted 10 lines
arch/arm/mach-kirkwood/Kconfig +10
-0+config MACH_DNS325_DT + bool "D-Link DNS-325 (Flattened Device Tree)" + select ARCH_KIRKWOOD_DT + select MACH_DNSKW_DT + select CONFIG_MTD_OF_PARTS + select CONFIG_SERIAL_OF_PLATFORM + help + Say 'Y' here if you want your kernel to support the + D-Link DNS-325 NAS, using Flattened Device Tree. +
The *only* difference between these two configs is the .dtb file that gets built. Don't create a separate Kconfig entry for each dnskw board. Just build all the dnskw dtb files when MACH_DNSKW_DT is selected. Building .dtb files is cheap.
Quoted 80 lines
arch/arm/mach-kirkwood/Kconfig +0
-0config MACH_TS219 bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS" helparch/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_DNSKW_DT) += board-dnskw.oarch/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_DNS320_DT) += kirkwood-dns320.dtb +dtb-$(CONFIG_MACH_DNS325_DT) += kirkwood-dns325.dtbarch/arm/mach-kirkwood/board-dnskw.c new file +52
-0@@ -0,0 +1,306 @@ +/* +* Copyright 2012 (C), Jamie Lentin <[email protected]> +* +* arch/arm/mach-kirkwood/board-dnskw.c +* +* D-link DNS-320 & DNS-325 NAS Init for drivers not converted to +* flattened device tree yet. +* +* 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 <linux/kernel.h> +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/i2c.h> +#include <linux/ata_platform.h> +#include <linux/mv643xx_eth.h> +#include <linux/of.h> +#include <linux/gpio.h> +#include <linux/input.h> +#include <linux/gpio_keys.h> +#include <linux/gpio-fan.h> +#include <linux/leds.h> +#include <linux/mtd/physmap.h> +#include <asm/mach-types.h> +#include <asm/mach/arch.h> +#include <asm/mach/map.h> +#include <mach/kirkwood.h> +#include <mach/bridge-regs.h> +#include "common.h" +#include "mpp.h" + +static struct mtd_partition dnskw_nand_parts[] = { + { + .name ="u-boot" , + .offset =0 , + .size =SZ_1M , + .mask_flags =MTD_WRITEABLE + }, { + .name ="uImage" , + .offset =MTDPART_OFS_NXTBLK , + .size =5 *SZ_1M + }, { + .name ="ramdisk" , + .offset =MTDPART_OFS_NXTBLK , + .size =5 *SZ_1M + }, { + .name ="image" , + .offset =MTDPART_OFS_NXTBLK , + .size =102 *SZ_1M
arch/arm/mach-kirkwood/board-dnskw.c line 62
Quoted 10 lines
arch/arm/mach-kirkwood/board-dnskw.c new file +10
-0+ }, { + .name = "mini firmware", + .offset = MTDPART_OFS_NXTBLK, + .size = 10 * SZ_1M + }, { + .name = "config", + .offset = MTDPART_OFS_NXTBLK, + .size = 5 * SZ_1M + }, +};
This patch adds a static partition mapping, and then a later patch in this same series removes it again. Please don't do that. Just squash the patches together. Or, if sqashing is not appropriate, then just omit the partitions.
I also suggest omiting similar data when there are patches already in progess to do it properly. It is okay for the inital support to go in to be incomplete when enhancements will be ready soon.
g.
Quoted 290 lines
arch/arm/mach-kirkwood/board-dnskw.c new file +244
-0+ +static struct mv643xx_eth_platform_data dnskw_ge00_data = { + .phy_addr =MV643XX_ETH_PHY_ADDR (8 ), +}; + +static struct mv_sata_platform_data dnskw_sata_data = { + .n_ports =2 , +}; + +static unsigned int dnskw_mpp_config[]__initdata = { +MPP13_UART1_TXD ,/* Custom ... */ +MPP14_UART1_RXD ,/* ... Controller (DNS-320 only) */ + MPP20_SATA1_ACTn,/* LED: White Right HDD */ + MPP21_SATA0_ACTn,/* LED: White Left HDD */ +MPP24_GPIO , +MPP25_GPIO , +MPP26_GPIO ,/* LED: Power */ +MPP27_GPIO ,/* LED: Red Right HDD */ +MPP28_GPIO ,/* LED: Red Left HDD */ +MPP29_GPIO ,/* LED: Red USB (DNS-325 only) */ +MPP30_GPIO , +MPP31_GPIO , +MPP32_GPIO , +MPP33_GPO , +MPP34_GPIO ,/* Button: Front power */ +MPP35_GPIO ,/* LED: Red USB (DNS-320 only) */ +MPP36_GPIO ,/* Power: Turn off board */ +MPP37_GPIO ,/* Power: Turn back on after power failure */ +MPP38_GPIO , +MPP39_GPIO ,/* Power: SATA0 */ +MPP40_GPIO ,/* Power: SATA1 */ +MPP41_GPIO , +MPP42_GPIO , +MPP43_GPIO ,/* LED: White USB */ +MPP44_GPIO ,/* Fan: Tachometer Pin */ +MPP45_GPIO ,/* Fan: high speed */ +MPP46_GPIO ,/* Fan: low speed */ +MPP47_GPIO ,/* Button: Back unmount */ +MPP48_GPIO ,/* Button: Back reset */ +MPP49_GPIO ,/* Pin of unused U5 (DNS-320 only) */ +0 +}; + +static struct gpio_led dns325_led_pins[] = { + { + .name ="dns325:white:power" , + .gpio =26 , + .active_low =1 , + .default_trigger ="default-on" , + }, + { + .name ="dns325:white:usb" , + .gpio =43 , + .active_low =1 , + }, + { + .name ="dns325:red:l_hdd" , + .gpio =28 , + .active_low =1 , + }, + { + .name ="dns325:red:r_hdd" , + .gpio =27 , + .active_low =1 , + }, + { + .name ="dns325:red:usb" , + .gpio =29 , + .active_low =1 , + }, +}; + +static struct gpio_led_platform_data dns325_led_data = { + .num_leds =ARRAY_SIZE (dns325_led_pins), + .leds = dns325_led_pins, +}; + +static struct platform_device dns325_led_device = { + .name ="leds-gpio" , + .id =-1 , + .dev = { + .platform_data = &dns325_led_data, + }, +}; + +static struct gpio_led dns320_led_pins[] = { + { + .name ="dns320:blue:power" , + .gpio =26 , + .active_low =1 , + .default_trigger ="default-on" , + }, + { + .name ="dns320:blue:usb" , + .gpio =43 , + .active_low =1 , + }, + { + .name ="dns320:orange:l_hdd" , + .gpio =28 , + .active_low =1 , + }, + { + .name ="dns320:orange:r_hdd" , + .gpio =27 , + .active_low =1 , + }, + { + .name ="dns320:orange:usb" , + .gpio =35 , + .active_low =1 , + }, +}; + +static struct gpio_led_platform_data dns320_led_data = { + .num_leds =ARRAY_SIZE (dns320_led_pins), + .leds = dns320_led_pins, +}; + +static struct platform_device dns320_led_device = { + .name ="leds-gpio" , + .id =-1 , + .dev = { + .platform_data = &dns320_led_data, + }, +}; + +static struct i2c_board_info dns325_i2c_board_info[]__initdata = { + { +I2C_BOARD_INFO ("lm75" ,0x48 ), + }, +/* Something at 0x0c also */ +}; + +static struct gpio_keys_button dnskw_button_pins[] = { + { + .code =KEY_POWER , + .gpio =34 , + .desc ="Power button" , + .active_low =1 , + }, + { + .code =KEY_EJECTCD , + .gpio =47 , + .desc ="USB unmount button" , + .active_low =1 , + }, + { + .code =KEY_RESTART , + .gpio =48 , + .desc ="Reset button" , + .active_low =1 , + }, +}; + +static struct gpio_keys_platform_data dnskw_button_data = { + .buttons = dnskw_button_pins, + .nbuttons =ARRAY_SIZE (dnskw_button_pins), +}; + +static struct platform_device dnskw_button_device = { + .name ="gpio-keys" , + .id =-1 , + .num_resources =0 , + .dev = { + .platform_data = &dnskw_button_data, + } +}; + +/* Fan: ADDA AD045HB-G73 40mm 6000rpm at 5v */ +static struct gpio_fan_speed dnskw_fan_speed[] = { + {0 ,0 }, + {3000 ,1 }, + {6000 ,2 }, +}; +static unsigned dnskw_fan_pins[] = {46 ,45 }; + +static struct gpio_fan_platform_data dnskw_fan_data = { + .num_ctrl =ARRAY_SIZE (dnskw_fan_pins), + .ctrl = dnskw_fan_pins, + .num_speed =ARRAY_SIZE (dnskw_fan_speed), + .speed = dnskw_fan_speed, +}; + +static struct platform_device dnskw_fan_device = { + .name ="gpio-fan" , + .id =-1 , + .dev = { + .platform_data = &dnskw_fan_data, + }, +}; + +static void dnskw_power_off (void ) +{ +gpio_set_value (36 ,1 ); +} + +/* Register any GPIO for output and set the value */ +static void __init dnskw_gpio_register (unsigned gpio,char *name,int def) +{ +if (gpio_request (gpio, name) ==0 && +gpio_direction_output (gpio,0 ) ==0 ) { +gpio_set_value (gpio, def); +if (gpio_export (gpio,0 ) !=0 ) +pr_err ("dnskw: Failed to export GPIO %s\n" , name); + }else +pr_err ("dnskw: Failed to register %s\n" , name); +} + +void __init dnskw_init (void ) +{ +kirkwood_mpp_conf (dnskw_mpp_config); +kirkwood_nand_init (ARRAY_AND_SIZE (dnskw_nand_parts),25 ); + +kirkwood_ehci_init (); +kirkwood_ge00_init (&dnskw_ge00_data); +kirkwood_sata_init (&dnskw_sata_data); +kirkwood_i2c_init (); + +platform_device_register (&dnskw_button_device); +platform_device_register (&dnskw_fan_device); + +if (of_machine_is_compatible ("dlink,dns-325" )) { +i2c_register_board_info (0 , dns325_i2c_board_info, +ARRAY_SIZE (dns325_i2c_board_info)); +platform_device_register (&dns325_led_device); + + }else if (of_machine_is_compatible ("dlink,dns-320" )) +platform_device_register (&dns320_led_device); + +/* Register power-off GPIO. */ +if (gpio_request (36 ,"dnskw:power:off" ) ==0 + &&gpio_direction_output (36 ,0 ) ==0 ) + pm_power_off = dnskw_power_off; +else +pr_err ("dnskw: failed to configure power-off GPIO\n" ); + +/* Ensure power is supplied to both HDDs */ +dnskw_gpio_register (39 ,"dnskw:power:sata0" ,1 ); +dnskw_gpio_register (40 ,"dnskw:power:sata1" ,1 ); + +/* Set NAS to turn back on after a power failure */ +dnskw_gpio_register (37 ,"dnskw:power:recover" ,1 ); +}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_DNSKW_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 · 7 lines
1.7.9.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel at lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 2 lines
Grant Likely, B.Sc, P.Eng. Secret Lab Technologies,Ltd.
PATCH v3 1/5 ARM: kirkwood: Basic support for DNS-320 and DNS-325
Quoted 110 lines · Grant Likely
Quoted 94 lines · Jamie Lentin
Add support for the DNS-320 and DNS-325. Describe as much as currently possible in the devicetree files, create a
board-dnskw.cfor everything else.Use IEEE-compliant "okay", rather than "ok"
Acked-by Arnd Bergmann <[email protected]>Acked-by Jason Cooper <[email protected]>Signed-off-by Jamie Lentin <[email protected]>--- arch/arm/boot/dts/kirkwood-dns320.dts | 29 +++ arch/arm/boot/dts/kirkwood-dns325.dts | 24 +++ arch/arm/mach-kirkwood/Kconfig | 23 +++ arch/arm/mach-kirkwood/Makefile | 1 + arch/arm/mach-kirkwood/Makefile.boot | 2 + arch/arm/mach-kirkwood/board-dnskw.c | 306 +++++++++++++++++++++++++++++++++ arch/arm/mach-kirkwood/board-dt.c | 5 + arch/arm/mach-kirkwood/common.h | 6 + 8 files changed, 396 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.carch/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 +0
-0@@ -58,6 +58,29 @@ config MACH_DREAMPLUG_DT Say 'Y' here if you want your kernel to support the Marvell DreamPlug (Flattened Device Tree).arch/arm/mach-kirkwood/Kconfig config MACH_DREAMPLUG_DT · line 69
Quoted 10 lines
arch/arm/mach-kirkwood/Kconfig +9
-0+config MACH_DNSKW_DT + bool + +config MACH_DNS320_DT + bool "D-Link DNS-320 (Flattened Device Tree)" + select ARCH_KIRKWOOD_DT + select MACH_DNSKW_DT + select CONFIG_MTD_OF_PARTS + select CONFIG_SERIAL_OF_PLATFORMThese two lines are dangerous. It is not safe to 'select'
Kconfigsymbols that have 'depends' constraints. Otherwise, the symbol will get forced on without it's dependencies.
Quoted 3 lines
Typically other code handles this by creating blank "HAVE_*" symbols that the needed symbol can do something like "default y if HAVE_*"
Okay I didn't realise this, thanks. The options in question aren't hard dependencies per-se, but no serial or NAND support is probably a mistake, so added them here to avoid a certain amount of shooting in foot.
What's the etiquette in this situation? Adding HAVE_* seems excessive, would selecting them in kirkwood_defconfig make more sense? Or would it simply be covered by having a reasonable config on my website or suchlike?
Jason, given you've already applied this patch, would you rather me submit something else to ditch these, or resumbit the entire series, combining feedback?
Quoted 11 lines
Quoted 11 lines
arch/arm/mach-kirkwood/Kconfig +11
-0+ help + Say 'Y' here if you want your kernel to support the + D-Link DNS-320 NAS, using Flattened Device Tree. + +config MACH_DNS325_DT + bool "D-Link DNS-325 (Flattened Device Tree)" + select ARCH_KIRKWOOD_DT + select MACH_DNSKW_DT + select CONFIG_MTD_OF_PARTS + select CONFIG_SERIAL_OF_PLATFORM + help
Quoted 9 lines
arch/arm/mach-kirkwood/Kconfig config MACH_DREAMPLUG_DT · line 83
Quoted 3 lines
arch/arm/mach-kirkwood/Kconfig +3
-0+ Say 'Y' here if you want your kernel to support the + D-Link DNS-325 NAS, using Flattened Device Tree. +The *only* difference between these two configs is the .dtb file that gets built. Don't create a separate
Kconfigentry for each dnskw board. Just build all the dnskw dtb files whenMACH_DNSKW_DTis selected. Building .dtb files is cheap.
The rationale for this is the code in dnskw.c is (hopefully!) temporary, and when it goes there isn't any need for MACH_DNSKW_DT either.
In a future land where everything has been converted to devicetree, what would be best? An option to "Build all kirkwood-based .dtb's", an option to build all D-link .dtb's, Q-QNAP .dtb's, etc. or an option for each board? I've not got any strong opinion, so will reformat the above to whatever is considered best.
Quoted 96 lines
Quoted 80 lines
arch/arm/mach-kirkwood/Kconfig +0
-0config MACH_TS219 bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS" helparch/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_DNSKW_DT) += board-dnskw.oarch/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_DNS320_DT) += kirkwood-dns320.dtb +dtb-$(CONFIG_MACH_DNS325_DT) += kirkwood-dns325.dtbarch/arm/mach-kirkwood/board-dnskw.c new file +52
-0@@ -0,0 +1,306 @@ +/* +* Copyright 2012 (C), Jamie Lentin <[email protected]> +* +* arch/arm/mach-kirkwood/board-dnskw.c +* +* D-link DNS-320 & DNS-325 NAS Init for drivers not converted to +* flattened device tree yet. +* +* 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 <linux/kernel.h> +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/i2c.h> +#include <linux/ata_platform.h> +#include <linux/mv643xx_eth.h> +#include <linux/of.h> +#include <linux/gpio.h> +#include <linux/input.h> +#include <linux/gpio_keys.h> +#include <linux/gpio-fan.h> +#include <linux/leds.h> +#include <linux/mtd/physmap.h> +#include <asm/mach-types.h> +#include <asm/mach/arch.h> +#include <asm/mach/map.h> +#include <mach/kirkwood.h> +#include <mach/bridge-regs.h> +#include "common.h" +#include "mpp.h" + +static struct mtd_partition dnskw_nand_parts[] = { + { + .name ="u-boot" , + .offset =0 , + .size =SZ_1M , + .mask_flags =MTD_WRITEABLE + }, { + .name ="uImage" , + .offset =MTDPART_OFS_NXTBLK , + .size =5 *SZ_1M + }, { + .name ="ramdisk" , + .offset =MTDPART_OFS_NXTBLK , + .size =5 *SZ_1M + }, { + .name ="image" , + .offset =MTDPART_OFS_NXTBLK , + .size =102 *SZ_1M arch/arm/mach-kirkwood/board-dnskw.c line 62
Quoted 10 lines
arch/arm/mach-kirkwood/board-dnskw.c new file +10
-0+ }, { + .name = "mini firmware", + .offset = MTDPART_OFS_NXTBLK, + .size = 10 * SZ_1M + }, { + .name = "config", + .offset = MTDPART_OFS_NXTBLK, + .size = 5 * SZ_1M + }, +};This patch adds a static partition mapping, and then a later patch in this same series removes it again. Please don't do that. Just squash the patches together. Or, if sqashing is not appropriate, then just omit the partitions.
Quoted 4 lines
I also suggest omiting similar data when there are patches already in progess to do it properly. It is okay for the inital support to go in to be incomplete when enhancements will be ready soon.
Noted. If the entire patchset needs resubmitting, I'll combine the patch that moves this definition to the .dtb
Quoted 294 lines
g.
Quoted 290 lines
arch/arm/mach-kirkwood/board-dnskw.c new file +244
-0+ +static struct mv643xx_eth_platform_data dnskw_ge00_data = { + .phy_addr =MV643XX_ETH_PHY_ADDR (8 ), +}; + +static struct mv_sata_platform_data dnskw_sata_data = { + .n_ports =2 , +}; + +static unsigned int dnskw_mpp_config[]__initdata = { +MPP13_UART1_TXD ,/* Custom ... */ +MPP14_UART1_RXD ,/* ... Controller (DNS-320 only) */ + MPP20_SATA1_ACTn,/* LED: White Right HDD */ + MPP21_SATA0_ACTn,/* LED: White Left HDD */ +MPP24_GPIO , +MPP25_GPIO , +MPP26_GPIO ,/* LED: Power */ +MPP27_GPIO ,/* LED: Red Right HDD */ +MPP28_GPIO ,/* LED: Red Left HDD */ +MPP29_GPIO ,/* LED: Red USB (DNS-325 only) */ +MPP30_GPIO , +MPP31_GPIO , +MPP32_GPIO , +MPP33_GPO , +MPP34_GPIO ,/* Button: Front power */ +MPP35_GPIO ,/* LED: Red USB (DNS-320 only) */ +MPP36_GPIO ,/* Power: Turn off board */ +MPP37_GPIO ,/* Power: Turn back on after power failure */ +MPP38_GPIO , +MPP39_GPIO ,/* Power: SATA0 */ +MPP40_GPIO ,/* Power: SATA1 */ +MPP41_GPIO , +MPP42_GPIO , +MPP43_GPIO ,/* LED: White USB */ +MPP44_GPIO ,/* Fan: Tachometer Pin */ +MPP45_GPIO ,/* Fan: high speed */ +MPP46_GPIO ,/* Fan: low speed */ +MPP47_GPIO ,/* Button: Back unmount */ +MPP48_GPIO ,/* Button: Back reset */ +MPP49_GPIO ,/* Pin of unused U5 (DNS-320 only) */ +0 +}; + +static struct gpio_led dns325_led_pins[] = { + { + .name ="dns325:white:power" , + .gpio =26 , + .active_low =1 , + .default_trigger ="default-on" , + }, + { + .name ="dns325:white:usb" , + .gpio =43 , + .active_low =1 , + }, + { + .name ="dns325:red:l_hdd" , + .gpio =28 , + .active_low =1 , + }, + { + .name ="dns325:red:r_hdd" , + .gpio =27 , + .active_low =1 , + }, + { + .name ="dns325:red:usb" , + .gpio =29 , + .active_low =1 , + }, +}; + +static struct gpio_led_platform_data dns325_led_data = { + .num_leds =ARRAY_SIZE (dns325_led_pins), + .leds = dns325_led_pins, +}; + +static struct platform_device dns325_led_device = { + .name ="leds-gpio" , + .id =-1 , + .dev = { + .platform_data = &dns325_led_data, + }, +}; + +static struct gpio_led dns320_led_pins[] = { + { + .name ="dns320:blue:power" , + .gpio =26 , + .active_low =1 , + .default_trigger ="default-on" , + }, + { + .name ="dns320:blue:usb" , + .gpio =43 , + .active_low =1 , + }, + { + .name ="dns320:orange:l_hdd" , + .gpio =28 , + .active_low =1 , + }, + { + .name ="dns320:orange:r_hdd" , + .gpio =27 , + .active_low =1 , + }, + { + .name ="dns320:orange:usb" , + .gpio =35 , + .active_low =1 , + }, +}; + +static struct gpio_led_platform_data dns320_led_data = { + .num_leds =ARRAY_SIZE (dns320_led_pins), + .leds = dns320_led_pins, +}; + +static struct platform_device dns320_led_device = { + .name ="leds-gpio" , + .id =-1 , + .dev = { + .platform_data = &dns320_led_data, + }, +}; + +static struct i2c_board_info dns325_i2c_board_info[]__initdata = { + { +I2C_BOARD_INFO ("lm75" ,0x48 ), + }, +/* Something at 0x0c also */ +}; + +static struct gpio_keys_button dnskw_button_pins[] = { + { + .code =KEY_POWER , + .gpio =34 , + .desc ="Power button" , + .active_low =1 , + }, + { + .code =KEY_EJECTCD , + .gpio =47 , + .desc ="USB unmount button" , + .active_low =1 , + }, + { + .code =KEY_RESTART , + .gpio =48 , + .desc ="Reset button" , + .active_low =1 , + }, +}; + +static struct gpio_keys_platform_data dnskw_button_data = { + .buttons = dnskw_button_pins, + .nbuttons =ARRAY_SIZE (dnskw_button_pins), +}; + +static struct platform_device dnskw_button_device = { + .name ="gpio-keys" , + .id =-1 , + .num_resources =0 , + .dev = { + .platform_data = &dnskw_button_data, + } +}; + +/* Fan: ADDA AD045HB-G73 40mm 6000rpm at 5v */ +static struct gpio_fan_speed dnskw_fan_speed[] = { + {0 ,0 }, + {3000 ,1 }, + {6000 ,2 }, +}; +static unsigned dnskw_fan_pins[] = {46 ,45 }; + +static struct gpio_fan_platform_data dnskw_fan_data = { + .num_ctrl =ARRAY_SIZE (dnskw_fan_pins), + .ctrl = dnskw_fan_pins, + .num_speed =ARRAY_SIZE (dnskw_fan_speed), + .speed = dnskw_fan_speed, +}; + +static struct platform_device dnskw_fan_device = { + .name ="gpio-fan" , + .id =-1 , + .dev = { + .platform_data = &dnskw_fan_data, + }, +}; + +static void dnskw_power_off (void ) +{ +gpio_set_value (36 ,1 ); +} + +/* Register any GPIO for output and set the value */ +static void __init dnskw_gpio_register (unsigned gpio,char *name,int def) +{ +if (gpio_request (gpio, name) ==0 && +gpio_direction_output (gpio,0 ) ==0 ) { +gpio_set_value (gpio, def); +if (gpio_export (gpio,0 ) !=0 ) +pr_err ("dnskw: Failed to export GPIO %s\n" , name); + }else +pr_err ("dnskw: Failed to register %s\n" , name); +} + +void __init dnskw_init (void ) +{ +kirkwood_mpp_conf (dnskw_mpp_config); +kirkwood_nand_init (ARRAY_AND_SIZE (dnskw_nand_parts),25 ); + +kirkwood_ehci_init (); +kirkwood_ge00_init (&dnskw_ge00_data); +kirkwood_sata_init (&dnskw_sata_data); +kirkwood_i2c_init (); + +platform_device_register (&dnskw_button_device); +platform_device_register (&dnskw_fan_device); + +if (of_machine_is_compatible ("dlink,dns-325" )) { +i2c_register_board_info (0 , dns325_i2c_board_info, +ARRAY_SIZE (dns325_i2c_board_info)); +platform_device_register (&dns325_led_device); + + }else if (of_machine_is_compatible ("dlink,dns-320" )) +platform_device_register (&dns320_led_device); + +/* Register power-off GPIO. */ +if (gpio_request (36 ,"dnskw:power:off" ) ==0 + &&gpio_direction_output (36 ,0 ) ==0 ) + pm_power_off = dnskw_power_off; +else +pr_err ("dnskw: failed to configure power-off GPIO\n" ); + +/* Ensure power is supplied to both HDDs */ +dnskw_gpio_register (39 ,"dnskw:power:sata0" ,1 ); +dnskw_gpio_register (40 ,"dnskw:power:sata1" ,1 ); + +/* Set NAS to turn back on after a power failure */ +dnskw_gpio_register (37 ,"dnskw:power:recover" ,1 ); +}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
-1@@ -58,6 +58,12 @@ void dreamplug_init(void);static inline void dreamplug_init (void ) {};#endif +#ifdef CONFIG_MACH_DNSKW_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 ); --1.7.9.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel at lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Signature · 1 line
Jamie Lentin
PATCH v3 1/5 ARM: kirkwood: Basic support for DNS-320 and DNS-325
Quoted 9 lines · Jamie Lentin
Quoted 7 lines · Grant Likely
These two lines are dangerous. It is not safe to 'select'
Kconfigsymbols that have 'depends' constraints. Otherwise, the symbol will get forced on without it's dependencies.Typically other code handles this by creating blank "HAVE_*" symbols that the needed symbol can do something like "default y if HAVE_*"
Quoted 7 lines
Okay I didn't realise this, thanks. The options in question aren't hard dependencies per-se, but no serial or NAND support is probably a mistake, so added them here to avoid a certain amount of shooting in foot.
What's the etiquette in this situation? Adding HAVE_* seems excessive, would selecting them in
kirkwood_defconfigmake more sense? Or would it simply be covered by having a reasonable config on my website or suchlike?
Either way works. We don't prevent people from shooting themselves in the foot in Kconfig, there are plenty of ways to do that already (e.g. disabling network support on a headless system). There should be a defconfig for each platform, so just make sure 'make kirkwood_defconfig' enables everything you need and works on your system, it should be the superset of all kirkwood based systems and users can disable the stuff they don't need.
Arnd
PATCH v3 1/5 ARM: kirkwood: Basic support for DNS-320 and DNS-325
In reply to Jamie LentinQuoted 116 lines · Jamie Lentin
Quoted 110 lines · Grant Likely
Quoted 94 lines · Jamie Lentin
Add support for the DNS-320 and DNS-325. Describe as much as currently possible in the devicetree files, create a
board-dnskw.cfor everything else.Use IEEE-compliant "okay", rather than "ok"
Acked-by Arnd Bergmann <[email protected]>Acked-by Jason Cooper <[email protected]>Signed-off-by Jamie Lentin <[email protected]>---
arch/arm/boot/dts/kirkwood-dns320.dts | 29 +++ arch/arm/boot/dts/kirkwood-dns325.dts | 24 +++ arch/arm/mach-kirkwood/Kconfig | 23 +++ arch/arm/mach-kirkwood/Makefile | 1 + arch/arm/mach-kirkwood/Makefile.boot | 2 + arch/arm/mach-kirkwood/board-dnskw.c | 306 +++++++++++++++++++++++++++++++++ arch/arm/mach-kirkwood/board-dt.c | 5 + arch/arm/mach-kirkwood/common.h | 6 + 8 files changed, 396 insertions(+), 0 deletions(-)create mode 100644
arch/arm/boot/dts/kirkwood-dns320.dtscreate mode 100644arch/arm/boot/dts/kirkwood-dns325.dtscreate mode 100644arch/arm/mach-kirkwood/board-dnskw.carch/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 +0
-0@@ -58,6 +58,29 @@ config MACH_DREAMPLUG_DT Say 'Y' here if you want your kernel to support the Marvell DreamPlug (Flattened Device Tree).arch/arm/mach-kirkwood/Kconfig config MACH_DREAMPLUG_DT · line 69
Quoted 10 lines
arch/arm/mach-kirkwood/Kconfig +9
-0+config MACH_DNSKW_DT + bool + +config MACH_DNS320_DT + bool "D-Link DNS-320 (Flattened Device Tree)" + select ARCH_KIRKWOOD_DT + select MACH_DNSKW_DT + select CONFIG_MTD_OF_PARTS + select CONFIG_SERIAL_OF_PLATFORMThese two lines are dangerous. It is not safe to 'select'
Kconfigsymbols that have 'depends' constraints. Otherwise, the symbol will get forced on without it's dependencies.Quoted 3 lines
Typically other code handles this by creating blank "HAVE_*" symbols that the needed symbol can do something like "default y if HAVE_*"
Quoted 7 lines
Okay I didn't realise this, thanks. The options in question aren't hard dependencies per-se, but no serial or NAND support is probably a mistake, so added them here to avoid a certain amount of shooting in foot.
What's the etiquette in this situation? Adding HAVE_* seems excessive, would selecting them in
kirkwood_defconfigmake more sense? Or would it simply be covered by having a reasonable config on my website or suchlike?
The latter sounds good. kirkwood_defconfig is in need of some love, and I haven't had time to get to it.
Quoted 3 lines
Jason, given you've already applied this patch, would you rather me submit something else to ditch these, or resumbit the entire series, combining feedback?
I only applied it locally, I was waiting for comments like this before doing a pull request. Go ahead and redo the series based on the input and repost. I'll replace what I have.
Quoted 22 lines
Quoted 12 lines
Quoted 12 lines
arch/arm/mach-kirkwood/Kconfig +11
-0+ help + Say 'Y' here if you want your kernel to support the + D-Link DNS-320 NAS, using Flattened Device Tree. + +config MACH_DNS325_DT + bool "D-Link DNS-325 (Flattened Device Tree)" + select ARCH_KIRKWOOD_DT + select MACH_DNSKW_DT + select CONFIG_MTD_OF_PARTS + select CONFIG_SERIAL_OF_PLATFORM + helpQuoted 9 lines
arch/arm/mach-kirkwood/Kconfig config MACH_DREAMPLUG_DT · line 83
Quoted 3 lines
arch/arm/mach-kirkwood/Kconfig +3
-0+ Say 'Y' here if you want your kernel to support the + D-Link DNS-325 NAS, using Flattened Device Tree. +The *only* difference between these two configs is the .dtb file that gets built. Don't create a separate
Kconfigentry for each dnskw board. Just build all the dnskw dtb files whenMACH_DNSKW_DTis selected. Building .dtb files is cheap.
Quoted 8 lines
The rationale for this is the code in
dnskw.cis (hopefully!) temporary, and when it goes there isn't any need forMACH_DNSKW_DTeither.In a future land where everything has been converted to devicetree, what would be best? An option to "Build all kirkwood-based .dtb's", an option to build all D-link .dtb's, Q-QNAP .dtb's, etc. or an option for each board? I've not got any strong opinion, so will reformat the above to whatever is considered best.
Based on Grant's comment, I'll probably be working towards a MACH_GLOBALSCALE_DT option to catch dreamplug,sheevaplug,guruplug, etc. Perhaps this should be MACH_BUFFALO_DT?
Quoted 96 lines
Quoted 96 lines
Quoted 80 lines
config
MACH_TS219bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS" helparch/arm/mach-kirkwood/Makefile +0
-0@@ -22,3 +22,4 @@ obj-$(CONFIG_MACH_T5325) += t5325-setup.oobj-$(CONFIG_CPU_IDLE) += cpuidle.o
obj-$(CONFIG_ARCH_KIRKWOOD_DT) += board-dt.o
obj-$(CONFIG_MACH_DREAMPLUG_DT) += board-dreamplug.oarch/arm/mach-kirkwood/Makefile +1
-0+obj-$(CONFIG_MACH_DNSKW_DT) += board-dnskw.oarch/arm/mach-kirkwood/Makefile.boot +0
-0@@ -3,3 +3,5 @@ params_phys-y := 0x00000100initrd_phys-y :=
0x00800000dtb-$(CONFIG_MACH_DREAMPLUG_DT) += kirkwood-dreamplug.dtb
arch/arm/mach-kirkwood/Makefile.boot +2
-0+dtb-$(CONFIG_MACH_DNS320_DT) += kirkwood-dns320.dtb +dtb-$(CONFIG_MACH_DNS325_DT) += kirkwood-dns325.dtbarch/arm/mach-kirkwood/board-dnskw.c new file +52
-0@@ -0,0 +1,306 @@ +/* +* Copyright 2012 (C), Jamie Lentin <[email protected]> +* +* arch/arm/mach-kirkwood/board-dnskw.c +* +* D-link DNS-320 & DNS-325 NAS Init for drivers not converted to +* flattened device tree yet. +* +* 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 <linux/kernel.h> +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/i2c.h> +#include <linux/ata_platform.h> +#include <linux/mv643xx_eth.h> +#include <linux/of.h> +#include <linux/gpio.h> +#include <linux/input.h> +#include <linux/gpio_keys.h> +#include <linux/gpio-fan.h> +#include <linux/leds.h> +#include <linux/mtd/physmap.h> +#include <asm/mach-types.h> +#include <asm/mach/arch.h> +#include <asm/mach/map.h> +#include <mach/kirkwood.h> +#include <mach/bridge-regs.h> +#include "common.h" +#include "mpp.h" + +static struct mtd_partition dnskw_nand_parts[] = { + { + .name ="u-boot" , + .offset =0 , + .size =SZ_1M , + .mask_flags =MTD_WRITEABLE + }, { + .name ="uImage" , + .offset =MTDPART_OFS_NXTBLK , + .size =5 *SZ_1M + }, { + .name ="ramdisk" , + .offset =MTDPART_OFS_NXTBLK , + .size =5 *SZ_1M + }, { + .name ="image" , + .offset =MTDPART_OFS_NXTBLK , + .size =102 *SZ_1M arch/arm/mach-kirkwood/board-dnskw.c line 62
Quoted 10 lines
arch/arm/mach-kirkwood/board-dnskw.c new file +10
-0+ }, { + .name = "mini firmware", + .offset = MTDPART_OFS_NXTBLK, + .size = 10 * SZ_1M + }, { + .name = "config", + .offset = MTDPART_OFS_NXTBLK, + .size = 5 * SZ_1M + }, +};This patch adds a static partition mapping, and then a later patch in this same series removes it again. Please don't do that. Just squash the patches together. Or, if sqashing is not appropriate, then just omit the partitions.
Quoted 7 lines
Quoted 4 lines
I also suggest omiting similar data when there are patches already in progess to do it properly. It is okay for the inital support to go in to be incomplete when enhancements will be ready soon.
Noted. If the entire patchset needs resubmitting, I'll combine the patch that moves this definition to the .dtb
See my comment in my other reply, just don't add nand/partition support in the beginning.
thx,
Jason.
PATCH v3 1/5 ARM: kirkwood: Basic support for DNS-320 and DNS-325
Quoted 10 lines · Jason Cooper
Quoted 5 lines
In a future land where everything has been converted to devicetree, what would be best? An option to "Build all kirkwood-based .dtb's", an option to build all D-link .dtb's, Q-QNAP .dtb's, etc. or an option for each board? I've not got any strong opinion, so will reformat the above to whatever is considered best.
Based on Grant's comment, I'll probably be working towards a
MACH_GLOBALSCALE_DToption to catch dreamplug,sheevaplug,guruplug, etc. Perhaps this should beMACH_BUFFALO_DT?
Thinking about it, MACH_DNSKW_DT would probably be best. Anything more general, e.g. MACH_DLINK_DNS_DT, would also cover the orion-based DNS-313/323/343. Presumably there will always be differences between kirkwood and orion5x?
Did you mean D-Link, or is there some relationship between Buffalo and D-link I'm not aware of? I know Conceptronic sold a ~identical device to the DNS-323, but not aware of anything else. You never know who truly makes the devices nowadays anyway.
Signature · 1 line
Jamie Lentin
PATCH v3 1/5 ARM: kirkwood: Basic support for DNS-320 and DNS-325
Quoted 14 lines · Jamie Lentin
Quoted 10 lines · Jason Cooper
Quoted 5 lines
In a future land where everything has been converted to devicetree, what would be best? An option to "Build all kirkwood-based .dtb's", an option to build all D-link .dtb's, Q-QNAP .dtb's, etc. or an option for each board? I've not got any strong opinion, so will reformat the above to whatever is considered best.
Based on Grant's comment, I'll probably be working towards a
MACH_GLOBALSCALE_DToption to catch dreamplug,sheevaplug,guruplug, etc. Perhaps this should beMACH_BUFFALO_DT?
Quoted 4 lines
Thinking about it,
MACH_DNSKW_DTwould probably be best. Anything more general, e.g.MACH_DLINK_DNS_DT, would also cover the orion-based DNS-313/323/343. Presumably there will always be differences between kirkwood and orion5x?
Hmm, Well, I think I would prefer MACH_DLINK_KIRKWOOD_DT, MACH_DLINK_ORION5X_DT. This way, all the dtb's for a given manf/SoC are built in one go, and the correct board-dt file is built as well.
So, in my case, I would do MACH_GLOBALSCALE_KIRKWOOD_DT, and MACH_GLOBALSCALE_ARMADA_DT.
Grant, Arnd, sound sensible?
Quoted 4 lines
Did you mean D-Link, or is there some relationship between Buffalo and D-link I'm not aware of? I know Conceptronic sold a ~identical device to the DNS-323, but not aware of anything else. You never know who truly makes the devices nowadays anyway.
Nope, just a momentary symlink'd /dev/brain -> /dev/random. Fixed now, thanks.
thx,
Jason.
PATCH v3 1/5 ARM: kirkwood: Basic support for DNS-320 and DNS-325
Quoted 5 lines · Jason Cooper
Quoted 4 lines
Thinking about it,
MACH_DNSKW_DTwould probably be best. Anything more general, e.g.MACH_DLINK_DNS_DT, would also cover the orion-based DNS-313/323/343. Presumably there will always be differences between kirkwood and orion5x?
Quoted 8 lines
Hmm, Well, I think I would prefer
MACH_DLINK_KIRKWOOD_DT,MACH_DLINK_ORION5X_DT. This way, all the dtb's for a given manf/SoC are built in one go, and the correct board-dt file is built as well.So, in my case, I would do
MACH_GLOBALSCALE_KIRKWOOD_DT, andMACH_GLOBALSCALE_ARMADA_DT.Grant, Arnd, sound sensible?
I think it's fine, I just don't spend too much time on the naming when the goal is to eventually just have one config option for all manufacturers.
Arnd
PATCH v3 1/5 ARM: kirkwood: Basic support for DNS-320 and DNS-325
In reply to Grant LikelyQuoted 9 lines · Grant Likely
arch/arm/mach-kirkwood/Kconfig config MACH_DREAMPLUG_DT · line 69
Quoted 6 lines · Jamie Lentin
arch/arm/mach-kirkwood/Kconfig +6
-0+config MACH_DNS320_DT + bool "D-Link DNS-320 (Flattened Device Tree)" + select ARCH_KIRKWOOD_DT + select MACH_DNSKW_DT + select CONFIG_MTD_OF_PARTS + select CONFIG_SERIAL_OF_PLATFORMThese two lines are dangerous.
No they aren't - at least not as the above patch is written. There are no configuration variables called CONFIG_CONFIG_MTD_OF_PARTS nor CONFIG_CONFIG_SERIAL_OF_PLATFORM.
Kconfig won't warn about that, and if we assume that this patch has been properly tested, it would appear that these two select statements just aren't required (because they're effective no-ops as they currently stand).
PATCH v3 1/5 ARM: kirkwood: Basic support for DNS-320 and DNS-325
In reply to Grant LikelyQuoted 110 lines · Grant Likely
Quoted 94 lines · Jamie Lentin
Add support for the DNS-320 and DNS-325. Describe as much as currently possible in the devicetree files, create a
board-dnskw.cfor everything else.Use IEEE-compliant "okay", rather than "ok"
Acked-by Arnd Bergmann <[email protected]>Acked-by Jason Cooper <[email protected]>Signed-off-by Jamie Lentin <[email protected]>--- arch/arm/boot/dts/kirkwood-dns320.dts | 29 +++ arch/arm/boot/dts/kirkwood-dns325.dts | 24 +++ arch/arm/mach-kirkwood/Kconfig | 23 +++ arch/arm/mach-kirkwood/Makefile | 1 + arch/arm/mach-kirkwood/Makefile.boot | 2 + arch/arm/mach-kirkwood/board-dnskw.c | 306 +++++++++++++++++++++++++++++++++ arch/arm/mach-kirkwood/board-dt.c | 5 + arch/arm/mach-kirkwood/common.h | 6 + 8 files changed, 396 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.carch/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 +0
-0@@ -58,6 +58,29 @@ config MACH_DREAMPLUG_DT Say 'Y' here if you want your kernel to support the Marvell DreamPlug (Flattened Device Tree).arch/arm/mach-kirkwood/Kconfig config MACH_DREAMPLUG_DT · line 69
Quoted 10 lines
arch/arm/mach-kirkwood/Kconfig +9
-0+config MACH_DNSKW_DT + bool + +config MACH_DNS320_DT + bool "D-Link DNS-320 (Flattened Device Tree)" + select ARCH_KIRKWOOD_DT + select MACH_DNSKW_DT + select CONFIG_MTD_OF_PARTS + select CONFIG_SERIAL_OF_PLATFORMThese two lines are dangerous. It is not safe to 'select'
Kconfigsymbols that have 'depends' constraints. Otherwise, the symbol will get forced on without it's dependencies.
Quoted 2 lines
Typically other code handles this by creating blank "HAVE_*" symbols that the needed symbol can do something like "default y if HAVE_*"
I'm in favor of just omitting these two lines. I think it's a bad habit to presume what features a user may want. This should be handled by *_defconfig, if anywhere.
Quoted 11 lines
Quoted 11 lines
arch/arm/mach-kirkwood/Kconfig +11
-0+ help + Say 'Y' here if you want your kernel to support the + D-Link DNS-320 NAS, using Flattened Device Tree. + +config MACH_DNS325_DT + bool "D-Link DNS-325 (Flattened Device Tree)" + select ARCH_KIRKWOOD_DT + select MACH_DNSKW_DT + select CONFIG_MTD_OF_PARTS + select CONFIG_SERIAL_OF_PLATFORM + help
Quoted 8 lines
arch/arm/mach-kirkwood/Kconfig config MACH_DREAMPLUG_DT · line 83
Quoted 3 lines
arch/arm/mach-kirkwood/Kconfig +3
-0+ Say 'Y' here if you want your kernel to support the + D-Link DNS-325 NAS, using Flattened Device Tree. +The *only* difference between these two configs is the .dtb file that gets built. Don't create a separate
Kconfigentry for each dnskw board. Just build all the dnskw dtb files whenMACH_DNSKW_DTis selected. Building .dtb files is cheap.
Ack.
Quoted 96 lines
Quoted 80 lines
arch/arm/mach-kirkwood/Kconfig +0
-0config MACH_TS219 bool "QNAP TS-110, TS-119, TS-119P+, TS-210, TS-219, TS-219P and TS-219P+ Turbo NAS" helparch/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_DNSKW_DT) += board-dnskw.oarch/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_DNS320_DT) += kirkwood-dns320.dtb +dtb-$(CONFIG_MACH_DNS325_DT) += kirkwood-dns325.dtbarch/arm/mach-kirkwood/board-dnskw.c new file +52
-0@@ -0,0 +1,306 @@ +/* +* Copyright 2012 (C), Jamie Lentin <[email protected]> +* +* arch/arm/mach-kirkwood/board-dnskw.c +* +* D-link DNS-320 & DNS-325 NAS Init for drivers not converted to +* flattened device tree yet. +* +* 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 <linux/kernel.h> +#include <linux/init.h> +#include <linux/platform_device.h> +#include <linux/i2c.h> +#include <linux/ata_platform.h> +#include <linux/mv643xx_eth.h> +#include <linux/of.h> +#include <linux/gpio.h> +#include <linux/input.h> +#include <linux/gpio_keys.h> +#include <linux/gpio-fan.h> +#include <linux/leds.h> +#include <linux/mtd/physmap.h> +#include <asm/mach-types.h> +#include <asm/mach/arch.h> +#include <asm/mach/map.h> +#include <mach/kirkwood.h> +#include <mach/bridge-regs.h> +#include "common.h" +#include "mpp.h" + +static struct mtd_partition dnskw_nand_parts[] = { + { + .name ="u-boot" , + .offset =0 , + .size =SZ_1M , + .mask_flags =MTD_WRITEABLE + }, { + .name ="uImage" , + .offset =MTDPART_OFS_NXTBLK , + .size =5 *SZ_1M + }, { + .name ="ramdisk" , + .offset =MTDPART_OFS_NXTBLK , + .size =5 *SZ_1M + }, { + .name ="image" , + .offset =MTDPART_OFS_NXTBLK , + .size =102 *SZ_1M arch/arm/mach-kirkwood/board-dnskw.c line 62
Quoted 10 lines
arch/arm/mach-kirkwood/board-dnskw.c new file +10
-0+ }, { + .name = "mini firmware", + .offset = MTDPART_OFS_NXTBLK, + .size = 10 * SZ_1M + }, { + .name = "config", + .offset = MTDPART_OFS_NXTBLK, + .size = 5 * SZ_1M + }, +};This patch adds a static partition mapping, and then a later patch in this same series removes it again. Please don't do that. Just squash the patches together. Or, if sqashing is not appropriate, then just omit the partitions.
Quoted 3 lines
I also suggest omiting similar data when there are patches already in progess to do it properly. It is okay for the inital support to go in to be incomplete when enhancements will be ready soon.
This is my doing. He was basing this off of dreamplug, which has SPI NOR flash and partitions specified in the board file because the spi driver is waiting for kirkwood to be converted to common clock. Jamie, go ahead and drop the above in the initial board-dnskw.c patch and just add support for nand/partitions in the last patch (fdt).
thx,
Jason.
PATCH v3 2/5 mtd: Add orion_nand devicetree bindings
In reply to Jamie LentinAllow a NAND chip using the orion_nand driver to be described using devicetree.
--- .../devicetree/bindings/mtd/orion-nand.txt | 46 ++++++++++++++++++++ drivers/mtd/nand/orion_nand.c | 35 ++++++++++++++- 2 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/mtd/orion-nand.txt
Documentation/devicetree/bindings/mtd/orion-nand.txt new file +46 -0
@@ -0,0 +1,46 @@ +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 : +- ale : +- bank-width : +- chip-delay : + +Examples: + +nand at f4000000 { + #address-cells = <1>; + #size-cells = <1>; + cle = <0>; + ale = <1>; + bank-width = <8>; + 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 +33 -2
@@ -13,6 +13,7 @@#include <linux/slab.h> #include <linux/module.h> #include <linux/platform_device.h> +#include <linux/of.h> #include <linux/mtd/mtd.h> #include <linux/mtd/nand.h> #include <linux/mtd/partitions.h>
@@ -74,11 +75,13 @@ static void orion_nand_read_buf(struct mtd_info *mtd, uint8_t *buf, int len)static int __init orion_nand_probe (struct platform_device *pdev) {struct mtd_info *mtd; +struct mtd_part_parser_data ppdata = {};struct nand_chip *nc;struct orion_nand_data *board;struct resource *res;void __iomem *io_base;int ret =0 ; +u32 val =0 ; nc =kzalloc (sizeof (struct nand_chip ) +sizeof (struct mtd_info ),GFP_KERNEL );if (!nc) {
@@ -101,7 +104,26 @@ static int __init orion_nand_probe(struct platform_device *pdev) goto no_res; } - board = pdev->dev.platform_data; +if (pdev->dev.of_node) { + board =devm_kzalloc (&pdev->dev,sizeof (struct orion_nand_data ), +GFP_KERNEL ); +if (!board) { +printk (KERN_ERR "orion_nand: failed to allocate board structure.\n" ); + ret = -ENOMEM ; + goto no_res; + } +if (!of_property_read_u32 (pdev->dev.of_node,"cle" , &val)) + board->cle = (u8 )val; +if (!of_property_read_u32 (pdev->dev.of_node,"ale" , &val)) + board->ale = (u8 )val; +if (!of_property_read_u32 (pdev->dev.of_node, +"bank-width" , &val)) + board->width = (u8 )val; +if (!of_property_read_u32 (pdev->dev.of_node, +"chip-delay" , &val)) + board->chip_delay = (u8 )val; + }else + board = pdev->dev.platform_data; mtd->priv = nc; mtd->owner =THIS_MODULE ;
@@ -129,7 +151,8 @@ static int __init orion_nand_probe(struct platform_device *pdev) } mtd->name ="orion_nand" ; - ret =mtd_device_parse_register (mtd,NULL ,0 , + ppdata.of_node = pdev->dev.of_node; + ret =mtd_device_parse_register (mtd,NULL , &ppdata, board->parts, board->nr_parts);if (ret) {nand_release (mtd);
@@ -161,11 +184,19 @@ static int __devexit orion_nand_remove(struct platform_device *pdev)return 0 ; } +#ifdef CONFIG_OF +static struct of_device_id orion_nand_of_match_table[] = { + { .compatible ="mrvl,orion-nand" , }, + {}, +}; +#endif +static struct platform_driver orion_nand_driver = { .remove =__devexit_p (orion_nand_remove), .driver = { .name ="orion_nand" , .owner =THIS_MODULE , + .of_match_table =of_match_ptr (orion_nand_of_match_table), }, };
Signature · 1 line
1.7.9.1
PATCH v3 2/5 mtd: Add orion_nand devicetree bindings
Quoted 18 lines · Jamie Lentin
Allow a NAND chip using the
orion_nanddriver to be described using devicetree.Acked-by Arnd Bergmann <[email protected]>Signed-off-by Jamie Lentin <[email protected]>--- .../devicetree/bindings/mtd/orion-nand.txt | 46 ++++++++++++++++++++ drivers/mtd/nand/orion_nand.c | 35 ++++++++++++++- 2 files changed, 79 insertions(+), 2 deletions(-) create mode 100644 Documentation/devicetree/bindings/mtd/orion-nand.txtDocumentation/devicetree/bindings/mtd/orion-nand.txt new file +2
-0@@ -0,0 +1,46 @@ +NAND support for Marvell Orion SoC platforms +
Documentation/devicetree/bindings/mtd/orion-nand.txt line 12
Quoted 10 lines
Documentation/devicetree/bindings/mtd/orion-nand.txt new file +10
-0+Required properties: +- compatible : "mrvl,orion-nand". +- reg : Base physical address of the NAND and length of memory mapped + region + +Optional properties: +- cle : +- ale : +- bank-width : +- chip-delay :
Please state what data these properties contain. :-)
PATCH v3 3/5 ARM: 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 = <8>; + 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 v3 4/5 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.
--- arch/arm/boot/dts/kirkwood-dns320.dts | 35 +++++++++++++++++++++++++++++++++ arch/arm/boot/dts/kirkwood-dns325.dts | 35 +++++++++++++++++++++++++++++++++ arch/arm/mach-kirkwood/board-dnskw.c | 31 ----------------------------- 3 files changed, 70 insertions(+), 31 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>; + }; + }; }; };
arch/arm/mach-kirkwood/board-dnskw.c +0 -31
@@ -23,7 +23,6 @@#include <linux/gpio_keys.h> #include <linux/gpio-fan.h> #include <linux/leds.h> -#include <linux/mtd/physmap.h> #include <asm/mach-types.h> #include <asm/mach/arch.h> #include <asm/mach/map.h>
@@ -32,35 +31,6 @@#include "common.h" #include "mpp.h" -static struct mtd_partition dnskw_nand_parts[] = { - { - .name ="u-boot" , - .offset =0 , - .size =SZ_1M , - .mask_flags =MTD_WRITEABLE - }, { - .name ="uImage" , - .offset =MTDPART_OFS_NXTBLK , - .size =5 *SZ_1M - }, { - .name ="ramdisk" , - .offset =MTDPART_OFS_NXTBLK , - .size =5 *SZ_1M - }, { - .name ="image" , - .offset =MTDPART_OFS_NXTBLK , - .size =102 *SZ_1M - }, { - .name ="mini firmware" , - .offset =MTDPART_OFS_NXTBLK , - .size =10 *SZ_1M - }, { - .name ="config" , - .offset =MTDPART_OFS_NXTBLK , - .size =5 *SZ_1M - }, -}; -static struct mv643xx_eth_platform_data dnskw_ge00_data = { .phy_addr =MV643XX_ETH_PHY_ADDR (8 ), };
@@ -272,7 +242,6 @@ static void __init dnskw_gpio_register(unsigned gpio, char *name, int def)void __init dnskw_init (void ) {kirkwood_mpp_conf (dnskw_mpp_config); -kirkwood_nand_init (ARRAY_AND_SIZE (dnskw_nand_parts),25 );kirkwood_ehci_init ();kirkwood_ge00_init (&dnskw_ge00_data);
Signature · 1 line
1.7.9.1
PATCH v3 5/5 mtd: Move fdt partition documentation to a seperate file
In reply to Jamie LentinPartitions are described in the same way for all mtd devices when using devicetree, move the documentation to a separate file and add references to it.
--- .../devicetree/bindings/mtd/arm-versatile.txt | 4 +- .../devicetree/bindings/mtd/atmel-dataflash.txt | 3 ++ .../devicetree/bindings/mtd/fsl-upm-nand.txt | 4 ++ .../devicetree/bindings/mtd/gpio-control-nand.txt | 3 ++ .../devicetree/bindings/mtd/mtd-physmap.txt | 23 +----------- .../devicetree/bindings/mtd/orion-nand.txt | 3 ++ .../devicetree/bindings/mtd/partition.txt | 38 ++++++++++++++++++++ 7 files changed, 55 insertions(+), 23 deletions(-) create mode 100644 Documentation/devicetree/bindings/mtd/partition.txt
Documentation/devicetree/bindings/mtd/arm-versatile.txt +2 -2
@@ -4,5 +4,5 @@ Required properties: - compatible : must be "arm,versatile-flash"; - bank-width : width in bytes of flash interface. -Optional properties: -- Subnode partition map from mtd flash binding +The device tree may optionally contain sub-nodes describing partitions of the +address space. See partition.txt for more detail.
Documentation/devicetree/bindings/mtd/atmel-dataflash.txt +3 -0
@@ -3,6 +3,9 @@ Required properties: - compatible : "atmel,<model>", "atmel,<series>", "atmel,dataflash". +The device tree may optionally contain sub-nodes describing partitions of the +address space. See partition.txt for more detail. + Example: flash at 1 {
Documentation/devicetree/bindings/mtd/fsl-upm-nand.txt +4 -0
@@ -19,6 +19,10 @@ Optional properties: read registers (tR). Required if property "gpios" is not used (R/B# pins not connected). +Each flash chip described may optionally contain additional sub-nodes +describing partitions of the address space. See partition.txt for more +detail. + Examples: upm at 1,0 {
Documentation/devicetree/bindings/mtd/gpio-control-nand.txt +3 -0
@@ -25,6 +25,9 @@ Optional properties: GPIO state and before and after command byte writes, this register will be read to ensure that the GPIO accesses have completed. +The device tree may optionally contain sub-nodes describing partitions of the +address space. See partition.txt for more detail. + Examples: gpio-nand at 1,0 {
Documentation/devicetree/bindings/mtd/mtd-physmap.txt +2 -21
@@ -23,27 +23,8 @@ are defined: - vendor-id : Contains the flash chip's vendor id (1 byte). - device-id : Contains the flash chip's device id (1 byte). -In addition to the information on the mtd bank itself, the -device tree may optionally contain additional information -describing partitions of the address space. This can be -used on platforms which have strong conventions about which -portions of a flash are used for what purposes, but which don't -use an on-flash partition table such as RedBoot. - -Each partition is represented as a sub-node of the mtd device. -Each node's name represents the name of the corresponding -partition of the mtd device. - -Flash partitions - - reg : The partition's offset and size within the mtd bank. - - label : (optional) The label / name for this partition. - If omitted, the label is taken from the node name (excluding - the unit address). - - read-only : (optional) This parameter, if present, is a hint to - Linux that this partition should only be mounted - read-only. This is usually used for flash partitions - containing early-boot firmware images or data which should not - be clobbered. +The device tree may optionally contain sub-nodes describing partitions of the +address space. See partition.txt for more detail. Example:
Documentation/devicetree/bindings/mtd/orion-nand.txt +3 -0
@@ -11,6 +11,9 @@ Optional properties: - bank-width : - chip-delay : +The device tree may optionally contain sub-nodes describing partitions of the +address space. See partition.txt for more detail. + Examples: nand at f4000000 {
Documentation/devicetree/bindings/mtd/partition.txt new file +38 -0
@@ -0,0 +1,38 @@ +Representing flash partitions in devicetree + +Partitions can be represented by sub-nodes of an mtd device. This can be used +on platforms which have strong conventions about which portions of a flash are +used for what purposes, but which don't use an on-flash partition table such +as RedBoot. + +#address-cells & #size-cells must both be present in the mtd device and be +equal to 1. + +Required properties: +- reg : The partition's offset and size within the mtd bank. + +Optional properties: +- label : The label / name for this partition. If omitted, the label is taken + from the node name (excluding the unit address). +- read-only : This parameter, if present, is a hint to Linux that this + partition should only be mounted read-only. This is usually used for flash + partitions containing early-boot firmware images or data which should not be + clobbered. + +Examples: + + +flash at 0 { + #address-cells = <1>; + #size-cells = <1>; + + partition at 0 { + label = "u-boot"; + reg = <0x0000000 0x100000>; + read-only; + }; + + uimage at 100000 { + reg = <0x0100000 0x200000>; + }; +];
Signature · 1 line
1.7.9.1
PATCH v3 5/5 mtd: Move fdt partition documentation to a seperate file
Quoted 6 lines · Jamie Lentin
Partitions are described in the same way for all mtd devices when using devicetree, move the documentation to a separate file and add references to it.
Signed-off-by Jamie Lentin <[email protected]>
Quoted 9 lines
--- .../devicetree/bindings/mtd/arm-versatile.txt | 4 +- .../devicetree/bindings/mtd/atmel-dataflash.txt | 3 ++ .../devicetree/bindings/mtd/fsl-upm-nand.txt | 4 ++ .../devicetree/bindings/mtd/gpio-control-nand.txt | 3 ++ .../devicetree/bindings/mtd/mtd-physmap.txt | 23 +----------- .../devicetree/bindings/mtd/orion-nand.txt | 3 ++ .../devicetree/bindings/mtd/partition.txt | 38 ++++++++++++++++++++ 7 files changed, 55 insertions(+), 23 deletions(-)
Grant Likely
AppliedPATCH v3 5/5 mtd: Move fdt partition documentation to a seperate file
Quoted 9 lines · Arnd Bergmann
Quoted 6 lines · Jamie Lentin
Partitions are described in the same way for all mtd devices when using devicetree, move the documentation to a separate file and add references to it.
Signed-off-by Jamie Lentin <[email protected]>Acked-by Arnd Bergmann <[email protected]>
Merged, thanks (dropping the orion-nand.txt hunk) because I'm not applying the rest of the series!)
g.
PATCH v3 5/5 mtd: Move fdt partition documentation to a seperate file
In reply to Jamie LentinQuoted 5 lines · Jamie Lentin
Partitions are described in the same way for all mtd devices when using devicetree, move the documentation to a separate file and add references to it.
Signed-off-by Jamie Lentin <[email protected]>
Quoted 10 lines
--- .../devicetree/bindings/mtd/arm-versatile.txt | 4 +- .../devicetree/bindings/mtd/atmel-dataflash.txt | 3 ++ .../devicetree/bindings/mtd/fsl-upm-nand.txt | 4 ++ .../devicetree/bindings/mtd/gpio-control-nand.txt | 3 ++ .../devicetree/bindings/mtd/mtd-physmap.txt | 23 +----------- .../devicetree/bindings/mtd/orion-nand.txt | 3 ++ .../devicetree/bindings/mtd/partition.txt | 38 ++++++++++++++++++++ 7 files changed, 55 insertions(+), 23 deletions(-) create mode 100644 Documentation/devicetree/bindings/mtd/partition.txt