* [PATCH net-next v4 0/7] Add Aspeed G7 FTGMAC100 support
@ 2024-12-05 7:20 Jacky Chou
2024-12-05 7:20 ` [PATCH net-next v4 1/7] dt-bindings: net: ftgmac100: support for AST2700 Jacky Chou
` (6 more replies)
0 siblings, 7 replies; 15+ messages in thread
From: Jacky Chou @ 2024-12-05 7:20 UTC (permalink / raw)
To: andrew+netdev, davem, edumazet, kuba, pabeni, robh, krzk+dt,
conor+dt, p.zabel, netdev, devicetree, linux-kernel
Cc: jacky_chou
The Aspeed 7th generation SoC features three FTGMAC100.
The main difference from the previous generation is that the
FTGMAC100 adds support for 64-bit DMA capability. Another change
is that the RMII/RGMII pin strap configuration is changed to be set
in the bit 20 fo register 0x50.
Jacky Chou (7):
dt-bindings: net: ftgmac100: support for AST2700
net: faraday: Add ARM64 in FTGMAC100 for AST2700
net: ftgmac100: Add reset toggling for Aspeed SOCs
net: ftgmac100: Add support for AST2700
net: ftgmac100: add pin strap configuration for AST2700
net: ftgmac100: Add 64-bit DMA support for AST2700
net: ftgmac100: remove extra newline symbols
.../bindings/net/faraday,ftgmac100.yaml | 17 ++++-
drivers/net/ethernet/faraday/Kconfig | 7 +-
drivers/net/ethernet/faraday/ftgmac100.c | 75 +++++++++++++++----
drivers/net/ethernet/faraday/ftgmac100.h | 10 +++
4 files changed, 88 insertions(+), 21 deletions(-)
---
v2:
- Separate old patch to multiple patch
- Add more commit information in all patches
- Add error handling in ftgmac100.
v3:
- Move reset function to normal probe procedure
- Move dma set mask to normal probe procedure
v4:
- Add more information in commit messages
- Add resets property in ftgmac100 yaml
- Remove more print log from reset flow in ftgmac100 driver
--
2.25.1
^ permalink raw reply [flat|nested] 15+ messages in thread
* [PATCH net-next v4 1/7] dt-bindings: net: ftgmac100: support for AST2700
2024-12-05 7:20 [PATCH net-next v4 0/7] Add Aspeed G7 FTGMAC100 support Jacky Chou
@ 2024-12-05 7:20 ` Jacky Chou
2024-12-05 8:17 ` Rob Herring (Arm)
` (2 more replies)
2024-12-05 7:20 ` [PATCH net-next v4 2/7] net: faraday: Add ARM64 in FTGMAC100 " Jacky Chou
` (5 subsequent siblings)
6 siblings, 3 replies; 15+ messages in thread
From: Jacky Chou @ 2024-12-05 7:20 UTC (permalink / raw)
To: andrew+netdev, davem, edumazet, kuba, pabeni, robh, krzk+dt,
conor+dt, p.zabel, netdev, devicetree, linux-kernel
Cc: jacky_chou, Conor Dooley
The AST2700 is the 7th generation SoC from Aspeed.
Add compatible support and resets property for AST2700 in
yaml.
Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>
Acked-by: Conor Dooley <conor.dooley@microchip.com>
---
.../bindings/net/faraday,ftgmac100.yaml | 17 ++++++++++++++++-
1 file changed, 16 insertions(+), 1 deletion(-)
diff --git a/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml b/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml
index 9bcbacb6640d..3bba8eee83d6 100644
--- a/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml
+++ b/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml
@@ -21,6 +21,7 @@ properties:
- aspeed,ast2400-mac
- aspeed,ast2500-mac
- aspeed,ast2600-mac
+ - aspeed,ast2700-mac
- const: faraday,ftgmac100
reg:
@@ -33,7 +34,7 @@ properties:
minItems: 1
items:
- description: MAC IP clock
- - description: RMII RCLK gate for AST2500/2600
+ - description: RMII RCLK gate for AST2500/2600/2700
clock-names:
minItems: 1
@@ -73,6 +74,20 @@ required:
unevaluatedProperties: false
+if:
+ properties:
+ compatible:
+ contains:
+ const: aspeed,ast2700-mac
+then:
+ properties:
+ resets:
+ maxItems: 1
+ items:
+ - description: MAC IP reset for AST2700
+ required:
+ - resets
+
examples:
- |
ethernet@1e660000 {
--
2.25.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH net-next v4 2/7] net: faraday: Add ARM64 in FTGMAC100 for AST2700
2024-12-05 7:20 [PATCH net-next v4 0/7] Add Aspeed G7 FTGMAC100 support Jacky Chou
2024-12-05 7:20 ` [PATCH net-next v4 1/7] dt-bindings: net: ftgmac100: support for AST2700 Jacky Chou
@ 2024-12-05 7:20 ` Jacky Chou
2024-12-05 7:20 ` [PATCH net-next v4 3/7] net: ftgmac100: Add reset toggling for Aspeed SOCs Jacky Chou
` (4 subsequent siblings)
6 siblings, 0 replies; 15+ messages in thread
From: Jacky Chou @ 2024-12-05 7:20 UTC (permalink / raw)
To: andrew+netdev, davem, edumazet, kuba, pabeni, robh, krzk+dt,
conor+dt, p.zabel, netdev, devicetree, linux-kernel
Cc: jacky_chou
AST2700 is a ARM 64-bit SoC and ftgmac100 adds support 64-bit
DMA capability in AST2700.
The ftgmac100 on Aspeed Soc 6th generation and above seperates MDIO
controller from MAC. It cannot add ARCH_ASPEED_G7 configuration at ARM64,
so here changes to select MDIO_ASPEED by ARCH_ARCH_ASPEED for Aspeed 6th
generation and above.
And remove not 64BIT and BROKEN dependency from FTGMAC100 config.
These are added for NDS32 architecture and now this NDS32 support
has been removed. Therefore, here does not need it anymore.
The ftgmac100 of AST2700 supports 64-bit operation, '!BIT64' dependency
will limit 64-bit support.
Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>
---
drivers/net/ethernet/faraday/Kconfig | 7 +++----
1 file changed, 3 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/faraday/Kconfig b/drivers/net/ethernet/faraday/Kconfig
index c699bd6bcbb9..c765663c0bbb 100644
--- a/drivers/net/ethernet/faraday/Kconfig
+++ b/drivers/net/ethernet/faraday/Kconfig
@@ -6,7 +6,7 @@
config NET_VENDOR_FARADAY
bool "Faraday devices"
default y
- depends on ARM || COMPILE_TEST
+ depends on ARM || ARM64 || COMPILE_TEST
help
If you have a network (Ethernet) card belonging to this class, say Y.
@@ -28,10 +28,9 @@ config FTMAC100
config FTGMAC100
tristate "Faraday FTGMAC100 Gigabit Ethernet support"
- depends on ARM || COMPILE_TEST
- depends on !64BIT || BROKEN
+ depends on ARM || ARM64 || COMPILE_TEST
select PHYLIB
- select MDIO_ASPEED if MACH_ASPEED_G6
+ select MDIO_ASPEED if ARCH_ASPEED
select CRC32
help
This driver supports the FTGMAC100 Gigabit Ethernet controller
--
2.25.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH net-next v4 3/7] net: ftgmac100: Add reset toggling for Aspeed SOCs
2024-12-05 7:20 [PATCH net-next v4 0/7] Add Aspeed G7 FTGMAC100 support Jacky Chou
2024-12-05 7:20 ` [PATCH net-next v4 1/7] dt-bindings: net: ftgmac100: support for AST2700 Jacky Chou
2024-12-05 7:20 ` [PATCH net-next v4 2/7] net: faraday: Add ARM64 in FTGMAC100 " Jacky Chou
@ 2024-12-05 7:20 ` Jacky Chou
2024-12-09 16:49 ` Simon Horman
2024-12-05 7:20 ` [PATCH net-next v4 4/7] net: ftgmac100: Add support for AST2700 Jacky Chou
` (3 subsequent siblings)
6 siblings, 1 reply; 15+ messages in thread
From: Jacky Chou @ 2024-12-05 7:20 UTC (permalink / raw)
To: andrew+netdev, davem, edumazet, kuba, pabeni, robh, krzk+dt,
conor+dt, p.zabel, netdev, devicetree, linux-kernel
Cc: jacky_chou
Toggle the SCU reset before hardware initialization.
Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>
---
drivers/net/ethernet/faraday/ftgmac100.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)
diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
index 17ec35e75a65..96c1eee547c4 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.c
+++ b/drivers/net/ethernet/faraday/ftgmac100.c
@@ -9,6 +9,7 @@
#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
#include <linux/clk.h>
+#include <linux/reset.h>
#include <linux/dma-mapping.h>
#include <linux/etherdevice.h>
#include <linux/ethtool.h>
@@ -98,6 +99,7 @@ struct ftgmac100 {
struct work_struct reset_task;
struct mii_bus *mii_bus;
struct clk *clk;
+ struct reset_control *rst;
/* AST2500/AST2600 RMII ref clock gate */
struct clk *rclk;
@@ -1979,6 +1981,22 @@ static int ftgmac100_probe(struct platform_device *pdev)
priv->base + FTGMAC100_OFFSET_TM);
}
+ priv->rst = devm_reset_control_get_optional_exclusive(priv->dev, NULL);
+ if (IS_ERR(priv->rst))
+ goto err_register_netdev;
+
+ err = reset_control_assert(priv->rst);
+ if (err) {
+ dev_err(priv->dev, "Failed to reset mac (%d)\n", err);
+ goto err_register_netdev;
+ }
+ usleep_range(10000, 20000);
+ err = reset_control_deassert(priv->rst);
+ if (err) {
+ dev_err(priv->dev, "Failed to deassert mac reset (%d)\n", err);
+ goto err_register_netdev;
+ }
+
/* Default ring sizes */
priv->rx_q_entries = priv->new_rx_q_entries = DEF_RX_QUEUE_ENTRIES;
priv->tx_q_entries = priv->new_tx_q_entries = DEF_TX_QUEUE_ENTRIES;
--
2.25.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH net-next v4 4/7] net: ftgmac100: Add support for AST2700
2024-12-05 7:20 [PATCH net-next v4 0/7] Add Aspeed G7 FTGMAC100 support Jacky Chou
` (2 preceding siblings ...)
2024-12-05 7:20 ` [PATCH net-next v4 3/7] net: ftgmac100: Add reset toggling for Aspeed SOCs Jacky Chou
@ 2024-12-05 7:20 ` Jacky Chou
2024-12-05 7:20 ` [PATCH net-next v4 5/7] net: ftgmac100: add pin strap configuration " Jacky Chou
` (2 subsequent siblings)
6 siblings, 0 replies; 15+ messages in thread
From: Jacky Chou @ 2024-12-05 7:20 UTC (permalink / raw)
To: andrew+netdev, davem, edumazet, kuba, pabeni, robh, krzk+dt,
conor+dt, p.zabel, netdev, devicetree, linux-kernel
Cc: jacky_chou
Add comptaible for AST2700 and set dma mask to 64-bit.
The ftgmac100 on AST2700 supports 64-bit DMA.
Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>
---
drivers/net/ethernet/faraday/ftgmac100.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
index 96c1eee547c4..c0540645d151 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.c
+++ b/drivers/net/ethernet/faraday/ftgmac100.c
@@ -1884,7 +1884,8 @@ static int ftgmac100_probe(struct platform_device *pdev)
np = pdev->dev.of_node;
if (np && (of_device_is_compatible(np, "aspeed,ast2400-mac") ||
of_device_is_compatible(np, "aspeed,ast2500-mac") ||
- of_device_is_compatible(np, "aspeed,ast2600-mac"))) {
+ of_device_is_compatible(np, "aspeed,ast2600-mac") ||
+ of_device_is_compatible(np, "aspeed,ast2700-mac"))) {
priv->rxdes0_edorr_mask = BIT(30);
priv->txdes0_edotr_mask = BIT(30);
priv->is_aspeed = true;
@@ -1976,7 +1977,8 @@ static int ftgmac100_probe(struct platform_device *pdev)
goto err_phy_connect;
/* Disable ast2600 problematic HW arbitration */
- if (of_device_is_compatible(np, "aspeed,ast2600-mac"))
+ if (of_device_is_compatible(np, "aspeed,ast2600-mac") ||
+ of_device_is_compatible(np, "aspeed,ast2700-mac"))
iowrite32(FTGMAC100_TM_DEFAULT,
priv->base + FTGMAC100_OFFSET_TM);
}
@@ -2021,6 +2023,12 @@ static int ftgmac100_probe(struct platform_device *pdev)
netdev->hw_features &= ~(NETIF_F_HW_CSUM | NETIF_F_RXCSUM);
netdev->features |= netdev->hw_features;
+ err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64));
+ if (err) {
+ dev_err(&pdev->dev, "64-bit DMA enable failed\n");
+ goto err_register_netdev;
+ }
+
/* register network device */
err = register_netdev(netdev);
if (err) {
--
2.25.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH net-next v4 5/7] net: ftgmac100: add pin strap configuration for AST2700
2024-12-05 7:20 [PATCH net-next v4 0/7] Add Aspeed G7 FTGMAC100 support Jacky Chou
` (3 preceding siblings ...)
2024-12-05 7:20 ` [PATCH net-next v4 4/7] net: ftgmac100: Add support for AST2700 Jacky Chou
@ 2024-12-05 7:20 ` Jacky Chou
2024-12-05 7:20 ` [PATCH net-next v4 6/7] net: ftgmac100: Add 64-bit DMA support " Jacky Chou
2024-12-05 7:20 ` [PATCH net-next v4 7/7] net: ftgmac100: remove extra newline symbols Jacky Chou
6 siblings, 0 replies; 15+ messages in thread
From: Jacky Chou @ 2024-12-05 7:20 UTC (permalink / raw)
To: andrew+netdev, davem, edumazet, kuba, pabeni, robh, krzk+dt,
conor+dt, p.zabel, netdev, devicetree, linux-kernel
Cc: jacky_chou
On AST2700, the RMII/RGMII pin strap is configured by setting
MAC 0x50 bit 20. Set to 0 is RGMII and set to 1 is RMII.
Use compatible property to distinguish different generations for
configuration.
Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>
---
drivers/net/ethernet/faraday/ftgmac100.c | 5 +++++
drivers/net/ethernet/faraday/ftgmac100.h | 1 +
2 files changed, 6 insertions(+)
diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
index c0540645d151..abee1ef1e293 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.c
+++ b/drivers/net/ethernet/faraday/ftgmac100.c
@@ -323,6 +323,7 @@ static void ftgmac100_init_hw(struct ftgmac100 *priv)
static void ftgmac100_start_hw(struct ftgmac100 *priv)
{
u32 maccr = ioread32(priv->base + FTGMAC100_OFFSET_MACCR);
+ struct phy_device *phydev = priv->netdev->phydev;
/* Keep the original GMAC and FAST bits */
maccr &= (FTGMAC100_MACCR_FAST_MODE | FTGMAC100_MACCR_GIGA_MODE);
@@ -351,6 +352,10 @@ static void ftgmac100_start_hw(struct ftgmac100 *priv)
if (priv->netdev->features & NETIF_F_HW_VLAN_CTAG_RX)
maccr |= FTGMAC100_MACCR_RM_VLAN;
+ if (of_device_is_compatible(priv->dev->of_node, "aspeed,ast2700-mac") &&
+ phydev && phydev->interface == PHY_INTERFACE_MODE_RMII)
+ maccr |= FTGMAC100_MACCR_RMII_ENABLE;
+
/* Hit the HW */
iowrite32(maccr, priv->base + FTGMAC100_OFFSET_MACCR);
}
diff --git a/drivers/net/ethernet/faraday/ftgmac100.h b/drivers/net/ethernet/faraday/ftgmac100.h
index 4968f6f0bdbc..c87aa7d7f14c 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.h
+++ b/drivers/net/ethernet/faraday/ftgmac100.h
@@ -166,6 +166,7 @@
#define FTGMAC100_MACCR_RX_MULTIPKT (1 << 16)
#define FTGMAC100_MACCR_RX_BROADPKT (1 << 17)
#define FTGMAC100_MACCR_DISCARD_CRCERR (1 << 18)
+#define FTGMAC100_MACCR_RMII_ENABLE (1 << 20) /* defined in ast2700 */
#define FTGMAC100_MACCR_FAST_MODE (1 << 19)
#define FTGMAC100_MACCR_SW_RST (1 << 31)
--
2.25.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH net-next v4 6/7] net: ftgmac100: Add 64-bit DMA support for AST2700
2024-12-05 7:20 [PATCH net-next v4 0/7] Add Aspeed G7 FTGMAC100 support Jacky Chou
` (4 preceding siblings ...)
2024-12-05 7:20 ` [PATCH net-next v4 5/7] net: ftgmac100: add pin strap configuration " Jacky Chou
@ 2024-12-05 7:20 ` Jacky Chou
2024-12-05 7:20 ` [PATCH net-next v4 7/7] net: ftgmac100: remove extra newline symbols Jacky Chou
6 siblings, 0 replies; 15+ messages in thread
From: Jacky Chou @ 2024-12-05 7:20 UTC (permalink / raw)
To: andrew+netdev, davem, edumazet, kuba, pabeni, robh, krzk+dt,
conor+dt, p.zabel, netdev, devicetree, linux-kernel
Cc: jacky_chou
In 7th generation of Aspeed, the ftgmac100 supports 64-bit
DMA operations because it is 64-bit SoC.
Add the high address base registers for TX/RX description and
add the high address base fields for packet buffer in TX/RX description.
These added registers and fields are reserved in older generations and
they will not affect older hardware for accessing read/write
operations to them.
We have verified these patches in older generations, link AST2600.
Run iperf3, tftp, ping and dhcp etc. to confirm that it works normally
on the new generation and older generation.
In TX/RX description, software will reuse the packet buffer address
fields to construct the dma information to unmap these dma region.
Filling in these high address fields in tx/rxdesc2 is software, and the
hardware just use it to do DMA operation and it does not modify these
fields.
And, in older generation, the software will assign to ZERO to the
fields that added in 7th gereration. Because these older SoCs are 32-bit
platforms, the high address will always be ZERO.
Therefore, avoid using a lot of conditions to set the physical address
on old and new generations.
Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>
---
drivers/net/ethernet/faraday/ftgmac100.c | 35 ++++++++++++++++++------
drivers/net/ethernet/faraday/ftgmac100.h | 9 ++++++
2 files changed, 35 insertions(+), 9 deletions(-)
diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
index abee1ef1e293..11a81f75ed4e 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.c
+++ b/drivers/net/ethernet/faraday/ftgmac100.c
@@ -267,10 +267,12 @@ static void ftgmac100_init_hw(struct ftgmac100 *priv)
iowrite32(reg, priv->base + FTGMAC100_OFFSET_ISR);
/* Setup RX ring buffer base */
- iowrite32(priv->rxdes_dma, priv->base + FTGMAC100_OFFSET_RXR_BADR);
+ iowrite32(lower_32_bits(priv->rxdes_dma), priv->base + FTGMAC100_OFFSET_RXR_BADR);
+ iowrite32(upper_32_bits(priv->rxdes_dma), priv->base + FTGMAC100_OFFSET_RXR_BADDR_HIGH);
/* Setup TX ring buffer base */
- iowrite32(priv->txdes_dma, priv->base + FTGMAC100_OFFSET_NPTXR_BADR);
+ iowrite32(lower_32_bits(priv->txdes_dma), priv->base + FTGMAC100_OFFSET_NPTXR_BADR);
+ iowrite32(upper_32_bits(priv->txdes_dma), priv->base + FTGMAC100_OFFSET_TXR_BADDR_HIGH);
/* Configure RX buffer size */
iowrite32(FTGMAC100_RBSR_SIZE(RX_BUF_SIZE),
@@ -432,7 +434,9 @@ static int ftgmac100_alloc_rx_buf(struct ftgmac100 *priv, unsigned int entry,
priv->rx_skbs[entry] = skb;
/* Store DMA address into RX desc */
- rxdes->rxdes3 = cpu_to_le32(map);
+ rxdes->rxdes2 = cpu_to_le32(FIELD_PREP(FTGMAC100_RXDES2_RXBUF_BADR_HI,
+ upper_32_bits(map)));
+ rxdes->rxdes3 = cpu_to_le32(lower_32_bits(map));
/* Ensure the above is ordered vs clearing the OWN bit */
dma_wmb();
@@ -558,7 +562,8 @@ static bool ftgmac100_rx_packet(struct ftgmac100 *priv, int *processed)
csum_vlan & 0xffff);
/* Tear down DMA mapping, do necessary cache management */
- map = le32_to_cpu(rxdes->rxdes3);
+ map = le32_to_cpu(rxdes->rxdes3) |
+ ((le32_to_cpu(rxdes->rxdes2) & FTGMAC100_RXDES2_RXBUF_BADR_HI) << 16);
#if defined(CONFIG_ARM) && !defined(CONFIG_ARM_DMA_USE_IOMMU)
/* When we don't have an iommu, we can save cycles by not
@@ -635,9 +640,12 @@ static void ftgmac100_free_tx_packet(struct ftgmac100 *priv,
struct ftgmac100_txdes *txdes,
u32 ctl_stat)
{
- dma_addr_t map = le32_to_cpu(txdes->txdes3);
+ dma_addr_t map;
size_t len;
+ map = le32_to_cpu(txdes->txdes3) |
+ ((le32_to_cpu(txdes->txdes2) & FTGMAC100_TXDES2_TXBUF_BADR_HI) << 16);
+
if (ctl_stat & FTGMAC100_TXDES0_FTS) {
len = skb_headlen(skb);
dma_unmap_single(priv->dev, map, len, DMA_TO_DEVICE);
@@ -791,7 +799,9 @@ static netdev_tx_t ftgmac100_hard_start_xmit(struct sk_buff *skb,
f_ctl_stat |= FTGMAC100_TXDES0_FTS;
if (nfrags == 0)
f_ctl_stat |= FTGMAC100_TXDES0_LTS;
- txdes->txdes3 = cpu_to_le32(map);
+ txdes->txdes2 = cpu_to_le32(FIELD_PREP(FTGMAC100_TXDES2_TXBUF_BADR_HI,
+ upper_32_bits((ulong)map)));
+ txdes->txdes3 = cpu_to_le32(lower_32_bits(map));
txdes->txdes1 = cpu_to_le32(csum_vlan);
/* Next descriptor */
@@ -819,7 +829,9 @@ static netdev_tx_t ftgmac100_hard_start_xmit(struct sk_buff *skb,
ctl_stat |= FTGMAC100_TXDES0_LTS;
txdes->txdes0 = cpu_to_le32(ctl_stat);
txdes->txdes1 = 0;
- txdes->txdes3 = cpu_to_le32(map);
+ txdes->txdes2 = cpu_to_le32(FIELD_PREP(FTGMAC100_TXDES2_TXBUF_BADR_HI,
+ upper_32_bits((ulong)map)));
+ txdes->txdes3 = cpu_to_le32(lower_32_bits(map));
/* Next one */
pointer = ftgmac100_next_tx_pointer(priv, pointer);
@@ -894,7 +906,10 @@ static void ftgmac100_free_buffers(struct ftgmac100 *priv)
for (i = 0; i < priv->rx_q_entries; i++) {
struct ftgmac100_rxdes *rxdes = &priv->rxdes[i];
struct sk_buff *skb = priv->rx_skbs[i];
- dma_addr_t map = le32_to_cpu(rxdes->rxdes3);
+ dma_addr_t map;
+
+ map = le32_to_cpu(rxdes->rxdes3) |
+ ((le32_to_cpu(rxdes->rxdes2) & FTGMAC100_RXDES2_RXBUF_BADR_HI) << 16);
if (!skb)
continue;
@@ -993,7 +1008,9 @@ static void ftgmac100_init_rings(struct ftgmac100 *priv)
for (i = 0; i < priv->rx_q_entries; i++) {
rxdes = &priv->rxdes[i];
rxdes->rxdes0 = 0;
- rxdes->rxdes3 = cpu_to_le32(priv->rx_scratch_dma);
+ rxdes->rxdes2 = cpu_to_le32(FIELD_PREP(FTGMAC100_RXDES2_RXBUF_BADR_HI,
+ upper_32_bits(priv->rx_scratch_dma)));
+ rxdes->rxdes3 = cpu_to_le32(lower_32_bits(priv->rx_scratch_dma));
}
/* Mark the end of the ring */
rxdes->rxdes0 |= cpu_to_le32(priv->rxdes0_edorr_mask);
diff --git a/drivers/net/ethernet/faraday/ftgmac100.h b/drivers/net/ethernet/faraday/ftgmac100.h
index c87aa7d7f14c..ac39b864a80c 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.h
+++ b/drivers/net/ethernet/faraday/ftgmac100.h
@@ -57,6 +57,13 @@
#define FTGMAC100_OFFSET_RX_RUNT 0xc0
#define FTGMAC100_OFFSET_RX_CRCER_FTL 0xc4
#define FTGMAC100_OFFSET_RX_COL_LOST 0xc8
+/* reserved 0xcc - 0x174 */
+#define FTGMAC100_OFFSET_TXR_BADDR_LOW 0x178 /* ast2700 */
+#define FTGMAC100_OFFSET_TXR_BADDR_HIGH 0x17c /* ast2700 */
+#define FTGMAC100_OFFSET_HPTXR_BADDR_LOW 0x180 /* ast2700 */
+#define FTGMAC100_OFFSET_HPTXR_BADDR_HIGH 0x184 /* ast2700 */
+#define FTGMAC100_OFFSET_RXR_BADDR_LOW 0x188 /* ast2700 */
+#define FTGMAC100_OFFSET_RXR_BADDR_HIGH 0x18C /* ast2700 */
/*
* Interrupt status register & interrupt enable register
@@ -226,6 +233,7 @@ struct ftgmac100_txdes {
#define FTGMAC100_TXDES1_TX2FIC (1 << 30)
#define FTGMAC100_TXDES1_TXIC (1 << 31)
+#define FTGMAC100_TXDES2_TXBUF_BADR_HI GENMASK(18, 16)
/*
* Receive descriptor, aligned to 16 bytes
*/
@@ -272,4 +280,5 @@ struct ftgmac100_rxdes {
#define FTGMAC100_RXDES1_UDP_CHKSUM_ERR (1 << 26)
#define FTGMAC100_RXDES1_IP_CHKSUM_ERR (1 << 27)
+#define FTGMAC100_RXDES2_RXBUF_BADR_HI GENMASK(18, 16)
#endif /* __FTGMAC100_H */
--
2.25.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* [PATCH net-next v4 7/7] net: ftgmac100: remove extra newline symbols
2024-12-05 7:20 [PATCH net-next v4 0/7] Add Aspeed G7 FTGMAC100 support Jacky Chou
` (5 preceding siblings ...)
2024-12-05 7:20 ` [PATCH net-next v4 6/7] net: ftgmac100: Add 64-bit DMA support " Jacky Chou
@ 2024-12-05 7:20 ` Jacky Chou
6 siblings, 0 replies; 15+ messages in thread
From: Jacky Chou @ 2024-12-05 7:20 UTC (permalink / raw)
To: andrew+netdev, davem, edumazet, kuba, pabeni, robh, krzk+dt,
conor+dt, p.zabel, netdev, devicetree, linux-kernel
Cc: jacky_chou
Remove some unnecessary newline symbols in code.
Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>
---
drivers/net/ethernet/faraday/ftgmac100.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
index 11a81f75ed4e..5a0a94c3b1eb 100644
--- a/drivers/net/ethernet/faraday/ftgmac100.c
+++ b/drivers/net/ethernet/faraday/ftgmac100.c
@@ -575,7 +575,6 @@ static bool ftgmac100_rx_packet(struct ftgmac100 *priv, int *processed)
dma_unmap_single(priv->dev, map, RX_BUF_SIZE, DMA_FROM_DEVICE);
#endif
-
/* Resplenish rx ring */
ftgmac100_alloc_rx_buf(priv, pointer, rxdes, GFP_ATOMIC);
priv->rx_pointer = ftgmac100_next_rx_pointer(priv, pointer);
@@ -1273,7 +1272,6 @@ static int ftgmac100_poll(struct napi_struct *napi, int budget)
more = ftgmac100_rx_packet(priv, &work_done);
} while (more && work_done < budget);
-
/* The interrupt is telling us to kick the MAC back to life
* after an RX overflow
*/
@@ -1363,7 +1361,6 @@ static void ftgmac100_reset(struct ftgmac100 *priv)
if (priv->mii_bus)
mutex_lock(&priv->mii_bus->mdio_lock);
-
/* Check if the interface is still up */
if (!netif_running(netdev))
goto bail;
@@ -1462,7 +1459,6 @@ static void ftgmac100_adjust_link(struct net_device *netdev)
if (netdev->phydev)
mutex_lock(&netdev->phydev->lock);
-
}
static int ftgmac100_mii_probe(struct net_device *netdev)
@@ -1990,7 +1986,6 @@ static int ftgmac100_probe(struct platform_device *pdev)
dev_err(priv->dev, "MII probe failed!\n");
goto err_ncsi_dev;
}
-
}
if (priv->is_aspeed) {
--
2.25.1
^ permalink raw reply related [flat|nested] 15+ messages in thread
* Re: [PATCH net-next v4 1/7] dt-bindings: net: ftgmac100: support for AST2700
2024-12-05 7:20 ` [PATCH net-next v4 1/7] dt-bindings: net: ftgmac100: support for AST2700 Jacky Chou
@ 2024-12-05 8:17 ` Rob Herring (Arm)
2024-12-06 1:52 ` 回覆: " Jacky Chou
2024-12-05 9:23 ` Krzysztof Kozlowski
2024-12-05 9:24 ` Krzysztof Kozlowski
2 siblings, 1 reply; 15+ messages in thread
From: Rob Herring (Arm) @ 2024-12-05 8:17 UTC (permalink / raw)
To: Jacky Chou
Cc: davem, andrew+netdev, netdev, pabeni, kuba, conor+dt, p.zabel,
linux-kernel, krzk+dt, edumazet, devicetree, Conor Dooley
On Thu, 05 Dec 2024 15:20:42 +0800, Jacky Chou wrote:
> The AST2700 is the 7th generation SoC from Aspeed.
> Add compatible support and resets property for AST2700 in
> yaml.
>
> Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>
> Acked-by: Conor Dooley <conor.dooley@microchip.com>
> ---
> .../bindings/net/faraday,ftgmac100.yaml | 17 ++++++++++++++++-
> 1 file changed, 16 insertions(+), 1 deletion(-)
>
My bot found errors running 'make dt_binding_check' on your patch:
yamllint warnings/errors:
dtschema/dtc warnings/errors:
/builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml: then:properties:resets: {'maxItems': 1, 'items': [{'description': 'MAC IP reset for AST2700'}]} should not be valid under {'required': ['maxItems']}
hint: "maxItems" is not needed with an "items" list
from schema $id: http://devicetree.org/meta-schemas/items.yaml#
doc reference errors (make refcheckdocs):
See https://patchwork.ozlabs.org/project/devicetree-bindings/patch/20241205072048.1397570-2-jacky_chou@aspeedtech.com
The base for the series is generally the latest rc1. A different dependency
should be noted in *this* patch.
If you already ran 'make dt_binding_check' and didn't see the above
error(s), then make sure 'yamllint' is installed and dt-schema is up to
date:
pip3 install dtschema --upgrade
Please check and re-submit after running the above command yourself. Note
that DT_SCHEMA_FILES can be set to your schema file to speed up checking
your schema. However, it must be unset to test all examples with your schema.
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next v4 1/7] dt-bindings: net: ftgmac100: support for AST2700
2024-12-05 7:20 ` [PATCH net-next v4 1/7] dt-bindings: net: ftgmac100: support for AST2700 Jacky Chou
2024-12-05 8:17 ` Rob Herring (Arm)
@ 2024-12-05 9:23 ` Krzysztof Kozlowski
2024-12-06 1:57 ` 回覆: " Jacky Chou
2024-12-05 9:24 ` Krzysztof Kozlowski
2 siblings, 1 reply; 15+ messages in thread
From: Krzysztof Kozlowski @ 2024-12-05 9:23 UTC (permalink / raw)
To: Jacky Chou
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, robh, krzk+dt,
conor+dt, p.zabel, netdev, devicetree, linux-kernel, Conor Dooley
On Thu, Dec 05, 2024 at 03:20:42PM +0800, Jacky Chou wrote:
> The AST2700 is the 7th generation SoC from Aspeed.
> Add compatible support and resets property for AST2700 in
> yaml.
>
> Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>
> Acked-by: Conor Dooley <conor.dooley@microchip.com>
Your changelog in cover letter does not mention received ack. When did
it happen?
> ---
> .../bindings/net/faraday,ftgmac100.yaml | 17 ++++++++++++++++-
> 1 file changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml b/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml
> index 9bcbacb6640d..3bba8eee83d6 100644
> --- a/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml
> +++ b/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml
> @@ -21,6 +21,7 @@ properties:
> - aspeed,ast2400-mac
> - aspeed,ast2500-mac
> - aspeed,ast2600-mac
> + - aspeed,ast2700-mac
> - const: faraday,ftgmac100
>
> reg:
> @@ -33,7 +34,7 @@ properties:
> minItems: 1
> items:
> - description: MAC IP clock
> - - description: RMII RCLK gate for AST2500/2600
> + - description: RMII RCLK gate for AST2500/2600/2700
>
> clock-names:
> minItems: 1
> @@ -73,6 +74,20 @@ required:
>
> unevaluatedProperties: false
>
> +if:
> + properties:
> + compatible:
> + contains:
> + const: aspeed,ast2700-mac
1. That's a signigicant change. *Drop ack.*
2. Test your bindings.
3. Put if: block under allOf: and move entire allOf just above your
unevaluatedProperties... if this stays.
4. But you cannot define properties in if:then. They must be defined in
top level. You can disallow them for variants in if:then: with :false"
Even exmaple schema has exactly this case:
https://elixir.bootlin.com/linux/v5.19/source/Documentation/devicetree/bindings/example-schema.yaml#L212
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next v4 1/7] dt-bindings: net: ftgmac100: support for AST2700
2024-12-05 7:20 ` [PATCH net-next v4 1/7] dt-bindings: net: ftgmac100: support for AST2700 Jacky Chou
2024-12-05 8:17 ` Rob Herring (Arm)
2024-12-05 9:23 ` Krzysztof Kozlowski
@ 2024-12-05 9:24 ` Krzysztof Kozlowski
2 siblings, 0 replies; 15+ messages in thread
From: Krzysztof Kozlowski @ 2024-12-05 9:24 UTC (permalink / raw)
To: Jacky Chou
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, robh, krzk+dt,
conor+dt, p.zabel, netdev, devicetree, linux-kernel, Conor Dooley
On Thu, Dec 05, 2024 at 03:20:42PM +0800, Jacky Chou wrote:
> The AST2700 is the 7th generation SoC from Aspeed.
> Add compatible support and resets property for AST2700 in
> yaml.
>
> Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>
> Acked-by: Conor Dooley <conor.dooley@microchip.com>
> ---
You were asked to post upstream DTS.
Hold with your new versions till you have DTS ready.
Best regards,
Krzysztof
^ permalink raw reply [flat|nested] 15+ messages in thread
* 回覆: [PATCH net-next v4 1/7] dt-bindings: net: ftgmac100: support for AST2700
2024-12-05 8:17 ` Rob Herring (Arm)
@ 2024-12-06 1:52 ` Jacky Chou
0 siblings, 0 replies; 15+ messages in thread
From: Jacky Chou @ 2024-12-06 1:52 UTC (permalink / raw)
To: Rob Herring (Arm)
Cc: davem@davemloft.net, andrew+netdev@lunn.ch,
netdev@vger.kernel.org, pabeni@redhat.com, kuba@kernel.org,
conor+dt@kernel.org, p.zabel@pengutronix.de,
linux-kernel@vger.kernel.org, krzk+dt@kernel.org,
edumazet@google.com, devicetree@vger.kernel.org, Conor Dooley
Hi Rob
Thank you for you reply.
> > The AST2700 is the 7th generation SoC from Aspeed.
> > Add compatible support and resets property for AST2700 in yaml.
> >
> > Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>
> > Acked-by: Conor Dooley <conor.dooley@microchip.com>
> > ---
> > .../bindings/net/faraday,ftgmac100.yaml | 17
> ++++++++++++++++-
> > 1 file changed, 16 insertions(+), 1 deletion(-)
> >
>
> My bot found errors running 'make dt_binding_check' on your patch:
>
> yamllint warnings/errors:
>
> dtschema/dtc warnings/errors:
> /builds/robherring/dt-review-ci/linux/Documentation/devicetree/bindings/net/
> faraday,ftgmac100.yaml: then:properties:resets: {'maxItems': 1, 'items':
> [{'description': 'MAC IP reset for AST2700'}]} should not be valid under
> {'required': ['maxItems']}
> hint: "maxItems" is not needed with an "items" list
> from schema $id: http://devicetree.org/meta-schemas/items.yaml#
>
> doc reference errors (make refcheckdocs):
>
> See
> https://patchwork.ozlabs.org/project/devicetree-bindings/patch/202412050720
> 48.1397570-2-jacky_chou@aspeedtech.com
>
> The base for the series is generally the latest rc1. A different dependency
> should be noted in *this* patch.
>
> If you already ran 'make dt_binding_check' and didn't see the above error(s),
> then make sure 'yamllint' is installed and dt-schema is up to
> date:
>
> pip3 install dtschema --upgrade
>
> Please check and re-submit after running the above command yourself. Note
> that DT_SCHEMA_FILES can be set to your schema file to speed up checking
> your schema. However, it must be unset to test all examples with your schema.
Thank you for your kind reminder.
I will run 'make dt_binding_check' and confirm there is no error or warning.
Thanks,
Jacky
^ permalink raw reply [flat|nested] 15+ messages in thread
* 回覆: [PATCH net-next v4 1/7] dt-bindings: net: ftgmac100: support for AST2700
2024-12-05 9:23 ` Krzysztof Kozlowski
@ 2024-12-06 1:57 ` Jacky Chou
0 siblings, 0 replies; 15+ messages in thread
From: Jacky Chou @ 2024-12-06 1:57 UTC (permalink / raw)
To: Krzysztof Kozlowski
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, robh@kernel.org,
krzk+dt@kernel.org, conor+dt@kernel.org, p.zabel@pengutronix.de,
netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, Conor Dooley
Hi Krzysztof,
Thank you for your reply.
> On Thu, Dec 05, 2024 at 03:20:42PM +0800, Jacky Chou wrote:
> > The AST2700 is the 7th generation SoC from Aspeed.
> > Add compatible support and resets property for AST2700 in yaml.
> >
> > Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>
> > Acked-by: Conor Dooley <conor.dooley@microchip.com>
>
>
> Your changelog in cover letter does not mention received ack. When did it
> happen?
I am really sorry for forgetting to remove this 'acked-by'.
I will drop it.
>
> > ---
> > .../bindings/net/faraday,ftgmac100.yaml | 17
> ++++++++++++++++-
> > 1 file changed, 16 insertions(+), 1 deletion(-)
> >
> > diff --git
> > a/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml
> > b/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml
> > index 9bcbacb6640d..3bba8eee83d6 100644
> > --- a/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml
> > +++ b/Documentation/devicetree/bindings/net/faraday,ftgmac100.yaml
> > @@ -21,6 +21,7 @@ properties:
> > - aspeed,ast2400-mac
> > - aspeed,ast2500-mac
> > - aspeed,ast2600-mac
> > + - aspeed,ast2700-mac
> > - const: faraday,ftgmac100
> >
> > reg:
> > @@ -33,7 +34,7 @@ properties:
> > minItems: 1
> > items:
> > - description: MAC IP clock
> > - - description: RMII RCLK gate for AST2500/2600
> > + - description: RMII RCLK gate for AST2500/2600/2700
> >
> > clock-names:
> > minItems: 1
> > @@ -73,6 +74,20 @@ required:
> >
> > unevaluatedProperties: false
> >
> > +if:
> > + properties:
> > + compatible:
> > + contains:
> > + const: aspeed,ast2700-mac
>
> 1. That's a signigicant change. *Drop ack.*
>
> 2. Test your bindings.
> 3. Put if: block under allOf: and move entire allOf just above your
> unevaluatedProperties... if this stays.
> 4. But you cannot define properties in if:then. They must be defined in top level.
> You can disallow them for variants in if:then: with :false"
>
> Even exmaple schema has exactly this case:
> https://elixir.bootlin.com/linux/v5.19/source/Documentation/devicetree/bindin
> gs/example-schema.yaml#L212
Thank you for the information.
I will correct my patch and hold it before the DTS is ready.
Thanks,
Jacky
^ permalink raw reply [flat|nested] 15+ messages in thread
* Re: [PATCH net-next v4 3/7] net: ftgmac100: Add reset toggling for Aspeed SOCs
2024-12-05 7:20 ` [PATCH net-next v4 3/7] net: ftgmac100: Add reset toggling for Aspeed SOCs Jacky Chou
@ 2024-12-09 16:49 ` Simon Horman
2024-12-11 3:06 ` 回覆: " Jacky Chou
0 siblings, 1 reply; 15+ messages in thread
From: Simon Horman @ 2024-12-09 16:49 UTC (permalink / raw)
To: Jacky Chou
Cc: andrew+netdev, davem, edumazet, kuba, pabeni, robh, krzk+dt,
conor+dt, p.zabel, netdev, devicetree, linux-kernel
On Thu, Dec 05, 2024 at 03:20:44PM +0800, Jacky Chou wrote:
> Toggle the SCU reset before hardware initialization.
>
> Signed-off-by: Jacky Chou <jacky_chou@aspeedtech.com>
> ---
> drivers/net/ethernet/faraday/ftgmac100.c | 18 ++++++++++++++++++
> 1 file changed, 18 insertions(+)
>
> diff --git a/drivers/net/ethernet/faraday/ftgmac100.c b/drivers/net/ethernet/faraday/ftgmac100.c
> index 17ec35e75a65..96c1eee547c4 100644
> --- a/drivers/net/ethernet/faraday/ftgmac100.c
> +++ b/drivers/net/ethernet/faraday/ftgmac100.c
> @@ -9,6 +9,7 @@
> #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
>
> #include <linux/clk.h>
> +#include <linux/reset.h>
> #include <linux/dma-mapping.h>
> #include <linux/etherdevice.h>
> #include <linux/ethtool.h>
> @@ -98,6 +99,7 @@ struct ftgmac100 {
> struct work_struct reset_task;
> struct mii_bus *mii_bus;
> struct clk *clk;
> + struct reset_control *rst;
>
> /* AST2500/AST2600 RMII ref clock gate */
> struct clk *rclk;
> @@ -1979,6 +1981,22 @@ static int ftgmac100_probe(struct platform_device *pdev)
> priv->base + FTGMAC100_OFFSET_TM);
> }
>
> + priv->rst = devm_reset_control_get_optional_exclusive(priv->dev, NULL);
> + if (IS_ERR(priv->rst))
> + goto err_register_netdev;
Hi Jacky,
The goto on the line above will result in this function returning err.
However, it seems that err is set to 0 here.
And perhaps it should be set to PTR_ERR(priv->rst).
Flagged by Smatch.
> +
> + err = reset_control_assert(priv->rst);
> + if (err) {
> + dev_err(priv->dev, "Failed to reset mac (%d)\n", err);
> + goto err_register_netdev;
> + }
> + usleep_range(10000, 20000);
> + err = reset_control_deassert(priv->rst);
> + if (err) {
> + dev_err(priv->dev, "Failed to deassert mac reset (%d)\n", err);
> + goto err_register_netdev;
> + }
> +
> /* Default ring sizes */
> priv->rx_q_entries = priv->new_rx_q_entries = DEF_RX_QUEUE_ENTRIES;
> priv->tx_q_entries = priv->new_tx_q_entries = DEF_TX_QUEUE_ENTRIES;
> --
> 2.25.1
>
>
^ permalink raw reply [flat|nested] 15+ messages in thread
* 回覆: [PATCH net-next v4 3/7] net: ftgmac100: Add reset toggling for Aspeed SOCs
2024-12-09 16:49 ` Simon Horman
@ 2024-12-11 3:06 ` Jacky Chou
0 siblings, 0 replies; 15+ messages in thread
From: Jacky Chou @ 2024-12-11 3:06 UTC (permalink / raw)
To: Simon Horman
Cc: andrew+netdev@lunn.ch, davem@davemloft.net, edumazet@google.com,
kuba@kernel.org, pabeni@redhat.com, robh@kernel.org,
krzk+dt@kernel.org, conor+dt@kernel.org, p.zabel@pengutronix.de,
netdev@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org
Hi Smatch
Thank you for your reply.
> > + struct reset_control *rst;
> >
> > /* AST2500/AST2600 RMII ref clock gate */
> > struct clk *rclk;
> > @@ -1979,6 +1981,22 @@ static int ftgmac100_probe(struct
> platform_device *pdev)
> > priv->base + FTGMAC100_OFFSET_TM);
> > }
> >
> > + priv->rst = devm_reset_control_get_optional_exclusive(priv->dev, NULL);
> > + if (IS_ERR(priv->rst))
> > + goto err_register_netdev;
>
> Hi Jacky,
>
> The goto on the line above will result in this function returning err.
> However, it seems that err is set to 0 here.
> And perhaps it should be set to PTR_ERR(priv->rst).
>
> Flagged by Smatch.
Agree.
I will add that err is assigned by PTR_ERR(priv->rst) for error handling in next version.
priv->rst = devm_reset_control_get_optional_exclusive(priv->dev, NULL);
if (IS_ERR(priv->rst)) {
err = PTR_ERR(priv->rst);
goto err_register_netdev;
}
Otherwise, err may be zero when getting an error from devm_reset_control_get_Optional_exclusive().
Thank you for your kind reminder.
Thanks,
Jacky
^ permalink raw reply [flat|nested] 15+ messages in thread
end of thread, other threads:[~2024-12-11 3:06 UTC | newest]
Thread overview: 15+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-12-05 7:20 [PATCH net-next v4 0/7] Add Aspeed G7 FTGMAC100 support Jacky Chou
2024-12-05 7:20 ` [PATCH net-next v4 1/7] dt-bindings: net: ftgmac100: support for AST2700 Jacky Chou
2024-12-05 8:17 ` Rob Herring (Arm)
2024-12-06 1:52 ` 回覆: " Jacky Chou
2024-12-05 9:23 ` Krzysztof Kozlowski
2024-12-06 1:57 ` 回覆: " Jacky Chou
2024-12-05 9:24 ` Krzysztof Kozlowski
2024-12-05 7:20 ` [PATCH net-next v4 2/7] net: faraday: Add ARM64 in FTGMAC100 " Jacky Chou
2024-12-05 7:20 ` [PATCH net-next v4 3/7] net: ftgmac100: Add reset toggling for Aspeed SOCs Jacky Chou
2024-12-09 16:49 ` Simon Horman
2024-12-11 3:06 ` 回覆: " Jacky Chou
2024-12-05 7:20 ` [PATCH net-next v4 4/7] net: ftgmac100: Add support for AST2700 Jacky Chou
2024-12-05 7:20 ` [PATCH net-next v4 5/7] net: ftgmac100: add pin strap configuration " Jacky Chou
2024-12-05 7:20 ` [PATCH net-next v4 6/7] net: ftgmac100: Add 64-bit DMA support " Jacky Chou
2024-12-05 7:20 ` [PATCH net-next v4 7/7] net: ftgmac100: remove extra newline symbols Jacky Chou
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).