--- a/add_dns320l_support.patch Tue Sep 03 00:21:11 2013 +0200
+++ b/add_dns320l_support.patch Fri Sep 06 00:08:26 2013 +0200
@@ -1,301 +1,3 @@
---- 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
@@ -319,3 +21,10 @@
+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