Index: target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig
===================================================================
--- target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig	(revision 35342)
+++ target/linux/ramips/files/arch/mips/ralink/rt305x/Kconfig	(working copy)
@@ -86,6 +86,11 @@
 	select RALINK_DEV_GPIO_BUTTONS
 	select RALINK_DEV_GPIO_LEDS
 
+config RT305X_MACH_DIR_320_REVB1
+	bool "D-Link DIR-320 revB1 board support"
+	select RALINK_DEV_GPIO_BUTTONS
+	select RALINK_DEV_GPIO_LEDS
+
 config RT305X_MACH_DIR_615_H1
 	bool "D-Link DIR-615 H1 board support"
 	select RALINK_DEV_GPIO_BUTTONS
Index: target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir-320-revb1.c
===================================================================
--- target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir-320-revb1.c	(revision 0)
+++ target/linux/ramips/files/arch/mips/ralink/rt305x/mach-dir-320-revb1.c	(revision 0)
@@ -0,0 +1,120 @@
+/*
+ *  D-Link DIR-320 rev B board support
+ *
+ *  Copyright (C) 2009-2010 Gabor Juhos <juhosg@openwrt.org>
+ *
+ *  This program is free software; you can redistribute it and/or modify it
+ *  under the terms of the GNU General Public License version 2 as published
+ *  by the Free Software Foundation.
+ */
+
+#include <linux/init.h>
+#include <linux/platform_device.h>
+#include <linux/spi/spi.h>
+#include <linux/spi/flash.h>
+#include <linux/mtd/mtd.h>
+#include <linux/mtd/partitions.h>
+#include <linux/mtd/physmap.h>
+
+#include <asm/mach-ralink/machine.h>
+#include <asm/mach-ralink/dev-gpio-buttons.h>
+#include <asm/mach-ralink/dev-gpio-leds.h>
+#include <asm/mach-ralink/rt305x.h>
+#include <asm/mach-ralink/rt305x_regs.h>
+
+#include "devices.h"
+
+#define DIR_320B1_GPIO_LED_STATUS_AMBER	8
+#define DIR_320B1_GPIO_LED_STATUS_GREEN	9
+#define DIR_320B1_GPIO_LED_WPS		13
+/*
+ * NOTE: The wan led is also connected to the switch, both
+ * switch and gpio must be active to make it light up
+ */
+#define DIR_320B1_GPIO_LED_WAN_GREEN	12
+#define DIR_320B1_GPIO_LED_USB		14
+
+#define DIR_320B1_GPIO_BUTTON_WPS	0	/* active low */
+#define DIR_320B1_GPIO_BUTTON_RESET	10	/* active low */
+
+#define DIR_320B1_KEYS_POLL_INTERVAL	20
+#define DIR_320B1_KEYS_DEBOUNCE_INTERVAL	(3 * DIR_320B1_KEYS_POLL_INTERVAL)
+
+static struct gpio_led dir_320b1_leds_gpio[] __initdata = {
+	{
+		.name		= "d-link:amber:status",
+		.gpio		= DIR_320B1_GPIO_LED_STATUS_AMBER,
+		.active_low	= 1,
+	}, {
+		.name		= "d-link:green:status",
+		.gpio		= DIR_320B1_GPIO_LED_STATUS_GREEN,
+		.active_low	= 1,
+	}, {
+		.name		= "d-link:green:wan",
+		.gpio		= DIR_320B1_GPIO_LED_WAN_GREEN,
+		.active_low	= 1,
+	}, {
+		.name		= "d-link:blue:wps",
+		.gpio		= DIR_320B1_GPIO_LED_WPS,
+		.active_low	= 1,
+	}, {
+		.name		= "d-link:green:usb",
+		.gpio		= DIR_320B1_GPIO_LED_USB,
+		.active_low	= 1,
+	}
+};
+
+static struct gpio_keys_button dir_320b1_gpio_buttons[] __initdata = {
+	{
+		.desc		= "reset",
+		.type		= EV_KEY,
+		.code		= KEY_RESTART,
+		.debounce_interval = DIR_320B1_KEYS_DEBOUNCE_INTERVAL,
+		.gpio		= DIR_320B1_GPIO_BUTTON_RESET,
+		.active_low	= 1,
+	}, {
+		.desc		= "wps",
+		.type		= EV_KEY,
+		.code		= KEY_WPS_BUTTON,
+		.debounce_interval = DIR_320B1_KEYS_DEBOUNCE_INTERVAL,
+		.gpio		= DIR_320B1_GPIO_BUTTON_WPS,
+		.active_low	= 1,
+	}
+};
+
+
+
+const struct flash_platform_data dir320b1_flash = {
+	.type		= "s25fl064k",
+};
+
+struct spi_board_info dir320b1_spi_slave_info[] __initdata = {
+	{
+		.modalias	= "m25p80",
+		.platform_data	= &dir320b1_flash,
+		.irq		= -1,
+		.max_speed_hz	= 10000000,
+		.bus_num	= 0,
+		.chip_select	= 0,
+	},
+};
+
+static void __init dir320b1_init(void)
+{
+	rt305x_gpio_init(RT305X_GPIO_MODE_GPIO << RT305X_GPIO_MODE_UART0_SHIFT);
+	rt305x_register_spi(dir320b1_spi_slave_info,
+			    ARRAY_SIZE(dir320b1_spi_slave_info));
+	rt305x_esw_data.vlan_config = RT305X_ESW_VLAN_CONFIG_LLLLW;
+	rt305x_register_ethernet();
+	ramips_register_gpio_leds(-1, ARRAY_SIZE(dir_320b1_leds_gpio),
+				  dir_320b1_leds_gpio);
+	ramips_register_gpio_buttons(-1, DIR_320B1_KEYS_POLL_INTERVAL,
+				     ARRAY_SIZE(dir_320b1_gpio_buttons),
+				     dir_320b1_gpio_buttons);
+	rt305x_register_wifi();
+	rt305x_register_wdt();
+	rt305x_register_usb();
+}
+
+MIPS_MACHINE(RAMIPS_MACH_DIR_320_B1, "DIR-320-B1", "D-Link DIR-320 B1",
+	     dir320b1_init);
Index: target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile
===================================================================
--- target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile	(revision 35342)
+++ target/linux/ramips/files/arch/mips/ralink/rt305x/Makefile	(working copy)
@@ -21,6 +21,7 @@
 obj-$(CONFIG_RT305X_MACH_BROADWAY)	+= mach-broadway.o
 obj-$(CONFIG_RT305X_MACH_CARAMBOLA)	+= mach-carambola.o
 obj-$(CONFIG_RT305X_MACH_DIR_300_REVB)	+= mach-dir-300-revb.o
+obj-$(CONFIG_RT305X_MACH_DIR_320_REVB1)	+= mach-dir-320-revb1.o
 obj-$(CONFIG_RT305X_MACH_DIR_615_H1)	+= mach-dir-615-h1.o
 obj-$(CONFIG_RT305X_MACH_DAP_1350)	+= mach-dap-1350.o
 obj-$(CONFIG_RT305X_MACH_ESR_9753)	+= mach-esr-9753.o
Index: target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h
===================================================================
--- target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h	(revision 35342)
+++ target/linux/ramips/files/arch/mips/include/asm/mach-ralink/machine.h	(working copy)
@@ -26,6 +26,7 @@
 	RAMIPS_MACH_ALL0256N,		/* Allnet ALL0256N */
 	RAMIPS_MACH_CARAMBOLA,		/* 8devices Carambola */
 	RAMIPS_MACH_DIR_300_B1,		/* D-Link DIR-300 B1 */
+	RAMIPS_MACH_DIR_320_B1,		/* D-Link DIR-320 B1 */
 	RAMIPS_MACH_DIR_600_B1,		/* D-Link DIR-600 B1 */
 	RAMIPS_MACH_DIR_600_B2,		/* D-Link DIR-600 B2 */
 	RAMIPS_MACH_DIR_615_D,		/* D-Link DIR-615 D */
Index: target/linux/ramips/rt305x/config-3.7
===================================================================
--- target/linux/ramips/rt305x/config-3.7	(revision 35342)
+++ target/linux/ramips/rt305x/config-3.7	(working copy)
@@ -114,6 +114,7 @@
 CONFIG_RT305X_MACH_DAP_1350=y
 CONFIG_RT305X_MACH_DIR_300_REVB=y
 CONFIG_RT305X_MACH_DIR_615_H1=y
+CONFIG_RT305X_MACH_DIR_320_REVB1=y
 CONFIG_RT305X_MACH_ESR_9753=y
 CONFIG_RT305X_MACH_F5D8235_V2=y
 CONFIG_RT305X_MACH_FONERA20N=y
