mirror of
https://github.com/hzyitc/openwrt-redmi-ax3000.git
synced 2025-12-16 08:22:16 +00:00
ipq50xx: ethernet support
This commit is contained in:
parent
bd79476445
commit
66e73cdde5
@ -19,7 +19,7 @@ define KernelPackage/qca-nss-dp
|
||||
SECTION:=kernel
|
||||
CATEGORY:=Kernel modules
|
||||
SUBMENU:=Network Devices
|
||||
DEPENDS:=@TARGET_ipq807x +kmod-qca-ssdk
|
||||
DEPENDS:=@(TARGET_ipq50xx||TARGET_ipq807x) +kmod-qca-ssdk
|
||||
TITLE:=Qualcom NSS dataplane ethernet driver
|
||||
FILES:=$(PKG_BUILD_DIR)/qca-nss-dp.ko
|
||||
AUTOLOAD:=$(call AutoLoad,31,qca-nss-dp,1)
|
||||
|
||||
@ -13,6 +13,17 @@ Recent kernels removed them.
|
||||
hal/gmac_ops/syn/xgmac/syn_if.c | 2 +-
|
||||
3 files changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
--- a/hal/soc_ops/ipq50xx/nss_ipq50xx.c
|
||||
+++ b/hal/soc_ops/ipq50xx/nss_ipq50xx
|
||||
@@ -75,7 +75,7 @@ static void nss_dp_hal_tcsr_set(void)
|
||||
pr_err("%s: SCM TCSR write error: %d\n", __func__, err);
|
||||
}
|
||||
} else {
|
||||
- tcsr_addr = ioremap_nocache((tcsr_base + TCSR_GMAC_AXI_CACHE_OVERRIDE_OFFSET),
|
||||
+ tcsr_addr = ioremap((tcsr_base + TCSR_GMAC_AXI_CACHE_OVERRIDE_OFFSET),
|
||||
TCSR_GMAC_AXI_CACHE_OVERRIDE_REG_SIZE);
|
||||
if (!tcsr_addr) {
|
||||
pr_err("%s: ioremap failed\n", __func__);
|
||||
--- a/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c
|
||||
+++ b/hal/dp_ops/edma_dp/edma_v1/edma_data_plane.c
|
||||
@@ -279,7 +279,7 @@ int edma_init(void)
|
||||
@ -46,3 +57,14 @@ Recent kernels removed them.
|
||||
resource_size(res));
|
||||
if (!shd->nghd.mac_base) {
|
||||
netdev_dbg(ndev, "ioremap fail.\n");
|
||||
--- a/hal/gmac_ops/syn/gmac/syn_if.c
|
||||
+++ b/hal/gmac_ops/syn/gmac/syn_if.c
|
||||
@@ -806,7 +806,7 @@ static void *syn_init(struct nss_gmac_ha
|
||||
* Populate the mac base addresses
|
||||
*/
|
||||
shd->nghd.mac_base =
|
||||
- devm_ioremap_nocache(&dp_priv->pdev->dev, res->start,
|
||||
+ devm_ioremap(&dp_priv->pdev->dev, res->start,
|
||||
resource_size(res));
|
||||
if (!shd->nghd.mac_base) {
|
||||
netdev_dbg(ndev, "ioremap fail.\n");
|
||||
|
||||
@ -0,0 +1,257 @@
|
||||
From 5b9d0813e457881f4970d330dad0e974abc30b83 Mon Sep 17 00:00:00 2001
|
||||
From: hzy <hzyitc@outlook.com>
|
||||
Date: Fri, 3 Mar 2023 15:44:17 +0000
|
||||
Subject: [PATCH 1/3] WiP: use standard DMA api
|
||||
|
||||
Signed-off-by: hzy <hzyitc@outlook.com>
|
||||
---
|
||||
hal/dp_ops/syn_gmac_dp/syn_dp_cfg_rx.c | 13 ++++--
|
||||
hal/dp_ops/syn_gmac_dp/syn_dp_cfg_tx.c | 2 +
|
||||
hal/dp_ops/syn_gmac_dp/syn_dp_rx.c | 61 +++++++++++++++++++-------
|
||||
hal/dp_ops/syn_gmac_dp/syn_dp_tx.c | 23 +++-------
|
||||
4 files changed, 63 insertions(+), 36 deletions(-)
|
||||
|
||||
diff --git a/hal/dp_ops/syn_gmac_dp/syn_dp_cfg_rx.c b/hal/dp_ops/syn_gmac_dp/syn_dp_cfg_rx.c
|
||||
index 3153b2ef..2f23c4cb 100644
|
||||
--- a/hal/dp_ops/syn_gmac_dp/syn_dp_cfg_rx.c
|
||||
+++ b/hal/dp_ops/syn_gmac_dp/syn_dp_cfg_rx.c
|
||||
@@ -34,13 +34,15 @@ static int syn_dp_cfg_rx_setup_desc_queue(struct syn_dp_info *dev_info)
|
||||
/*
|
||||
* Allocate cacheable descriptors for Rx
|
||||
*/
|
||||
- first_desc = kzalloc(sizeof(struct dma_desc_rx) * SYN_DP_RX_DESC_SIZE, GFP_KERNEL);
|
||||
+ first_desc = dma_alloc_coherent(rx_info->dev,
|
||||
+ sizeof(struct dma_desc_rx) * SYN_DP_RX_DESC_SIZE,
|
||||
+ &dma_addr, GFP_KERNEL);
|
||||
if (!first_desc) {
|
||||
netdev_dbg(netdev, "Error in Rx Descriptor Memory allocation in Ring mode\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
- dev_info->rx_desc_dma_addr = (dma_addr_t)virt_to_phys(first_desc);
|
||||
+ dev_info->rx_desc_dma_addr = dma_addr;
|
||||
rx_info->rx_desc = first_desc;
|
||||
syn_dp_gmac_rx_desc_init_ring(rx_info->rx_desc, SYN_DP_RX_DESC_SIZE);
|
||||
|
||||
@@ -99,6 +101,10 @@ void syn_dp_cfg_rx_cleanup_rings(struct syn_dp_info *dev_info)
|
||||
for (i = 0; i < rx_info->busy_rx_desc_cnt; i++) {
|
||||
rx_skb_index = (rx_skb_index + i) & SYN_DP_RX_DESC_MAX_INDEX;
|
||||
rxdesc = rx_info->rx_desc;
|
||||
+
|
||||
+ dma_unmap_single(rx_info->dev, rxdesc->buffer1,
|
||||
+ rxdesc->length, DMA_FROM_DEVICE);
|
||||
+
|
||||
skb = rx_info->rx_buf_pool[rx_skb_index].skb;
|
||||
if (unlikely(skb != NULL)) {
|
||||
dev_kfree_skb_any(skb);
|
||||
@@ -106,7 +112,8 @@ void syn_dp_cfg_rx_cleanup_rings(struct syn_dp_info *dev_info)
|
||||
}
|
||||
}
|
||||
|
||||
- kfree(rx_info->rx_desc);
|
||||
+ dma_free_coherent(rx_info->dev, (sizeof(struct dma_desc_rx) * SYN_DP_RX_DESC_SIZE),
|
||||
+ rx_info->rx_desc, dev_info->rx_desc_dma_addr);
|
||||
rx_info->rx_desc = NULL;
|
||||
dev_info->rx_desc_dma_addr = (dma_addr_t)0;
|
||||
}
|
||||
diff --git a/hal/dp_ops/syn_gmac_dp/syn_dp_cfg_tx.c b/hal/dp_ops/syn_gmac_dp/syn_dp_cfg_tx.c
|
||||
index bf5e19a0..284e8880 100644
|
||||
--- a/hal/dp_ops/syn_gmac_dp/syn_dp_cfg_tx.c
|
||||
+++ b/hal/dp_ops/syn_gmac_dp/syn_dp_cfg_tx.c
|
||||
@@ -91,6 +91,8 @@ void syn_dp_cfg_tx_cleanup_rings(struct syn_dp_info *dev_info)
|
||||
tx_skb_index = syn_dp_tx_inc_index(tx_skb_index, i);
|
||||
txdesc = tx_info->tx_desc;
|
||||
|
||||
+ dma_unmap_single(tx_info->dev, txdesc->buffer1, txdesc->length, DMA_TO_DEVICE);
|
||||
+
|
||||
skb = tx_info->tx_buf_pool[tx_skb_index].skb;
|
||||
if (unlikely(skb != NULL)) {
|
||||
dev_kfree_skb_any(skb);
|
||||
diff --git a/hal/dp_ops/syn_gmac_dp/syn_dp_rx.c b/hal/dp_ops/syn_gmac_dp/syn_dp_rx.c
|
||||
index 1ddeb7d6..fff25538 100644
|
||||
--- a/hal/dp_ops/syn_gmac_dp/syn_dp_rx.c
|
||||
+++ b/hal/dp_ops/syn_gmac_dp/syn_dp_rx.c
|
||||
@@ -73,17 +73,27 @@ static inline void syn_dp_rx_refill_one_desc(struct dma_desc_rx *rx_desc,
|
||||
*/
|
||||
static inline void syn_dp_rx_inval_and_flush(struct syn_dp_info_rx *rx_info, uint32_t start, uint32_t end)
|
||||
{
|
||||
+ int dma_size;
|
||||
+
|
||||
/*
|
||||
- * Batched flush and invalidation of the rx descriptors
|
||||
+ * flush and invalidation of the rx descriptors
|
||||
*/
|
||||
if (end > start) {
|
||||
- dmac_flush_range_no_dsb((void *)&rx_info->rx_desc[start], (void *)&rx_info->rx_desc[end] + sizeof(struct dma_desc_rx));
|
||||
+ dma_size = sizeof(struct dma_desc_rx) * (end - start + 1);
|
||||
+ dma_sync_single_for_device(rx_info->dev,
|
||||
+ rx_info->rx_desc[start].buffer1,
|
||||
+ dma_size, DMA_FROM_DEVICE);
|
||||
} else {
|
||||
- dmac_flush_range_no_dsb((void *)&rx_info->rx_desc[start], (void *)&rx_info->rx_desc[SYN_DP_RX_DESC_MAX_INDEX] + sizeof(struct dma_desc_rx));
|
||||
- dmac_flush_range_no_dsb((void *)&rx_info->rx_desc[0], (void *)&rx_info->rx_desc[end] + sizeof(struct dma_desc_rx));
|
||||
+ dma_size = sizeof(struct dma_desc_rx) * (SYN_DP_RX_DESC_MAX_INDEX - start + 1);
|
||||
+ dma_sync_single_for_device(rx_info->dev,
|
||||
+ rx_info->rx_desc[start].buffer1,
|
||||
+ dma_size, DMA_FROM_DEVICE);
|
||||
+
|
||||
+ dma_size = sizeof(struct dma_desc_rx) * (end + 1);
|
||||
+ dma_sync_single_for_device(rx_info->dev,
|
||||
+ rx_info->rx_desc[0].buffer1,
|
||||
+ dma_size, DMA_FROM_DEVICE);
|
||||
}
|
||||
-
|
||||
- dsb(st);
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -127,12 +137,15 @@ int syn_dp_rx_refill_page_mode(struct syn_dp_info_rx *rx_info)
|
||||
/*
|
||||
* Get virtual address of allocated page.
|
||||
*/
|
||||
- page_addr = page_address(pg);
|
||||
- dma_addr = (dma_addr_t)virt_to_phys(page_addr);
|
||||
+ dma_addr = dma_map_page(rx_info->dev, pg, 0, rx_info->alloc_buf_len, DMA_FROM_DEVICE);
|
||||
+ if (unlikely(dma_mapping_error(rx_info->dev, dma_addr))) {
|
||||
+ dev_kfree_skb(skb);
|
||||
+ netdev_dbg(netdev, "DMA mapping failed for empty buffer\n");
|
||||
+ break;
|
||||
+ }
|
||||
|
||||
skb_fill_page_desc(skb, 0, pg, 0, PAGE_SIZE);
|
||||
|
||||
- dmac_inv_range_no_dsb(page_addr, (page_addr + PAGE_SIZE));
|
||||
rx_refill_idx = rx_info->rx_refill_idx;
|
||||
rx_desc = rx_info->rx_desc + rx_refill_idx;
|
||||
|
||||
@@ -181,8 +194,13 @@ int syn_dp_rx_refill(struct syn_dp_info_rx *rx_info)
|
||||
|
||||
skb_reserve(skb, SYN_DP_SKB_HEADROOM + NET_IP_ALIGN);
|
||||
|
||||
- dma_addr = (dma_addr_t)virt_to_phys(skb->data);
|
||||
- dmac_inv_range_no_dsb((void *)skb->data, (void *)(skb->data + inval_len));
|
||||
+ dma_addr = dma_map_single(rx_info->dev, skb->data, rx_info->alloc_buf_len, DMA_FROM_DEVICE);
|
||||
+ if (unlikely(dma_mapping_error(rx_info->dev, dma_addr))) {
|
||||
+ dev_kfree_skb(skb);
|
||||
+ netdev_dbg(netdev, "DMA mapping failed for empty buffer\n");
|
||||
+ break;
|
||||
+ }
|
||||
+
|
||||
rx_refill_idx = rx_info->rx_refill_idx;
|
||||
rx_desc = rx_info->rx_desc + rx_refill_idx;
|
||||
|
||||
@@ -381,6 +399,7 @@ int syn_dp_rx(struct syn_dp_info_rx *rx_info, int budget)
|
||||
struct dma_desc_rx *rx_desc_next = NULL;
|
||||
uint8_t *next_skb_ptr;
|
||||
skb_frag_t *frag = NULL;
|
||||
+ int dma_size;
|
||||
|
||||
busy = atomic_read((atomic_t *)&rx_info->busy_rx_desc_cnt);
|
||||
if (unlikely(!busy)) {
|
||||
@@ -408,10 +427,20 @@ int syn_dp_rx(struct syn_dp_info_rx *rx_info, int budget)
|
||||
*/
|
||||
end = syn_dp_rx_inc_index(rx_info->rx_idx, busy);
|
||||
if (end > start) {
|
||||
- dmac_inv_range_no_dsb((void *)&rx_info->rx_desc[start], (void *)&rx_info->rx_desc[end] + sizeof(struct dma_desc_rx));
|
||||
+ dma_size = sizeof(struct dma_desc_rx) * (end - start + 1);
|
||||
+ dma_sync_single_for_cpu(rx_info->dev,
|
||||
+ rx_info->rx_desc[start].buffer1,
|
||||
+ dma_size, DMA_FROM_DEVICE);
|
||||
} else {
|
||||
- dmac_inv_range_no_dsb((void *)&rx_info->rx_desc[start], (void *)&rx_info->rx_desc[SYN_DP_RX_DESC_MAX_INDEX] + sizeof(struct dma_desc_rx));
|
||||
- dmac_inv_range_no_dsb((void *)&rx_info->rx_desc[0], (void *)&rx_info->rx_desc[end] + sizeof(struct dma_desc_rx));
|
||||
+ dma_size = sizeof(struct dma_desc_rx) * (SYN_DP_RX_DESC_MAX_INDEX - start + 1);
|
||||
+ dma_sync_single_for_cpu(rx_info->dev,
|
||||
+ rx_info->rx_desc[start].buffer1,
|
||||
+ dma_size, DMA_FROM_DEVICE);
|
||||
+
|
||||
+ dma_size = sizeof(struct dma_desc_rx) * (end + 1);
|
||||
+ dma_sync_single_for_cpu(rx_info->dev,
|
||||
+ rx_info->rx_desc[0].buffer1,
|
||||
+ dma_size, DMA_FROM_DEVICE);
|
||||
}
|
||||
|
||||
dsb(st);
|
||||
@@ -439,8 +468,8 @@ int syn_dp_rx(struct syn_dp_info_rx *rx_info, int budget)
|
||||
* speculative prefetch by CPU may have occurred.
|
||||
*/
|
||||
frame_length = syn_dp_gmac_get_rx_desc_frame_length(status);
|
||||
- dmac_inv_range((void *)rx_buf->map_addr_virt,
|
||||
- (void *)(((uint8_t *)rx_buf->map_addr_virt) + frame_length));
|
||||
+ dma_sync_single_for_cpu(rx_info->dev, rx_desc->buffer1,
|
||||
+ frame_length, DMA_FROM_DEVICE);
|
||||
prefetch((void *)rx_buf->map_addr_virt);
|
||||
|
||||
rx_next_idx = syn_dp_rx_inc_index(rx_idx, 1);
|
||||
diff --git a/hal/dp_ops/syn_gmac_dp/syn_dp_tx.c b/hal/dp_ops/syn_gmac_dp/syn_dp_tx.c
|
||||
index c97e252b..6d4adb3f 100644
|
||||
--- a/hal/dp_ops/syn_gmac_dp/syn_dp_tx.c
|
||||
+++ b/hal/dp_ops/syn_gmac_dp/syn_dp_tx.c
|
||||
@@ -104,9 +104,7 @@ static inline struct dma_desc_tx *syn_dp_tx_process_nr_frags(struct syn_dp_info_
|
||||
BUG_ON(!length);
|
||||
#endif
|
||||
|
||||
- dma_addr = (dma_addr_t)virt_to_phys(frag_addr);
|
||||
-
|
||||
- dmac_clean_range_no_dsb(frag_addr, frag_addr + length);
|
||||
+ dma_addr = dma_map_single(tx_info->dev, frag_addr, length, DMA_TO_DEVICE);
|
||||
|
||||
*total_length += length;
|
||||
tx_desc = syn_dp_tx_set_desc_sg(tx_info, dma_addr, length, DESC_OWN_BY_DMA);
|
||||
@@ -150,8 +148,7 @@ int syn_dp_tx_nr_frags(struct syn_dp_info_tx *tx_info, struct sk_buff *skb)
|
||||
/*
|
||||
* Flush the dma for non-paged skb data
|
||||
*/
|
||||
- dma_addr = (dma_addr_t)virt_to_phys(skb->data);
|
||||
- dmac_clean_range_no_dsb((void *)skb->data, (void *)(skb->data + length));
|
||||
+ dma_addr = dma_map_single(tx_info->dev, skb->data, length, DMA_TO_DEVICE);
|
||||
|
||||
total_len = length;
|
||||
|
||||
@@ -256,12 +253,7 @@ int syn_dp_tx_frag_list(struct syn_dp_info_tx *tx_info, struct sk_buff *skb)
|
||||
return NETDEV_TX_BUSY;
|
||||
}
|
||||
|
||||
- dma_addr = (dma_addr_t)virt_to_phys(skb->data);
|
||||
-
|
||||
- /*
|
||||
- * Flush the data area of the head skb
|
||||
- */
|
||||
- dmac_clean_range_no_dsb((void *)skb->data, (void *)(skb->data + length));
|
||||
+ dma_addr = dma_map_single(tx_info->dev, skb->data, length, DMA_TO_DEVICE);
|
||||
|
||||
total_len = length;
|
||||
|
||||
@@ -290,9 +282,7 @@ int syn_dp_tx_frag_list(struct syn_dp_info_tx *tx_info, struct sk_buff *skb)
|
||||
BUG_ON(!length);
|
||||
#endif
|
||||
|
||||
- dma_addr = (dma_addr_t)virt_to_phys(iter_skb->data);
|
||||
-
|
||||
- dmac_clean_range_no_dsb((void *)iter_skb->data, (void *)(iter_skb->data + length));
|
||||
+ dma_addr = dma_map_single(tx_info->dev, iter_skb->data, length, DMA_TO_DEVICE);
|
||||
|
||||
total_len += length;
|
||||
|
||||
@@ -445,6 +435,7 @@ int syn_dp_tx_complete(struct syn_dp_info_tx *tx_info, int budget)
|
||||
break;
|
||||
}
|
||||
|
||||
+ dma_unmap_single(tx_info->dev, desc->buffer1, desc->length, DMA_TO_DEVICE);
|
||||
|
||||
if (likely(status & DESC_TX_LAST)) {
|
||||
tx_skb_index = syn_dp_tx_comp_index_get(tx_info);
|
||||
@@ -571,9 +562,7 @@ int syn_dp_tx(struct syn_dp_info_tx *tx_info, struct sk_buff *skb)
|
||||
return NETDEV_TX_BUSY;
|
||||
}
|
||||
|
||||
- dma_addr = (dma_addr_t)virt_to_phys(skb->data);
|
||||
-
|
||||
- dmac_clean_range_no_dsb((void *)skb->data, (void *)(skb->data + skb->len));
|
||||
+ dma_addr = dma_map_single(tx_info->dev, skb->data, skb->len, DMA_TO_DEVICE);
|
||||
|
||||
/*
|
||||
* Queue packet to the GMAC rings
|
||||
--
|
||||
2.40.1
|
||||
|
||||
@ -0,0 +1,32 @@
|
||||
From 7c2988d4cdb06acc86c75f9aa1088c35b0b2541f Mon Sep 17 00:00:00 2001
|
||||
From: hzy <hzyitc@outlook.com>
|
||||
Date: Fri, 3 Mar 2023 15:43:06 +0000
|
||||
Subject: [PATCH 2/3] Use corrent scm function to write tcsr
|
||||
|
||||
Signed-off-by: hzy <hzyitc@outlook.com>
|
||||
---
|
||||
hal/soc_ops/ipq50xx/nss_ipq50xx.c | 7 +------
|
||||
1 file changed, 1 insertion(+), 6 deletions(-)
|
||||
|
||||
diff --git a/hal/soc_ops/ipq50xx/nss_ipq50xx.c b/hal/soc_ops/ipq50xx/nss_ipq50xx.c
|
||||
index b5a9783c..e0bad95f 100644
|
||||
--- a/hal/soc_ops/ipq50xx/nss_ipq50xx.c
|
||||
+++ b/hal/soc_ops/ipq50xx/nss_ipq50xx.c
|
||||
@@ -69,13 +69,8 @@ static void nss_dp_hal_tcsr_set(void)
|
||||
* If TZ is not enabled, we can write to the register directly.
|
||||
*/
|
||||
if (qcom_scm_is_available()) {
|
||||
-#if (LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0))
|
||||
- err = qcom_scm_tcsr_reg_write((tcsr_base + TCSR_GMAC_AXI_CACHE_OVERRIDE_OFFSET),
|
||||
+ err = qcom_scm_io_writel((tcsr_base + TCSR_GMAC_AXI_CACHE_OVERRIDE_OFFSET),
|
||||
TCSR_GMAC_AXI_CACHE_OVERRIDE_VALUE);
|
||||
-#else
|
||||
- err = qti_scm_tcsr_reg_write((tcsr_base + TCSR_GMAC_AXI_CACHE_OVERRIDE_OFFSET),
|
||||
- TCSR_GMAC_AXI_CACHE_OVERRIDE_VALUE);
|
||||
-#endif
|
||||
if (err) {
|
||||
pr_err("%s: SCM TCSR write error: %d\n", __func__, err);
|
||||
}
|
||||
--
|
||||
2.40.1
|
||||
|
||||
26
package/kernel/qca-nss-dp/patches/0103-Fix-build-issue.patch
Normal file
26
package/kernel/qca-nss-dp/patches/0103-Fix-build-issue.patch
Normal file
@ -0,0 +1,26 @@
|
||||
From 9be837e01a1b67a3fe3d87764c8a9beaa025cb98 Mon Sep 17 00:00:00 2001
|
||||
From: hzy <hzyitc@outlook.com>
|
||||
Date: Tue, 7 Mar 2023 13:11:20 +0000
|
||||
Subject: [PATCH 3/3] Fix build issue
|
||||
|
||||
Signed-off-by: hzy <hzyitc@outlook.com>
|
||||
---
|
||||
nss_dp_main.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/nss_dp_main.c b/nss_dp_main.c
|
||||
index cc16a6f2..0a70c2db 100644
|
||||
--- a/nss_dp_main.c
|
||||
+++ b/nss_dp_main.c
|
||||
@@ -814,7 +814,7 @@ static int32_t nss_dp_probe(struct platform_device *pdev)
|
||||
}
|
||||
|
||||
netdev_info(netdev, "Registered netdev %s(qcom-id:%d)\n",
|
||||
- netdev->name, port_id);
|
||||
+ netdev->name, dp_priv->macid);
|
||||
|
||||
dp_global_ctx.nss_dp[dp_priv->macid - 1] = dp_priv;
|
||||
dp_global_ctx.slowproto_acl_bm = 0;
|
||||
--
|
||||
2.40.1
|
||||
|
||||
@ -20,7 +20,7 @@ define KernelPackage/qca-ssdk
|
||||
CATEGORY:=Kernel modules
|
||||
SUBMENU:=Network Devices
|
||||
TITLE:=Qualcom SSDK switch driver
|
||||
DEPENDS:=@(TARGET_ipq807x)
|
||||
DEPENDS:=@(TARGET_ipq50xx||TARGET_ipq807x)
|
||||
FILES:=$(PKG_BUILD_DIR)/build/bin/qca-ssdk.ko
|
||||
AUTOLOAD:=$(call AutoLoad,30,qca-ssdk)
|
||||
endef
|
||||
@ -49,8 +49,13 @@ MAKE_FLAGS+= \
|
||||
TARGET_SUFFIX=$(CONFIG_TARGET_SUFFIX) \
|
||||
GCC_VERSION=$(GCC_VERSION) \
|
||||
EXTRA_CFLAGS=-fno-stack-protector -I$(STAGING_DIR)/usr/include \
|
||||
SoC="$(CONFIG_TARGET_BOARD)" \
|
||||
$(LNX_CONFIG_OPTS)
|
||||
|
||||
ifeq ($(CONFIG_TARGET_BOARD), "ipq50xx")
|
||||
MAKE_FLAGS+= CHIP_TYPE=MP MINI_SSDK=enable ISISC_ENABLE=enable PTP_FEATURE=disable
|
||||
endif
|
||||
|
||||
ifeq ($(CONFIG_TARGET_BOARD), "ipq807x")
|
||||
MAKE_FLAGS+= CHIP_TYPE=HPPE PTP_FEATURE=disable SWCONFIG_FEATURE=disable
|
||||
endif
|
||||
|
||||
@ -25,6 +25,24 @@ Signed-off-by: Robert Marko <robimarko@gmail.com>
|
||||
ifeq ($(KVER), 3.4.0)
|
||||
OS_VER=3_4
|
||||
endif
|
||||
@@ -122,7 +126,7 @@ ifeq ($(ARCH), arm)
|
||||
ifeq ($(KVER), 3.18.21)
|
||||
CPU_CFLAG=-D__LINUX_ARM_ARCH__=7 -DMODULE -fno-common -DCONFIG_MMU -D$(BOARD_NAME)
|
||||
endif
|
||||
- ifeq ($(KVER),$(filter 4.4% 5.4%,$(KVER)))
|
||||
+ ifeq ($(KVER),$(filter 4.4% 5.4% 5.15%,$(KVER)))
|
||||
CPU_CFLAG=-D__LINUX_ARM_ARCH__=7 -DMODULE -fno-common -DCONFIG_MMU -D$(BOARD_NAME)
|
||||
endif
|
||||
|
||||
@@ -130,7 +130,7 @@ ifeq ($(ARCH), arm)
|
||||
CPU_CFLAG= -DMODULE -nostdinc -D$(BOARD_NAME) -mlittle-endian -Wundef -Wstrict-prototypes -Wno-trigraphs -Werror -fno-strict-aliasing -fno-common -Wno-format-security -fno-delete-null-pointer-checks -O2 -fno-dwarf2-cfi-asm -mabi=aapcs-linux -mno-thumb-interwork -mfpu=vfp -funwind-tables -marm -D__LINUX_ARM_ARCH__=7 -march=armv7-a -msoft-float -Uarm -Wframe-larger-than=1024 -fno-stack-protector -Wno-unused-but-set-variable -fomit-frame-pointer -g -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -Werror=implicit-int -DCC_HAVE_ASM_GOTO -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(mem)"
|
||||
endif
|
||||
|
||||
- ifeq ($(KVER),$(filter 4.9% 4.4% 5.4%,$(KVER)))
|
||||
+ ifeq ($(KVER),$(filter 4.9% 4.4% 5.4% 5.15%,$(KVER)))
|
||||
CPU_CFLAG= -DMODULE -nostdinc -D$(BOARD_NAME) -mlittle-endian -Wundef -Wstrict-prototypes -Wno-trigraphs -Werror -fno-strict-aliasing -fno-common -Wno-format-security -fno-delete-null-pointer-checks -Os -fno-dwarf2-cfi-asm -mabi=aapcs-linux -mno-thumb-interwork -mfpu=vfp -funwind-tables -marm -D__LINUX_ARM_ARCH__=7 -march=armv7-a -msoft-float -Uarm -Wframe-larger-than=2048 -fno-stack-protector -Wno-unused-but-set-variable -fomit-frame-pointer -g -Wdeclaration-after-statement -Wno-pointer-sign -fno-strict-overflow -fconserve-stack -Werror=implicit-int -DCC_HAVE_ASM_GOTO -D"KBUILD_STR(s)=\#s" -D"KBUILD_BASENAME=KBUILD_STR(mem)"
|
||||
endif
|
||||
|
||||
@@ -132,7 +136,7 @@ ifeq ($(ARCH), arm)
|
||||
endif
|
||||
|
||||
|
||||
@ -0,0 +1,26 @@
|
||||
From 70d9436e4019dd9eddb664d53ee85cb87a0d8772 Mon Sep 17 00:00:00 2001
|
||||
From: hzy <hzyitc@outlook.com>
|
||||
Date: Thu, 9 Mar 2023 15:14:20 +0000
|
||||
Subject: [PATCH 1/4] Remove uncessary header file
|
||||
|
||||
Signed-off-by: hzy <hzyitc@outlook.com>
|
||||
---
|
||||
src/init/ssdk_clk.c | 2 +-
|
||||
1 file changed, 1 insertion(+), 1 deletion(-)
|
||||
|
||||
diff --git a/src/init/ssdk_clk.c b/src/init/ssdk_clk.c
|
||||
index ee9fbdda..b419f906 100755
|
||||
--- a/src/init/ssdk_clk.c
|
||||
+++ b/src/init/ssdk_clk.c
|
||||
@@ -31,7 +31,7 @@
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/clkdev.h>
|
||||
#endif
|
||||
-#if (LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,0))
|
||||
+#if defined(APPE) && (LINUX_VERSION_CODE >= KERNEL_VERSION(5,4,0))
|
||||
#include <soc/qcom/socinfo.h>
|
||||
#endif
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -0,0 +1,44 @@
|
||||
From 0d11c6be51766f6603bbf659881b98a6572b275a Mon Sep 17 00:00:00 2001
|
||||
From: hzy <hzyitc@outlook.com>
|
||||
Date: Sat, 13 May 2023 17:23:46 +0000
|
||||
Subject: [PATCH 4/4] Drop switch_ext support
|
||||
|
||||
Signed-off-by: hzy <hzyitc@outlook.com>
|
||||
---
|
||||
src/init/ssdk_init.c | 6 ------
|
||||
src/ref/Makefile | 2 +-
|
||||
2 files changed, 1 insertion(+), 7 deletions(-)
|
||||
|
||||
diff --git a/src/init/ssdk_init.c b/src/init/ssdk_init.c
|
||||
index 0d7cac41..3626ac10 100755
|
||||
--- a/src/init/ssdk_init.c
|
||||
+++ b/src/init/ssdk_init.c
|
||||
@@ -1150,12 +1150,6 @@ static struct switch_attr qca_ar8327_globals[] = {
|
||||
.get = qca_ar8327_sw_atu_dump,
|
||||
},
|
||||
#endif
|
||||
- {
|
||||
- .name = "switch_ext",
|
||||
- .description = "Switch extended configuration",
|
||||
- .type = SWITCH_TYPE_EXT,
|
||||
- .set = qca_ar8327_sw_switch_ext,
|
||||
- },
|
||||
};
|
||||
|
||||
static struct switch_attr qca_ar8327_port[] = {
|
||||
diff --git a/src/ref/Makefile b/src/ref/Makefile
|
||||
index ac1a0c2a..f9e6840a 100755
|
||||
--- a/src/ref/Makefile
|
||||
+++ b/src/ref/Makefile
|
||||
@@ -3,7 +3,7 @@ LIB=REF
|
||||
|
||||
include $(PRJ_PATH)/make/config.mk
|
||||
|
||||
-SRC_LIST_TMP=ref_uci.c
|
||||
+SRC_LIST_TMP=
|
||||
SRC_SW_LIST=ref_misc.c ref_uci.c
|
||||
|
||||
ifeq (TRUE, $(IN_FDB))
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -15,6 +15,7 @@ KERNELNAME:=Image dtbs
|
||||
|
||||
DEFAULT_PACKAGES += \
|
||||
kmod-gpio-button-hotplug \
|
||||
uboot-envtools
|
||||
uboot-envtools \
|
||||
kmod-qca-nss-dp swconfig
|
||||
|
||||
$(eval $(call BuildTarget))
|
||||
|
||||
@ -1295,3 +1295,5 @@ CONFIG_FW_CACHE=y
|
||||
CONFIG_ARCH_IPQ50XX=y
|
||||
CONFIG_QCOM_SCM_DOWNLOAD_MODE_DEFAULT=y
|
||||
# CONFIG_MTD_UBI_GLUEBI is not set
|
||||
CONFIG_MDIO_IPQ4019=y
|
||||
CONFIG_BRIDGE_VLAN_FILTERING=y
|
||||
|
||||
@ -0,0 +1,49 @@
|
||||
From b9cc3658c5ebcbe8f79a4488448ea7feaf198392 Mon Sep 17 00:00:00 2001
|
||||
From: zhongjia <zhongjia@codeaurora.org>
|
||||
Date: Tue, 24 Nov 2020 23:48:00 +0800
|
||||
Subject: [PATCH] gcc: ipq5018: fix reset issue for uniphy and gephy
|
||||
|
||||
Change-Id: I771b59f59ba7f15e43f6ca739f947d7bffcf5cf3
|
||||
Signed-off-by: zhongjia <zhongjia@codeaurora.org>
|
||||
|
||||
Pick from https://git.codelinaro.org/clo/qsdk/oss/kernel/linux-ipq-5.4/-/commit/00743c3e82fa87cba4460e7a2ba32f473a9ce932
|
||||
|
||||
Signed-off-by: hzy <hzyitc@outlook.com>
|
||||
---
|
||||
drivers/clk/qcom/gcc-ipq5018.c | 6 +++---
|
||||
1 file changed, 3 insertions(+), 3 deletions(-)
|
||||
|
||||
diff --git a/drivers/clk/qcom/gcc-ipq5018.c b/drivers/clk/qcom/gcc-ipq5018.c
|
||||
index 9056386ae134..2f6672d0d844 100644
|
||||
--- a/drivers/clk/qcom/gcc-ipq5018.c
|
||||
+++ b/drivers/clk/qcom/gcc-ipq5018.c
|
||||
@@ -3648,7 +3648,7 @@ static const struct qcom_reset_map gcc_ipq5018_resets[] = {
|
||||
[GCC_DDRSS_BCR] = { 0x1e000, 0 },
|
||||
[GCC_EDPD_BCR] = { 0x3a000, 0 },
|
||||
[GCC_GEPHY_BCR] = { 0x56000, 0 },
|
||||
- [GCC_GEPHY_MDC_SW_ARES] = { 0x56004, 0 },
|
||||
+ [GCC_GEPHY_MDC_SW_ARES] = { 0x56004, .bitmask = 0x3 },
|
||||
[GCC_GEPHY_DSP_HW_ARES] = { 0x56004, 1 },
|
||||
[GCC_GEPHY_RX_ARES] = { 0x56004, 2 },
|
||||
[GCC_GEPHY_TX_ARES] = { 0x56004, 3 },
|
||||
@@ -3728,7 +3728,7 @@ static const struct qcom_reset_map gcc_ipq5018_resets[] = {
|
||||
[GCC_UNIPHY_SYS_ARES] = { 0x56104, 1 },
|
||||
[GCC_UNIPHY_RX_ARES] = { 0x56104, 4 },
|
||||
[GCC_UNIPHY_TX_ARES] = { 0x56104, 5 },
|
||||
- [GCC_UNIPHY_SOFT_RESET] = {0x56104, 0 },
|
||||
+ [GCC_UNIPHY_SOFT_RESET] = { 0x56104, .bitmask = 0x32 },
|
||||
[GCC_USB0_BCR] = { 0x3e070, 0 },
|
||||
[GCC_USB0_PHY_BCR] = { 0x3e034, 0 },
|
||||
[GCC_WCSS_BCR] = { 0x18000, 0 },
|
||||
@@ -3741,7 +3741,7 @@ static const struct qcom_reset_map gcc_ipq5018_resets[] = {
|
||||
[GCC_WCSS_AXI_S_ARES] = { 0x59008, 6 },
|
||||
[GCC_WCSS_Q6_BCR] = { 0x18004, 0 },
|
||||
[GCC_WCSSAON_RESET] = { 0x59010, 0},
|
||||
- [GCC_GEPHY_MISC_ARES] = { 0x56004, 0 },
|
||||
+ [GCC_GEPHY_MISC_ARES] = { 0x56004, .bitmask = 0xf },
|
||||
};
|
||||
|
||||
static const struct of_device_id gcc_ipq5018_match_table[] = {
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -0,0 +1,174 @@
|
||||
From 1c1e28ecb9940bf6708cd833ac392b877f3c1c8e Mon Sep 17 00:00:00 2001
|
||||
From: Praveenkumar I <ipkumar@codeaurora.org>
|
||||
Date: Wed, 12 Jul 2017 21:33:32 +0530
|
||||
Subject: [PATCH 1/1] clk: qcom: support for duplicate freq in RCG2 freq table
|
||||
MIME-Version: 1.0
|
||||
Content-Type: text/plain; charset=UTF-8
|
||||
Content-Transfer-Encoding: 8bit
|
||||
|
||||
Currently RCG code looks up the frequency table during set
|
||||
rate and return the first available frequency greater than
|
||||
requested rate. If CLK_SET_RATE_PARENT flag is set then the
|
||||
set_rate request will go to its parent otherwise the clock
|
||||
framework will configure pre-div, m and n according to the
|
||||
returned frequency table entry. In this case, it is assuming
|
||||
that parent clock will run in the same frequency with which
|
||||
pre-div, m and n has been derived. But it may be possible
|
||||
that the parent clock supports multiple frequency and the
|
||||
same frequency can be derived with different pre-div, m and
|
||||
n values depending upon current frequency. Also, the same
|
||||
frequency can be derived from different parent sources and
|
||||
currently there is no option for having duplicate
|
||||
frequencies in frequency table and choosing the best one
|
||||
according to current rate.
|
||||
|
||||
Now this patch adds the support for having duplicate
|
||||
frequencies in frequency table. During set rate, it will
|
||||
compare the actual rate for each entry with requested rate
|
||||
and will select the best entry in which the difference will
|
||||
be less.
|
||||
|
||||
The existing functionality won’t be affected with this code
|
||||
change since this code change will hit only if frequency
|
||||
table has duplicate values.
|
||||
|
||||
Change-Id: I97d9e1b55d8f3ee095f6f01729af527ba90e50e5
|
||||
Signed-off-by: Abhishek Sahu <absahu@codeaurora.org>
|
||||
(cherry picked from commit 775e7d3b69ffc97afb5bd5a6c9c423f2f4d8a0b2)
|
||||
Signed-off-by: Praveenkumar I <ipkumar@codeaurora.org>
|
||||
|
||||
Change-Id: If10193fc79a3c1375ab73597813745ff1f4df0ad
|
||||
|
||||
Pick from https://git.codelinaro.org/clo/qsdk/oss/kernel/linux-ipq-5.4/-/commit/6dfb368bae130bee58e00ddf8330b55066e1c8c5
|
||||
|
||||
Signed-off-by: hzy <hzyitc@outlook.com>
|
||||
---
|
||||
drivers/clk/qcom/clk-rcg2.c | 86 ++++++++++++++++++++++++++++---------
|
||||
1 file changed, 66 insertions(+), 20 deletions(-)
|
||||
|
||||
diff --git a/drivers/clk/qcom/clk-rcg2.c b/drivers/clk/qcom/clk-rcg2.c
|
||||
index 89c1adeb84d4..3f2ef7e8d8c8 100644
|
||||
--- a/drivers/clk/qcom/clk-rcg2.c
|
||||
+++ b/drivers/clk/qcom/clk-rcg2.c
|
||||
@@ -188,26 +188,82 @@ clk_rcg2_recalc_rate(struct clk_hw *hw, unsigned long parent_rate)
|
||||
return calc_rate(parent_rate, m, n, mode, hid_div);
|
||||
}
|
||||
|
||||
-static int _freq_tbl_determine_rate(struct clk_hw *hw, const struct freq_tbl *f,
|
||||
- struct clk_rate_request *req,
|
||||
- enum freq_policy policy)
|
||||
+static const struct freq_tbl *
|
||||
+clk_rcg2_find_best_freq(struct clk_hw *hw, const struct freq_tbl *f,
|
||||
+ unsigned long rate, enum freq_policy policy)
|
||||
{
|
||||
- unsigned long clk_flags, rate = req->rate;
|
||||
- struct clk_hw *p;
|
||||
+ unsigned long req_rate = rate, best = 0, freq;
|
||||
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
|
||||
int index;
|
||||
+ u64 tmp;
|
||||
+ const struct freq_tbl *best_ftable = NULL;
|
||||
|
||||
switch (policy) {
|
||||
case FLOOR:
|
||||
- f = qcom_find_freq_floor(f, rate);
|
||||
+ f = qcom_find_freq_floor(rcg->freq_tbl, rate);
|
||||
break;
|
||||
case CEIL:
|
||||
- f = qcom_find_freq(f, rate);
|
||||
+ f = qcom_find_freq(rcg->freq_tbl, rate);
|
||||
break;
|
||||
default:
|
||||
- return -EINVAL;
|
||||
+ return best_ftable;
|
||||
}
|
||||
|
||||
+ /*
|
||||
+ * Check for duplicate frequencies in frequency table if
|
||||
+ * CLK_SET_RATE_PARENT flag is not set
|
||||
+ */
|
||||
+ if (!f || (clk_hw_get_flags(hw) & CLK_SET_RATE_PARENT) ||
|
||||
+ ((f->freq && (f + 1)->freq != f->freq)))
|
||||
+ return f;
|
||||
+
|
||||
+ /*
|
||||
+ * Check for all the duplicate entries in frequency table and
|
||||
+ * calculate the actual rate from current parent rate with each
|
||||
+ * entries pre_div, m and n values. The entry, which gives the
|
||||
+ * minimum difference in requested rate and actual rate, will be
|
||||
+ * selected as the best one.
|
||||
+ */
|
||||
+ for (freq = f->freq; freq == f->freq; f++) {
|
||||
+ index = qcom_find_src_index(hw, rcg->parent_map, f->src);
|
||||
+ if (index < 0)
|
||||
+ continue;
|
||||
+
|
||||
+ rate = clk_hw_get_rate(clk_hw_get_parent_by_index(hw, index));
|
||||
+ if (rcg->hid_width && f->pre_div) {
|
||||
+ rate *= 2;
|
||||
+ rate /= f->pre_div + 1;
|
||||
+ }
|
||||
+
|
||||
+ if (rcg->mnd_width && f->n) {
|
||||
+ tmp = rate;
|
||||
+ tmp = tmp * f->n;
|
||||
+ do_div(tmp, f->m);
|
||||
+ rate = tmp;
|
||||
+ }
|
||||
+
|
||||
+ if (abs(req_rate - rate) < abs(best - rate)) {
|
||||
+ best_ftable = f;
|
||||
+ best = rate;
|
||||
+
|
||||
+ if (req_rate == rate)
|
||||
+ break;
|
||||
+ }
|
||||
+ }
|
||||
+
|
||||
+ return best_ftable;
|
||||
+}
|
||||
+
|
||||
+static int _freq_tbl_determine_rate(struct clk_hw *hw, const struct freq_tbl *f,
|
||||
+ struct clk_rate_request *req,
|
||||
+ enum freq_policy policy)
|
||||
+{
|
||||
+ unsigned long clk_flags, rate = req->rate;
|
||||
+ struct clk_hw *p;
|
||||
+ struct clk_rcg2 *rcg = to_clk_rcg2(hw);
|
||||
+ int index;
|
||||
+
|
||||
+ f = clk_rcg2_find_best_freq(hw, f, rate, policy);
|
||||
if (!f)
|
||||
return -EINVAL;
|
||||
|
||||
@@ -324,17 +380,7 @@ static int __clk_rcg2_set_rate(struct clk_hw *hw, unsigned long rate,
|
||||
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
|
||||
const struct freq_tbl *f;
|
||||
|
||||
- switch (policy) {
|
||||
- case FLOOR:
|
||||
- f = qcom_find_freq_floor(rcg->freq_tbl, rate);
|
||||
- break;
|
||||
- case CEIL:
|
||||
- f = qcom_find_freq(rcg->freq_tbl, rate);
|
||||
- break;
|
||||
- default:
|
||||
- return -EINVAL;
|
||||
- }
|
||||
-
|
||||
+ f = clk_rcg2_find_best_freq(hw, rcg->freq_tbl, rate, policy);
|
||||
if (!f)
|
||||
return -EINVAL;
|
||||
|
||||
@@ -874,7 +920,7 @@ static int clk_rcg2_shared_set_rate(struct clk_hw *hw, unsigned long rate,
|
||||
struct clk_rcg2 *rcg = to_clk_rcg2(hw);
|
||||
const struct freq_tbl *f;
|
||||
|
||||
- f = qcom_find_freq(rcg->freq_tbl, rate);
|
||||
+ f = clk_rcg2_find_best_freq(hw, rcg->freq_tbl, rate, CEIL);
|
||||
if (!f)
|
||||
return -EINVAL;
|
||||
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -0,0 +1,61 @@
|
||||
From b9dde0c1cfad5e09d5be5248aeeda2941ec8e02b Mon Sep 17 00:00:00 2001
|
||||
From: hzy <hzyitc@outlook.com>
|
||||
Date: Mon, 20 Mar 2023 19:55:51 +0000
|
||||
Subject: [PATCH 1/3] net: mdio: ipq4019: Add phy reset support
|
||||
|
||||
Signed-off-by: hzy <hzyitc@outlook.com>
|
||||
---
|
||||
drivers/net/phy/mdio-ipq4019.c | 16 ++++++++++++++++
|
||||
1 file changed, 16 insertions(+)
|
||||
|
||||
diff --git a/drivers/net/mdio/mdio-ipq4019.c b/drivers/net/mdio/mdio-ipq4019.c
|
||||
index 7227917755cc..59a37e4378ea 100644
|
||||
--- a/drivers/net/mdio/mdio-ipq4019.c
|
||||
+++ b/drivers/net/mdio/mdio-ipq4019.c
|
||||
@@ -12,6 +12,7 @@
|
||||
#include <linux/phy.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/clk.h>
|
||||
+#include <linux/reset.h>
|
||||
|
||||
#define MDIO_MODE_REG 0x40
|
||||
#define MDIO_ADDR_REG 0x44
|
||||
@@ -41,6 +42,7 @@ struct ipq4019_mdio_data {
|
||||
void __iomem *membase;
|
||||
void __iomem *eth_ldo_rdy;
|
||||
struct clk *mdio_clk;
|
||||
+ struct reset_control *phy_reset;
|
||||
};
|
||||
|
||||
static int ipq4019_mdio_wait_busy(struct mii_bus *bus)
|
||||
@@ -195,6 +197,13 @@ static int ipq_mdio_reset(struct mii_bus *bus)
|
||||
fsleep(IPQ_PHY_SET_DELAY_US);
|
||||
}
|
||||
|
||||
+ if (priv->phy_reset) {
|
||||
+ reset_control_assert(priv->phy_reset);
|
||||
+ fsleep(IPQ_PHY_SET_DELAY_US);
|
||||
+ reset_control_deassert(priv->phy_reset);
|
||||
+ fsleep(IPQ_PHY_SET_DELAY_US);
|
||||
+ }
|
||||
+
|
||||
/* Configure MDIO clock source frequency if clock is specified in the device tree */
|
||||
ret = clk_set_rate(priv->mdio_clk, IPQ_MDIO_CLK_RATE);
|
||||
if (ret)
|
||||
@@ -229,6 +238,13 @@ static int ipq4019_mdio_probe(struct platform_device *pdev)
|
||||
if (res)
|
||||
priv->eth_ldo_rdy = devm_ioremap_resource(&pdev->dev, res);
|
||||
|
||||
+ priv->phy_reset = devm_reset_control_get_optional(&pdev->dev, "phy");
|
||||
+ if (IS_ERR(priv->phy_reset)) {
|
||||
+ if (PTR_ERR(priv->phy_reset) == -EPROBE_DEFER)
|
||||
+ return PTR_ERR(priv->phy_reset);
|
||||
+ priv->phy_reset = NULL;
|
||||
+ }
|
||||
+
|
||||
bus->name = "ipq4019_mdio";
|
||||
bus->read = ipq4019_mdio_read;
|
||||
bus->write = ipq4019_mdio_write;
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -0,0 +1,43 @@
|
||||
From c8e781390284c3fadb38189c52eb3a9f0533968d Mon Sep 17 00:00:00 2001
|
||||
From: hzy <hzyitc@outlook.com>
|
||||
Date: Mon, 20 Mar 2023 20:26:38 +0000
|
||||
Subject: [PATCH 2/3] arm64: dts: qcom: ipq5018: Add mdio node
|
||||
|
||||
Signed-off-by: hzy <hzyitc@outlook.com>
|
||||
---
|
||||
arch/arm64/boot/dts/qcom/ipq5018.dtsi | 20 ++++++++++++++++++++
|
||||
1 file changed, 20 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/qcom/ipq5018.dtsi b/arch/arm64/boot/dts/qcom/ipq5018.dtsi
|
||||
index c214ac5580eb..71da4ba4f6bb 100644
|
||||
--- a/arch/arm64/boot/dts/qcom/ipq5018.dtsi
|
||||
+++ b/arch/arm64/boot/dts/qcom/ipq5018.dtsi
|
||||
@@ -251,5 +251,25 @@
|
||||
nand-bus-width = <8>;
|
||||
};
|
||||
};
|
||||
+
|
||||
+ mdio0: mdio@88000 {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ compatible = "qcom,ipq5018-mdio", "qcom,qca-mdio";
|
||||
+ reg = <0x88000 0x64>, <0x19475C4 0x4>;
|
||||
+ clocks = <&gcc GCC_MDIO0_AHB_CLK>;
|
||||
+ clock-names = "gcc_mdio_ahb_clk";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
+
|
||||
+ mdio1: mdio@90000 {
|
||||
+ #address-cells = <1>;
|
||||
+ #size-cells = <0>;
|
||||
+ compatible = "qcom,ipq5018-mdio";
|
||||
+ reg = <0x90000 0x64>;
|
||||
+ clocks = <&gcc GCC_MDIO1_AHB_CLK>;
|
||||
+ clock-names = "gcc_mdio_ahb_clk";
|
||||
+ status = "disabled";
|
||||
+ };
|
||||
};
|
||||
};
|
||||
--
|
||||
2.25.1
|
||||
|
||||
@ -0,0 +1,98 @@
|
||||
From f85c726162496b3d1cba80867b8d780c142b77eb Mon Sep 17 00:00:00 2001
|
||||
From: hzy <hzyitc@outlook.com>
|
||||
Date: Mon, 20 Mar 2023 20:27:17 +0000
|
||||
Subject: [PATCH 3/3] arm64: dts: qcom: ipq5018: Add ess node
|
||||
|
||||
Signed-off-by: hzy <hzyitc@outlook.com>
|
||||
---
|
||||
arch/arm64/boot/dts/qcom/ipq5018.dtsi | 75 +++++++++++++++++++++++++++
|
||||
1 file changed, 75 insertions(+)
|
||||
|
||||
diff --git a/arch/arm64/boot/dts/qcom/ipq5018.dtsi b/arch/arm64/boot/dts/qcom/ipq5018.dtsi
|
||||
index 71da4ba4f6bb..0bc0f271b251 100644
|
||||
--- a/arch/arm64/boot/dts/qcom/ipq5018.dtsi
|
||||
+++ b/arch/arm64/boot/dts/qcom/ipq5018.dtsi
|
||||
@@ -271,5 +271,80 @@
|
||||
clocks-name = "gcc_mdio_ahb_clk";
|
||||
status = "disabled";
|
||||
};
|
||||
+
|
||||
+ nss-dp-common {
|
||||
+ compatible = "qcom,nss-dp-common";
|
||||
+ qcom,tcsr-base = <0x01937000>;
|
||||
+ };
|
||||
+
|
||||
+ ess-uniphy@98000 {
|
||||
+ compatible = "qcom,ess-uniphy";
|
||||
+ reg = <0x98000 0x800>;
|
||||
+ uniphy_access_mode = "local bus";
|
||||
+ };
|
||||
+
|
||||
+ ess-instance {
|
||||
+ ess-switch@0x39c00000 {
|
||||
+ compatible = "qcom,ess-switch-ipq50xx";
|
||||
+ reg = <0x39c00000 0x200000>;
|
||||
+ switch_access_mode = "local bus";
|
||||
+ clocks = <&gcc GCC_CMN_BLK_AHB_CLK>,
|
||||
+ <&gcc GCC_CMN_BLK_SYS_CLK>,
|
||||
+ <&gcc GCC_UNIPHY_AHB_CLK>,
|
||||
+ <&gcc GCC_UNIPHY_SYS_CLK>,
|
||||
+ <&gcc GCC_MDIO0_AHB_CLK>,
|
||||
+ <&gcc GCC_MDIO1_AHB_CLK>,
|
||||
+ <&gcc GCC_GMAC0_CFG_CLK>,
|
||||
+ <&gcc GCC_GMAC0_SYS_CLK>,
|
||||
+ <&gcc GCC_GMAC1_CFG_CLK>,
|
||||
+ <&gcc GCC_GMAC1_SYS_CLK>,
|
||||
+ <&gcc GCC_GEPHY_RX_CLK>,
|
||||
+ <&gcc GCC_GEPHY_TX_CLK>,
|
||||
+ <&gcc GCC_UNIPHY_RX_CLK>,
|
||||
+ <&gcc GCC_UNIPHY_TX_CLK>,
|
||||
+ <&gcc GCC_GMAC0_RX_CLK>,
|
||||
+ <&gcc GCC_GMAC0_TX_CLK>,
|
||||
+ <&gcc GCC_GMAC1_RX_CLK>,
|
||||
+ <&gcc GCC_GMAC1_TX_CLK>,
|
||||
+ <&gcc GCC_SNOC_GMAC0_AHB_CLK>,
|
||||
+ <&gcc GCC_SNOC_GMAC1_AHB_CLK>,
|
||||
+ <&gcc GCC_GMAC0_PTP_CLK>,
|
||||
+ <&gcc GCC_GMAC1_PTP_CLK>;
|
||||
+ clock-names = "cmn_ahb_clk",
|
||||
+ "cmn_sys_clk",
|
||||
+ "uniphy_ahb_clk",
|
||||
+ "uniphy_sys_clk",
|
||||
+ "gcc_mdio0_ahb_clk",
|
||||
+ "gcc_mdio1_ahb_clk",
|
||||
+ "gcc_gmac0_cfg_clk",
|
||||
+ "gcc_gmac0_sys_clk",
|
||||
+ "gcc_gmac1_cfg_clk",
|
||||
+ "gcc_gmac1_sys_clk",
|
||||
+ "uniphy0_port1_rx_clk",
|
||||
+ "uniphy0_port1_tx_clk",
|
||||
+ "uniphy1_port5_rx_clk",
|
||||
+ "uniphy1_port5_tx_clk",
|
||||
+ "nss_port1_rx_clk",
|
||||
+ "nss_port1_tx_clk",
|
||||
+ "nss_port2_rx_clk",
|
||||
+ "nss_port2_tx_clk",
|
||||
+ "gcc_snoc_gmac0_ahb_clk",
|
||||
+ "gcc_snoc_gmac1_ahb_clk",
|
||||
+ "gcc_gmac0_ptp_clk",
|
||||
+ "gcc_gmac1_ptp_clk";
|
||||
+ resets = <&gcc GCC_GEPHY_BCR>,
|
||||
+ <&gcc GCC_UNIPHY_BCR>,
|
||||
+ <&gcc GCC_GMAC0_BCR>,
|
||||
+ <&gcc GCC_GMAC1_BCR>,
|
||||
+ <&gcc GCC_UNIPHY_SOFT_RESET>,
|
||||
+ <&gcc GCC_GEPHY_MISC_ARES>;
|
||||
+ reset-names = "gephy_bcr_rst",
|
||||
+ "uniphy_bcr_rst",
|
||||
+ "gmac0_bcr_rst",
|
||||
+ "gmac1_bcr_rst",
|
||||
+ "uniphy1_soft_rst",
|
||||
+ "gephy_misc_rst";
|
||||
+ };
|
||||
+ };
|
||||
};
|
||||
};
|
||||
--
|
||||
2.25.1
|
||||
|
||||
Loading…
Reference in New Issue
Block a user