diff --git a/package/kernel/mt76/patches/0155-npu-param.patch b/package/kernel/mt76/patches/0155-npu-param.patch new file mode 100644 index 00000000000000..023d2e13db8ce9 --- /dev/null +++ b/package/kernel/mt76/patches/0155-npu-param.patch @@ -0,0 +1,30 @@ +--- a/npu.c ++++ b/npu.c +@@ -3,6 +3,7 @@ + * Copyright (c) 2025 AIROHA Inc + * Author: Lorenzo Bianconi + */ ++#include + #include + #include + +@@ -13,6 +14,9 @@ + #define MT76_NPU_RX_BUF_SIZE (1800 + \ + SKB_DATA_ALIGN(sizeof(struct skb_shared_info))) + ++static bool npu_enable = true; ++module_param(npu_enable, bool, 0644); ++ + static int mt76_npu_fill_rx_queue(struct mt76_dev *dev, struct mt76_queue *q) + { + int nframes = 0; +@@ -504,6 +508,9 @@ int mt76_npu_init(struct mt76_dev *dev) + if (!is_mt7992(dev)) + return -EINVAL; + ++ if (!npu_enable) ++ return -EINVAL; ++ + mutex_lock(&dev->mutex); + + npu = airoha_npu_get(dev->dev, NULL); diff --git a/target/linux/airoha/dts/an7581.dtsi b/target/linux/airoha/dts/an7581.dtsi index ace5c8b661e1e9..1a3a304d4f3df5 100644 --- a/target/linux/airoha/dts/an7581.dtsi +++ b/target/linux/airoha/dts/an7581.dtsi @@ -30,22 +30,22 @@ qdma1_buf: qdma1-buf@89000000 { no-map; - reg = <0x0 0x89000000 0x0 0x400000>; + reg = <0x0 0x89000000 0x0 0x1000000>; }; - npu_pkt: npu-pkt@89400000 { + npu_pkt: npu-pkt@8a000000 { no-map; - reg = <0x0 0x89400000 0x0 0x2c00000>; + reg = <0x0 0x8a000000 0x0 0x2c00000>; }; - npu_txpkt: npu-txpkt@8c000000 { + npu_txpkt: npu-txpkt@8cc00000 { no-map; - reg = <0x0 0x8c000000 0x0 0x4000000>; + reg = <0x0 0x8cc00000 0x0 0x4000000>; }; - npu_txbufid: npu-txbufid@90000000 { + npu_txbufid: npu-txbufid@90c00000 { no-map; - reg = <0x0 0x90000000 0x0 0x6800>; + reg = <0x0 0x90c00000 0x0 0x6800>; }; }; diff --git a/target/linux/airoha/patches-6.6/999-61-net-airoha-Differentiate-hwfd-buffer-size-for-QDMA0-.patch b/target/linux/airoha/patches-6.6/999-61-net-airoha-Differentiate-hwfd-buffer-size-for-QDMA0-.patch index cf4c7f1a6d3153..522f162ebf8335 100644 --- a/target/linux/airoha/patches-6.6/999-61-net-airoha-Differentiate-hwfd-buffer-size-for-QDMA0-.patch +++ b/target/linux/airoha/patches-6.6/999-61-net-airoha-Differentiate-hwfd-buffer-size-for-QDMA0-.patch @@ -18,12 +18,11 @@ Signed-off-by: Lorenzo Bianconi --- a/drivers/net/ethernet/airoha/airoha_eth.c +++ b/drivers/net/ethernet/airoha/airoha_eth.c -@@ -1219,15 +1219,18 @@ static int airoha_qdma_init_hfwd_queues( - { +@@ -1220,20 +1220,24 @@ static int airoha_qdma_init_hfwd_queues( int size, index, num_desc = HW_DSCP_NUM; struct airoha_eth *eth = qdma->eth; -+ u32 status, buf_size, buf_size_val; int id = qdma - ð->qdma[0]; ++ u32 status, buf_size; dma_addr_t dma_addr; const char *name; - u32 status; @@ -32,31 +31,43 @@ Signed-off-by: Lorenzo Bianconi if (!name) return -ENOMEM; -+ buf_size = id ? AIROHA_MAX_PACKET_SIZE / 8 : AIROHA_MAX_PACKET_SIZE; -+ buf_size_val = id ? 3 : 0; /* QDMA0: 2KB. QDMA1: 256B */ -+ ++ buf_size = id ? AIROHA_MAX_PACKET_SIZE / 2 : AIROHA_MAX_PACKET_SIZE; index = of_property_match_string(eth->dev->of_node, "memory-region-names", name); if (index >= 0) { -@@ -1245,9 +1248,9 @@ static int airoha_qdma_init_hfwd_queues( + struct reserved_mem *rmem; + struct device_node *np; + ++ /* Consume reserved memory for hw forwarding buffers queue if ++ * available in the DTS ++ */ + np = of_parse_phandle(eth->dev->of_node, "memory-region", + index); + if (!np) +@@ -1245,9 +1249,9 @@ static int airoha_qdma_init_hfwd_queues( /* Compute the number of hw descriptors according to the * reserved memory size and the payload buffer size */ - num_desc = rmem->size / AIROHA_MAX_PACKET_SIZE; -+ num_desc = rmem->size / buf_size; ++ num_desc = div_u64(rmem->size, buf_size); } else { - size = AIROHA_MAX_PACKET_SIZE * num_desc; + size = buf_size * num_desc; if (!dmam_alloc_coherent(eth->dev, size, &dma_addr, GFP_KERNEL)) return -ENOMEM; -@@ -1262,7 +1265,8 @@ static int airoha_qdma_init_hfwd_queues( +@@ -1260,12 +1264,12 @@ static int airoha_qdma_init_hfwd_queues( + return -ENOMEM; + airoha_qdma_wr(qdma, REG_FWD_DSCP_BASE, dma_addr); ++ /* QDMA0: 2KB. QDMA1: 1KB */ airoha_qdma_rmw(qdma, REG_HW_FWD_DSCP_CFG, HW_FWD_DSCP_PAYLOAD_SIZE_MASK, - FIELD_PREP(HW_FWD_DSCP_PAYLOAD_SIZE_MASK, 0)); -+ FIELD_PREP(HW_FWD_DSCP_PAYLOAD_SIZE_MASK, -+ buf_size_val)); ++ FIELD_PREP(HW_FWD_DSCP_PAYLOAD_SIZE_MASK, !!id)); airoha_qdma_rmw(qdma, REG_FWD_DSCP_LOW_THR, FWD_DSCP_LOW_THR_MASK, FIELD_PREP(FWD_DSCP_LOW_THR_MASK, 128)); - +- + airoha_qdma_rmw(qdma, REG_LMGR_INIT_CFG, + LMGR_INIT_START | LMGR_SRAM_MODE_MASK | + HW_FWD_DESC_NUM_MASK, diff --git a/target/linux/airoha/patches-6.6/999-62-net-airoha-Enable-RX-queues-16-31.patch b/target/linux/airoha/patches-6.6/999-62-net-airoha-Enable-RX-queues-16-31.patch index b608944940eeea..47a0a28197d3ac 100644 --- a/target/linux/airoha/patches-6.6/999-62-net-airoha-Enable-RX-queues-16-31.patch +++ b/target/linux/airoha/patches-6.6/999-62-net-airoha-Enable-RX-queues-16-31.patch @@ -12,11 +12,9 @@ Signed-off-by: Lorenzo Bianconi drivers/net/ethernet/airoha/airoha_regs.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -diff --git a/drivers/net/ethernet/airoha/airoha_regs.h b/drivers/net/ethernet/airoha/airoha_regs.h -index 04187eb40ec6..150c85995cc1 100644 --- a/drivers/net/ethernet/airoha/airoha_regs.h +++ b/drivers/net/ethernet/airoha/airoha_regs.h -@@ -614,8 +614,9 @@ +@@ -635,8 +635,9 @@ RX19_DONE_INT_MASK | RX18_DONE_INT_MASK | \ RX17_DONE_INT_MASK | RX16_DONE_INT_MASK) @@ -27,6 +25,3 @@ index 04187eb40ec6..150c85995cc1 100644 #define INT_RX2_MASK(_n) \ ((RX_NO_CPU_DSCP_HIGH_INT_MASK & (_n)) | \ --- -2.49.0 -