[OpenWrt-Devel] [PATCH] ralink: MT7621 add i2c controller driver

2015-03-25 Thread wengbj
ralink i2c driver is not working on MT7621 platform. Porting a new drivers from 
MTK's source code.

Signed-off-by: Jay Weng fl.serv...@t-firefly.com
---
 package/kernel/linux/modules/fs.mk |4 +-
 package/kernel/linux/modules/usb.mk|   13 +-
 target/linux/ramips/dts/FIREWRT.dts|2 +-
 target/linux/ramips/image/Makefile |2 +-
 target/linux/ramips/mt7621/config-3.18 |   16 +-
 .../0111-i2c-MIPS-add-mt7621-I2C-driver.patch  |  335 
 6 files changed, 359 insertions(+), 13 deletions(-)
 create mode 100755 
target/linux/ramips/patches-3.18/0111-i2c-MIPS-add-mt7621-I2C-driver.patch

diff --git a/package/kernel/linux/modules/fs.mk 
b/package/kernel/linux/modules/fs.mk
index 64182e6..e3e8c57 100644
--- a/package/kernel/linux/modules/fs.mk
+++ b/package/kernel/linux/modules/fs.mk
@@ -156,8 +156,8 @@ define KernelPackage/fs-ext4
   SUBMENU:=$(FS_MENU)
   TITLE:=EXT4 filesystem support
   KCONFIG:= \
-   CONFIG_EXT4_FS \
-   CONFIG_JBD2
+   CONFIG_EXT4_FS=y \
+   CONFIG_JBD2=y
   FILES:= \
$(LINUX_DIR)/fs/ext4/ext4.ko \
$(LINUX_DIR)/fs/jbd2/jbd2.ko \
diff --git a/package/kernel/linux/modules/usb.mk 
b/package/kernel/linux/modules/usb.mk
index be1553a..fa01a65 100644
--- a/package/kernel/linux/modules/usb.mk
+++ b/package/kernel/linux/modules/usb.mk
@@ -15,7 +15,7 @@ define KernelPackage/usb-core
   SUBMENU:=$(USB_MENU)
   TITLE:=Support for USB
   DEPENDS:=@USB_SUPPORT
-  KCONFIG:=CONFIG_USB CONFIG_XPS_USB_HCD_XILINX=n CONFIG_USB_FHCI_HCD=n
+  KCONFIG:=CONFIG_USB=y CONFIG_XPS_USB_HCD_XILINX=n CONFIG_USB_FHCI_HCD=n
   FILES:= \
$(LINUX_DIR)/drivers/usb/core/usbcore.ko \
$(LINUX_DIR)/drivers/usb/usb-common.ko@lt3.16 \
@@ -168,7 +168,7 @@ $(eval $(call KernelPackage,usb-phy-omap-usb2))
 
 define KernelPackage/usb-phy-omap-usb3
   TITLE:=Support for OMAP USB3 PHY
-  KCONFIG:=CONFIG_OMAP_USB3
+  KCONFIG:=CONFIG_OMAP_USB3=y
   DEPENDS:=@TARGET_omap +kmod-usb-phy-omap-usb2
   FILES:=$(LINUX_DIR)/drivers/usb/phy/phy-omap-usb3.ko
   AUTOLOAD:=$(call AutoLoad,45,phy-omap-usb3)
@@ -873,8 +873,7 @@ $(eval $(call KernelPackage,usb-serial-qualcomm))
 define KernelPackage/usb-storage
   TITLE:=USB Storage support
   DEPENDS:= +kmod-scsi-core
-  KCONFIG:=CONFIG_USB_STORAGE
-  FILES:=$(LINUX_DIR)/drivers/usb/storage/usb-storage.ko
+  KCONFIG:= CONFIG_USB_STORAGE=y
   AUTOLOAD:=$(call AutoProbe,usb-storage,1)
   $(call AddDepends/usb)
 endef
@@ -1477,9 +1476,9 @@ define KernelPackage/usb3
   TITLE:=Support for USB3 controllers
   DEPENDS:=+TARGET_omap:kmod-usb-phy-omap-usb3
   KCONFIG:= \
-   CONFIG_USB_XHCI_HCD \
-   CONFIG_USB_XHCI_PCI \
-   CONFIG_USB_XHCI_PLATFORM \
+   CONFIG_USB_XHCI_HCD=y \
+   CONFIG_USB_XHCI_PCI=y \
+   CONFIG_USB_XHCI_PLATFORM=y \
CONFIG_USB_XHCI_HCD_DEBUGGING=n
   FILES:= \
$(XHCI_FILES)
diff --git a/target/linux/ramips/dts/FIREWRT.dts 
b/target/linux/ramips/dts/FIREWRT.dts
index 54f0e55..e25a035 100644
--- a/target/linux/ramips/dts/FIREWRT.dts
+++ b/target/linux/ramips/dts/FIREWRT.dts
@@ -12,7 +12,7 @@
};
 
chosen {
-   bootargs = console=ttyS0,57600;
+   bootargs = console=ttyS0,57600 root=/dev/sda1 rw rootwait 
init=/bin/bash;
};
 
sdhci@1013 {
diff --git a/target/linux/ramips/image/Makefile 
b/target/linux/ramips/image/Makefile
index 45ae3a5..13fac3b 100644
--- a/target/linux/ramips/image/Makefile
+++ b/target/linux/ramips/image/Makefile
@@ -901,7 +901,7 @@ endif
 #
 
 ifeq ($(SUBTARGET),mt7621)
-  TARGET_DEVICES += mt7621 wsr-600 wsr-1166 dir-860l-b1 firewrt
+  TARGET_DEVICES += firewrt
 endif
 
 define Device/mt7621
diff --git a/target/linux/ramips/mt7621/config-3.18 
b/target/linux/ramips/mt7621/config-3.18
index 11d372b..2b7bea1 100644
--- a/target/linux/ramips/mt7621/config-3.18
+++ b/target/linux/ramips/mt7621/config-3.18
@@ -34,6 +34,10 @@ CONFIG_CPU_RMAP=y
 CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
 CONFIG_CPU_SUPPORTS_HIGHMEM=y
 CONFIG_CPU_SUPPORTS_MSA=y
+CONFIG_CRC16=y
+CONFIG_CRYPTO_CRC32C=y
+CONFIG_CRYPTO_HASH=y
+CONFIG_CRYPTO_HASH2=y
 CONFIG_CSRC_R4K=y
 CONFIG_DEBUG_PINCTRL=y
 CONFIG_DMA_NONCOHERENT=y
@@ -41,6 +45,8 @@ CONFIG_DMA_NONCOHERENT=y
 CONFIG_DTB_RT_NONE=y
 CONFIG_DTC=y
 CONFIG_EARLY_PRINTK=y
+CONFIG_EXT4_FS=y
+CONFIG_FS_MBCACHE=y
 CONFIG_GENERIC_ATOMIC64=y
 CONFIG_GENERIC_CLOCKEVENTS=y
 CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
@@ -99,6 +105,7 @@ CONFIG_IRQ_DOMAIN=y
 CONFIG_IRQ_FORCED_THREADING=y
 CONFIG_IRQ_GIC=y
 CONFIG_IRQ_WORK=y
+CONFIG_JBD2=y
 CONFIG_LIBFDT=y
 CONFIG_MDIO_BOARDINFO=y
 CONFIG_MIPS=y
@@ -126,13 +133,13 @@ CONFIG_MTD_SPLIT_FIRMWARE=y
 CONFIG_MTD_SPLIT_SEAMA_FW=y
 CONFIG_MTD_SPLIT_TRX_FW=y
 CONFIG_MTD_SPLIT_UIMAGE_FW=y
-# CONFIG_MTK_MTD_NAND is not set
 CONFIG_NEED_DMA_MAP_STATE=y
 CONFIG_NET_FLOW_LIMIT=y
 CONFIG_NET_RALINK=y
 CONFIG_NET_RALINK_GSW_MT7620=y
 CONFIG_NET_RALINK_MDIO=y
 CONFIG_NET_RALINK_MT7620=y

Re: [OpenWrt-Devel] [PATCH] ralink: MT7621 add i2c controller driver

2015-03-25 Thread fl.serv...@t-firefly.com
Dear All:
Oh , i am sorry . Please ignore this patch .
i will send a new version .



Best Regards.
Jay Weng

Website:  www.t-firefly.com
E-mail:  fl.serv...@t-firefly.com
 
From: wengbj
Date: 2015-03-25 18:07
To: blogic
CC: openwrt-devel; linux.c; fl.service; wbj; zxf; dxj
Subject: [PATCH] ralink: MT7621 add i2c controller driver
ralink i2c driver is not working on MT7621 platform. Porting a new drivers from 
MTK's source code.
 
Signed-off-by: Jay Weng fl.serv...@t-firefly.com
---
package/kernel/linux/modules/fs.mk |4 +-
package/kernel/linux/modules/usb.mk|   13 +-
target/linux/ramips/dts/FIREWRT.dts|2 +-
target/linux/ramips/image/Makefile |2 +-
target/linux/ramips/mt7621/config-3.18 |   16 +-
.../0111-i2c-MIPS-add-mt7621-I2C-driver.patch  |  335 
6 files changed, 359 insertions(+), 13 deletions(-)
create mode 100755 
target/linux/ramips/patches-3.18/0111-i2c-MIPS-add-mt7621-I2C-driver.patch
 
diff --git a/package/kernel/linux/modules/fs.mk 
b/package/kernel/linux/modules/fs.mk
index 64182e6..e3e8c57 100644
--- a/package/kernel/linux/modules/fs.mk
+++ b/package/kernel/linux/modules/fs.mk
@@ -156,8 +156,8 @@ define KernelPackage/fs-ext4
   SUBMENU:=$(FS_MENU)
   TITLE:=EXT4 filesystem support
   KCONFIG:= \
- CONFIG_EXT4_FS \
- CONFIG_JBD2
+ CONFIG_EXT4_FS=y \
+ CONFIG_JBD2=y
   FILES:= \
$(LINUX_DIR)/fs/ext4/ext4.ko \
$(LINUX_DIR)/fs/jbd2/jbd2.ko \
diff --git a/package/kernel/linux/modules/usb.mk 
b/package/kernel/linux/modules/usb.mk
index be1553a..fa01a65 100644
--- a/package/kernel/linux/modules/usb.mk
+++ b/package/kernel/linux/modules/usb.mk
@@ -15,7 +15,7 @@ define KernelPackage/usb-core
   SUBMENU:=$(USB_MENU)
   TITLE:=Support for USB
   DEPENDS:=@USB_SUPPORT
-  KCONFIG:=CONFIG_USB CONFIG_XPS_USB_HCD_XILINX=n CONFIG_USB_FHCI_HCD=n
+  KCONFIG:=CONFIG_USB=y CONFIG_XPS_USB_HCD_XILINX=n CONFIG_USB_FHCI_HCD=n
   FILES:= \
$(LINUX_DIR)/drivers/usb/core/usbcore.ko \
$(LINUX_DIR)/drivers/usb/usb-common.ko@lt3.16 \
@@ -168,7 +168,7 @@ $(eval $(call KernelPackage,usb-phy-omap-usb2))
define KernelPackage/usb-phy-omap-usb3
   TITLE:=Support for OMAP USB3 PHY
-  KCONFIG:=CONFIG_OMAP_USB3
+  KCONFIG:=CONFIG_OMAP_USB3=y
   DEPENDS:=@TARGET_omap +kmod-usb-phy-omap-usb2
   FILES:=$(LINUX_DIR)/drivers/usb/phy/phy-omap-usb3.ko
   AUTOLOAD:=$(call AutoLoad,45,phy-omap-usb3)
@@ -873,8 +873,7 @@ $(eval $(call KernelPackage,usb-serial-qualcomm))
define KernelPackage/usb-storage
   TITLE:=USB Storage support
   DEPENDS:= +kmod-scsi-core
-  KCONFIG:=CONFIG_USB_STORAGE
-  FILES:=$(LINUX_DIR)/drivers/usb/storage/usb-storage.ko
+  KCONFIG:= CONFIG_USB_STORAGE=y
   AUTOLOAD:=$(call AutoProbe,usb-storage,1)
   $(call AddDepends/usb)
endef
@@ -1477,9 +1476,9 @@ define KernelPackage/usb3
   TITLE:=Support for USB3 controllers
   DEPENDS:=+TARGET_omap:kmod-usb-phy-omap-usb3
   KCONFIG:= \
- CONFIG_USB_XHCI_HCD \
- CONFIG_USB_XHCI_PCI \
- CONFIG_USB_XHCI_PLATFORM \
+ CONFIG_USB_XHCI_HCD=y \
+ CONFIG_USB_XHCI_PCI=y \
+ CONFIG_USB_XHCI_PLATFORM=y \
CONFIG_USB_XHCI_HCD_DEBUGGING=n
   FILES:= \
$(XHCI_FILES)
diff --git a/target/linux/ramips/dts/FIREWRT.dts 
b/target/linux/ramips/dts/FIREWRT.dts
index 54f0e55..e25a035 100644
--- a/target/linux/ramips/dts/FIREWRT.dts
+++ b/target/linux/ramips/dts/FIREWRT.dts
@@ -12,7 +12,7 @@
};
chosen {
- bootargs = console=ttyS0,57600;
+ bootargs = console=ttyS0,57600 root=/dev/sda1 rw rootwait init=/bin/bash;
};
sdhci@1013 {
diff --git a/target/linux/ramips/image/Makefile 
b/target/linux/ramips/image/Makefile
index 45ae3a5..13fac3b 100644
--- a/target/linux/ramips/image/Makefile
+++ b/target/linux/ramips/image/Makefile
@@ -901,7 +901,7 @@ endif
#
ifeq ($(SUBTARGET),mt7621)
-  TARGET_DEVICES += mt7621 wsr-600 wsr-1166 dir-860l-b1 firewrt
+  TARGET_DEVICES += firewrt
endif
define Device/mt7621
diff --git a/target/linux/ramips/mt7621/config-3.18 
b/target/linux/ramips/mt7621/config-3.18
index 11d372b..2b7bea1 100644
--- a/target/linux/ramips/mt7621/config-3.18
+++ b/target/linux/ramips/mt7621/config-3.18
@@ -34,6 +34,10 @@ CONFIG_CPU_RMAP=y
CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
CONFIG_CPU_SUPPORTS_HIGHMEM=y
CONFIG_CPU_SUPPORTS_MSA=y
+CONFIG_CRC16=y
+CONFIG_CRYPTO_CRC32C=y
+CONFIG_CRYPTO_HASH=y
+CONFIG_CRYPTO_HASH2=y
CONFIG_CSRC_R4K=y
CONFIG_DEBUG_PINCTRL=y
CONFIG_DMA_NONCOHERENT=y
@@ -41,6 +45,8 @@ CONFIG_DMA_NONCOHERENT=y
CONFIG_DTB_RT_NONE=y
CONFIG_DTC=y
CONFIG_EARLY_PRINTK=y
+CONFIG_EXT4_FS=y
+CONFIG_FS_MBCACHE=y
CONFIG_GENERIC_ATOMIC64=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
@@ -99,6 +105,7 @@ CONFIG_IRQ_DOMAIN=y
CONFIG_IRQ_FORCED_THREADING=y
CONFIG_IRQ_GIC=y
CONFIG_IRQ_WORK=y
+CONFIG_JBD2=y
CONFIG_LIBFDT=y
CONFIG_MDIO_BOARDINFO=y
CONFIG_MIPS=y
@@ -126,13 +133,13 @@ CONFIG_MTD_SPLIT_FIRMWARE=y
CONFIG_MTD_SPLIT_SEAMA_FW=y
CONFIG_MTD_SPLIT_TRX_FW=y
CONFIG_MTD_SPLIT_UIMAGE_FW=y
-# CONFIG_MTK_MTD_NAND is not set
CONFIG_NEED_DMA_MAP_STATE=y

[OpenWrt-Devel] [PATCH] ralink: MT7621 add i2c controller driver

2015-03-25 Thread wengbj
ralink i2c driver is not working on MT7621 platform. Porting a new drivers from 
MTK's source code.
Last time i got some mess . This is new version.

Signed-off-by: wengbj fl.serv...@t-firefly.com
---
 .../0111-i2c-MIPS-add-mt7621-I2C-driver.patch  |  335 
 1 file changed, 335 insertions(+)
 create mode 100755 
target/linux/ramips/patches-3.18/0111-i2c-MIPS-add-mt7621-I2C-driver.patch

diff --git 
a/target/linux/ramips/patches-3.18/0111-i2c-MIPS-add-mt7621-I2C-driver.patch 
b/target/linux/ramips/patches-3.18/0111-i2c-MIPS-add-mt7621-I2C-driver.patch
new file mode 100755
index 000..5df95f4
--- /dev/null
+++ b/target/linux/ramips/patches-3.18/0111-i2c-MIPS-add-mt7621-I2C-driver.patch
@@ -0,0 +1,335 @@
+Index: linux-3.18.9/drivers/i2c/busses/Kconfig
+===
+--- linux-3.18.9.orig/drivers/i2c/busses/Kconfig   2015-03-23 
15:00:11.730403938 +0800
 linux-3.18.9/drivers/i2c/busses/Kconfig2015-03-23 15:00:11.982403926 
+0800
+@@ -714,6 +714,10 @@
+   tristate Ralink I2C Controller
+   select OF_I2C
+ 
++config I2C_MT7621
++  tristate MT7621 I2C Controller
++  select OF_I2C
++
+ config HAVE_S3C2410_I2C
+   bool
+   help
+Index: linux-3.18.9/drivers/i2c/busses/Makefile
+===
+--- linux-3.18.9.orig/drivers/i2c/busses/Makefile  2015-03-23 
15:00:11.730403938 +0800
 linux-3.18.9/drivers/i2c/busses/Makefile   2015-03-23 15:00:11.982403926 
+0800
+@@ -67,6 +67,7 @@
+ obj-$(CONFIG_I2C_PXA) += i2c-pxa.o
+ obj-$(CONFIG_I2C_PXA_PCI) += i2c-pxa-pci.o
+ obj-$(CONFIG_I2C_RALINK)  += i2c-ralink.o
++obj-$(CONFIG_I2C_MT7621)  += i2c-mt7621.o
+ obj-$(CONFIG_I2C_QUP) += i2c-qup.o
+ obj-$(CONFIG_I2C_RIIC)+= i2c-riic.o
+ obj-$(CONFIG_I2C_RK3X)+= i2c-rk3x.o
+Index: linux-3.18.9/drivers/i2c/busses/i2c-mt7621.c
+===
+--- /dev/null  1970-01-01 00:00:00.0 +
 linux-3.18.9/drivers/i2c/busses/i2c-mt7621.c   2015-03-23 
16:31:42.684747034 +0800
+@@ -0,0 +1,303 @@
++/*
++ * drivers/i2c/busses/i2c-mt7621.c
++ *
++ * Copyright (C) 2013 Steven Liu steven_...@mediatek.com
++ *
++ * Improve driver for i2cdetect from i2c-tools to detect i2c devices on the 
bus.
++ * (C) 2014 Sittisak sittis...@hotmail.com
++ *
++ * This software is licensed under the terms of the GNU General Public
++ * License version 2, as published by the Free Software Foundation, and
++ * may be copied, distributed, and modified under those terms.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ */
++
++#include linux/interrupt.h
++#include linux/kernel.h
++#include linux/module.h
++#include linux/reset.h
++#include linux/delay.h
++#include linux/slab.h
++#include linux/init.h
++#include linux/errno.h
++#include linux/platform_device.h
++#include linux/i2c.h
++#include linux/io.h
++#include linux/err.h
++
++#include asm/mach-ralink/ralink_regs.h
++
++#define REG_CONFIG_REG   0x00
++#define REG_CLKDIV_REG   0x04
++#define REG_DEVADDR_REG  0x08
++#define REG_ADDR_REG 0x0C
++#define REG_DATAOUT_REG  0x10
++#define REG_DATAIN_REG   0x14
++#define REG_STATUS_REG   0x18
++#define REG_STARTXFR_REG 0x1C
++#define REG_BYTECNT_REG  0x20
++#define REG_SM0_IS_AUTOMODE  0x28
++#define REG_SM0CTL0  0x40
++
++
++#define I2C_STARTERR 0x10
++#define I2C_ACKERR   0x08
++#define I2C_DATARDY  0x04
++#define I2C_SDOEMPTY 0x02
++#define I2C_BUSY 0x01
++
++/* I2C_CFG register bit field */
++#define I2C_CFG_ADDRLEN_8(75)   /* 8 bits */
++#define I2C_CFG_DEVADLEN_7   (62)
++#define I2C_CFG_ADDRDIS  BIT(1)
++#define I2C_CFG_DEVADDIS BIT(0)
++
++#define I2C_CFG_DEFAULT   (I2C_CFG_ADDRLEN_8 | \
++  I2C_CFG_DEVADLEN_7 | \
++  I2C_CFG_ADDRDIS)
++
++#define I2C_RETRY0x1000
++
++#define CLKDIV_VALUE 333
++#define i2c_busy_loop(CLKDIV_VALUE*30)
++
++#define READ_CMD 0x01
++#define WRITE_CMD0x00
++#define READ_BLOCK   16
++
++#define SM0_ODRAIN   BIT(31)
++#define SM0_VSYNC_MODE   BIT(28)
++#define SM0_CLK_DIV 

[OpenWrt-Devel] [PATCH] ralink: MT7621 add i2c controller driver

2015-03-12 Thread wengbj
ralink i2c driver is not working on MT7621 platform. Porting a new drivers from 
MTK's source code.

Signed-off-by: daixj fl.serv...@t-firefly.com
---
 target/linux/ramips/modules.mk |   20 +-
 .../0111-i2c-MIPS-add-mt7621-I2C-driver.patch  |  390 
 2 files changed, 409 insertions(+), 1 deletion(-)
 create mode 100644 
target/linux/ramips/patches-3.14/0111-i2c-MIPS-add-mt7621-I2C-driver.patch

diff --git a/target/linux/ramips/modules.mk b/target/linux/ramips/modules.mk
index 550a8c2..d72e0aa 100644
--- a/target/linux/ramips/modules.mk
+++ b/target/linux/ramips/modules.mk
@@ -27,7 +27,7 @@ I2C_RALINK_MODULES:= \
 define KernelPackage/i2c-ralink
   $(call i2c_defaults,$(I2C_RALINK_MODULES),59)
   TITLE:=Ralink I2C Controller
-  DEPENDS:=@TARGET_ramips kmod-i2c-core
+  DEPENDS:=@TARGET_ramips @(!TARGET_ramips_mt7621) kmod-i2c-core
 endef
 
 define KernelPackage/i2c-ralink/description
@@ -36,6 +36,24 @@ endef
 
 $(eval $(call KernelPackage,i2c-ralink))
 
+
+I2C_MT7621_MODULES:= \
+  CONFIG_I2C_MT7621:drivers/i2c/busses/i2c-mt7621
+
+define KernelPackage/i2c-mt7621
+  $(call i2c_defaults,$(I2C_MT7621_MODULES),59)
+  TITLE:=MT7621 I2C Controller
+  DEPENDS:=@TARGET_ramips @TARGET_ramips_mt7621 kmod-i2c-core
+endef
+
+define KernelPackage/i2c-mt7621/description
+ Kernel modules for enable mt7621 i2c controller.
+endef
+
+$(eval $(call KernelPackage,i2c-mt7621))
+
+
+
 define KernelPackage/sound-mt7620
   TITLE:=MT7620 PCM/I2S Alsa Driver
   DEPENDS:=@TARGET_ramips_mt7620 +kmod-sound-soc-core +kmod-regmap
diff --git 
a/target/linux/ramips/patches-3.14/0111-i2c-MIPS-add-mt7621-I2C-driver.patch 
b/target/linux/ramips/patches-3.14/0111-i2c-MIPS-add-mt7621-I2C-driver.patch
new file mode 100644
index 000..5f10a80
--- /dev/null
+++ b/target/linux/ramips/patches-3.14/0111-i2c-MIPS-add-mt7621-I2C-driver.patch
@@ -0,0 +1,390 @@
+Index: linux-3.14.30/drivers/i2c/busses/Kconfig
+===
+--- linux-3.14.30.orig/drivers/i2c/busses/Kconfig  2015-03-11 
16:46:46.963996212 +0800
 linux-3.14.30/drivers/i2c/busses/Kconfig   2015-03-12 10:40:34.849574512 
+0800
+@@ -663,6 +663,10 @@
+   tristate Ralink I2C Controller
+   select OF_I2C
+ 
++config I2C_MT7621
++  tristate Mt7621 I2C Controller
++  select OF_I2C
++
+ config HAVE_S3C2410_I2C
+   bool
+   help
+Index: linux-3.14.30/drivers/i2c/busses/Makefile
+===
+--- linux-3.14.30.orig/drivers/i2c/busses/Makefile 2015-03-11 
16:46:46.967996212 +0800
 linux-3.14.30/drivers/i2c/busses/Makefile  2015-03-11 17:52:43.008121712 
+0800
+@@ -64,6 +64,7 @@
+ obj-$(CONFIG_I2C_PXA) += i2c-pxa.o
+ obj-$(CONFIG_I2C_PXA_PCI) += i2c-pxa-pci.o
+ obj-$(CONFIG_I2C_RALINK)  += i2c-ralink.o
++obj-$(CONFIG_I2C_MT7621)  += i2c-mt7621.o
+ obj-$(CONFIG_I2C_RIIC)+= i2c-riic.o
+ obj-$(CONFIG_I2C_S3C2410) += i2c-s3c2410.o
+ obj-$(CONFIG_I2C_S6000)   += i2c-s6000.o
+Index: linux-3.14.30/drivers/i2c/busses/i2c-mt7621.c
+===
+--- /dev/null  1970-01-01 00:00:00.0 +
 linux-3.14.30/drivers/i2c/busses/i2c-mt7621.c  2015-03-12 
11:45:00.449759139 +0800
+@@ -0,0 +1,358 @@
++/*
++ * drivers/i2c/busses/i2c-mt7621.c
++ *
++ * Copyright (C) 2013 Steven Liu steven_...@mediatek.com
++ *
++ * Improve driver for i2cdetect from i2c-tools to detect i2c devices on the 
bus.
++ * (C) 2014 Sittisak sittis...@hotmail.com
++ *
++ * This software is licensed under the terms of the GNU General Public
++ * License version 2, as published by the Free Software Foundation, and
++ * may be copied, distributed, and modified under those terms.
++ *
++ * This program is distributed in the hope that it will be useful,
++ * but WITHOUT ANY WARRANTY; without even the implied warranty of
++ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
++ * GNU General Public License for more details.
++ *
++ */
++
++#include linux/interrupt.h
++#include linux/kernel.h
++#include linux/module.h
++#include linux/reset.h
++#include linux/delay.h
++#include linux/slab.h
++#include linux/init.h
++#include linux/errno.h
++#include linux/platform_device.h
++#include linux/i2c.h
++#include linux/io.h
++#include linux/err.h
++
++#include asm/mach-ralink/ralink_regs.h
++
++#define REG_CONFIG_REG   0x00
++#define REG_CLKDIV_REG   0x04
++#define REG_DEVADDR_REG  0x08
++#define REG_ADDR_REG 0x0C
++#define REG_DATAOUT_REG  0x10
++#define REG_DATAIN_REG   0x14
++#define REG_STATUS_REG   0x18
++#define REG_STARTXFR_REG 0x1C
++#define REG_BYTECNT_REG  0x20
++#define REG_SM0_IS_AUTOMODE  0x28
++#define REG_SM0CTL0