summaryrefslogtreecommitdiff
path: root/drivers/net/ethernet/renesas/rswitch.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/ethernet/renesas/rswitch.h')
-rw-r--r--drivers/net/ethernet/renesas/rswitch.h62
1 files changed, 49 insertions, 13 deletions
diff --git a/drivers/net/ethernet/renesas/rswitch.h b/drivers/net/ethernet/renesas/rswitch.h
index edbdd1b98d3d..27d3d38c055f 100644
--- a/drivers/net/ethernet/renesas/rswitch.h
+++ b/drivers/net/ethernet/renesas/rswitch.h
@@ -13,9 +13,21 @@
#define RSWITCH_MAX_NUM_QUEUES 128
#define RSWITCH_NUM_PORTS 3
+#define rswitch_for_each_enabled_port(priv, i) \
+ for (i = 0; i < RSWITCH_NUM_PORTS; i++) \
+ if (priv->rdev[i]->disabled) \
+ continue; \
+ else
+
+#define rswitch_for_each_enabled_port_continue_reverse(priv, i) \
+ for (i--; i >= 0; i--) \
+ if (priv->rdev[i]->disabled) \
+ continue; \
+ else
#define TX_RING_SIZE 1024
#define RX_RING_SIZE 1024
+#define TS_RING_SIZE (TX_RING_SIZE * RSWITCH_NUM_PORTS)
#define PKT_BUF_SZ 1584
#define RSWITCH_ALIGN 128
@@ -38,6 +50,10 @@
#define AGENT_INDEX_GWCA 3
#define GWRO RSWITCH_GWCA0_OFFSET
+#define GWCA_TS_IRQ_RESOURCE_NAME "gwca0_rxts0"
+#define GWCA_TS_IRQ_NAME "rswitch: gwca0_rxts0"
+#define GWCA_TS_IRQ_BIT BIT(0)
+
#define FWRO 0
#define TPRO RSWITCH_TOP_OFFSET
#define CARO RSWITCH_COMA_OFFSET
@@ -820,7 +836,7 @@ enum DIE_DT {
DT_FSINGLE = 0x80,
DT_FSTART = 0x90,
DT_FMID = 0xa0,
- DT_FEND = 0xb8,
+ DT_FEND = 0xb0,
/* Chain control */
DT_LEMPTY = 0xc0,
@@ -832,7 +848,7 @@ enum DIE_DT {
DT_FEMPTY = 0x40,
DT_FEMPTY_IS = 0x10,
DT_FEMPTY_IC = 0x20,
- DT_FEMPTY_ND = 0x38,
+ DT_FEMPTY_ND = 0x30,
DT_FEMPTY_START = 0x50,
DT_FEMPTY_MID = 0x60,
DT_FEMPTY_END = 0x70,
@@ -854,6 +870,12 @@ enum DIE_DT {
/* For reception */
#define INFO1_SPN(port) ((u64)(port) << 36ULL)
+/* For timestamp descriptor in dptrl (Byte 4 to 7) */
+#define TS_DESC_TSUN(dptrl) ((dptrl) & GENMASK(7, 0))
+#define TS_DESC_SPN(dptrl) (((dptrl) & GENMASK(10, 8)) >> 8)
+#define TS_DESC_DPN(dptrl) (((dptrl) & GENMASK(17, 16)) >> 16)
+#define TS_DESC_TN(dptrl) ((dptrl) & BIT(24))
+
struct rswitch_desc {
__le16 info_ds; /* Descriptor size */
u8 die_dt; /* Descriptor interrupt enable and type */
@@ -900,27 +922,43 @@ struct rswitch_etha {
* name, this driver calls "queue".
*/
struct rswitch_gwca_queue {
- int index;
- bool dir_tx;
- bool gptp;
union {
- struct rswitch_ext_desc *ring;
- struct rswitch_ext_ts_desc *ts_ring;
+ struct rswitch_ext_desc *tx_ring;
+ struct rswitch_ext_ts_desc *rx_ring;
+ struct rswitch_ts_desc *ts_ring;
};
+
+ /* Common */
dma_addr_t ring_dma;
int ring_size;
int cur;
int dirty;
- struct sk_buff **skbs;
+ /* For [rt]_ring */
+ int index;
+ bool dir_tx;
+ struct sk_buff **skbs;
struct net_device *ndev; /* queue to ndev for irq */
};
+struct rswitch_gwca_ts_info {
+ struct sk_buff *skb;
+ struct list_head list;
+
+ int port;
+ u8 tag;
+};
+
#define RSWITCH_NUM_IRQ_REGS (RSWITCH_MAX_NUM_QUEUES / BITS_PER_TYPE(u32))
struct rswitch_gwca {
int index;
+ struct rswitch_desc *linkfix_table;
+ dma_addr_t linkfix_table_dma;
+ u32 linkfix_table_size;
struct rswitch_gwca_queue *queues;
int num_queues;
+ struct rswitch_gwca_queue ts_queue;
+ struct list_head ts_info_list;
DECLARE_BITMAP(used, RSWITCH_MAX_NUM_QUEUES);
u32 tx_irq_bits[RSWITCH_NUM_IRQ_REGS];
u32 rx_irq_bits[RSWITCH_NUM_IRQ_REGS];
@@ -932,15 +970,16 @@ struct rswitch_device {
struct rswitch_private *priv;
struct net_device *ndev;
struct napi_struct napi;
- struct phylink *phylink;
- struct phylink_config phylink_config;
void __iomem *addr;
struct rswitch_gwca_queue *tx_queue;
struct rswitch_gwca_queue *rx_queue;
u8 ts_tag;
+ bool disabled;
int port;
struct rswitch_etha *etha;
+ struct device_node *np_port;
+ struct phy *serdes;
};
struct rswitch_mfwd_mac_table_entry {
@@ -957,9 +996,6 @@ struct rswitch_private {
struct platform_device *pdev;
void __iomem *addr;
struct rcar_gen4_ptp_private *ptp_priv;
- struct rswitch_desc *linkfix_table;
- dma_addr_t linkfix_table_dma;
- u32 linkfix_table_size;
struct rswitch_device *rdev[RSWITCH_NUM_PORTS];