From: Ilias Apalodimas <ilias.apalodimas@linaro.org>
To: netdev@vger.kernel.org, grygorii.strashko@ti.com,
ivan.khoronzhuk@linaro.org, nsekhar@ti.com, jiri@resnulli.us,
ivecera@redhat.com
Cc: francois.ozog@linaro.org, yogeshs@ti.com, spatton@ti.com,
Ilias Apalodimas <ilias.apalodimas@linaro.org>
Subject: [PATCH 1/4] cpsw: move common headers definitions to cpsw_priv.h
Date: Thu, 24 May 2018 09:56:21 +0300 [thread overview]
Message-ID: <1527144984-31236-2-git-send-email-ilias.apalodimas@linaro.org> (raw)
In-Reply-To: <1527144984-31236-1-git-send-email-ilias.apalodimas@linaro.org>
Signed-off-by: Ilias Apalodimas <ilias.apalodimas@linaro.org>
---
drivers/net/ethernet/ti/cpsw.c | 111 +---------------------------
drivers/net/ethernet/ti/cpsw_priv.h | 141 ++++++++++++++++++++++++++++++++++++
2 files changed, 142 insertions(+), 110 deletions(-)
create mode 100644 drivers/net/ethernet/ti/cpsw_priv.h
diff --git a/drivers/net/ethernet/ti/cpsw.c b/drivers/net/ethernet/ti/cpsw.c
index 3037127..b16e7cf 100644
--- a/drivers/net/ethernet/ti/cpsw.c
+++ b/drivers/net/ethernet/ti/cpsw.c
@@ -41,6 +41,7 @@
#include "cpsw.h"
#include "cpsw_ale.h"
+#include "cpsw_priv.h"
#include "cpts.h"
#include "davinci_cpdma.h"
@@ -88,7 +89,6 @@ do { \
#define CPSW_VERSION_3 0x19010f
#define CPSW_VERSION_4 0x190112
-#define HOST_PORT_NUM 0
#define CPSW_ALE_PORTS_NUM 3
#define SLIVER_SIZE 0x40
@@ -309,16 +309,6 @@ struct cpsw_ss_regs {
#define CPSW_MAX_BLKS_TX_SHIFT 4
#define CPSW_MAX_BLKS_RX 5
-struct cpsw_host_regs {
- u32 max_blks;
- u32 blk_cnt;
- u32 tx_in_ctl;
- u32 port_vlan;
- u32 tx_pri_map;
- u32 cpdma_tx_pri_map;
- u32 cpdma_rx_chan_map;
-};
-
struct cpsw_sliver_regs {
u32 id_ver;
u32 mac_control;
@@ -370,105 +360,6 @@ struct cpsw_hw_stats {
u32 rxdmaoverruns;
};
-struct cpsw_slave_data {
- struct device_node *phy_node;
- char phy_id[MII_BUS_ID_SIZE];
- int phy_if;
- u8 mac_addr[ETH_ALEN];
- u16 dual_emac_res_vlan; /* Reserved VLAN for DualEMAC */
-};
-
-struct cpsw_platform_data {
- struct cpsw_slave_data *slave_data;
- u32 ss_reg_ofs; /* Subsystem control register offset */
- u32 channels; /* number of cpdma channels (symmetric) */
- u32 slaves; /* number of slave cpgmac ports */
- u32 active_slave; /* time stamping, ethtool and SIOCGMIIPHY slave */
- u32 ale_entries; /* ale table size */
- u32 bd_ram_size; /*buffer descriptor ram size */
- u32 mac_control; /* Mac control register */
- u16 default_vlan; /* Def VLAN for ALE lookup in VLAN aware mode*/
- bool dual_emac; /* Enable Dual EMAC mode */
-};
-
-struct cpsw_slave {
- void __iomem *regs;
- struct cpsw_sliver_regs __iomem *sliver;
- int slave_num;
- u32 mac_control;
- struct cpsw_slave_data *data;
- struct phy_device *phy;
- struct net_device *ndev;
- u32 port_vlan;
-};
-
-static inline u32 slave_read(struct cpsw_slave *slave, u32 offset)
-{
- return readl_relaxed(slave->regs + offset);
-}
-
-static inline void slave_write(struct cpsw_slave *slave, u32 val, u32 offset)
-{
- writel_relaxed(val, slave->regs + offset);
-}
-
-struct cpsw_vector {
- struct cpdma_chan *ch;
- int budget;
-};
-
-struct cpsw_common {
- struct device *dev;
- struct cpsw_platform_data data;
- struct napi_struct napi_rx;
- struct napi_struct napi_tx;
- struct cpsw_ss_regs __iomem *regs;
- struct cpsw_wr_regs __iomem *wr_regs;
- u8 __iomem *hw_stats;
- struct cpsw_host_regs __iomem *host_port_regs;
- u32 version;
- u32 coal_intvl;
- u32 bus_freq_mhz;
- int rx_packet_max;
- struct cpsw_slave *slaves;
- struct cpdma_ctlr *dma;
- struct cpsw_vector txv[CPSW_MAX_QUEUES];
- struct cpsw_vector rxv[CPSW_MAX_QUEUES];
- struct cpsw_ale *ale;
- bool quirk_irq;
- bool rx_irq_disabled;
- bool tx_irq_disabled;
- u32 irqs_table[IRQ_NUM];
- struct cpts *cpts;
- int rx_ch_num, tx_ch_num;
- int speed;
- int usage_count;
-};
-
-struct cpsw_priv {
- struct net_device *ndev;
- struct device *dev;
- u32 msg_enable;
- u8 mac_addr[ETH_ALEN];
- bool rx_pause;
- bool tx_pause;
- u32 emac_port;
- struct cpsw_common *cpsw;
-};
-
-struct cpsw_stats {
- char stat_string[ETH_GSTRING_LEN];
- int type;
- int sizeof_stat;
- int stat_offset;
-};
-
-enum {
- CPSW_STATS,
- CPDMA_RX_STATS,
- CPDMA_TX_STATS,
-};
-
#define CPSW_STAT(m) CPSW_STATS, \
sizeof(((struct cpsw_hw_stats *)0)->m), \
offsetof(struct cpsw_hw_stats, m)
diff --git a/drivers/net/ethernet/ti/cpsw_priv.h b/drivers/net/ethernet/ti/cpsw_priv.h
new file mode 100644
index 0000000..3b02a83
--- /dev/null
+++ b/drivers/net/ethernet/ti/cpsw_priv.h
@@ -0,0 +1,141 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+#include <linux/netdevice.h>
+#include <linux/platform_device.h>
+
+#define HOST_PORT_NUM 0
+#define IRQ_NUM 2
+#define CPSW_MAX_QUEUES 8
+
+#define CPSW_VERSION_1 0x19010a
+#define CPSW_VERSION_2 0x19010c
+#define CPSW_VERSION_3 0x19010f
+#define CPSW_VERSION_4 0x190112
+
+/* CPSW_PORT_V1 */
+#define CPSW1_MAX_BLKS 0x00 /* Maximum FIFO Blocks */
+#define CPSW1_BLK_CNT 0x04 /* FIFO Block Usage Count (Read Only) */
+#define CPSW1_TX_IN_CTL 0x08 /* Transmit FIFO Control */
+#define CPSW1_PORT_VLAN 0x0c /* VLAN Register */
+#define CPSW1_TX_PRI_MAP 0x10 /* Tx Header Priority to Switch Pri Mapping */
+#define CPSW1_TS_CTL 0x14 /* Time Sync Control */
+#define CPSW1_TS_SEQ_LTYPE 0x18 /* Time Sync Sequence ID Offset and Msg Type */
+#define CPSW1_TS_VLAN 0x1c /* Time Sync VLAN1 and VLAN2 */
+
+/* CPSW_PORT_V2 */
+#define CPSW2_CONTROL 0x00 /* Control Register */
+#define CPSW2_MAX_BLKS 0x08 /* Maximum FIFO Blocks */
+#define CPSW2_BLK_CNT 0x0c /* FIFO Block Usage Count (Read Only) */
+#define CPSW2_TX_IN_CTL 0x10 /* Transmit FIFO Control */
+#define CPSW2_PORT_VLAN 0x14 /* VLAN Register */
+#define CPSW2_TX_PRI_MAP 0x18 /* Tx Header Priority to Switch Pri Mapping */
+#define CPSW2_TS_SEQ_MTYPE 0x1c /* Time Sync Sequence ID Offset and Msg Type */
+
+struct cpsw_slave_data {
+ struct device_node *phy_node;
+ char phy_id[MII_BUS_ID_SIZE];
+ int phy_if;
+ u8 mac_addr[ETH_ALEN];
+ u16 dual_emac_res_vlan; /* Reserved VLAN for DualEMAC */
+};
+
+struct cpsw_platform_data {
+ struct cpsw_slave_data *slave_data;
+ u32 ss_reg_ofs; /* Subsystem control register offset */
+ u32 channels; /* number of cpdma channels (symmetric) */
+ u32 slaves; /* number of slave cpgmac ports */
+ u32 active_slave; /* time stamping, ethtool and SIOCGMIIPHY slave */
+ u32 ale_entries; /* ale table size */
+ u32 bd_ram_size; /*buffer descriptor ram size */
+ u32 mac_control; /* Mac control register */
+ u16 default_vlan; /* Def VLAN for ALE lookup in VLAN aware mode*/
+ bool dual_emac; /* Enable Dual EMAC mode */
+};
+
+struct cpsw_slave {
+ void __iomem *regs;
+ struct cpsw_sliver_regs __iomem *sliver;
+ int slave_num;
+ u32 mac_control;
+ struct cpsw_slave_data *data;
+ struct phy_device *phy;
+ struct net_device *ndev;
+ u32 port_vlan;
+};
+
+struct cpsw_vector {
+ struct cpdma_chan *ch;
+ int budget;
+};
+
+struct cpsw_common {
+ struct device *dev;
+ struct cpsw_platform_data data;
+ struct napi_struct napi_rx;
+ struct napi_struct napi_tx;
+ struct cpsw_ss_regs __iomem *regs;
+ struct cpsw_wr_regs __iomem *wr_regs;
+ u8 __iomem *hw_stats;
+ struct cpsw_host_regs __iomem *host_port_regs;
+ u32 version;
+ u32 coal_intvl;
+ u32 bus_freq_mhz;
+ int rx_packet_max;
+ struct cpsw_slave *slaves;
+ struct cpdma_ctlr *dma;
+ struct cpsw_vector txv[CPSW_MAX_QUEUES];
+ struct cpsw_vector rxv[CPSW_MAX_QUEUES];
+ struct cpsw_ale *ale;
+ bool quirk_irq;
+ bool rx_irq_disabled;
+ bool tx_irq_disabled;
+ u32 irqs_table[IRQ_NUM];
+ struct cpts *cpts;
+ int rx_ch_num, tx_ch_num;
+ int speed;
+ int usage_count;
+};
+
+struct cpsw_priv {
+ struct net_device *ndev;
+ struct device *dev;
+ u32 msg_enable;
+ u8 mac_addr[ETH_ALEN];
+ bool rx_pause;
+ bool tx_pause;
+ u8 port_state[3];
+ u32 emac_port;
+ struct cpsw_common *cpsw;
+};
+
+struct cpsw_stats {
+ char stat_string[ETH_GSTRING_LEN];
+ int type;
+ int sizeof_stat;
+ int stat_offset;
+};
+
+enum {
+ CPSW_STATS,
+ CPDMA_RX_STATS,
+ CPDMA_TX_STATS,
+};
+
+struct cpsw_host_regs {
+ u32 max_blks;
+ u32 blk_cnt;
+ u32 tx_in_ctl;
+ u32 port_vlan;
+ u32 tx_pri_map;
+ u32 cpdma_tx_pri_map;
+ u32 cpdma_rx_chan_map;
+};
+
+static inline u32 slave_read(struct cpsw_slave *slave, u32 offset)
+{
+ return readl_relaxed(slave->regs + offset);
+}
+
+static inline void slave_write(struct cpsw_slave *slave, u32 val, u32 offset)
+{
+ writel_relaxed(val, slave->regs + offset);
+}
--
2.7.4
next prev parent reply other threads:[~2018-05-24 6:56 UTC|newest]
Thread overview: 53+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-05-24 6:56 [PATCH 0/4] RFC CPSW switchdev mode Ilias Apalodimas
2018-05-24 6:56 ` Ilias Apalodimas [this message]
2018-05-24 6:56 ` [PATCH 2/4] cpsw_ale: add support functions for switchdev Ilias Apalodimas
2018-05-24 6:56 ` [PATCH 3/4] cpsw_switchdev: add switchdev support files Ilias Apalodimas
2018-05-24 10:00 ` Maxim Uvarov
2018-05-27 4:39 ` kbuild test robot
2018-05-24 6:56 ` [PATCH 4/4] cpsw: add switchdev support Ilias Apalodimas
2018-05-24 13:12 ` Andrew Lunn
2018-05-24 13:32 ` Ilias Apalodimas
2018-05-24 16:39 ` Andrew Lunn
2018-05-25 4:56 ` Ilias Apalodimas
2018-06-01 21:48 ` Florian Fainelli
2018-06-02 10:34 ` Ilias Apalodimas
2018-06-02 16:10 ` Florian Fainelli
2018-06-02 16:52 ` Ilias Apalodimas
2018-06-05 21:03 ` Grygorii Strashko
2018-06-05 21:37 ` Florian Fainelli
2018-05-24 8:05 ` [PATCH 0/4] RFC CPSW switchdev mode Jiri Pirko
2018-05-24 8:48 ` Ilias Apalodimas
2018-05-24 12:54 ` Andrew Lunn
2018-05-24 13:44 ` Ivan Vecera
2018-05-24 14:08 ` Ilias Apalodimas
2018-05-24 14:54 ` Andrew Lunn
2018-05-24 15:07 ` Ilias Apalodimas
2018-05-24 15:25 ` Andrew Lunn
2018-05-24 16:02 ` Ilias Apalodimas
2018-05-24 16:33 ` Andrew Lunn
2018-05-25 6:29 ` Ilias Apalodimas
2018-05-25 10:28 ` Ilias Apalodimas
2018-05-25 11:59 ` Andrew Lunn
2018-05-25 12:09 ` Andrew Lunn
2018-05-31 15:27 ` Ilias Apalodimas
2018-06-02 23:28 ` Grygorii Strashko
2018-06-03 0:08 ` Andrew Lunn
2018-06-05 21:18 ` Grygorii Strashko
2018-06-05 21:28 ` Andrew Lunn
2018-06-05 21:42 ` Grygorii Strashko
2018-06-05 21:55 ` Andrew Lunn
2018-06-03 0:26 ` Andrew Lunn
2018-06-05 23:23 ` Grygorii Strashko
2018-06-05 23:49 ` Andrew Lunn
2018-06-06 8:23 ` Ivan Khoronzhuk
2018-06-03 0:37 ` Andrew Lunn
2018-06-05 21:31 ` Grygorii Strashko
2018-06-05 21:37 ` Andrew Lunn
2018-06-03 0:49 ` Andrew Lunn
2018-06-05 22:45 ` Grygorii Strashko
2018-06-05 23:40 ` Andrew Lunn
2018-06-01 21:29 ` Grygorii Strashko
2018-06-02 14:08 ` Andrew Lunn
2018-06-05 22:59 ` Grygorii Strashko
2018-06-05 23:53 ` Andrew Lunn
2018-06-06 6:42 ` Ilias Apalodimas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1527144984-31236-2-git-send-email-ilias.apalodimas@linaro.org \
--to=ilias.apalodimas@linaro.org \
--cc=francois.ozog@linaro.org \
--cc=grygorii.strashko@ti.com \
--cc=ivan.khoronzhuk@linaro.org \
--cc=ivecera@redhat.com \
--cc=jiri@resnulli.us \
--cc=netdev@vger.kernel.org \
--cc=nsekhar@ti.com \
--cc=spatton@ti.com \
--cc=yogeshs@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).