From: Thomas Petazzoni Date: Fri, 16 Nov 2012 15:39:46 +0000 (+0100) Subject: arm: orion5x: convert 'LaCie Ethernet Disk mini v2' to Device Tree X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=07f645df9ff2550749b806af626576d5ad418215;p=linux-beck.git arm: orion5x: convert 'LaCie Ethernet Disk mini v2' to Device Tree 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 Acked-by: Andrew Lunn Signed-off-by: Jason Cooper --- diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile index eef6545f65ee..f1ba69c2496a 100644 --- a/arch/arm/boot/dts/Makefile +++ b/arch/arm/boot/dts/Makefile @@ -81,6 +81,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 000000000000..5a3a58b7e18f --- /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 0910c3bd0c99..2cb2f06c20f5 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 843e6deb66d0..9e809a7c05c0 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 a26397f58f1f..32e5c211a89b 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 2033b79089a7..7db5cdd9c4b7 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 355e962137c7..d675e727803d 100644 --- a/arch/arm/mach-orion5x/edmini_v2-setup.c +++ b/arch/arm/mach-orion5x/edmini_v2-setup.c @@ -114,69 +114,6 @@ static struct i2c_board_info __initdata edmini_v2_i2c_rtc = { .irq = 0, }; -/***************************************************************************** - * 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 ****************************************************************************/ @@ -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