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 | |
developer | e5e687d | 2023-08-08 16:05:33 +0800 | [diff] [blame] | 16 | define Build/Prepare |
| 17 | mkdir -p $(PKG_BUILD_DIR) |
| 18 | $(CP) ./firmware $(PKG_BUILD_DIR)/firmware |
| 19 | $(CP) ./src/* $(PKG_BUILD_DIR)/ |
| 20 | endef |
| 21 | |
| 22 | define Package/tops-rebb-fw-release |
developer | 1b2375f | 2023-08-31 14:38:35 +0800 | [diff] [blame] | 23 | TITLE:=Mediatek Tunnel Offload Processor System ReBB Release Firmware |
developer | e5e687d | 2023-08-08 16:05:33 +0800 | [diff] [blame] | 24 | SECTION:=firmware |
| 25 | CATEGORY:=Firmware |
developer | 1b2375f | 2023-08-31 14:38:35 +0800 | [diff] [blame] | 26 | DEPENDS:= \ |
| 27 | @MTK_TOPS_RELEASE_TARGET \ |
| 28 | kmod-tops-release |
developer | e5e687d | 2023-08-08 16:05:33 +0800 | [diff] [blame] | 29 | endef |
| 30 | |
| 31 | define Package/tops-rebb-fw-release/description |
developer | 1b2375f | 2023-08-31 14:38:35 +0800 | [diff] [blame] | 32 | Support for Mediatek Tunnel Offload Processor System ReBB release firmware. |
| 33 | The firmware offload and accerlerate APMCU's tunnel protocols traffic. |
| 34 | Available offload tunnel include L2oGRE, L2TP. |
developer | e5e687d | 2023-08-08 16:05:33 +0800 | [diff] [blame] | 35 | endef |
| 36 | |
| 37 | define Package/tops-rebb-fw-release/install |
| 38 | $(INSTALL_DIR) $(1)/lib/firmware/mediatek |
| 39 | $(CP) \ |
| 40 | $(PKG_BUILD_DIR)/firmware/rebb/mt7988_mgmt/tops-mgmt.img \ |
| 41 | $(PKG_BUILD_DIR)/firmware/rebb/mt7988_offload/tops-offload.img \ |
| 42 | $(1)/lib/firmware/mediatek |
| 43 | endef |
| 44 | |
developer | 1b2375f | 2023-08-31 14:38:35 +0800 | [diff] [blame] | 45 | define KernelPackage/tops-release |
developer | e5e687d | 2023-08-08 16:05:33 +0800 | [diff] [blame] | 46 | CATEGORY:=MTK Properties |
| 47 | SUBMENU:=Drivers |
developer | 1b2375f | 2023-08-31 14:38:35 +0800 | [diff] [blame] | 48 | TITLE:= MTK Tunnel Offload Processor System Kernel Driver |
developer | e5e687d | 2023-08-08 16:05:33 +0800 | [diff] [blame] | 49 | FILES+=$(PKG_BUILD_DIR)/tops.ko |
| 50 | KCONFIG:= |
developer | e5e687d | 2023-08-08 16:05:33 +0800 | [diff] [blame] | 51 | DEPENDS:= \ |
developer | 1b2375f | 2023-08-31 14:38:35 +0800 | [diff] [blame] | 52 | @MTK_TOPS_RELEASE_TARGET \ |
developer | e5e687d | 2023-08-08 16:05:33 +0800 | [diff] [blame] | 53 | kmod-mediatek_hnat \ |
developer | 1b2375f | 2023-08-31 14:38:35 +0800 | [diff] [blame] | 54 | kmod-tops \ |
developer | e5e687d | 2023-08-08 16:05:33 +0800 | [diff] [blame] | 55 | +kmod-pce \ |
| 56 | +@KERNEL_RELAY |
| 57 | endef |
| 58 | |
developer | 1b2375f | 2023-08-31 14:38:35 +0800 | [diff] [blame] | 59 | define KernelPackage/tops-release/description |
| 60 | Support for MTK Tunnel Offload Processor System Released Driver. The driver |
| 61 | controls the TOPS system to reduce the loading of tunnel protocol processing |
| 62 | in APMCU. |
developer | e5e687d | 2023-08-08 16:05:33 +0800 | [diff] [blame] | 63 | endef |
| 64 | |
developer | 1b2375f | 2023-08-31 14:38:35 +0800 | [diff] [blame] | 65 | define KernelPackage/tops-release-autoload |
developer | e5e687d | 2023-08-08 16:05:33 +0800 | [diff] [blame] | 66 | CATEGORY:=MTK Properties |
| 67 | SUBMENU:=Drivers |
| 68 | TITLE:= MTK Tunnel Offload Processor System Auto Load |
| 69 | AUTOLOAD:=$(call AutoLoad,51,tops) |
| 70 | KCONFIG:= |
| 71 | DEPENDS:= \ |
developer | 1b2375f | 2023-08-31 14:38:35 +0800 | [diff] [blame] | 72 | kmod-tops-release \ |
developer | e5e687d | 2023-08-08 16:05:33 +0800 | [diff] [blame] | 73 | +kmod-pce-autoload |
| 74 | endef |
| 75 | |
developer | 1b2375f | 2023-08-31 14:38:35 +0800 | [diff] [blame] | 76 | define KernelPackage/tops-release-autoload/description |
developer | e5e687d | 2023-08-08 16:05:33 +0800 | [diff] [blame] | 77 | Support for MTK Tunnel Offload Processor System auto load on system |
| 78 | boot process. |
| 79 | endef |
| 80 | |
developer | 1b2375f | 2023-08-31 14:38:35 +0800 | [diff] [blame] | 81 | define KernelPackage/tops |
| 82 | CATEGORY:=MTK Properties |
| 83 | TITLE:=Mediatek Tunnel Offload Processor System |
| 84 | SUBMENU:=Drivers |
| 85 | DEFAULT:=y |
| 86 | DEPENDS:= \ |
| 87 | @TARGET_mediatek_mt7988 |
| 88 | endef |
| 89 | |
| 90 | define KernelPackage/tops/config |
| 91 | source "$(SOURCE)/Config.in" |
| 92 | endef |
| 93 | |
| 94 | define KernelPackage/tops/description |
| 95 | Support for MTK Tunnel Offload Processor System. This system reduces the |
| 96 | loading of APMCU's tunnel protocol overhead and improve tunnel protocol's |
| 97 | throughput. |
| 98 | endef |
| 99 | |
developer | e5e687d | 2023-08-08 16:05:33 +0800 | [diff] [blame] | 100 | define Build/Compile |
| 101 | $(MAKE) -C "$(LINUX_DIR)" \ |
| 102 | $(KERNEL_MAKE_FLAGS) \ |
| 103 | M="$(PKG_BUILD_DIR)" \ |
| 104 | EXTRA_CFLAGS="$(EXTRA_CFLAGS)" \ |
| 105 | $(EXTRA_KCONFIG) \ |
| 106 | modules |
| 107 | endef |
| 108 | |
developer | 1b2375f | 2023-08-31 14:38:35 +0800 | [diff] [blame] | 109 | include tops.mk |
| 110 | include $(filter-out tops.mk,$(wildcard *.mk)) |
| 111 | |
developer | e5e687d | 2023-08-08 16:05:33 +0800 | [diff] [blame] | 112 | $(eval $(call BuildPackage,tops-rebb-fw-release)) |
| 113 | $(eval $(call KernelPackage,tops)) |
developer | 1b2375f | 2023-08-31 14:38:35 +0800 | [diff] [blame] | 114 | $(eval $(call KernelPackage,tops-release)) |
| 115 | $(eval $(call KernelPackage,tops-release-autoload)) |