* [PATCH net-next 0/2] r8169:change hardware setting
@ 2014-12-02 8:48 Chunhao Lin
2014-12-02 8:48 ` [PATCH net-next 1/2] r8169:prevent enable hardware tx/rx too early Chunhao Lin
` (2 more replies)
0 siblings, 3 replies; 4+ messages in thread
From: Chunhao Lin @ 2014-12-02 8:48 UTC (permalink / raw)
To: netdev; +Cc: nic_swsd, linux-kernel, Chunhao Lin
This patch series contains two hardware setting modification to prevent
hardware become abnormal.
Chunhao Lin (2):
r8169:prevent enable hardware tx/rx too early
r8169:disable rtl8168ep cmac engine
drivers/net/ethernet/realtek/r8169.c | 33 ++++++++++++++++++++++-----------
1 file changed, 22 insertions(+), 11 deletions(-)
--
1.9.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net-next 1/2] r8169:prevent enable hardware tx/rx too early
2014-12-02 8:48 [PATCH net-next 0/2] r8169:change hardware setting Chunhao Lin
@ 2014-12-02 8:48 ` Chunhao Lin
2014-12-02 8:48 ` [PATCH net-next 2/2] r8169:disable rtl8168ep cmac engine Chunhao Lin
2014-12-09 1:44 ` [PATCH net-next 0/2] r8169:change hardware setting David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Chunhao Lin @ 2014-12-02 8:48 UTC (permalink / raw)
To: netdev; +Cc: nic_swsd, linux-kernel, Chunhao Lin
For RTL8168G/GU/H/EP and RTL8411B remove enable tx/rx from its own hw_start
function. This will prevent enable tx/rx before complete hardware tx/rx
setting.
Tx/Rx will be enabled in the end of function rtl_hw_start_8168.
Signed-off-by: Chunhao Lin <hau@realtek.com>
---
drivers/net/ethernet/realtek/r8169.c | 3 ---
1 file changed, 3 deletions(-)
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index cf154f7..7f4515f 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -5934,7 +5934,6 @@ static void rtl_hw_start_8168g_1(struct rtl8169_private *tp)
rtl_w0w1_eri(tp, 0xdc, ERIAR_MASK_0001, 0x01, 0x00, ERIAR_EXGMAC);
rtl_eri_write(tp, 0x2f8, ERIAR_MASK_0011, 0x1d8f, ERIAR_EXGMAC);
- RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb);
RTL_W32(MISC, RTL_R32(MISC) & ~RXDV_GATED_EN);
RTL_W8(MaxTxPacketSize, EarlySize);
@@ -6027,7 +6026,6 @@ static void rtl_hw_start_8168h_1(struct rtl8169_private *tp)
rtl_eri_write(tp, 0x5f0, ERIAR_MASK_0011, 0x4f87, ERIAR_EXGMAC);
- RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb);
RTL_W32(MISC, RTL_R32(MISC) & ~RXDV_GATED_EN);
RTL_W8(MaxTxPacketSize, EarlySize);
@@ -6109,7 +6107,6 @@ static void rtl_hw_start_8168ep(struct rtl8169_private *tp)
rtl_eri_write(tp, 0x5f0, ERIAR_MASK_0011, 0x4f87, ERIAR_EXGMAC);
- RTL_W8(ChipCmd, CmdTxEnb | CmdRxEnb);
RTL_W32(MISC, RTL_R32(MISC) & ~RXDV_GATED_EN);
RTL_W8(MaxTxPacketSize, EarlySize);
--
1.9.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* [PATCH net-next 2/2] r8169:disable rtl8168ep cmac engine
2014-12-02 8:48 [PATCH net-next 0/2] r8169:change hardware setting Chunhao Lin
2014-12-02 8:48 ` [PATCH net-next 1/2] r8169:prevent enable hardware tx/rx too early Chunhao Lin
@ 2014-12-02 8:48 ` Chunhao Lin
2014-12-09 1:44 ` [PATCH net-next 0/2] r8169:change hardware setting David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Chunhao Lin @ 2014-12-02 8:48 UTC (permalink / raw)
To: netdev; +Cc: nic_swsd, linux-kernel, Chunhao Lin
Cmac engine is the bridge between driver and dash firmware.
Other os may not disable cmac when leave. And r8169 did not allocate any
resources for cmac engine. Disable it to prevent abnormal system behavior.
Signed-off-by: Chunhao Lin <hau@realtek.com>
---
drivers/net/ethernet/realtek/r8169.c | 30 ++++++++++++++++++++++--------
1 file changed, 22 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/realtek/r8169.c b/drivers/net/ethernet/realtek/r8169.c
index 7f4515f..56280c1 100644
--- a/drivers/net/ethernet/realtek/r8169.c
+++ b/drivers/net/ethernet/realtek/r8169.c
@@ -1377,6 +1377,16 @@ DECLARE_RTL_COND(rtl_ocp_tx_cond)
return RTL_R8(IBISR0) & 0x02;
}
+static void rtl8168ep_stop_cmac(struct rtl8169_private *tp)
+{
+ void __iomem *ioaddr = tp->mmio_addr;
+
+ RTL_W8(IBCR2, RTL_R8(IBCR2) & ~0x01);
+ rtl_msleep_loop_wait_low(tp, &rtl_ocp_tx_cond, 50, 2000);
+ RTL_W8(IBISR0, RTL_R8(IBISR0) | 0x20);
+ RTL_W8(IBCR0, RTL_R8(IBCR0) & ~0x01);
+}
+
static void rtl8168dp_driver_start(struct rtl8169_private *tp)
{
rtl8168_oob_notify(tp, OOB_CMD_DRIVER_START);
@@ -1417,12 +1427,7 @@ static void rtl8168dp_driver_stop(struct rtl8169_private *tp)
static void rtl8168ep_driver_stop(struct rtl8169_private *tp)
{
- void __iomem *ioaddr = tp->mmio_addr;
-
- RTL_W8(IBCR2, RTL_R8(IBCR2) & ~0x01);
- rtl_msleep_loop_wait_low(tp, &rtl_ocp_tx_cond, 50, 2000);
- RTL_W8(IBISR0, RTL_R8(IBISR0) | 0x20);
- RTL_W8(IBCR0, RTL_R8(IBCR0) & ~0x01);
+ rtl8168ep_stop_cmac(tp);
ocp_write(tp, 0x01, 0x180, OOB_CMD_DRIVER_STOP);
ocp_write(tp, 0x01, 0x30, ocp_read(tp, 0x01, 0x30) | 0x01);
rtl_msleep_loop_wait_low(tp, &rtl_ep_ocp_read_cond, 10, 10);
@@ -6089,6 +6094,8 @@ static void rtl_hw_start_8168ep(struct rtl8169_private *tp)
void __iomem *ioaddr = tp->mmio_addr;
struct pci_dev *pdev = tp->pci_dev;
+ rtl8168ep_stop_cmac(tp);
+
RTL_W32(TxConfig, RTL_R32(TxConfig) | TXCFG_AUTO_FIFO);
rtl_eri_write(tp, 0xc8, ERIAR_MASK_0101, 0x00080002, ERIAR_EXGMAC);
@@ -8002,6 +8009,12 @@ static void rtl_hw_init_8168g(struct rtl8169_private *tp)
return;
}
+static void rtl_hw_init_8168ep(struct rtl8169_private *tp)
+{
+ rtl8168ep_stop_cmac(tp);
+ rtl_hw_init_8168g(tp);
+}
+
static void rtl_hw_initialize(struct rtl8169_private *tp)
{
switch (tp->mac_version) {
@@ -8014,12 +8027,13 @@ static void rtl_hw_initialize(struct rtl8169_private *tp)
case RTL_GIGA_MAC_VER_46:
case RTL_GIGA_MAC_VER_47:
case RTL_GIGA_MAC_VER_48:
+ rtl_hw_init_8168g(tp);
+ break;
case RTL_GIGA_MAC_VER_49:
case RTL_GIGA_MAC_VER_50:
case RTL_GIGA_MAC_VER_51:
- rtl_hw_init_8168g(tp);
+ rtl_hw_init_8168ep(tp);
break;
-
default:
break;
}
--
1.9.1
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH net-next 0/2] r8169:change hardware setting
2014-12-02 8:48 [PATCH net-next 0/2] r8169:change hardware setting Chunhao Lin
2014-12-02 8:48 ` [PATCH net-next 1/2] r8169:prevent enable hardware tx/rx too early Chunhao Lin
2014-12-02 8:48 ` [PATCH net-next 2/2] r8169:disable rtl8168ep cmac engine Chunhao Lin
@ 2014-12-09 1:44 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2014-12-09 1:44 UTC (permalink / raw)
To: hau; +Cc: netdev, nic_swsd, linux-kernel
From: Chunhao Lin <hau@realtek.com>
Date: Tue, 2 Dec 2014 16:48:29 +0800
> This patch series contains two hardware setting modification to prevent
> hardware become abnormal.
Series applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2014-12-09 1:44 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-12-02 8:48 [PATCH net-next 0/2] r8169:change hardware setting Chunhao Lin
2014-12-02 8:48 ` [PATCH net-next 1/2] r8169:prevent enable hardware tx/rx too early Chunhao Lin
2014-12-02 8:48 ` [PATCH net-next 2/2] r8169:disable rtl8168ep cmac engine Chunhao Lin
2014-12-09 1:44 ` [PATCH net-next 0/2] r8169:change hardware setting David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®