developer | e5e687d | 2023-08-08 16:05:33 +0800 | [diff] [blame] | 1 | # SPDX-License-Identifier: GPL-2.0-or-later |
| 2 | # |
| 3 | # Copyright (C) 2023 Mediatek Inc. All Rights Reserved. |
| 4 | # Author: Ren-Ting Wang <ren-ting.wang@mediatek.com> |
| 5 | # |
| 6 | |
| 7 | include $(TOPDIR)/rules.mk |
| 8 | include $(INCLUDE_DIR)/kernel.mk |
| 9 | |
| 10 | PKG_NAME:=tops |
| 11 | PKG_RELEASE:=1 |
| 12 | |
| 13 | include $(INCLUDE_DIR)/package.mk |
| 14 | include $(INCLUDE_DIR)/package-defaults.mk |
| 15 | |
| 16 | EXTRA_KCONFIG+= \ |
| 17 | CONFIG_MTK_TOPS_SUPPORT=m \ |
| 18 | CONFIG_MTK_TOPS_GRE=$(CONFIG_MTK_TOPS_GRE) \ |
| 19 | CONFIG_MTK_TOPS_GRETAP=$(CONFIG_MTK_TOPS_GRETAP) \ |
| 20 | CONFIG_MTK_TOPS_L2TP=$(CONFIG_MTK_TOPS_L2TP) \ |
| 21 | CONFIG_MTK_TOPS_UDP_L2TP_DATA=$(CONFIG_MTK_TOPS_UDP_L2TP_DATA) \ |
| 22 | CONFIG_MTK_TOPS_SECURE_FW=$(CONFIG_MTK_TOPS_SECURE_FW) |
| 23 | |
| 24 | EXTRA_CFLAGS+= \ |
| 25 | $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=m,%,$(filter %=m,$(EXTRA_KCONFIG)))) \ |
| 26 | $(patsubst CONFIG_%, -DCONFIG_%=1, $(patsubst %=y,%,$(filter %=y,$(EXTRA_KCONFIG)))) |
| 27 | |
| 28 | EXTRA_CFLAGS+= \ |
| 29 | -I$(LINUX_DIR)/drivers/net/ethernet/mediatek/ \ |
| 30 | -I$(LINUX_DIR)/drivers/dma/ \ |
| 31 | -I$(KERNEL_BUILD_DIR)/pce/inc/ \ |
| 32 | -DCONFIG_TOPS_TNL_NUM=$(CONFIG_TOPS_TNL_NUM) \ |
| 33 | -DCONFIG_TOPS_TNL_MAP_BIT=$(CONFIG_TOPS_TNL_MAP_BIT) \ |
| 34 | -Wall -Werror |
| 35 | |
| 36 | define Build/Prepare |
| 37 | mkdir -p $(PKG_BUILD_DIR) |
| 38 | $(CP) ./firmware $(PKG_BUILD_DIR)/firmware |
| 39 | $(CP) ./src/* $(PKG_BUILD_DIR)/ |
| 40 | endef |
| 41 | |
| 42 | define Package/tops-rebb-fw-release |
| 43 | TITLE:=Mediatek Tunnel Offload Processor System ReBB Firmware |
| 44 | SECTION:=firmware |
| 45 | CATEGORY:=Firmware |
| 46 | DEPENDS:=@MTK_TOPS_FIRMWARE_RELEASE |
| 47 | endef |
| 48 | |
| 49 | define Package/tops-rebb-fw-release/description |
| 50 | Support for Mediatek Tunnel Offload Processor System ReBB firmware. The |
| 51 | firmware offload and accerlerate APMCU's tunnel protocols traffic. Available |
| 52 | offload tunnel include L2oGRE, L2TP. |
| 53 | endef |
| 54 | |
| 55 | define Package/tops-rebb-fw-release/install |
| 56 | $(INSTALL_DIR) $(1)/lib/firmware/mediatek |
| 57 | $(CP) \ |
| 58 | $(PKG_BUILD_DIR)/firmware/rebb/mt7988_mgmt/tops-mgmt.img \ |
| 59 | $(PKG_BUILD_DIR)/firmware/rebb/mt7988_offload/tops-offload.img \ |
| 60 | $(1)/lib/firmware/mediatek |
| 61 | endef |
| 62 | |
| 63 | define KernelPackage/tops |
| 64 | CATEGORY:=MTK Properties |
| 65 | SUBMENU:=Drivers |
| 66 | TITLE:= MTK Tunnel Offload Processor System Driver |
| 67 | FILES+=$(PKG_BUILD_DIR)/tops.ko |
| 68 | KCONFIG:= |
| 69 | DEFAULT:=y |
| 70 | DEPENDS:= \ |
| 71 | @TARGET_mediatek_mt7988 \ |
| 72 | kmod-mediatek_hnat \ |
| 73 | +kmod-pce \ |
| 74 | +@KERNEL_RELAY |
| 75 | endef |
| 76 | |
| 77 | define KernelPackage/tops/description |
| 78 | Support for MTK Tunnel Offload Processor System. This system reduces the |
| 79 | loading of APMCU's tunnel protocol overhead and improve tunnel protocol's |
| 80 | throughput. |
| 81 | endef |
| 82 | |
| 83 | define KernelPackage/tops/config |
| 84 | source "$(SOURCE)/Config.in" |
| 85 | endef |
| 86 | |
| 87 | define KernelPackage/tops-autoload |
| 88 | CATEGORY:=MTK Properties |
| 89 | SUBMENU:=Drivers |
| 90 | TITLE:= MTK Tunnel Offload Processor System Auto Load |
| 91 | AUTOLOAD:=$(call AutoLoad,51,tops) |
| 92 | KCONFIG:= |
| 93 | DEPENDS:= \ |
| 94 | kmod-tops \ |
| 95 | +kmod-pce-autoload |
| 96 | endef |
| 97 | |
| 98 | define KernelPackage/tops-autoload/description |
| 99 | Support for MTK Tunnel Offload Processor System auto load on system |
| 100 | boot process. |
| 101 | endef |
| 102 | |
| 103 | define Build/Compile |
| 104 | $(MAKE) -C "$(LINUX_DIR)" \ |
| 105 | $(KERNEL_MAKE_FLAGS) \ |
| 106 | M="$(PKG_BUILD_DIR)" \ |
| 107 | EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \ |
| 108 | $(EXTRA_KCONFIG) \ |
| 109 | modules |
| 110 | endef |
| 111 | |
| 112 | $(eval $(call BuildPackage,tops-rebb-fw-release)) |
| 113 | $(eval $(call KernelPackage,tops)) |
| 114 | $(eval $(call KernelPackage,tops-autoload)) |