summaryrefslogtreecommitdiff
path: root/target/linux
diff options
context:
space:
mode:
authorLudovic Pouzenc <ludovic@pouzenc.fr>2018-09-14 23:38:12 +0200
committerLudovic Pouzenc <ludovic@pouzenc.fr>2018-09-14 23:38:12 +0200
commite266de11dcd0b2d71c445b943bef2f50258fa314 (patch)
treefd53612a762e46dbda5727f521c60b9d20b36e80 /target/linux
parentca2d447b348acc07b74c8e624771ae7f9bb1fc9e (diff)
downloadmtk-20170518-e266de11dcd0b2d71c445b943bef2f50258fa314.zip
mtk-20170518-e266de11dcd0b2d71c445b943bef2f50258fa314.tar.gz
mtk-20170518-e266de11dcd0b2d71c445b943bef2f50258fa314.tar.bz2
target/linux/ramips: profile mt7621, cpu 24kec to 1004kc, custom modules
hw_nat MTK Hardware NAT nf-sc Netfilter shortcut mtk-i2c APSoC/MTK I2C Driver mtk-i2s I2S Driver mtk-mmc MMC/SD card support hw_wdg Kernel Mode Watchdog rdm Register Debug Module cfg80211-normal CFG80211 kernel support
Diffstat (limited to 'target/linux')
-rw-r--r--target/linux/ramips/Makefile14
-rw-r--r--target/linux/ramips/image/Makefile101
-rw-r--r--target/linux/ramips/modules.mk179
-rw-r--r--target/linux/ramips/mt7621/profiles/00-default.mk15
-rw-r--r--target/linux/ramips/mt7621/target.mk6
5 files changed, 238 insertions, 77 deletions
diff --git a/target/linux/ramips/Makefile b/target/linux/ramips/Makefile
index d363743..ed2999a 100644
--- a/target/linux/ramips/Makefile
+++ b/target/linux/ramips/Makefile
@@ -8,18 +8,18 @@ include $(TOPDIR)/rules.mk
ARCH:=mipsel
BOARD:=ramips
-BOARDNAME:=Ralink RT288x/RT3xxx
-SUBTARGETS:=rt305x mt7620a mt7620n mt7621 rt3883 rt288x
+BOARDNAME:=MTK/Ralink APSoC (MIPS)
+SUBTARGETS:=mt7620 mt7621 mt7628
FEATURES:=squashfs gpio
-
-LINUX_VERSION:=3.10.49
+LINUX_VERSION:=3.10.14
+LINUX_P4REV:=169495
+LINUX_EXT_VERSION:=$(LINUX_VERSION)-$(LINUX_P4REV)
include $(INCLUDE_DIR)/target.mk
-DEFAULT_PACKAGES += \
- kmod-leds-gpio kmod-gpio-button-hotplug wpad-mini swconfig
+DEFAULT_PACKAGES +=
define Target/Description
- Build firmware images for Ralink RT288x/RT3xxx based boards.
+ Build firmware images for MTK/Ralink APSoC based boards.
endef
$(eval $(call BuildTarget))
diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile
index 35057e4..5ce8215 100644
--- a/target/linux/ramips/image/Makefile
+++ b/target/linux/ramips/image/Makefile
@@ -24,21 +24,21 @@ define Image/Build/Initramfs
endef
endif
-ifeq ($(CONFIG_SOC_RT288X),y)
+ifeq ($(CONFIG_RALINK_MT7621),y)
+ifeq ($(CONFIG_RT2880_DRAM_512M),y)
define kernel_entry
--a 0x88000000 -e 0x88000000
+-a 0x82001000 -e 0x82001000
endef
else
-ifeq ($(CONFIG_SOC_MT7621),y)
define kernel_entry
--a 0x80001000 -e 0x80001000
+-a 0x81001000 -e 0x81001000
endef
+endif
else
define kernel_entry
-a 0x80000000 -e 0x80000000
endef
endif
-endif
define MkCombineduImage
$(call PatchKernelLzma,$(2),$(3))
@@ -58,7 +58,7 @@ endef
#
define MkImage
- $(eval imagename=$(if $(4),$(4),MIPS OpenWrt Linux-$(LINUX_VERSION)))
+ $(eval imagename=$(if $(4),$(4),OpenWrt Linux-$(LINUX_EXT_VERSION)))
-mkimage -A mips -O linux -T kernel -C $(1) $(call kernel_entry)\
-n "$(imagename)" \
-d $(2) $(3)
@@ -81,8 +81,8 @@ endef
define PatchKernelLzmaDtb
cp $(KDIR)/vmlinux$(3) $(KDIR)/vmlinux-$(1)$(3)
- $(LINUX_DIR)/scripts/dtc/dtc -O dtb -o $(KDIR)/$(2).dtb ../dts/$(2).dts
- $(STAGING_DIR_HOST)/bin/patch-dtb $(KDIR)/vmlinux-$(1)$(3) $(KDIR)/$(2).dtb
+ #$(LINUX_DIR)/scripts/dtc/dtc -O dtb -o $(KDIR)/$(2).dtb ../dts/$(2).dts
+ #$(STAGING_DIR_HOST)/bin/patch-dtb $(KDIR)/vmlinux-$(1)$(3) $(KDIR)/$(2).dtb
$(call CompressLzma,$(KDIR)/vmlinux-$(1)$(3),$(KDIR)/vmlinux-$(1)$(3).bin.lzma)
endef
@@ -124,6 +124,10 @@ ralink_default_fw_size_16M=16121856
BuildFirmware/Default16M/squashfs=$(call BuildFirmware/OF,$(1),$(2),$(3),$(ralink_default_fw_size_16M),$(4))
BuildFirmware/Default16M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3),$(4))
+ralink_default_fw_size_32M=33554432
+BuildFirmware/Default32M/squashfs=$(call BuildFirmware/OF,$(1),$(2),$(3),$(ralink_default_fw_size_32M),$(4))
+BuildFirmware/Default32M/initramfs=$(call BuildFirmware/OF/initramfs,$(1),$(2),$(3),$(4))
+
# Build images for a custom sized flash layout
# $(1) = squashfs/initramfs
# $(2) = lowercase board name
@@ -504,8 +508,6 @@ endef
BuildFirmware/WHRG300N/initramfs=$(call BuildFirmware/OF/initramfs,$(1),whr-g300n,WHR-G300N)
Image/Build/Profile/WHRG300N=$(call BuildFirmware/WHRG300N/$(1),$(1))
-Image/Build/Profile/WIZARD8800=$(call BuildFirmware/Default8M/$(1),$(1),wizard-8800,WIZARD8800,Linux Kernel Image)
-
Image/Build/Profile/WL_330N=$(call BuildFirmware/Default4M/$(1),$(1),wl-330n,WL_330N)
Image/Build/Profile/WL_330N3G=$(call BuildFirmware/Default4M/$(1),$(1),wl-330n3g,WL_330N3G)
@@ -627,7 +629,6 @@ define Image/Build/Profile/Default
$(call Image/Build/Profile/W502U,$(1))
$(call Image/Build/Profile/WCR150GN,$(1))
$(call Image/Build/Profile/WHRG300N,$(1))
- $(call Image/Build/Profile/WIZARD8800,$(1))
$(call Image/Build/Profile/WL_330N,$(1))
$(call Image/Build/Profile/WL_330N3G,$(1))
$(call Image/Build/Profile/WL341V3,$(1))
@@ -709,78 +710,54 @@ endef
endif
#
-# MT7620A Profiles
+# MT7620 Profiles
#
-Image/Build/Profile/MT7620a=$(call BuildFirmware/Default8M/$(1),$(1),mt7620a,MT7620a)
-Image/Build/Profile/MT7620a_MT7610e=$(call BuildFirmware/Default8M/$(1),$(1),mt7620a_mt7610e,MT7620a_MT7610e)
-Image/Build/Profile/MT7620a_MT7530=$(call BuildFirmware/Default8M/$(1),$(1),mt7620a_mt7530,MT7620a_MT7530)
-Image/Build/Profile/MT7620a_V22SG=$(call BuildFirmware/Default8M/$(1),$(1),mt7620a_v22sg,MT7620a_V22SG)
-Image/Build/Profile/RP-N53=$(call BuildFirmware/Default8M/$(1),$(1),rp_n53,RP-N53)
-whr_300hp2_mtd_size=7012352
-Image/Build/Profile/WHR300HP2=$(call BuildFirmware/CustomFlash/$(1),$(1),whr-300hp2,WHR-300HP2,$(whr_300hp2_mtd_size))
-Image/Build/Profile/WHR600D=$(call BuildFirmware/CustomFlash/$(1),$(1),whr-600d,WHR-600D,$(whr_300hp2_mtd_size))
-whr_1166d_mtd_size=15400960
-Image/Build/Profile/WHR1166D=$(call BuildFirmware/CustomFlash/$(1),$(1),whr-1166d,WHR-1166D,$(whr_1166hd_mtd_size))
-dlink810l_mtd_size=6881280
-Image/Build/Profile/DIR-810L=$(call BuildFirmware/CustomFlash/$(1),$(1),dir-810l,DIR-810L,$(dlink810l_mtd_size))
-na930_mtd_size=20971520
-Image/Build/Profile/NA930=$(call BuildFirmware/CustomFlash/$(1),$(1),na930,NA930,$(na930_mtd_size))
-Image/Build/Profile/MZK-750DHP=$(call BuildFirmware/Default8M/$(1),$(1),mzk-750dhp,MZK-750DHP)
-Image/Build/Profile/Y1=$(call BuildFirmware/Default16M/$(1),$(1),Lenovo-y1,Y1)
-Image/Build/Profile/Y1S=$(call BuildFirmware/Default16M/$(1),$(1),Lenovo-y1s,Y1S)
-
-ifeq ($(SUBTARGET),mt7620a)
+
+Image/Build/Profile/MT7620=$(call BuildFirmware/Default8M/$(1),$(1),mt7620,MT7620)
+
+ifeq ($(SUBTARGET),mt7620)
define Image/Build/Profile/Default
- $(call Image/Build/Profile/MT7620a,$(1))
- $(call Image/Build/Profile/MT7620a_MT7610e,$(1))
- $(call Image/Build/Profile/MT7620a_MT7530,$(1))
- $(call Image/Build/Profile/MT7620a_V22SG,$(1))
- $(call Image/Build/Profile/RP-N53,$(1))
- $(call Image/Build/Profile/DIR-810L,$(1))
- $(call Image/Build/Profile/WHR300HP2,$(1))
- $(call Image/Build/Profile/WHR600D,$(1))
- $(call Image/Build/Profile/WHR1166D,$(1))
- $(call Image/Build/Profile/MZK-750DHP,$(1))
- $(call Image/Build/Profile/NA930,$(1))
- $(call Image/Build/Profile/Y1,$(1))
- $(call Image/Build/Profile/Y1S,$(1))
+ $(call Image/Build/Profile/MT7620,$(1))
endef
endif
#
-# MT7620N Profiles
+# MT7621 Profiles
#
-Image/Build/Profile/MLW221=$(call BuildFirmware/Default16M/$(1),$(1),mlw221,MLW221)
-Image/Build/Profile/WMR300=$(call BuildFirmware/Default8M/$(1),$(1),wmr-300,WMR300)
-Image/Build/Profile/RT-N14U=$(call BuildFirmware/Default8M/$(1),$(1),rt-n14u,RT-N14U)
-Image/Build/Profile/WR8305RT=$(call BuildFirmware/Default8M/$(1),$(1),wr8305rt,WR8305RT)
-Image/Build/Profile/WRTNODE=$(call BuildFirmware/Default16M/$(1),$(1),wrtnode,WRTNODE)
-Image/Build/Profile/ZBT-WA05=$(call BuildFirmware/Default8M/$(1),$(1),zbt-wa05,ZBT-WA05)
+Image/Build/Profile/MT7621=$(call BuildFirmware/Default8M/$(1),$(1),mt7621,MT7621)
-ifeq ($(SUBTARGET),mt7620n)
+ifeq ($(SUBTARGET),mt7621)
define Image/Build/Profile/Default
- $(call Image/Build/Profile/MLW221,$(1))
- $(call Image/Build/Profile/WMR300,$(1))
- $(call Image/Build/Profile/RT-N14U,$(1))
- $(call Image/Build/Profile/WR8305RT,$(1))
- $(call Image/Build/Profile/WRTNODE,$(1))
- $(call Image/Build/Profile/ZBT-WA05,$(1))
+ $(call Image/Build/Profile/MT7621,$(1))
endef
endif
#
-# MT7621 Profiles
+# MT7628 Profiles
#
-Image/Build/Profile/MT7621=$(call BuildFirmware/Default4M/$(1),$(1),mt7621,MT7621)
+Image/Build/Profile/MT7628=$(call BuildFirmware/Default8M/$(1),$(1),mt7628,MT7628)
-ifeq ($(SUBTARGET),mt7621)
+ifeq ($(SUBTARGET),mt7628)
define Image/Build/Profile/Default
- $(call Image/Build/Profile/MT7621,$(1))
+ $(call Image/Build/Profile/MT7628,$(1))
+endef
+endif
+
+
+#
+# MT7688 Profiles
+#
+
+Image/Build/Profile/MT7688=$(call BuildFirmware/Default8M/$(1),$(1),mt7688,MT7688)
+
+ifeq ($(SUBTARGET),mt7688)
+define Image/Build/Profile/Default
+ $(call Image/Build/Profile/MT7688,$(1))
endef
endif
diff --git a/target/linux/ramips/modules.mk b/target/linux/ramips/modules.mk
index cff4d71..72b4d56 100644
--- a/target/linux/ramips/modules.mk
+++ b/target/linux/ramips/modules.mk
@@ -54,6 +54,45 @@ endef
$(eval $(call KernelPackage,i2c-ralink))
+
+define KernelPackage/hw_nat
+ CATEGORY:=MTK Properties
+ SUBMENU:=Drivers
+ TITLE:=MTK Hardware NAT
+ KCONFIG:=CONFIG_RA_HW_NAT
+ DEPENDS:=@TARGET_ramips_mt7620||@TARGET_ramips_mt7621||@TARGET_mediatek_mt7623_emmc||@TARGET_mediatek_mt7623_mtd
+ FILES:=$(LINUX_DIR)/net/nat/hw_nat/hw_nat.ko
+ AUTOLOAD:=$(call AutoProbe,hw_nat)
+endef
+
+define KernelPackage/hw_nat/install
+ $(INSTALL_DIR) $(1)/lib/modules/ralink/
+ mv $(1)/lib/modules/$(if $(findstring y,$(CONFIG_TARGET_mediatek)),3.10.20,3.10.14)/hw_nat.ko $(1)/lib/modules/ralink/
+endef
+
+$(eval $(call KernelPackage,hw_nat))
+
+define KernelPackage/nf-sc
+ CATEGORY:=MTK Properties
+ SUBMENU:=Drivers
+ TITLE:=Netfilter shortcut
+ DEPENDS:=+kmod-ipt-core
+ KCONFIG:=CONFIG_NF_SHORTCUT_HOOK
+ FILES:=$(LINUX_DIR)/net/netfilter/nf_sc.ko
+ AUTOLOAD:=$(call AutoProbe,nf_sc)
+endef
+
+define KernelPackage/nf-sc/install
+ $(INSTALL_DIR) $(1)/lib/modules/ralink/
+ mv $(1)/lib/modules/$(if $(findstring y,$(CONFIG_TARGET_mediatek)),3.10.20,3.10.14)/nf_sc.ko $(1)/lib/modules/ralink/
+endef
+
+define KernelPackage/nf-sc/description
+ Kernel modules support for shortcut
+endef
+
+$(eval $(call KernelPackage,nf-sc))
+
define KernelPackage/sound-mt7620
TITLE:=MT7620 PCM/I2S Alsa Driver
DEPENDS:=@TARGET_ramips_mt7620a +kmod-sound-soc-core +kmod-regmap
@@ -73,3 +112,143 @@ define KernelPackage/sound-mt7620/description
endef
$(eval $(call KernelPackage,sound-mt7620))
+
+
+
+define KernelPackage/mtk-gdma
+ CATEGORY:=MTK Properties
+ SUBMENU:=Drivers
+ TITLE:=GDMA Driver
+ DEPENDS:=@TARGET_ramips_mt7621
+ KCONFIG:=CONFIG_RALINK_GDMA CONFIG_GDMA_EVERYBODY
+ FILES:=$(LINUX_DIR)/drivers/char/ralink_gdma.ko
+ AUTOLOAD:=$(call AutoLoad,90,ralink_gdma)
+endef
+
+define KernelPackage/mtk-gdma/description
+ MediaTek APSoC GDMA driver
+endef
+
+$(eval $(call KernelPackage,mtk-gdma))
+
+
+
+define KernelPackage/mtk-i2c
+ CATEGORY:=MTK Properties
+ SUBMENU:=Drivers
+ TITLE:=MTK I2C Driver
+ DEPENDS:=@TARGET_ramips_mt7621
+ KCONFIG:=CONFIG_RALINK_I2C
+ FILES:=$(LINUX_DIR)/drivers/char/i2c_drv.ko
+ AUTOLOAD:=$(call AutoLoad,90,i2c_drv)
+endef
+
+define KernelPackage/mtk-i2c/description
+ MediaTek APSoC I2C Driver
+endef
+
+$(eval $(call KernelPackage,mtk-i2c))
+
+
+define KernelPackage/mtk-pcm
+ CATEGORY:=MTK Properties
+ SUBMENU:=Drivers
+ TITLE:=MTK PCM Driver
+ DEPENDS:=@TARGET_ramips_mt7621 +kmod-mtk-gdma
+ KCONFIG:=CONFIG_RALINK_PCM
+ FILES:=$(LINUX_DIR)/drivers/char/pcm/ralink_pcm.ko
+ AUTOLOAD:=$(call AutoLoad,90,ralink_pcm)
+endef
+
+define KernelPackage/mtk-pcm/description
+ MediaTek APSoC PCM Driver
+endef
+
+$(eval $(call KernelPackage,mtk-pcm))
+
+
+define KernelPackage/mtk-i2s
+ CATEGORY:=MTK Properties
+ SUBMENU:=Drivers
+ TITLE:=I2S Driver
+ DEPENDS:=@TARGET_ramips_mt7621 +kmod-mtk-gdma +kmod-mtk-i2c
+ KCONFIG:=CONFIG_RALINK_I2S CONFIG_I2S_WM8960
+ FILES:=$(LINUX_DIR)/drivers/char/i2s/core/ralink_i2s.ko
+ AUTOLOAD:=$(call AutoLoad,90,ralink_i2s)
+endef
+
+define KernelPackage/mtk-i2s/description
+ MediaTek APSoC I2S driver, along with a WM8960 driver (You don't
+ have to choose /sound/soc/codecs/wm8960 .
+endef
+
+$(eval $(call KernelPackage,mtk-i2s))
+
+
+
+define KernelPackage/mtk-mmc
+ CATEGORY:=MTK Properties
+ SUBMENU:=Drivers
+ TITLE:=MMC/SD card support
+ DEPENDS:=+kmod-mmc
+ KCONFIG:= \
+ CONFIG_MTK_MMC=m
+ FILES:= \
+ $(LINUX_DIR)/drivers/mmc/host/mtk-mmc/mtk_sd.ko
+ AUTOLOAD:=$(call AutoLoad,90,mtk_sd)
+endef
+
+define KernelPackage/mtk-mmc/description
+ driver for mtk mmc/sd card controller.
+endef
+
+$(eval $(call KernelPackage,mtk-mmc))
+
+
+define KernelPackage/hw_wdg
+ CATEGORY:=MTK Properties
+ SUBMENU:=Drivers
+ TITLE:=MTK APSoC Watchdog Driver
+ KCONFIG:= CONFIG_WATCHDOG=y CONFIG_RALINK_WATCHDOG CONFIG_RALINK_TIMER_WDG_RESET_OUTPUT=y
+ FILES:=$(LINUX_DIR)/drivers/watchdog/ralink_wdt.ko
+ AUTOLOAD:=$(call AutoProbe,ralink_wdt)
+endef
+
+$(eval $(call KernelPackage,hw_wdg))
+
+define KernelPackage/hw_kwdg
+ CATEGORY:=MTK Properties
+ SUBMENU:=Drivers
+ TITLE:=Kernel Mode Watchdog
+ KCONFIG:=CONFIG_RALINK_TIMER CONFIG_RALINK_TIMER_DFS=y CONFIG_RALINK_TIMER_WDG CONFIG_RALINK_WDG_TIMER=10 CONFIG_RALINK_WDG_REFRESH_INTERVAL=4 CONFIG_RALINK_TIMER_WDG_RESET_OUTPUT=y
+ FILES:=$(LINUX_DIR)/arch/mips/ralink/ralink_wdt.ko
+ AUTOLOAD:=$(call AutoProbe,ralink_wdt)
+endef
+
+$(eval $(call KernelPackage,hw_kwdg))
+
+
+define KernelPackage/rdm
+ CATEGORY:=MTK Properties
+ SUBMENU:=Drivers
+ TITLE:=Register Debug Module
+ KCONFIG:=CONFIG_RALINK_RDM=m
+ FILES:=$(LINUX_DIR)/drivers/net/rt_rdm/rt_rdm.ko
+ AUTOLOAD:=$(call AutoProbe,rt_rdm)
+endef
+
+$(eval $(call KernelPackage,rdm))
+
+
+define KernelPackage/cfg80211-normal
+ CATEGORY:=MTK Properties
+ SUBMENU:=Drivers
+ TITLE:=CFG80211 kernel support
+ KCONFIG:=CONFIG_CFG80211=m
+ FILES:=$(LINUX_DIR)/net/wireless/cfg80211.ko
+ AUTOLOAD:=$(call AutoProbe,cfg80211)
+endef
+
+$(eval $(call KernelPackage,cfg80211-normal))
+
+
diff --git a/target/linux/ramips/mt7621/profiles/00-default.mk b/target/linux/ramips/mt7621/profiles/00-default.mk
index fb04ba7..40a5099 100644
--- a/target/linux/ramips/mt7621/profiles/00-default.mk
+++ b/target/linux/ramips/mt7621/profiles/00-default.mk
@@ -5,14 +5,19 @@
# See /LICENSE for more information.
#
-define Profile/Default
+define Profile/MT7621
NAME:=Default Profile
PACKAGES:=\
- kmod-usb-core kmod-usb3 \
- kmod-ledtrig-usbdev
+ -swconfig -rt2x00 \
+ ated hwnat reg gpio btnd switch ethstt uci2dat mii_mgr watchdog 8021xd \
+ wireless-tools block-mount fstools kmod-scsi-generic \
+ kmod-usb-core kmod-usb3 kmod-usb-storage \
+ kmod-fs-vfat kmod-fs-ntfs kmod-nls-base kmod-nls-utf8 kmod-nls-cp936 \
+ kmod-nls-cp437 kmod-nls-cp850 kmod-nls-iso8859-1 kmod-nls-iso8859-15 kmod-nls-cp950
endef
+
define Profile/Default/Description
- Default package set compatible with most boards.
+ Basic MT7621 SoC support
endef
-$(eval $(call Profile,Default))
+$(eval $(call Profile,MT7621))
diff --git a/target/linux/ramips/mt7621/target.mk b/target/linux/ramips/mt7621/target.mk
index 830b5b0..99cd4d1 100644
--- a/target/linux/ramips/mt7621/target.mk
+++ b/target/linux/ramips/mt7621/target.mk
@@ -4,12 +4,12 @@
SUBTARGET:=mt7621
BOARDNAME:=MT7621 based boards
-ARCH_PACKAGES:=ramips_24kec
+ARCH_PACKAGES:=ramips_1004kc
FEATURES+=usb
-CPU_TYPE:=24kec
+CPU_TYPE:=1004kc
CPU_SUBTYPE:=dsp
+CFLAGS:=-Os -pipe -mmt -mips32r2 -mtune=1004kc
-DEFAULT_PACKAGES += kmod-rt2800-pci
define Target/Description
Build firmware images for Ralink MT7621 based boards.