diff mbox

PATCH Add support for the Iomega IX2-200 Device Tree

Message ID CADhrpJ5JEGQWAjwu5+=Hy_gFjWLkkrzj9E0dZ-vxMk9x+M5uCA@mail.gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

alan butler Aug. 15, 2012, 6 p.m. UTC
On 15 August 2012 14:54, Jason Cooper <jason@lakedaemon.net> wrote:
> On Wed, Aug 15, 2012 at 01:43:24PM +0100, alan butler wrote:
>> On 15 August 2012 13:11, Jason Cooper <jason@lakedaemon.net> wrote:
>> > On Wed, Aug 15, 2012 at 07:55:42AM -0400, Josh Coombs wrote:
>> > > >> Sorry i meant board-dt in the previous message and the name just
>> > > >> getting used to the mail program on os x aswel. I have run through the
>> > > >> checkpatch.pl script and it tells me there are no errors but i just
>> > > >> found out a few minutes ago theres a fix for the 2 sata ports not
>> > > >> working (on all kirkwood devices as far as i know) so i am going to
>> > > >> test that now as it envolves modifying a line in the dts file.
>> > > >
>> > > > Ok.  Please let everyone know in the comment portion of the patch (after
>> > > > the --- line) that your patch depends on this fix.  I haven't seen the
>> > > > patch you're referring to yet.  I'll keep my eye out for it.
>> > >
>> > > What he's referring to is needing to up the coherent_pool size to get
>> > > a Kirkwood device with two SATA ports to init completely.  I brought
>> > > the topic up on arm-kernel under the subject 'Potential Regression in
>> > > 3.6-rc1 - Kirkwood SATA' and Aaro Koskinen suggested the root cause
>> > > and potential fix of adding coherent_pool=1M to the bootargs.  I
>> > > didn't think to cc you in the discussion, sorry about that.  So there
>> > > isn't a pending patch yet, just a suggestion of altered bootargs.
>> >
>> > Yes, I saw that discussion.  Setting coherent_pool=1M was a way of
>> > diagnosing the problem.  It allowed the system to boot, which tells us
>> > where the problem lies.  But it did not fix the problem in the code.
>> > *That's* the patch I was referring to.  Which I haven't seen, yet. ;-)
>>
>> I could not get the way to use git figured out so i will send the
>> patch here though the browser based gmail interface and hope i do not
>> cause or get in too much trouble.
>
> It's doing some linewrapping, but it's fine for review.  When you
> resubmit for inclusion, you'll need to get that fixed up.
>
>> And my patch contains that part of
>> the altered bootargs so i hope that wont cause a problem either.
>
> Not a problem for review and testing, but I'm going to hold off on
> pulling it until we have the core problem fixed.
>
>> diff -urN linuxorig//arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
>> linux//arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
>> --- linuxorig//arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
>> 1970-01-01 01:00:00.000000000 +0100
>> +++ linux//arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts    2012-08-15
>> 10:17:35.000000000 +0100
>> @@ -0,0 +1,77 @@
>> +/dts-v1/;
>> +
>> +/include/ "kirkwood.dtsi"
>> +
>> +/ {
>> +    model = "Iomega StorCenter ix2-200";
>> +    compatible = "iom,ix2-200", "marvell,kirkwood-88f6281", "marvell,kirkwood";
>> +
>> +    memory {
>> +        device_type = "memory";
>> +        reg = <0x00000000 0x10000000>;
>> +    };
>> +
>> +    chosen {
>> +        bootargs = "console=ttyS0,115200n8 earlyprintk
>> root=LABEL=ROOTFS coherent_pool=1M";
>
> watch the linewrap.  Also, please remove the root= declaration and the
> coherent_pool=.  Once we get that fixed, your patch won't need it.
>
>> +    };
>> +
>> +    ocp@f1000000 {
>> +        i2c@11000 {
>> +            status = "okay";
>> +
>> +            lm63: lm63@4c {
>> +                compatible = "national,lm63";
>> +                reg = <0x4c>;
>> +            };
>> +        };
>> +
>> +        serial@12000 {
>> +            clock-frequency = <200000000>;
>> +            status = "ok";
>> +        };
>> +
>> +        nand@3000000 {
>> +            status = "okay";
>> +
>> +            partition@100000 {
>> +                label = "uImage";
>> +                reg = <0x100000 0x300000>;
>> +                read-only;
>> +            };
>> +
>> +            partition@400000 {
>> +                label = "uInitrd";
>> +                reg = <0x540000 0x1000000>;
>> +            };
>
> is there a partition for u-boot and the u-boot environment?
>
>> +        };
>> +        sata@80000 {
>> +            compatible = "marvell,orion-sata";
>> +            reg = <0x80000 0x5000>;
>> +            interrupts = <21>;
>> +            status = "okay";
>> +            nr-ports = <2>;
>> +        };
>> +
>> +    };
>> +    gpio-leds {
>> +        compatible = "gpio-leds";
>> +
>> +        power_led {
>> +            label = "status:white:power_led";
>> +            gpios = <&gpio0 16 0>;
>> +            linux,default-trigger = "default-on";
>> +        };
>> +        rebuild_led {
>> +            label = "status:white:rebuild_led";
>> +            gpios = <&gpio1 5 0>;
>> +        };
>> +        health_led {
>> +            label = "status:red:health_led";
>> +            gpios = <&gpio1 6 0>;
>> +        };
>> +        backup_led {
>> +            label = "status:blue:backup_led";
>> +            gpios = <&gpio0 15 0>;
>> +        };
>> +    };
>> +};
>> diff -urN linuxorig//arch/arm/mach-kirkwood/board-dt.c
>> linux//arch/arm/mach-kirkwood/board-dt.c
>> --- linuxorig//arch/arm/mach-kirkwood/board-dt.c    2012-08-15
>> 12:48:11.000000000 +0100
>> +++ linux//arch/arm/mach-kirkwood/board-dt.c    2012-08-15
>> 13:17:47.000000000 +0100
>> @@ -87,6 +87,9 @@
>>     if (of_machine_is_compatible("buffalo,lsxl"))
>>         lsxl_init();
>>
>> +    if (of_machine_is_compatible("iom,ix2-200"))
>> +        iomega_ix2_200_init();
>> +
>>     of_platform_populate(NULL, kirkwood_dt_match_table,
>>                  kirkwood_auxdata_lookup, NULL);
>>  }
>> @@ -100,6 +103,7 @@
>>     "qnap,ts219",
>>     "seagate,goflexnet",
>>     "buffalo,lsxl",
>> +    "iom,ix2-200",
>
> Please double check that this is a leading tab, and not a collection of
> spaces.  checkpatch.pl should have coughed on this if it was wrong.
> Could also be mail client mangling.
>
>>     NULL
>>  };
>>
>> diff -urN linuxorig//arch/arm/mach-kirkwood/board-iomega_ix2_200.c
>> linux//arch/arm/mach-kirkwood/board-iomega_ix2_200.c
>> --- linuxorig//arch/arm/mach-kirkwood/board-iomega_ix2_200.c
>> 1970-01-01 01:00:00.000000000 +0100
>> +++ linux//arch/arm/mach-kirkwood/board-iomega_ix2_200.c    2012-08-15
>> 10:16:55.000000000 +0100
>> @@ -0,0 +1,138 @@
>> +/*
>> + * arch/arm/mach-kirkwood/board-iomega_ix2_200.c
>> + *
>> + * Iomega StorCenter ix2-200
>> + *
>> + * 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/irq.h>
>> +#include <linux/mtd/partitions.h>
>> +#include <linux/ata_platform.h>
>> +#include <linux/mv643xx_eth.h>
>> +#include <linux/ethtool.h>
>> +#include <net/dsa.h>
>> +#include <linux/gpio.h>
>> +#include <linux/leds.h>
>> +#include <linux/gpio_keys.h>
>> +#include <linux/i2c.h>
>> +#include <linux/input.h>
>> +#include <asm/mach-types.h>
>> +#include <asm/mach/arch.h>
>> +#include <mach/kirkwood.h>
>> +#include "common.h"
>> +#include "mpp.h"
>> +
>> +static struct mv643xx_eth_platform_data iomega_ix2_200_ge00_data = {
>> +    .phy_addr       = MV643XX_ETH_PHY_NONE,
>> +    .speed          = SPEED_1000,
>> +    .duplex         = DUPLEX_FULL,
>> +};
>> +
>> +static struct mv643xx_eth_platform_data iomega_ix2_200_ge01_data = {
>> +    .phy_addr    = MV643XX_ETH_PHY_ADDR(11),
>> +};
>> +
>> +/****************************************************************************
>> + * GPIO Attached Keys
>> + ****************************************************************************/
>> +
>> +#define iomega_ix2_200_GPIO_KEY_RESET    12
>> +#define iomega_ix2_200_GPIO_KEY_POWER    14
>> +#define iomega_ix2_200_GPIO_KEY_OTB        35
>> +
>> +#define iomega_ix2_200_SW_RESET    0x00
>> +#define iomega_ix2_200_SW_POWER    0x01
>> +#define iomega_ix2_200_SW_OTB    0x02
>> +
>> +static struct gpio_keys_button iomega_ix2_200_buttons[] = {
>> +    {
>> +        .type        = EV_SW,
>> +        .code       = iomega_ix2_200_SW_RESET,
>> +        .gpio       = iomega_ix2_200_GPIO_KEY_RESET,
>> +        .desc       = "Reset Button",
>> +        .active_low     = 1,
>> +        .debounce_interval = 100,
>> +    },
>> +    {
>> +        .type        = EV_SW,
>> +        .code       = iomega_ix2_200_SW_POWER,
>> +        .gpio       = iomega_ix2_200_GPIO_KEY_POWER,
>> +        .desc       = "Power Button",
>> +        .active_low     = 1,
>> +        .debounce_interval = 100,
>> +    },
>> +    {
>> +        .type        = EV_SW,
>> +        .code       = iomega_ix2_200_SW_OTB,
>> +        .gpio       = iomega_ix2_200_GPIO_KEY_OTB,
>> +        .desc       = "OTB Button",
>> +        .active_low     = 1,
>> +        .debounce_interval = 100,
>> +    },
>> +
>> +};
>> +
>> +static struct gpio_keys_platform_data iomega_ix2_200_button_data = {
>> +    .buttons    = iomega_ix2_200_buttons,
>> +    .nbuttons       = ARRAY_SIZE(iomega_ix2_200_buttons),
>> +};
>> +
>> +static struct platform_device iomega_ix2_200_button_device = {
>> +    .name       = "gpio-keys",
>> +    .id         = -1,
>> +    .num_resources  = 0,
>> +    .dev        = {
>> +        .platform_data  = &iomega_ix2_200_button_data,
>> +    },
>> +};
>> +
>
> All of the above (gpio keys) can be removed and described in the DT.
> Please look at:
>
> da3fd4c ARM: Kirkwood: Describe iconnect keys in DT.
>
> which is currently at:
>
> git://git.infradead.org/users/jcooper/linux.git boards-for-v3.7
>
>> +static unsigned int iomega_ix2_200_mpp_config[] __initdata = {
>> +    MPP12_GPIO,                             /* Reset Button */
>> +    MPP14_GPIO,                             /* Power Button */
>> +    MPP15_GPIO,                             /* Backup LED (blue) */
>> +    MPP16_GPIO,                             /* Power LED (white) */
>> +    MPP35_GPIO,                             /* OTB Button */
>> +    MPP36_GPIO,                             /* Rebuild LED (white) */
>> +    MPP37_GPIO,                             /* Health LED (red) */
>> +    MPP38_GPIO,                             /* SATA LED brightness control 1 */
>> +    MPP39_GPIO,                             /* SATA LED brightness control 2 */
>> +    MPP40_GPIO,                             /* Backup LED brightness
>> control 1 */
>> +    MPP41_GPIO,                             /* Backup LED brightness
>> control 2 */
>> +    MPP42_GPIO,                             /* Power LED brightness
>> control 1 */
>> +    MPP43_GPIO,                             /* Power LED brightness
>> control 2 */
>> +    MPP44_GPIO,                             /* Health LED brightness
>> control 1 */
>> +    MPP45_GPIO,                             /* Health LED brightness
>> control 2 */
>> +    MPP46_GPIO,                             /* Rebuild LED brightness
>> control 1 */
>> +    MPP47_GPIO,                             /* Rebuild LED brightness
>> control 2 */
>> +    0
>> +};
>> +
>> +void __init iomega_ix2_200_init(void)
>> +{
>> +    /*
>> +     * Basic setup. Needs to be called early.
>> +     */
>> +    kirkwood_mpp_conf(iomega_ix2_200_mpp_config);
>> +
>> +    kirkwood_ehci_init();
>> +
>> +    kirkwood_ge00_init(&iomega_ix2_200_ge00_data);
>> +    kirkwood_ge01_init(&iomega_ix2_200_ge01_data);
>
>
>> +    kirkwood_uart0_init();
>> +    platform_device_register(&iomega_ix2_200_button_device);
>
> These two lines can be removed, the second after describing the gpio
> keys in the DT.  Make sure you have CONFIG_SERIAL_OF_PLATFORM=y in your
> config.
>
>> +}
>> +
>> +static int __init iomega_ix2_200_pci_init(void)
>> +{
>> +    if (of_machine_is_compatible("iom,ix2-200"))
>> +        kirkwood_pcie_init(KW_PCIE0);
>> +    return 0;
>> +}
>> +subsys_initcall(iomega_ix2_200_pci_init);
>> +
>> diff -urN linuxorig//arch/arm/mach-kirkwood/common.h
>> linux//arch/arm/mach-kirkwood/common.h
>> --- linuxorig//arch/arm/mach-kirkwood/common.h    2012-08-15
>> 12:48:11.000000000 +0100
>> +++ linux//arch/arm/mach-kirkwood/common.h    2012-08-15
>> 12:54:07.000000000 +0100
>> @@ -94,6 +94,12 @@
>>  static inline void lsxl_init(void) {};
>>  #endif
>>
>> +#ifdef CONFIG_MACH_IOMEGA_IX2_200_DT
>> +void iomega_ix2_200_init(void);
>> +#else
>> +static inline void iomega_ix2_200_init(void) {};
>> +#endif
>> +
>>  /* early init functions not converted to fdt yet */
>>  char *kirkwood_id(void);
>>  void kirkwood_l2_init(void);
>> diff -urN linuxorig//arch/arm/mach-kirkwood/Kconfig
>> linux//arch/arm/mach-kirkwood/Kconfig
>> --- linuxorig//arch/arm/mach-kirkwood/Kconfig    2012-08-15
>> 12:48:11.000000000 +0100
>> +++ linux//arch/arm/mach-kirkwood/Kconfig    2012-08-15 12:54:55.000000000 +0100
>> @@ -195,6 +195,13 @@
>>       Say 'Y' here if you want your kernel to support the
>>       HP t5325 Thin Client.
>>
>> +config MACH_IOMEGA_IX2_200_DT
>> +    bool "Iomega StorCenter ix2-200 (Flattened Device Tree)"
>> +    select ARCH_KIRKWOOD_DT
>> +    help
>> +      Say 'Y' here if you want your kernel to support the
>> +      Iomega StorCenter ix2-200 (Flattened Device Tree).
>> +
>>  endmenu
>>
>>  endif
>> diff -urN linuxorig//arch/arm/mach-kirkwood/Makefile
>> linux//arch/arm/mach-kirkwood/Makefile
>> --- linuxorig//arch/arm/mach-kirkwood/Makefile    2012-08-15
>> 12:48:11.000000000 +0100
>> +++ linux//arch/arm/mach-kirkwood/Makefile    2012-08-15
>> 12:55:17.000000000 +0100
>> @@ -28,3 +28,4 @@
>>  obj-$(CONFIG_MACH_TS219_DT)        += board-ts219.o tsx1x-common.o
>>  obj-$(CONFIG_MACH_GOFLEXNET_DT)        += board-goflexnet.o
>>  obj-$(CONFIG_MACH_LSXL_DT)        += board-lsxl.o
>> +obj-$(CONFIG_MACH_IOMEGA_IX2_200_DT)    += board-iomega_ix2_200.o
>> diff -urN linuxorig//arch/arm/mach-kirkwood/Makefile.boot
>> linux//arch/arm/mach-kirkwood/Makefile.boot
>> --- linuxorig//arch/arm/mach-kirkwood/Makefile.boot    2012-08-15
>> 13:07:03.000000000 +0100
>> +++ linux//arch/arm/mach-kirkwood/Makefile.boot    2012-08-15
>> 12:55:43.000000000 +0100
>> @@ -11,3 +11,4 @@
>>  dtb-$(CONFIG_MACH_GOFLEXNET_DT) += kirkwood-goflexnet.dtb
>>  dbt-$(CONFIG_MACH_LSXL_DT) += kirkwood-lschlv2.dtb
>>  dbt-$(CONFIG_MACH_LSXL_DT) += kirkwood-lsxhl.dtb
>> +dtb-$(CONFIG_MACH_IOMEGA_IX2_200_DT) += kirkwood-iomega_ix2_200.dtb
>
> ...
>
>> Signed-off-by: Alan M Butler <alanbutty12@gmail.com>
>
> This will need to go above the --- line, which you don't have in this
> email.
>
> Since you have this patch as a file, do the following:
>
> # after the git checkout command in my previous instructions
>
> patch -Np0 <../my_patch_file
>         # you may need 1 instead here, depends on the patch.
>
> git diff HEAD
>         # review the output, quit out and fix anything that isn't
>         # right. review again with the same command.  Once it looks
>         # correct, proceed
>
> git add .
>
> # you'll probably need to do these two if this is a new repo:
>         git config --add user.name "Alan M Butler"
>         git config --add user.email "alanbutty12@gmail.com"
>
> git commit -s
>         # The first line should be "ARM: Kirkwood: ...".  This will
>         # become the subject of the email submission
>
> # now, pickup in my original instructions with 'git format-patch'
>
> hth,
>
> Jason.

i did what you sujested and all commands worked except for the git
sendmail part so i do not know if I should still be sending you the
patch this way but here it is. i also defined the gpio keys in the dts
file like you said the same as with the iconnect but the kernel keeps
crashing with them defined in the dts is the support actualy there for
the keys? or have i just defined them wrong?

From f55ed67347f4b10ebbe2adc29d134acaf362279a Mon Sep 17 00:00:00 2001
Message-Id: <cover.1345046444.git.alanbutty12@gmail.com>
From: Alan M Butler <alanbutty12@gmail.com>
Date: Wed, 15 Aug 2012 17:00:44 +0100
Subject: [PATCH] *** SUBJECT HERE ***

*** BLURB HERE ***

Alan M Butler (1):
  ARM: Kirkwood: Iomega_IX2_200     Signed-off-by: Alan M Butler
    <alanbutty12@gmail.com>

 arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts |  111 +++++++++++++++++++++++++
 arch/arm/mach-kirkwood/Kconfig                |    7 ++
 arch/arm/mach-kirkwood/Makefile               |    1 +
 arch/arm/mach-kirkwood/Makefile.boot          |    1 +
 arch/arm/mach-kirkwood/board-dt.c             |    4 +
 arch/arm/mach-kirkwood/board-iomega_ix2_200.c |   80 ++++++++++++++++++
 arch/arm/mach-kirkwood/common.h               |    6 ++
 7 files changed, 210 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
 create mode 100644 arch/arm/mach-kirkwood/board-iomega_ix2_200.c

Comments

Jason Cooper Aug. 15, 2012, 8:19 p.m. UTC | #1
Alan,

Not too bad for your first go-round with git.  Some comments below.


On Wed, Aug 15, 2012 at 07:00:42PM +0100, alan butler wrote:
...
> i did what you sujested and all commands worked except for the git
> sendmail part so i do not know if I should still be sending you the
> patch this way but here it is. 

Please post the exact command you used and the complete error message it
gave you.

> i also defined the gpio keys in the dts
> file like you said the same as with the iconnect but the kernel keeps
> crashing with them defined in the dts is the support actualy there for
> the keys? or have i just defined them wrong?

Please post the exact error message from the kernel for this as well.

> 
> From f55ed67347f4b10ebbe2adc29d134acaf362279a Mon Sep 17 00:00:00 2001
> Message-Id: <cover.1345046444.git.alanbutty12@gmail.com>
> From: Alan M Butler <alanbutty12@gmail.com>
> Date: Wed, 15 Aug 2012 17:00:44 +0100
> Subject: [PATCH] *** SUBJECT HERE ***
> 
> *** BLURB HERE ***

Since this is a single patch, not a series, you can omit --cover-letter.

> Alan M Butler (1):
>   ARM: Kirkwood: Iomega_IX2_200     Signed-off-by: Alan M Butler
>     <alanbutty12@gmail.com>
> 
>  arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts |  111 +++++++++++++++++++++++++
>  arch/arm/mach-kirkwood/Kconfig                |    7 ++
>  arch/arm/mach-kirkwood/Makefile               |    1 +
>  arch/arm/mach-kirkwood/Makefile.boot          |    1 +
>  arch/arm/mach-kirkwood/board-dt.c             |    4 +
>  arch/arm/mach-kirkwood/board-iomega_ix2_200.c |   80 ++++++++++++++++++
>  arch/arm/mach-kirkwood/common.h               |    6 ++
>  7 files changed, 210 insertions(+), 0 deletions(-)
>  create mode 100644 arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
>  create mode 100644 arch/arm/mach-kirkwood/board-iomega_ix2_200.c
> 
> -- 
> 1.7.5.4
> From f55ed67347f4b10ebbe2adc29d134acaf362279a Mon Sep 17 00:00:00 2001
> Message-Id: <f55ed67347f4b10ebbe2adc29d134acaf362279a.1345046444.git.alanbutty12@gmail.com>
> In-Reply-To: <cover.1345046444.git.alanbutty12@gmail.com>
> References: <cover.1345046444.git.alanbutty12@gmail.com>
> From: Alan M Butler <alanbutty12@gmail.com>
> Date: Wed, 15 Aug 2012 16:52:56 +0100
> Subject: [PATCH] ARM: Kirkwood: Iomega_IX2_200 Signed-off-by: Alan M Butler
>  <alanbutty12@gmail.com>

The 'git commit -s' automatically signs the commit properly.  So, you
shouldn't have to add the Signed-off-by: anywhere once you have git
send-email working.

btw - vvvv these are the '---' I was referring to.

> ---
>  arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts |  111 +++++++++++++++++++++++++
>  arch/arm/mach-kirkwood/Kconfig                |    7 ++
>  arch/arm/mach-kirkwood/Makefile               |    1 +
>  arch/arm/mach-kirkwood/Makefile.boot          |    1 +
>  arch/arm/mach-kirkwood/board-dt.c             |    4 +
>  arch/arm/mach-kirkwood/board-iomega_ix2_200.c |   80 ++++++++++++++++++
>  arch/arm/mach-kirkwood/common.h               |    6 ++
>  7 files changed, 210 insertions(+), 0 deletions(-)
>  create mode 100644 arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
>  create mode 100644 arch/arm/mach-kirkwood/board-iomega_ix2_200.c
> 
> diff --git a/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
> b/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
> new file mode 100644
> index 0000000..7863009
> --- /dev/null
> +++ b/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
> @@ -0,0 +1,111 @@
> +/dts-v1/;
> +
> +/include/ "kirkwood.dtsi"
> +
> +/ {
> +	model = "Iomega StorCenter ix2-200";
> +	compatible = "iom,ix2-200", "marvell,kirkwood-88f6281", "marvell,kirkwood";
> +
> +	memory {
> +		device_type = "memory";
> +		reg = <0x00000000 0x10000000>;
> +	};
> +
> +	chosen {
> +		bootargs = "console=ttyS0,115200n8 earlyprintk";
> +	};
> +
> +	ocp@f1000000 {
> +		i2c@11000 {
> +			status = "okay";
> +
> +			lm63: lm63@4c {
> +				compatible = "national,lm63";
> +				reg = <0x4c>;
> +			};
> +		};
> +
> +		serial@12000 {
> +			clock-frequency = <200000000>;
> +			status = "ok";
> +		};
> +
> +		nand@3000000 {
> +			status = "okay";
> +
> +			partition@0 {
> +				label = "u-boot";
> +				reg = <0x0000000 0x100000>;
> +				read-only;
> +			};
> +
> +			partition@a0000 {
> +				label = "env";
> +				reg = <0xa0000 0x20000>;
> +			};
> +
> +			partition@100000 {
> +				label = "uImage";
> +				reg = <0x100000 0x300000>;
> +				read-only;
> +			};
> +
> +			partition@400000 {
> +				label = "uInitrd";
> +				reg = <0x540000 0x1000000>;
> +			};
> +		};
> +		sata@80000 {
> +			compatible = "marvell,orion-sata";
> +			reg = <0x80000 0x5000>;
> +			interrupts = <21>;
> +			status = "okay";
> +			nr-ports = <2>;
> +		};
> +
> +	};
> +	gpio-leds {
> +		compatible = "gpio-leds";
> +
> +		power_led {
> +			label = "status:white:power_led";
> +			gpios = <&gpio0 16 0>;
> +			linux,default-trigger = "default-on";
> +		};
> +		rebuild_led {
> +			label = "status:white:rebuild_led";
> +			gpios = <&gpio1 5 0>;
> +		};
> +		health_led {
> +			label = "status:red:health_led";
> +			gpios = <&gpio1 6 0>;
> +		};
> +		backup_led {
> +			label = "status:blue:backup_led";
> +			gpios = <&gpio0 15 0>;
> +		};
> +	};
> +	gpio_keys {
> +		compatible = "gpio-keys";
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +		button@1 {
> +			label = "OTB Button";
> +			linux,code = <0x00>;
> +			gpios = <&gpio1 4 1>;
> +			debounce-interval = <100>;
> +		};
> +		button@2 {
> +			label = "Reset";
> +			linux,code = <0x01>;
> +			gpios = <&gpio0 12 1>;
> +			debounce-interval = <100>;
> +		};
> +		button@3 {
> +			label = "Power";
> +			linux,code = <0x028>;
> +			gpios = <&gpio0 14 1>;
> +			debounce-interval = <100>;
> +		};
> +	};
> +};
> diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
> index ca5c15a..bee8451 100644
> --- a/arch/arm/mach-kirkwood/Kconfig
> +++ b/arch/arm/mach-kirkwood/Kconfig
> @@ -195,6 +195,13 @@ config MACH_T5325
>  	  Say 'Y' here if you want your kernel to support the
>  	  HP t5325 Thin Client.
> 
> +config MACH_IOMEGA_IX2_200_DT
> +	bool "Iomega StorCenter ix2-200 (Flattened Device Tree)"
> +	select ARCH_KIRKWOOD_DT
> +	help
> +	  Say 'Y' here if you want your kernel to support the
> +	  Iomega StorCenter ix2-200 (Flattened Device Tree).
> +
>  endmenu
> 
>  endif
> diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
> index 055c85a..f5484dc 100644
> --- a/arch/arm/mach-kirkwood/Makefile
> +++ b/arch/arm/mach-kirkwood/Makefile
> @@ -28,3 +28,4 @@ obj-$(CONFIG_MACH_IB62X0_DT)		+= board-ib62x0.o
>  obj-$(CONFIG_MACH_TS219_DT)		+= board-ts219.o tsx1x-common.o
>  obj-$(CONFIG_MACH_GOFLEXNET_DT)		+= board-goflexnet.o
>  obj-$(CONFIG_MACH_LSXL_DT)		+= board-lsxl.o
> +obj-$(CONFIG_MACH_IOMEGA_IX2_200_DT)	+= board-iomega_ix2_200.o
> diff --git a/arch/arm/mach-kirkwood/Makefile.boot
> b/arch/arm/mach-kirkwood/Makefile.boot
> index 2a576ab..f8ef771 100644
> --- a/arch/arm/mach-kirkwood/Makefile.boot
> +++ b/arch/arm/mach-kirkwood/Makefile.boot
> @@ -11,3 +11,4 @@ dtb-$(CONFIG_MACH_TS219_DT)	+= kirkwood-qnap-ts219.dtb
>  dtb-$(CONFIG_MACH_GOFLEXNET_DT) += kirkwood-goflexnet.dtb
>  dbt-$(CONFIG_MACH_LSXL_DT) += kirkwood-lschlv2.dtb
>  dbt-$(CONFIG_MACH_LSXL_DT) += kirkwood-lsxhl.dtb
> +dtb-$(CONFIG_MACH_IOMEGA_IX2_200_DT) += kirkwood-iomega_ix2_200.dtb
> diff --git a/arch/arm/mach-kirkwood/board-dt.c
> b/arch/arm/mach-kirkwood/board-dt.c
> index e4eb450..a932ae9 100644
> --- a/arch/arm/mach-kirkwood/board-dt.c
> +++ b/arch/arm/mach-kirkwood/board-dt.c
> @@ -87,6 +87,9 @@ static void __init kirkwood_dt_init(void)
>  	if (of_machine_is_compatible("buffalo,lsxl"))
>  		lsxl_init();
> 
> +	if (of_machine_is_compatible("iom,ix2-200"))
> +		iomega_ix2_200_init()
> +
>  	of_platform_populate(NULL, kirkwood_dt_match_table,
>  			     kirkwood_auxdata_lookup, NULL);
>  }
> @@ -100,6 +103,7 @@ static const char *kirkwood_dt_board_compat[] = {
>  	"qnap,ts219",
>  	"seagate,goflexnet",
>  	"buffalo,lsxl",
> +	"iom,ix2-200",
>  	NULL
>  };
> 
> diff --git a/arch/arm/mach-kirkwood/board-iomega_ix2_200.c
> b/arch/arm/mach-kirkwood/board-iomega_ix2_200.c
> new file mode 100644
> index 0000000..a6bb98e
> --- /dev/null
> +++ b/arch/arm/mach-kirkwood/board-iomega_ix2_200.c
> @@ -0,0 +1,80 @@
> +/*
> + * arch/arm/mach-kirkwood/board-iomega_ix2_200.c
> + *
> + * Iomega StorCenter ix2-200
> + *
> + * 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/irq.h>
> +#include <linux/mtd/partitions.h>
> +#include <linux/ata_platform.h>
> +#include <linux/mv643xx_eth.h>
> +#include <linux/ethtool.h>
> +#include <net/dsa.h>
> +#include <linux/gpio.h>
> +#include <linux/leds.h>
> +#include <linux/i2c.h>
> +#include <asm/mach-types.h>
> +#include <asm/mach/arch.h>
> +#include <mach/kirkwood.h>
> +#include "common.h"
> +#include "mpp.h"
> +
> +static struct mv643xx_eth_platform_data iomega_ix2_200_ge00_data = {
> +	.phy_addr       = MV643XX_ETH_PHY_NONE,
> +	.speed          = SPEED_1000,
> +	.duplex         = DUPLEX_FULL,
> +};
> +
> +static struct mv643xx_eth_platform_data iomega_ix2_200_ge01_data = {
> +	.phy_addr	= MV643XX_ETH_PHY_ADDR(11),
> +};
> +
> +static unsigned int iomega_ix2_200_mpp_config[] __initdata = {
> +	MPP12_GPIO,			/* Reset Button */
> +	MPP14_GPIO,			/* Power Button */
> +	MPP15_GPIO,			/* Backup LED (blue) */
> +	MPP16_GPIO,			/* Power LED (white) */
> +	MPP35_GPIO,			/* OTB Button */
> +	MPP36_GPIO,			/* Rebuild LED (white) */
> +	MPP37_GPIO,			/* Health LED (red) */
> +	MPP38_GPIO,			/* SATA LED brightness control 1 */
> +	MPP39_GPIO,			/* SATA LED brightness control 2 */
> +	MPP40_GPIO,			/* Backup LED brightness control 1 */
> +	MPP41_GPIO,			/* Backup LED brightness control 2 */
> +	MPP42_GPIO,			/* Power LED brightness control 1 */
> +	MPP43_GPIO,			/* Power LED brightness control 2 */
> +	MPP44_GPIO,			/* Health LED brightness control 1 */
> +	MPP45_GPIO,			/* Health LED brightness control 2 */
> +	MPP46_GPIO,			/* Rebuild LED brightness control 1 */
> +	MPP47_GPIO,			/* Rebuild LED brightness control 2 */
> +	0
> +};
> +
> +void __init iomega_ix2_200_init(void)
> +{
> +	/*
> +	 * Basic setup. Needs to be called early.
> +	 */
> +	kirkwood_mpp_conf(iomega_ix2_200_mpp_config);
> +
> +	kirkwood_ehci_init();
> +
> +	kirkwood_ge00_init(&iomega_ix2_200_ge00_data);
> +	kirkwood_ge01_init(&iomega_ix2_200_ge01_data);
> +}
> +
> +static int __init iomega_ix2_200_pci_init(void)
> +{
> +	if (of_machine_is_compatible("iom,ix2-200"))
> +		kirkwood_pcie_init(KW_PCIE0);
> +	return 0;
> +}
> +subsys_initcall(iomega_ix2_200_pci_init);
> +
> diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
> index 304dd1a..d5d4064 100644
> --- a/arch/arm/mach-kirkwood/common.h
> +++ b/arch/arm/mach-kirkwood/common.h
> @@ -94,6 +94,12 @@ void lsxl_init(void);
>  static inline void lsxl_init(void) {};
>  #endif
> 
> +#ifdef CONFIG_MACH_IOMEGA_IX2_200_DT
> +void iomega_ix2_200_init(void);
> +#else
> +static inline void iomega_ix2_200_init(void) {};
> +#endif
> +
>  /* early init functions not converted to fdt yet */
>  char *kirkwood_id(void);
>  void kirkwood_l2_init(void);
> Signed-off-by: Alan M Butler <alanbutty12@gmail.com>

Please remove this line ^^^.  It isn't valid C ;-)  See my comment
above.

thx,

Jason.
alan butler Aug. 15, 2012, 8:56 p.m. UTC | #2
On 15 August 2012 21:19, Jason Cooper <jason@lakedaemon.net> wrote:
> Alan,
>
> Not too bad for your first go-round with git.  Some comments below.
>
>
> On Wed, Aug 15, 2012 at 07:00:42PM +0100, alan butler wrote:
> ...
>> i did what you sujested and all commands worked except for the git
>> sendmail part so i do not know if I should still be sending you the
>> patch this way but here it is.
>
> Please post the exact command you used and the complete error message it
> gave you.
>
>> i also defined the gpio keys in the dts
>> file like you said the same as with the iconnect but the kernel keeps
>> crashing with them defined in the dts is the support actualy there for
>> the keys? or have i just defined them wrong?
>
> Please post the exact error message from the kernel for this as well.
>
>>
>> From f55ed67347f4b10ebbe2adc29d134acaf362279a Mon Sep 17 00:00:00 2001
>> Message-Id: <cover.1345046444.git.alanbutty12@gmail.com>
>> From: Alan M Butler <alanbutty12@gmail.com>
>> Date: Wed, 15 Aug 2012 17:00:44 +0100
>> Subject: [PATCH] *** SUBJECT HERE ***
>>
>> *** BLURB HERE ***
>
> Since this is a single patch, not a series, you can omit --cover-letter.
>
>> Alan M Butler (1):
>>   ARM: Kirkwood: Iomega_IX2_200     Signed-off-by: Alan M Butler
>>     <alanbutty12@gmail.com>
>>
>>  arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts |  111 +++++++++++++++++++++++++
>>  arch/arm/mach-kirkwood/Kconfig                |    7 ++
>>  arch/arm/mach-kirkwood/Makefile               |    1 +
>>  arch/arm/mach-kirkwood/Makefile.boot          |    1 +
>>  arch/arm/mach-kirkwood/board-dt.c             |    4 +
>>  arch/arm/mach-kirkwood/board-iomega_ix2_200.c |   80 ++++++++++++++++++
>>  arch/arm/mach-kirkwood/common.h               |    6 ++
>>  7 files changed, 210 insertions(+), 0 deletions(-)
>>  create mode 100644 arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
>>  create mode 100644 arch/arm/mach-kirkwood/board-iomega_ix2_200.c
>>
>> --
>> 1.7.5.4
>> From f55ed67347f4b10ebbe2adc29d134acaf362279a Mon Sep 17 00:00:00 2001
>> Message-Id: <f55ed67347f4b10ebbe2adc29d134acaf362279a.1345046444.git.alanbutty12@gmail.com>
>> In-Reply-To: <cover.1345046444.git.alanbutty12@gmail.com>
>> References: <cover.1345046444.git.alanbutty12@gmail.com>
>> From: Alan M Butler <alanbutty12@gmail.com>
>> Date: Wed, 15 Aug 2012 16:52:56 +0100
>> Subject: [PATCH] ARM: Kirkwood: Iomega_IX2_200 Signed-off-by: Alan M Butler
>>  <alanbutty12@gmail.com>
>
> The 'git commit -s' automatically signs the commit properly.  So, you
> shouldn't have to add the Signed-off-by: anywhere once you have git
> send-email working.
>
> btw - vvvv these are the '---' I was referring to.
>
>> ---
>>  arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts |  111 +++++++++++++++++++++++++
>>  arch/arm/mach-kirkwood/Kconfig                |    7 ++
>>  arch/arm/mach-kirkwood/Makefile               |    1 +
>>  arch/arm/mach-kirkwood/Makefile.boot          |    1 +
>>  arch/arm/mach-kirkwood/board-dt.c             |    4 +
>>  arch/arm/mach-kirkwood/board-iomega_ix2_200.c |   80 ++++++++++++++++++
>>  arch/arm/mach-kirkwood/common.h               |    6 ++
>>  7 files changed, 210 insertions(+), 0 deletions(-)
>>  create mode 100644 arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
>>  create mode 100644 arch/arm/mach-kirkwood/board-iomega_ix2_200.c
>>
>> diff --git a/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
>> b/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
>> new file mode 100644
>> index 0000000..7863009
>> --- /dev/null
>> +++ b/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
>> @@ -0,0 +1,111 @@
>> +/dts-v1/;
>> +
>> +/include/ "kirkwood.dtsi"
>> +
>> +/ {
>> +     model = "Iomega StorCenter ix2-200";
>> +     compatible = "iom,ix2-200", "marvell,kirkwood-88f6281", "marvell,kirkwood";
>> +
>> +     memory {
>> +             device_type = "memory";
>> +             reg = <0x00000000 0x10000000>;
>> +     };
>> +
>> +     chosen {
>> +             bootargs = "console=ttyS0,115200n8 earlyprintk";
>> +     };
>> +
>> +     ocp@f1000000 {
>> +             i2c@11000 {
>> +                     status = "okay";
>> +
>> +                     lm63: lm63@4c {
>> +                             compatible = "national,lm63";
>> +                             reg = <0x4c>;
>> +                     };
>> +             };
>> +
>> +             serial@12000 {
>> +                     clock-frequency = <200000000>;
>> +                     status = "ok";
>> +             };
>> +
>> +             nand@3000000 {
>> +                     status = "okay";
>> +
>> +                     partition@0 {
>> +                             label = "u-boot";
>> +                             reg = <0x0000000 0x100000>;
>> +                             read-only;
>> +                     };
>> +
>> +                     partition@a0000 {
>> +                             label = "env";
>> +                             reg = <0xa0000 0x20000>;
>> +                     };
>> +
>> +                     partition@100000 {
>> +                             label = "uImage";
>> +                             reg = <0x100000 0x300000>;
>> +                             read-only;
>> +                     };
>> +
>> +                     partition@400000 {
>> +                             label = "uInitrd";
>> +                             reg = <0x540000 0x1000000>;
>> +                     };
>> +             };
>> +             sata@80000 {
>> +                     compatible = "marvell,orion-sata";
>> +                     reg = <0x80000 0x5000>;
>> +                     interrupts = <21>;
>> +                     status = "okay";
>> +                     nr-ports = <2>;
>> +             };
>> +
>> +     };
>> +     gpio-leds {
>> +             compatible = "gpio-leds";
>> +
>> +             power_led {
>> +                     label = "status:white:power_led";
>> +                     gpios = <&gpio0 16 0>;
>> +                     linux,default-trigger = "default-on";
>> +             };
>> +             rebuild_led {
>> +                     label = "status:white:rebuild_led";
>> +                     gpios = <&gpio1 5 0>;
>> +             };
>> +             health_led {
>> +                     label = "status:red:health_led";
>> +                     gpios = <&gpio1 6 0>;
>> +             };
>> +             backup_led {
>> +                     label = "status:blue:backup_led";
>> +                     gpios = <&gpio0 15 0>;
>> +             };
>> +     };
>> +     gpio_keys {
>> +             compatible = "gpio-keys";
>> +             #address-cells = <1>;
>> +             #size-cells = <0>;
>> +             button@1 {
>> +                     label = "OTB Button";
>> +                     linux,code = <0x00>;
>> +                     gpios = <&gpio1 4 1>;
>> +                     debounce-interval = <100>;
>> +             };
>> +             button@2 {
>> +                     label = "Reset";
>> +                     linux,code = <0x01>;
>> +                     gpios = <&gpio0 12 1>;
>> +                     debounce-interval = <100>;
>> +             };
>> +             button@3 {
>> +                     label = "Power";
>> +                     linux,code = <0x028>;
>> +                     gpios = <&gpio0 14 1>;
>> +                     debounce-interval = <100>;
>> +             };
>> +     };
>> +};
>> diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
>> index ca5c15a..bee8451 100644
>> --- a/arch/arm/mach-kirkwood/Kconfig
>> +++ b/arch/arm/mach-kirkwood/Kconfig
>> @@ -195,6 +195,13 @@ config MACH_T5325
>>         Say 'Y' here if you want your kernel to support the
>>         HP t5325 Thin Client.
>>
>> +config MACH_IOMEGA_IX2_200_DT
>> +     bool "Iomega StorCenter ix2-200 (Flattened Device Tree)"
>> +     select ARCH_KIRKWOOD_DT
>> +     help
>> +       Say 'Y' here if you want your kernel to support the
>> +       Iomega StorCenter ix2-200 (Flattened Device Tree).
>> +
>>  endmenu
>>
>>  endif
>> diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
>> index 055c85a..f5484dc 100644
>> --- a/arch/arm/mach-kirkwood/Makefile
>> +++ b/arch/arm/mach-kirkwood/Makefile
>> @@ -28,3 +28,4 @@ obj-$(CONFIG_MACH_IB62X0_DT)                += board-ib62x0.o
>>  obj-$(CONFIG_MACH_TS219_DT)          += board-ts219.o tsx1x-common.o
>>  obj-$(CONFIG_MACH_GOFLEXNET_DT)              += board-goflexnet.o
>>  obj-$(CONFIG_MACH_LSXL_DT)           += board-lsxl.o
>> +obj-$(CONFIG_MACH_IOMEGA_IX2_200_DT) += board-iomega_ix2_200.o
>> diff --git a/arch/arm/mach-kirkwood/Makefile.boot
>> b/arch/arm/mach-kirkwood/Makefile.boot
>> index 2a576ab..f8ef771 100644
>> --- a/arch/arm/mach-kirkwood/Makefile.boot
>> +++ b/arch/arm/mach-kirkwood/Makefile.boot
>> @@ -11,3 +11,4 @@ dtb-$(CONFIG_MACH_TS219_DT) += kirkwood-qnap-ts219.dtb
>>  dtb-$(CONFIG_MACH_GOFLEXNET_DT) += kirkwood-goflexnet.dtb
>>  dbt-$(CONFIG_MACH_LSXL_DT) += kirkwood-lschlv2.dtb
>>  dbt-$(CONFIG_MACH_LSXL_DT) += kirkwood-lsxhl.dtb
>> +dtb-$(CONFIG_MACH_IOMEGA_IX2_200_DT) += kirkwood-iomega_ix2_200.dtb
>> diff --git a/arch/arm/mach-kirkwood/board-dt.c
>> b/arch/arm/mach-kirkwood/board-dt.c
>> index e4eb450..a932ae9 100644
>> --- a/arch/arm/mach-kirkwood/board-dt.c
>> +++ b/arch/arm/mach-kirkwood/board-dt.c
>> @@ -87,6 +87,9 @@ static void __init kirkwood_dt_init(void)
>>       if (of_machine_is_compatible("buffalo,lsxl"))
>>               lsxl_init();
>>
>> +     if (of_machine_is_compatible("iom,ix2-200"))
>> +             iomega_ix2_200_init()
>> +
>>       of_platform_populate(NULL, kirkwood_dt_match_table,
>>                            kirkwood_auxdata_lookup, NULL);
>>  }
>> @@ -100,6 +103,7 @@ static const char *kirkwood_dt_board_compat[] = {
>>       "qnap,ts219",
>>       "seagate,goflexnet",
>>       "buffalo,lsxl",
>> +     "iom,ix2-200",
>>       NULL
>>  };
>>
>> diff --git a/arch/arm/mach-kirkwood/board-iomega_ix2_200.c
>> b/arch/arm/mach-kirkwood/board-iomega_ix2_200.c
>> new file mode 100644
>> index 0000000..a6bb98e
>> --- /dev/null
>> +++ b/arch/arm/mach-kirkwood/board-iomega_ix2_200.c
>> @@ -0,0 +1,80 @@
>> +/*
>> + * arch/arm/mach-kirkwood/board-iomega_ix2_200.c
>> + *
>> + * Iomega StorCenter ix2-200
>> + *
>> + * 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/irq.h>
>> +#include <linux/mtd/partitions.h>
>> +#include <linux/ata_platform.h>
>> +#include <linux/mv643xx_eth.h>
>> +#include <linux/ethtool.h>
>> +#include <net/dsa.h>
>> +#include <linux/gpio.h>
>> +#include <linux/leds.h>
>> +#include <linux/i2c.h>
>> +#include <asm/mach-types.h>
>> +#include <asm/mach/arch.h>
>> +#include <mach/kirkwood.h>
>> +#include "common.h"
>> +#include "mpp.h"
>> +
>> +static struct mv643xx_eth_platform_data iomega_ix2_200_ge00_data = {
>> +     .phy_addr       = MV643XX_ETH_PHY_NONE,
>> +     .speed          = SPEED_1000,
>> +     .duplex         = DUPLEX_FULL,
>> +};
>> +
>> +static struct mv643xx_eth_platform_data iomega_ix2_200_ge01_data = {
>> +     .phy_addr       = MV643XX_ETH_PHY_ADDR(11),
>> +};
>> +
>> +static unsigned int iomega_ix2_200_mpp_config[] __initdata = {
>> +     MPP12_GPIO,                     /* Reset Button */
>> +     MPP14_GPIO,                     /* Power Button */
>> +     MPP15_GPIO,                     /* Backup LED (blue) */
>> +     MPP16_GPIO,                     /* Power LED (white) */
>> +     MPP35_GPIO,                     /* OTB Button */
>> +     MPP36_GPIO,                     /* Rebuild LED (white) */
>> +     MPP37_GPIO,                     /* Health LED (red) */
>> +     MPP38_GPIO,                     /* SATA LED brightness control 1 */
>> +     MPP39_GPIO,                     /* SATA LED brightness control 2 */
>> +     MPP40_GPIO,                     /* Backup LED brightness control 1 */
>> +     MPP41_GPIO,                     /* Backup LED brightness control 2 */
>> +     MPP42_GPIO,                     /* Power LED brightness control 1 */
>> +     MPP43_GPIO,                     /* Power LED brightness control 2 */
>> +     MPP44_GPIO,                     /* Health LED brightness control 1 */
>> +     MPP45_GPIO,                     /* Health LED brightness control 2 */
>> +     MPP46_GPIO,                     /* Rebuild LED brightness control 1 */
>> +     MPP47_GPIO,                     /* Rebuild LED brightness control 2 */
>> +     0
>> +};
>> +
>> +void __init iomega_ix2_200_init(void)
>> +{
>> +     /*
>> +      * Basic setup. Needs to be called early.
>> +      */
>> +     kirkwood_mpp_conf(iomega_ix2_200_mpp_config);
>> +
>> +     kirkwood_ehci_init();
>> +
>> +     kirkwood_ge00_init(&iomega_ix2_200_ge00_data);
>> +     kirkwood_ge01_init(&iomega_ix2_200_ge01_data);
>> +}
>> +
>> +static int __init iomega_ix2_200_pci_init(void)
>> +{
>> +     if (of_machine_is_compatible("iom,ix2-200"))
>> +             kirkwood_pcie_init(KW_PCIE0);
>> +     return 0;
>> +}
>> +subsys_initcall(iomega_ix2_200_pci_init);
>> +
>> diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
>> index 304dd1a..d5d4064 100644
>> --- a/arch/arm/mach-kirkwood/common.h
>> +++ b/arch/arm/mach-kirkwood/common.h
>> @@ -94,6 +94,12 @@ void lsxl_init(void);
>>  static inline void lsxl_init(void) {};
>>  #endif
>>
>> +#ifdef CONFIG_MACH_IOMEGA_IX2_200_DT
>> +void iomega_ix2_200_init(void);
>> +#else
>> +static inline void iomega_ix2_200_init(void) {};
>> +#endif
>> +
>>  /* early init functions not converted to fdt yet */
>>  char *kirkwood_id(void);
>>  void kirkwood_l2_init(void);
>> Signed-off-by: Alan M Butler <alanbutty12@gmail.com>
>
> Please remove this line ^^^.  It isn't valid C ;-)  See my comment
> above.
>
> thx,
>
> Jason.
Thanks yeah first time using git first time trying to create a real
patch for linux (and learning how in the process) and trying to figure
out this device tree stuff.

As far as i can tell from looking at the iconnect button definition's
that part is correct (except for the proper codes to do what the
buttons should actually do) the error i get is:

[    5.976074] Key type dns_resolver registered
[    5.981782] Unable to handle kernel NULL pointer dereference at
virtual address 00000004
[    5.989932] pgd = c0004000
[    5.992649] [00000004] *pgd=00000000
[    5.996247] Internal error: Oops: 805 [#1] ARM
[    6.000707] Modules linked in:
[    6.003780] CPU: 0    Not tainted  (3.6.0-rc1-next-20120814 #13)
[    6.009822] PC is at gpio_keys_probe+0x110/0x6d4
[    6.014471] LR is at of_get_named_gpio_flags+0x90/0xb4
[    6.019634] pc : [<c02e3190>]    lr : [<c0191a80>]    psr: 60000013
[    6.019634] sp : cf82feb8  ip : 00000001  fp : cf867400
[    6.031158] r10: cf867408  r9 : 00000028  r8 : 00000000
[    6.036400] r7 : c07ebde0  r6 : c07ebe64  r5 : 00000000  r4 : ceff7600
[    6.042958] r3 : 00000001  r2 : c042e57c  r1 : 00000000  r0 : 00000023
[    6.049516] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM
Segment kernel
[    6.056857] Control: 0005397f  Table: 0eff8000  DAC: 00000017
[    6.062629] Process swapper (pid: 1, stack limit = 0xcf82e270)
[    6.068481] Stack: (0xcf82feb8 to 0xcf830000)
[    6.072851] fea0:
    00000000 cefff380
[    6.081071] fec0: cf865b40 c00e88f8 cf84e080 00000000 cf808bac
00000003 cf865b40 00000001
[    6.089286] fee0: cf86743c cf867408 cf86743c c04476cc c04476cc
00000034 c041d318 c03fb208
[    6.097500] ff00: 00000000 c01c7ccc c01c7cb8 c01c6dc4 00000000
cf867408 cf86743c c04476cc
[    6.105713] ff20: 00000000 c01c6f5c c04476cc cf82ff38 c01c6efc
c01c58b4 cf808b8c cf8641b0
[    6.113928] ff40: c04476cc c04476cc ceffe300 c0442d18 00000000
c01c654c c03aa8b2 c03aa8b3
[    6.122141] ff60: c04476cc c0412e40 00000000 c0451300 00000034
c01c7208 00000000 00000007
[    6.130355] ff80: c0412e40 00000000 c0451300 00000034 c03fb208
c0008554 00000007 00000007
[    6.138570] ffa0: 00000000 00000007 c0419614 00000007 c0419618
c04195f8 c0451300 00000034
[    6.146784] ffc0: c041d318 c03fb894 00000007 00000007 c03fb208
00000000 00000000 c03fb77c
[    6.154999] ffe0: c000a004 00000013 00000000 00000000 00000000
c000a004 80040038 08040038
[    6.163226] [<c02e3190>] (gpio_keys_probe+0x110/0x6d4) from
[<c01c7ccc>] (platform_drv_probe+0x14/0x18)
[    6.172676] [<c01c7ccc>] (platform_drv_probe+0x14/0x18) from
[<c01c6dc4>] (driver_probe_device+0xb8/0x1f0)
[    6.182385] [<c01c6dc4>] (driver_probe_device+0xb8/0x1f0) from
[<c01c6f5c>] (__driver_attach+0x60/0x84)
[    6.191827] [<c01c6f5c>] (__driver_attach+0x60/0x84) from
[<c01c58b4>] (bus_for_each_dev+0x4c/0x78)
[    6.200922] [<c01c58b4>] (bus_for_each_dev+0x4c/0x78) from
[<c01c654c>] (bus_add_driver+0xa8/0x21c)
[    6.210017] [<c01c654c>] (bus_add_driver+0xa8/0x21c) from
[<c01c7208>] (driver_register+0x9c/0x138)
[    6.219112] [<c01c7208>] (driver_register+0x9c/0x138) from
[<c0008554>] (do_one_initcall+0x90/0x168)
[    6.228294] [<c0008554>] (do_one_initcall+0x90/0x168) from
[<c03fb894>] (kernel_init+0x118/0x1d8)
[    6.237215] [<c03fb894>] (kernel_init+0x118/0x1d8) from
[<c000a004>] (kernel_thread_exit+0x0/0x8)
[    6.246130] Code: e5945000 ebfaba19 e0255899 e59d3024 (e5850004)
[    6.252273] ---[ end trace 192fd8390b667beb ]---
[    6.256946] Kernel panic - not syncing: Attempted to kill init!
exitcode=0x0000000b


and as for the git command i tried and what it tells me this is what i get:

git send-email --to="alanbutty12@gmail.com" --smtp-server=Gmail
--no-chain-reply-to --from="alanbutty12@gmail.com"
/tmp/patches/*.patch


error:
git: 'send-email' is not a git command. See 'git --help'.

I am using a ubuntu 11.10 vm to compile and do my patching and such on
if thats in any way useful.
Andrew Lunn Aug. 15, 2012, 9:15 p.m. UTC | #3
Hi Alan
...

> i did what you sujested and all commands worked except for the git
> sendmail part so i do not know if I should still be sending you the
> patch this way but here it is. i also defined the gpio keys in the dts
> file like you said the same as with the iconnect but the kernel keeps
> crashing with them defined in the dts is the support actualy there for
> the keys? or have i just defined them wrong?

...

> +		sata@80000 {
> +			compatible = "marvell,orion-sata";
> +			reg = <0x80000 0x5000>;
> +			interrupts = <21>;
> +			status = "okay";
> +			nr-ports = <2>;
> +		};

You should not need all the values above. All you need is what is
different to the defaults in kirkwood.dtsi. So i _think_ you need:

		sata@80000 {
			status = "okay";
			nr-ports = <2>;
		};


> +	gpio_keys {
> +		compatible = "gpio-keys";
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +		button@1 {
> +			label = "OTB Button";
> +			linux,code = <0x00>;

0x00 seems odd.  

From <linux/input.h>

#define KEY_RESERVED            0


> +			gpios = <&gpio1 4 1>;
> +			debounce-interval = <100>;
> +		};
> +		button@2 {
> +			label = "Reset";
> +			linux,code = <0x01>;

0x01 seems odd.
#define KEY_ESC                 1

> +			gpios = <&gpio0 12 1>;
> +			debounce-interval = <100>;
> +		};
> +		button@3 {
> +			label = "Power";
> +			linux,code = <0x028>;

#define KEY_APOSTROPHE          40

???

	Andrew
alan butler Aug. 15, 2012, 9:23 p.m. UTC | #4
On 15 August 2012 22:15, Andrew Lunn <andrew@lunn.ch> wrote:
> Hi Alan
> ...
>
>> i did what you sujested and all commands worked except for the git
>> sendmail part so i do not know if I should still be sending you the
>> patch this way but here it is. i also defined the gpio keys in the dts
>> file like you said the same as with the iconnect but the kernel keeps
>> crashing with them defined in the dts is the support actualy there for
>> the keys? or have i just defined them wrong?
>
> ...
>
>> +             sata@80000 {
>> +                     compatible = "marvell,orion-sata";
>> +                     reg = <0x80000 0x5000>;
>> +                     interrupts = <21>;
>> +                     status = "okay";
>> +                     nr-ports = <2>;
>> +             };
>
> You should not need all the values above. All you need is what is
> different to the defaults in kirkwood.dtsi. So i _think_ you need:
>
>                 sata@80000 {
>                         status = "okay";
>                         nr-ports = <2>;
>                 };
>
>
>> +     gpio_keys {
>> +             compatible = "gpio-keys";
>> +             #address-cells = <1>;
>> +             #size-cells = <0>;
>> +             button@1 {
>> +                     label = "OTB Button";
>> +                     linux,code = <0x00>;
>
> 0x00 seems odd.
>
> From <linux/input.h>
>
> #define KEY_RESERVED            0
>
>
>> +                     gpios = <&gpio1 4 1>;
>> +                     debounce-interval = <100>;
>> +             };
>> +             button@2 {
>> +                     label = "Reset";
>> +                     linux,code = <0x01>;
>
> 0x01 seems odd.
> #define KEY_ESC                 1
>
>> +                     gpios = <&gpio0 12 1>;
>> +                     debounce-interval = <100>;
>> +             };
>> +             button@3 {
>> +                     label = "Power";
>> +                     linux,code = <0x028>;
>
> #define KEY_APOSTROPHE          40
>
> ???
>
>         Andrew

ah yeah the last key was a typo and the second key was just what was
in the origional file i was creating the patch from until i can get
the system to properly boot with the buttons defined in the dts file.
(was just kinda using those values as placeholders till i get the
kernel to boot with them then figure out the proper codes)

As for the sata definition that was just an experiment i forgot to
change back (wanted to see if it made any difference).
alan butler Aug. 15, 2012, 9:57 p.m. UTC | #5
On 15 August 2012 22:52, Andrew Lunn <andrew@lunn.ch> wrote:
>> That would be great i just need to recreate the patch with those
>> changes but i was talking with jason cooper i believe and he said to
>> put the buttons for the device in the dts file and im working on that
>> but the kernel panics
>
> Please show us the panic.
>
>        Andrew

i sent it to jason a lil bit earlier but i guess i must of forgotten
to cc the list on the last message or 2 but here is the panic again:

[    5.976074] Key type dns_resolver registered
[    5.981782] Unable to handle kernel NULL pointer dereference at
virtual address 00000004
[    5.989932] pgd = c0004000
[    5.992649] [00000004] *pgd=00000000
[    5.996247] Internal error: Oops: 805 [#1] ARM
[    6.000707] Modules linked in:
[    6.003780] CPU: 0    Not tainted  (3.6.0-rc1-next-20120814 #13)
[    6.009822] PC is at gpio_keys_probe+0x110/0x6d4
[    6.014471] LR is at of_get_named_gpio_flags+0x90/0xb4
[    6.019634] pc : [<c02e3190>]    lr : [<c0191a80>]    psr: 60000013
[    6.019634] sp : cf82feb8  ip : 00000001  fp : cf867400
[    6.031158] r10: cf867408  r9 : 00000028  r8 : 00000000
[    6.036400] r7 : c07ebde0  r6 : c07ebe64  r5 : 00000000  r4 : ceff7600
[    6.042958] r3 : 00000001  r2 : c042e57c  r1 : 00000000  r0 : 00000023
[    6.049516] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM
Segment kernel
[    6.056857] Control: 0005397f  Table: 0eff8000  DAC: 00000017
[    6.062629] Process swapper (pid: 1, stack limit = 0xcf82e270)
[    6.068481] Stack: (0xcf82feb8 to 0xcf830000)
[    6.072851] fea0:
    00000000 cefff380
[    6.081071] fec0: cf865b40 c00e88f8 cf84e080 00000000 cf808bac
00000003 cf865b40 00000001
[    6.089286] fee0: cf86743c cf867408 cf86743c c04476cc c04476cc
00000034 c041d318 c03fb208
[    6.097500] ff00: 00000000 c01c7ccc c01c7cb8 c01c6dc4 00000000
cf867408 cf86743c c04476cc
[    6.105713] ff20: 00000000 c01c6f5c c04476cc cf82ff38 c01c6efc
c01c58b4 cf808b8c cf8641b0
[    6.113928] ff40: c04476cc c04476cc ceffe300 c0442d18 00000000
c01c654c c03aa8b2 c03aa8b3
[    6.122141] ff60: c04476cc c0412e40 00000000 c0451300 00000034
c01c7208 00000000 00000007
[    6.130355] ff80: c0412e40 00000000 c0451300 00000034 c03fb208
c0008554 00000007 00000007
[    6.138570] ffa0: 00000000 00000007 c0419614 00000007 c0419618
c04195f8 c0451300 00000034
[    6.146784] ffc0: c041d318 c03fb894 00000007 00000007 c03fb208
00000000 00000000 c03fb77c
[    6.154999] ffe0: c000a004 00000013 00000000 00000000 00000000
c000a004 80040038 08040038
[    6.163226] [<c02e3190>] (gpio_keys_probe+0x110/0x6d4) from
[<c01c7ccc>] (platform_drv_probe+0x14/0x18)
[    6.172676] [<c01c7ccc>] (platform_drv_probe+0x14/0x18) from
[<c01c6dc4>] (driver_probe_device+0xb8/0x1f0)
[    6.182385] [<c01c6dc4>] (driver_probe_device+0xb8/0x1f0) from
[<c01c6f5c>] (__driver_attach+0x60/0x84)
[    6.191827] [<c01c6f5c>] (__driver_attach+0x60/0x84) from
[<c01c58b4>] (bus_for_each_dev+0x4c/0x78)
[    6.200922] [<c01c58b4>] (bus_for_each_dev+0x4c/0x78) from
[<c01c654c>] (bus_add_driver+0xa8/0x21c)
[    6.210017] [<c01c654c>] (bus_add_driver+0xa8/0x21c) from
[<c01c7208>] (driver_register+0x9c/0x138)
[    6.219112] [<c01c7208>] (driver_register+0x9c/0x138) from
[<c0008554>] (do_one_initcall+0x90/0x168)
[    6.228294] [<c0008554>] (do_one_initcall+0x90/0x168) from
[<c03fb894>] (kernel_init+0x118/0x1d8)
[    6.237215] [<c03fb894>] (kernel_init+0x118/0x1d8) from
[<c000a004>] (kernel_thread_exit+0x0/0x8)
[    6.246130] Code: e5945000 ebfaba19 e0255899 e59d3024 (e5850004)
[    6.252273] ---[ end trace 192fd8390b667beb ]---
[    6.256946] Kernel panic - not syncing: Attempted to kill init!
exitcode=0x0000000b
Jason Cooper Aug. 15, 2012, 10:58 p.m. UTC | #6
On Wed, Aug 15, 2012 at 08:56:29PM +0000, alan butler wrote:
...
> >> +     gpio_keys {
> >> +             compatible = "gpio-keys";
> >> +             #address-cells = <1>;
> >> +             #size-cells = <0>;
> >> +             button@1 {
> >> +                     label = "OTB Button";
> >> +                     linux,code = <0x00>;
> >> +                     gpios = <&gpio1 4 1>;
> >> +                     debounce-interval = <100>;
> >> +             };
> >> +             button@2 {
> >> +                     label = "Reset";
> >> +                     linux,code = <0x01>;
> >> +                     gpios = <&gpio0 12 1>;
> >> +                     debounce-interval = <100>;
> >> +             };
> >> +             button@3 {
> >> +                     label = "Power";
> >> +                     linux,code = <0x028>;
> >> +                     gpios = <&gpio0 14 1>;
> >> +                     debounce-interval = <100>;
> >> +             };
> >> +     };
> >> +};
...
> As far as i can tell from looking at the iconnect button definition's
> that part is correct (except for the proper codes to do what the
> buttons should actually do) the error i get is:
> 
> [    5.976074] Key type dns_resolver registered
> [    5.981782] Unable to handle kernel NULL pointer dereference at
> virtual address 00000004
> [    5.989932] pgd = c0004000
> [    5.992649] [00000004] *pgd=00000000
> [    5.996247] Internal error: Oops: 805 [#1] ARM
> [    6.000707] Modules linked in:
> [    6.003780] CPU: 0    Not tainted  (3.6.0-rc1-next-20120814 #13)
> [    6.009822] PC is at gpio_keys_probe+0x110/0x6d4
> [    6.014471] LR is at of_get_named_gpio_flags+0x90/0xb4
> [    6.019634] pc : [<c02e3190>]    lr : [<c0191a80>]    psr: 60000013
> [    6.019634] sp : cf82feb8  ip : 00000001  fp : cf867400
> [    6.031158] r10: cf867408  r9 : 00000028  r8 : 00000000
> [    6.036400] r7 : c07ebde0  r6 : c07ebe64  r5 : 00000000  r4 : ceff7600
> [    6.042958] r3 : 00000001  r2 : c042e57c  r1 : 00000000  r0 : 00000023
> [    6.049516] Flags: nZCv  IRQs on  FIQs on  Mode SVC_32  ISA ARM
> Segment kernel
> [    6.056857] Control: 0005397f  Table: 0eff8000  DAC: 00000017
> [    6.062629] Process swapper (pid: 1, stack limit = 0xcf82e270)
> [    6.068481] Stack: (0xcf82feb8 to 0xcf830000)
> [    6.072851] fea0:
>     00000000 cefff380
> [    6.081071] fec0: cf865b40 c00e88f8 cf84e080 00000000 cf808bac
> 00000003 cf865b40 00000001
> [    6.089286] fee0: cf86743c cf867408 cf86743c c04476cc c04476cc
> 00000034 c041d318 c03fb208
> [    6.097500] ff00: 00000000 c01c7ccc c01c7cb8 c01c6dc4 00000000
> cf867408 cf86743c c04476cc
> [    6.105713] ff20: 00000000 c01c6f5c c04476cc cf82ff38 c01c6efc
> c01c58b4 cf808b8c cf8641b0
> [    6.113928] ff40: c04476cc c04476cc ceffe300 c0442d18 00000000
> c01c654c c03aa8b2 c03aa8b3
> [    6.122141] ff60: c04476cc c0412e40 00000000 c0451300 00000034
> c01c7208 00000000 00000007
> [    6.130355] ff80: c0412e40 00000000 c0451300 00000034 c03fb208
> c0008554 00000007 00000007
> [    6.138570] ffa0: 00000000 00000007 c0419614 00000007 c0419618
> c04195f8 c0451300 00000034
> [    6.146784] ffc0: c041d318 c03fb894 00000007 00000007 c03fb208
> 00000000 00000000 c03fb77c
> [    6.154999] ffe0: c000a004 00000013 00000000 00000000 00000000
> c000a004 80040038 08040038
> [    6.163226] [<c02e3190>] (gpio_keys_probe+0x110/0x6d4) from
> [<c01c7ccc>] (platform_drv_probe+0x14/0x18)
> [    6.172676] [<c01c7ccc>] (platform_drv_probe+0x14/0x18) from
> [<c01c6dc4>] (driver_probe_device+0xb8/0x1f0)
> [    6.182385] [<c01c6dc4>] (driver_probe_device+0xb8/0x1f0) from
> [<c01c6f5c>] (__driver_attach+0x60/0x84)
> [    6.191827] [<c01c6f5c>] (__driver_attach+0x60/0x84) from
> [<c01c58b4>] (bus_for_each_dev+0x4c/0x78)
> [    6.200922] [<c01c58b4>] (bus_for_each_dev+0x4c/0x78) from
> [<c01c654c>] (bus_add_driver+0xa8/0x21c)
> [    6.210017] [<c01c654c>] (bus_add_driver+0xa8/0x21c) from
> [<c01c7208>] (driver_register+0x9c/0x138)
> [    6.219112] [<c01c7208>] (driver_register+0x9c/0x138) from
> [<c0008554>] (do_one_initcall+0x90/0x168)
> [    6.228294] [<c0008554>] (do_one_initcall+0x90/0x168) from
> [<c03fb894>] (kernel_init+0x118/0x1d8)
> [    6.237215] [<c03fb894>] (kernel_init+0x118/0x1d8) from
> [<c000a004>] (kernel_thread_exit+0x0/0x8)
> [    6.246130] Code: e5945000 ebfaba19 e0255899 e59d3024 (e5850004)
> [    6.252273] ---[ end trace 192fd8390b667beb ]---
> [    6.256946] Kernel panic - not syncing: Attempted to kill init!
> exitcode=0x0000000b
> 

Take a look at Documentation/devicetree/bindings/gpio/gpio_keys.txt, I
think you need 'linux,input-type = "EV_SW";' for each of the buttons.
Or, the numerical equivalent, <0x05>.

> and as for the git command i tried and what it tells me this is what i get:
> 
> git send-email --to="alanbutty12@gmail.com" --smtp-server=Gmail
> --no-chain-reply-to --from="alanbutty12@gmail.com"
> /tmp/patches/*.patch
> 
> 
> error:
> git: 'send-email' is not a git command. See 'git --help'.

sudo apt-get install git-send-email

then, follow the section "Another method, I didn't try it" here:

https://mohammadthalif.wordpress.com/2010/01/02/configuring-git-send-email-to-use-gmail-smtp/

hth,

Jason.
alan butler Aug. 15, 2012, 11:12 p.m. UTC | #7
On 16 August 2012 00:02, alan butler <alanbutty12@gmail.com> wrote:
> On 15 August 2012 23:16, Andrew Lunn <andrew@lunn.ch> wrote:
>> On Wed, Aug 15, 2012 at 10:57:27PM +0100, alan butler wrote:
>>> On 15 August 2012 22:52, Andrew Lunn <andrew@lunn.ch> wrote:
>>> >> That would be great i just need to recreate the patch with those
>>> >> changes but i was talking with jason cooper i believe and he said to
>>> >> put the buttons for the device in the dts file and im working on that
>>> >> but the kernel panics
>>> >
>>> > Please show us the panic.
>>> >
>>> >        Andrew
>>>
>>> i sent it to jason a lil bit earlier but i guess i must of forgotten
>>> to cc the list on the last message or 2 but here is the panic again:
>>>
>>> [    5.976074] Key type dns_resolver registered
>>> [    5.981782] Unable to handle kernel NULL pointer dereference at
>>> virtual address 00000004
>>> [    5.989932] pgd = c0004000
>>> [    5.992649] [00000004] *pgd=00000000
>>> [    5.996247] Internal error: Oops: 805 [#1] ARM
>>> [    6.000707] Modules linked in:
>>> [    6.003780] CPU: 0    Not tainted  (3.6.0-rc1-next-20120814 #13)
>>> [    6.009822] PC is at gpio_keys_probe+0x110/0x6d4
>>
>> You might want to scatter some printk() in gpio_keys_probe() and see
>> where it panics. It will probably then be clear what is wrong.
>>
>>       Andrew
>
> where do i find the gpio_keys_probe() ?

i found the gpio_keys_probe() and it seems that it is failing in this
piece of code i put a printk() before and after it and it didnt reach
the printk after it:

if (!pdata) {
		pdata = gpio_keys_get_devtree_pdata(dev);
		if (IS_ERR(pdata))
			return PTR_ERR(pdata);
	}

	ddata = kzalloc(sizeof(struct gpio_keys_drvdata) +
			pdata->nbuttons * sizeof(struct gpio_button_data),
			GFP_KERNEL);
	input = input_allocate_device();
	if (!ddata || !input) {
		dev_err(dev, "failed to allocate state\n");
		error = -ENOMEM;
		goto fail1;
	}
alan butler Aug. 15, 2012, 11:34 p.m. UTC | #8
On 16 August 2012 00:12, alan butler <alanbutty12@gmail.com> wrote:
> On 16 August 2012 00:02, alan butler <alanbutty12@gmail.com> wrote:
>> On 15 August 2012 23:16, Andrew Lunn <andrew@lunn.ch> wrote:
>>> On Wed, Aug 15, 2012 at 10:57:27PM +0100, alan butler wrote:
>>>> On 15 August 2012 22:52, Andrew Lunn <andrew@lunn.ch> wrote:
>>>> >> That would be great i just need to recreate the patch with those
>>>> >> changes but i was talking with jason cooper i believe and he said to
>>>> >> put the buttons for the device in the dts file and im working on that
>>>> >> but the kernel panics
>>>> >
>>>> > Please show us the panic.
>>>> >
>>>> >        Andrew
>>>>
>>>> i sent it to jason a lil bit earlier but i guess i must of forgotten
>>>> to cc the list on the last message or 2 but here is the panic again:
>>>>
>>>> [    5.976074] Key type dns_resolver registered
>>>> [    5.981782] Unable to handle kernel NULL pointer dereference at
>>>> virtual address 00000004
>>>> [    5.989932] pgd = c0004000
>>>> [    5.992649] [00000004] *pgd=00000000
>>>> [    5.996247] Internal error: Oops: 805 [#1] ARM
>>>> [    6.000707] Modules linked in:
>>>> [    6.003780] CPU: 0    Not tainted  (3.6.0-rc1-next-20120814 #13)
>>>> [    6.009822] PC is at gpio_keys_probe+0x110/0x6d4
>>>
>>> You might want to scatter some printk() in gpio_keys_probe() and see
>>> where it panics. It will probably then be clear what is wrong.
>>>
>>>       Andrew
>>
>> where do i find the gpio_keys_probe() ?
>
> i found the gpio_keys_probe() and it seems that it is failing in this
> piece of code i put a printk() before and after it and it didnt reach
> the printk after it:
>
> if (!pdata) {
>                 pdata = gpio_keys_get_devtree_pdata(dev);
>                 if (IS_ERR(pdata))
>                         return PTR_ERR(pdata);
>         }
>
>         ddata = kzalloc(sizeof(struct gpio_keys_drvdata) +
>                         pdata->nbuttons * sizeof(struct gpio_button_data),
>                         GFP_KERNEL);
>         input = input_allocate_device();
>         if (!ddata || !input) {
>                 dev_err(dev, "failed to allocate state\n");
>                 error = -ENOMEM;
>                 goto fail1;
>         }

actualy it seems to not be getting past this piece of code in what i
posted before:

if (!pdata) {
		pdata = gpio_keys_get_devtree_pdata(dev);
		if (IS_ERR(pdata))
			return PTR_ERR(pdata);
	}
Jason Cooper Aug. 15, 2012, 11:41 p.m. UTC | #9
On Thu, Aug 16, 2012 at 12:34:46AM +0100, alan butler wrote:
> On 16 August 2012 00:12, alan butler <alanbutty12@gmail.com> wrote:
> > On 16 August 2012 00:02, alan butler <alanbutty12@gmail.com> wrote:
> >> On 15 August 2012 23:16, Andrew Lunn <andrew@lunn.ch> wrote:
> >>> On Wed, Aug 15, 2012 at 10:57:27PM +0100, alan butler wrote:
> >>>> On 15 August 2012 22:52, Andrew Lunn <andrew@lunn.ch> wrote:
> >>>> >> That would be great i just need to recreate the patch with those
> >>>> >> changes but i was talking with jason cooper i believe and he said to
> >>>> >> put the buttons for the device in the dts file and im working on that
> >>>> >> but the kernel panics
> >>>> >
> >>>> > Please show us the panic.
> >>>> >
> >>>> >        Andrew
> >>>>
> >>>> i sent it to jason a lil bit earlier but i guess i must of forgotten
> >>>> to cc the list on the last message or 2 but here is the panic again:
> >>>>
> >>>> [    5.976074] Key type dns_resolver registered
> >>>> [    5.981782] Unable to handle kernel NULL pointer dereference at
> >>>> virtual address 00000004
> >>>> [    5.989932] pgd = c0004000
> >>>> [    5.992649] [00000004] *pgd=00000000
> >>>> [    5.996247] Internal error: Oops: 805 [#1] ARM
> >>>> [    6.000707] Modules linked in:
> >>>> [    6.003780] CPU: 0    Not tainted  (3.6.0-rc1-next-20120814 #13)
> >>>> [    6.009822] PC is at gpio_keys_probe+0x110/0x6d4
> >>>
> >>> You might want to scatter some printk() in gpio_keys_probe() and see
> >>> where it panics. It will probably then be clear what is wrong.
> >>>
> >>>       Andrew
> >>
> >> where do i find the gpio_keys_probe() ?
> >
> > i found the gpio_keys_probe() and it seems that it is failing in this
> > piece of code i put a printk() before and after it and it didnt reach
> > the printk after it:
> >
> > if (!pdata) {
> >                 pdata = gpio_keys_get_devtree_pdata(dev);
> >                 if (IS_ERR(pdata))
> >                         return PTR_ERR(pdata);
> >         }
> >
> >         ddata = kzalloc(sizeof(struct gpio_keys_drvdata) +
> >                         pdata->nbuttons * sizeof(struct gpio_button_data),
> >                         GFP_KERNEL);
> >         input = input_allocate_device();
> >         if (!ddata || !input) {
> >                 dev_err(dev, "failed to allocate state\n");
> >                 error = -ENOMEM;
> >                 goto fail1;
> >         }
> 
> actualy it seems to not be getting past this piece of code in what i
> posted before:
> 
> if (!pdata) {
> 		pdata = gpio_keys_get_devtree_pdata(dev);
> 		if (IS_ERR(pdata))
> 			return PTR_ERR(pdata);
> 	}

That means gpio_keys_get_devtree_pdata() is returning an error.  Have
you tried 'linux,input-type = <0x05>;' ?

thx,

Jason.
alan butler Aug. 15, 2012, 11:52 p.m. UTC | #10
On 16 August 2012 00:41, Jason Cooper <jason@lakedaemon.net> wrote:
> On Thu, Aug 16, 2012 at 12:34:46AM +0100, alan butler wrote:
>> On 16 August 2012 00:12, alan butler <alanbutty12@gmail.com> wrote:
>> > On 16 August 2012 00:02, alan butler <alanbutty12@gmail.com> wrote:
>> >> On 15 August 2012 23:16, Andrew Lunn <andrew@lunn.ch> wrote:
>> >>> On Wed, Aug 15, 2012 at 10:57:27PM +0100, alan butler wrote:
>> >>>> On 15 August 2012 22:52, Andrew Lunn <andrew@lunn.ch> wrote:
>> >>>> >> That would be great i just need to recreate the patch with those
>> >>>> >> changes but i was talking with jason cooper i believe and he said to
>> >>>> >> put the buttons for the device in the dts file and im working on that
>> >>>> >> but the kernel panics
>> >>>> >
>> >>>> > Please show us the panic.
>> >>>> >
>> >>>> >        Andrew
>> >>>>
>> >>>> i sent it to jason a lil bit earlier but i guess i must of forgotten
>> >>>> to cc the list on the last message or 2 but here is the panic again:
>> >>>>
>> >>>> [    5.976074] Key type dns_resolver registered
>> >>>> [    5.981782] Unable to handle kernel NULL pointer dereference at
>> >>>> virtual address 00000004
>> >>>> [    5.989932] pgd = c0004000
>> >>>> [    5.992649] [00000004] *pgd=00000000
>> >>>> [    5.996247] Internal error: Oops: 805 [#1] ARM
>> >>>> [    6.000707] Modules linked in:
>> >>>> [    6.003780] CPU: 0    Not tainted  (3.6.0-rc1-next-20120814 #13)
>> >>>> [    6.009822] PC is at gpio_keys_probe+0x110/0x6d4
>> >>>
>> >>> You might want to scatter some printk() in gpio_keys_probe() and see
>> >>> where it panics. It will probably then be clear what is wrong.
>> >>>
>> >>>       Andrew
>> >>
>> >> where do i find the gpio_keys_probe() ?
>> >
>> > i found the gpio_keys_probe() and it seems that it is failing in this
>> > piece of code i put a printk() before and after it and it didnt reach
>> > the printk after it:
>> >
>> > if (!pdata) {
>> >                 pdata = gpio_keys_get_devtree_pdata(dev);
>> >                 if (IS_ERR(pdata))
>> >                         return PTR_ERR(pdata);
>> >         }
>> >
>> >         ddata = kzalloc(sizeof(struct gpio_keys_drvdata) +
>> >                         pdata->nbuttons * sizeof(struct gpio_button_data),
>> >                         GFP_KERNEL);
>> >         input = input_allocate_device();
>> >         if (!ddata || !input) {
>> >                 dev_err(dev, "failed to allocate state\n");
>> >                 error = -ENOMEM;
>> >                 goto fail1;
>> >         }
>>
>> actualy it seems to not be getting past this piece of code in what i
>> posted before:
>>
>> if (!pdata) {
>>               pdata = gpio_keys_get_devtree_pdata(dev);
>>               if (IS_ERR(pdata))
>>                       return PTR_ERR(pdata);
>>       }
>
> That means gpio_keys_get_devtree_pdata() is returning an error.  Have
> you tried 'linux,input-type = <0x05>;' ?
>
> thx,
>
> Jason.

'inux,input-type = <0x05>' instead of 'linux,code = <...>' in the dts?
no i havent tried will give it a try now.
alan butler Aug. 16, 2012, 10:36 a.m. UTC | #11
On 16 August 2012 01:00, alan butler <alanbutty12@gmail.com> wrote:
> On 16 August 2012 00:52, alan butler <alanbutty12@gmail.com> wrote:
>> On 16 August 2012 00:41, Jason Cooper <jason@lakedaemon.net> wrote:
>>> On Thu, Aug 16, 2012 at 12:34:46AM +0100, alan butler wrote:
>>>> On 16 August 2012 00:12, alan butler <alanbutty12@gmail.com> wrote:
>>>> > On 16 August 2012 00:02, alan butler <alanbutty12@gmail.com> wrote:
>>>> >> On 15 August 2012 23:16, Andrew Lunn <andrew@lunn.ch> wrote:
>>>> >>> On Wed, Aug 15, 2012 at 10:57:27PM +0100, alan butler wrote:
>>>> >>>> On 15 August 2012 22:52, Andrew Lunn <andrew@lunn.ch> wrote:
>>>> >>>> >> That would be great i just need to recreate the patch with those
>>>> >>>> >> changes but i was talking with jason cooper i believe and he said to
>>>> >>>> >> put the buttons for the device in the dts file and im working on that
>>>> >>>> >> but the kernel panics
>>>> >>>> >
>>>> >>>> > Please show us the panic.
>>>> >>>> >
>>>> >>>> >        Andrew
>>>> >>>>
>>>> >>>> i sent it to jason a lil bit earlier but i guess i must of forgotten
>>>> >>>> to cc the list on the last message or 2 but here is the panic again:
>>>> >>>>
>>>> >>>> [    5.976074] Key type dns_resolver registered
>>>> >>>> [    5.981782] Unable to handle kernel NULL pointer dereference at
>>>> >>>> virtual address 00000004
>>>> >>>> [    5.989932] pgd = c0004000
>>>> >>>> [    5.992649] [00000004] *pgd=00000000
>>>> >>>> [    5.996247] Internal error: Oops: 805 [#1] ARM
>>>> >>>> [    6.000707] Modules linked in:
>>>> >>>> [    6.003780] CPU: 0    Not tainted  (3.6.0-rc1-next-20120814 #13)
>>>> >>>> [    6.009822] PC is at gpio_keys_probe+0x110/0x6d4
>>>> >>>
>>>> >>> You might want to scatter some printk() in gpio_keys_probe() and see
>>>> >>> where it panics. It will probably then be clear what is wrong.
>>>> >>>
>>>> >>>       Andrew
>>>> >>
>>>> >> where do i find the gpio_keys_probe() ?
>>>> >
>>>> > i found the gpio_keys_probe() and it seems that it is failing in this
>>>> > piece of code i put a printk() before and after it and it didnt reach
>>>> > the printk after it:
>>>> >
>>>> > if (!pdata) {
>>>> >                 pdata = gpio_keys_get_devtree_pdata(dev);
>>>> >                 if (IS_ERR(pdata))
>>>> >                         return PTR_ERR(pdata);
>>>> >         }
>>>> >
>>>> >         ddata = kzalloc(sizeof(struct gpio_keys_drvdata) +
>>>> >                         pdata->nbuttons * sizeof(struct gpio_button_data),
>>>> >                         GFP_KERNEL);
>>>> >         input = input_allocate_device();
>>>> >         if (!ddata || !input) {
>>>> >                 dev_err(dev, "failed to allocate state\n");
>>>> >                 error = -ENOMEM;
>>>> >                 goto fail1;
>>>> >         }
>>>>
>>>> actualy it seems to not be getting past this piece of code in what i
>>>> posted before:
>>>>
>>>> if (!pdata) {
>>>>               pdata = gpio_keys_get_devtree_pdata(dev);
>>>>               if (IS_ERR(pdata))
>>>>                       return PTR_ERR(pdata);
>>>>       }
>>>
>>> That means gpio_keys_get_devtree_pdata() is returning an error.  Have
>>> you tried 'linux,input-type = <0x05>;' ?
>>>
>>> thx,
>>>
>>> Jason.
>>
>> 'inux,input-type = <0x05>' instead of 'linux,code = <...>' in the dts?
>> no i havent tried will give it a try now.
>
> with the buttons setup as follows:
> gpio-keys {
>                 compatible = "gpio-keys";
>                 #address-cells = <1>;
>                 #size-cells = <0>;
>                 iomotb {
>                         label = "OTB Button";
>                         linux,input-type = <133>;
>                         gpios = <&gpio1 3 1>;
>                         debounce-interval = <100>;
>                 };
>                 iomreset {
>                         label = "Reset";
>                         linux,input-type = <0x198>;
>                         gpios = <&gpio0 12 1>;
>                         debounce-interval = <100>;
>                 };
>         };
>
> it errors at the following:
>
> button->gpio = of_get_gpio_flags(pp, 0, &flags);
> button->active_low = flags & OF_GPIO_ACTIVE_LOW;

with the buttons setup like this:

gpio_keys {
		compatible = "gpio-keys";
		#address-cells = <1>;
		#size-cells = <0>;
		button@1 {
			label = "Reset Button";
			linux,code = <116>;
			gpios = <&gpio0 12 1>;
		};
		button@2 {
			label = "Power-on Switch";
			linux,code = <116>;
			gpios = <&gpio0 14 1>;
		};
		button@3 {
			label = "OTB Switch";
			linux,code = <142>;
			gpios = <&gpio1 3 1>;
		};
	};

the problem seems to be in this comming from this line:

button->gpio = of_get_gpio_flags(pp, 0, &flags);

in the function :

/*
 * Translate OpenFirmware node properties into platform_data
 */
static struct gpio_keys_platform_data * __devinit

of the gpio_keys.c file or whatever that line links to. It does not
know how to deal with some NULL reference as far as i can tell.
Jason Cooper Aug. 16, 2012, 12:43 p.m. UTC | #12
On Thu, Aug 16, 2012 at 12:52:18AM +0100, alan butler wrote:
> On 16 August 2012 00:41, Jason Cooper <jason@lakedaemon.net> wrote:
...
> > That means gpio_keys_get_devtree_pdata() is returning an error.  Have
> > you tried 'linux,input-type = <0x05>;' ?
> 
> 'inux,input-type = <0x05>' instead of 'linux,code = <...>' in the dts?
> no i havent tried will give it a try now.

no, use both.  Look at the original gpio code you had.  It specified
both the type and the code in the struct.  gpio_keys.txt says when
input-type isn't specified it defaults to EV_KEY, whereas your code set
it to EV_SW (0x05 in include/linux/inputh:181).

hth,

Jason.
Andrew Lunn Aug. 16, 2012, 10:10 p.m. UTC | #13
> the problem seems to be in this comming from this line:
> 
> button->gpio = of_get_gpio_flags(pp, 0, &flags);
> 
> in the function :
> 
> /*
>  * Translate OpenFirmware node properties into platform_data
>  */
> static struct gpio_keys_platform_data * __devinit
> 
> of the gpio_keys.c file or whatever that line links to. It does not
> know how to deal with some NULL reference as far as i can tell.

Do you mean this piece of code:

       while ((pp = of_get_next_child(node, pp))) {
                enum of_gpio_flags flags;

                if (!of_find_property(pp, "gpios", NULL)) {
                        pdata->nbuttons--;
                        dev_warn(dev, "Found button without gpios\n");
                        continue;
                }
                buttons[i].gpio = of_get_gpio_flags(pp, 0, &flags);

This would fit with:

[    5.981782] Unable to handle kernel NULL pointer dereference at
virtual address 00000004
  
since gpio is at offset 4 in buttons. What is the value of i when it
oppses? What is buttons[i]?

	Andrew
Fabio Estevam Aug. 17, 2012, 12:03 a.m. UTC | #14
On Thu, Aug 16, 2012 at 7:10 PM, Andrew Lunn <andrew@lunn.ch> wrote:

>
> This would fit with:
>
> [    5.981782] Unable to handle kernel NULL pointer dereference at
> virtual address 00000004

Can you check if this patch fixes your issue?
https://patchwork.kernel.org/patch/1270731/

Regards,

Fabio Estevam
diff mbox

Patch

diff --git a/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
b/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
new file mode 100644
index 0000000..7863009
--- /dev/null
+++ b/arch/arm/boot/dts/kirkwood-iomega_ix2_200.dts
@@ -0,0 +1,111 @@ 
+/dts-v1/;
+
+/include/ "kirkwood.dtsi"
+
+/ {
+	model = "Iomega StorCenter ix2-200";
+	compatible = "iom,ix2-200", "marvell,kirkwood-88f6281", "marvell,kirkwood";
+
+	memory {
+		device_type = "memory";
+		reg = <0x00000000 0x10000000>;
+	};
+
+	chosen {
+		bootargs = "console=ttyS0,115200n8 earlyprintk";
+	};
+
+	ocp@f1000000 {
+		i2c@11000 {
+			status = "okay";
+
+			lm63: lm63@4c {
+				compatible = "national,lm63";
+				reg = <0x4c>;
+			};
+		};
+
+		serial@12000 {
+			clock-frequency = <200000000>;
+			status = "ok";
+		};
+
+		nand@3000000 {
+			status = "okay";
+
+			partition@0 {
+				label = "u-boot";
+				reg = <0x0000000 0x100000>;
+				read-only;
+			};
+
+			partition@a0000 {
+				label = "env";
+				reg = <0xa0000 0x20000>;
+			};
+
+			partition@100000 {
+				label = "uImage";
+				reg = <0x100000 0x300000>;
+				read-only;
+			};
+
+			partition@400000 {
+				label = "uInitrd";
+				reg = <0x540000 0x1000000>;
+			};
+		};
+		sata@80000 {
+			compatible = "marvell,orion-sata";
+			reg = <0x80000 0x5000>;
+			interrupts = <21>;
+			status = "okay";
+			nr-ports = <2>;
+		};
+
+	};
+	gpio-leds {
+		compatible = "gpio-leds";
+
+		power_led {
+			label = "status:white:power_led";
+			gpios = <&gpio0 16 0>;
+			linux,default-trigger = "default-on";
+		};
+		rebuild_led {
+			label = "status:white:rebuild_led";
+			gpios = <&gpio1 5 0>;
+		};
+		health_led {
+			label = "status:red:health_led";
+			gpios = <&gpio1 6 0>;
+		};
+		backup_led {
+			label = "status:blue:backup_led";
+			gpios = <&gpio0 15 0>;
+		};
+	};
+	gpio_keys {
+		compatible = "gpio-keys";
+		#address-cells = <1>;
+		#size-cells = <0>;
+		button@1 {
+			label = "OTB Button";
+			linux,code = <0x00>;
+			gpios = <&gpio1 4 1>;
+			debounce-interval = <100>;
+		};
+		button@2 {
+			label = "Reset";
+			linux,code = <0x01>;
+			gpios = <&gpio0 12 1>;
+			debounce-interval = <100>;
+		};
+		button@3 {
+			label = "Power";
+			linux,code = <0x028>;
+			gpios = <&gpio0 14 1>;
+			debounce-interval = <100>;
+		};
+	};
+};
diff --git a/arch/arm/mach-kirkwood/Kconfig b/arch/arm/mach-kirkwood/Kconfig
index ca5c15a..bee8451 100644
--- a/arch/arm/mach-kirkwood/Kconfig
+++ b/arch/arm/mach-kirkwood/Kconfig
@@ -195,6 +195,13 @@  config MACH_T5325
 	  Say 'Y' here if you want your kernel to support the
 	  HP t5325 Thin Client.

+config MACH_IOMEGA_IX2_200_DT
+	bool "Iomega StorCenter ix2-200 (Flattened Device Tree)"
+	select ARCH_KIRKWOOD_DT
+	help
+	  Say 'Y' here if you want your kernel to support the
+	  Iomega StorCenter ix2-200 (Flattened Device Tree).
+
 endmenu

 endif
diff --git a/arch/arm/mach-kirkwood/Makefile b/arch/arm/mach-kirkwood/Makefile
index 055c85a..f5484dc 100644
--- a/arch/arm/mach-kirkwood/Makefile
+++ b/arch/arm/mach-kirkwood/Makefile
@@ -28,3 +28,4 @@  obj-$(CONFIG_MACH_IB62X0_DT)		+= board-ib62x0.o
 obj-$(CONFIG_MACH_TS219_DT)		+= board-ts219.o tsx1x-common.o
 obj-$(CONFIG_MACH_GOFLEXNET_DT)		+= board-goflexnet.o
 obj-$(CONFIG_MACH_LSXL_DT)		+= board-lsxl.o
+obj-$(CONFIG_MACH_IOMEGA_IX2_200_DT)	+= board-iomega_ix2_200.o
diff --git a/arch/arm/mach-kirkwood/Makefile.boot
b/arch/arm/mach-kirkwood/Makefile.boot
index 2a576ab..f8ef771 100644
--- a/arch/arm/mach-kirkwood/Makefile.boot
+++ b/arch/arm/mach-kirkwood/Makefile.boot
@@ -11,3 +11,4 @@  dtb-$(CONFIG_MACH_TS219_DT)	+= kirkwood-qnap-ts219.dtb
 dtb-$(CONFIG_MACH_GOFLEXNET_DT) += kirkwood-goflexnet.dtb
 dbt-$(CONFIG_MACH_LSXL_DT) += kirkwood-lschlv2.dtb
 dbt-$(CONFIG_MACH_LSXL_DT) += kirkwood-lsxhl.dtb
+dtb-$(CONFIG_MACH_IOMEGA_IX2_200_DT) += kirkwood-iomega_ix2_200.dtb
diff --git a/arch/arm/mach-kirkwood/board-dt.c
b/arch/arm/mach-kirkwood/board-dt.c
index e4eb450..a932ae9 100644
--- a/arch/arm/mach-kirkwood/board-dt.c
+++ b/arch/arm/mach-kirkwood/board-dt.c
@@ -87,6 +87,9 @@  static void __init kirkwood_dt_init(void)
 	if (of_machine_is_compatible("buffalo,lsxl"))
 		lsxl_init();

+	if (of_machine_is_compatible("iom,ix2-200"))
+		iomega_ix2_200_init()
+
 	of_platform_populate(NULL, kirkwood_dt_match_table,
 			     kirkwood_auxdata_lookup, NULL);
 }
@@ -100,6 +103,7 @@  static const char *kirkwood_dt_board_compat[] = {
 	"qnap,ts219",
 	"seagate,goflexnet",
 	"buffalo,lsxl",
+	"iom,ix2-200",
 	NULL
 };

diff --git a/arch/arm/mach-kirkwood/board-iomega_ix2_200.c
b/arch/arm/mach-kirkwood/board-iomega_ix2_200.c
new file mode 100644
index 0000000..a6bb98e
--- /dev/null
+++ b/arch/arm/mach-kirkwood/board-iomega_ix2_200.c
@@ -0,0 +1,80 @@ 
+/*
+ * arch/arm/mach-kirkwood/board-iomega_ix2_200.c
+ *
+ * Iomega StorCenter ix2-200
+ *
+ * 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/irq.h>
+#include <linux/mtd/partitions.h>
+#include <linux/ata_platform.h>
+#include <linux/mv643xx_eth.h>
+#include <linux/ethtool.h>
+#include <net/dsa.h>
+#include <linux/gpio.h>
+#include <linux/leds.h>
+#include <linux/i2c.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <mach/kirkwood.h>
+#include "common.h"
+#include "mpp.h"
+
+static struct mv643xx_eth_platform_data iomega_ix2_200_ge00_data = {
+	.phy_addr       = MV643XX_ETH_PHY_NONE,
+	.speed          = SPEED_1000,
+	.duplex         = DUPLEX_FULL,
+};
+
+static struct mv643xx_eth_platform_data iomega_ix2_200_ge01_data = {
+	.phy_addr	= MV643XX_ETH_PHY_ADDR(11),
+};
+
+static unsigned int iomega_ix2_200_mpp_config[] __initdata = {
+	MPP12_GPIO,			/* Reset Button */
+	MPP14_GPIO,			/* Power Button */
+	MPP15_GPIO,			/* Backup LED (blue) */
+	MPP16_GPIO,			/* Power LED (white) */
+	MPP35_GPIO,			/* OTB Button */
+	MPP36_GPIO,			/* Rebuild LED (white) */
+	MPP37_GPIO,			/* Health LED (red) */
+	MPP38_GPIO,			/* SATA LED brightness control 1 */
+	MPP39_GPIO,			/* SATA LED brightness control 2 */
+	MPP40_GPIO,			/* Backup LED brightness control 1 */
+	MPP41_GPIO,			/* Backup LED brightness control 2 */
+	MPP42_GPIO,			/* Power LED brightness control 1 */
+	MPP43_GPIO,			/* Power LED brightness control 2 */
+	MPP44_GPIO,			/* Health LED brightness control 1 */
+	MPP45_GPIO,			/* Health LED brightness control 2 */
+	MPP46_GPIO,			/* Rebuild LED brightness control 1 */
+	MPP47_GPIO,			/* Rebuild LED brightness control 2 */
+	0
+};
+
+void __init iomega_ix2_200_init(void)
+{
+	/*
+	 * Basic setup. Needs to be called early.
+	 */
+	kirkwood_mpp_conf(iomega_ix2_200_mpp_config);
+
+	kirkwood_ehci_init();
+
+	kirkwood_ge00_init(&iomega_ix2_200_ge00_data);
+	kirkwood_ge01_init(&iomega_ix2_200_ge01_data);
+}
+
+static int __init iomega_ix2_200_pci_init(void)
+{
+	if (of_machine_is_compatible("iom,ix2-200"))
+		kirkwood_pcie_init(KW_PCIE0);
+	return 0;
+}
+subsys_initcall(iomega_ix2_200_pci_init);
+
diff --git a/arch/arm/mach-kirkwood/common.h b/arch/arm/mach-kirkwood/common.h
index 304dd1a..d5d4064 100644
--- a/arch/arm/mach-kirkwood/common.h
+++ b/arch/arm/mach-kirkwood/common.h
@@ -94,6 +94,12 @@  void lsxl_init(void);
 static inline void lsxl_init(void) {};
 #endif

+#ifdef CONFIG_MACH_IOMEGA_IX2_200_DT
+void iomega_ix2_200_init(void);
+#else
+static inline void iomega_ix2_200_init(void) {};
+#endif
+
 /* early init functions not converted to fdt yet */
 char *kirkwood_id(void);
 void kirkwood_l2_init(void);