Add support for DNS-320 and DNS-325 using devicetree
Subsystems (6)
v2 cover Add support for DNS-320 and DNS-325 using devicetree
Thankyou to Arnd and Jason for taking the time to review, sorry it's taken a while to get back to you both with an updated version.
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
I looked into adding a dtb partition into the d-link partition scheme. However D-Link supplied userland references all partitions by number and there isn't any obvious space that would be safe to use. Regardless, if you still have D-Link userland around, you probably still have D-Link u-boot, which won't load the dtb for you anyway.
Jamie Lentin (3):
ARM: kirkwood: Basic support for DNS-320 and DNS-325
ARM: kirkwood: Convert orion-nand to fdt
ARM: kirkwood: Define NAND partitions in dts
.../devicetree/bindings/mtd/orion-nand.txt | 46 ++++ 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 | 34 +++- 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 v2 1/3 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.
--- 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 = "ok"; + }; + + serial at 12100 { + clock-frequency = <166666667>; + status = "ok"; + }; + }; +};
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 = "ok"; + }; + }; +};
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 v2 1/3 ARM: kirkwood: Basic support for DNS-320 and DNS-325
Quoted 5 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.Signed-off-by Jamie Lentin <[email protected]>
Looks good to me.
Jason, do you want to add these to your tree? You are already have some the patches for dreamplug, and I think it makes sense to update these two together when you have more patches.
Since the dnskw board file contains mostly gpio setup, I think it would be good if one of you could take that part on next: once the gpio controller uses DT probing, you can move all the gpio leds and buttons into the device tree, which drastically shrinks the dnskw file.
Arnd
PATCH v2 1/3 ARM: kirkwood: Basic support for DNS-320 and DNS-325
Quoted 8 lines · Arnd Bergmann
Quoted 5 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.Signed-off-by Jamie Lentin <[email protected]>Looks good to me.
Me as well. Jamie, if you could just incorporate the orion_nand/kirkwood split and then resubmit (don't forget the acks), I'll pull them in.
Quoted 3 lines
Jason, do you want to add these to your tree? You are already have some the patches for dreamplug, and I think it makes sense to update these two together when you have more patches.
Will do.
Quoted 4 lines
Since the dnskw board file contains mostly gpio setup, I think it would be good if one of you could take that part on next: once the gpio controller uses DT probing, you can move all the gpio leds and buttons into the device tree, which drastically shrinks the dnskw file.
Agreed. Jamie, would you mind working on that while I work on the irq controller?
Other than my one comment about the patch split, please consider this series:
thx,
Jason.
Quoted 4 lines
Acked-by Arnd Bergmann <[email protected]>Arnd
PATCH v2 2/3 ARM: kirkwood: Convert orion-nand to fdt
In reply to Jamie LentinConvert orion-nand to use fdt and add common setup to kirkwood.dtsi, including a default value for chip-delay (all current boards seem to use 25 anyway).
Add placeholder documentation for the bindings, for someone more knowledgable than me to fill in the details of the properties.
--- .../devicetree/bindings/mtd/orion-nand.txt | 46 ++++++++++++++++++++ arch/arm/boot/dts/kirkwood.dtsi | 15 ++++++- arch/arm/mach-kirkwood/common.c | 12 +++++ drivers/mtd/nand/orion_nand.c | 34 ++++++++++++++- 4 files changed, 104 insertions(+), 3 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 : +- width : +- chip-delay : + +Examples: + +nand at f4000000 { + #address-cells = <1>; + #size-cells = <1>; + cle = <0>; + ale = <1>; + 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>; + }; +};
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>; + 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 */
drivers/mtd/nand/orion_nand.c +32 -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,25 @@ 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,"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 +150,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 +183,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 v2 2/3 ARM: kirkwood: Convert orion-nand to fdt
Quoted 5 lines · Jamie Lentin
Convert orion-nand to use fdt and add common setup to
kirkwood.dtsi, including a default value for chip-delay (all current boards seem to use 25 anyway).Add placeholder documentation for the bindings, for someone more knowledgable than me to fill in the details of the properties.
Looks very good. Two small comments:
Quoted 8 lines
Documentation/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 : +- width : +- chip-delay :
I think the "width" property should be called "bank-width" to match the other bindings.
Quoted 7 lines
Documentation/devicetree/bindings/mtd/orion-nand.txt new file +7
-0+Examples: + +nand at f4000000 { + #address-cells = <1>; + #size-cells = <1>; + cle = <0>; + ale = <1>;
Documentation/devicetree/bindings/mtd/orion-nand.txt line 30
Quoted 10 lines
Documentation/devicetree/bindings/mtd/orion-nand.txt new file +10
-0+ width = <8>; + chip-delay = <25>; + compatible = "mrvl,orion-nand"; + reg = <0xf4000000 0x400>; + + partition at 0 { + label = "u-boot"; + reg = <0x0000000 0x100000>; + read-only; + };
You don't describe the partitions in the binding. Others have the same omission, but I think it's worth mentioning. Either point to the mtd-physmap.txt file, or make your patch move the partition support into a new file that everything else can refer to.
Arnd
PATCH v3 2/3 ARM: kirkwood: Convert orion-nand to fdt
Convert orion-nand to use fdt and add common setup to kirkwood.dtsi, including a default value for chip-delay (all current boards seem to use 25 anyway).
Add placeholder documentation for the bindings, for someone more knowledgable than me to fill in the details of the properties.
Move common partition table documentation into a separate file and reference this.
---
Re-arranged documentation as you suggest, however it's tempting to have this as a separate patch and add references to partition.txt for the other binding documentation files. Let me know if you want me to do this.
Cheers for your help!
.../devicetree/bindings/mtd/mtd-physmap.txt | 24 +-------- .../devicetree/bindings/mtd/orion-nand.txt | 50 ++++++++++++++++++++ .../devicetree/bindings/mtd/partition.txt | 38 +++++++++++++++ arch/arm/boot/dts/kirkwood.dtsi | 15 ++++++- arch/arm/mach-kirkwood/common.c | 12 +++++ drivers/mtd/nand/orion_nand.c | 34 +++++++++++++- 6 files changed, 149 insertions(+), 24 deletions(-)
create mode 100644 Documentation/devicetree/bindings/mtd/orion-nand.txt create mode 100644 Documentation/devicetree/bindings/mtd/partition.txt
Documentation/devicetree/bindings/mtd/mtd-physmap.txt +3 -21
@@ -23,27 +23,9 @@ 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. +In addition to the information on the mtd bank itself, the device tree may +optionally contain additional sub-nodes describing partitions of the address +space. See partition.txt for more detail. Example:
Documentation/devicetree/bindings/mtd/orion-nand.txt new file +50 -0
50 lines not on this page · raw message
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>; + }; +];
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 */
drivers/mtd/nand/orion_nand.c +32 -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,25 @@ 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 +150,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 +183,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/3 ARM: kirkwood: Convert orion-nand to fdt
Quoted 4 lines · Jamie Lentin
Re-arranged documentation as you suggest, however it's tempting to have this as a separate patch and add references to partition.txt for the other binding documentation files. Let me know if you want me to do this.
Sounds lika a good idea, yes. This version is also fine with me though,
PATCH v3 2/3 ARM: kirkwood: Convert orion-nand to fdt
In reply to Jamie LentinQuoted 8 lines · Jamie Lentin
Convert orion-nand to use fdt and add common setup to
kirkwood.dtsi, including a default value for chip-delay (all current boards seem to use 25 anyway).Add placeholder documentation for the bindings, for someone more knowledgable than me to fill in the details of the properties.
Move common partition table documentation into a separate file and reference this.
Jamie,
This looks great! In addition to Arnd's comments, could you split this into two? The orion_nand dt bindings work, and kirkwood making use of it? It's not earth-shattering, but it helps folks on orion5x/dove/etc pull it in and try it without worrying about kirkwood.
Quoted 6 lines
Signed-off-by Jamie Lentin <[email protected]>---
Re-arranged documentation as you suggest, however it's tempting to have this as a separate patch and add references to partition.txt for the other binding documentation files. Let me know if you want me to do this.
If it's not too much trouble, this would be appreciated.
thx,
Jason.
Quoted 301 lines
Cheers for your help!
.../devicetree/bindings/mtd/mtd-physmap.txt | 24 +-------- .../devicetree/bindings/mtd/orion-nand.txt | 50 ++++++++++++++++++++ .../devicetree/bindings/mtd/partition.txt | 38 +++++++++++++++ arch/arm/boot/dts/kirkwood.dtsi | 15 ++++++- arch/arm/mach-kirkwood/common.c | 12 +++++ drivers/mtd/nand/orion_nand.c | 34 +++++++++++++- 6 files changed, 149 insertions(+), 24 deletions(-) create mode 100644 Documentation/devicetree/bindings/mtd/orion-nand.txt create mode 100644 Documentation/devicetree/bindings/mtd/partition.txtDocumentation/devicetree/bindings/mtd/mtd-physmap.txt +3
-21@@ -23,27 +23,9 @@ 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. +In addition to the information on the mtd bank itself, the device tree may +optionally contain additional sub-nodes describing partitions of the address +space. See partition.txt for more detail. Example: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 : +- ale : +- bank-width : +- chip-delay : + +In addition to the information on the mtd bank itself, the device tree may +optionally contain additional sub-nodes describing partitions of the address +space. See partition.txt for more detail. + +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>; + }; +};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>; + }; +];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 */ drivers/mtd/nand/orion_nand.c +32
-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,25 @@ 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 +150,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 +183,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 v2 3/3 ARM: kirkwood: Define NAND partitions in dts
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 = "ok"; }; + + nand at 3000000 { + status = "ok"; + + 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 = "ok"; }; + + nand at 3000000 { + status = "ok"; + + 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 v2 3/3 ARM: kirkwood: Define NAND partitions in dts
Quoted 4 lines · Jamie Lentin
Use devicetree to define NAND partitions. Use D-link partition scheme by default, to be vaguely compatible with their userland.
Signed-off-by Jamie Lentin <[email protected]>
PATCH v2 3/3 ARM: kirkwood: Define NAND partitions in dts
In reply to Jamie LentinQuoted 15 lines · Jamie Lentin
Use devicetree to define NAND partitions. Use D-link partition scheme by default, to be vaguely compatible with their userland.
Signed-off-by Jamie Lentin <[email protected]>--- 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 +0
-0
arch/arm/boot/dts/kirkwood-dns320.dts line 31
Quoted 7 lines
arch/arm/boot/dts/kirkwood-dns320.dts +4
-0@@ -25,5 +25,40 @@ clock-frequency = <166666667>; status = "ok"; }; + + nand at 3000000 { + status = "ok"; +
This should be "okay", not "ok" -- see IEEE1275. Or just leave it out.
-Scott
PATCH v2 3/3 ARM: kirkwood: Define NAND partitions in dts
Quoted 11 lines · Scott Wood
Quoted 10 lines · Jamie Lentin
Use devicetree to define NAND partitions. Use D-link partition scheme by default, to be vaguely compatible with their userland.
Signed-off-by Jamie Lentin <[email protected]>--- 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(-)
Quoted 14 lines
arch/arm/boot/dts/kirkwood-dns320.dts line 31
Quoted 12 lines
arch/arm/boot/dts/kirkwood-dns320.dts +4
-0@@ -25,5 +25,40 @@ clock-frequency = <166666667>; status = "ok"; }; + + nand at 3000000 { + status = "ok"; +This should be "okay", not "ok" -- see IEEE1275. Or just leave it out.
Ack, but it needs to be there. Most, but not all, kirkwood boards have nand, so we define it in kirkwood.dtsi and set it as disabled. Individual boards can then enable it as needed.
As for 'okay', looks like we may need to patch of_device_is_available() in drivers/of/base.c (~284) if we want to be consistent with IEEE1275.
The following boards would need to be updated:
arch/arm/boot/dts/kirkwood-dreamplug.dtsarch/powerpc/boot/dts/currituck.dtsarch/powerpc/boot/dts/iss4xx-mpic.dts
Grant, any thoughts on this?
thx,
Jason.
PATCH v2 3/3 ARM: kirkwood: Define NAND partitions in dts
Quoted 27 lines · Jason Cooper
Quoted 11 lines · Scott Wood
Quoted 10 lines · Jamie Lentin
Use devicetree to define NAND partitions. Use D-link partition scheme by default, to be vaguely compatible with their userland.
Signed-off-by Jamie Lentin <[email protected]>--- 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(-)Quoted 14 lines
arch/arm/boot/dts/kirkwood-dns320.dts line 31
Quoted 12 lines
arch/arm/boot/dts/kirkwood-dns320.dts +4
-0@@ -25,5 +25,40 @@ clock-frequency = <166666667>; status = "ok"; }; + + nand at 3000000 { + status = "ok"; +This should be "okay", not "ok" -- see IEEE1275. Or just leave it out.
Quoted 6 lines
Ack, but it needs to be there. Most, but not all, kirkwood boards have nand, so we define it in
kirkwood.dtsiand set it as disabled. Individual boards can then enable it as needed.As for 'okay', looks like we may need to patch
of_device_is_available()indrivers/of/base.c(~284) if we want to be consistent with IEEE1275.
No need to change of_device_is_available() -- it handles the standards-compliant "okay" as well as "ok" which is non-compliant but probably exists in some broken real OF trees (and even if not, it's bad to break compatibility with older device trees without a good reason).
Maybe add a comment indicating which should be used.
-Scott
PATCH v2 3/3 ARM: kirkwood: Define NAND partitions in dts
Quoted 35 lines · Scott Wood
Quoted 27 lines · Jason Cooper
Quoted 11 lines · Scott Wood
Quoted 10 lines · Jamie Lentin
Use devicetree to define NAND partitions. Use D-link partition scheme by default, to be vaguely compatible with their userland.
Signed-off-by Jamie Lentin <[email protected]>--- 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(-)Quoted 14 lines
arch/arm/boot/dts/kirkwood-dns320.dts line 31
Quoted 12 lines
arch/arm/boot/dts/kirkwood-dns320.dts +4
-0@@ -25,5 +25,40 @@ clock-frequency = <166666667>; status = "ok"; }; + + nand at 3000000 { + status = "ok"; +This should be "okay", not "ok" -- see IEEE1275. Or just leave it out.
Quoted 6 lines
Ack, but it needs to be there. Most, but not all, kirkwood boards have nand, so we define it in
kirkwood.dtsiand set it as disabled. Individual boards can then enable it as needed.As for 'okay', looks like we may need to patch
of_device_is_available()indrivers/of/base.c(~284) if we want to be consistent with IEEE1275.
Quoted 6 lines
No need to change
of_device_is_available()-- it handles the standards-compliant "okay" as well as "ok" which is non-compliant but probably exists in some broken real OF trees (and even if not, it's bad to break compatibility with older device trees without a good reason).Maybe add a comment indicating which should be used.
I need to re-jig this part anyway, so will update to "okay" too---looks like a fairly harmless change.
Would it make sense to change drivers/of/base.c to emit a warning if "ok" is used? Or are there already too many devicetrees in the wild that use "ok"?
Quoted 4 lines
-Scott
Signature · 1 line
Jamie Lentin
PATCH v2 3/3 ARM: kirkwood: Define NAND partitions in dts
Quoted 42 lines · Jamie Lentin
Quoted 40 lines · Scott Wood
Quoted 27 lines · Jason Cooper
Quoted 11 lines · Scott Wood
Quoted 10 lines · Jamie Lentin
Use devicetree to define NAND partitions. Use D-link partition scheme by default, to be vaguely compatible with their userland.
Signed-off-by Jamie Lentin <[email protected]>---
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(-)Quoted 14 lines
arch/arm/boot/dts/kirkwood-dns320.dts line 31
Quoted 12 lines
arch/arm/boot/dts/kirkwood-dns320.dts +4
-0@@ -25,5 +25,40 @@ clock-frequency = <166666667>; status = "ok"; }; + + nand at 3000000 { + status = "ok"; +This should be "okay", not "ok" -- see IEEE1275. Or just leave it out.
Quoted 6 lines
Ack, but it needs to be there. Most, but not all, kirkwood boards have nand, so we define it in
kirkwood.dtsiand set it as disabled. Individual boards can then enable it as needed.As for 'okay', looks like we may need to patch
of_device_is_available()indrivers/of/base.c(~284) if we want to be consistent with IEEE1275.No need to change
of_device_is_available()-- it handles the standards-compliant "okay" as well as "ok" which is non-compliant but probably exists in some broken real OF trees (and even if not, it's bad to break compatibility with older device trees without a good reason).
Quoted 8 lines
Quoted 1 line
Maybe add a comment indicating which should be used.
I need to re-jig this part anyway, so will update to "okay" too---looks like a fairly harmless change.
Would it make sense to change
drivers/of/base.cto emit a warning if "ok" is used? Or are there already too many devicetrees in the wild that use "ok"?
There's only two powerpc boards using this. I have a patch I'm about to submit that just adds a comment above the test. Since that's where I pulled "ok" from, that should prevent others in the future from repeating my mistake.
thx,
Jason.
PATCH 1/1 ARM: kirkwood: fdt: use IEEE1275 status = "okay".
In reply to Scott Wood---
- This should prevent others from making the same mistake I did when searching the code.
arch/arm/boot/dts/kirkwood-dreamplug.dts | 2 +- drivers/of/base.c | 1 + 2 files changed, 2 insertions(+), 1 deletions(-)
arch/arm/boot/dts/kirkwood-dreamplug.dts +1 -1
@@ -18,7 +18,7 @@ ocp at f1000000 { serial at 12000 { clock-frequency = <200000000>; - status = "ok"; + status = "okay"; }; }; };
drivers/of/base.c +1 -0
@@ -285,6 +285,7 @@ int of_device_is_available(const struct device_node *device)return 1 ;if (statlen >0 ) { +/* new boards should use "okay" according to IEEE1275 */ if (!strcmp (status,"okay" ) || !strcmp (status,"ok" ))return 1 ; }
Signature · 1 line
1.7.3.4