Page MenuHomePhabricator

No OneTemporary

diff --git a/add_dns320l_support.patch b/add_dns320l_support.patch
--- a/add_dns320l_support.patch
+++ b/add_dns320l_support.patch
@@ -1,321 +1,30 @@
---- linux-3.1.arch-orig/arch/arm/mach-kirkwood/dns320l-setup.c 1970-01-01 01:00:00.000000000 +0100
-+++ linux-3.1/arch/arm/mach-kirkwood/dns320l-setup.c 2013-09-02 23:49:04.481512328 +0200
-@@ -0,0 +1,295 @@
-+/*
-+ * arch/arm/mach-kirkwood/dns320l-setup.c
-+ *
-+ * D-Link DNS-320L Setup File
-+ *
-+ * 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/ata_platform.h>
-+#include <linux/mtd/partitions.h>
-+#include <linux/mv643xx_eth.h>
-+#include <linux/gpio.h>
-+#include <linux/leds.h>
-+#include <asm/mach-types.h>
-+#include <asm/mach/arch.h>
-+#include <mach/kirkwood.h>
-+#include "common.h"
-+#include "mpp.h"
-+#include <linux/sysfs.h>
-+#include <linux/kobject.h>
-+#include <linux/mtd/nand.h>
-+#include <linux/i2c.h>
-+#include <linux/gpio_keys.h>
-+#include <linux/gpio-fan.h>
-+#include <linux/input.h>
-+
-+#define DNSKW_GPIO_LED_POWER 26
-+#define DNSKW_GPIO_LED_RED_R 27
-+#define DNSKW_GPIO_LED_RED_L 28
-+#define DNS325_GPIO_LED_RED_USB 29
-+#define DNS320_GPIO_LED_RED_USB 35
-+#define DNSKW_GPIO_LED_WHITE_R 20
-+#define DNSKW_GPIO_LED_WHITE_L 21
-+#define DNSKW_GPIO_LED_WHITE_USB 43
-+#define DNSKW_GPIO_FAN_ALARM 44
-+#define DNSKW_GPIO_FAN_HIGH 45
-+#define DNSKW_GPIO_FAN_LOW 46
-+#define DNSKW_GPIO_BTN_POWER 34
-+#define DNSKW_GPIO_BTN_UNMOUNT 47
-+#define DNSKW_GPIO_BTN_RESET 48
-+#define DNSKW_GPIO_POWER 36
-+#define DNSKW_GPIO_POWER_RECOVER 37
-+#define DNSKW_GPIO_POWER_SATA0 39
-+#define DNSKW_GPIO_POWER_SATA1 40
-+
-+static struct mtd_partition dns320l_nand_parts[] = {
-+ {
-+ .name = "u-boot",
-+ .offset = 0,
-+ .size = SZ_1M
-+ }, {
-+ .name = "uImage",
-+ .offset = MTDPART_OFS_NXTBLK,
-+ .size = 5 * SZ_1M
-+ }, {
-+ .name = "ramdisk",
-+ .offset = MTDPART_OFS_NXTBLK,
-+ .size = 5 * SZ_1M
-+ }, {
-+ .name = "image",
-+ .offset = MTDPART_OFS_NXTBLK,
-+ .size = 100 * SZ_1M
-+ }, {
-+ .name = "rescue firmware",
-+ .offset = MTDPART_OFS_NXTBLK,
-+ .size = 10 * SZ_1M
-+ }, {
-+ .name = "config",
-+ .offset = MTDPART_OFS_NXTBLK,
-+ .size = 5 * SZ_1M
-+ }, {
-+ .name = "my-dlink",
-+ .offset = MTDPART_OFS_NXTBLK,
-+ .size = 2 * SZ_1M
-+ },
-+};
-+
-+
-+static struct mv643xx_eth_platform_data dns320l_ge00_data = {
-+ .phy_addr = MV643XX_ETH_PHY_ADDR(0),
-+};
-+
-+static struct mv_sata_platform_data dns320l_sata_data = {
-+ .n_ports = 2,
-+};
-+
-+static void __init dnskw_gpio_register(unsigned gpio, char *name, int def)
-+{
-+ if (gpio_request(gpio, name) == 0 &&
-+ gpio_direction_output(gpio, 0) == 0) {
-+ gpio_set_value(gpio, def);
-+ if (gpio_export(gpio, 0) != 0)
-+ pr_err("dnskw: Failed to export GPIO %s\n", name);
-+ } else
-+ pr_err("dnskw: Failed to register %s\n", name);
-+}
-+
-+/*****************************************************************************
-+ * Buttons
-+ ****************************************************************************/
-+
-+static struct gpio_keys_button dnskw_button_pins[] = {
-+ {
-+ .code = KEY_POWER,
-+ .gpio = DNSKW_GPIO_BTN_POWER,
-+ .desc = "Power button",
-+ .active_low = 1,
-+ },
-+ {
-+ .code = KEY_EJECTCD,
-+ .gpio = DNSKW_GPIO_BTN_UNMOUNT,
-+ .desc = "USB unmount button",
-+ .active_low = 1,
-+ },
-+ {
-+ .code = KEY_RESTART,
-+ .gpio = DNSKW_GPIO_BTN_RESET,
-+ .desc = "Reset button",
-+ .active_low = 1,
-+ },
-+};
-+
-+static struct gpio_keys_platform_data dnskw_button_data = {
-+ .buttons = dnskw_button_pins,
-+ .nbuttons = ARRAY_SIZE(dnskw_button_pins),
-+};
-+
-+static struct platform_device dnskw_button_device = {
-+ .name = "gpio-keys",
-+ .id = -1,
-+ .num_resources = 0,
-+ .dev = {
-+ .platform_data = &dnskw_button_data,
-+ }
-+};
-+
-+/*****************************************************************************
-+ * LEDs
-+ ****************************************************************************/
-+
-+
-+#ifdef CONFIG_MACH_DNS320L
-+static struct gpio_led dns320_led_pins[] = {
-+ {
-+ .name = "dns320:blue:power",
-+ .gpio = DNSKW_GPIO_LED_POWER,
-+ .active_low = 1,
-+ .default_trigger = "default-on",
-+ },
-+ {
-+ .name = "dns320:blue:usb",
-+ .gpio = DNSKW_GPIO_LED_WHITE_USB,
-+ .active_low = 1,
-+ },
-+ {
-+ .name = "dns320:orange:l_hdd",
-+ .gpio = DNSKW_GPIO_LED_RED_L,
-+ .active_low = 1,
-+ },
-+ {
-+ .name = "dns320:orange:r_hdd",
-+ .gpio = DNSKW_GPIO_LED_RED_R,
-+ .active_low = 1,
-+ },
-+ {
-+ .name = "dns320:orange:usb",
-+ .gpio = DNS320_GPIO_LED_RED_USB,
-+ .active_low = 1,
-+ },
-+};
-+
-+static struct gpio_led_platform_data dns320_led_data = {
-+ .num_leds = ARRAY_SIZE(dns320_led_pins),
-+ .leds = dns320_led_pins,
-+};
-+
-+static struct platform_device dns320_led_device = {
-+ .name = "leds-gpio",
-+ .id = -1,
-+ .dev = {
-+ .platform_data = &dns320_led_data,
-+ },
-+};
-+#endif
-+
-+/*****************************************************************************
-+ * Fan
-+ ****************************************************************************/
-+
-+/* Fan: ADDA AD045HB-G73 40mm 6000rpm <at> 5v */
-+static struct gpio_fan_speed dnskw_fan_speed[] = {
-+ { 0, 0 },
-+ { 3000, 1 },
-+ { 6000, 2 },
-+};
-+
-+static unsigned dnskw_fan_pins[] = {
-+ DNSKW_GPIO_FAN_LOW,
-+ DNSKW_GPIO_FAN_HIGH,
-+};
-+
-+static struct gpio_fan_platform_data dnskw_fan_data = {
-+ .num_ctrl = ARRAY_SIZE(dnskw_fan_pins),
-+ .ctrl = dnskw_fan_pins,
-+ .num_speed = ARRAY_SIZE(dnskw_fan_speed),
-+ .speed = dnskw_fan_speed,
-+};
-+
-+static struct platform_device dnskw_fan_device = {
-+ .name = "gpio-fan",
-+ .id = -1,
-+ .dev = {
-+ .platform_data = &dnskw_fan_data,
-+ },
-+};
-+
-+static unsigned int dns320l_mpp_config[] __initdata = {
-+ MPP13_UART1_TXD, /* Custom ... */
-+ MPP14_UART1_RXD, /* ... Controller (DNS-320 only) */
-+ MPP20_SATA1_ACTn, /* LED: White Right HDD */
-+ MPP21_SATA0_ACTn, /* LED: White Left HDD */
-+ MPP24_GPIO,
-+ MPP25_GPIO,
-+ MPP26_GPIO, /* LED: Power */
-+ MPP27_GPIO, /* LED: Red Right HDD */
-+ MPP28_GPIO, /* LED: Red Left HDD */
-+ MPP29_GPIO, /* LED: Red USB (DNS-325 only) */
-+ MPP30_GPIO,
-+ MPP31_GPIO,
-+ MPP32_GPIO,
-+ MPP33_GPO,
-+ MPP34_GPIO, /* Button: Front power */
-+ MPP35_GPIO, /* LED: Red USB (DNS-320 only) */
-+ MPP36_GPIO, /* Power: MV88F6281_DEV_ID Board */
-+ MPP37_GPIO, /* Power: Boot when power applied */
-+ MPP38_GPIO,
-+ MPP39_GPIO, /* Power: SATA0 */
-+ MPP40_GPIO, /* Power: SATA1 */
-+ MPP41_GPIO,
-+ MPP42_GPIO,
-+ MPP43_GPIO, /* LED: White USB */
-+ MPP44_GPIO, /* Fan: Tachometer Pin */
-+ MPP45_GPIO, /* Fan: high speed */
-+ MPP46_GPIO, /* Fan: low speed */
-+ MPP47_GPIO, /* Button: Back unmount */
-+ MPP48_GPIO, /* Button: Back reset */
-+ MPP49_GPIO, /* Pin of unused U5 (DNS-320 only) */
-+ 0
-+};
-+
-+static void dnskw_power_off(void)
-+{
-+ gpio_set_value(DNSKW_GPIO_POWER, 1);
-+}
-+
-+static void __init dns320l_init(void)
-+{
-+ /*
-+ * Basic setup. Needs to be called early.
-+ */
-+ kirkwood_init();
-+ /* setup gpio pin select */
-+ kirkwood_mpp_conf(dns320l_mpp_config);
-+ kirkwood_uart0_init();
-+ kirkwood_uart1_init();
-+ kirkwood_nand_init(ARRAY_AND_SIZE(dns320l_nand_parts), 60);
-+
-+ kirkwood_ehci_init();
-+ kirkwood_i2c_init();
-+ kirkwood_ge00_init(&dns320l_ge00_data);
-+ platform_device_register(&dns320_led_device);
-+ dnskw_gpio_register(DNSKW_GPIO_POWER_SATA0, "dnskw:power:sata0", 1);
-+ dnskw_gpio_register(DNSKW_GPIO_POWER_SATA1, "dnskw:power:sata1", 1);
-+ kirkwood_sata_init(&dns320l_sata_data);
-+
-+ platform_device_register(&dnskw_button_device);
-+ platform_device_register(&dnskw_fan_device);
-+
-+}
-+
-+MACHINE_START(DNS320L, "DNS-320L")
-+ /* Maintainer: Andreas Boehler <andreas@aboehler.at> */
-+ .boot_params = 0x00000100,
-+ .init_machine = dns320l_init,
-+ .map_io = kirkwood_map_io,
-+ .init_early = kirkwood_init_early,
-+ .init_irq = kirkwood_init_irq,
-+ .timer = &kirkwood_timer,
-+MACHINE_END
-+
--- linux-3.1.arch-orig/arch/arm/mach-kirkwood/Kconfig 2013-08-31 01:01:15.248534683 +0200
+++ linux-3.1/arch/arm/mach-kirkwood/Kconfig 2013-09-02 18:54:10.319145257 +0200
@@ -196,6 +196,11 @@ config MACH_NSA320
Say 'Y' here if you want your kernel to support the
ZyXEL NSA320.
+config MACH_DNS320L
+ bool "D-Link DNS-320L NAS"
+ help
+ Say 'Y' here if you want your kernel to support the
+ D-Link DNS-320L.
endmenu
endif
--- linux-3.1.arch-orig/arch/arm/mach-kirkwood/Makefile 2013-08-31 01:01:15.248534683 +0200
+++ linux-3.1/arch/arm/mach-kirkwood/Makefile 2013-09-02 19:59:33.482264353 +0200
@@ -29,5 +29,6 @@ obj-$(CONFIG_MACH_BUBBA3) += bubba3-set
obj-$(CONFIG_MACH_T5325) += t5325-setup.o
obj-$(CONFIG_MACH_NSA310) += nsa310-setup.o
obj-$(CONFIG_MACH_NSA320) += nsa320-setup.o
+obj-$(CONFIG_MACH_DNS320L) += dns320l-setup.o
obj-$(CONFIG_CPU_IDLE) += cpuidle.o
+--- linux-3.1.arch-orig/arch/arm/tools/mach-types 2013-08-31 01:01:33.438533689 +0200
++++ linux-3.1/arch/arm/tools/mach-types 2013-09-02 18:52:44.529149942 +0200
+@@ -4694,3 +4694,4 @@ msm7x27_thunder MACH_MSM7X27_THUNDER MS
+ maxim MACH_MAXIM MAXIM 4740
+ telematicctrlunit MACH_TELEMATICCTRLUNIT TELEMATICCTRLUNIT 4741
+ mx6q_jcdbox MACH_MX6Q_JCDBOX MX6Q_JCDBOX 4742
++dns320l MACH_DNS320L DNS320L 4746
diff --git a/dns320l-setup.c b/dns320l-setup.c
new file mode 100644
--- /dev/null
+++ b/dns320l-setup.c
@@ -0,0 +1,236 @@
+/*
+ * arch/arm/mach-kirkwood/dns320l-setup.c
+ *
+ * D-Link DNS-320L Setup File
+ *
+ * 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/ata_platform.h>
+#include <linux/mtd/partitions.h>
+#include <linux/mv643xx_eth.h>
+#include <linux/gpio.h>
+#include <linux/leds.h>
+#include <asm/mach-types.h>
+#include <asm/mach/arch.h>
+#include <mach/kirkwood.h>
+#include "common.h"
+#include "mpp.h"
+#include <linux/sysfs.h>
+#include <linux/kobject.h>
+#include <linux/mtd/nand.h>
+#include <linux/i2c.h>
+#include <linux/gpio_keys.h>
+#include <linux/gpio-fan.h>
+#include <linux/input.h>
+
+#define DNS320L_GPIO_LED_SATA1 20
+#define DNS320L_GPIO_LED_SATA0 21
+#define DNS320L_GPIO_POWER_SATA 24
+#define DNS320L_GPIO_LED_USB_BLUE 25
+#define DNS320L_GPIO_LED_USB_ORANGE 26
+#define DNS320L_GPIO_BUTTON_USB 27
+
+static struct mtd_partition dns320l_nand_parts[] = {
+ {
+ .name = "u-boot",
+ .offset = 0,
+ .size = SZ_1M
+ }, {
+ .name = "uImage",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = 5 * SZ_1M
+ }, {
+ .name = "ramdisk",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = 5 * SZ_1M
+ }, {
+ .name = "image",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = 100 * SZ_1M
+ }, {
+ .name = "rescue firmware",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = 10 * SZ_1M
+ }, {
+ .name = "config",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = 5 * SZ_1M
+ }, {
+ .name = "my-dlink",
+ .offset = MTDPART_OFS_NXTBLK,
+ .size = 2 * SZ_1M
+ },
+};
+
+
+static struct mv643xx_eth_platform_data dns320l_ge00_data = {
+ .phy_addr = MV643XX_ETH_PHY_ADDR(0),
+};
+
+static struct mv_sata_platform_data dns320l_sata_data = {
+ .n_ports = 2,
+};
+
+static void __init dns320l_gpio_register(unsigned gpio, char *name, int def)
+{
+ if (gpio_request(gpio, name) == 0 &&
+ gpio_direction_output(gpio, 0) == 0) {
+ gpio_set_value(gpio, def);
+ if (gpio_export(gpio, 0) != 0)
+ pr_err("dns320l: Failed to export GPIO %s\n", name);
+ } else
+ pr_err("dns320l: Failed to register %s\n", name);
+}
+
+/*****************************************************************************
+ * Buttons
+ ****************************************************************************/
+
+static struct gpio_keys_button dns320l_button_pins[] = {
+ {
+ .code = KEY_EJECTCD,
+ .gpio = DNS320L_GPIO_BUTTON_USB,
+ .desc = "USB unmount button",
+ .active_low = 1,
+ }
+};
+
+static struct gpio_keys_platform_data dns320l_button_data = {
+ .buttons = dns320l_button_pins,
+ .nbuttons = ARRAY_SIZE(dns320l_button_pins),
+};
+
+static struct platform_device dns320l_button_device = {
+ .name = "gpio-keys",
+ .id = -1,
+ .num_resources = 0,
+ .dev = {
+ .platform_data = &dns320l_button_data,
+ }
+};
+
+/*****************************************************************************
+ * LEDs
+ ****************************************************************************/
+
+static struct gpio_led dns320l_led_pins[] = {
+ {
+ .name = "dns320l:blue:usb",
+ .gpio = DNS320L_GPIO_LED_USB_BLUE,
+ .default_trigger = "default-on",
+ },
+ {
+ .name = "dns320l:orange:usb",
+ .gpio = DNS320L_GPIO_LED_USB_ORANGE,
+ },
+ {
+ .name = "dns320l:blue:sata0",
+ .gpio = DNS320L_GPIO_LED_SATA0,
+ .default_trigger = "ide-disk"
+ },
+ {
+ .name = "dns320l:blue:sata1",
+ .gpio = DNS320L_GPIO_LED_SATA1,
+ .default_trigger = "ide-disk"
+ },
+// {
+// .name = "dns320l:blue:power",
+// .gpio = DNS320L_GPIO_LED_POWER,
+// },
+
+};
+
+static struct gpio_led_platform_data dns320l_led_data = {
+ .num_leds = ARRAY_SIZE(dns320l_led_pins),
+ .leds = dns320l_led_pins,
+};
+
+static struct platform_device dns320l_led_device = {
+ .name = "leds-gpio",
+ .id = -1,
+ .dev = {
+ .platform_data = &dns320l_led_data,
+ },
+};
+
+/*****************************************************************************
+ * Fan
+ ****************************************************************************/
+
+static unsigned int dns320l_mpp_config[] __initdata = {
+ MPP13_UART1_TXD,
+ MPP14_UART1_RXD,
+ MPP16_GPIO,
+ MPP17_GPIO,
+ MPP18_GPO,
+ MPP19_GPO,
+ MPP20_GPIO, // SATA LED
+ MPP21_GPIO, // SATA LED
+ MPP24_GPIO, // SATA Power
+ MPP25_GPIO, // USB LED Blue
+ MPP26_GPIO, // USB LED Orange
+ MPP27_GPIO, // Button USB Copy
+ MPP28_GPIO,
+ MPP29_GPIO,
+ MPP30_GPIO,
+ MPP31_GPIO,
+ MPP32_GPIO,
+ MPP33_GPO,
+ MPP34_GPIO,
+ MPP35_GPIO,
+ MPP36_GPIO,
+ MPP37_GPIO,
+ MPP38_GPIO,
+ MPP39_GPIO,
+ MPP40_GPIO,
+ MPP41_GPIO,
+ MPP42_GPIO,
+ MPP43_GPIO,
+ MPP44_GPIO,
+ MPP45_GPIO,
+ MPP46_GPIO,
+ MPP47_GPIO,
+ MPP48_GPIO,
+ MPP49_GPIO,
+ 0
+};
+
+static void __init dns320l_init(void)
+{
+ /*
+ * Basic setup. Needs to be called early.
+ */
+
+ kirkwood_init();
+ /* setup gpio pin select */
+ kirkwood_mpp_conf(dns320l_mpp_config);
+ kirkwood_uart0_init();
+ kirkwood_uart1_init();
+ kirkwood_nand_init(ARRAY_AND_SIZE(dns320l_nand_parts), 60);
+
+ kirkwood_ehci_init();
+ kirkwood_i2c_init();
+ kirkwood_ge00_init(&dns320l_ge00_data);
+ platform_device_register(&dns320l_led_device);
+ dns320l_gpio_register(DNS320L_GPIO_POWER_SATA, "dns320l:power:sata", 1);
+ kirkwood_sata_init(&dns320l_sata_data);
+
+ platform_device_register(&dns320l_button_device);
+}
+
+MACHINE_START(DNS320L, "DNS-320L")
+ /* Maintainer: Andreas Boehler <andreas@aboehler.at> */
+ .boot_params = 0x00000100,
+ .init_machine = dns320l_init,
+ .map_io = kirkwood_map_io,
+ .init_early = kirkwood_init_early,
+ .init_irq = kirkwood_init_irq,
+ .timer = &kirkwood_timer,
+MACHINE_END
+

File Metadata

Mime Type
text/x-diff
Expires
Fri, Jan 24, 5:11 AM (1 d, 21 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
532433
Default Alt Text
(15 KB)

Event Timeline