diff options
9 files changed, 150 insertions, 14 deletions
diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth.h b/drivers/net/ethernet/freescale/dpa/dpaa_eth.h index cda8f2c..d179fda 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_eth.h +++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth.h @@ -565,7 +565,7 @@ static inline uint16_t dpa_get_buffer_size(struct dpa_buffer_layout_s *bl, return dpa_get_headroom(bl) + data_size; } -void fm_mac_dump_regs(struct fm_mac_dev *fm_mac_dev); +int fm_mac_dump_regs(struct mac_device *h_dev, char *buf, int n); void dpaa_eth_sysfs_remove(struct device *dev); void dpaa_eth_sysfs_init(struct device *dev); diff --git a/drivers/net/ethernet/freescale/dpa/dpaa_eth_sysfs.c b/drivers/net/ethernet/freescale/dpa/dpaa_eth_sysfs.c index 16071b3..5bb7339 100644 --- a/drivers/net/ethernet/freescale/dpa/dpaa_eth_sysfs.c +++ b/drivers/net/ethernet/freescale/dpa/dpaa_eth_sysfs.c @@ -164,13 +164,14 @@ static ssize_t dpaa_eth_show_mac_regs(struct device *dev, { struct dpa_priv_s *priv = netdev_priv(to_net_dev(dev)); struct mac_device *mac_dev = priv->mac_dev; + int n = 0; if (mac_dev) - fm_mac_dump_regs(mac_dev->get_mac_handle(mac_dev)); + n = fm_mac_dump_regs(mac_dev, buf, n); else return sprintf(buf, "no mac registers\n"); - return 0; + return n; } diff --git a/drivers/net/ethernet/freescale/dpa/mac-api.c b/drivers/net/ethernet/freescale/dpa/mac-api.c index 328d55a..438fe1f 100644 --- a/drivers/net/ethernet/freescale/dpa/mac-api.c +++ b/drivers/net/ethernet/freescale/dpa/mac-api.c @@ -46,6 +46,11 @@ #include "error_ext.h" /* GET_ERROR_TYPE, E_OK */ +#include "../fman/inc/flib/fsl_fman_dtsec.h" +#include "../fman/inc/flib/fsl_fman_tgec.h" +#include "../fman/inc/flib/fsl_fman_memac.h" +#include "../fman/src/wrapper/lnxwrp_sysfs_fm.h" + #define MAC_DESCRIPTION "FSL FMan MAC API based driver" MODULE_LICENSE("Dual BSD/GPL"); @@ -457,6 +462,139 @@ static struct fm_mac_dev *get_mac_handle(struct mac_device *mac_dev) return priv->fm_mac; } +static int dtsec_dump_regs(struct mac_device *h_mac, char *buf, int nn) +{ + struct dtsec_regs *p_mm = (struct dtsec_regs *) h_mac->vaddr; + int i = 0, n = nn; + + FM_DMP_SUBTITLE(buf, n, "\n"); + + FM_DMP_TITLE(buf, n, p_mm, "FM MAC - DTSEC-%d", h_mac->cell_index); + + FM_DMP_V32(buf, n, p_mm, tsec_id); + FM_DMP_V32(buf, n, p_mm, tsec_id2); + FM_DMP_V32(buf, n, p_mm, ievent); + FM_DMP_V32(buf, n, p_mm, imask); + FM_DMP_V32(buf, n, p_mm, ecntrl); + FM_DMP_V32(buf, n, p_mm, ptv); + FM_DMP_V32(buf, n, p_mm, tmr_ctrl); + FM_DMP_V32(buf, n, p_mm, tmr_pevent); + FM_DMP_V32(buf, n, p_mm, tmr_pemask); + FM_DMP_V32(buf, n, p_mm, tctrl); + FM_DMP_V32(buf, n, p_mm, rctrl); + FM_DMP_V32(buf, n, p_mm, maccfg1); + FM_DMP_V32(buf, n, p_mm, maccfg2); + FM_DMP_V32(buf, n, p_mm, ipgifg); + FM_DMP_V32(buf, n, p_mm, hafdup); + FM_DMP_V32(buf, n, p_mm, maxfrm); + + FM_DMP_V32(buf, n, p_mm, macstnaddr1); + FM_DMP_V32(buf, n, p_mm, macstnaddr2); + + for (i = 0; i < 7; ++i) { + FM_DMP_V32(buf, n, p_mm, macaddr[i].exact_match1); + FM_DMP_V32(buf, n, p_mm, macaddr[i].exact_match2); + } + + FM_DMP_V32(buf, n, p_mm, car1); + FM_DMP_V32(buf, n, p_mm, car2); + + return n; +} + +static int xgmac_dump_regs(struct mac_device *h_mac, char *buf, int nn) +{ + struct tgec_regs *p_mm = (struct tgec_regs *) h_mac->vaddr; + int n = nn; + + FM_DMP_SUBTITLE(buf, n, "\n"); + FM_DMP_TITLE(buf, n, p_mm, "FM MAC - TGEC -%d", h_mac->cell_index); + + FM_DMP_V32(buf, n, p_mm, tgec_id); + FM_DMP_V32(buf, n, p_mm, command_config); + FM_DMP_V32(buf, n, p_mm, mac_addr_0); + FM_DMP_V32(buf, n, p_mm, mac_addr_1); + FM_DMP_V32(buf, n, p_mm, maxfrm); + FM_DMP_V32(buf, n, p_mm, pause_quant); + FM_DMP_V32(buf, n, p_mm, rx_fifo_sections); + FM_DMP_V32(buf, n, p_mm, tx_fifo_sections); + FM_DMP_V32(buf, n, p_mm, rx_fifo_almost_f_e); + FM_DMP_V32(buf, n, p_mm, tx_fifo_almost_f_e); + FM_DMP_V32(buf, n, p_mm, hashtable_ctrl); + FM_DMP_V32(buf, n, p_mm, mdio_cfg_status); + FM_DMP_V32(buf, n, p_mm, mdio_command); + FM_DMP_V32(buf, n, p_mm, mdio_data); + FM_DMP_V32(buf, n, p_mm, mdio_regaddr); + FM_DMP_V32(buf, n, p_mm, status); + FM_DMP_V32(buf, n, p_mm, tx_ipg_len); + FM_DMP_V32(buf, n, p_mm, mac_addr_2); + FM_DMP_V32(buf, n, p_mm, mac_addr_3); + FM_DMP_V32(buf, n, p_mm, rx_fifo_ptr_rd); + FM_DMP_V32(buf, n, p_mm, rx_fifo_ptr_wr); + FM_DMP_V32(buf, n, p_mm, tx_fifo_ptr_rd); + FM_DMP_V32(buf, n, p_mm, tx_fifo_ptr_wr); + FM_DMP_V32(buf, n, p_mm, imask); + FM_DMP_V32(buf, n, p_mm, ievent); + + return n; +} + +static int memac_dump_regs(struct mac_device *h_mac, char *buf, int nn) +{ + struct memac_regs *p_mm = (struct memac_regs *) h_mac->vaddr; + int i = 0, n = nn; + + FM_DMP_SUBTITLE(buf, n, "\n"); + FM_DMP_TITLE(buf, n, p_mm, "FM MAC - MEMAC -%d", h_mac->cell_index); + + FM_DMP_V32(buf, n, p_mm, command_config); + FM_DMP_V32(buf, n, p_mm, mac_addr0.mac_addr_l); + FM_DMP_V32(buf, n, p_mm, mac_addr0.mac_addr_u); + FM_DMP_V32(buf, n, p_mm, maxfrm); + FM_DMP_V32(buf, n, p_mm, hashtable_ctrl); + FM_DMP_V32(buf, n, p_mm, ievent); + FM_DMP_V32(buf, n, p_mm, tx_ipg_length); + FM_DMP_V32(buf, n, p_mm, imask); + + for (i = 0; i < 4; ++i) + FM_DMP_V32(buf, n, p_mm, pause_quanta[i]); + + for (i = 0; i < 4; ++i) + FM_DMP_V32(buf, n, p_mm, pause_thresh[i]); + + FM_DMP_V32(buf, n, p_mm, rx_pause_status); + + for (i = 0; i < MEMAC_NUM_OF_PADDRS; ++i) { + FM_DMP_V32(buf, n, p_mm, mac_addr[i].mac_addr_l); + FM_DMP_V32(buf, n, p_mm, mac_addr[i].mac_addr_u); + } + + FM_DMP_V32(buf, n, p_mm, lpwake_timer); + FM_DMP_V32(buf, n, p_mm, sleep_timer); + FM_DMP_V32(buf, n, p_mm, statn_config); + FM_DMP_V32(buf, n, p_mm, if_mode); + FM_DMP_V32(buf, n, p_mm, if_status); + FM_DMP_V32(buf, n, p_mm, hg_config); + FM_DMP_V32(buf, n, p_mm, hg_pause_quanta); + FM_DMP_V32(buf, n, p_mm, hg_pause_thresh); + FM_DMP_V32(buf, n, p_mm, hgrx_pause_status); + FM_DMP_V32(buf, n, p_mm, hg_fifos_status); + FM_DMP_V32(buf, n, p_mm, rhm); + FM_DMP_V32(buf, n, p_mm, thm); + + return n; +} + +int fm_mac_dump_regs(struct mac_device *h_mac, char *buf, int nn) +{ + int n = nn; + + n = h_mac->dump_mac_regs(h_mac, buf, n); + + return n; +} + + static void __cold setup_dtsec(struct mac_device *mac_dev) { mac_dev->init_phy = dtsec_init_phy; @@ -480,6 +618,7 @@ static void __cold setup_dtsec(struct mac_device *mac_dev) mac_dev->fm_rtc_set_drift = fm_rtc_set_drift; mac_dev->fm_rtc_set_alarm = fm_rtc_set_alarm; mac_dev->fm_rtc_set_fiper = fm_rtc_set_fiper; + mac_dev->dump_mac_regs = dtsec_dump_regs; } static void __cold setup_xgmac(struct mac_device *mac_dev) @@ -495,6 +634,7 @@ static void __cold setup_xgmac(struct mac_device *mac_dev) mac_dev->get_mac_handle = get_mac_handle; mac_dev->set_tx_pause = fm_mac_set_tx_pause_frames; mac_dev->set_rx_pause = fm_mac_set_rx_ignore_pause_frames; + mac_dev->dump_mac_regs = xgmac_dump_regs; } static void __cold setup_memac(struct mac_device *mac_dev) @@ -518,6 +658,7 @@ static void __cold setup_memac(struct mac_device *mac_dev) mac_dev->fm_rtc_set_drift = fm_rtc_set_drift; mac_dev->fm_rtc_set_alarm = fm_rtc_set_alarm; mac_dev->fm_rtc_set_fiper = fm_rtc_set_fiper; + mac_dev->dump_mac_regs = memac_dump_regs; } void (*const mac_setup[])(struct mac_device *mac_dev) = { diff --git a/drivers/net/ethernet/freescale/dpa/mac.h b/drivers/net/ethernet/freescale/dpa/mac.h index 7545a1c..270ee90 100644 --- a/drivers/net/ethernet/freescale/dpa/mac.h +++ b/drivers/net/ethernet/freescale/dpa/mac.h @@ -93,6 +93,8 @@ struct mac_device { int (*fm_rtc_set_alarm)(struct fm *fm_dev, uint32_t id, uint64_t time); int (*fm_rtc_set_fiper)(struct fm *fm_dev, uint32_t id, uint64_t fiper); + int (*dump_mac_regs)(struct mac_device *h_mac, char *buf, int nn); + }; struct mac_address { diff --git a/drivers/net/ethernet/freescale/fman/inc/flib/fsl_fman_dtsec.h b/drivers/net/ethernet/freescale/fman/inc/flib/fsl_fman_dtsec.h index 445e73c8..628ef3a 100644 --- a/drivers/net/ethernet/freescale/fman/inc/flib/fsl_fman_dtsec.h +++ b/drivers/net/ethernet/freescale/fman/inc/flib/fsl_fman_dtsec.h @@ -185,7 +185,7 @@ #define DTSEC_IMASK_TDPEEN 0x00000002 #define DTSEC_IMASK_RDPEEN 0x00000001 -#define EVENTS_MASK \ +#define DTSEC_EVENTS_MASK \ ((uint32_t)(DTSEC_IMASK_BREN | \ DTSEC_IMASK_RXCEN | \ DTSEC_IMASK_BTEN | \ diff --git a/drivers/net/ethernet/freescale/fman/inc/flib/fsl_fman_memac.h b/drivers/net/ethernet/freescale/fman/inc/flib/fsl_fman_memac.h index 503eebb..314463c 100644 --- a/drivers/net/ethernet/freescale/fman/inc/flib/fsl_fman_memac.h +++ b/drivers/net/ethernet/freescale/fman/inc/flib/fsl_fman_memac.h @@ -84,7 +84,7 @@ #define HASH_TABLE_SIZE 64 /* Hash tbl size */ /* Transmit Inter-Packet Gap Length Register (TX_IPG_LENGTH) */ -#define TX_IPG_LENGTH_MASK 0x0000003F +#define MEMAC_TX_IPG_LENGTH_MASK 0x0000003F /* Statistics Configuration Register (STATN_CONFIG) */ #define STATS_CFG_CLR 0x00000004 /* 29 Reset all counters */ diff --git a/drivers/net/ethernet/freescale/fman/inc/flib/fsl_fman_tgec.h b/drivers/net/ethernet/freescale/fman/inc/flib/fsl_fman_tgec.h index b95ef37..e031ccf 100644 --- a/drivers/net/ethernet/freescale/fman/inc/flib/fsl_fman_tgec.h +++ b/drivers/net/ethernet/freescale/fman/inc/flib/fsl_fman_tgec.h @@ -105,7 +105,7 @@ enum tgec_counters { #define TGEC_IMASK_RX_CRC_ER 0x00000002 #define TGEC_IMASK_RX_ALIGN_ER 0x00000001 -#define EVENTS_MASK \ +#define TGEC_EVENTS_MASK \ ((uint32_t)(TGEC_IMASK_MDIO_SCAN_EVENT | \ TGEC_IMASK_MDIO_CMD_CMPL | \ TGEC_IMASK_REM_FAULT | \ diff --git a/drivers/net/ethernet/freescale/fman/src/inc/wrapper/lnxwrp_fsl_fman.h b/drivers/net/ethernet/freescale/fman/src/inc/wrapper/lnxwrp_fsl_fman.h index f182e3f..37f8193 100644 --- a/drivers/net/ethernet/freescale/fman/src/inc/wrapper/lnxwrp_fsl_fman.h +++ b/drivers/net/ethernet/freescale/fman/src/inc/wrapper/lnxwrp_fsl_fman.h @@ -427,8 +427,6 @@ int fm_rtc_set_alarm(struct fm *fm_dev, uint32_t id, int fm_rtc_set_fiper(struct fm *fm_dev, uint32_t id, uint64_t fiper); -void fm_mac_dump_regs(struct fm_mac_dev *fm_mac_dev); - /** @} */ /* end of FM_LnxKern_ctrl_grp group */ /** @} */ /* end of FM_LnxKern_grp group */ diff --git a/drivers/net/ethernet/freescale/fman/src/wrapper/lnxwrp_fm.c b/drivers/net/ethernet/freescale/fman/src/wrapper/lnxwrp_fm.c index 82ba4f7..0645bfe 100644 --- a/drivers/net/ethernet/freescale/fman/src/wrapper/lnxwrp_fm.c +++ b/drivers/net/ethernet/freescale/fman/src/wrapper/lnxwrp_fm.c @@ -1764,12 +1764,6 @@ int fm_rtc_set_fiper(struct fm *fm_dev, uint32_t id, } EXPORT_SYMBOL(fm_rtc_set_fiper); -void fm_mac_dump_regs(struct fm_mac_dev *fm_mac_dev) -{ - FM_MAC_DumpRegs(fm_mac_dev); -} -EXPORT_SYMBOL(fm_mac_dump_regs); - void fm_mutex_lock(void) { mutex_lock(&lnxwrp_mutex); |