From patchwork Fri Nov 16 15:39:46 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thomas Petazzoni X-Patchwork-Id: 1756011 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id B65AEDF288 for ; Fri, 16 Nov 2012 15:43:55 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TZO2y-0001d8-2D; Fri, 16 Nov 2012 15:41:37 +0000 Received: from mail.free-electrons.com ([88.190.12.23]) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TZO1e-00012u-Rd for linux-arm-kernel@lists.infradead.org; Fri, 16 Nov 2012 15:40:21 +0000 Received: by mail.free-electrons.com (Postfix, from userid 106) id 20A35DB; Fri, 16 Nov 2012 16:40:09 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-3.4 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_00 shortcircuit=no autolearn=ham version=3.3.1 Received: from localhost (col31-4-88-188-83-94.fbx.proxad.net [88.188.83.94]) by mail.free-electrons.com (Postfix) with ESMTPSA id D1BDF163; Fri, 16 Nov 2012 16:39:53 +0100 (CET) From: Thomas Petazzoni To: Jason Cooper , Andrew Lunn Subject: [PATCH 3/4] arm: orion5x: convert 'LaCie Ethernet Disk mini v2' to Device Tree Date: Fri, 16 Nov 2012 16:39:46 +0100 Message-Id: <1353080388-4091-4-git-send-email-thomas.petazzoni@free-electrons.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1353080388-4091-1-git-send-email-thomas.petazzoni@free-electrons.com> References: <1353080388-4091-1-git-send-email-thomas.petazzoni@free-electrons.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20121116_104015_746769_68D696A6 X-CRM114-Status: GOOD ( 20.49 ) X-Spam-Score: -2.6 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.6 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.7 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] Cc: Gregory Clement , Lior Amsalem , mhadjinlian@lacie.com, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org This commit converts the 'LaCie Ethernet Disk mini v2' board to the Device Tree. All devices that have existing Device Tree bindings are converted over to the Device Tree, the other devices remain instantiated in the old way, until the respective drivers get the needed Device Tree bindings. Signed-off-by: Thomas Petazzoni Tested by: Maxime Hadjinlian --- arch/arm/boot/dts/Makefile | 1 + .../dts/orion5x-lacie-ethernet-disk-mini-v2.dts | 55 ++++++++++++ arch/arm/mach-orion5x/Kconfig | 7 +- arch/arm/mach-orion5x/Makefile | 2 +- arch/arm/mach-orion5x/board-dt.c | 3 + arch/arm/mach-orion5x/common.h | 7 ++ arch/arm/mach-orion5x/edmini_v2-setup.c | 88 +------------------- 7 files changed, 72 insertions(+), 91 deletions(-) create mode 100644 arch/arm/boot/dts/orion5x-lacie-ethernet-disk-mini-v2.dts diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index f37cf9f..6cb3b3c 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -73,6 +73,7 @@ dtb-$(CONFIG_ARCH_OMAP2PLUS) += omap2420-h4.dtb \ omap5-evm.dtb \ am335x-evm.dtb \ am335x-bone.dtb +dtb-$(CONFIG_ARCH_ORION5X) += orion5x-lacie-ethernet-disk-mini-v2.dtb dtb-$(CONFIG_ARCH_PRIMA2) += prima2-evb.dtb dtb-$(CONFIG_ARCH_U8500) += snowball.dtb dtb-$(CONFIG_ARCH_SHMOBILE) += emev2-kzm9d.dtb \ diff --git a/arch/arm/boot/dts/orion5x-lacie-ethernet-disk-mini-v2.dts b/arch/arm/boot/dts/orion5x-lacie-ethernet-disk-mini-v2.dts new file mode 100644 index 0000000..5a3a58b --- /dev/null +++ b/arch/arm/boot/dts/orion5x-lacie-ethernet-disk-mini-v2.dts @@ -0,0 +1,55 @@ +/* + * Copyright (C) 2012 Thomas Petazzoni + * + * 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. + */ + +/dts-v1/; +/include/ "orion5x.dtsi" + +/ { + model = "LaCie Ethernet Disk mini V2"; + compatible = "lacie,ethernet-disk-mini-v2", "marvell-orion5x-88f5182", "marvell,orion5x"; + + memory { + reg = <0x00000000 0x4000000>; /* 64 MB */ + }; + + chosen { + bootargs = "console=ttyS0,115200n8 earlyprintk"; + }; + + ocp@f1000000 { + serial@12000 { + clock-frequency = <166666667>; + status = "okay"; + }; + + sata@80000 { + status = "okay"; + nr-ports = <2>; + }; + }; + + gpio_keys { + compatible = "gpio-keys"; + #address-cells = <1>; + #size-cells = <0>; + button@1 { + label = "Power-on Switch"; + linux,code = <116>; /* KEY_POWER */ + gpios = <&gpio0 18 0>; + }; + }; + + gpio_leds { + compatible = "gpio-leds"; + + led@1 { + label = "power:blue"; + gpios = <&gpio0 16 1>; + }; + }; +}; diff --git a/arch/arm/mach-orion5x/Kconfig b/arch/arm/mach-orion5x/Kconfig index 0910c3b..2cb2f06 100644 --- a/arch/arm/mach-orion5x/Kconfig +++ b/arch/arm/mach-orion5x/Kconfig @@ -103,12 +103,13 @@ config MACH_MV2120 Say 'Y' here if you want your kernel to support the HP Media Vault mv2120 or mv5100. -config MACH_EDMINI_V2 - bool "LaCie Ethernet Disk mini V2" +config MACH_EDMINI_V2_DT + bool "LaCie Ethernet Disk mini V2 (Flattened Device Tree)" select I2C_BOARDINFO + select ARCH_ORION5X_DT help Say 'Y' here if you want your kernel to support the - LaCie Ethernet Disk mini V2. + LaCie Ethernet Disk mini V2 (Flattened Device Tree). config MACH_D2NET bool "LaCie d2 Network" diff --git a/arch/arm/mach-orion5x/Makefile b/arch/arm/mach-orion5x/Makefile index 843e6de..9e809a7 100644 --- a/arch/arm/mach-orion5x/Makefile +++ b/arch/arm/mach-orion5x/Makefile @@ -12,7 +12,6 @@ obj-$(CONFIG_MACH_TS409) += ts409-setup.o tsx09-common.o obj-$(CONFIG_MACH_WRT350N_V2) += wrt350n-v2-setup.o obj-$(CONFIG_MACH_TS78XX) += ts78xx-setup.o obj-$(CONFIG_MACH_MV2120) += mv2120-setup.o -obj-$(CONFIG_MACH_EDMINI_V2) += edmini_v2-setup.o obj-$(CONFIG_MACH_D2NET) += d2net-setup.o obj-$(CONFIG_MACH_BIGDISK) += d2net-setup.o obj-$(CONFIG_MACH_NET2BIG) += net2big-setup.o @@ -24,3 +23,4 @@ obj-$(CONFIG_MACH_RD88F6183AP_GE) += rd88f6183ap-ge-setup.o obj-$(CONFIG_MACH_LINKSTATION_LSCHL) += ls-chl-setup.o obj-$(CONFIG_ARCH_ORION5X_DT) += board-dt.o +obj-$(CONFIG_MACH_EDMINI_V2_DT) += edmini_v2-setup.o diff --git a/arch/arm/mach-orion5x/board-dt.c b/arch/arm/mach-orion5x/board-dt.c index a26397f..32e5c21 100644 --- a/arch/arm/mach-orion5x/board-dt.c +++ b/arch/arm/mach-orion5x/board-dt.c @@ -55,6 +55,9 @@ static void __init orion5x_dt_init(void) disable_hlt(); } + if (of_machine_is_compatible("lacie,ethernet-disk-mini-v2")) + edmini_v2_init(); + of_platform_populate(NULL, of_default_bus_match_table, orion5x_auxdata_lookup, NULL); } diff --git a/arch/arm/mach-orion5x/common.h b/arch/arm/mach-orion5x/common.h index 2033b79..7db5cdd 100644 --- a/arch/arm/mach-orion5x/common.h +++ b/arch/arm/mach-orion5x/common.h @@ -56,6 +56,13 @@ int orion5x_pci_sys_setup(int nr, struct pci_sys_data *sys); struct pci_bus *orion5x_pci_sys_scan_bus(int nr, struct pci_sys_data *sys); int orion5x_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin); +/* board init functions for boards not fully converted to fdt */ +#ifdef CONFIG_MACH_EDMINI_V2_DT +void edmini_v2_init(void); +#else +static inline void edmini_v2_init(void) {}; +#endif + struct meminfo; struct tag; extern void __init tag_fixup_mem32(struct tag *, char **, struct meminfo *); diff --git a/arch/arm/mach-orion5x/edmini_v2-setup.c b/arch/arm/mach-orion5x/edmini_v2-setup.c index 355e962..d675e72 100644 --- a/arch/arm/mach-orion5x/edmini_v2-setup.c +++ b/arch/arm/mach-orion5x/edmini_v2-setup.c @@ -115,69 +115,6 @@ static struct i2c_board_info __initdata edmini_v2_i2c_rtc = { }; /***************************************************************************** - * Sata - ****************************************************************************/ - -static struct mv_sata_platform_data edmini_v2_sata_data = { - .n_ports = 2, -}; - -/***************************************************************************** - * GPIO LED (simple - doesn't use hardware blinking support) - ****************************************************************************/ - -#define EDMINI_V2_GPIO_LED_POWER 16 - -static struct gpio_led edmini_v2_leds[] = { - { - .name = "power:blue", - .gpio = EDMINI_V2_GPIO_LED_POWER, - .active_low = 1, - }, -}; - -static struct gpio_led_platform_data edmini_v2_led_data = { - .num_leds = ARRAY_SIZE(edmini_v2_leds), - .leds = edmini_v2_leds, -}; - -static struct platform_device edmini_v2_gpio_leds = { - .name = "leds-gpio", - .id = -1, - .dev = { - .platform_data = &edmini_v2_led_data, - }, -}; - -/**************************************************************************** - * GPIO key - ****************************************************************************/ - -#define EDMINI_V2_GPIO_KEY_POWER 18 - -static struct gpio_keys_button edmini_v2_buttons[] = { - { - .code = KEY_POWER, - .gpio = EDMINI_V2_GPIO_KEY_POWER, - .desc = "Power Button", - .active_low = 0, - }, -}; - -static struct gpio_keys_platform_data edmini_v2_button_data = { - .buttons = edmini_v2_buttons, - .nbuttons = ARRAY_SIZE(edmini_v2_buttons), -}; - -static struct platform_device edmini_v2_gpio_buttons = { - .name = "gpio-keys", - .id = -1, - .dev = { - .platform_data = &edmini_v2_button_data, - }, -}; - -/***************************************************************************** * General Setup ****************************************************************************/ static unsigned int edminiv2_mpp_modes[] __initdata = { @@ -207,13 +144,8 @@ static unsigned int edminiv2_mpp_modes[] __initdata = { 0, }; -static void __init edmini_v2_init(void) +void __init edmini_v2_init(void) { - /* - * Setup basic Orion functions. Need to be called early. - */ - orion5x_init(); - orion5x_mpp_conf(edminiv2_mpp_modes); /* @@ -221,15 +153,10 @@ static void __init edmini_v2_init(void) */ orion5x_ehci0_init(); orion5x_eth_init(&edmini_v2_eth_data); - orion5x_i2c_init(); - orion5x_sata_init(&edmini_v2_sata_data); - orion5x_uart0_init(); orion5x_setup_dev_boot_win(EDMINI_V2_NOR_BOOT_BASE, EDMINI_V2_NOR_BOOT_SIZE); platform_device_register(&edmini_v2_nor_flash); - platform_device_register(&edmini_v2_gpio_leds); - platform_device_register(&edmini_v2_gpio_buttons); pr_notice("edmini_v2: USB device port, flash write and power-off " "are not yet supported.\n"); @@ -247,16 +174,3 @@ static void __init edmini_v2_init(void) i2c_register_board_info(0, &edmini_v2_i2c_rtc, 1); } - -/* Warning: LaCie use a wrong mach-type (0x20e=526) in their bootloader. */ -MACHINE_START(EDMINI_V2, "LaCie Ethernet Disk mini V2") - /* Maintainer: Christopher Moore */ - .atag_offset = 0x100, - .init_machine = edmini_v2_init, - .map_io = orion5x_map_io, - .init_early = orion5x_init_early, - .init_irq = orion5x_init_irq, - .timer = &orion5x_timer, - .fixup = tag_fixup_mem32, - .restart = orion5x_restart, -MACHINE_END