mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
synced 2026-05-13 23:29:10 -04:00
net: stmmac: dwmac-loongson: Move queue number init to common function
Currently, the tx and rx queue number initialization is duplicated in loongson_gmac_data() and loongson_gnet_data(), so move it to the common function loongson_default_data(). This is a preparation for later patches. Reviewed-by: Yanteng Si <si.yanteng@linux.dev> Tested-by: Henry Chen <chenx97@aosc.io> Tested-by: Biao Dong <dongbiao@loongson.cn> Signed-off-by: Baoqi Zhang <zhangbaoqi@loongson.cn> Signed-off-by: Huacai Chen <chenhuacai@loongson.cn> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:
committed by
David S. Miller
parent
5c3bf6cba7
commit
f438eee2c8
@@ -83,6 +83,8 @@ struct stmmac_pci_info {
|
|||||||
static void loongson_default_data(struct pci_dev *pdev,
|
static void loongson_default_data(struct pci_dev *pdev,
|
||||||
struct plat_stmmacenet_data *plat)
|
struct plat_stmmacenet_data *plat)
|
||||||
{
|
{
|
||||||
|
struct loongson_data *ld = plat->bsp_priv;
|
||||||
|
|
||||||
/* Get bus_id, this can be overwritten later */
|
/* Get bus_id, this can be overwritten later */
|
||||||
plat->bus_id = pci_dev_id(pdev);
|
plat->bus_id = pci_dev_id(pdev);
|
||||||
|
|
||||||
@@ -116,17 +118,6 @@ static void loongson_default_data(struct pci_dev *pdev,
|
|||||||
|
|
||||||
plat->dma_cfg->pbl = 32;
|
plat->dma_cfg->pbl = 32;
|
||||||
plat->dma_cfg->pblx8 = true;
|
plat->dma_cfg->pblx8 = true;
|
||||||
}
|
|
||||||
|
|
||||||
static int loongson_gmac_data(struct pci_dev *pdev,
|
|
||||||
struct plat_stmmacenet_data *plat)
|
|
||||||
{
|
|
||||||
struct loongson_data *ld;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
ld = plat->bsp_priv;
|
|
||||||
|
|
||||||
loongson_default_data(pdev, plat);
|
|
||||||
|
|
||||||
if (ld->loongson_id == DWMAC_CORE_LS_MULTICHAN) {
|
if (ld->loongson_id == DWMAC_CORE_LS_MULTICHAN) {
|
||||||
plat->rx_queues_to_use = CHANNEL_NUM;
|
plat->rx_queues_to_use = CHANNEL_NUM;
|
||||||
@@ -135,12 +126,18 @@ static int loongson_gmac_data(struct pci_dev *pdev,
|
|||||||
/* Only channel 0 supports checksum,
|
/* Only channel 0 supports checksum,
|
||||||
* so turn off checksum to enable multiple channels.
|
* so turn off checksum to enable multiple channels.
|
||||||
*/
|
*/
|
||||||
for (i = 1; i < CHANNEL_NUM; i++)
|
for (int i = 1; i < CHANNEL_NUM; i++)
|
||||||
plat->tx_queues_cfg[i].coe_unsupported = 1;
|
plat->tx_queues_cfg[i].coe_unsupported = 1;
|
||||||
} else {
|
} else {
|
||||||
plat->tx_queues_to_use = 1;
|
plat->tx_queues_to_use = 1;
|
||||||
plat->rx_queues_to_use = 1;
|
plat->rx_queues_to_use = 1;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int loongson_gmac_data(struct pci_dev *pdev,
|
||||||
|
struct plat_stmmacenet_data *plat)
|
||||||
|
{
|
||||||
|
loongson_default_data(pdev, plat);
|
||||||
|
|
||||||
plat->phy_interface = PHY_INTERFACE_MODE_RGMII_ID;
|
plat->phy_interface = PHY_INTERFACE_MODE_RGMII_ID;
|
||||||
|
|
||||||
@@ -172,27 +169,8 @@ static void loongson_gnet_fix_speed(void *priv, int speed, unsigned int mode)
|
|||||||
static int loongson_gnet_data(struct pci_dev *pdev,
|
static int loongson_gnet_data(struct pci_dev *pdev,
|
||||||
struct plat_stmmacenet_data *plat)
|
struct plat_stmmacenet_data *plat)
|
||||||
{
|
{
|
||||||
struct loongson_data *ld;
|
|
||||||
int i;
|
|
||||||
|
|
||||||
ld = plat->bsp_priv;
|
|
||||||
|
|
||||||
loongson_default_data(pdev, plat);
|
loongson_default_data(pdev, plat);
|
||||||
|
|
||||||
if (ld->loongson_id == DWMAC_CORE_LS_MULTICHAN) {
|
|
||||||
plat->rx_queues_to_use = CHANNEL_NUM;
|
|
||||||
plat->tx_queues_to_use = CHANNEL_NUM;
|
|
||||||
|
|
||||||
/* Only channel 0 supports checksum,
|
|
||||||
* so turn off checksum to enable multiple channels.
|
|
||||||
*/
|
|
||||||
for (i = 1; i < CHANNEL_NUM; i++)
|
|
||||||
plat->tx_queues_cfg[i].coe_unsupported = 1;
|
|
||||||
} else {
|
|
||||||
plat->tx_queues_to_use = 1;
|
|
||||||
plat->rx_queues_to_use = 1;
|
|
||||||
}
|
|
||||||
|
|
||||||
plat->phy_interface = PHY_INTERFACE_MODE_GMII;
|
plat->phy_interface = PHY_INTERFACE_MODE_GMII;
|
||||||
plat->mdio_bus_data->phy_mask = ~(u32)BIT(2);
|
plat->mdio_bus_data->phy_mask = ~(u32)BIT(2);
|
||||||
plat->fix_mac_speed = loongson_gnet_fix_speed;
|
plat->fix_mac_speed = loongson_gnet_fix_speed;
|
||||||
|
|||||||
Reference in New Issue
Block a user