Merge Mainline
This commit is contained in:
commit
2ff427b0b9
@ -1,4 +1,4 @@
|
||||
src-git packages https://github.com/immortalwrt/packages.git;openwrt-18.06
|
||||
src-git luci https://github.com/immortalwrt/luci.git;openwrt-18.06-k5.4
|
||||
src-git routing https://github.com/openwrt-routing/packages.git
|
||||
src-git routing https://github.com/openwrt/routing.git
|
||||
src-git telephony https://github.com/openwrt/telephony.git
|
||||
|
||||
@ -1,5 +1,13 @@
|
||||
cmake_bool = $(patsubst %,-D%:BOOL=$(if $($(1)),ON,OFF),$(2))
|
||||
|
||||
PKG_USE_NINJA ?= 1
|
||||
HOST_USE_NINJA ?= 1
|
||||
ifeq ($(PKG_USE_NINJA),1)
|
||||
PKG_BUILD_PARALLEL ?= 1
|
||||
endif
|
||||
ifeq ($(HOST_USE_NINJA),1)
|
||||
HOST_BUILD_PARALLEL ?= 1
|
||||
endif
|
||||
PKG_INSTALL:=1
|
||||
|
||||
ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
|
||||
@ -44,6 +52,34 @@ CMAKE_FIND_ROOT_PATH:=$(STAGING_DIR)/usr;$(TOOLCHAIN_DIR)$(if $(CONFIG_EXTERNAL_
|
||||
CMAKE_HOST_FIND_ROOT_PATH:=$(STAGING_DIR)/host;$(STAGING_DIR_HOSTPKG);$(STAGING_DIR_HOST)
|
||||
CMAKE_SHARED_LDFLAGS:=-Wl,-Bsymbolic-functions
|
||||
|
||||
ifeq ($(HOST_USE_NINJA),1)
|
||||
CMAKE_HOST_OPTIONS += -DCMAKE_GENERATOR="Ninja"
|
||||
|
||||
define Host/Compile/Default
|
||||
+$(NINJA) -C $(HOST_BUILD_DIR) $(1)
|
||||
endef
|
||||
|
||||
define Host/Install/Default
|
||||
+$(NINJA) -C $(HOST_BUILD_DIR) install
|
||||
endef
|
||||
|
||||
define Host/Uninstall/Default
|
||||
+$(NINJA) -C $(HOST_BUILD_DIR) uninstall
|
||||
endef
|
||||
endif
|
||||
|
||||
ifeq ($(PKG_USE_NINJA),1)
|
||||
CMAKE_OPTIONS += -DCMAKE_GENERATOR="Ninja"
|
||||
|
||||
define Build/Compile/Default
|
||||
+$(NINJA) -C $(CMAKE_BINARY_DIR) $(1)
|
||||
endef
|
||||
|
||||
define Build/Install/Default
|
||||
+DESTDIR="$(PKG_INSTALL_DIR)" $(NINJA) -C $(CMAKE_BINARY_DIR) install
|
||||
endef
|
||||
endif
|
||||
|
||||
define Build/Configure/Default
|
||||
mkdir -p $(CMAKE_BINARY_DIR)
|
||||
(cd $(CMAKE_BINARY_DIR); \
|
||||
|
||||
@ -43,5 +43,11 @@ endef
|
||||
|
||||
# 1: package name
|
||||
define GetABISuffix
|
||||
$(if $(filter-out kmod-%,$(1)),$(if $(ABIV_$(1)),$(ABIV_$(1)),$(foreach v,$(wildcard $(STAGING_DIR)/pkginfo/$(1).version),$(shell cat $(v)))))
|
||||
$(if $(ABIV_$(1)),$(ABIV_$(1)),$(call FormatABISuffix,$(1),$(foreach v,$(wildcard $(STAGING_DIR)/pkginfo/$(1).version),$(shell cat $(v)))))
|
||||
endef
|
||||
|
||||
# 1: package name
|
||||
# 2: abi version
|
||||
define FormatABISuffix
|
||||
$(if $(filter-out kmod-%,$(1)),$(if $(2),$(if $(filter %0 %1 %2 %3 %4 %5 %6 %7 %8 %9,$(1)),-)$(2)))
|
||||
endef
|
||||
|
||||
@ -99,7 +99,7 @@ _endef=endef
|
||||
|
||||
ifeq ($(DUMP),)
|
||||
define BuildTarget/ipkg
|
||||
ABIV_$(1):=$(if $(filter-out kmod-%,$(1)),$(ABI_VERSION))
|
||||
ABIV_$(1):=$(call FormatABISuffix,$(1),$(ABI_VERSION))
|
||||
PDIR_$(1):=$(call FeedPackageDir,$(1))
|
||||
IPKG_$(1):=$$(PDIR_$(1))/$(1)$$(ABIV_$(1))_$(VERSION)_$(PKGARCH).ipk
|
||||
IDIR_$(1):=$(PKG_BUILD_DIR)/ipkg-$(PKGARCH)/$(1)
|
||||
|
||||
@ -102,9 +102,9 @@ $(eval $(call SetupHostCommand,patch,Please install GNU 'patch', \
|
||||
gpatch --version 2>&1 | grep 'Free Software Foundation', \
|
||||
patch --version 2>&1 | grep 'Free Software Foundation'))
|
||||
|
||||
$(eval $(call SetupHostCommand,diff,Please install diffutils, \
|
||||
gdiff --version 2>&1 | grep diff, \
|
||||
diff --version 2>&1 | grep diff))
|
||||
$(eval $(call SetupHostCommand,diff,Please install GNU diffutils, \
|
||||
gdiff --version 2>&1 | grep GNU, \
|
||||
diff --version 2>&1 | grep GNU))
|
||||
|
||||
$(eval $(call SetupHostCommand,cp,Please install GNU fileutils, \
|
||||
gcp --help 2>&1 | grep 'Copy SOURCE', \
|
||||
|
||||
@ -44,7 +44,8 @@ TARGET_DEP = TARGET_$(BUILD_TARGET)$(if $(BUILD_SUBTARGET),_$(BUILD_SUBTARGET))
|
||||
UBOOT_MAKE_FLAGS = \
|
||||
HOSTCC="$(HOSTCC)" \
|
||||
HOSTCFLAGS="$(HOST_CFLAGS) $(HOST_CPPFLAGS) -std=gnu11" \
|
||||
HOSTLDFLAGS="$(HOST_LDFLAGS)"
|
||||
HOSTLDFLAGS="$(HOST_LDFLAGS)" \
|
||||
$(if $(findstring c,$(OPENWRT_VERBOSE)),V=1,V='')
|
||||
|
||||
define Build/U-Boot/Target
|
||||
$(eval $(call U-Boot/Init,$(1)))
|
||||
|
||||
@ -7,12 +7,12 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=exfat
|
||||
PKG_VERSION:=5.11.1
|
||||
PKG_VERSION:=5.12.3
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/namjaejeon/linux-exfat-oot/tar.gz/$(PKG_VERSION)?
|
||||
PKG_HASH:=85324f1edb1c03f65700164ba4f5750fe5cc7a8b956add321626be69149790f5
|
||||
PKG_HASH:=43889c73af76c466bbc904aff80354a62ecaa24c7b20e354ff735f5949907982
|
||||
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/linux-exfat-oot-$(PKG_VERSION)
|
||||
|
||||
PKG_MAINTAINER:=
|
||||
|
||||
@ -13,6 +13,7 @@ PKG_SOURCE_VERSION:=22b690334c0f49b11534cc2e331c9d5e17c4a0bc
|
||||
PKG_MIRROR_HASH:=ff5e563935919d2e40c1e7254ef3bc06f7ecc5e69f8ddd12903e8f5de942d630
|
||||
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
PKG_USE_NINJA:=0
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
|
||||
PKG_CONFIG_DEPENDS += \
|
||||
|
||||
@ -7,7 +7,7 @@ include $(TOPDIR)/rules.mk
|
||||
include $(INCLUDE_DIR)/kernel.mk
|
||||
|
||||
PKG_NAME:=r8125
|
||||
PKG_VERSION:=9.005.01
|
||||
PKG_VERSION:=9.005.06
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_BUILD_DIR:=$(KERNEL_BUILD_DIR)/$(PKG_NAME)-$(PKG_VERSION)
|
||||
|
||||
@ -46,6 +46,7 @@ ENABLE_PTP_SUPPORT = n
|
||||
ENABLE_PTP_MASTER_MODE = n
|
||||
ENABLE_RSS_SUPPORT = y
|
||||
ENABLE_LIB_SUPPORT = n
|
||||
ENABLE_USE_FIRMWARE_FILE = n
|
||||
|
||||
ifneq ($(KERNELRELEASE),)
|
||||
obj-m := r8125.o
|
||||
@ -106,6 +107,10 @@ ifneq ($(KERNELRELEASE),)
|
||||
r8125-objs += r8125_lib.o
|
||||
EXTRA_CFLAGS += -DENABLE_LIB_SUPPORT
|
||||
endif
|
||||
ifeq ($(ENABLE_USE_FIRMWARE_FILE), y)
|
||||
r8125-objs += r8125_firmware.o
|
||||
EXTRA_CFLAGS += -DENABLE_USE_FIRMWARE_FILE
|
||||
endif
|
||||
else
|
||||
BASEDIR := /lib/modules/$(shell uname -r)
|
||||
KERNELDIR ?= $(BASEDIR)/build
|
||||
|
||||
@ -47,9 +47,15 @@
|
||||
#include "r8125_lib.h"
|
||||
#endif
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,32)
|
||||
typedef int netdev_tx_t;
|
||||
#endif
|
||||
|
||||
/*
|
||||
#if LINUX_VERSION_CODE >= KERNEL_VERSION(4,12,0)&& !defined(ENABLE_LIB_SUPPORT)
|
||||
#define RTL_USE_NEW_INTR_API
|
||||
#endif
|
||||
*/
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,22)
|
||||
#define skb_transport_offset(skb) (skb->h.raw - skb->data)
|
||||
@ -357,7 +363,7 @@ do { \
|
||||
#define RSS_SUFFIX ""
|
||||
#endif
|
||||
|
||||
#define RTL8125_VERSION "9.005.01" NAPI_SUFFIX DASH_SUFFIX REALWOW_SUFFIX PTP_SUFFIX RSS_SUFFIX
|
||||
#define RTL8125_VERSION "9.005.06" NAPI_SUFFIX DASH_SUFFIX REALWOW_SUFFIX PTP_SUFFIX RSS_SUFFIX
|
||||
#define MODULENAME "r8125"
|
||||
#define PFX MODULENAME ": "
|
||||
|
||||
@ -460,6 +466,8 @@ This is free software, and you are welcome to redistribute it under certain cond
|
||||
#define R8125_MAX_RX_QUEUES (4)
|
||||
#define R8125_MAX_QUEUES R8125_MAX_RX_QUEUES
|
||||
|
||||
#define OCP_STD_PHY_BASE 0xa400
|
||||
|
||||
#ifdef ENABLE_LIB_SUPPORT
|
||||
#define R8125_MULTI_RX_Q(tp) 1
|
||||
#else
|
||||
@ -497,7 +505,7 @@ This is free software, and you are welcome to redistribute it under certain cond
|
||||
#endif
|
||||
|
||||
#ifndef NETDEV_TX_LOCKED
|
||||
#define NETDEV_TX_LOCKED -1 /* driver tx lock was already taken */
|
||||
#define NETDEV_TX_LOCKED -1t /* driver tx lock was already taken */
|
||||
#endif
|
||||
|
||||
#ifndef ADVERTISED_Pause
|
||||
@ -533,6 +541,7 @@ This is free software, and you are welcome to redistribute it under certain cond
|
||||
#endif
|
||||
|
||||
#define RTK_ADVERTISE_2500FULL 0x80
|
||||
#define RTK_LPA_ADVERTISE_2500FULL 0x20
|
||||
|
||||
/* Tx NO CLOSE */
|
||||
#define MAX_TX_NO_CLOSE_DESC_PTR_V2 0x10000
|
||||
@ -1284,6 +1293,7 @@ enum RTL8125_register_content {
|
||||
RxCfg_128_int_en = (1 << 15),
|
||||
RxCfg_fet_multi_en = (1 << 14),
|
||||
RxCfg_half_refetch = (1 << 13),
|
||||
RxCfg_pause_slot_en = (1 << 11),
|
||||
RxCfg_9356SEL = (1 << 6),
|
||||
|
||||
/* TxConfigBits */
|
||||
@ -1911,10 +1921,6 @@ struct rtl8125_private {
|
||||
|
||||
u8 random_mac;
|
||||
|
||||
u8 HwSuppGigaForceMode;
|
||||
|
||||
u16 phy_reg_anlpar;
|
||||
|
||||
u32 HwPcieSNOffset;
|
||||
|
||||
u8 HwSuppTxNoCloseVer;
|
||||
@ -1931,6 +1937,12 @@ struct rtl8125_private {
|
||||
u8 HwSuppD0SpeedUpVer;
|
||||
u8 D0SpeedUpSpeed;
|
||||
|
||||
u8 ring_lib_enabled;
|
||||
|
||||
const char *fw_name;
|
||||
struct rtl8125_fw *rtl_fw;
|
||||
u32 ocp_base;
|
||||
|
||||
//Dash+++++++++++++++++
|
||||
u8 HwSuppDashVer;
|
||||
u8 DASH;
|
||||
@ -2020,8 +2032,7 @@ struct rtl8125_private {
|
||||
//Realwow--------------
|
||||
#endif //ENABLE_REALWOW_SUPPORT
|
||||
|
||||
u32 eee_adv_t;
|
||||
u8 eee_enabled;
|
||||
struct ethtool_eee eee;
|
||||
|
||||
#ifdef ENABLE_R8125_PROCFS
|
||||
//Procfs support
|
||||
@ -2123,8 +2134,8 @@ enum mcfg {
|
||||
CFG_METHOD_3,
|
||||
CFG_METHOD_4,
|
||||
CFG_METHOD_5,
|
||||
CFG_METHOD_MAX,
|
||||
CFG_METHOD_DEFAULT = 0xFF
|
||||
CFG_METHOD_DEFAULT,
|
||||
CFG_METHOD_MAX
|
||||
};
|
||||
|
||||
#define LSO_32K 32000
|
||||
@ -2164,15 +2175,15 @@ enum mcfg {
|
||||
|
||||
static const u16 other_q_intr_mask = (RxOK1 | RxDU1);
|
||||
|
||||
void rtl8125_mdio_write(struct rtl8125_private *tp, u32 RegAddr, u32 value);
|
||||
void rtl8125_mdio_write(struct rtl8125_private *tp, u16 RegAddr, u16 value);
|
||||
void rtl8125_mdio_prot_write(struct rtl8125_private *tp, u32 RegAddr, u32 value);
|
||||
void rtl8125_mdio_prot_direct_write_phy_ocp(struct rtl8125_private *tp, u32 RegAddr, u32 value);
|
||||
u32 rtl8125_mdio_read(struct rtl8125_private *tp, u32 RegAddr);
|
||||
u32 rtl8125_mdio_read(struct rtl8125_private *tp, u16 RegAddr);
|
||||
u32 rtl8125_mdio_prot_read(struct rtl8125_private *tp, u32 RegAddr);
|
||||
u32 rtl8125_mdio_prot_direct_read_phy_ocp(struct rtl8125_private *tp, u32 RegAddr);
|
||||
void rtl8125_ephy_write(struct rtl8125_private *tp, int RegAddr, int value);
|
||||
void rtl8125_mac_ocp_write(struct rtl8125_private *tp, u16 reg_addr, u16 value);
|
||||
u16 rtl8125_mac_ocp_read(struct rtl8125_private *tp, u16 reg_addr);
|
||||
u32 rtl8125_mac_ocp_read(struct rtl8125_private *tp, u16 reg_addr);
|
||||
void rtl8125_clear_eth_phy_bit(struct rtl8125_private *tp, u8 addr, u16 mask);
|
||||
void rtl8125_set_eth_phy_bit(struct rtl8125_private *tp, u8 addr, u16 mask);
|
||||
void rtl8125_ocp_write(struct rtl8125_private *tp, u16 addr, u8 len, u32 data);
|
||||
@ -2180,7 +2191,6 @@ void rtl8125_oob_notify(struct rtl8125_private *tp, u8 cmd);
|
||||
void rtl8125_init_ring_indexes(struct rtl8125_private *tp);
|
||||
int rtl8125_eri_write(struct rtl8125_private *tp, int addr, int len, u32 value, int type);
|
||||
void rtl8125_oob_mutex_lock(struct rtl8125_private *tp);
|
||||
u32 rtl8125_mdio_read(struct rtl8125_private *tp, u32 RegAddr);
|
||||
u32 rtl8125_ocp_read(struct rtl8125_private *tp, u16 addr, u8 len);
|
||||
u32 rtl8125_ocp_read_with_oob_base_address(struct rtl8125_private *tp, u16 addr, u8 len, u32 base_address);
|
||||
u32 rtl8125_ocp_write_with_oob_base_address(struct rtl8125_private *tp, u16 addr, u8 len, u32 value, u32 base_address);
|
||||
@ -2232,6 +2242,9 @@ rtl8125_enable_hw_interrupt_v2(struct rtl8125_private *tp, u32 message_id)
|
||||
RTL_W32(tp, IMR_V2_SET_REG_8125, BIT(message_id));
|
||||
}
|
||||
|
||||
int rtl8125_open(struct net_device *dev);
|
||||
int rtl8125_close(struct net_device *dev);
|
||||
void rtl8125_hw_config(struct net_device *dev);
|
||||
void rtl8125_hw_set_timer_int_8125(struct rtl8125_private *tp, u32 message_id, u8 timer_intmiti_val);
|
||||
void rtl8125_set_rx_q_num(struct rtl8125_private *tp, unsigned int num_rx_queues);
|
||||
void rtl8125_set_tx_q_num(struct rtl8125_private *tp, unsigned int num_tx_queues);
|
||||
@ -2242,11 +2255,9 @@ void rtl8125_tx_clear(struct rtl8125_private *tp);
|
||||
void rtl8125_rx_clear(struct rtl8125_private *tp);
|
||||
int rtl8125_init_ring(struct net_device *dev);
|
||||
void rtl8125_hw_set_rx_packet_filter(struct net_device *dev);
|
||||
void rtl8125_enable_hw_linkchg_interrupt(struct rtl8125_private *tp);
|
||||
|
||||
#ifdef ENABLE_LIB_SUPPORT
|
||||
void rtl8125_lib_reset_prepare(struct rtl8125_private *tp);
|
||||
void rtl8125_lib_reset_complete(struct rtl8125_private *tp);
|
||||
#else
|
||||
#ifndef ENABLE_LIB_SUPPORT
|
||||
static inline void rtl8125_lib_reset_prepare(struct rtl8125_private *tp) { }
|
||||
static inline void rtl8125_lib_reset_complete(struct rtl8125_private *tp) { }
|
||||
#endif
|
||||
|
||||
264
package/kernel/r8125/src/r8125_firmware.c
Normal file
264
package/kernel/r8125/src/r8125_firmware.c
Normal file
@ -0,0 +1,264 @@
|
||||
// SPDX-License-Identifier: GPL-2.0-only
|
||||
/*
|
||||
################################################################################
|
||||
#
|
||||
# r8168 is the Linux device driver released for Realtek Gigabit Ethernet
|
||||
# controllers with PCI-Express interface.
|
||||
#
|
||||
# Copyright(c) 2021 Realtek Semiconductor Corp. All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify 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.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along with
|
||||
# this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Author:
|
||||
# Realtek NIC software team <nicfae@realtek.com>
|
||||
# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan
|
||||
#
|
||||
################################################################################
|
||||
*/
|
||||
|
||||
/************************************************************************************
|
||||
* This product is covered by one or more of the following patents:
|
||||
* US6,570,884, US6,115,776, and US6,327,625.
|
||||
***********************************************************************************/
|
||||
|
||||
#include <linux/version.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/firmware.h>
|
||||
|
||||
#include "r8125_firmware.h"
|
||||
|
||||
enum rtl_fw_opcode {
|
||||
PHY_READ = 0x0,
|
||||
PHY_DATA_OR = 0x1,
|
||||
PHY_DATA_AND = 0x2,
|
||||
PHY_BJMPN = 0x3,
|
||||
PHY_MDIO_CHG = 0x4,
|
||||
PHY_CLEAR_READCOUNT = 0x7,
|
||||
PHY_WRITE = 0x8,
|
||||
PHY_READCOUNT_EQ_SKIP = 0x9,
|
||||
PHY_COMP_EQ_SKIPN = 0xa,
|
||||
PHY_COMP_NEQ_SKIPN = 0xb,
|
||||
PHY_WRITE_PREVIOUS = 0xc,
|
||||
PHY_SKIPN = 0xd,
|
||||
PHY_DELAY_MS = 0xe,
|
||||
};
|
||||
|
||||
struct fw_info {
|
||||
u32 magic;
|
||||
char version[RTL8125_VER_SIZE];
|
||||
__le32 fw_start;
|
||||
__le32 fw_len;
|
||||
u8 chksum;
|
||||
} __packed;
|
||||
|
||||
#if LINUX_VERSION_CODE < KERNEL_VERSION(4,16,0)
|
||||
#define sizeof_field(TYPE, MEMBER) sizeof((((TYPE *)0)->MEMBER))
|
||||
#endif
|
||||
#define FW_OPCODE_SIZE sizeof_field(struct rtl8125_fw_phy_action, code[0])
|
||||
|
||||
static bool rtl8125_fw_format_ok(struct rtl8125_fw *rtl_fw)
|
||||
{
|
||||
const struct firmware *fw = rtl_fw->fw;
|
||||
struct fw_info *fw_info = (struct fw_info *)fw->data;
|
||||
struct rtl8125_fw_phy_action *pa = &rtl_fw->phy_action;
|
||||
|
||||
if (fw->size < FW_OPCODE_SIZE)
|
||||
return false;
|
||||
|
||||
if (!fw_info->magic) {
|
||||
size_t i, size, start;
|
||||
u8 checksum = 0;
|
||||
|
||||
if (fw->size < sizeof(*fw_info))
|
||||
return false;
|
||||
|
||||
for (i = 0; i < fw->size; i++)
|
||||
checksum += fw->data[i];
|
||||
if (checksum != 0)
|
||||
return false;
|
||||
|
||||
start = le32_to_cpu(fw_info->fw_start);
|
||||
if (start > fw->size)
|
||||
return false;
|
||||
|
||||
size = le32_to_cpu(fw_info->fw_len);
|
||||
if (size > (fw->size - start) / FW_OPCODE_SIZE)
|
||||
return false;
|
||||
|
||||
strscpy(rtl_fw->version, fw_info->version, RTL8125_VER_SIZE);
|
||||
|
||||
pa->code = (__le32 *)(fw->data + start);
|
||||
pa->size = size;
|
||||
} else {
|
||||
if (fw->size % FW_OPCODE_SIZE)
|
||||
return false;
|
||||
|
||||
strscpy(rtl_fw->version, rtl_fw->fw_name, RTL8125_VER_SIZE);
|
||||
|
||||
pa->code = (__le32 *)fw->data;
|
||||
pa->size = fw->size / FW_OPCODE_SIZE;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
static bool rtl8125_fw_data_ok(struct rtl8125_fw *rtl_fw)
|
||||
{
|
||||
struct rtl8125_fw_phy_action *pa = &rtl_fw->phy_action;
|
||||
size_t index;
|
||||
|
||||
for (index = 0; index < pa->size; index++) {
|
||||
u32 action = le32_to_cpu(pa->code[index]);
|
||||
u32 val = action & 0x0000ffff;
|
||||
u32 regno = (action & 0x0fff0000) >> 16;
|
||||
|
||||
switch (action >> 28) {
|
||||
case PHY_READ:
|
||||
case PHY_DATA_OR:
|
||||
case PHY_DATA_AND:
|
||||
case PHY_CLEAR_READCOUNT:
|
||||
case PHY_WRITE:
|
||||
case PHY_WRITE_PREVIOUS:
|
||||
case PHY_DELAY_MS:
|
||||
break;
|
||||
|
||||
case PHY_MDIO_CHG:
|
||||
if (val > 1)
|
||||
goto out;
|
||||
break;
|
||||
|
||||
case PHY_BJMPN:
|
||||
if (regno > index)
|
||||
goto out;
|
||||
break;
|
||||
case PHY_READCOUNT_EQ_SKIP:
|
||||
if (index + 2 >= pa->size)
|
||||
goto out;
|
||||
break;
|
||||
case PHY_COMP_EQ_SKIPN:
|
||||
case PHY_COMP_NEQ_SKIPN:
|
||||
case PHY_SKIPN:
|
||||
if (index + 1 + regno >= pa->size)
|
||||
goto out;
|
||||
break;
|
||||
|
||||
default:
|
||||
dev_err(rtl_fw->dev, "Invalid action 0x%08x\n", action);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
out:
|
||||
dev_err(rtl_fw->dev, "Out of range of firmware\n");
|
||||
return false;
|
||||
}
|
||||
|
||||
void rtl8125_fw_write_firmware(struct rtl8125_private *tp, struct rtl8125_fw *rtl_fw)
|
||||
{
|
||||
struct rtl8125_fw_phy_action *pa = &rtl_fw->phy_action;
|
||||
rtl8125_fw_write_t fw_write = rtl_fw->phy_write;
|
||||
rtl8125_fw_read_t fw_read = rtl_fw->phy_read;
|
||||
int predata = 0, count = 0;
|
||||
size_t index;
|
||||
|
||||
for (index = 0; index < pa->size; index++) {
|
||||
u32 action = le32_to_cpu(pa->code[index]);
|
||||
u32 data = action & 0x0000ffff;
|
||||
u32 regno = (action & 0x0fff0000) >> 16;
|
||||
enum rtl_fw_opcode opcode = action >> 28;
|
||||
|
||||
if (!action)
|
||||
break;
|
||||
|
||||
switch (opcode) {
|
||||
case PHY_READ:
|
||||
predata = fw_read(tp, regno);
|
||||
count++;
|
||||
break;
|
||||
case PHY_DATA_OR:
|
||||
predata |= data;
|
||||
break;
|
||||
case PHY_DATA_AND:
|
||||
predata &= data;
|
||||
break;
|
||||
case PHY_BJMPN:
|
||||
index -= (regno + 1);
|
||||
break;
|
||||
case PHY_MDIO_CHG:
|
||||
if (data) {
|
||||
fw_write = rtl_fw->mac_mcu_write;
|
||||
fw_read = rtl_fw->mac_mcu_read;
|
||||
} else {
|
||||
fw_write = rtl_fw->phy_write;
|
||||
fw_read = rtl_fw->phy_read;
|
||||
}
|
||||
|
||||
break;
|
||||
case PHY_CLEAR_READCOUNT:
|
||||
count = 0;
|
||||
break;
|
||||
case PHY_WRITE:
|
||||
fw_write(tp, regno, data);
|
||||
break;
|
||||
case PHY_READCOUNT_EQ_SKIP:
|
||||
if (count == data)
|
||||
index++;
|
||||
break;
|
||||
case PHY_COMP_EQ_SKIPN:
|
||||
if (predata == data)
|
||||
index += regno;
|
||||
break;
|
||||
case PHY_COMP_NEQ_SKIPN:
|
||||
if (predata != data)
|
||||
index += regno;
|
||||
break;
|
||||
case PHY_WRITE_PREVIOUS:
|
||||
fw_write(tp, regno, predata);
|
||||
break;
|
||||
case PHY_SKIPN:
|
||||
index += regno;
|
||||
break;
|
||||
case PHY_DELAY_MS:
|
||||
mdelay(data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void rtl8125_fw_release_firmware(struct rtl8125_fw *rtl_fw)
|
||||
{
|
||||
release_firmware(rtl_fw->fw);
|
||||
}
|
||||
|
||||
int rtl8125_fw_request_firmware(struct rtl8125_fw *rtl_fw)
|
||||
{
|
||||
int rc;
|
||||
|
||||
rc = request_firmware(&rtl_fw->fw, rtl_fw->fw_name, rtl_fw->dev);
|
||||
if (rc < 0)
|
||||
goto out;
|
||||
|
||||
if (!rtl8125_fw_format_ok(rtl_fw) || !rtl8125_fw_data_ok(rtl_fw)) {
|
||||
release_firmware(rtl_fw->fw);
|
||||
rc = -EINVAL;
|
||||
goto out;
|
||||
}
|
||||
|
||||
return 0;
|
||||
out:
|
||||
dev_err(rtl_fw->dev, "Unable to load firmware %s (%d)\n",
|
||||
rtl_fw->fw_name, rc);
|
||||
return rc;
|
||||
}
|
||||
68
package/kernel/r8125/src/r8125_firmware.h
Normal file
68
package/kernel/r8125/src/r8125_firmware.h
Normal file
@ -0,0 +1,68 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0-only */
|
||||
/*
|
||||
################################################################################
|
||||
#
|
||||
# r8125 is the Linux device driver released for Realtek 2.5Gigabit Ethernet
|
||||
# controllers with PCI-Express interface.
|
||||
#
|
||||
# Copyright(c) 2021 Realtek Semiconductor Corp. All rights reserved.
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify 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.
|
||||
#
|
||||
# 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.
|
||||
#
|
||||
# You should have received a copy of the GNU General Public License along with
|
||||
# this program; if not, see <http://www.gnu.org/licenses/>.
|
||||
#
|
||||
# Author:
|
||||
# Realtek NIC software team <nicfae@realtek.com>
|
||||
# No. 2, Innovation Road II, Hsinchu Science Park, Hsinchu 300, Taiwan
|
||||
#
|
||||
################################################################################
|
||||
*/
|
||||
|
||||
/************************************************************************************
|
||||
* This product is covered by one or more of the following patents:
|
||||
* US6,570,884, US6,115,776, and US6,327,625.
|
||||
***********************************************************************************/
|
||||
|
||||
#ifndef _LINUX_rtl8125_FIRMWARE_H
|
||||
#define _LINUX_rtl8125_FIRMWARE_H
|
||||
|
||||
#include <linux/device.h>
|
||||
#include <linux/firmware.h>
|
||||
|
||||
struct rtl8125_private;
|
||||
typedef void (*rtl8125_fw_write_t)(struct rtl8125_private *tp, u16 reg, u16 val);
|
||||
typedef u32 (*rtl8125_fw_read_t)(struct rtl8125_private *tp, u16 reg);
|
||||
|
||||
#define RTL8125_VER_SIZE 32
|
||||
|
||||
struct rtl8125_fw {
|
||||
rtl8125_fw_write_t phy_write;
|
||||
rtl8125_fw_read_t phy_read;
|
||||
rtl8125_fw_write_t mac_mcu_write;
|
||||
rtl8125_fw_read_t mac_mcu_read;
|
||||
const struct firmware *fw;
|
||||
const char *fw_name;
|
||||
struct device *dev;
|
||||
|
||||
char version[RTL8125_VER_SIZE];
|
||||
|
||||
struct rtl8125_fw_phy_action {
|
||||
__le32 *code;
|
||||
size_t size;
|
||||
} phy_action;
|
||||
};
|
||||
|
||||
int rtl8125_fw_request_firmware(struct rtl8125_fw *rtl_fw);
|
||||
void rtl8125_fw_release_firmware(struct rtl8125_fw *rtl_fw);
|
||||
void rtl8125_fw_write_firmware(struct rtl8125_private *tp, struct rtl8125_fw *rtl_fw);
|
||||
|
||||
#endif /* _LINUX_rtl8125_FIRMWARE_H */
|
||||
File diff suppressed because it is too large
Load Diff
@ -9,7 +9,7 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=json-c
|
||||
PKG_VERSION:=0.15
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-nodoc.tar.gz
|
||||
PKG_SOURCE_URL:=https://s3.amazonaws.com/json-c_releases/releases/
|
||||
@ -20,6 +20,7 @@ PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
PKG_CPE_ID:=cpe:/a:json-c_project:json-c
|
||||
|
||||
PKG_FLAGS := nonshared
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
HOST_BUILD_PREFIX:=$(STAGING_DIR_HOST)
|
||||
|
||||
|
||||
@ -8,7 +8,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=libnl-tiny
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/libnl-tiny.git
|
||||
@ -17,6 +17,8 @@ PKG_SOURCE_VERSION:=c291088f631d1694f7ba0444b59677b194348da8
|
||||
PKG_MIRROR_HASH:=99bcce12701bb34dadb39689d95c2c5cf1e27719d0ecfd645d3957a8947025ac
|
||||
CMAKE_INSTALL:=1
|
||||
|
||||
PKG_FLAGS := nonshared
|
||||
|
||||
PKG_LICENSE:=LGPL-2.1
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
|
||||
@ -10,6 +10,8 @@ PKG_SOURCE_DATE:=2020-07-11
|
||||
PKG_SOURCE_VERSION:=f4e9bf73ac5c0ee6b8f240e2a2100e70ca56d705
|
||||
CMAKE_INSTALL:=1
|
||||
|
||||
PKG_FLAGS := nonshared
|
||||
|
||||
PKG_LICENSE:=ISC
|
||||
PKG_LICENSE_FILES:=
|
||||
|
||||
@ -64,7 +66,7 @@ define Package/libubox-lua
|
||||
endef
|
||||
|
||||
TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
|
||||
CMAKE_OPTIONS = \
|
||||
CMAKE_OPTIONS += \
|
||||
-DLUAPATH=/usr/lib/lua
|
||||
|
||||
define Package/libubox/install
|
||||
|
||||
@ -85,7 +85,7 @@ endif
|
||||
|
||||
TARGET_LDFLAGS += -lcrypt
|
||||
|
||||
CMAKE_OPTIONS = -DTLS_SUPPORT=on
|
||||
CMAKE_OPTIONS += -DTLS_SUPPORT=on
|
||||
|
||||
define Package/uhttpd/install
|
||||
$(INSTALL_DIR) $(1)/etc/init.d
|
||||
|
||||
@ -11,10 +11,10 @@ PKG_RELEASE:=$(AUTORELEASE)
|
||||
PKG_FLAGS:=essential
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=$(PROJECT_GIT)/project/opkg-lede.git
|
||||
PKG_SOURCE_DATE:=2021-03-15
|
||||
PKG_SOURCE_VERSION:=5936c4f9660248284e8a9b040ea3153d3ea888de
|
||||
PKG_MIRROR_HASH:=b873c209baaf4f150c89646d58e4a0072f807d24b02c320ab8c7ae9180c13240
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/opkg-lede.git
|
||||
PKG_SOURCE_DATE:=2021-06-13
|
||||
PKG_SOURCE_VERSION:=1bf042dd06751b693a8544d2317e5b969d666b69
|
||||
PKG_MIRROR_HASH:=aeda4e0f11805bf95fc7be6d38391ce579acd965c8ba6a490b3e8669815b7264
|
||||
|
||||
PKG_LICENSE:=GPL-2.0
|
||||
PKG_LICENSE_FILES:=COPYING
|
||||
|
||||
@ -1,7 +1,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ubus
|
||||
PKG_RELEASE:=1
|
||||
PKG_RELEASE:=2
|
||||
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/ubus.git
|
||||
@ -14,6 +14,7 @@ PKG_LICENSE:=LGPL-2.1
|
||||
PKG_LICENSE_FILES:=
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
PKG_FLAGS := nonshared
|
||||
PKG_ASLR_PIE_REGULAR:=1
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
@ -51,7 +52,7 @@ endef
|
||||
TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include -flto
|
||||
TARGET_LDFLAGS += -flto
|
||||
|
||||
CMAKE_OPTIONS = \
|
||||
CMAKE_OPTIONS += \
|
||||
-DLUAPATH=/usr/lib/lua
|
||||
|
||||
define Package/ubus/install
|
||||
|
||||
@ -9,7 +9,7 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=uci
|
||||
PKG_RELEASE:=3
|
||||
PKG_RELEASE:=4
|
||||
|
||||
PKG_SOURCE_URL=$(PROJECT_GIT)/project/uci.git
|
||||
PKG_SOURCE_PROTO:=git
|
||||
@ -23,6 +23,7 @@ PKG_LICENSE_FILES:=
|
||||
PKG_MAINTAINER:=Felix Fietkau <nbd@nbd.name>
|
||||
|
||||
PKG_BUILD_PARALLEL:=0
|
||||
PKG_FLAGS := nonshared
|
||||
|
||||
include $(INCLUDE_DIR)/package.mk
|
||||
include $(INCLUDE_DIR)/cmake.mk
|
||||
@ -55,7 +56,7 @@ endef
|
||||
TARGET_CFLAGS += -I$(STAGING_DIR)/usr/include
|
||||
TARGET_LDFLAGS += -L$(STAGING_DIR)/usr/lib
|
||||
|
||||
CMAKE_OPTIONS = \
|
||||
CMAKE_OPTIONS += \
|
||||
-DLUAPATH=/usr/lib/lua \
|
||||
$(if $(DEBUG),-DUCI_DEBUG=ON)
|
||||
|
||||
|
||||
@ -9,13 +9,14 @@ include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=lua
|
||||
PKG_VERSION:=5.1.5
|
||||
PKG_RELEASE:=8
|
||||
PKG_RELEASE:=9
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=http://www.lua.org/ftp/ \
|
||||
http://www.tecgraf.puc-rio.br/lua/ftp/
|
||||
PKG_HASH:=2640fc56a795f29d28ef15e13c34a47e223960b0240e8cb0a82d9b0738695333
|
||||
PKG_BUILD_PARALLEL:=1
|
||||
PKG_FLAGS := nonshared
|
||||
|
||||
PKG_LICENSE:=MIT
|
||||
PKG_LICENSE_FILES:=COPYRIGHT
|
||||
|
||||
@ -16,11 +16,16 @@ start_service() {
|
||||
local disabled="$(uci get gps.@gps[-1].disabled || echo 0)"
|
||||
|
||||
[ "$disabled" == "0" ] || return
|
||||
[ "$tty" ] || return
|
||||
|
||||
[ -c "$tty" ] || {
|
||||
tty="/dev/$tty"
|
||||
[ -c "$tty" ] || return
|
||||
}
|
||||
case "$tty" in
|
||||
"/"*)
|
||||
true
|
||||
;;
|
||||
*)
|
||||
tty="/dev/$tty"
|
||||
;;
|
||||
esac
|
||||
|
||||
procd_open_instance
|
||||
procd_set_param command "$PROG"
|
||||
|
||||
6
rules.mk
6
rules.mk
@ -344,6 +344,12 @@ else
|
||||
$(SCRIPT_DIR)/rstrip.sh
|
||||
endif
|
||||
|
||||
NINJA = \
|
||||
MAKEFLAGS="$(MAKE_JOBSERVER)" \
|
||||
$(STAGING_DIR_HOST)/bin/ninja \
|
||||
$(if $(findstring c,$(OPENWRT_VERBOSE)),-v) \
|
||||
$(if $(MAKE_JOBSERVER),,-j1)
|
||||
|
||||
ifeq ($(CONFIG_IPV6),y)
|
||||
DISABLE_IPV6:=
|
||||
else
|
||||
|
||||
@ -31,7 +31,7 @@
|
||||
compatible = "gpio-leds";
|
||||
|
||||
led_sys: sys {
|
||||
label = "m520:green:sys";
|
||||
label = "green:sys";
|
||||
gpios = <&gpio_ext 15 GPIO_ACTIVE_LOW>;
|
||||
};
|
||||
};
|
||||
|
||||
@ -46,7 +46,7 @@ HOST_CONFIGURE_ARGS = \
|
||||
ifneq ($(CONFIG_GDB_PYTHON),)
|
||||
HOST_CONFIGURE_ARGS+= --with-python
|
||||
else
|
||||
HOST_CONFIGURE_ARGS:= --without-python
|
||||
HOST_CONFIGURE_ARGS+= --without-python
|
||||
endif
|
||||
|
||||
define Host/Install
|
||||
|
||||
@ -24,7 +24,7 @@ endif
|
||||
tools-y += autoconf autoconf-archive automake bc bison cmake cpio dosfstools
|
||||
tools-y += e2fsprogs fakeroot findutils firmware-utils flex gengetopt
|
||||
tools-y += libressl libtool lzma m4 make-ext4fs missing-macros mkimage
|
||||
tools-y += mklibs mm-macros mtd-utils mtools padjffs2 patch-image patchelf
|
||||
tools-y += mklibs mm-macros mtd-utils mtools ninja padjffs2 patch-image patchelf
|
||||
tools-y += pkg-config quilt squashfskit4 sstrip ucl upx xxd zip zlib zstd
|
||||
tools-$(BUILD_B43_TOOLS) += b43-tools
|
||||
tools-$(BUILD_ISL) += isl
|
||||
@ -45,7 +45,7 @@ $(curdir)/b43-tools/compile := $(curdir)/bison/compile
|
||||
$(curdir)/bc/compile := $(curdir)/bison/compile $(curdir)/libtool/compile
|
||||
$(curdir)/bison/compile := $(curdir)/flex/compile
|
||||
$(curdir)/cbootimage/compile += $(curdir)/automake/compile
|
||||
$(curdir)/cmake/compile += $(curdir)/libressl/compile
|
||||
$(curdir)/cmake/compile += $(curdir)/libressl/compile $(curdir)/ninja/compile
|
||||
$(curdir)/dosfstools/compile := $(curdir)/autoconf/compile $(curdir)/automake/compile
|
||||
$(curdir)/e2fsprogs/compile := $(curdir)/libtool/compile
|
||||
$(curdir)/fakeroot/compile := $(curdir)/libtool/compile
|
||||
@ -83,7 +83,7 @@ ifneq ($(HOST_OS),Linux)
|
||||
endif
|
||||
|
||||
ifneq ($(CONFIG_CCACHE)$(CONFIG_SDK),)
|
||||
$(foreach tool, $(filter-out xz zstd patch pkgconf libressl cmake,$(tools-y)), $(eval $(curdir)/$(tool)/compile += $(curdir)/ccache/compile))
|
||||
$(foreach tool, $(filter-out xz zstd patch pkg-config libressl ninja cmake,$(tools-y)), $(eval $(curdir)/$(tool)/compile += $(curdir)/ccache/compile))
|
||||
tools-y += ccache
|
||||
$(curdir)/ccache/compile := $(curdir)/zstd/compile
|
||||
endif
|
||||
|
||||
39
tools/ninja/Makefile
Normal file
39
tools/ninja/Makefile
Normal file
@ -0,0 +1,39 @@
|
||||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=ninja
|
||||
PKG_VERSION:=1.10.2
|
||||
PKG_RELEASE:=1
|
||||
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION).tar.gz
|
||||
PKG_SOURCE_URL:=https://codeload.github.com/ninja-build/ninja/tar.gz/v$(PKG_VERSION)?
|
||||
PKG_HASH:=ce35865411f0490368a8fc383f29071de6690cbadc27704734978221f25e2bed
|
||||
|
||||
include $(INCLUDE_DIR)/host-build.mk
|
||||
|
||||
CONFIGURE_ARGS:=
|
||||
ifneq ($(findstring c,$(OPENWRT_VERBOSE)),)
|
||||
CONFIGURE_ARGS+=--verbose
|
||||
endif
|
||||
|
||||
define Host/Configure
|
||||
endef
|
||||
|
||||
define Host/Compile
|
||||
cd $(HOST_BUILD_DIR) && \
|
||||
CXX="$(HOSTCXX_NOCACHE)" \
|
||||
CXXFLAGS="$(HOST_CXXFLAGS) $(HOST_CPPFLAGS)" \
|
||||
LDFLAGS="$(HOST_LDFLAGS)" \
|
||||
$(STAGING_DIR_HOST)/bin/$(PYTHON) configure.py --bootstrap $(CONFIGURE_ARGS)
|
||||
endef
|
||||
|
||||
define Host/Install
|
||||
$(INSTALL_DIR) $(STAGING_DIR_HOST)/bin
|
||||
$(INSTALL_BIN) $(HOST_BUILD_DIR)/ninja $(STAGING_DIR_HOST)/bin/
|
||||
endef
|
||||
|
||||
define Host/Clean
|
||||
$(call Host/Clean/Default)
|
||||
rm -f $(STAGING_DIR_HOST)/bin/ninja
|
||||
endef
|
||||
|
||||
$(eval $(call HostBuild))
|
||||
2279
tools/ninja/patches/100-make_jobserver_support.patch
Normal file
2279
tools/ninja/patches/100-make_jobserver_support.patch
Normal file
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user