* [PATCH net-next 0/6] tg3: Misc changes
@ 2013-07-29 20:58 Nithin Nayak Sujir
2013-07-29 20:58 ` [PATCH net-next 1/6] tg3: Remove incorrect switch to aux power Nithin Nayak Sujir
` (5 more replies)
0 siblings, 6 replies; 7+ messages in thread
From: Nithin Nayak Sujir @ 2013-07-29 20:58 UTC (permalink / raw)
To: davem; +Cc: netdev, Nithin Nayak Sujir
This series adds a few minor fixes and a minor ptp feature.
Nithin Nayak Sujir (6):
tg3: Remove incorrect switch to aux power
tg3: Allow NVRAM programming when interface is down
tg3: Implement the shutdown handler
tg3: Enable support for timesync gpio output
tg3: Fix UDP fragments treated as RMCP
tg3: Update version to 3.133
drivers/net/ethernet/broadcom/tg3.c | 103 +++++++++++++++++++++++++++++-------
drivers/net/ethernet/broadcom/tg3.h | 12 ++++-
2 files changed, 94 insertions(+), 21 deletions(-)
--
1.8.1.4
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH net-next 1/6] tg3: Remove incorrect switch to aux power
2013-07-29 20:58 [PATCH net-next 0/6] tg3: Misc changes Nithin Nayak Sujir
@ 2013-07-29 20:58 ` Nithin Nayak Sujir
2013-07-29 20:58 ` [PATCH net-next 2/6] tg3: Allow NVRAM programming when interface is down Nithin Nayak Sujir
` (4 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Nithin Nayak Sujir @ 2013-07-29 20:58 UTC (permalink / raw)
To: davem; +Cc: netdev, Nithin Nayak Sujir, Michael Chan
During probe, the driver is incorrectly switching the power to Vaux on
the 5717 and later devices. At this point, we are in D0 state and
drawing maximum power. We also definitely have Vmain available. It
doesn't make sense to switch to Vaux since it has a lesser maximum power
draw and we might go over the limit. On a new system, we observe that
not all ports are recognized in some of the slots with this call in
place.
Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
---
drivers/net/ethernet/broadcom/tg3.c | 5 -----
1 file changed, 5 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index d964f30..2e4bf5f 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -17547,11 +17547,6 @@ static int tg3_init_one(struct pci_dev *pdev,
tg3_asic_rev(tp) == ASIC_REV_5762)
tg3_flag_set(tp, PTP_CAPABLE);
- if (tg3_flag(tp, 5717_PLUS)) {
- /* Resume a low-power mode */
- tg3_frob_aux_power(tp, false);
- }
-
tg3_timer_init(tp);
tg3_carrier_off(tp);
--
1.8.1.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net-next 2/6] tg3: Allow NVRAM programming when interface is down
2013-07-29 20:58 [PATCH net-next 0/6] tg3: Misc changes Nithin Nayak Sujir
2013-07-29 20:58 ` [PATCH net-next 1/6] tg3: Remove incorrect switch to aux power Nithin Nayak Sujir
@ 2013-07-29 20:58 ` Nithin Nayak Sujir
2013-07-29 20:58 ` [PATCH net-next 3/6] tg3: Implement the shutdown handler Nithin Nayak Sujir
` (3 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Nithin Nayak Sujir @ 2013-07-29 20:58 UTC (permalink / raw)
To: davem; +Cc: netdev, Nithin Nayak Sujir, Michael Chan
Previously, when the interface was brought down, the driver would set
the power state to D3hot. In D3hot, we don't have access to the NVRAM.
This patch removes the call to set the power state to PCI_D3hot in
close. A following patch will implement the shutdown handler to properly
set the D3hot state when the system is going down.
Doing the above means that the TG3_PHYFLG_IS_LOW_POWER should not be
checked to validate access to the NVRAM.
Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
---
drivers/net/ethernet/broadcom/tg3.c | 10 ++--------
1 file changed, 2 insertions(+), 8 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 2e4bf5f..ec244c9 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -11502,7 +11502,7 @@ static int tg3_close(struct net_device *dev)
memset(&tp->net_stats_prev, 0, sizeof(tp->net_stats_prev));
memset(&tp->estats_prev, 0, sizeof(tp->estats_prev));
- tg3_power_down(tp);
+ tg3_power_down_prepare(tp);
tg3_carrier_off(tp);
@@ -11724,9 +11724,6 @@ static int tg3_get_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
if (tg3_flag(tp, NO_NVRAM))
return -EINVAL;
- if (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER)
- return -EAGAIN;
-
offset = eeprom->offset;
len = eeprom->len;
eeprom->len = 0;
@@ -11784,9 +11781,6 @@ static int tg3_set_eeprom(struct net_device *dev, struct ethtool_eeprom *eeprom,
u8 *buf;
__be32 start, end;
- if (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER)
- return -EAGAIN;
-
if (tg3_flag(tp, NO_NVRAM) ||
eeprom->magic != TG3_EEPROM_MAGIC)
return -EINVAL;
@@ -13515,7 +13509,7 @@ static void tg3_self_test(struct net_device *dev, struct ethtool_test *etest,
tg3_phy_start(tp);
}
if (tp->phy_flags & TG3_PHYFLG_IS_LOW_POWER)
- tg3_power_down(tp);
+ tg3_power_down_prepare(tp);
}
--
1.8.1.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net-next 3/6] tg3: Implement the shutdown handler
2013-07-29 20:58 [PATCH net-next 0/6] tg3: Misc changes Nithin Nayak Sujir
2013-07-29 20:58 ` [PATCH net-next 1/6] tg3: Remove incorrect switch to aux power Nithin Nayak Sujir
2013-07-29 20:58 ` [PATCH net-next 2/6] tg3: Allow NVRAM programming when interface is down Nithin Nayak Sujir
@ 2013-07-29 20:58 ` Nithin Nayak Sujir
2013-07-29 20:58 ` [PATCH net-next 4/6] tg3: Enable support for timesync gpio output Nithin Nayak Sujir
` (2 subsequent siblings)
5 siblings, 0 replies; 7+ messages in thread
From: Nithin Nayak Sujir @ 2013-07-29 20:58 UTC (permalink / raw)
To: davem; +Cc: netdev, Nithin Nayak Sujir, Michael Chan
Also remove the call to tg3_power_down_prepare() in tg3_power_down()
since tg3_close() calls it.
Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
---
drivers/net/ethernet/broadcom/tg3.c | 20 ++++++++++++++++++--
1 file changed, 18 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index ec244c9..9351707 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -4226,8 +4226,6 @@ static int tg3_power_down_prepare(struct tg3 *tp)
static void tg3_power_down(struct tg3 *tp)
{
- tg3_power_down_prepare(tp);
-
pci_wake_from_d3(tp->pdev, tg3_flag(tp, WOL_ENABLE));
pci_set_power_state(tp->pdev, PCI_D3hot);
}
@@ -17743,6 +17741,23 @@ out:
static SIMPLE_DEV_PM_OPS(tg3_pm_ops, tg3_suspend, tg3_resume);
+static void tg3_shutdown(struct pci_dev *pdev)
+{
+ struct net_device *dev = pci_get_drvdata(pdev);
+ struct tg3 *tp = netdev_priv(dev);
+
+ rtnl_lock();
+ netif_device_detach(dev);
+
+ if (netif_running(dev))
+ dev_close(dev);
+
+ if (system_state == SYSTEM_POWER_OFF)
+ tg3_power_down(tp);
+
+ rtnl_unlock();
+}
+
/**
* tg3_io_error_detected - called when PCI error is detected
* @pdev: Pointer to PCI device
@@ -17898,6 +17913,7 @@ static struct pci_driver tg3_driver = {
.remove = tg3_remove_one,
.err_handler = &tg3_err_handler,
.driver.pm = &tg3_pm_ops,
+ .shutdown = tg3_shutdown,
};
module_pci_driver(tg3_driver);
--
1.8.1.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net-next 4/6] tg3: Enable support for timesync gpio output
2013-07-29 20:58 [PATCH net-next 0/6] tg3: Misc changes Nithin Nayak Sujir
` (2 preceding siblings ...)
2013-07-29 20:58 ` [PATCH net-next 3/6] tg3: Implement the shutdown handler Nithin Nayak Sujir
@ 2013-07-29 20:58 ` Nithin Nayak Sujir
2013-07-29 20:58 ` [PATCH net-next 5/6] tg3: Fix UDP fragments treated as RMCP Nithin Nayak Sujir
2013-07-29 20:58 ` [PATCH net-next 6/6] tg3: Update version to 3.133 Nithin Nayak Sujir
5 siblings, 0 replies; 7+ messages in thread
From: Nithin Nayak Sujir @ 2013-07-29 20:58 UTC (permalink / raw)
To: davem; +Cc: netdev, Nithin Nayak Sujir, Richard Cochran, Michael Chan
The PTP_CAPABLE tg3 devices have a gpio output that is toggled when the
free running counter matches a watchdog value. This patch adds support
to set the watchdog and enable this feature.
Since the output is controlled via bits in the EAV_REF_CLCK_CTL
register, we have to read-modify-write it when we stop/resume.
Cc: Richard Cochran <richardcochran@gmail.com>
Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
---
drivers/net/ethernet/broadcom/tg3.c | 61 +++++++++++++++++++++++++++++++++++--
drivers/net/ethernet/broadcom/tg3.h | 11 ++++++-
2 files changed, 68 insertions(+), 4 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 9351707..f077c8f 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -6093,10 +6093,12 @@ static u64 tg3_refclk_read(struct tg3 *tp)
/* tp->lock must be held */
static void tg3_refclk_write(struct tg3 *tp, u64 newval)
{
- tw32(TG3_EAV_REF_CLCK_CTL, TG3_EAV_REF_CLCK_CTL_STOP);
+ u32 clock_ctl = tr32(TG3_EAV_REF_CLCK_CTL);
+
+ tw32(TG3_EAV_REF_CLCK_CTL, clock_ctl | TG3_EAV_REF_CLCK_CTL_STOP);
tw32(TG3_EAV_REF_CLCK_LSB, newval & 0xffffffff);
tw32(TG3_EAV_REF_CLCK_MSB, newval >> 32);
- tw32_f(TG3_EAV_REF_CLCK_CTL, TG3_EAV_REF_CLCK_CTL_RESUME);
+ tw32_f(TG3_EAV_REF_CLCK_CTL, clock_ctl | TG3_EAV_REF_CLCK_CTL_RESUME);
}
static inline void tg3_full_lock(struct tg3 *tp, int irq_sync);
@@ -6212,6 +6214,59 @@ static int tg3_ptp_settime(struct ptp_clock_info *ptp,
static int tg3_ptp_enable(struct ptp_clock_info *ptp,
struct ptp_clock_request *rq, int on)
{
+ struct tg3 *tp = container_of(ptp, struct tg3, ptp_info);
+ u32 clock_ctl;
+ int rval = 0;
+
+ switch (rq->type) {
+ case PTP_CLK_REQ_PEROUT:
+ if (rq->perout.index != 0)
+ return -EINVAL;
+
+ tg3_full_lock(tp, 0);
+ clock_ctl = tr32(TG3_EAV_REF_CLCK_CTL);
+ clock_ctl &= ~TG3_EAV_CTL_TSYNC_GPIO_MASK;
+
+ if (on) {
+ u64 nsec;
+
+ nsec = rq->perout.start.sec * 1000000000ULL +
+ rq->perout.start.nsec;
+
+ if (rq->perout.period.sec || rq->perout.period.nsec) {
+ netdev_warn(tp->dev,
+ "Device supports only a one-shot timesync output, period must be 0\n");
+ rval = -EINVAL;
+ goto err_out;
+ }
+
+ if (nsec & (1ULL << 63)) {
+ netdev_warn(tp->dev,
+ "Start value (nsec) is over limit. Maximum size of start is only 63 bits\n");
+ rval = -EINVAL;
+ goto err_out;
+ }
+
+ tw32(TG3_EAV_WATCHDOG0_LSB, (nsec & 0xffffffff));
+ tw32(TG3_EAV_WATCHDOG0_MSB,
+ TG3_EAV_WATCHDOG0_EN |
+ ((nsec >> 32) & TG3_EAV_WATCHDOG_MSB_MASK));
+
+ tw32(TG3_EAV_REF_CLCK_CTL,
+ clock_ctl | TG3_EAV_CTL_TSYNC_WDOG0);
+ } else {
+ tw32(TG3_EAV_WATCHDOG0_MSB, 0);
+ tw32(TG3_EAV_REF_CLCK_CTL, clock_ctl);
+ }
+
+err_out:
+ tg3_full_unlock(tp);
+ return rval;
+
+ default:
+ break;
+ }
+
return -EOPNOTSUPP;
}
@@ -6221,7 +6276,7 @@ static const struct ptp_clock_info tg3_ptp_caps = {
.max_adj = 250000000,
.n_alarm = 0,
.n_ext_ts = 0,
- .n_per_out = 0,
+ .n_per_out = 1,
.pps = 0,
.adjfreq = tg3_ptp_adjfreq,
.adjtime = tg3_ptp_adjtime,
diff --git a/drivers/net/ethernet/broadcom/tg3.h b/drivers/net/ethernet/broadcom/tg3.h
index cd63d11..2e0f3d3 100644
--- a/drivers/net/ethernet/broadcom/tg3.h
+++ b/drivers/net/ethernet/broadcom/tg3.h
@@ -1818,12 +1818,21 @@
#define TG3_EAV_REF_CLCK_CTL 0x00006908
#define TG3_EAV_REF_CLCK_CTL_STOP 0x00000002
#define TG3_EAV_REF_CLCK_CTL_RESUME 0x00000004
+#define TG3_EAV_CTL_TSYNC_GPIO_MASK (0x3 << 16)
+#define TG3_EAV_CTL_TSYNC_WDOG0 (1 << 17)
+
+#define TG3_EAV_WATCHDOG0_LSB 0x00006918
+#define TG3_EAV_WATCHDOG0_MSB 0x0000691c
+#define TG3_EAV_WATCHDOG0_EN (1 << 31)
+#define TG3_EAV_WATCHDOG_MSB_MASK 0x7fffffff
+
#define TG3_EAV_REF_CLK_CORRECT_CTL 0x00006928
#define TG3_EAV_REF_CLK_CORRECT_EN (1 << 31)
#define TG3_EAV_REF_CLK_CORRECT_NEG (1 << 30)
#define TG3_EAV_REF_CLK_CORRECT_MASK 0xffffff
-/* 0x690c --> 0x7000 unused */
+
+/* 0x692c --> 0x7000 unused */
/* NVRAM Control registers */
#define NVRAM_CMD 0x00007000
--
1.8.1.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net-next 5/6] tg3: Fix UDP fragments treated as RMCP
2013-07-29 20:58 [PATCH net-next 0/6] tg3: Misc changes Nithin Nayak Sujir
` (3 preceding siblings ...)
2013-07-29 20:58 ` [PATCH net-next 4/6] tg3: Enable support for timesync gpio output Nithin Nayak Sujir
@ 2013-07-29 20:58 ` Nithin Nayak Sujir
2013-07-29 20:58 ` [PATCH net-next 6/6] tg3: Update version to 3.133 Nithin Nayak Sujir
5 siblings, 0 replies; 7+ messages in thread
From: Nithin Nayak Sujir @ 2013-07-29 20:58 UTC (permalink / raw)
To: davem; +Cc: netdev, Nithin Nayak Sujir, Michael Chan
The 5762 devices sometimes incorrectly treat udp fragments as RMCP
packets and route to the APE. This patch sets the RX_MODE_IPV4_FRAG_FIX
bit for these devices which enables the proper behaviour.
Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
---
drivers/net/ethernet/broadcom/tg3.c | 3 +++
drivers/net/ethernet/broadcom/tg3.h | 1 +
2 files changed, 4 insertions(+)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index f077c8f..6e59ef1 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -10420,6 +10420,9 @@ static int tg3_reset_hw(struct tg3 *tp, bool reset_phy)
if (tg3_flag(tp, 5755_PLUS))
tp->rx_mode |= RX_MODE_IPV6_CSUM_ENABLE;
+ if (tg3_asic_rev(tp) == ASIC_REV_5762)
+ tp->rx_mode |= RX_MODE_IPV4_FRAG_FIX;
+
if (tg3_flag(tp, ENABLE_RSS))
tp->rx_mode |= RX_MODE_RSS_ENABLE |
RX_MODE_RSS_ITBL_HASH_BITS_7 |
diff --git a/drivers/net/ethernet/broadcom/tg3.h b/drivers/net/ethernet/broadcom/tg3.h
index 2e0f3d3..ddb8be1 100644
--- a/drivers/net/ethernet/broadcom/tg3.h
+++ b/drivers/net/ethernet/broadcom/tg3.h
@@ -532,6 +532,7 @@
#define RX_MODE_RSS_ITBL_HASH_BITS_7 0x00700000
#define RX_MODE_RSS_ENABLE 0x00800000
#define RX_MODE_IPV6_CSUM_ENABLE 0x01000000
+#define RX_MODE_IPV4_FRAG_FIX 0x02000000
#define MAC_RX_STATUS 0x0000046c
#define RX_STATUS_REMOTE_TX_XOFFED 0x00000001
#define RX_STATUS_XOFF_RCVD 0x00000002
--
1.8.1.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH net-next 6/6] tg3: Update version to 3.133
2013-07-29 20:58 [PATCH net-next 0/6] tg3: Misc changes Nithin Nayak Sujir
` (4 preceding siblings ...)
2013-07-29 20:58 ` [PATCH net-next 5/6] tg3: Fix UDP fragments treated as RMCP Nithin Nayak Sujir
@ 2013-07-29 20:58 ` Nithin Nayak Sujir
5 siblings, 0 replies; 7+ messages in thread
From: Nithin Nayak Sujir @ 2013-07-29 20:58 UTC (permalink / raw)
To: davem; +Cc: netdev, Nithin Nayak Sujir, Michael Chan
Signed-off-by: Nithin Nayak Sujir <nsujir@broadcom.com>
Signed-off-by: Michael Chan <mchan@broadcom.com>
---
drivers/net/ethernet/broadcom/tg3.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/tg3.c b/drivers/net/ethernet/broadcom/tg3.c
index 6e59ef1..2aa8624 100644
--- a/drivers/net/ethernet/broadcom/tg3.c
+++ b/drivers/net/ethernet/broadcom/tg3.c
@@ -94,10 +94,10 @@ static inline void _tg3_flag_clear(enum TG3_FLAGS flag, unsigned long *bits)
#define DRV_MODULE_NAME "tg3"
#define TG3_MAJ_NUM 3
-#define TG3_MIN_NUM 132
+#define TG3_MIN_NUM 133
#define DRV_MODULE_VERSION \
__stringify(TG3_MAJ_NUM) "." __stringify(TG3_MIN_NUM)
-#define DRV_MODULE_RELDATE "May 21, 2013"
+#define DRV_MODULE_RELDATE "Jul 29, 2013"
#define RESET_KIND_SHUTDOWN 0
#define RESET_KIND_INIT 1
--
1.8.1.4
^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2013-07-29 20:58 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-07-29 20:58 [PATCH net-next 0/6] tg3: Misc changes Nithin Nayak Sujir
2013-07-29 20:58 ` [PATCH net-next 1/6] tg3: Remove incorrect switch to aux power Nithin Nayak Sujir
2013-07-29 20:58 ` [PATCH net-next 2/6] tg3: Allow NVRAM programming when interface is down Nithin Nayak Sujir
2013-07-29 20:58 ` [PATCH net-next 3/6] tg3: Implement the shutdown handler Nithin Nayak Sujir
2013-07-29 20:58 ` [PATCH net-next 4/6] tg3: Enable support for timesync gpio output Nithin Nayak Sujir
2013-07-29 20:58 ` [PATCH net-next 5/6] tg3: Fix UDP fragments treated as RMCP Nithin Nayak Sujir
2013-07-29 20:58 ` [PATCH net-next 6/6] tg3: Update version to 3.133 Nithin Nayak Sujir
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).