summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorClaudio Mignanti <c.mignanti@gmail.com>2012-04-20 13:32:55 +0000
committerClaudio Mignanti <c.mignanti@gmail.com>2012-04-20 13:32:55 +0000
commit3ac08ca653750f8414f41978c8246c31069605a0 (patch)
tree13b30a6dd27799fa39271e37d834d3e7c80e0667
parentf50231aeb3bd0d6a8c7dc04cc7130d8a64938e63 (diff)
downloadmtk-20170518-3ac08ca653750f8414f41978c8246c31069605a0.zip
mtk-20170518-3ac08ca653750f8414f41978c8246c31069605a0.tar.gz
mtk-20170518-3ac08ca653750f8414f41978c8246c31069605a0.tar.bz2
Update the kernel to 3.3.x series, remove patches that doesn't apply anymore
Signed-off-by: Claudio Mignanti <c.mignanti@gmail.com> SVN-Revision: 31371
-rw-r--r--target/linux/at91/Makefile2
-rw-r--r--target/linux/at91/config-default120
-rw-r--r--target/linux/at91/flexibity/config-default (renamed from target/linux/at91/flexibity/config-2.6.39)0
-rw-r--r--target/linux/at91/flexibity/target.mk1
-rw-r--r--target/linux/at91/netus/config-default8
-rw-r--r--target/linux/at91/patches/100-at91_i2c.patch285
-rw-r--r--target/linux/at91/patches/200-experimenta_adc_driver.patch23
-rw-r--r--target/linux/at91/patches/600-usb_vbus_active_high.patch84
8 files changed, 60 insertions, 463 deletions
diff --git a/target/linux/at91/Makefile b/target/linux/at91/Makefile
index 1d65d75..f20b7e6 100644
--- a/target/linux/at91/Makefile
+++ b/target/linux/at91/Makefile
@@ -14,7 +14,7 @@ FEATURES:=squashfs jffs2 targz
CFLAGS:=-Os -pipe -march=armv5te -mtune=arm926ej-s -fno-caller-saves
SUBTARGETS:=netus tqma9263 flexibity
-LINUX_VERSION:=2.6.38.8
+LINUX_VERSION:=3.3.2
DEVICE_TYPE=
include $(INCLUDE_DIR)/target.mk
diff --git a/target/linux/at91/config-default b/target/linux/at91/config-default
index 29c7234..1ffbb76 100644
--- a/target/linux/at91/config-default
+++ b/target/linux/at91/config-default
@@ -1,28 +1,32 @@
CONFIG_ALIGNMENT_TRAP=y
-# CONFIG_ARCH_AT572D940HF is not set
CONFIG_ARCH_AT91=y
# CONFIG_ARCH_AT91CAP9 is not set
# CONFIG_ARCH_AT91RM9200 is not set
-# CONFIG_ARCH_AT91RM9200DK is not set
# CONFIG_ARCH_AT91SAM9260 is not set
# CONFIG_ARCH_AT91SAM9261 is not set
# CONFIG_ARCH_AT91SAM9263 is not set
# CONFIG_ARCH_AT91SAM9G10 is not set
-# CONFIG_ARCH_AT91SAM9G20 is not set
+CONFIG_ARCH_AT91SAM9G20=y
# CONFIG_ARCH_AT91SAM9G45 is not set
# CONFIG_ARCH_AT91SAM9RL is not set
# CONFIG_ARCH_AT91X40 is not set
+CONFIG_ARCH_BINFMT_ELF_RANDOMIZE_PIE=y
+CONFIG_ARCH_HAS_CPU_IDLE_WAIT=y
+CONFIG_ARCH_NR_GPIO=0
+# CONFIG_ARCH_PHYS_ADDR_T_64BIT is not set
CONFIG_ARCH_REQUIRE_GPIOLIB=y
# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
# CONFIG_ARCH_SUPPORTS_MSI is not set
CONFIG_ARCH_SUSPEND_POSSIBLE=y
+# 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_THUMB=y
# CONFIG_AT91SAM9X_WATCHDOG is not set
-# CONFIG_AT91_ADC is not set
-CONFIG_AT91_EARLY_DBGU=y
+CONFIG_AT91_EARLY_DBGU0=y
# CONFIG_AT91_EARLY_USART0 is not set
# CONFIG_AT91_EARLY_USART1 is not set
# CONFIG_AT91_EARLY_USART2 is not set
@@ -31,15 +35,17 @@ CONFIG_AT91_EARLY_DBGU=y
# CONFIG_AT91_EARLY_USART5 is not set
CONFIG_AT91_PMC_UNIT=y
CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
+CONFIG_AT91_SAM9_ALT_RESET=y
CONFIG_AT91_TIMER_HZ=100
# CONFIG_ATMEL_PWM is not set
# CONFIG_ATMEL_SSC is not set
# CONFIG_ATMEL_TCLIB is not set
-CONFIG_BITREVERSE=y
+CONFIG_BCMA_POSSIBLE=y
# CONFIG_BLK_DEV is not set
-# CONFIG_BLK_DEV_IDE_AT91 is not set
# CONFIG_BLK_DEV_INITRD is not set
+# CONFIG_CACHE_L2X0 is not set
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+CONFIG_CLKDEV_LOOKUP=y
CONFIG_CPU_32v5=y
CONFIG_CPU_ABRT_EV5TJ=y
CONFIG_CPU_ARM926T=y
@@ -52,22 +58,23 @@ CONFIG_CPU_CP15_MMU=y
# CONFIG_CPU_ICACHE_DISABLE is not set
CONFIG_CPU_PABRT_LEGACY=y
CONFIG_CPU_TLB_V4WBI=y
+CONFIG_CPU_USE_DOMAINS=y
+CONFIG_CRC16=y
CONFIG_DEBUG_BUGVERBOSE=y
# CONFIG_DEBUG_USER is not set
-CONFIG_DECOMPRESS_LZMA=y
CONFIG_DEVPTS_MULTIPLE_INSTANCES=y
-# CONFIG_DM9000 is not set
+# CONFIG_DW_WATCHDOG is not set
CONFIG_EXT4_FS=y
-# CONFIG_FPE_FASTFPE is not set
-# CONFIG_FPE_NWFPE is not set
CONFIG_FRAME_POINTER=y
-# CONFIG_FSNOTIFY is not set
+CONFIG_FS_MBCACHE=y
CONFIG_GENERIC_ATOMIC64=y
+CONFIG_GENERIC_BUG=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
-CONFIG_GENERIC_FIND_LAST_BIT=y
+# CONFIG_GENERIC_CPU_DEVICES is not set
CONFIG_GENERIC_GPIO=y
-CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
+CONFIG_GENERIC_IRQ_SHOW=y
+CONFIG_GENERIC_PCI_IOMAP=y
CONFIG_GPIOLIB=y
CONFIG_GPIO_DEVICE=y
CONFIG_GPIO_SYSFS=y
@@ -78,41 +85,51 @@ 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_AT91_DBGU0=y
CONFIG_HAVE_AT91_USART3=y
CONFIG_HAVE_AT91_USART4=y
CONFIG_HAVE_AT91_USART5=y
CONFIG_HAVE_CLK=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_IDE=y
+CONFIG_HAVE_GENERIC_HARDIRQS=y
+CONFIG_HAVE_IRQ_WORK=y
CONFIG_HAVE_KERNEL_GZIP=y
CONFIG_HAVE_KERNEL_LZMA=y
CONFIG_HAVE_KERNEL_LZO=y
-CONFIG_HAVE_KPROBES=y
-CONFIG_HAVE_KRETPROBES=y
+CONFIG_HAVE_KERNEL_XZ=y
CONFIG_HAVE_LATENCYTOP_SUPPORT=y
+CONFIG_HAVE_MEMBLOCK=y
+CONFIG_HAVE_NET_MACB=y
CONFIG_HAVE_OPROFILE=y
CONFIG_HAVE_PERF_EVENTS=y
CONFIG_HAVE_PROC_CPU=y
-# CONFIG_HW_RANDOM is not set
+CONFIG_HAVE_REGS_AND_STACK_ACCESS_API=y
+CONFIG_HAVE_SPARSE_IRQ=y
# CONFIG_ISDN is not set
+CONFIG_JBD2=y
+CONFIG_KTIME_SCALAR=y
# CONFIG_LEDS is not set
-# CONFIG_LEDS_ATMEL_PWM is not set
# CONFIG_LEDS_GPIO is not set
-CONFIG_MACB=y
+CONFIG_LEDS_TRIGGER_HEARTBEAT=y
+# CONFIG_MACB is not set
# CONFIG_MACH_ACMENETUSFOXG20 is not set
-# CONFIG_MACH_AT91RM9200EK is not set
# CONFIG_MACH_AT91SAM9G20EK is not set
-# CONFIG_MACH_AT91SAM9G20EK_2MMC is not set
+# CONFIG_MACH_AT91SAM_DT is not set
# CONFIG_MACH_CPU9G20 is not set
-# CONFIG_MACH_CSB337 is not set
# CONFIG_MACH_GSIA18S is not set
-# CONFIG_MACH_NETUS_FOXBOARD is not set
-# CONFIG_MACH_ONEARM is not set
# CONFIG_MACH_PCONTROL_G20 is not set
# CONFIG_MACH_PORTUXG20 is not set
# CONFIG_MACH_SNAPPER_9260 is not set
# CONFIG_MACH_STAMP9G20 is not set
+# CONFIG_MACH_USB_A9G20 is not set
+CONFIG_MDIO_BOARDINFO=y
# CONFIG_MFD_T7L66XB is not set
# CONFIG_MII is not set
CONFIG_MMC=y
@@ -123,25 +140,20 @@ CONFIG_MTD_DATAFLASH=y
# CONFIG_MTD_DATAFLASH_OTP is not set
# CONFIG_MTD_DATAFLASH_WRITE_VERIFY is not set
CONFIG_NEED_DMA_MAP_STATE=y
-# CONFIG_NETDEV_1000 is not set
-# CONFIG_NETUS_FOXGM is not set
-CONFIG_NETUS_HEARTBEAT_LED=y
-CONFIG_NETUS_SERIALS=y
-# CONFIG_NETUS_USE_DATAFLASH is not set
+CONFIG_NEED_PER_CPU_KM=y
CONFIG_NLS=y
CONFIG_PAGEFLAGS_EXTENDED=y
CONFIG_PAGE_OFFSET=0xC0000000
-# CONFIG_PATA_AT91 is not set
# CONFIG_PCI_SYSCALL is not set
CONFIG_PERF_USE_VMALLOC=y
CONFIG_PHYLIB=y
+CONFIG_PHYS_OFFSET=0x0
+# CONFIG_PREEMPT_RCU is not set
+# CONFIG_QUOTACTL is not set
CONFIG_RTC_CLASS=y
-CONFIG_RTC_DRV_AT91SAM9=y
-CONFIG_RTC_DRV_AT91SAM9_GPBR=0
-CONFIG_RTC_DRV_AT91SAM9_RTT=0
+# CONFIG_RTC_DRV_AT91SAM9 is not set
# CONFIG_RTC_DRV_CMOS is not set
# CONFIG_SCSI_DMA is not set
-CONFIG_SCSI_MOD=y
# CONFIG_SDIO_UART is not set
# CONFIG_SERIAL_8250 is not set
CONFIG_SERIAL_ATMEL=y
@@ -157,54 +169,38 @@ CONFIG_SPI_SPIDEV=y
CONFIG_SPLIT_PTLOCK_CPUS=999999
# CONFIG_STAGING is not set
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
-#CONFIG_SND_ATMEL_SOC is not set
CONFIG_UID16=y
# CONFIG_USB_ARCH_HAS_EHCI is not set
+# CONFIG_USB_ARCH_HAS_XHCI is not set
CONFIG_USB_AT91=y
-# CONFIG_USB_AUDIO is not set
# CONFIG_USB_CDC_COMPOSITE is not set
+CONFIG_USB_COMMON=y
CONFIG_USB_ETH=y
-CONFIG_USB_ETH_EEM=y
+# CONFIG_USB_ETH_EEM is not set
CONFIG_USB_ETH_RNDIS=y
# CONFIG_USB_FILE_STORAGE is not set
+# CONFIG_USB_FUNCTIONFS is not set
+# CONFIG_USB_FUSB300 is not set
CONFIG_USB_GADGET=y
# CONFIG_USB_GADGETFS is not set
-# CONFIG_USB_GADGET_AMD5536UDC is not set
-CONFIG_USB_GADGET_AT91=y
-# CONFIG_USB_GADGET_ATMEL_USBA is not set
-# CONFIG_USB_GADGET_CI13XXX is not set
# CONFIG_USB_GADGET_DEBUG_FILES is not set
# CONFIG_USB_GADGET_DEBUG_FS is not set
-# CONFIG_USB_GADGET_DUALSPEED is not set
-# CONFIG_USB_GADGET_DUMMY_HCD is not set
-# CONFIG_USB_GADGET_FSL_QE is not set
-# CONFIG_USB_GADGET_FSL_USB2 is not set
-# CONFIG_USB_GADGET_GOKU is not set
-# CONFIG_USB_GADGET_IMX is not set
-# CONFIG_USB_GADGET_LANGWELL is not set
-# CONFIG_USB_GADGET_LH7A40X is not set
-# CONFIG_USB_GADGET_M66592 is not set
-# CONFIG_USB_GADGET_MUSB_HDRC is not set
-# CONFIG_USB_GADGET_NET2280 is not set
-# CONFIG_USB_GADGET_OMAP is not set
-# CONFIG_USB_GADGET_PXA25X is not set
-# CONFIG_USB_GADGET_PXA27X is not set
-# CONFIG_USB_GADGET_PXA_U2O is not set
-# CONFIG_USB_GADGET_R8A66597 is not set
-# CONFIG_USB_GADGET_S3C2410 is not set
-# CONFIG_USB_GADGET_S3C_HSOTG is not set
-CONFIG_USB_GADGET_SELECTED=y
CONFIG_USB_GADGET_VBUS_DRAW=2
# CONFIG_USB_G_DBGP is not set
+# CONFIG_USB_G_HID is not set
# CONFIG_USB_G_NCM is not set
# CONFIG_USB_G_PRINTER is not set
# CONFIG_USB_G_SERIAL is not set
-# CONFIG_USB_MIDI_GADGET is not set
+# CONFIG_USB_M66592 is not set
+# CONFIG_USB_MV_UDC is not set
+# CONFIG_USB_NET2272 is not set
+# CONFIG_USB_R8A66597 is not set
CONFIG_USB_SUPPORT=y
# CONFIG_USB_ZERO is not set
CONFIG_VECTORS_BASE=0xffff0000
# CONFIG_VFP is not set
# CONFIG_WLAN is not set
+CONFIG_XZ_DEC=y
CONFIG_ZBOOT_ROM_BSS=0
CONFIG_ZBOOT_ROM_TEXT=0
CONFIG_ZONE_DMA_FLAG=0
diff --git a/target/linux/at91/flexibity/config-2.6.39 b/target/linux/at91/flexibity/config-default
index c194586..c194586 100644
--- a/target/linux/at91/flexibity/config-2.6.39
+++ b/target/linux/at91/flexibity/config-default
diff --git a/target/linux/at91/flexibity/target.mk b/target/linux/at91/flexibity/target.mk
index 5e4c460..113d2bf 100644
--- a/target/linux/at91/flexibity/target.mk
+++ b/target/linux/at91/flexibity/target.mk
@@ -8,7 +8,6 @@
SUBTARGET:=flexibity
BOARDNAME:=Flexibity Connect (AT91)
FEATURES:=ext2 tgz usb
-LINUX_VERSION:=2.6.39
define Target/Description
Build fimware images for Flexibity Connect board.
diff --git a/target/linux/at91/netus/config-default b/target/linux/at91/netus/config-default
index c965f23..a4287e7 100644
--- a/target/linux/at91/netus/config-default
+++ b/target/linux/at91/netus/config-default
@@ -1,8 +1,2 @@
CONFIG_ARCH_AT91SAM9G20=y
-# CONFIG_ARCH_USES_GETTIMEOFFSET is not set
-CONFIG_CRC16=y
-CONFIG_JBD2=y
-CONFIG_MACH_NETUS_FOXBOARD=y
-# CONFIG_USB_FUNCTIONFS is not set
-# CONFIG_USB_G_HID is not set
-# CONFIG_USB_G_WEBCAM is not set
+CONFIG_MACH_ACMENETUSFOXG20=y
diff --git a/target/linux/at91/patches/100-at91_i2c.patch b/target/linux/at91/patches/100-at91_i2c.patch
deleted file mode 100644
index e78ffde..0000000
--- a/target/linux/at91/patches/100-at91_i2c.patch
+++ /dev/null
@@ -1,285 +0,0 @@
---- a/drivers/i2c/busses/Kconfig
-+++ b/drivers/i2c/busses/Kconfig
-@@ -283,7 +283,7 @@ comment "I2C system bus drivers (mostly
-
- config I2C_AT91
- tristate "Atmel AT91 I2C Two-Wire interface (TWI)"
-- depends on ARCH_AT91 && EXPERIMENTAL && BROKEN
-+ depends on ARCH_AT91 && EXPERIMENTAL
- help
- This supports the use of the I2C interface on Atmel AT91
- processors.
---- a/drivers/i2c/busses/i2c-at91.c
-+++ b/drivers/i2c/busses/i2c-at91.c
-@@ -11,8 +11,18 @@
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-+
-+ D. Gilbert [20100318 AT91SAM9G20]
-+ - Check for NACK, a NACK will abort current tranfser,
-+ returned as errno=EREMOTEIO unless I2C_M_IGNORE_NAK is set
-+ - Only supports 7 bit I2C device (slave) address
-+ - clockrate adjustable (module_param).
- */
-
-+
-+/* Uncomment following line to see dev_dbg() output in logs */
-+/* #define DEBUG 1 */
-+
- #include <linux/module.h>
- #include <linux/kernel.h>
- #include <linux/err.h>
-@@ -32,26 +42,28 @@
- #define TWI_CLOCK 100000 /* Hz. max 400 Kbits/sec */
-
-
-+static unsigned int clockrate = TWI_CLOCK;
-+static unsigned int prev_clockrate = TWI_CLOCK;
- static struct clk *twi_clk;
- static void __iomem *twi_base;
-
- #define at91_twi_read(reg) __raw_readl(twi_base + (reg))
- #define at91_twi_write(reg, val) __raw_writel((val), twi_base + (reg))
-
--
- /*
-- * Initialize the TWI hardware registers.
-+ * Set TWI clock dividers based on clockrate (clock rate for SCL)
- */
--static void __devinit at91_twi_hwinit(void)
-+static void at91_twi_clock_dividers(void)
- {
- unsigned long cdiv, ckdiv;
-
-- at91_twi_write(AT91_TWI_IDR, 0xffffffff); /* Disable all interrupts */
-- at91_twi_write(AT91_TWI_CR, AT91_TWI_SWRST); /* Reset peripheral */
-- at91_twi_write(AT91_TWI_CR, AT91_TWI_MSEN); /* Set Master mode */
-+ if (clockrate < 1000)
-+ clockrate = 1000;
-+ else if (clockrate > 400000)
-+ clockrate = 400000;
-
-- /* Calcuate clock dividers */
-- cdiv = (clk_get_rate(twi_clk) / (2 * TWI_CLOCK)) - 3;
-+ /* Calculate clock dividers */
-+ cdiv = (clk_get_rate(twi_clk) / (2 * clockrate)) - 3;
- cdiv = cdiv + 1; /* round up */
- ckdiv = 0;
- while (cdiv > 255) {
-@@ -61,41 +73,92 @@ static void __devinit at91_twi_hwinit(vo
-
- if (cpu_is_at91rm9200()) { /* AT91RM9200 Errata #22 */
- if (ckdiv > 5) {
-- printk(KERN_ERR "AT91 I2C: Invalid TWI_CLOCK value!\n");
-+ printk(KERN_ERR "i2c-at91: Invalid AT91RM9200 clock rate\n");
- ckdiv = 5;
- }
- }
-+ /* AT91SAM9G20 has 3 bits for ckdiv so it cannot exceed 7 */
-+ if (cpu_is_at91sam9g20()) {
-+ if (ckdiv > 7) {
-+ printk(KERN_ERR "i2c-at91: Invalid AT91SAM9G20 clock "
-+ "rate, ckdiv=%lu\n", ckdiv);
-+ ckdiv = 7;
-+ }
-+ }
-
- at91_twi_write(AT91_TWI_CWGR, (ckdiv << 16) | (cdiv << 8) | cdiv);
-+ prev_clockrate = clockrate;
- }
-
- /*
-- * Poll the i2c status register until the specified bit is set.
-- * Returns 0 if timed out (100 msec).
-+ * Initialize the TWI hardware registers.
- */
--static short at91_poll_status(unsigned long bit)
-+static void __devinit at91_twi_hwinit(void)
- {
-- int loop_cntr = 10000;
-+ at91_twi_write(AT91_TWI_IDR, 0xffffffff); /* Disable all interrupts */
-+ at91_twi_write(AT91_TWI_CR, AT91_TWI_SWRST); /* Reset peripheral */
-+ /* Set Master mode; Atmel suggests disabling slave mode */
-+ at91_twi_write(AT91_TWI_CR, AT91_TWI_MSEN | AT91_TWI_SVDIS);
-
-+ at91_twi_clock_dividers();
-+}
-+
-+/*
-+ * Poll the i2c status register until the specified bit is set or a NACK
-+ * occurs. Returns 0 if timed out (50 msec). If nack_seen_p is non-NULL
-+ * then write 0 to it first, then if the NACK bit is set in the status
-+ * register then write 1 to it and immediately return with a value of 1.
-+ */
-+static short at91_poll_status(unsigned long bit, int * nack_seen_p)
-+{
-+ int loop_cntr = 5000;
-+ unsigned long stat;
-+
-+ if (nack_seen_p)
-+ *nack_seen_p = 0;
-+ if (clockrate <= 20000)
-+ loop_cntr = 100;
- do {
-- udelay(10);
-- } while (!(at91_twi_read(AT91_TWI_SR) & bit) && (--loop_cntr > 0));
-+ if (clockrate <= 20000)
-+ udelay(100);
-+ else if (clockrate <= 100000)
-+ udelay(10);
-+ else
-+ udelay(3);
-+ stat = at91_twi_read(AT91_TWI_SR);
-+ if ((stat & AT91_TWI_NACK) && nack_seen_p) {
-+ *nack_seen_p = 1;
-+ return 1;
-+ }
-+ } while (!(stat & bit) && (--loop_cntr > 0));
-
- return (loop_cntr > 0);
- }
-
- static int xfer_read(struct i2c_adapter *adap, unsigned char *buf, int length)
- {
-+ int nack_seen = 0;
-+ int sent_stop = 0;
-+
- /* Send Start */
-- at91_twi_write(AT91_TWI_CR, AT91_TWI_START);
-+ if (1 == length) {
-+ at91_twi_write(AT91_TWI_CR, AT91_TWI_START | AT91_TWI_STOP);
-+ sent_stop = 1;
-+ } else
-+ at91_twi_write(AT91_TWI_CR, AT91_TWI_START);
-
- /* Read data */
- while (length--) {
-- if (!length) /* need to send Stop before reading last byte */
-+ /* send Stop before reading last byte (if not already done) */
-+ if ((0 == length) && (0 == sent_stop))
- at91_twi_write(AT91_TWI_CR, AT91_TWI_STOP);
-- if (!at91_poll_status(AT91_TWI_RXRDY)) {
-+ if (!at91_poll_status(AT91_TWI_RXRDY, &nack_seen)) {
- dev_dbg(&adap->dev, "RXRDY timeout\n");
- return -ETIMEDOUT;
-+ } else if (nack_seen) {
-+ dev_dbg(&adap->dev, "read NACKed\n");
-+ /* NACK supplies Stop */
-+ return -EREMOTEIO;
- }
- *buf++ = (at91_twi_read(AT91_TWI_RHR) & 0xff);
- }
-@@ -105,16 +168,24 @@ static int xfer_read(struct i2c_adapter
-
- static int xfer_write(struct i2c_adapter *adap, unsigned char *buf, int length)
- {
-+ int nack_seen = 0;
-+
- /* Load first byte into transmitter */
- at91_twi_write(AT91_TWI_THR, *buf++);
-
-- /* Send Start */
-+ /* Send Start [AT91SAM9G20 does not need this on write] */
- at91_twi_write(AT91_TWI_CR, AT91_TWI_START);
-
- do {
-- if (!at91_poll_status(AT91_TWI_TXRDY)) {
-+ if (!at91_poll_status(AT91_TWI_TXRDY, &nack_seen)) {
- dev_dbg(&adap->dev, "TXRDY timeout\n");
-+ /* Set Master mode again */
-+ at91_twi_write(AT91_TWI_CR, AT91_TWI_MSEN);
- return -ETIMEDOUT;
-+ } else if (nack_seen) {
-+ dev_dbg(&adap->dev, "write NACKed\n");
-+ /* NACK supplies Stop */
-+ return -EREMOTEIO;
- }
-
- length--; /* byte was transmitted */
-@@ -123,7 +194,7 @@ static int xfer_write(struct i2c_adapter
- at91_twi_write(AT91_TWI_THR, *buf++);
- } while (length);
-
-- /* Send Stop */
-+ /* Send Stop [AT91SAM9G20 does not need this on write] */
- at91_twi_write(AT91_TWI_CR, AT91_TWI_STOP);
-
- return 0;
-@@ -136,11 +207,19 @@ static int xfer_write(struct i2c_adapter
- * Instead the "internal device address" has to be written using a separate
- * i2c message.
- * http://lists.arm.linux.org.uk/pipermail/linux-arm-kernel/2004-September/024411.html
-+ * [dpg] By 2010 silicon bugs should be fixed, will need IADR for 10 bit device address
- */
- static int at91_xfer(struct i2c_adapter *adap, struct i2c_msg *pmsg, int num)
- {
- int i, ret;
-+ int nack_seen = 0;
-
-+ if (prev_clockrate != clockrate) {
-+ dev_dbg(&adap->dev, "at91_xfer: prev_clockrate=%u "
-+ "clockrate=%u, change\n", prev_clockrate, clockrate);
-+ at91_twi_clock_dividers();
-+ msleep(1); /* let things settle */
-+ }
- dev_dbg(&adap->dev, "at91_xfer: processing %d messages:\n", num);
-
- for (i = 0; i < num; i++) {
-@@ -158,13 +237,23 @@ static int at91_xfer(struct i2c_adapter
- else
- ret = xfer_write(adap, pmsg->buf, pmsg->len);
-
-- if (ret)
-- return ret;
--
-+ if (ret) {
-+ if ((I2C_M_IGNORE_NAK & pmsg->flags) &&
-+ (-EREMOTEIO == ret)) {
-+ dev_dbg(&adap->dev, "transfer "
-+ "NACKed, skip to next\n");
-+ pmsg++;
-+ continue;
-+ } else
-+ return ret;
-+ }
- /* Wait until transfer is finished */
-- if (!at91_poll_status(AT91_TWI_TXCOMP)) {
-+ if (!at91_poll_status(AT91_TWI_TXCOMP, &nack_seen)) {
- dev_dbg(&adap->dev, "TXCOMP timeout\n");
- return -ETIMEDOUT;
-+ } else if (nack_seen) {
-+ dev_dbg(&adap->dev, "TXCOMP NACKed\n");
-+ return -EREMOTEIO;
- }
- }
- dev_dbg(&adap->dev, "transfer complete\n");
-@@ -239,7 +328,8 @@ static int __devinit at91_i2c_probe(stru
- goto fail3;
- }
-
-- dev_info(&pdev->dev, "AT91 i2c bus driver.\n");
-+ dev_info(&pdev->dev, "AT91 TWI (I2C) bus driver [SCL %d Hz]\n",
-+ clockrate);
- return 0;
-
- fail3:
-@@ -295,6 +385,11 @@ static int at91_i2c_resume(struct platfo
- #define at91_i2c_resume NULL
- #endif
-
-+/* I2C clock speed, in Hz 0-400kHz*/
-+module_param(clockrate, uint, S_IRUGO | S_IWUSR);
-+MODULE_PARM_DESC(clockrate,
-+ "SCL clock rate, 1000 to 400000 Hz (def: 100 kHz)");
-+
- /* work with "modprobe at91_i2c" from hotplugging or coldplugging */
- MODULE_ALIAS("platform:at91_i2c");
-
-@@ -323,5 +418,5 @@ module_init(at91_i2c_init);
- module_exit(at91_i2c_exit);
-
- MODULE_AUTHOR("Rick Bronson");
--MODULE_DESCRIPTION("I2C (TWI) driver for Atmel AT91");
-+MODULE_DESCRIPTION("I2C (TWI) master driver for Atmel AT91");
- MODULE_LICENSE("GPL");
diff --git a/target/linux/at91/patches/200-experimenta_adc_driver.patch b/target/linux/at91/patches/200-experimenta_adc_driver.patch
deleted file mode 100644
index 48bb61e..0000000
--- a/target/linux/at91/patches/200-experimenta_adc_driver.patch
+++ /dev/null
@@ -1,23 +0,0 @@
---- a/drivers/misc/Kconfig
-+++ b/drivers/misc/Kconfig
-@@ -104,6 +104,10 @@ config ATMEL_TCB_CLKSRC_BLOCK
- TC can be used for other purposes, such as PWM generation and
- interval timing.
-
-+config AT91_ADC
-+ tristate "AT91 ADC converter"
-+ depends on ARCH_AT91 && SYSFS
-+
- config IBM_ASM
- tristate "Device driver for IBM RSA service processor"
- depends on X86 && PCI && INPUT && EXPERIMENTAL
---- a/drivers/misc/Makefile
-+++ b/drivers/misc/Makefile
-@@ -9,6 +9,7 @@ obj-$(CONFIG_AD525X_DPOT_SPI) += ad525x_
- obj-$(CONFIG_ATMEL_PWM) += atmel_pwm.o
- obj-$(CONFIG_ATMEL_SSC) += atmel-ssc.o
- obj-$(CONFIG_ATMEL_TCLIB) += atmel_tclib.o
-+obj-$(CONFIG_AT91_ADC) += at91-adc.o
- obj-$(CONFIG_BMP085) += bmp085.o
- obj-$(CONFIG_ICS932S401) += ics932s401.o
- obj-$(CONFIG_LKDTM) += lkdtm.o
diff --git a/target/linux/at91/patches/600-usb_vbus_active_high.patch b/target/linux/at91/patches/600-usb_vbus_active_high.patch
deleted file mode 100644
index 08dfcb3..0000000
--- a/target/linux/at91/patches/600-usb_vbus_active_high.patch
+++ /dev/null
@@ -1,84 +0,0 @@
---- a/arch/arm/mach-at91/at91cap9_devices.c
-+++ b/arch/arm/mach-at91/at91cap9_devices.c
-@@ -77,7 +77,7 @@ void __init at91_add_device_usbh(struct
- /* Enable VBus control for UHP ports */
- for (i = 0; i < data->ports; i++) {
- if (data->vbus_pin[i])
-- at91_set_gpio_output(data->vbus_pin[i], 0);
-+ at91_set_gpio_output(data->vbus_pin[i], data->vbus_active_high);
- }
-
- usbh_data = *data;
---- a/arch/arm/mach-at91/at91sam9263_devices.c
-+++ b/arch/arm/mach-at91/at91sam9263_devices.c
-@@ -71,7 +71,7 @@ void __init at91_add_device_usbh(struct
- /* Enable VBus control for UHP ports */
- for (i = 0; i < data->ports; i++) {
- if (data->vbus_pin[i])
-- at91_set_gpio_output(data->vbus_pin[i], 0);
-+ at91_set_gpio_output(data->vbus_pin[i], data->vbus_active_high);
- }
-
- usbh_data = *data;
---- a/arch/arm/mach-at91/at91sam9g45_devices.c
-+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
-@@ -121,7 +121,7 @@ void __init at91_add_device_usbh_ohci(st
- /* Enable VBus control for UHP ports */
- for (i = 0; i < data->ports; i++) {
- if (data->vbus_pin[i])
-- at91_set_gpio_output(data->vbus_pin[i], 0);
-+ at91_set_gpio_output(data->vbus_pin[i], data->vbus_active_high);
- }
-
- usbh_ohci_data = *data;
-@@ -176,7 +176,7 @@ void __init at91_add_device_usbh_ehci(st
- /* Enable VBus control for UHP ports */
- for (i = 0; i < data->ports; i++) {
- if (data->vbus_pin[i])
-- at91_set_gpio_output(data->vbus_pin[i], 0);
-+ at91_set_gpio_output(data->vbus_pin[i], data->vbus_active_high);
- }
-
- usbh_ehci_data = *data;
---- a/arch/arm/mach-at91/include/mach/board.h
-+++ b/arch/arm/mach-at91/include/mach/board.h
-@@ -96,8 +96,9 @@ extern void __init at91_add_device_eth(s
-
- /* USB Host */
- struct at91_usbh_data {
-- u8 ports; /* number of ports on root hub */
-- u8 vbus_pin[2]; /* port power-control pin */
-+ u8 ports; /* number of ports on root hub */
-+ u8 vbus_pin[2]; /* port power-control pin */
-+ u8 vbus_active_high; /* true == vbus_pins are active high */
- };
- extern void __init at91_add_device_usbh(struct at91_usbh_data *data);
- extern void __init at91_add_device_usbh_ohci(struct at91_usbh_data *data);
---- a/drivers/usb/host/ohci-at91.c
-+++ b/drivers/usb/host/ohci-at91.c
-@@ -277,14 +277,13 @@ static int ohci_hcd_at91_drv_probe(struc
- if (pdata) {
- /* REVISIT make the driver support per-port power switching,
- * and also overcurrent detection. Here we assume the ports
-- * are always powered while this driver is active, and use
-- * active-low power switches.
-+ * are always powered while this driver is active.
- */
- for (i = 0; i < ARRAY_SIZE(pdata->vbus_pin); i++) {
- if (pdata->vbus_pin[i] <= 0)
- continue;
- gpio_request(pdata->vbus_pin[i], "ohci_vbus");
-- gpio_direction_output(pdata->vbus_pin[i], 0);
-+ gpio_direction_output(pdata->vbus_pin[i], pdata->vbus_active_high);
- }
- }
-
-@@ -301,7 +300,7 @@ static int ohci_hcd_at91_drv_remove(stru
- for (i = 0; i < ARRAY_SIZE(pdata->vbus_pin); i++) {
- if (pdata->vbus_pin[i] <= 0)
- continue;
-- gpio_direction_output(pdata->vbus_pin[i], 1);
-+ gpio_direction_output(pdata->vbus_pin[i], !pdata->vbus_active_high);
- gpio_free(pdata->vbus_pin[i]);
- }
- }