You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
115 lines
4.5 KiB
115 lines
4.5 KiB
From 8ceaaed2176db0f499c5cddc22181ab081d2568a Mon Sep 17 00:00:00 2001
|
|
From: Igor Russkikh <irusskik@redhat.com>
|
|
Date: Fri, 6 Nov 2020 18:37:16 -0500
|
|
Subject: [PATCH 059/139] [netdrv] net: atlantic: ptp gpio adjustments
|
|
|
|
Message-id: <1604687916-15087-60-git-send-email-irusskik@redhat.com>
|
|
Patchwork-id: 338486
|
|
Patchwork-instance: patchwork
|
|
O-Subject: [RHEL8.4 BZ 1857861 059/139] net: atlantic: ptp gpio adjustments
|
|
Bugzilla: 1857861
|
|
RH-Acked-by: David Arcari <darcari@redhat.com>
|
|
RH-Acked-by: John Linville <linville@redhat.com>
|
|
RH-Acked-by: Tony Camuso <tcamuso@redhat.com>
|
|
|
|
Bugzilla: http://bugzilla.redhat.com/1857861
|
|
|
|
commit f08a464c27ca0a4050333baa271504b27ce834b7
|
|
Author: Egor Pomozov <epomozov@marvell.com>
|
|
Date: Fri Feb 14 18:44:53 2020 +0300
|
|
|
|
net: atlantic: ptp gpio adjustments
|
|
|
|
Clock adjustment data should be passed to FW as well, otherwise in some
|
|
cases a drift was observed when using GPIO features.
|
|
|
|
Signed-off-by: Egor Pomozov <epomozov@marvell.com>
|
|
Signed-off-by: Igor Russkikh <irusskikh@marvell.com>
|
|
Signed-off-by: Dmitry Bogdanov <dbogdanov@marvell.com>
|
|
Signed-off-by: David S. Miller <davem@davemloft.net>
|
|
|
|
Signed-off-by: Igor Russkikh <irusskik@redhat.com>
|
|
|
|
Cc: David Arcari <darcari@redhat.com>
|
|
Cc: Igor Russkikh <irusskik@redhat.com>
|
|
Signed-off-by: Jan Stancek <jstancek@redhat.com>
|
|
---
|
|
drivers/net/ethernet/aquantia/atlantic/aq_hw.h | 2 ++
|
|
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c | 4 +++-
|
|
.../ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c | 12 ++++++++++++
|
|
3 files changed, 17 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/drivers/net/ethernet/aquantia/atlantic/aq_hw.h b/drivers/net/ethernet/aquantia/atlantic/aq_hw.h
|
|
index e9cf5913b70a..c8d1bb38f746 100644
|
|
--- a/drivers/net/ethernet/aquantia/atlantic/aq_hw.h
|
|
+++ b/drivers/net/ethernet/aquantia/atlantic/aq_hw.h
|
|
@@ -337,6 +337,8 @@ struct aq_fw_ops {
|
|
|
|
void (*enable_ptp)(struct aq_hw_s *self, int enable);
|
|
|
|
+ void (*adjust_ptp)(struct aq_hw_s *self, uint64_t adj);
|
|
+
|
|
int (*set_eee_rate)(struct aq_hw_s *self, u32 speed);
|
|
|
|
int (*get_eee_rate)(struct aq_hw_s *self, u32 *rate,
|
|
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
|
|
index 5784da26f868..9acdb3fbb750 100644
|
|
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
|
|
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
|
|
@@ -1162,6 +1162,8 @@ static int hw_atl_b0_adj_sys_clock(struct aq_hw_s *self, s64 delta)
|
|
{
|
|
self->ptp_clk_offset += delta;
|
|
|
|
+ self->aq_fw_ops->adjust_ptp(self, self->ptp_clk_offset);
|
|
+
|
|
return 0;
|
|
}
|
|
|
|
@@ -1212,7 +1214,7 @@ static int hw_atl_b0_gpio_pulse(struct aq_hw_s *self, u32 index,
|
|
fwreq.ptp_gpio_ctrl.index = index;
|
|
fwreq.ptp_gpio_ctrl.period = period;
|
|
/* Apply time offset */
|
|
- fwreq.ptp_gpio_ctrl.start = start - self->ptp_clk_offset;
|
|
+ fwreq.ptp_gpio_ctrl.start = start;
|
|
|
|
size = sizeof(fwreq.msg_id) + sizeof(fwreq.ptp_gpio_ctrl);
|
|
return self->aq_fw_ops->send_fw_request(self, &fwreq, size);
|
|
diff --git a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c
|
|
index 97ebf849695f..77a4ed64830f 100644
|
|
--- a/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c
|
|
+++ b/drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils_fw2x.c
|
|
@@ -30,6 +30,9 @@
|
|
#define HW_ATL_FW3X_EXT_CONTROL_ADDR 0x378
|
|
#define HW_ATL_FW3X_EXT_STATE_ADDR 0x37c
|
|
|
|
+#define HW_ATL_FW3X_PTP_ADJ_LSW_ADDR 0x50a0
|
|
+#define HW_ATL_FW3X_PTP_ADJ_MSW_ADDR 0x50a4
|
|
+
|
|
#define HW_ATL_FW2X_CAP_PAUSE BIT(CAPS_HI_PAUSE)
|
|
#define HW_ATL_FW2X_CAP_ASYM_PAUSE BIT(CAPS_HI_ASYMMETRIC_PAUSE)
|
|
#define HW_ATL_FW2X_CAP_SLEEP_PROXY BIT(CAPS_HI_SLEEP_PROXY)
|
|
@@ -475,6 +478,14 @@ static void aq_fw3x_enable_ptp(struct aq_hw_s *self, int enable)
|
|
aq_hw_write_reg(self, HW_ATL_FW3X_EXT_CONTROL_ADDR, ptp_opts);
|
|
}
|
|
|
|
+static void aq_fw3x_adjust_ptp(struct aq_hw_s *self, uint64_t adj)
|
|
+{
|
|
+ aq_hw_write_reg(self, HW_ATL_FW3X_PTP_ADJ_LSW_ADDR,
|
|
+ (adj >> 0) & 0xffffffff);
|
|
+ aq_hw_write_reg(self, HW_ATL_FW3X_PTP_ADJ_MSW_ADDR,
|
|
+ (adj >> 32) & 0xffffffff);
|
|
+}
|
|
+
|
|
static int aq_fw2x_led_control(struct aq_hw_s *self, u32 mode)
|
|
{
|
|
if (self->fw_ver_actual < HW_ATL_FW_VER_LED)
|
|
@@ -633,4 +644,5 @@ const struct aq_fw_ops aq_fw_2x_ops = {
|
|
.enable_ptp = aq_fw3x_enable_ptp,
|
|
.led_control = aq_fw2x_led_control,
|
|
.set_phyloopback = aq_fw2x_set_phyloopback,
|
|
+ .adjust_ptp = aq_fw3x_adjust_ptp,
|
|
};
|
|
--
|
|
2.13.6
|
|
|