aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/orion
diff options
context:
space:
mode:
authorblogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-10-05 10:12:53 +0000
committerblogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-10-05 10:12:53 +0000
commit5c105d9f3fd086aff195d3849dcf847d6b0bd927 (patch)
tree1229a11f725bfa58aa7c57a76898553bb5f6654a /target/linux/orion
downloadopenwrt-5c105d9f3fd086aff195d3849dcf847d6b0bd927.tar.gz
openwrt-5c105d9f3fd086aff195d3849dcf847d6b0bd927.zip
branch Attitude Adjustment
git-svn-id: svn://svn.openwrt.org/openwrt/branches/attitude_adjustment@33625 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/orion')
-rw-r--r--target/linux/orion/Makefile24
-rw-r--r--target/linux/orion/base-files/etc/config/network22
-rw-r--r--target/linux/orion/base-files/etc/hotplug.d/usb/10-usb54
-rw-r--r--target/linux/orion/config-3.3182
-rw-r--r--target/linux/orion/dns323/base-files/etc/config/network12
-rw-r--r--target/linux/orion/dns323/config-3.347
-rw-r--r--target/linux/orion/dns323/target.mk6
-rw-r--r--target/linux/orion/files/arch/arm/mach-orion5x/dt2-common.h82
-rw-r--r--target/linux/orion/files/arch/arm/mach-orion5x/dt2-setup.c446
-rw-r--r--target/linux/orion/generic/base-files/etc/uci-defaults/hardware54
-rw-r--r--target/linux/orion/generic/base-files/lib/upgrade/platform.sh38
-rw-r--r--target/linux/orion/generic/target.mk14
-rw-r--r--target/linux/orion/harddisk/config-3.328
-rw-r--r--target/linux/orion/harddisk/target.mk14
-rw-r--r--target/linux/orion/image/Makefile12
-rw-r--r--target/linux/orion/image/dns323.mk36
-rw-r--r--target/linux/orion/image/generic.mk218
-rw-r--r--target/linux/orion/image/harddisk.mk55
-rw-r--r--target/linux/orion/patches-3.3/100-wrt350nv2_openwrt_partition_map.patch32
-rw-r--r--target/linux/orion/patches-3.3/101-wnr854t_partition_map.patch13
-rw-r--r--target/linux/orion/patches-3.3/200-dt2_board_support.patch26
-rw-r--r--target/linux/orion/patches-3.3/300-dns323_partition_map.patch30
-rw-r--r--target/linux/orion/patches-3.3/400-fix-section-mismatch-warnings.patch31
-rw-r--r--target/linux/orion/patches-3.3/a01-dt2-fixes-for-3.3.patch34
24 files changed, 1510 insertions, 0 deletions
diff --git a/target/linux/orion/Makefile b/target/linux/orion/Makefile
new file mode 100644
index 000000000..b81c4f5cc
--- /dev/null
+++ b/target/linux/orion/Makefile
@@ -0,0 +1,24 @@
+#
+# Copyright (C) 2008-2011 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+
+ARCH:=arm
+BOARD:=orion
+BOARDNAME:=Marvell Orion
+SUBTARGETS:=generic harddisk dns323
+CFLAGS=-Os -pipe -march=armv5te -mtune=xscale -fno-caller-saves
+MAINTAINER:=Imre Kaloz <kaloz@openwrt.org>
+
+LINUX_VERSION:=3.3.8
+
+include $(INCLUDE_DIR)/target.mk
+
+KERNELNAME:="uImage"
+
+DEFAULT_PACKAGES += kmod-ath9k kmod-crypto-mv-cesa wpad-mini
+
+$(eval $(call BuildTarget))
diff --git a/target/linux/orion/base-files/etc/config/network b/target/linux/orion/base-files/etc/config/network
new file mode 100644
index 000000000..e7fdecd0e
--- /dev/null
+++ b/target/linux/orion/base-files/etc/config/network
@@ -0,0 +1,22 @@
+# Copyright (C) 2008 OpenWrt.org
+
+config interface loopback
+ option ifname lo
+ option proto static
+ option ipaddr 127.0.0.1
+ option netmask 255.0.0.0
+
+config interface eth0
+ option ifname eth0
+
+config interface wan
+ option ifname wan
+ option proto dhcp
+ option hostname openwrt
+
+config interface lan
+ option ifname "lan1 lan2 lan3 lan4"
+ option type bridge
+ option proto static
+ option ipaddr 192.168.1.1
+ option netmask 255.255.255.0
diff --git a/target/linux/orion/base-files/etc/hotplug.d/usb/10-usb b/target/linux/orion/base-files/etc/hotplug.d/usb/10-usb
new file mode 100644
index 000000000..5572daede
--- /dev/null
+++ b/target/linux/orion/base-files/etc/hotplug.d/usb/10-usb
@@ -0,0 +1,54 @@
+#!/bin/sh
+#
+# Copyright (C) 2009-2010 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+usb_led=''
+usb_device=''
+
+led_set_attr() {
+ [ -f "/sys/class/leds/$1/$2" ] && echo "$3" > "/sys/class/leds/$1/$2"
+}
+
+usb_led_set_timer() {
+ led_set_attr "${usb_led}" 'trigger' 'timer'
+ led_set_attr "${usb_led}" 'delay_on' "$1"
+ led_set_attr "${usb_led}" 'delay_off' "$2"
+}
+
+usb_led_on() {
+ led_set_attr "${usb_led}" 'trigger' 'none'
+ led_set_attr "${usb_led}" 'brightness' 255
+}
+
+usb_led_off() {
+ led_set_attr "${usb_led}" 'trigger' 'none'
+ led_set_attr "${usb_led}" 'brightness' 0
+}
+
+get_usb_led() {
+ local hardware=`sed -n /Hardware/s/.*:.//p /proc/cpuinfo`
+
+ case "${hardware}" in
+ 'Linksys WRT350N v2')
+ usb_led='wrt350nv2:green:usb'
+ usb_device='1-1:1.0'
+ ;;
+ esac;
+}
+
+get_usb_led
+
+case "${ACTION}" in
+ add)
+ # update LEDs
+ [ "${usb_device}" = "${DEVICENAME}" ] && usb_led_on
+ ;;
+ remove)
+ # update LEDs
+ [ "${usb_device}" = "${DEVICENAME}" ] && usb_led_off
+ ;;
+esac
diff --git a/target/linux/orion/config-3.3 b/target/linux/orion/config-3.3
new file mode 100644
index 000000000..46e6ecbab
--- /dev/null
+++ b/target/linux/orion/config-3.3
@@ -0,0 +1,182 @@
+CONFIG_ALIGNMENT_TRAP=y
+CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y
+CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
+CONFIG_ARCH_NR_GPIO=0
+CONFIG_ARCH_ORION5X=y
+CONFIG_ARCH_REQUIRE_GPIOLIB=y
+# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
+# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
+# CONFIG_ARCH_USES_GETTIMEOFFSET is not set
+CONFIG_ARM=y
+# CONFIG_ARM_CPU_SUSPEND is not set
+CONFIG_ARM_L1_CACHE_SHIFT=5
+CONFIG_ARM_NR_BANKS=8
+CONFIG_ARM_PATCH_PHYS_VIRT=y
+# CONFIG_ARM_THUMB is not set
+# CONFIG_ARPD is not set
+CONFIG_ATA=m
+CONFIG_BCMA_POSSIBLE=y
+# CONFIG_CACHE_L2X0 is not set
+CONFIG_CLKSRC_MMIO=y
+CONFIG_CMDLINE="root=/dev/mtdblock1 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"
+CONFIG_CMDLINE_FORCE=y
+CONFIG_CPU_32v5=y
+CONFIG_CPU_ABRT_EV5T=y
+CONFIG_CPU_CACHE_VIVT=y
+CONFIG_CPU_COPY_FEROCEON=y
+CONFIG_CPU_CP15=y
+CONFIG_CPU_CP15_MMU=y
+CONFIG_CPU_FEROCEON=y
+CONFIG_CPU_FEROCEON_OLD_ID=y
+# CONFIG_CPU_ICACHE_DISABLE is not set
+CONFIG_CPU_PABRT_LEGACY=y
+CONFIG_CPU_TLB_FEROCEON=y
+CONFIG_CPU_USE_DOMAINS=y
+CONFIG_CRYPTO_AES=y
+CONFIG_CRYPTO_ALGAPI=y
+CONFIG_CRYPTO_ALGAPI2=y
+CONFIG_CRYPTO_BLKCIPHER2=y
+CONFIG_CRYPTO_DEV_MV_CESA=y
+CONFIG_CRYPTO_HASH2=y
+CONFIG_CRYPTO_HW=y
+CONFIG_CRYPTO_RNG2=y
+CONFIG_CRYPTO_WORKQUEUE=y
+# CONFIG_DEBUG_USER is not set
+CONFIG_DECOMPRESS_LZMA=y
+CONFIG_DLCI=m
+CONFIG_DLCI_MAX=8
+CONFIG_DNOTIFY=y
+# CONFIG_DSCC4 is not set
+# CONFIG_FARSYNC is not set
+CONFIG_FRAME_POINTER=y
+CONFIG_GENERIC_ATOMIC64=y
+CONFIG_GENERIC_BUG=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
+CONFIG_GENERIC_GPIO=y
+CONFIG_GENERIC_IRQ_CHIP=y
+CONFIG_GENERIC_IRQ_SHOW=y
+CONFIG_GENERIC_PCI_IOMAP=y
+CONFIG_GPIOLIB=y
+CONFIG_GPIO_SYSFS=y
+# CONFIG_HAMRADIO is not set
+CONFIG_HARDIRQS_SW_RESEND=y
+CONFIG_HAS_DMA=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+CONFIG_HAVE_AOUT=y
+CONFIG_HAVE_ARCH_KGDB=y
+CONFIG_HAVE_ARCH_PFN_VALID=y
+CONFIG_HAVE_C_RECORDMCOUNT=y
+CONFIG_HAVE_DMA_API_DEBUG=y
+CONFIG_HAVE_DYNAMIC_FTRACE=y
+CONFIG_HAVE_FTRACE_MCOUNT_RECORD=y
+CONFIG_HAVE_FUNCTION_GRAPH_TRACER=y
+CONFIG_HAVE_FUNCTION_TRACER=y
+CONFIG_HAVE_GENERIC_DMA_COHERENT=y
+CONFIG_HAVE_GENERIC_HARDIRQS=y
+CONFIG_HAVE_IDE=y
+CONFIG_HAVE_IRQ_WORK=y
+CONFIG_HAVE_KERNEL_GZIP=y
+CONFIG_HAVE_KERNEL_LZMA=y
+CONFIG_HAVE_KERNEL_LZO=y
+CONFIG_HAVE_KERNEL_XZ=y
+CONFIG_HAVE_LATENCYTOP_SUPPORT=y
+CONFIG_HAVE_MEMBLOCK=y
+CONFIG_HAVE_OPROFILE=y
+CONFIG_HAVE_PERF_EVENTS=y
+CONFIG_HAVE_PROC_CPU=y
+CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
+CONFIG_HAVE_SCHED_CLOCK=y
+CONFIG_HAVE_SPARSE_IRQ=y
+CONFIG_HDLC=m
+CONFIG_HDLC_CISCO=m
+CONFIG_HDLC_FR=m
+CONFIG_HDLC_PPP=m
+CONFIG_HDLC_RAW=m
+CONFIG_HWMON=y
+CONFIG_HW_RANDOM=y
+CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
+CONFIG_I2C_CHARDEV=y
+CONFIG_I2C_MV64XXX=y
+CONFIG_INET_LRO=y
+CONFIG_INITRAMFS_SOURCE=""
+CONFIG_IP_PIMSM_V1=y
+CONFIG_IP_PIMSM_V2=y
+CONFIG_KTIME_SCALAR=y
+CONFIG_LEDS_GPIO=y
+CONFIG_LEGACY_PTYS=y
+CONFIG_LEGACY_PTY_COUNT=256
+# CONFIG_MACH_BIGDISK is not set
+# CONFIG_MACH_D2NET is not set
+# CONFIG_MACH_DB88F5281 is not set
+CONFIG_MACH_DNS323=y
+CONFIG_MACH_DT2=y
+# CONFIG_MACH_EDMINI_V2 is not set
+# CONFIG_MACH_KUROBOX_PRO is not set
+# CONFIG_MACH_LINKSTATION_LSCHL is not set
+# CONFIG_MACH_LINKSTATION_LS_HGL is not set
+# CONFIG_MACH_LINKSTATION_MINI is not set
+# CONFIG_MACH_LINKSTATION_PRO is not set
+# CONFIG_MACH_MSS2 is not set
+# CONFIG_MACH_MV2120 is not set
+# CONFIG_MACH_NET2BIG is not set
+# CONFIG_MACH_RD88F5181L_FXO is not set
+# CONFIG_MACH_RD88F5181L_GE is not set
+# CONFIG_MACH_RD88F5182 is not set
+# CONFIG_MACH_RD88F6183AP_GE is not set
+# CONFIG_MACH_TERASTATION_PRO2 is not set
+# CONFIG_MACH_TS209 is not set
+# CONFIG_MACH_TS409 is not set
+# CONFIG_MACH_TS78XX is not set
+CONFIG_MACH_WNR854T=y
+CONFIG_MACH_WRT350N_V2=y
+CONFIG_MDIO_BOARDINFO=y
+CONFIG_MTD_PHYSMAP=y
+CONFIG_MV643XX_ETH=y
+CONFIG_NEED_DMA_MAP_STATE=y
+CONFIG_NEED_PER_CPU_KM=y
+CONFIG_NET_DSA=y
+# CONFIG_NET_DSA_MV88E6060 is not set
+CONFIG_NET_DSA_MV88E6131=y
+CONFIG_NET_DSA_MV88E6XXX=y
+CONFIG_NET_DSA_MV88E6XXX_NEED_PPU=y
+CONFIG_NET_DSA_TAG_DSA=y
+# CONFIG_NET_DSA_TAG_TRAILER is not set
+# CONFIG_NET_VENDOR_3COM is not set
+CONFIG_NLS=m
+CONFIG_PAGEFLAGS_EXTENDED=y
+CONFIG_PAGE_OFFSET=0xC0000000
+CONFIG_PATA_ARTOP=m
+CONFIG_PCI=y
+CONFIG_PERF_USE_VMALLOC=y
+CONFIG_PHYLIB=y
+CONFIG_PLAT_ORION=y
+# CONFIG_PREEMPT_RCU is not set
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_DRV_ISL1208=y
+CONFIG_SATA_PMP=y
+CONFIG_SCSI=m
+CONFIG_SCSI_MOD=m
+# CONFIG_SCSI_MULTI_LUN is not set
+CONFIG_SPLIT_PTLOCK_CPUS=999999
+CONFIG_SYS_SUPPORTS_APM_EMULATION=y
+CONFIG_UID16=y
+CONFIG_USB=m
+CONFIG_USB_ARCH_HAS_XHCI=y
+CONFIG_USB_COMMON=m
+CONFIG_USB_EHCI_HCD=m
+# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
+# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
+CONFIG_USB_OHCI_HCD=m
+CONFIG_USB_SUPPORT=y
+CONFIG_USB_UHCI_HCD=m
+CONFIG_VECTORS_BASE=0xffff0000
+# CONFIG_VFP is not set
+CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_WAN=y
+CONFIG_XZ_DEC=y
+CONFIG_ZBOOT_ROM_BSS=0x0
+CONFIG_ZBOOT_ROM_TEXT=0x0
+CONFIG_ZONE_DMA_FLAG=0
diff --git a/target/linux/orion/dns323/base-files/etc/config/network b/target/linux/orion/dns323/base-files/etc/config/network
new file mode 100644
index 000000000..8bdd3b060
--- /dev/null
+++ b/target/linux/orion/dns323/base-files/etc/config/network
@@ -0,0 +1,12 @@
+# Copyright (C) 2010 OpenWrt.org
+
+config interface loopback
+ option ifname lo
+ option proto static
+ option ipaddr 127.0.0.1
+ option netmask 255.0.0.0
+
+config interface eth0
+ option ifname eth0
+ option proto dhcp
+ option hostname dns323
diff --git a/target/linux/orion/dns323/config-3.3 b/target/linux/orion/dns323/config-3.3
new file mode 100644
index 000000000..b0daf7f22
--- /dev/null
+++ b/target/linux/orion/dns323/config-3.3
@@ -0,0 +1,47 @@
+CONFIG_ATA=y
+CONFIG_ATAGS_PROC=y
+CONFIG_BLK_DEV_DM=y
+CONFIG_BLK_DEV_MD=y
+CONFIG_BLK_DEV_SD=y
+CONFIG_CMDLINE="root=/dev/mtdblock3 rootfstype=squashfs,jffs2 noinitrd console=ttyS0,115200"
+CONFIG_CRC16=y
+CONFIG_CRYPTO_AEAD2=y
+CONFIG_CRYPTO_BLKCIPHER=y
+CONFIG_CRYPTO_CBC=y
+CONFIG_CRYPTO_MANAGER=y
+CONFIG_CRYPTO_MANAGER2=y
+CONFIG_CRYPTO_PCOMP2=y
+CONFIG_DM_CRYPT=y
+CONFIG_DM_MIRROR=y
+CONFIG_DM_SNAPSHOT=y
+CONFIG_EXPORTFS=y
+CONFIG_EXT2_FS=y
+CONFIG_EXT3_FS=y
+CONFIG_EXT4_FS=y
+CONFIG_FS_MBCACHE=y
+CONFIG_GPIO_DEVICE=y
+CONFIG_INPUT=y
+CONFIG_INPUT_EVDEV=y
+CONFIG_INPUT_KEYBOARD=y
+CONFIG_JBD=y
+CONFIG_JBD2=y
+CONFIG_KEXEC=y
+CONFIG_KEYBOARD_GPIO=y
+CONFIG_MD=y
+CONFIG_MD_AUTODETECT=y
+CONFIG_MD_LINEAR=y
+# CONFIG_MD_MULTIPATH is not set
+CONFIG_MD_RAID0=y
+CONFIG_MD_RAID1=y
+# CONFIG_MD_RAID10 is not set
+# CONFIG_MD_RAID456 is not set
+CONFIG_NLS=y
+CONFIG_RTC_DRV_M41T80=y
+CONFIG_RTC_DRV_M41T80_WDT=y
+CONFIG_SATA_MV=y
+CONFIG_SCSI=y
+CONFIG_SCSI_MOD=y
+CONFIG_SENSORS_G760A=y
+CONFIG_SENSORS_LM75=y
+# CONFIG_USB_SUPPORT is not set
+CONFIG_XFS_FS=y
diff --git a/target/linux/orion/dns323/target.mk b/target/linux/orion/dns323/target.mk
new file mode 100644
index 000000000..25523aee9
--- /dev/null
+++ b/target/linux/orion/dns323/target.mk
@@ -0,0 +1,6 @@
+BOARDNAME:=D-Link DNS-323
+DEFAULT_PACKAGES += -kmod-ath9k -wpad-mini -dnsmasq
+
+define Target/Description
+ Build OpenWrt image for D-Link DNS-323
+endef
diff --git a/target/linux/orion/files/arch/arm/mach-orion5x/dt2-common.h b/target/linux/orion/files/arch/arm/mach-orion5x/dt2-common.h
new file mode 100644
index 000000000..a54e1883d
--- /dev/null
+++ b/target/linux/orion/files/arch/arm/mach-orion5x/dt2-common.h
@@ -0,0 +1,82 @@
+#ifndef __INC_DT2_COMMON_H
+#define __INC_DT2_COMMON_H
+
+#define ATAG_MV_UBOOT 0x41000403
+
+struct tag_mv_uboot {
+ u32 uboot_version;
+ u32 tclk;
+ u32 sysclk;
+ u32 isUsbHost;
+ u32 overEthAddr;
+ u8 dt2_eeprom[256];
+};
+
+#define DT2_EEPROM_ADDR 0x50
+#define DT2_EEPROM_OFFSET 0
+#define DT2_EEPROM_LENGTH 256
+
+#define DT2_SERIAL_NUMBER_DEFAULT "run on default\0"
+#define DT2_REVISION_DEFAULT_INIT 0xFF
+#define DT2_CONFIG_FLAGS_DEFAULT 0x00
+
+#define _PACKED_ __attribute__((packed))
+
+struct DT2_EEPROM_SD_CONFIG {
+ unsigned int ram_1;
+ unsigned int ram_2;
+ unsigned int ram_3;
+ unsigned int ram_4;
+ unsigned char ram_5;
+ unsigned char ram_6;
+ unsigned short ram_7;
+ unsigned int magic_id;
+ } _PACKED_; // 24 Bytes in total
+
+struct DT2_EEPROM_FC_CONFIG {
+ unsigned char rtc_sts_mask;
+ unsigned char rtc_sts_init;
+ unsigned char rtc_int_mask;
+ unsigned char rtc_int_init;
+ unsigned char rtc_atrim_init;
+ unsigned char rtc_dtrim_init;
+ unsigned char dummy1;
+ unsigned char dummy2;
+ unsigned char dt2_config_flags; /* 0x80 to load rtc_values to RTC */
+ unsigned char dt2_revision; /* upper nibble is HW, lower nibble is FW */
+ unsigned char dt2_serial_number[16]; /* Serial number of DT-2 */
+ } _PACKED_; // 26 Bytes in total
+
+#define CFG_LOAD_RTC_VALUES 0x80
+
+struct DT2_EEPROM_GW_CONFIG {
+ unsigned int dummy1;
+ unsigned int dummy2;
+ unsigned int dummy3;
+ unsigned char dummy4;
+ unsigned char tos_video_val1;
+ unsigned char tos_video_val2;
+ unsigned char tos_voip_val;
+ unsigned char qos_igmp_cfg;
+ unsigned char num_of_ifs;
+ unsigned short vlan_ports_if[3];
+ unsigned char mac_addr[3][6];
+ } _PACKED_; // 42 Bytes in total
+
+#define _SIZE_OF_ALL_STRUCTS_ (sizeof(struct DT2_EEPROM_SD_CONFIG) + sizeof(struct DT2_EEPROM_FC_CONFIG) + sizeof(struct DT2_EEPROM_GW_CONFIG))
+
+// MV = EEPROM - SD - FC - GW - CRC
+struct DT2_EEPROM_MV_CONFIG {
+ unsigned int reg_addr[(DT2_EEPROM_LENGTH - _SIZE_OF_ALL_STRUCTS_ - sizeof(unsigned int)) / (sizeof(unsigned int) * 2)];
+ unsigned int reg_data[(DT2_EEPROM_LENGTH - _SIZE_OF_ALL_STRUCTS_ - sizeof(unsigned int)) / (sizeof(unsigned int) * 2)];
+ } _PACKED_;
+
+struct DT2_EEPROM_STRUCT {
+ struct DT2_EEPROM_MV_CONFIG mv;
+ struct DT2_EEPROM_SD_CONFIG sd;
+ struct DT2_EEPROM_FC_CONFIG fc;
+ struct DT2_EEPROM_GW_CONFIG gw;
+ unsigned int crc;
+ } _PACKED_;
+
+#endif
diff --git a/target/linux/orion/files/arch/arm/mach-orion5x/dt2-setup.c b/target/linux/orion/files/arch/arm/mach-orion5x/dt2-setup.c
new file mode 100644
index 000000000..a3d9c82dc
--- /dev/null
+++ b/target/linux/orion/files/arch/arm/mach-orion5x/dt2-setup.c
@@ -0,0 +1,446 @@
+/*
+ * arch/arm/mach-orion5x/dt2-setup.c
+ *
+ * Freecom DataTank Gateway Setup
+ *
+ * Copyright (C) 2009 Zintis Petersons <Zintis.Petersons@abcsolutions.lv>
+ *
+ * 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/pci.h>
+#include <linux/irq.h>
+#include <linux/mtd/physmap.h>
+#include <linux/mv643xx_eth.h>
+#include <linux/ethtool.h>
+#include <linux/if_ether.h>
+#include <net/dsa.h>
+#include <linux/ata_platform.h>
+#include <linux/i2c.h>
+#include <linux/reboot.h>
+#include <linux/interrupt.h>
+#include <asm/mach-types.h>
+#include <asm/gpio.h>
+#include <asm/leds.h>
+#include <asm/mach/arch.h>
+#include <asm/mach/pci.h>
+#include <mach/orion5x.h>
+#include "common.h"
+#include "mpp.h"
+
+/*****************************************************************************
+ * DT2 local
+ ****************************************************************************/
+#include <asm/setup.h>
+#include "dt2-common.h"
+
+u32 mvUbootVer = 0;
+u32 mvTclk = 166666667;
+u32 mvSysclk = 200000000;
+u32 mvIsUsbHost = 1;
+u32 overEthAddr = 0;
+u32 gBoardId = -1;
+struct DT2_EEPROM_STRUCT dt2_eeprom;
+
+/*****************************************************************************
+ * DT2 Info
+ ****************************************************************************/
+/*
+ * PCI
+ */
+
+#define DT2_PCI_SLOT0_OFFS 7
+#define DT2_PCI_SLOT0_IRQ_A_PIN 3
+#define DT2_PCI_SLOT0_IRQ_B_PIN 2
+
+#define DT2_PIN_GPIO_SYNC 25
+#define DT2_PIN_GPIO_POWER 24
+#define DT2_PIN_GPIO_UNPLUG1 23
+#define DT2_PIN_GPIO_UNPLUG2 22
+#define DT2_PIN_GPIO_RESET 4
+
+#define DT2_NOR_BOOT_BASE 0xf4000000
+#define DT2_NOR_BOOT_SIZE SZ_512K
+
+#define DT2_LEDS_BASE 0xfa000000
+#define DT2_LEDS_SIZE SZ_1K
+
+/*****************************************************************************
+ * 512K NOR Flash on Device bus Boot CS
+ ****************************************************************************/
+
+static struct mtd_partition dt2_partitions[] = {
+ {
+ .name = "u-boot",
+ .size = 0x00080000,
+ .offset = 0,
+ },
+};
+
+static struct physmap_flash_data dt2_nor_flash_data = {
+ .width = 1, /* 8 bit bus width */
+ .parts = dt2_partitions,
+ .nr_parts = ARRAY_SIZE(dt2_partitions)
+};
+
+static struct resource dt2_nor_flash_resource = {
+ .flags = IORESOURCE_MEM,
+ .start = DT2_NOR_BOOT_BASE,
+ .end = DT2_NOR_BOOT_BASE + DT2_NOR_BOOT_SIZE - 1,
+};
+
+static struct platform_device dt2_nor_flash = {
+ .name = "physmap-flash",
+ .id = 0,
+ .dev = {
+ .platform_data = &dt2_nor_flash_data,
+ },
+ .resource = &dt2_nor_flash_resource,
+ .num_resources = 1,
+};
+
+/*****************************************************************************
+ * PCI
+ ****************************************************************************/
+
+void __init dt2_pci_preinit(void)
+{
+ int pin, irq;
+
+ /*
+ * Configure PCI GPIO IRQ pins
+ */
+ pin = DT2_PCI_SLOT0_IRQ_A_PIN;
+ if (gpio_request(pin, "PCI IntA") == 0) {
+ if (gpio_direction_input(pin) == 0) {
+ irq = gpio_to_irq(pin);
+ irq_set_irq_type(irq, IRQ_TYPE_LEVEL_LOW);
+ printk (KERN_INFO "PCI IntA IRQ: %d\n", irq);
+ } else {
+ printk(KERN_ERR "dt2_pci_preinit failed to "
+ "irq_set_irq_type pin %d\n", pin);
+ gpio_free(pin);
+ }
+ } else {
+ printk(KERN_ERR "dt2_pci_preinit failed to request gpio %d\n", pin);
+ }
+
+ pin = DT2_PCI_SLOT0_IRQ_B_PIN;
+ if (gpio_request(pin, "PCI IntB") == 0) {
+ if (gpio_direction_input(pin) == 0) {
+ irq = gpio_to_irq(pin);
+ irq_set_irq_type(irq, IRQ_TYPE_LEVEL_LOW);
+ printk (KERN_INFO "PCI IntB IRQ: %d\n", irq);
+ } else {
+ printk(KERN_ERR "dt2_pci_preinit failed to "
+ "irq_set_irq_type pin %d\n", pin);
+ gpio_free(pin);
+ }
+ } else {
+ printk(KERN_ERR "dt2_pci_preinit failed to gpio_request %d\n", pin);
+ }
+}
+
+static int __init dt2_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
+{
+ int irq;
+
+ /*
+ * Check for devices with hard-wired IRQs.
+ */
+ irq = orion5x_pci_map_irq(dev, slot, pin);
+ if (irq != -1){
+ printk(KERN_INFO "orion5x_pci_map_irq: %d\n", irq);
+ return irq;
+ }
+
+ /*
+ * PCI IRQs are connected via GPIOs
+ */
+ switch (slot - DT2_PCI_SLOT0_OFFS) {
+ case 0:
+ if (pin == 1){
+ irq = gpio_to_irq(DT2_PCI_SLOT0_IRQ_A_PIN);
+ printk(KERN_INFO "dt2_pci_map_irq DT2_PCI_SLOT0_IRQ_A_PIN: %d\n", irq);
+ }
+ else {
+ irq = gpio_to_irq(DT2_PCI_SLOT0_IRQ_B_PIN);
+ printk(KERN_INFO "dt2_pci_map_irq DT2_PCI_SLOT0_IRQ_B_PIN: %d\n", irq);
+ }
+ default:
+ irq = -1;
+ printk(KERN_INFO "dt2_pci_map_irq IRQ: %d\n", irq);
+ }
+
+ return irq;
+}
+
+static struct hw_pci dt2_pci __initdata = {
+ .nr_controllers = 2,
+ .preinit = dt2_pci_preinit,
+ .swizzle = pci_std_swizzle,
+ .setup = orion5x_pci_sys_setup,
+ .scan = orion5x_pci_sys_scan_bus,
+ .map_irq = dt2_pci_map_irq,
+};
+
+static int __init dt2_pci_init(void)
+{
+ if (machine_is_dt2())
+ pci_common_init(&dt2_pci);
+
+ return 0;
+}
+
+subsys_initcall(dt2_pci_init);
+
+/*****************************************************************************
+ * Ethernet
+ ****************************************************************************/
+
+static struct mv643xx_eth_platform_data dt2_eth_data = {
+ .phy_addr = MV643XX_ETH_PHY_NONE,
+ .speed = SPEED_1000,
+ .duplex = DUPLEX_FULL,
+};
+
+static struct dsa_chip_data dt2_switch_chip_data = {
+ .port_names[0] = "wan",
+ .port_names[1] = "lan1",
+ .port_names[2] = "lan2",
+ .port_names[3] = "cpu",
+ .port_names[4] = "lan3",
+ .port_names[5] = "lan4",
+};
+
+static struct dsa_platform_data dt2_switch_plat_data = {
+ .nr_chips = 1,
+ .chip = &dt2_switch_chip_data,
+};
+
+/*****************************************************************************
+ * RTC ISL1208 on I2C bus
+ ****************************************************************************/
+static struct i2c_board_info __initdata dt2_i2c_rtc = {
+ I2C_BOARD_INFO("isl1208", 0x6F),
+};
+
+/*****************************************************************************
+ * Sata
+ ****************************************************************************/
+static struct mv_sata_platform_data dt2_sata_data = {
+ .n_ports = 2,
+};
+
+/*****************************************************************************
+ * General Setup
+ ****************************************************************************/
+static unsigned int dt2_mpp_modes[] __initdata = {
+ MPP0_GPIO, // RTC interrupt
+ MPP1_GPIO, // 88e6131 interrupt
+ MPP2_GPIO, // PCI_intB
+ MPP3_GPIO, // PCI_intA
+ MPP4_GPIO, // reset button switch
+ MPP5_GPIO,
+ MPP6_GPIO,
+ MPP7_GPIO,
+ MPP8_GPIO,
+ MPP9_GIGE, /* GE_RXERR */
+ MPP10_GPIO, // usb
+ MPP11_GPIO, // usb
+ MPP12_GIGE, // GE_TXD[4]
+ MPP13_GIGE, // GE_TXD[5]
+ MPP14_GIGE, // GE_TXD[6]
+ MPP15_GIGE, // GE_TXD[7]
+ MPP16_GIGE, // GE_RXD[4]
+ MPP17_GIGE, // GE_RXD[5]
+ MPP18_GIGE, // GE_RXD[6]
+ MPP19_GIGE, // GE_RXD[7]
+ 0,
+};
+
+/*****************************************************************************
+ * LEDS
+ ****************************************************************************/
+static struct platform_device dt2_leds = {
+ .name = "dt2-led",
+ .id = -1,
+};
+
+/****************************************************************************
+ * GPIO key
+ ****************************************************************************/
+static irqreturn_t dt2_reset_handler(int irq, void *dev_id)
+{
+ /* This is the paper-clip reset which does an emergency reboot. */
+ printk(KERN_INFO "Restarting system.\n");
+ machine_restart(NULL);
+
+ /* This should never be reached. */
+ return IRQ_HANDLED;
+}
+
+static irqreturn_t dt2_power_handler(int irq, void *dev_id)
+{
+ printk(KERN_INFO "Shutting down system.\n");
+ machine_power_off();
+ return IRQ_HANDLED;
+}
+
+static void __init dt2_init(void)
+{
+ /*
+ * Setup basic Orion functions. Need to be called early.
+ */
+ orion5x_init();
+
+ orion5x_mpp_conf(dt2_mpp_modes);
+
+ /*
+ * Configure peripherals.
+ */
+
+ orion5x_uart0_init();
+ orion5x_ehci0_init();
+ orion5x_ehci1_init();
+ orion5x_i2c_init();
+ orion5x_sata_init(&dt2_sata_data);
+ orion5x_xor_init();
+
+ printk(KERN_INFO "U-Boot parameters:\n");
+ printk(KERN_INFO "Sys Clk = %d, Tclk = %d, BoardID = 0x%02x\n", mvSysclk, mvTclk, gBoardId);
+
+ printk(KERN_INFO "Serial: %s\n", dt2_eeprom.fc.dt2_serial_number);
+ printk(KERN_INFO "Revision: %016x\n", dt2_eeprom.fc.dt2_revision);
+ printk(KERN_INFO "DT2: Using MAC address %pM for port 0\n",
+ dt2_eeprom.gw.mac_addr[0]);
+ printk(KERN_INFO "DT2: Using MAC address %pM for port 1\n",
+ dt2_eeprom.gw.mac_addr[1]);
+
+ orion5x_eth_init(&dt2_eth_data);
+ memcpy(dt2_eth_data.mac_addr, dt2_eeprom.gw.mac_addr[0], 6);
+ orion5x_eth_switch_init(&dt2_switch_plat_data, NO_IRQ);
+
+ i2c_register_board_info(0, &dt2_i2c_rtc, 1);
+
+ orion5x_setup_dev_boot_win(DT2_NOR_BOOT_BASE, DT2_NOR_BOOT_SIZE);
+ platform_device_register(&dt2_nor_flash);
+
+ orion5x_setup_dev0_win(DT2_LEDS_BASE, DT2_LEDS_SIZE);
+ platform_device_register(&dt2_leds);
+
+ if (request_irq(gpio_to_irq(DT2_PIN_GPIO_RESET), &dt2_reset_handler,
+ IRQF_DISABLED | IRQF_TRIGGER_LOW,
+ "DT2: Reset button", NULL) < 0) {
+
+ printk("DT2: Reset Button IRQ %d not available\n",
+ gpio_to_irq(DT2_PIN_GPIO_RESET));
+ }
+
+ if (request_irq(gpio_to_irq(DT2_PIN_GPIO_POWER), &dt2_power_handler,
+ IRQF_DISABLED | IRQF_TRIGGER_LOW,
+ "DT2: Power button", NULL) < 0) {
+
+ printk(KERN_DEBUG "DT2: Power Button IRQ %d not available\n",
+ gpio_to_irq(DT2_PIN_GPIO_POWER));
+ }
+}
+
+static int __init parse_tag_dt2_uboot(const struct tag *t)
+{
+ struct tag_mv_uboot *mv_uboot;
+
+ // Get pointer to our block
+ mv_uboot = (struct tag_mv_uboot*)&t->u;
+ mvTclk = mv_uboot->tclk;
+ mvSysclk = mv_uboot->sysclk;
+ mvUbootVer = mv_uboot->uboot_version;
+ mvIsUsbHost = mv_uboot->isUsbHost;
+
+ // Some clock fixups
+ if(mvTclk == 166000000) mvTclk = 166666667;
+ else if(mvTclk == 133000000) mvTclk = 133333333;
+ else if(mvSysclk == 166000000) mvSysclk = 166666667;
+
+ gBoardId = (mvUbootVer & 0xff);
+
+ //DT2 specific data
+ memcpy(&dt2_eeprom, mv_uboot->dt2_eeprom, sizeof(struct DT2_EEPROM_STRUCT));
+
+ return 0;
+}
+__tagtable(ATAG_MV_UBOOT, parse_tag_dt2_uboot);
+
+/*
+ * This is OpenWrt specific fixup. It includes code from original "tag_fixup_mem32" to
+ * fixup bogus memory tags and also fixes kernel cmdline by adding " init=/etc/preinit"
+ * at the end. It is important to flash OpenWrt image from original Freecom firmware.
+ *
+ * Vanilla kernel should use "tag_fixup_mem32" function.
+ */
+void __init openwrt_fixup(struct machine_desc *mdesc, struct tag *t,
+ char **from, struct meminfo *meminfo)
+{
+ char *p = NULL;
+ static char openwrt_init_tag[] __initdata = " init=/etc/preinit";
+
+ for (; t->hdr.size; t = tag_next(t)){
+ /* Locate the Freecom cmdline */
+ if (t->hdr.tag == ATAG_CMDLINE) {
+ p = t->u.cmdline.cmdline;
+ printk("%s(%d): Found cmdline '%s' at 0x%0lx\n",
+ __FUNCTION__, __LINE__, p, (unsigned long)p);
+ }
+ /*
+ * Many orion-based systems have buggy bootloader implementations.
+ * This is a common fixup for bogus memory tags.
+ */
+ if (t->hdr.tag == ATAG_MEM &&
+ (!t->u.mem.size || t->u.mem.size & ~PAGE_MASK ||
+ t->u.mem.start & ~PAGE_MASK)) {
+ printk(KERN_WARNING
+ "Clearing invalid memory bank %dKB@0x%08x\n",
+ t->u.mem.size / 1024, t->u.mem.start);
+ t->hdr.tag = 0;
+ }
+ }
+
+ printk("%s(%d): End of table at 0x%0lx\n", __FUNCTION__, __LINE__, (unsigned long)t);
+
+ /* Overwrite the end of the table with a new cmdline tag. */
+ t->hdr.tag = ATAG_CMDLINE;
+ t->hdr.size =
+ (sizeof (struct tag_header) +
+ strlen(p) + strlen(openwrt_init_tag) + 1 + 4) >> 2;
+
+ strlcpy(t->u.cmdline.cmdline, p, COMMAND_LINE_SIZE);
+ strlcpy(t->u.cmdline.cmdline + strlen(p), openwrt_init_tag,
+ COMMAND_LINE_SIZE - strlen(p));
+
+ printk("%s(%d): New cmdline '%s' at 0x%0lx\n",
+ __FUNCTION__, __LINE__,
+ t->u.cmdline.cmdline, (unsigned long)t->u.cmdline.cmdline);
+
+ t = tag_next(t);
+
+ printk("%s(%d): New end of table at 0x%0lx\n", __FUNCTION__, __LINE__, (unsigned long)t);
+
+ t->hdr.tag = ATAG_NONE;
+ t->hdr.size = 0;
+}
+
+/* Warning: Freecom uses their own custom bootloader with mach-type (=1500) */
+MACHINE_START(DT2, "Freecom DataTank Gateway")
+ /* Maintainer: Zintis Petersons <Zintis.Petersons@abcsolutions.lv> */
+ .boot_params = 0x00000100,
+ .init_machine = dt2_init,
+ .map_io = orion5x_map_io,
+ .init_irq = orion5x_init_irq,
+ .timer = &orion5x_timer,
+ .fixup = openwrt_fixup, //tag_fixup_mem32,
+MACHINE_END
diff --git a/target/linux/orion/generic/base-files/etc/uci-defaults/hardware b/target/linux/orion/generic/base-files/etc/uci-defaults/hardware
new file mode 100644
index 000000000..7f727eb59
--- /dev/null
+++ b/target/linux/orion/generic/base-files/etc/uci-defaults/hardware
@@ -0,0 +1,54 @@
+#!/bin/sh
+#
+# Copyright (C) 2010 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+#
+# This script sets system defaults for the hardware on firstboot
+#
+
+local hardware=`sed -n /Hardware/s/.*:.//p /proc/cpuinfo`
+
+wrt350nv2_default() {
+# leds
+ uci batch <<__EOF
+set system.power_led=led
+set system.power_led.name='Power LED (green)'
+set system.power_led.sysfs='wrt350nv2:green:power'
+set system.power_led.default='1'
+set system.wifi_led=led
+set system.wifi_led.name='Wireless LED (green)'
+set system.wifi_led.sysfs='wrt350nv2:green:wireless'
+set system.wifi_led.trigger='netdev'
+set system.wifi_led.dev='wlan0'
+set system.wifi_led.mode='link tx rx'
+set system.wifi_led.default='0'
+commit system
+__EOF
+
+# add mac address from U-Boot partition to lan and wan devices
+ MTD=`grep -e 'u-boot' /proc/mtd`
+ MTD=`echo ${MTD} | sed 's/[a-z]*\([0-9]*\):.*/\1/'`
+ [ -n "${MTD}" ] && {
+ MACADDR=`dd if=/dev/mtdblock${MTD} bs=1 skip=262048 count=6 2>/dev/null | hexdump -e '1/1 "%02x"'`
+ MACADDR2=$(( 0x${MACADDR} + 1))
+ MACADDR2=`printf "%012x" ${MACADDR2}`
+
+ MACADDR=`echo ${MACADDR} | sed 's/\(..\)/\1:/g' | sed 's/:$//'`
+ MACADDR2=`echo ${MACADDR2} | sed 's/\(..\)/\1:/g' | sed 's/:$//'`
+
+ uci set network.eth0.macaddr=${MACADDR}
+ uci set network.lan.macaddr=${MACADDR}
+ uci set network.wan.macaddr=${MACADDR2}
+ uci commit network
+ }
+}
+
+case "${hardware}" in
+ 'Linksys WRT350N v2')
+ wrt350nv2_default
+ ;;
+esac
diff --git a/target/linux/orion/generic/base-files/lib/upgrade/platform.sh b/target/linux/orion/generic/base-files/lib/upgrade/platform.sh
new file mode 100644
index 000000000..9c9967e4a
--- /dev/null
+++ b/target/linux/orion/generic/base-files/lib/upgrade/platform.sh
@@ -0,0 +1,38 @@
+#
+# Copyright (C) 2010-2011 OpenWrt.org
+#
+
+# use default "image" for PART_NAME
+# use default for platform_do_upgrade()
+
+platform_check_image() {
+ [ "${ARGC}" -gt 1 ] && { echo 'Too many arguments. Only flash file expected.'; return 1; }
+
+ local hardware=`sed -n /Hardware/s/.*:.//p /proc/cpuinfo`
+ local magic="$(get_magic_word "$1")"
+ local magic_long="$(get_magic_long "$1")"
+
+ case "${hardware}" in
+ # hardware with a direct uImage partition
+ # image header format as described in U-Boot's include/image.h
+ # see http://git.denx.de/cgi-bin/gitweb.cgi?p=u-boot.git;a=blob;f=include/image.h
+ 'Linksys WRT350N v2')
+ [ "${magic_long}" != '27051956' ] && {
+ echo "Invalid image type ${magic_long}."
+ return 1
+ }
+ return 0
+ ;;
+ # Netgear WNR854T (has uImage as file inside a JFFS2 partition)
+ 'Netgear WNR854T')
+ [ "${magic}" != '8519' ] && {
+ echo "Invalid image type ${magic}."
+ return 1
+ }
+ return 0
+ ;;
+ esac
+
+ echo "Sysupgrade is not yet supported on ${hardware}."
+ return 1
+}
diff --git a/target/linux/orion/generic/target.mk b/target/linux/orion/generic/target.mk
new file mode 100644
index 000000000..451de4e90
--- /dev/null
+++ b/target/linux/orion/generic/target.mk
@@ -0,0 +1,14 @@
+#
+# Copyright (C) 2008-2010 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+BOARDNAME:=Generic
+FEATURES:=squashfs
+
+define Target/Description
+ Build firmware images for Marvell Orion based boards that boot from internal flash.
+ (e.g.: Linksys WRT350N v2, Netgear WNR854T, ...)
+endef
diff --git a/target/linux/orion/harddisk/config-3.3 b/target/linux/orion/harddisk/config-3.3
new file mode 100644
index 000000000..a566aa537
--- /dev/null
+++ b/target/linux/orion/harddisk/config-3.3
@@ -0,0 +1,28 @@
+CONFIG_ATA=y
+CONFIG_BLK_DEV_DM=y
+CONFIG_BLK_DEV_MD=y
+CONFIG_BLK_DEV_SD=y
+CONFIG_CRC16=y
+# CONFIG_DM_CRYPT is not set
+# CONFIG_DM_MIRROR is not set
+# CONFIG_DM_SNAPSHOT is not set
+CONFIG_EXT4_FS=y
+CONFIG_FS_MBCACHE=y
+CONFIG_JBD2=y
+CONFIG_MD=y
+CONFIG_MD_AUTODETECT=y
+CONFIG_MD_LINEAR=y
+# CONFIG_MD_MULTIPATH is not set
+CONFIG_MD_RAID0=y
+CONFIG_MD_RAID1=y
+# CONFIG_MD_RAID10 is not set
+# CONFIG_MD_RAID456 is not set
+CONFIG_NLS=y
+CONFIG_SATA_MV=y
+CONFIG_SCSI=y
+CONFIG_SCSI_MOD=y
+CONFIG_USB=y
+CONFIG_USB_COMMON=y
+CONFIG_USB_EHCI_HCD=y
+CONFIG_USB_EHCI_TT_NEWSCHED=y
+CONFIG_USB_STORAGE=y
diff --git a/target/linux/orion/harddisk/target.mk b/target/linux/orion/harddisk/target.mk
new file mode 100644
index 000000000..a3a0e41c0
--- /dev/null
+++ b/target/linux/orion/harddisk/target.mk
@@ -0,0 +1,14 @@
+#
+# Copyright (C) 2008-2010 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+BOARDNAME:=Internal Hard-Disk
+FEATURES:=targz
+
+define Target/Description
+ Build firmware images for Marvell Orion based boards that boot directly from internal disk storage.
+ (e.g.: Freecom DataTank 2, ...)
+endef
diff --git a/target/linux/orion/image/Makefile b/target/linux/orion/image/Makefile
new file mode 100644
index 000000000..058519f72
--- /dev/null
+++ b/target/linux/orion/image/Makefile
@@ -0,0 +1,12 @@
+#
+# Copyright (C) 2008-2010 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+include $(TOPDIR)/rules.mk
+include $(INCLUDE_DIR)/image.mk
+
+include $(SUBTARGET).mk
+
+$(eval $(call BuildImage))
diff --git a/target/linux/orion/image/dns323.mk b/target/linux/orion/image/dns323.mk
new file mode 100644
index 000000000..c33e61295
--- /dev/null
+++ b/target/linux/orion/image/dns323.mk
@@ -0,0 +1,36 @@
+#
+# Copyright (C) 2010 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Image/Prepare
+ cp $(LINUX_DIR)/arch/arm/boot/uImage $(KDIR)/uImage
+endef
+
+define Image/BuildKernel
+ # Orion Kernel uImages
+ # DNS-323: mach id 1542 (0x606)
+ echo -en "\x06\x1c\xa0\xe3\x06\x10\x81\xe3" > $(KDIR)/dns323-zImage
+ cat $(LINUX_DIR)/arch/arm/boot/zImage >> $(KDIR)/dns323-zImage
+ $(STAGING_DIR_HOST)/bin/mkimage -A arm -O linux -T kernel \
+ -C none -a 0x00008000 -e 0x00008000 -n 'Linux-$(LINUX_VERSION)' \
+ -d $(KDIR)/dns323-zImage $(KDIR)/dns323-uImage
+ cp $(KDIR)/dns323-uImage $(BIN_DIR)/openwrt-dns323-uImage
+endef
+
+define Image/Build/D-Link
+ # Orion DNS-323 Images
+ # mtd image
+ dd if=$(KDIR)/root.$(1) of=$(BIN_DIR)/openwrt-dns323-rootfs bs=128k
+endef
+
+define Image/Build
+$(call Image/Build/$(1),$(1))
+$(call Image/Build/D-Link,$(1),dns323,DNS-323,$(1))
+endef
+
+define Image/Build/squashfs
+$(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
+endef
diff --git a/target/linux/orion/image/generic.mk b/target/linux/orion/image/generic.mk
new file mode 100644
index 000000000..0594ebffa
--- /dev/null
+++ b/target/linux/orion/image/generic.mk
@@ -0,0 +1,218 @@
+#
+# Copyright (C) 2008-2012 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+### DO NOT INDENT LINES CONTAINING $(call xyz) AS THIS MAY CHANGE THE CONTEXT
+### OF THE FIRST LINE IN THE CALLED VARIABLE (NOTE: variable!)
+### see http://www.gnu.org/software/make/manual/html_node/Call-Function.html#Call-Function
+### ACTUALLY IT IS A SIMPLE MACRO EXPANSION
+
+### use round brackets for make variables, and curly brackets for shell variables
+
+
+## Kernel mtd partition size in KiB
+KERNEL_MTD_SIZE:=1024
+
+# Netgear WNR854T: erase size is 128KiB = 0x00020000 = 131072
+ERASE_SIZE_WNR854T:=128
+UIMAGE_FILE_NAME_WNR854T:=uImage
+
+# Linksys WRT350N v2: erase size is 64KiB = 0x00010000 = 65536
+ERASE_SIZE_WRT350Nv2:=64
+
+# define JFFS2 sizes for include/image.mk
+JFFS2_BLOCKSIZE:=64k 128k
+
+
+###
+### Image/Prepare
+###
+
+define Image/Prepare
+### Dummy comment for indented calls of Image/Prepare
+ cp '$(LINUX_DIR)/arch/arm/boot/zImage' '$(BIN_DIR)/$(IMG_PREFIX)-zImage'
+endef
+
+
+###
+### Image/BuildKernel
+###
+
+define Image/BuildKernel
+### Dummy comment for indented calls of Image/BuildKernel
+
+ ## Netgear WNR854T: mach id 1801 (0x0709)
+$(call Image/BuildKernel/ARM/zImage,wnr854t,"\x07\x1c\xa0\xe3\x09\x10\x81\xe3")
+$(call Image/BuildKernel/ARM/uImage,wnr854t)
+ ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y) # nothing more to do for a ramdisk build
+$(call Image/BuildKernel/JFFS2uImage,wnr854t,$(ERASE_SIZE_WNR854T),$(UIMAGE_FILE_NAME_WNR854T))
+$(call Image/Default/FileSizeCheck,$(KDIR)/wnr854t-uImage.jffs2,$(shell expr $(KERNEL_MTD_SIZE) \* 1024))
+ endif
+
+ ## Linksys WRT350N v2: mach id 1633 (0x0661)
+$(call Image/BuildKernel/ARM/zImage,wrt350nv2,"\x06\x1c\xa0\xe3\x61\x10\x81\xe3")
+$(call Image/BuildKernel/ARM/uImage,wrt350nv2)
+ ifneq ($(CONFIG_TARGET_ROOTFS_INITRAMFS),y) # nothing more to do for a ramdisk build
+$(call Image/Default/FileSizeCheck,$(KDIR)/wrt350nv2-uImage,$(shell expr $(KERNEL_MTD_SIZE) \* 1024))
+ endif
+endef
+
+define Image/BuildKernel/ARM/zImage
+ # merge machine id and regular zImage into one file
+ # parameters: 1 = machine name, 2 = machine id as string in quotes
+ # $(BOARD) kernel zImage for $(1)
+ echo -en $(2) > '$(KDIR)/$(1)-zImage'
+ cat '$(LINUX_DIR)/arch/arm/boot/zImage' >> '$(KDIR)/$(1)-zImage'
+ cp '$(KDIR)/$(1)-zImage' '$(BIN_DIR)/openwrt-$(1)-zImage'
+endef
+
+define Image/BuildKernel/ARM/uImage
+ # create uImage from zImage
+ # parameters: 1 = machine name
+ # $(BOARD) kernel uImage for $(1)
+ '$(STAGING_DIR_HOST)/bin/mkimage' -A arm -O linux -T kernel \
+ -C none -a 0x00008000 -e 0x00008000 -n 'Linux-$(LINUX_VERSION)' \
+ -d '$(KDIR)/$(1)-zImage' '$(KDIR)/$(1)-uImage'
+ cp '$(KDIR)/$(1)-uImage' '$(BIN_DIR)/openwrt-$(1)-uImage'
+endef
+
+define Image/BuildKernel/JFFS2uImage
+ # create JFFS2 partition with uImage file (result is already padded to erase size)
+ # parameters: 1 = machine name, 2 = erase size in KiB, 3 = uImage file name
+ # $(BOARD) kernel uImage for $(1) in JFFS2-$(2)k partition
+ rm -rf '$(TMP_DIR)/$(1)_jffs2_uimage'
+ mkdir '$(TMP_DIR)/$(1)_jffs2_uimage'
+ cp '$(KDIR)/$(1)-uImage' '$(TMP_DIR)/$(1)_jffs2_uimage/$(3)'
+ $(STAGING_DIR_HOST)/bin/mkfs.jffs2 --compression-mode=none --pad --little-endian --squash -e $(2)KiB -o '$(KDIR)/$(1)-uImage.jffs2' -d '$(TMP_DIR)/$(1)_jffs2_uimage'
+ rm -rf '$(TMP_DIR)/$(1)_jffs2_uimage'
+endef
+
+define Image/Default/FileSizeCheck
+ # parameters: 1 = file path, 2 = maximum size in bytes
+ [ `stat -c %s '$(1)'` -le $(2) ] || { echo ' ERROR: $(1) too big (> $(2) bytes)'; exit 1; }
+endef
+
+
+###
+### Image/Build
+###
+
+define Image/Build
+### Dummy comment for indented calls of Image/Build with $(1)
+
+ ## Prepare rootfs
+$(call Image/Build/$(1),$(1))
+
+ ## Netgear WNR854T
+$(call Image/Build/Default,$(1),wnr854t,$(ERASE_SIZE_WNR854T),$(KERNEL_MTD_SIZE),.jffs2,NG_WNR854T)
+
+ ## Linksys WRT350N v2
+$(call Image/Build/Linksys/wrt350nv2,$(1),wrt350nv2,$(ERASE_SIZE_WRT350Nv2),$(KERNEL_MTD_SIZE),)
+endef
+
+define Image/Build/squashfs
+$(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
+ cp '$(KDIR)/root.squashfs' '$(BIN_DIR)/$(IMG_PREFIX)-root.squashfs'
+endef
+
+## generate defines for all JFFS2 block sizes
+define Image/Build/jffs2/sub
+ $(eval define Image/Build/jffs2-$(1)
+ cp '$$(KDIR)/root.jffs2-$(1)' '$$(BIN_DIR)/$$(IMG_PREFIX)-root.jffs2-$(1)'
+ endef)
+endef
+
+$(foreach SZ,$(JFFS2_BLOCKSIZE),$(call Image/Build/jffs2/sub,$(SZ)))
+
+define Image/Build/Default
+ # parameters: 1 = rootfs type, 2 = machine name, 3 = erase size in KiB, 4 = kernel mtd size in KiB, 5 = kernel file suffix, 6 = header
+ ifeq ($(findstring jffs2-,$(1)),jffs2-) # JFFS2: build only image fitting to erase size
+ ifeq ($(1),jffs2-$(3)k)
+$(call Image/Build/Default/sysupgrade,$(1),$(2),$(4),$(5))
+$(call Image/Build/Default/factory,$(1),$(2),$(6))
+ endif
+ else
+ ifeq ($(1),ext4) # EXT4: ignore
+ # do nothing
+ else # do all other images
+$(call Image/Build/Default/sysupgrade,$(1),$(2),$(4),$(5))
+$(call Image/Build/Default/factory,$(1),$(2),$(6))
+ endif
+ endif
+endef
+
+define Image/Build/Default/sysupgrade
+ # parameters: 1 = rootfs type, 2 = machine name, 3 = pad size in KiB (kernel mtd size or erase size), 4 = kernel file suffix
+ # $(BOARD) $(1) sysupgrade image for $(2)
+ ( \
+ dd if='$(KDIR)/$(2)-uImage$(4)' bs=$(3)k conv=sync; \
+ dd if='$(KDIR)/root.$(1)'; \
+ ) > '$(BIN_DIR)/openwrt-$(2)-$(1)-sysupgrade.img'
+endef
+
+define Image/Build/Default/factory
+ # parameters: 1 = rootfs type, 2 = machine name, 3 = header
+ # $(BOARD) $(1) factory upgrade image for $(2)
+ '$(STAGING_DIR_HOST)/bin/add_header' $(3) '$(BIN_DIR)/openwrt-$(2)-$(1)-sysupgrade.img' '$(BIN_DIR)/openwrt-$(2)-$(1)-factory.img'
+endef
+
+##
+## Image/Build/Linksys
+##
+
+define Image/Build/Linksys/wrt350nv2
+ # parameters: 1 = rootfs type, 2 = machine name, 3 = erase size in KiB, 4 = kernel mtd size in KiB, 5 = kernel file suffix
+ ifeq ($(findstring jffs2-,$(1)),jffs2-) # JFFS2: build only image fitting to erase size
+ ifeq ($(1),jffs2-$(3)k)
+$(call Image/Build/Default/sysupgrade,$(1),$(2),$(4),$(5))
+$(call Image/Build/Linksys/wrt350nv2-builder,$(1),$(2))
+ endif
+ else
+ ifeq ($(1),ext4) # EXT4: ignore
+ # do nothing
+ else # do all other images
+$(call Image/Build/Default/sysupgrade,$(1),$(2),$(4),$(5))
+$(call Image/Build/Linksys/wrt350nv2-builder,$(1),$(2))
+ endif
+ endif
+endef
+
+define Image/Build/Linksys/wrt350nv2-builder
+ # parameters: 1 = rootfs type, 2 = machine name
+ # $(BOARD) $(1) factory and recovery image for $(2) via wrt350nv2-builder
+ rm -rf '$(TMP_DIR)/$(2)_factory'
+ mkdir '$(TMP_DIR)/$(2)_factory'
+ # create parameter file
+ echo ':image 0 $(BIN_DIR)/openwrt-$(2)-$(1)-sysupgrade.img' > '$(TMP_DIR)/$(2)_factory/$(2).par'
+ [ ! -f '$(STAGING_DIR_HOST)/share/wrt350nv2-builder/u-boot.bin' ] || ( \
+ echo ':u-boot 0 $(STAGING_DIR_HOST)/share/wrt350nv2-builder/u-boot.bin' >> '$(TMP_DIR)/$(2)_factory/$(2).par'; \
+ )
+ echo '#version 0x2020' >> '$(TMP_DIR)/$(2)_factory/$(2).par'
+ # create bin file for recovery and factory image
+ ( \
+ cd '$(TMP_DIR)/$(2)_factory'; \
+ '$(STAGING_DIR_HOST)/bin/wrt350nv2-builder' -b '$(TMP_DIR)/$(2)_factory/$(2).par'; \
+ )
+ # copy bin file as recovery image
+ $(CP) '$(TMP_DIR)/$(2)_factory/wrt350n.bin' '$(BIN_DIR)/openwrt-$(2)-$(1)-recovery.bin'
+ # create factory image for stock firmware update mechanism
+ ( \
+ cd '$(TMP_DIR)/$(2)_factory'; \
+ zip 'wrt350n.zip' 'wrt350n.bin'; \
+ )
+ '$(STAGING_DIR_HOST)/bin/wrt350nv2-builder' -z '$(TMP_DIR)/$(2)_factory/wrt350n.zip' '$(BIN_DIR)/openwrt-$(2)-$(1)-factory.img'
+ rm -rf '$(TMP_DIR)/$(2)_factory'
+endef
+
+
+###
+### Image/PreReq
+###
+
+## Dependency for WRT350N v2 factory image
+$(eval $(call RequireCommand,zip, \
+ Please install zip. \
+))
diff --git a/target/linux/orion/image/harddisk.mk b/target/linux/orion/image/harddisk.mk
new file mode 100644
index 000000000..9f2efad12
--- /dev/null
+++ b/target/linux/orion/image/harddisk.mk
@@ -0,0 +1,55 @@
+#
+# Copyright (C) 2008-2010 OpenWrt.org
+#
+# This is free software, licensed under the GNU General Public License v2.
+# See /LICENSE for more information.
+#
+
+define Image/Prepare
+ cp $(LINUX_DIR)/arch/arm/boot/uImage $(KDIR)/uImage
+endef
+
+define Image/BuildKernel
+ # Orion Kernel uImages
+ # DT2: mach id 1514 (0x5EA)
+ echo -en "\x05\x1c\xa0\xe3\xea\x10\x81\xe3" > $(KDIR)/dt2-zImage
+ cat $(LINUX_DIR)/arch/arm/boot/zImage >> $(KDIR)/dt2-zImage
+ $(STAGING_DIR_HOST)/bin/mkimage -A arm -O linux -T kernel \
+ -C none -a 0x00008000 -e 0x00008000 -n 'Linux-$(LINUX_VERSION)' \
+ -d $(KDIR)/dt2-zImage $(KDIR)/dt2-uImage
+ cp $(KDIR)/dt2-uImage $(BIN_DIR)/openwrt-dt2-uImage
+endef
+
+define Image/Build/Freecom
+ # Orion Freecom Images
+ # backup unwanted files
+ rm -rf ${TMP_DIR}/$2_backup
+ mkdir ${TMP_DIR}/$2_backup
+ -mv $(TARGET_DIR)/{var,jffs,rom} ${TMP_DIR}/$2_backup
+ # add extra files
+ $(INSTALL_DIR) $(TARGET_DIR)/boot
+ # TODO: Add special CMDLINE shim for webupgrade image here
+ $(CP) $(KDIR)/dt2-uImage $(TARGET_DIR)/boot/uImage
+ $(INSTALL_DIR) $(TARGET_DIR)/var
+ # create image
+ $(TAR) cfj $(BIN_DIR)/openwrt-$(2)-$(1).img --numeric-owner --owner=0 --group=0 -C $(TARGET_DIR)/ .
+ $(STAGING_DIR_HOST)/bin/encode_crc $(BIN_DIR)/openwrt-$(2)-$(1).img $(BIN_DIR)/openwrt-$(2)-$(1)-webupgrade.img $(3)
+ # remove extra files
+ rm -rf $(TARGET_DIR)/{boot,var}
+ # recover unwanted files
+ -mv ${TMP_DIR}/$2_backup/* $(TARGET_DIR)/
+ rm -rf ${TMP_DIR}/$2_backup
+endef
+
+define Image/Build
+$(call Image/Build/$(1),$(1))
+$(call Image/Build/Freecom,$(1),dt2,DT,$(1))
+endef
+
+define Image/Build/squashfs
+$(call prepare_generic_squashfs,$(KDIR)/root.squashfs)
+ ( \
+ dd if=$(KDIR)/uImage bs=1024k conv=sync; \
+ dd if=$(KDIR)/root.$(1) bs=128k conv=sync; \
+ ) > $(BIN_DIR)/$(IMG_PREFIX)-$(1).img
+endef
diff --git a/target/linux/orion/patches-3.3/100-wrt350nv2_openwrt_partition_map.patch b/target/linux/orion/patches-3.3/100-wrt350nv2_openwrt_partition_map.patch
new file mode 100644
index 000000000..5e2dc2514
--- /dev/null
+++ b/target/linux/orion/patches-3.3/100-wrt350nv2_openwrt_partition_map.patch
@@ -0,0 +1,32 @@
+--- a/arch/arm/mach-orion5x/wrt350n-v2-setup.c
++++ b/arch/arm/mach-orion5x/wrt350n-v2-setup.c
+@@ -134,11 +134,11 @@ static struct mtd_partition wrt350n_v2_n
+ {
+ .name = "kernel",
+ .offset = 0x00000000,
+- .size = 0x00760000,
++ .size = 0x00100000, // change to kernel mtd size here (1/3)
+ }, {
+ .name = "rootfs",
+- .offset = 0x001a0000,
+- .size = 0x005c0000,
++ .offset = 0x00100000, // change to kernel mtd size here (2/3)
++ .size = 0x00650000, // adopt to kernel mtd size here (3/3) = 0x00750000 - <kernel mtd size>
+ }, {
+ .name = "lang",
+ .offset = 0x00760000,
+@@ -151,6 +151,14 @@ static struct mtd_partition wrt350n_v2_n
+ .name = "u-boot",
+ .offset = 0x007c0000,
+ .size = 0x00040000,
++ }, {
++ .name = "eRcOmM_do_not_touch",
++ .offset = 0x00750000,
++ .size = 0x00010000, // erasesize
++ }, {
++ .name = "image", // for sysupgrade
++ .offset = 0x00000000,
++ .size = 0x00750000,
+ },
+ };
+
diff --git a/target/linux/orion/patches-3.3/101-wnr854t_partition_map.patch b/target/linux/orion/patches-3.3/101-wnr854t_partition_map.patch
new file mode 100644
index 000000000..9757d4578
--- /dev/null
+++ b/target/linux/orion/patches-3.3/101-wnr854t_partition_map.patch
@@ -0,0 +1,13 @@
+--- a/arch/arm/mach-orion5x/wnr854t-setup.c
++++ b/arch/arm/mach-orion5x/wnr854t-setup.c
+@@ -66,6 +66,10 @@ static struct mtd_partition wnr854t_nor_
+ .name = "uboot",
+ .offset = 0x00760000,
+ .size = 0x00040000,
++ }, {
++ .name = "image", // for sysupgrade
++ .offset = 0x00000000,
++ .size = 0x00760000,
+ },
+ };
+
diff --git a/target/linux/orion/patches-3.3/200-dt2_board_support.patch b/target/linux/orion/patches-3.3/200-dt2_board_support.patch
new file mode 100644
index 000000000..91909abac
--- /dev/null
+++ b/target/linux/orion/patches-3.3/200-dt2_board_support.patch
@@ -0,0 +1,26 @@
+--- a/arch/arm/mach-orion5x/Kconfig
++++ b/arch/arm/mach-orion5x/Kconfig
+@@ -16,6 +16,13 @@ config MACH_RD88F5182
+ Say 'Y' here if you want your kernel to support the
+ Marvell Orion-NAS (88F5182) RD2
+
++config MACH_DT2
++ bool "Freecom DataTank Gateway"
++ select I2C_BOARDINFO
++ help
++ Say 'Y' here if you want your kernel to support the
++ Freecom DataTank Gateway
++
+ config MACH_KUROBOX_PRO
+ bool "KuroBox Pro"
+ select I2C_BOARDINFO
+--- a/arch/arm/mach-orion5x/Makefile
++++ b/arch/arm/mach-orion5x/Makefile
+@@ -18,6 +18,7 @@ obj-$(CONFIG_MACH_BIGDISK) += d2net-setu
+ obj-$(CONFIG_MACH_NET2BIG) += net2big-setup.o
+ obj-$(CONFIG_MACH_MSS2) += mss2-setup.o
+ obj-$(CONFIG_MACH_WNR854T) += wnr854t-setup.o
++obj-$(CONFIG_MACH_DT2) += dt2-setup.o
+ obj-$(CONFIG_MACH_RD88F5181L_GE) += rd88f5181l-ge-setup.o
+ obj-$(CONFIG_MACH_RD88F5181L_FXO) += rd88f5181l-fxo-setup.o
+ obj-$(CONFIG_MACH_RD88F6183AP_GE) += rd88f6183ap-ge-setup.o
diff --git a/target/linux/orion/patches-3.3/300-dns323_partition_map.patch b/target/linux/orion/patches-3.3/300-dns323_partition_map.patch
new file mode 100644
index 000000000..6eab81fd5
--- /dev/null
+++ b/target/linux/orion/patches-3.3/300-dns323_partition_map.patch
@@ -0,0 +1,30 @@
+--- a/arch/arm/mach-orion5x/dns323-setup.c
++++ b/arch/arm/mach-orion5x/dns323-setup.c
+@@ -113,6 +113,13 @@ subsys_initcall(dns323_pci_init);
+ * 0x00020000-0x001a0000 : "Linux Kernel"
+ * 0x001a0000-0x007d0000 : "File System"
+ * 0x007d0000-0x00800000 : "u-boot"
++ *
++ * Layout as used by OpenWrt
++ * 0x00000000-0x00010000 : "MTD1"
++ * 0x00010000-0x00020000 : "MTD2"
++ * 0x00020000-0x001a0000 : "kernel"
++ * 0x001a0000-0x007d0000 : "rootfs"
++ * 0x007d0000-0x00800000 : "u-boot"
+ */
+
+ #define DNS323_NOR_BOOT_BASE 0xf4000000
+@@ -128,11 +135,11 @@ static struct mtd_partition dns323_parti
+ .size = 0x00010000,
+ .offset = 0x00010000,
+ }, {
+- .name = "Linux Kernel",
++ .name = "kernel",
+ .size = 0x00180000,
+ .offset = 0x00020000,
+ }, {
+- .name = "File System",
++ .name = "rootfs",
+ .size = 0x00630000,
+ .offset = 0x001A0000,
+ }, {
diff --git a/target/linux/orion/patches-3.3/400-fix-section-mismatch-warnings.patch b/target/linux/orion/patches-3.3/400-fix-section-mismatch-warnings.patch
new file mode 100644
index 000000000..84ca91f0a
--- /dev/null
+++ b/target/linux/orion/patches-3.3/400-fix-section-mismatch-warnings.patch
@@ -0,0 +1,31 @@
+--- a/arch/arm/mach-orion5x/common.c
++++ b/arch/arm/mach-orion5x/common.c
+@@ -192,7 +192,7 @@ void __init orion5x_init_early(void)
+
+ int orion5x_tclk;
+
+-int __init orion5x_find_tclk(void)
++static __init int orion5x_find_tclk(void)
+ {
+ u32 dev, rev;
+
+@@ -204,7 +204,7 @@ int __init orion5x_find_tclk(void)
+ return 166666667;
+ }
+
+-static void orion5x_timer_init(void)
++static __init void orion5x_timer_init(void)
+ {
+ orion5x_tclk = orion5x_find_tclk();
+
+--- a/arch/arm/mach-orion5x/addr-map.c
++++ b/arch/arm/mach-orion5x/addr-map.c
+@@ -76,7 +76,7 @@ static int __init cpu_win_can_remap(cons
+ /*
+ * Description of the windows needed by the platform code
+ */
+-static struct __initdata orion_addr_map_cfg addr_map_cfg = {
++static struct orion_addr_map_cfg addr_map_cfg __initdata = {
+ .num_wins = 8,
+ .cpu_win_can_remap = cpu_win_can_remap,
+ .bridge_virt_base = ORION5X_BRIDGE_VIRT_BASE,
diff --git a/target/linux/orion/patches-3.3/a01-dt2-fixes-for-3.3.patch b/target/linux/orion/patches-3.3/a01-dt2-fixes-for-3.3.patch
new file mode 100644
index 000000000..c101f142d
--- /dev/null
+++ b/target/linux/orion/patches-3.3/a01-dt2-fixes-for-3.3.patch
@@ -0,0 +1,34 @@
+--- a/arch/arm/mach-orion5x/dt2-setup.c
++++ b/arch/arm/mach-orion5x/dt2-setup.c
+@@ -146,7 +146,7 @@ void __init dt2_pci_preinit(void)
+ }
+ }
+
+-static int __init dt2_pci_map_irq(struct pci_dev *dev, u8 slot, u8 pin)
++static int __init dt2_pci_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
+ {
+ int irq;
+
+@@ -383,8 +383,7 @@ __tagtable(ATAG_MV_UBOOT, parse_tag_dt2_
+ *
+ * Vanilla kernel should use "tag_fixup_mem32" function.
+ */
+-void __init openwrt_fixup(struct machine_desc *mdesc, struct tag *t,
+- char **from, struct meminfo *meminfo)
++void __init openwrt_fixup(struct tag *t, char **from, struct meminfo *meminfo)
+ {
+ char *p = NULL;
+ static char openwrt_init_tag[] __initdata = " init=/etc/preinit";
+@@ -437,10 +436,11 @@ void __init openwrt_fixup(struct machine
+ /* Warning: Freecom uses their own custom bootloader with mach-type (=1500) */
+ MACHINE_START(DT2, "Freecom DataTank Gateway")
+ /* Maintainer: Zintis Petersons <Zintis.Petersons@abcsolutions.lv> */
+- .boot_params = 0x00000100,
++ .atag_offset = 0x100,
+ .init_machine = dt2_init,
+ .map_io = orion5x_map_io,
+ .init_irq = orion5x_init_irq,
+ .timer = &orion5x_timer,
+ .fixup = openwrt_fixup, //tag_fixup_mem32,
++ .restart = orion5x_restart,
+ MACHINE_END