All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] ARM: dts: orion5x: add device tree for kurobox-pro
@ 2016-03-22 14:28 Roger Shimizu
  2016-03-22 16:42 ` Andrew Lunn
  2016-03-29 16:11 ` [PATCH v2] " Roger Shimizu
  0 siblings, 2 replies; 9+ messages in thread
From: Roger Shimizu @ 2016-03-22 14:28 UTC (permalink / raw)
  To: linux-arm-kernel

Add dts file to support Buffalo/Revogear Kurobox-Pro, which is marvell
orion5x based 3.5" HDD NAS.

It's a quite old product and already discontinued. So there's no
official website for it. But it was an early product which used marvell
orion5x 88F5182 chipset, it's popular in the community.
Some unofficial site:
  - http://buffalo.nas-central.org/wiki/Category:KuroboxPro
  - http://nice.kaze.com/KUROPRO_ProductSpecifications.pdf

This device tree is based on the board file:
  arch/arm/mach-orion5x/kurobox_pro-setup.c
However, the NAND device, which is supported by board file, is not
supported by device tree yet. So I still want to keep the board file
for the time being.

Signed-off-by: Roger Shimizu <rogershimizu@gmail.com>
---
 arch/arm/boot/dts/Makefile               |   1 +
 arch/arm/boot/dts/orion5x-kuroboxpro.dts | 113 +++++++++++++++++++++++++++++++
 2 files changed, 114 insertions(+)
 create mode 100644 arch/arm/boot/dts/orion5x-kuroboxpro.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 52b34a0..de1d67a 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -521,6 +521,7 @@ dtb-$(CONFIG_SOC_DRA7XX) += \
 	dra7-evm.dtb \
 	dra72-evm.dtb
 dtb-$(CONFIG_ARCH_ORION5X) += \
+	orion5x-kuroboxpro.dtb \
 	orion5x-lacie-d2-network.dtb \
 	orion5x-lacie-ethernet-disk-mini-v2.dtb \
 	orion5x-linkstation-lsgl.dtb \
diff --git a/arch/arm/boot/dts/orion5x-kuroboxpro.dts b/arch/arm/boot/dts/orion5x-kuroboxpro.dts
new file mode 100644
index 0000000..c626ddd
--- /dev/null
+++ b/arch/arm/boot/dts/orion5x-kuroboxpro.dts
@@ -0,0 +1,113 @@
+/*
+ * Device Tree file for Buffalo/Revogear Kurobox Pro
+ *
+ * Copyright (C) 2016
+ * Roger Shimizu <rogershimizu@gmail.com>
+ *
+ * Based on the board file arch/arm/mach-orion5x/kurobox_pro-setup.c
+ * Copyright (C) Ronen Shitrit <rshitrit@marvell.com>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This file is distributed in the hope that it will be useful
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED , WITHOUT WARRANTY OF ANY KIND
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+
+#include "orion5x-linkstation.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+	model = "Buffalo/Revogear Kurobox Pro";
+	compatible = "buffalo,kurobox-pro", "marvell,orion5x-88f5182", "marvell,orion5x";
+
+	soc {
+		ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000>,
+				 <MBUS_ID(0x09, 0x00) 0 0xf2200000 0x800>,
+				 <MBUS_ID(0x01, 0x0f) 0 0xf4000000 0x40000>,
+				 <MBUS_ID(0x01, 0x1e) 0 0xfc000000 0x1000000>;
+	};
+
+	memory { /* 128 MB */
+		device_type = "memory";
+		reg = <0x00000000 0x8000000>;
+	};
+};
+
+&pinctrl {
+	pmx_power_hdd: pmx-power-hdd {
+		marvell,pins = "mpp1";
+		marvell,function = "gpio";
+	};
+
+	pmx_power_usb: pmx-power-usb {
+		marvell,pins = "mpp9";
+		marvell,function = "gpio";
+	};
+};
+
+&devbus_cs0 {
+	status = "disabled";
+	devbus,keep-config;
+
+	/* According to board file: arch/arm/mach-orion5x/kurobox_pro-setup.c
+	 * There's a NAND flash on Device Bus CS0, but it fails on probing,
+	 * so it's disabled here.
+	 */
+
+	flash at 0 {
+		compatible = "cfi-flash";
+		reg = <0 0x1000000>;
+		bank-width = <1>;
+	};
+};
+
+&hdd_power {
+	gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>;
+};
+
+&usb_power {
+	gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>;
+};
+
+&sata {
+	nr-ports = <2>;
+};
+
+&ehci1 {
+	status = "okay";
+};
-- 
2.7.0

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH] ARM: dts: orion5x: add device tree for kurobox-pro
  2016-03-22 14:28 [PATCH] ARM: dts: orion5x: add device tree for kurobox-pro Roger Shimizu
@ 2016-03-22 16:42 ` Andrew Lunn
  2016-03-22 22:54   ` Roger Shimizu
  2016-03-29 16:11 ` [PATCH v2] " Roger Shimizu
  1 sibling, 1 reply; 9+ messages in thread
From: Andrew Lunn @ 2016-03-22 16:42 UTC (permalink / raw)
  To: linux-arm-kernel

On Tue, Mar 22, 2016 at 11:28:18PM +0900, Roger Shimizu wrote:
> Add dts file to support Buffalo/Revogear Kurobox-Pro, which is marvell
> orion5x based 3.5" HDD NAS.
> 
> It's a quite old product and already discontinued. So there's no
> official website for it. But it was an early product which used marvell
> orion5x 88F5182 chipset, it's popular in the community.
> Some unofficial site:
>   - http://buffalo.nas-central.org/wiki/Category:KuroboxPro
>   - http://nice.kaze.com/KUROPRO_ProductSpecifications.pdf
> 
> This device tree is based on the board file:
>   arch/arm/mach-orion5x/kurobox_pro-setup.c

Hi Roger

This looks good, but lets try to figure out the NAND.

> However, the NAND device, which is supported by board file, is not
> supported by device tree yet. So I still want to keep the board file
> for the time being.

> +&devbus_cs0 {
> +	status = "disabled";
> +	devbus,keep-config;
> +
> +	/* According to board file: arch/arm/mach-orion5x/kurobox_pro-setup.c
> +	 * There's a NAND flash on Device Bus CS0, but it fails on probing,
> +	 * so it's disabled here.
> +	 */
> +
> +	flash at 0 {
> +		compatible = "cfi-flash";
> +		reg = <0 0x1000000>;
> +		bank-width = <1>;
> +	};
> +};

kurobox_pro-setup.c says:

/*
 * 256K NOR flash Device bus boot chip select
 */

#define KUROBOX_PRO_NOR_BOOT_BASE       0xf4000000
#define KUROBOX_PRO_NOR_BOOT_SIZE       SZ_256K

/*
 * 256M NAND flash on Device bus chip select 1
 */

#define KUROBOX_PRO_NAND_BASE           0xfc000000
#define KUROBOX_PRO_NAND_SIZE           SZ_2M

So there is a NOR on CS0, not NAND.

static struct platform_device kurobox_pro_nand_flash = {
        .name           = "orion_nand",
        .id             = -1,
        .dev            = {
                .platform_data  = &kurobox_pro_nand_data,
        },
        .resource       = &kurobox_pro_nand_resource,
        .num_resources  = 1,
};

The name "orion_nand" means this fits with the driver:

drivers/mtd/nand/orion_nand.c:

static struct platform_driver orion_nand_driver = {
        .remove         = orion_nand_remove,
        .driver         = {
                .name   = "orion_nand",
                .of_match_table = of_match_ptr(orion_nand_of_match_table),
        },
};

And this uses compatible string         { .compatible = "marvell,orion-nand", },

We need to add this to the dts file. The kirkwood.dtsi might be a good
example to copy.

	Andrew

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] ARM: dts: orion5x: add device tree for kurobox-pro
  2016-03-22 16:42 ` Andrew Lunn
@ 2016-03-22 22:54   ` Roger Shimizu
  2016-03-23  2:12     ` Andrew Lunn
  0 siblings, 1 reply; 9+ messages in thread
From: Roger Shimizu @ 2016-03-22 22:54 UTC (permalink / raw)
  To: linux-arm-kernel

Dear Andrew,

Thanks for your review!

On Wed, Mar 23, 2016 at 1:42 AM, Andrew Lunn <andrew@lunn.ch> wrote:
> On Tue, Mar 22, 2016 at 11:28:18PM +0900, Roger Shimizu wrote:
>> Add dts file to support Buffalo/Revogear Kurobox-Pro, which is marvell
>> orion5x based 3.5" HDD NAS.
>>
>> It's a quite old product and already discontinued. So there's no
>> official website for it. But it was an early product which used marvell
>> orion5x 88F5182 chipset, it's popular in the community.
>> Some unofficial site:
>>   - http://buffalo.nas-central.org/wiki/Category:KuroboxPro
>>   - http://nice.kaze.com/KUROPRO_ProductSpecifications.pdf
>>
>> This device tree is based on the board file:
>>   arch/arm/mach-orion5x/kurobox_pro-setup.c
>
> Hi Roger
>
> This looks good, but lets try to figure out the NAND.
>
>> However, the NAND device, which is supported by board file, is not
>> supported by device tree yet. So I still want to keep the board file
>> for the time being.
>
>> +&devbus_cs0 {
>> +     status = "disabled";
>> +     devbus,keep-config;
>> +
>> +     /* According to board file: arch/arm/mach-orion5x/kurobox_pro-setup.c
>> +      * There's a NAND flash on Device Bus CS0, but it fails on probing,
>> +      * so it's disabled here.
>> +      */
>> +
>> +     flash at 0 {
>> +             compatible = "cfi-flash";
>> +             reg = <0 0x1000000>;
>> +             bank-width = <1>;
>> +     };
>> +};
>
> kurobox_pro-setup.c says:
>
> /*
>  * 256K NOR flash Device bus boot chip select
>  */
>
> #define KUROBOX_PRO_NOR_BOOT_BASE       0xf4000000
> #define KUROBOX_PRO_NOR_BOOT_SIZE       SZ_256K
>
> /*
>  * 256M NAND flash on Device bus chip select 1
>  */
>
> #define KUROBOX_PRO_NAND_BASE           0xfc000000
> #define KUROBOX_PRO_NAND_SIZE           SZ_2M
>
> So there is a NOR on CS0, not NAND.

The NOR is on Device Bus Boot, which described in
orion5x-linkstation.dtsi and is the probed OK:

[    1.843221] Found: SST 39LF020
[    1.846391] f4000000.flash: Found 1 x8 devices at 0x0 in 8-bit bank
[    1.852715] number of JEDEC chips: 1
[    1.872860] 3 ofpart partitions found on MTD device f4000000.flash
[    1.879122] Creating 3 MTD partitions on "f4000000.flash":
[    1.884697] 0x000000000000-0x000000030000 : "header"
[    1.893209] 0x000000030000-0x00000003f000 : "uboot"
[    1.901671] 0x00000003f000-0x000000040000 : "uboot_env"


The NAND, which is on Device Bus CS0, has probing issue. I only can
have it probed by the board file:

[    8.698762] nand: device found, Manufacturer ID: 0x20, Chip ID: 0xda
[    8.705194] nand: ST Micro NAND 256MiB 3,3V 8-bit
[    8.709953] nand: 256 MiB, SLC, erase size: 128 KiB, page size:
2048, OOB size: 64
[    8.717619] Scanning device for bad blocks
[    8.782220] Bad eraseblock 1530 at 0x00000bf40000
[    8.794409] Bad eraseblock 1718 at 0x00000d6c0000
[    8.806717] Bad eraseblock 1909 at 0x00000eea0000
[    8.816968] Creating 3 MTD partitions on "orion_nand":
[    8.822169] 0x000000000000-0x000000400000 : "uImage"
[    8.830605] 0x000000400000-0x000004400000 : "rootfs"
[    8.839497] 0x000004400000-0x000010000000 : "extra"

> static struct platform_device kurobox_pro_nand_flash = {
>         .name           = "orion_nand",
>         .id             = -1,
>         .dev            = {
>                 .platform_data  = &kurobox_pro_nand_data,
>         },
>         .resource       = &kurobox_pro_nand_resource,
>         .num_resources  = 1,
> };
>
> The name "orion_nand" means this fits with the driver:
>
> drivers/mtd/nand/orion_nand.c:
>
> static struct platform_driver orion_nand_driver = {
>         .remove         = orion_nand_remove,
>         .driver         = {
>                 .name   = "orion_nand",
>                 .of_match_table = of_match_ptr(orion_nand_of_match_table),
>         },
> };
>
> And this uses compatible string         { .compatible = "marvell,orion-nand", },
>
> We need to add this to the dts file. The kirkwood.dtsi might be a good
> example to copy.

I already tried to use 'compatible = "marvell,orion-nand"' in flash
block of devbus_cs0 part, but with no luck.

So you mean I need to refer the nand block in mbus part in kirkwood.dtsi?

        nand: nand at 012f {
            #address-cells = <1>;
            #size-cells = <1>;
            cle = <0>;
            ale = <1>;
            bank-width = <1>;
            compatible = "marvell,orion-nand";
            reg = <MBUS_ID(0x01, 0x2f) 0 0x400>;
            chip-delay = <25>;
            /* set partition map and/or chip-delay in board dts */
            clocks = <&gate_clk 7>;
            pinctrl-0 = <&pmx_nand>;
            pinctrl-names = "default";
            status = "disabled";
        };

The difficulty for me is I have no idea on
- which clock to use
- which mpp pin to use
- how to set these address

And anohter question is, so the NAND is actually on mbus/nand, not
Device Bus CS0?
I say CS0 because it's described in board file, which may be wrong?

Thank you!

Cheers,
-- 
Roger Shimizu, GMT +9 Tokyo
PGP/GPG: 17B3ACB1

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] ARM: dts: orion5x: add device tree for kurobox-pro
  2016-03-22 22:54   ` Roger Shimizu
@ 2016-03-23  2:12     ` Andrew Lunn
  2016-03-23 10:38       ` Roger Shimizu
  0 siblings, 1 reply; 9+ messages in thread
From: Andrew Lunn @ 2016-03-23  2:12 UTC (permalink / raw)
  To: linux-arm-kernel

> > kurobox_pro-setup.c says:
> >
> > /*
> >  * 256K NOR flash Device bus boot chip select
> >  */
> >
> > #define KUROBOX_PRO_NOR_BOOT_BASE       0xf4000000
> > #define KUROBOX_PRO_NOR_BOOT_SIZE       SZ_256K
> >
> > /*
> >  * 256M NAND flash on Device bus chip select 1
> >  */
> >
> > #define KUROBOX_PRO_NAND_BASE           0xfc000000
> > #define KUROBOX_PRO_NAND_SIZE           SZ_2M
> >
> > So there is a NOR on CS0, not NAND.
> 
> The NOR is on Device Bus Boot, which described in
> orion5x-linkstation.dtsi and is the probed OK:
> 
> [    1.843221] Found: SST 39LF020
> [    1.846391] f4000000.flash: Found 1 x8 devices at 0x0 in 8-bit bank
> [    1.852715] number of JEDEC chips: 1
> [    1.872860] 3 ofpart partitions found on MTD device f4000000.flash
> [    1.879122] Creating 3 MTD partitions on "f4000000.flash":
> [    1.884697] 0x000000000000-0x000000030000 : "header"
> [    1.893209] 0x000000030000-0x00000003f000 : "uboot"
> [    1.901671] 0x00000003f000-0x000000040000 : "uboot_env"
> 
> 
> The NAND, which is on Device Bus CS0, has probing issue. I only can
> have it probed by the board file:

The comment on the board file says chip select 1, not 0.

> So you mean I need to refer the nand block in mbus part in
> kirkwood.dtsi?
 
>         nand: nand at 012f {
>             #address-cells = <1>;
>             #size-cells = <1>;
>             cle = <0>;
>             ale = <1>;
>             bank-width = <1>;
>             compatible = "marvell,orion-nand";
>             reg = <MBUS_ID(0x01, 0x2f) 0 0x400>;
>             chip-delay = <25>;
>             /* set partition map and/or chip-delay in board dts */
>             clocks = <&gate_clk 7>;
>             pinctrl-0 = <&pmx_nand>;
>             pinctrl-names = "default";
>             status = "disabled";
>         };
> 
> The difficulty for me is I have no idea on
> - which clock to use

Orion5x does not have a specific clocks for peripherals. In this case,
the clock is not needed.

> - which mpp pin to use

You need to define a pinmux configuration. Looking at the board file,
we have:

        MPP6_NAND,              /* NAND Flash REn */
        MPP7_NAND,              /* NAND Flash WEn */

So you can add a node to orion5x-mv88f5182.dtsi containing these two
pins.

> - how to set these address

Not so sure here. The data sheet says CS1 uses Target Interface ID 1,
Target Interface Attribute 0x1d.

In the soc ranges you want

reg = <MBUS_ID(0x01, 0x1d) 0 0xfc000000 0x1000000>

and in the nand node

reg = <MBUS_ID(0x01, 0x2f) 0 0x200000>;

    Andrew

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] ARM: dts: orion5x: add device tree for kurobox-pro
  2016-03-23  2:12     ` Andrew Lunn
@ 2016-03-23 10:38       ` Roger Shimizu
  2016-03-28 11:09         ` Roger Shimizu
  0 siblings, 1 reply; 9+ messages in thread
From: Roger Shimizu @ 2016-03-23 10:38 UTC (permalink / raw)
  To: linux-arm-kernel

Dear Andrew,

Thanks for your informative feedback!

On Wed, Mar 23, 2016 at 11:12 AM, Andrew Lunn <andrew@lunn.ch> wrote:
>>
>> The NAND, which is on Device Bus CS0, has probing issue. I only can
>> have it probed by the board file:
>
> The comment on the board file says chip select 1, not 0.

Yes, the board file states both:

 * 256M NAND flash on Device bus chip select 1

and:

 * 256MB NAND Flash on Device bus CS0

I guessed CS0, but maybe I was wrong ... (there's my final conclusion
in this post end)

>>
>> The difficulty for me is I have no idea on
>> - which clock to use
>
> Orion5x does not have a specific clocks for peripherals. In this case,
> the clock is not needed.
>
>> - which mpp pin to use
>
> You need to define a pinmux configuration. Looking at the board file,
> we have:
>
>         MPP6_NAND,              /* NAND Flash REn */
>         MPP7_NAND,              /* NAND Flash WEn */
>

After a few test, I found it's okay WITHOUT clock and MPP setting.

The devbus_cs0 looks like:

&devbus_cs0 {
    status = "okay";
    compatible = "marvell,orion-nand";
    reg = <MBUS_ID(0x01, 0x1e) 0 0x400>;
    cle = <0>;
    ale = <1>;
    bank-width = <1>;

    partitions {
        compatible = "fixed-partitions";
        #address-cells = <1>;
        #size-cells = <1>;

        uImage at 0 {
            reg = <0 0x400000>;
            read-only;
        };

        rootfs at 400000 {
            reg = <0x400000 0x4000000>;
            read-only;
        };

        extra at 4400000 {
            reg = <0x4400000 0xBC00000>;
            read-only;
        };
    };
};

This probes alright.

[    1.793575] nand: device found, Manufacturer ID: 0x20, Chip ID: 0xda
[    1.800006] nand: ST Micro NAND 256MiB 3,3V 8-bit
[    1.804765] nand: 256 MiB, SLC, erase size: 128 KiB, page size:
2048, OOB size: 64
[    1.812384] Scanning device for bad blocks
[    1.876876] Bad eraseblock 1530 at 0x00000bf40000
[    1.889048] Bad eraseblock 1718 at 0x00000d6c0000
[    1.901338] Bad eraseblock 1909 at 0x00000eea0000
[    1.911572] 3 ofpart partitions found on MTD device orion_nand
[    1.917452] Creating 3 MTD partitions on "orion_nand":
[    1.922648] 0x000000000000-0x000000400000 : "uImage"
[    1.931186] 0x000000400000-0x000004400000 : "rootfs"
[    1.940139] 0x000004400000-0x000010000000 : "extra"

> So you can add a node to orion5x-mv88f5182.dtsi containing these two
> pins.
>
>> - how to set these address
>
> Not so sure here. The data sheet says CS1 uses Target Interface ID 1,
> Target Interface Attribute 0x1d.
>
> In the soc ranges you want
>
> reg = <MBUS_ID(0x01, 0x1d) 0 0xfc000000 0x1000000>
>
> and in the nand node
>
> reg = <MBUS_ID(0x01, 0x2f) 0 0x200000>;

I also tested using "devbus_cs1" with address "<MBUS_ID(0x01, 0x1d) 0
0x400>", but with no luck. The kernel loops output full screens of
"Bad eraseblock XXXX at 0xYYYY" for minutes before I forcely shutdown
the device.

So it's almost sure that the NAND is on Device Bus CS0.

And I have another question.
Currently kernel probes NAND first (mtd{0,1,2}), and then jedec-flash
device (mtd{3,4,5}).
Can I change something in device tree to make jedec-flash first and then NAND?

Here I paste the kernel log of jedec-flash:

[    2.000951] Found: SST 39LF020
[    2.004036] f4000000.flash: Found 1 x8 devices at 0x0 in 8-bit bank
[    2.010394] number of JEDEC chips: 1
[    2.030787] 3 ofpart partitions found on MTD device f4000000.flash
[    2.037066] Creating 3 MTD partitions on "f4000000.flash":
[    2.042649] 0x000000000000-0x000000030000 : "header"
[    2.051040] 0x000000030000-0x00000003f000 : "uboot"
[    2.059362] 0x00000003f000-0x000000040000 : "uboot_env"

Thank you!

-- 
Roger Shimizu, GMT +9 Tokyo
PGP/GPG: 17B3ACB1

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH] ARM: dts: orion5x: add device tree for kurobox-pro
  2016-03-23 10:38       ` Roger Shimizu
@ 2016-03-28 11:09         ` Roger Shimizu
  0 siblings, 0 replies; 9+ messages in thread
From: Roger Shimizu @ 2016-03-28 11:09 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Mar 23, 2016 at 7:38 PM, Roger Shimizu <rogershimizu@gmail.com> wrote:
>
> After a few test, I found it's okay WITHOUT clock and MPP setting.
>
> The devbus_cs0 looks like:
>
> &devbus_cs0 {
>     status = "okay";
>     compatible = "marvell,orion-nand";
>     reg = <MBUS_ID(0x01, 0x1e) 0 0x400>;
>     cle = <0>;
>     ale = <1>;
>     bank-width = <1>;
>
>     partitions {
>         compatible = "fixed-partitions";
>         #address-cells = <1>;
>         #size-cells = <1>;
>
>         uImage at 0 {
>             reg = <0 0x400000>;
>             read-only;
>         };
>
>         rootfs at 400000 {
>             reg = <0x400000 0x4000000>;
>             read-only;
>         };
>
>         extra at 4400000 {
>             reg = <0x4400000 0xBC00000>;
>             read-only;
>         };
>     };
> };
>
> This probes alright.
>
> [    1.793575] nand: device found, Manufacturer ID: 0x20, Chip ID: 0xda
> [    1.800006] nand: ST Micro NAND 256MiB 3,3V 8-bit
> [    1.804765] nand: 256 MiB, SLC, erase size: 128 KiB, page size:
> 2048, OOB size: 64
> [    1.812384] Scanning device for bad blocks
> [    1.876876] Bad eraseblock 1530 at 0x00000bf40000
> [    1.889048] Bad eraseblock 1718 at 0x00000d6c0000
> [    1.901338] Bad eraseblock 1909 at 0x00000eea0000
> [    1.911572] 3 ofpart partitions found on MTD device orion_nand
> [    1.917452] Creating 3 MTD partitions on "orion_nand":
> [    1.922648] 0x000000000000-0x000000400000 : "uImage"
> [    1.931186] 0x000000400000-0x000004400000 : "rootfs"
> [    1.940139] 0x000004400000-0x000010000000 : "extra"
>
>> So you can add a node to orion5x-mv88f5182.dtsi containing these two
>> pins.
>>
>>> - how to set these address
>>
>> Not so sure here. The data sheet says CS1 uses Target Interface ID 1,
>> Target Interface Attribute 0x1d.
>>
>> In the soc ranges you want
>>
>> reg = <MBUS_ID(0x01, 0x1d) 0 0xfc000000 0x1000000>
>>
>> and in the nand node
>>
>> reg = <MBUS_ID(0x01, 0x2f) 0 0x200000>;
>
> I also tested using "devbus_cs1" with address "<MBUS_ID(0x01, 0x1d) 0
> 0x400>", but with no luck. The kernel loops output full screens of
> "Bad eraseblock XXXX at 0xYYYY" for minutes before I forcely shutdown
> the device.
>
> So it's almost sure that the NAND is on Device Bus CS0.
>
> And I have another question.
> Currently kernel probes NAND first (mtd{0,1,2}), and then jedec-flash
> device (mtd{3,4,5}).
> Can I change something in device tree to make jedec-flash first and then NAND?
>
> Here I paste the kernel log of jedec-flash:
>
> [    2.000951] Found: SST 39LF020
> [    2.004036] f4000000.flash: Found 1 x8 devices at 0x0 in 8-bit bank
> [    2.010394] number of JEDEC chips: 1
> [    2.030787] 3 ofpart partitions found on MTD device f4000000.flash
> [    2.037066] Creating 3 MTD partitions on "f4000000.flash":
> [    2.042649] 0x000000000000-0x000000030000 : "header"
> [    2.051040] 0x000000030000-0x00000003f000 : "uboot"
> [    2.059362] 0x00000003f000-0x000000040000 : "uboot_env"

Dear Andrew,

Could you kindly help to comment, especially the final part, whether
we can have jedec-flash first?
So I can proceed the patch v2.

Thank you and looking forward to your reply!

Cheers,
-- 
Roger Shimizu, GMT +9 Tokyo
PGP/GPG: 17B3ACB1

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2] ARM: dts: orion5x: add device tree for kurobox-pro
  2016-03-22 14:28 [PATCH] ARM: dts: orion5x: add device tree for kurobox-pro Roger Shimizu
  2016-03-22 16:42 ` Andrew Lunn
@ 2016-03-29 16:11 ` Roger Shimizu
  2016-04-04 12:35   ` Andrew Lunn
  1 sibling, 1 reply; 9+ messages in thread
From: Roger Shimizu @ 2016-03-29 16:11 UTC (permalink / raw)
  To: linux-arm-kernel

Add dts file to support Buffalo/Revogear Kurobox-Pro, which is marvell
orion5x based 3.5" HDD NAS.

It's a quite old product and already discontinued. So there's no
official website for it. But it was an early product which used marvell
orion5x 88F5182 chipset, it's popular in the community.
Some unofficial site:
  - http://buffalo.nas-central.org/wiki/Category:KuroboxPro
  - http://nice.kaze.com/KUROPRO_ProductSpecifications.pdf

This device tree is based on the board file:
  arch/arm/mach-orion5x/kurobox_pro-setup.c
However, the probing order of NAND and JEDEC-Flash are different from
the original board file, this results in incompatible minor number
for a few /dev/mtdX and /dev/mtdblockX devices.
So I still want to keep the board file for the time being.

Signed-off-by: Roger Shimizu <rogershimizu@gmail.com>
---
Change in v2:
  - The NAND device on devbus CS0 becomes able to probe

 arch/arm/boot/dts/Makefile               |   1 +
 arch/arm/boot/dts/orion5x-kuroboxpro.dts | 127 +++++++++++++++++++++++++++++++
 2 files changed, 128 insertions(+)
 create mode 100644 arch/arm/boot/dts/orion5x-kuroboxpro.dts

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 52b34a0..de1d67a 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -521,6 +521,7 @@ dtb-$(CONFIG_SOC_DRA7XX) += \
 	dra7-evm.dtb \
 	dra72-evm.dtb
 dtb-$(CONFIG_ARCH_ORION5X) += \
+	orion5x-kuroboxpro.dtb \
 	orion5x-lacie-d2-network.dtb \
 	orion5x-lacie-ethernet-disk-mini-v2.dtb \
 	orion5x-linkstation-lsgl.dtb \
diff --git a/arch/arm/boot/dts/orion5x-kuroboxpro.dts b/arch/arm/boot/dts/orion5x-kuroboxpro.dts
new file mode 100644
index 0000000..1a672b0
--- /dev/null
+++ b/arch/arm/boot/dts/orion5x-kuroboxpro.dts
@@ -0,0 +1,127 @@
+/*
+ * Device Tree file for Buffalo/Revogear Kurobox Pro
+ *
+ * Copyright (C) 2016
+ * Roger Shimizu <rogershimizu@gmail.com>
+ *
+ * Based on the board file arch/arm/mach-orion5x/kurobox_pro-setup.c
+ * Copyright (C) Ronen Shitrit <rshitrit@marvell.com>
+ *
+ * This file is dual-licensed: you can use it either under the terms
+ * of the GPL or the X11 license, at your option. Note that this dual
+ * licensing only applies to this file, and not this project as a
+ * whole.
+ *
+ *  a) This file is free software; you can redistribute it and/or
+ *     modify it under the terms of the GNU General Public License as
+ *     published by the Free Software Foundation; either version 2 of the
+ *     License, or (at your option) any later version.
+ *
+ *     This file is distributed in the hope that it will be useful
+ *     but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *     GNU General Public License for more details.
+ *
+ * Or, alternatively
+ *
+ *  b) Permission is hereby granted, free of charge, to any person
+ *     obtaining a copy of this software and associated documentation
+ *     files (the "Software"), to deal in the Software without
+ *     restriction, including without limitation the rights to use
+ *     copy, modify, merge, publish, distribute, sublicense, and/or
+ *     sell copies of the Software, and to permit persons to whom the
+ *     Software is furnished to do so, subject to the following
+ *     conditions:
+ *
+ *     The above copyright notice and this permission notice shall be
+ *     included in all copies or substantial portions of the Software.
+ *
+ *     THE SOFTWARE IS PROVIDED , WITHOUT WARRANTY OF ANY KIND
+ *     EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
+ *     OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
+ *     NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
+ *     HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY
+ *     WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+ *     FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
+ *     OTHER DEALINGS IN THE SOFTWARE.
+ */
+
+/dts-v1/;
+
+#include "orion5x-linkstation.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+
+/ {
+	model = "Buffalo/Revogear Kurobox Pro";
+	compatible = "buffalo,kurobox-pro", "marvell,orion5x-88f5182", "marvell,orion5x";
+
+	soc {
+		ranges = <MBUS_ID(0xf0, 0x01) 0 0xf1000000 0x100000>,
+				 <MBUS_ID(0x09, 0x00) 0 0xf2200000 0x800>,
+				 <MBUS_ID(0x01, 0x0f) 0 0xf4000000 0x40000>,
+				 <MBUS_ID(0x01, 0x1e) 0 0xfc000000 0x1000000>;
+	};
+
+	memory { /* 128 MB */
+		device_type = "memory";
+		reg = <0x00000000 0x8000000>;
+	};
+};
+
+&pinctrl {
+	pmx_power_hdd: pmx-power-hdd {
+		marvell,pins = "mpp1";
+		marvell,function = "gpio";
+	};
+
+	pmx_power_usb: pmx-power-usb {
+		marvell,pins = "mpp9";
+		marvell,function = "gpio";
+	};
+};
+
+&devbus_cs0 {
+	status = "okay";
+	compatible = "marvell,orion-nand";
+	reg = <MBUS_ID(0x01, 0x1e) 0 0x400>;
+	cle = <0>;
+	ale = <1>;
+	bank-width = <1>;
+
+	partitions {
+		compatible = "fixed-partitions";
+		#address-cells = <1>;
+		#size-cells = <1>;
+
+		uImage at 0 { /* 4 MB */
+			reg = <0 0x400000>;
+			read-only;
+		};
+
+		rootfs at 400000 { /* 64 MB */
+			reg = <0x400000 0x4000000>;
+			read-only;
+		};
+
+		extra at 4400000 { /* 188 MB */
+			reg = <0x4400000 0xBC00000>;
+			read-only;
+		};
+	};
+};
+
+&hdd_power {
+	gpios = <&gpio0 1 GPIO_ACTIVE_HIGH>;
+};
+
+&usb_power {
+	gpios = <&gpio0 9 GPIO_ACTIVE_HIGH>;
+};
+
+&sata {
+	nr-ports = <2>;
+};
+
+&ehci1 {
+	status = "okay";
+};
-- 
2.8.0.rc3

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [PATCH v2] ARM: dts: orion5x: add device tree for kurobox-pro
  2016-03-29 16:11 ` [PATCH v2] " Roger Shimizu
@ 2016-04-04 12:35   ` Andrew Lunn
  2016-04-07 22:09     ` Gregory CLEMENT
  0 siblings, 1 reply; 9+ messages in thread
From: Andrew Lunn @ 2016-04-04 12:35 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Mar 30, 2016 at 01:11:45AM +0900, Roger Shimizu wrote:
> Add dts file to support Buffalo/Revogear Kurobox-Pro, which is marvell
> orion5x based 3.5" HDD NAS.
> 
> It's a quite old product and already discontinued. So there's no
> official website for it. But it was an early product which used marvell
> orion5x 88F5182 chipset, it's popular in the community.
> Some unofficial site:
>   - http://buffalo.nas-central.org/wiki/Category:KuroboxPro
>   - http://nice.kaze.com/KUROPRO_ProductSpecifications.pdf
> 
> This device tree is based on the board file:
>   arch/arm/mach-orion5x/kurobox_pro-setup.c
> However, the probing order of NAND and JEDEC-Flash are different from
> the original board file, this results in incompatible minor number
> for a few /dev/mtdX and /dev/mtdblockX devices.
> So I still want to keep the board file for the time being.
> 
> Signed-off-by: Roger Shimizu <rogershimizu@gmail.com>

Hi Roger

Looks good:

Reviewed-by: Andrew Lunn <andrew@lunn.ch>

	     Andrew

^ permalink raw reply	[flat|nested] 9+ messages in thread

* [PATCH v2] ARM: dts: orion5x: add device tree for kurobox-pro
  2016-04-04 12:35   ` Andrew Lunn
@ 2016-04-07 22:09     ` Gregory CLEMENT
  0 siblings, 0 replies; 9+ messages in thread
From: Gregory CLEMENT @ 2016-04-07 22:09 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Roger,
 
 On lun., avril 04 2016, Andrew Lunn <andrew@lunn.ch> wrote:

> On Wed, Mar 30, 2016 at 01:11:45AM +0900, Roger Shimizu wrote:
>> Add dts file to support Buffalo/Revogear Kurobox-Pro, which is marvell
>> orion5x based 3.5" HDD NAS.
>> 
>> It's a quite old product and already discontinued. So there's no
>> official website for it. But it was an early product which used marvell
>> orion5x 88F5182 chipset, it's popular in the community.
>> Some unofficial site:
>>   - http://buffalo.nas-central.org/wiki/Category:KuroboxPro
>>   - http://nice.kaze.com/KUROPRO_ProductSpecifications.pdf
>> 
>> This device tree is based on the board file:
>>   arch/arm/mach-orion5x/kurobox_pro-setup.c
>> However, the probing order of NAND and JEDEC-Flash are different from
>> the original board file, this results in incompatible minor number
>> for a few /dev/mtdX and /dev/mtdblockX devices.
>> So I still want to keep the board file for the time being.
>> 
>> Signed-off-by: Roger Shimizu <rogershimizu@gmail.com>
>
> Hi Roger
>
> Looks good:
>
> Reviewed-by: Andrew Lunn <andrew@lunn.ch>


Applied on mvebu/dt

Thanks,

Gregory


>
> 	     Andrew

-- 
Gregory Clement, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2016-04-07 22:09 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-03-22 14:28 [PATCH] ARM: dts: orion5x: add device tree for kurobox-pro Roger Shimizu
2016-03-22 16:42 ` Andrew Lunn
2016-03-22 22:54   ` Roger Shimizu
2016-03-23  2:12     ` Andrew Lunn
2016-03-23 10:38       ` Roger Shimizu
2016-03-28 11:09         ` Roger Shimizu
2016-03-29 16:11 ` [PATCH v2] " Roger Shimizu
2016-04-04 12:35   ` Andrew Lunn
2016-04-07 22:09     ` Gregory CLEMENT

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.