[amazon] Add kernel 2.6.32 support
authorHauke Mehrtens <hauke@hauke-m.de>
Sun, 31 Jan 2010 15:13:14 +0000 (15:13 +0000)
committerHauke Mehrtens <hauke@hauke-m.de>
Sun, 31 Jan 2010 15:13:14 +0000 (15:13 +0000)
SVN-Revision: 19458

12 files changed:
target/linux/amazon/config-2.6.32 [new file with mode: 0644]
target/linux/amazon/files/arch/mips/amazon/interrupt.c
target/linux/amazon/files/drivers/net/amazon_sw.c
target/linux/amazon/files/drivers/serial/amazon_asc.c
target/linux/amazon/patches-2.6.32/000-mips-bad-intctl.patch [new file with mode: 0644]
target/linux/amazon/patches-2.6.32/010-mips_clocksource_init_war.patch [new file with mode: 0644]
target/linux/amazon/patches-2.6.32/017-wdt-driver.patch [new file with mode: 0644]
target/linux/amazon/patches-2.6.32/100-board.patch [new file with mode: 0644]
target/linux/amazon/patches-2.6.32/130-mtd_drivers.patch [new file with mode: 0644]
target/linux/amazon/patches-2.6.32/140-net_drivers.patch [new file with mode: 0644]
target/linux/amazon/patches-2.6.32/150-serial_driver.patch [new file with mode: 0644]
target/linux/amazon/patches-2.6.32/160-cfi-swap.patch [new file with mode: 0644]

diff --git a/target/linux/amazon/config-2.6.32 b/target/linux/amazon/config-2.6.32
new file mode 100644 (file)
index 0000000..d68558c
--- /dev/null
@@ -0,0 +1,154 @@
+CONFIG_32BIT=y
+# CONFIG_64BIT is not set
+CONFIG_ADM6996_SUPPORT=y
+# CONFIG_ALCHEMY_GPIO_INDIRECT is not set
+CONFIG_AMAZON=y
+CONFIG_AMAZON_ASC_UART=y
+CONFIG_AMAZON_MTD=y
+CONFIG_AMAZON_NET_SW=y
+CONFIG_AMAZON_PCI=y
+CONFIG_AMAZON_WDT=y
+# CONFIG_AR7 is not set
+# CONFIG_ARCH_HAS_ILOG2_U32 is not set
+# CONFIG_ARCH_HAS_ILOG2_U64 is not set
+CONFIG_ARCH_HIBERNATION_POSSIBLE=y
+CONFIG_ARCH_POPULATES_NODE_MAP=y
+# CONFIG_ARCH_SUPPORTS_MSI is not set
+CONFIG_ARCH_SUPPORTS_OPROFILE=y
+CONFIG_ARCH_SUSPEND_POSSIBLE=y
+# CONFIG_BCM47XX is not set
+# CONFIG_BCM63XX is not set
+CONFIG_BITREVERSE=y
+# CONFIG_CAVIUM_OCTEON_REFERENCE_BOARD is not set
+# CONFIG_CAVIUM_OCTEON_SIMULATOR is not set
+CONFIG_CEVT_R4K=y
+CONFIG_CEVT_R4K_LIB=y
+CONFIG_CFG80211_DEFAULT_PS_VALUE=0
+CONFIG_CMDLINE="console=ttyS0,115200 rootfstype=squashfs,jffs2 init=/bin/sh"
+CONFIG_CPU_BIG_ENDIAN=y
+# CONFIG_CPU_CAVIUM_OCTEON is not set
+CONFIG_CPU_HAS_PREFETCH=y
+CONFIG_CPU_HAS_SYNC=y
+# CONFIG_CPU_LITTLE_ENDIAN is not set
+# CONFIG_CPU_LOONGSON2E is not set
+CONFIG_CPU_MIPS32=y
+# CONFIG_CPU_MIPS32_R1 is not set
+CONFIG_CPU_MIPS32_R2=y
+# CONFIG_CPU_MIPS64_R1 is not set
+# CONFIG_CPU_MIPS64_R2 is not set
+CONFIG_CPU_MIPSR2=y
+# CONFIG_CPU_NEVADA is not set
+# CONFIG_CPU_R10000 is not set
+# CONFIG_CPU_R3000 is not set
+# CONFIG_CPU_R4300 is not set
+# CONFIG_CPU_R4X00 is not set
+# CONFIG_CPU_R5000 is not set
+# CONFIG_CPU_R5432 is not set
+# CONFIG_CPU_R5500 is not set
+# CONFIG_CPU_R6000 is not set
+# CONFIG_CPU_R8000 is not set
+# CONFIG_CPU_RM7000 is not set
+# CONFIG_CPU_RM9000 is not set
+# CONFIG_CPU_SB1 is not set
+CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
+CONFIG_CPU_SUPPORTS_HIGHMEM=y
+# CONFIG_CPU_TX39XX is not set
+# CONFIG_CPU_TX49XX is not set
+# CONFIG_CPU_VR41XX is not set
+CONFIG_CSRC_R4K=y
+CONFIG_CSRC_R4K_LIB=y
+CONFIG_DECOMPRESS_LZMA=y
+CONFIG_DEVPORT=y
+# CONFIG_DM9000 is not set
+CONFIG_DMA_NEED_PCI_MAP_STATE=y
+CONFIG_DMA_NONCOHERENT=y
+CONFIG_EARLY_PRINTK=y
+# CONFIG_FSNOTIFY is not set
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
+CONFIG_GENERIC_CMOS_UPDATE=y
+CONFIG_GENERIC_FIND_LAST_BIT=y
+CONFIG_GENERIC_FIND_NEXT_BIT=y
+CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
+CONFIG_HARDWARE_WATCHPOINTS=y
+CONFIG_HAS_DMA=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+CONFIG_HAVE_ARCH_KGDB=y
+CONFIG_HAVE_GENERIC_DMA_COHERENT=y
+CONFIG_HAVE_IDE=y
+CONFIG_HAVE_OPROFILE=y
+CONFIG_HAVE_STD_PC_SERIAL_PORT=y
+CONFIG_HW_HAS_PCI=y
+CONFIG_HW_RANDOM=y
+CONFIG_INITRAMFS_SOURCE=""
+CONFIG_IRQ_CPU=y
+CONFIG_KALLSYMS=y
+# CONFIG_MACH_ALCHEMY is not set
+# CONFIG_MACH_DECSTATION is not set
+# CONFIG_MACH_JAZZ is not set
+# CONFIG_MACH_LOONGSON is not set
+# CONFIG_MACH_TX39XX is not set
+# CONFIG_MACH_TX49XX is not set
+# CONFIG_MACH_VR41XX is not set
+# CONFIG_MIKROTIK_RB532 is not set
+CONFIG_MIPS=y
+# CONFIG_MIPS_COBALT is not set
+CONFIG_MIPS_L1_CACHE_SHIFT=5
+# CONFIG_MIPS_MACHINE is not set
+# CONFIG_MIPS_MALTA is not set
+CONFIG_MIPS_MT_DISABLED=y
+# CONFIG_MIPS_MT_SMP is not set
+# CONFIG_MIPS_MT_SMTC is not set
+# CONFIG_MIPS_SIM is not set
+CONFIG_MTD_AMAZON_BUS_WIDTH_16=y
+# CONFIG_MTD_AMAZON_BUS_WIDTH_32 is not set
+# CONFIG_MTD_AMAZON_BUS_WIDTH_8 is not set
+# CONFIG_MTD_AMAZON_FLASH_SIZE_16 is not set
+# CONFIG_MTD_AMAZON_FLASH_SIZE_2 is not set
+CONFIG_MTD_AMAZON_FLASH_SIZE_4=y
+# CONFIG_MTD_AMAZON_FLASH_SIZE_8 is not set
+CONFIG_MTD_CFI_ADV_OPTIONS=y
+# CONFIG_MTD_CFI_GEOMETRY is not set
+# CONFIG_MTD_CFI_INTELEXT is not set
+CONFIG_MTD_PHYSMAP=y
+CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-3
+CONFIG_MTD_REDBOOT_PARTS=y
+# CONFIG_NET_PCI is not set
+# CONFIG_NO_IOPORT is not set
+# CONFIG_NXP_STB220 is not set
+# CONFIG_NXP_STB225 is not set
+CONFIG_PAGEFLAGS_EXTENDED=y
+CONFIG_PCI_DOMAINS=y
+# CONFIG_PMC_MSP is not set
+# CONFIG_PMC_YOSEMITE is not set
+# CONFIG_PNX8550_JBS is not set
+# CONFIG_PNX8550_STB810 is not set
+# CONFIG_PROBE_INITRD_HEADER is not set
+CONFIG_SCHED_OMIT_FRAME_POINTER=y
+# CONFIG_SCSI_DMA is not set
+# CONFIG_SERIAL_8250 is not set
+# CONFIG_SGI_IP22 is not set
+# CONFIG_SGI_IP27 is not set
+# CONFIG_SGI_IP28 is not set
+# CONFIG_SGI_IP32 is not set
+# CONFIG_SIBYTE_BIGSUR is not set
+# CONFIG_SIBYTE_CARMEL is not set
+# CONFIG_SIBYTE_CRHINE is not set
+# CONFIG_SIBYTE_CRHONE is not set
+# CONFIG_SIBYTE_LITTLESUR is not set
+# CONFIG_SIBYTE_RHONE is not set
+# CONFIG_SIBYTE_SENTOSA is not set
+# CONFIG_SIBYTE_SWARM is not set
+CONFIG_SWAP_IO_SPACE=y
+CONFIG_SYS_HAS_CPU_MIPS32_R1=y
+CONFIG_SYS_HAS_CPU_MIPS32_R2=y
+CONFIG_SYS_HAS_EARLY_PRINTK=y
+CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
+CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
+CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
+CONFIG_TRAD_SIGNALS=y
+# CONFIG_TREE_PREEMPT_RCU is not set
+CONFIG_TREE_RCU=y
+CONFIG_USB_SUPPORT=y
+CONFIG_ZONE_DMA_FLAG=0
index 4746f1247e03851ad58e0d3783c413dea66c395d..e264ca759267e9aec0d9196942c4f4e8e88bc61d 100644 (file)
@@ -109,8 +109,8 @@ static void amazon_end_irq(unsigned int irq)
        }
 }
 
-static struct hw_interrupt_type amazon_irq_type = {
-       "AMAZON",
+static struct irq_chip amazon_irq_type = {
+       .name = "AMAZON",
        .startup = amazon_startup_irq,
        .enable = amazon_enable_irq,
        .disable = amazon_disable_irq,
index 1101d840deddba19130b9242e5eaa9500ab28313..54a70622e49ac41fa584a2cc955c0ced3a1bdad1 100644 (file)
@@ -778,6 +778,17 @@ int switch_set_mac_address(struct net_device *dev, void *p)
        return OK;
 }
 
+static const struct net_device_ops amazon_mii_ops = {
+       .ndo_init               = switch_init,
+       .ndo_open               = switch_open,
+       .ndo_stop               = switch_release,
+       .ndo_start_xmit         = switch_tx,
+       .ndo_do_ioctl           = switch_ioctl,
+       .ndo_get_stats          = switch_stats,
+       .ndo_change_mtu         = switch_change_mtu,
+       .ndo_set_mac_address            = switch_set_mac_address,
+       .ndo_tx_timeout         = switch_tx_timeout,
+};
 
 int switch_init(struct net_device *dev)
 {
@@ -787,14 +798,6 @@ int switch_init(struct net_device *dev)
        struct switch_priv *priv;
        ether_setup(dev);                       /* assign some of the fields */
        printk(KERN_INFO "amazon_mii0: %s up using ", dev->name);
-       dev->open = switch_open;
-       dev->stop = switch_release;
-       dev->hard_start_xmit = switch_tx;
-       dev->do_ioctl = switch_ioctl;
-       dev->get_stats = switch_stats;
-       dev->change_mtu = switch_change_mtu;
-       dev->set_mac_address = switch_set_mac_address;
-       dev->tx_timeout = switch_tx_timeout;
        dev->watchdog_timeo = timeout;
 
        priv = netdev_priv(dev);
@@ -836,7 +839,7 @@ static int amazon_mii_probe(struct platform_device *dev)
 
        for (i = 0; i < AMAZON_SW_INT_NO; i++) {
                switch_devs[i] = alloc_etherdev(sizeof(struct switch_priv));
-               switch_devs[i]->init = switch_init;
+               switch_devs[i]->netdev_ops = &amazon_mii_ops;
                strcpy(switch_devs[i]->name, "eth%d");
                priv = (struct switch_priv *) netdev_priv(switch_devs[i]);
                priv->num = i;
index f7fa907b00a241e6e4318918fb9f239b9de2a3f8..fe7050c790c2cd220df4e4c302c40094435c1dc3 100644 (file)
@@ -108,10 +108,10 @@ static void amazonasc_enable_ms(struct uart_port *port)
 static void
 amazonasc_rx_chars(struct uart_port *port)
 {
-#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 26))
-       struct tty_struct *tty = port->info->port.tty;
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 31))
+       struct tty_struct *tty = port->state->port.tty;
 #else
-       struct tty_struct *tty = port->info->tty;
+       struct tty_struct *tty = port->info->port.tty;
 #endif
        unsigned int ch = 0, rsr = 0, fifocnt;
 
@@ -169,7 +169,11 @@ amazonasc_rx_chars(struct uart_port *port)
 
 static void amazonasc_tx_chars(struct uart_port *port)
 {
+#if (LINUX_VERSION_CODE > KERNEL_VERSION(2, 6, 31))
+       struct circ_buf *xmit = &port->state->xmit;
+#else
        struct circ_buf *xmit = &port->info->xmit;
+#endif
 
        if (uart_tx_stopped(port)) {
                amazonasc_stop_tx(port);
@@ -679,7 +683,7 @@ static int __init amazon_asc_probe(struct platform_device *dev)
        return res;
 }
 
-static int __exit amazon_asc_remove(struct platform_device *dev)
+static int amazon_asc_remove(struct platform_device *dev)
 {
        uart_unregister_driver(&amazonasc_reg);
        return 0;
diff --git a/target/linux/amazon/patches-2.6.32/000-mips-bad-intctl.patch b/target/linux/amazon/patches-2.6.32/000-mips-bad-intctl.patch
new file mode 100644 (file)
index 0000000..ad3fe9f
--- /dev/null
@@ -0,0 +1,32 @@
+--- a/arch/mips/kernel/traps.c
++++ b/arch/mips/kernel/traps.c
+@@ -1537,7 +1537,16 @@ void __cpuinit per_cpu_trap_init(void)
+        */
+       if (cpu_has_mips_r2) {
+               cp0_compare_irq = (read_c0_intctl() >> 29) & 7;
++              if (!cp0_compare_irq)
++                      cp0_compare_irq = CP0_LEGACY_COMPARE_IRQ;
++
+               cp0_perfcount_irq = (read_c0_intctl() >> 26) & 7;
++              if (!cp0_perfcount_irq)
++                      cp0_perfcount_irq = CP0_LEGACY_PERFCNT_IRQ;
++
++              if (arch_fixup_c0_irqs)
++                      arch_fixup_c0_irqs();
++
+               if (cp0_perfcount_irq == cp0_compare_irq)
+                       cp0_perfcount_irq = -1;
+       } else {
+--- a/arch/mips/include/asm/irq.h
++++ b/arch/mips/include/asm/irq.h
+@@ -158,8 +158,10 @@ extern void free_irqno(unsigned int irq)
+  * IE7.  Since R2 their number has to be read from the c0_intctl register.
+  */
+ #define CP0_LEGACY_COMPARE_IRQ 7
++#define CP0_LEGACY_PERFCNT_IRQ 7
+ extern int cp0_compare_irq;
+ extern int cp0_perfcount_irq;
++extern void __weak arch_fixup_c0_irqs(void);
+ #endif /* _ASM_IRQ_H */
diff --git a/target/linux/amazon/patches-2.6.32/010-mips_clocksource_init_war.patch b/target/linux/amazon/patches-2.6.32/010-mips_clocksource_init_war.patch
new file mode 100644 (file)
index 0000000..81eabc6
--- /dev/null
@@ -0,0 +1,33 @@
+--- a/arch/mips/kernel/cevt-r4k.c
++++ b/arch/mips/kernel/cevt-r4k.c
+@@ -22,6 +22,22 @@
+ #ifndef CONFIG_MIPS_MT_SMTC
++/*
++ * Compare interrupt can be routed and latched outside the core,
++ * so a single execution hazard barrier may not be enough to give
++ * it time to clear as seen in the Cause register.  4 time the
++ * pipeline depth seems reasonably conservative, and empirically
++ * works better in configurations with high CPU/bus clock ratios.
++ */
++
++#define compare_change_hazard() \
++      do { \
++              irq_disable_hazard(); \
++              irq_disable_hazard(); \
++              irq_disable_hazard(); \
++              irq_disable_hazard(); \
++      } while (0)
++
+ static int mips_next_event(unsigned long delta,
+                            struct clock_event_device *evt)
+ {
+@@ -31,6 +47,7 @@ static int mips_next_event(unsigned long
+       cnt = read_c0_count();
+       cnt += delta;
+       write_c0_compare(cnt);
++      compare_change_hazard();
+       res = ((int)(read_c0_count() - cnt) > 0) ? -ETIME : 0;
+       return res;
+ }
diff --git a/target/linux/amazon/patches-2.6.32/017-wdt-driver.patch b/target/linux/amazon/patches-2.6.32/017-wdt-driver.patch
new file mode 100644 (file)
index 0000000..433abd5
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/drivers/watchdog/Makefile
++++ b/drivers/watchdog/Makefile
+@@ -113,6 +113,7 @@ obj-$(CONFIG_WDT_RM9K_GPI) += rm9k_wdt.o
+ obj-$(CONFIG_SIBYTE_WDOG) += sb_wdog.o
+ obj-$(CONFIG_AR7_WDT) += ar7_wdt.o
+ obj-$(CONFIG_TXX9_WDT) += txx9wdt.o
++obj-$(CONFIG_AMAZON_WDT) += amazon_wdt.o
+ # PARISC Architecture
diff --git a/target/linux/amazon/patches-2.6.32/100-board.patch b/target/linux/amazon/patches-2.6.32/100-board.patch
new file mode 100644 (file)
index 0000000..d1d9c47
--- /dev/null
@@ -0,0 +1,49 @@
+--- a/arch/mips/Kconfig
++++ b/arch/mips/Kconfig
+@@ -96,6 +96,22 @@ config BCM63XX
+       help
+        Support for BCM63XX based boards
++config AMAZON
++      bool "Amazon support (EXPERIMENTAL)"
++      depends on EXPERIMENTAL
++      select DMA_NONCOHERENT
++      select IRQ_CPU
++      select CEVT_R4K
++      select CSRC_R4K
++      select SYS_HAS_CPU_MIPS32_R1
++      select SYS_HAS_CPU_MIPS32_R2
++      select HAVE_STD_PC_SERIAL_PORT
++      select SYS_SUPPORTS_BIG_ENDIAN
++      select SYS_SUPPORTS_32BIT_KERNEL
++      select SYS_HAS_EARLY_PRINTK
++      select HW_HAS_PCI
++      select SWAP_IO_SPACE
++
+ config MIPS_COBALT
+       bool "Cobalt Server"
+       select CEVT_R4K
+@@ -673,6 +689,7 @@ config CAVIUM_OCTEON_REFERENCE_BOARD
+ endchoice
++source "arch/mips/amazon/Kconfig"
+ source "arch/mips/alchemy/Kconfig"
+ source "arch/mips/basler/excite/Kconfig"
+ source "arch/mips/bcm63xx/Kconfig"
+--- a/arch/mips/Makefile
++++ b/arch/mips/Makefile
+@@ -296,6 +296,13 @@ cflags-$(CONFIG_SOC_AU1X00)       += -I$(srctr
+ #
++# Infineon AMAZON
++#
++core-$(CONFIG_AMAZON)         += arch/mips/amazon/
++cflags-$(CONFIG_AMAZON)       += -I$(srctree)/arch/mips/include/asm/mach-amazon
++load-$(CONFIG_AMAZON)         += 0xffffffff80002000
++
++#
+ # Cobalt Server
+ #
+ core-$(CONFIG_MIPS_COBALT)    += arch/mips/cobalt/
diff --git a/target/linux/amazon/patches-2.6.32/130-mtd_drivers.patch b/target/linux/amazon/patches-2.6.32/130-mtd_drivers.patch
new file mode 100644 (file)
index 0000000..fafd996
--- /dev/null
@@ -0,0 +1,7 @@
+--- a/drivers/mtd/maps/Makefile
++++ b/drivers/mtd/maps/Makefile
+@@ -61,3 +61,4 @@ obj-$(CONFIG_MTD_BFIN_ASYNC) += bfin-asy
+ obj-$(CONFIG_MTD_RBTX4939)    += rbtx4939-flash.o
+ obj-$(CONFIG_MTD_VMU)         += vmu-flash.o
+ obj-$(CONFIG_MTD_GPIO_ADDR)   += gpio-addr-flash.o
++obj-$(CONFIG_AMAZON_MTD)      += amazon.o
diff --git a/target/linux/amazon/patches-2.6.32/140-net_drivers.patch b/target/linux/amazon/patches-2.6.32/140-net_drivers.patch
new file mode 100644 (file)
index 0000000..e64908c
--- /dev/null
@@ -0,0 +1,9 @@
+--- a/drivers/net/Makefile
++++ b/drivers/net/Makefile
+@@ -286,3 +286,6 @@ obj-$(CONFIG_VIRTIO_NET) += virtio_net.o
+ obj-$(CONFIG_SFC) += sfc/
+ obj-$(CONFIG_WIMAX) += wimax/
++
++obj-$(CONFIG_AMAZON_NET_SW) += amazon_sw.o
++obj-$(CONFIG_ADM6996_SUPPORT) += admmod.o
diff --git a/target/linux/amazon/patches-2.6.32/150-serial_driver.patch b/target/linux/amazon/patches-2.6.32/150-serial_driver.patch
new file mode 100644 (file)
index 0000000..8b7741c
--- /dev/null
@@ -0,0 +1,10 @@
+--- a/drivers/serial/Makefile
++++ b/drivers/serial/Makefile
+@@ -3,6 +3,7 @@
+ #
+ obj-$(CONFIG_SERIAL_CORE) += serial_core.o
++obj-$(CONFIG_AMAZON_ASC_UART) += amazon_asc.o
+ obj-$(CONFIG_SERIAL_21285) += 21285.o
+ # These Sparc drivers have to appear before others such as 8250
diff --git a/target/linux/amazon/patches-2.6.32/160-cfi-swap.patch b/target/linux/amazon/patches-2.6.32/160-cfi-swap.patch
new file mode 100644 (file)
index 0000000..bb89f61
--- /dev/null
@@ -0,0 +1,56 @@
+--- a/drivers/mtd/chips/cfi_cmdset_0002.c
++++ b/drivers/mtd/chips/cfi_cmdset_0002.c
+@@ -1079,6 +1079,9 @@ static int __xipram do_write_oneword(str
+       int retry_cnt = 0;
+       adr += chip->start;
++#ifdef CONFIG_AMAZON
++      adr ^= 2;
++#endif
+       spin_lock(chip->mutex);
+       ret = get_chip(map, chip, adr, FL_WRITING);
+@@ -1361,7 +1364,11 @@ static int __xipram do_write_buffer(stru
+       z = 0;
+       while(z < words * map_bankwidth(map)) {
+               datum = map_word_load(map, buf);
++#ifdef CONFIG_AMAZON
++              map_write(map, datum, (adr + z) ^ 0x2);
++#else
+               map_write(map, datum, adr + z);
++#endif
+               z += map_bankwidth(map);
+               buf += map_bankwidth(map);
+@@ -1606,6 +1613,9 @@ static int __xipram do_erase_oneblock(st
+       int ret = 0;
+       adr += chip->start;
++#ifdef CONFIG_AMAZON
++      adr ^= 2;
++#endif
+       spin_lock(chip->mutex);
+       ret = get_chip(map, chip, adr, FL_ERASING);
+@@ -1734,6 +1744,10 @@ static int do_atmel_lock(struct map_info
+       struct cfi_private *cfi = map->fldrv_priv;
+       int ret;
++#ifdef CONFIG_AMAZON
++      adr ^= 2;
++#endif
++
+       spin_lock(chip->mutex);
+       ret = get_chip(map, chip, adr + chip->start, FL_LOCKING);
+       if (ret)
+@@ -1770,6 +1784,10 @@ static int do_atmel_unlock(struct map_in
+       struct cfi_private *cfi = map->fldrv_priv;
+       int ret;
++#ifdef CONFIG_AMAZON
++      adr ^= 2;
++#endif
++
+       spin_lock(chip->mutex);
+       ret = get_chip(map, chip, adr + chip->start, FL_UNLOCKING);
+       if (ret)