diff options
Diffstat (limited to 'src/drivers/net/marvell')
| -rw-r--r-- | src/drivers/net/marvell/aqc1xx.c | 154 | ||||
| -rw-r--r-- | src/drivers/net/marvell/aqc1xx.h | 24 | ||||
| -rw-r--r-- | src/drivers/net/marvell/atl2_hw.c | 59 | ||||
| -rw-r--r-- | src/drivers/net/marvell/atl2_hw.h | 46 | ||||
| -rw-r--r-- | src/drivers/net/marvell/atl_hw.c | 79 | ||||
| -rw-r--r-- | src/drivers/net/marvell/atl_hw.h | 18 |
6 files changed, 175 insertions, 205 deletions
diff --git a/src/drivers/net/marvell/aqc1xx.c b/src/drivers/net/marvell/aqc1xx.c index 42b8164ac..b108bf75d 100644 --- a/src/drivers/net/marvell/aqc1xx.c +++ b/src/drivers/net/marvell/aqc1xx.c @@ -2,7 +2,7 @@ * * Marvell AQtion family network card driver. * - * Copyright(C) 2017-2021 Marvell + * Copyright(C) 2017-2024 Marvell * * SPDX-License-Identifier: BSD-2-Clause * @@ -56,8 +56,7 @@ extern struct atl_hw_ops atl2_hw; */ static int atl_ring_alloc ( const struct atl_nic *nic, struct atl_ring *ring, - uint32_t desc_size, uint32_t reg_base ) -{ + uint32_t desc_size, uint32_t reg_base ) { physaddr_t phy_addr; /* Allocate ring buffer.*/ @@ -75,8 +74,8 @@ static int atl_ring_alloc ( const struct atl_nic *nic, struct atl_ring *ring, phy_addr = dma ( &ring->map, ring->ring ); /* Write ring address (hi & low parts).*/ - ATL_WRITE_REG ( (uint32_t)phy_addr, reg_base ); - ATL_WRITE_REG ( (uint32_t)(((uint64_t)phy_addr) >> 32), reg_base + 4 ); + ATL_WRITE_REG ( ( uint32_t )phy_addr, reg_base ); + ATL_WRITE_REG ( ( uint32_t ) ( ( ( uint64_t )phy_addr ) >> 32 ), reg_base + 4 ); /* Write ring length.*/ ATL_WRITE_REG ( ATL_RING_SIZE, reg_base + 8 ); @@ -84,35 +83,31 @@ static int atl_ring_alloc ( const struct atl_nic *nic, struct atl_ring *ring, ring->sw_head = ring->sw_tail = 0; DBGC ( nic, "AQUANTIA: %p ring is at [%08llx,%08llx), reg base %#x\n", - nic, ((unsigned long long)phy_addr), - ((unsigned long long) phy_addr + ring->length), reg_base ); + nic, ( ( unsigned long long )phy_addr ), + ( ( unsigned long long ) phy_addr + ring->length ), reg_base ); return 0; } -static void atl_ring_free ( struct atl_ring *ring ) -{ +static void atl_ring_free ( struct atl_ring *ring ) { dma_free ( &ring->map, ring->ring, ring->length ); ring->ring = NULL; ring->length = 0; } -static void atl_ring_next_dx ( unsigned int *val ) -{ +static void atl_ring_next_dx ( unsigned int *val ) { ++( *val ); if ( *val == ATL_RING_SIZE ) *val = 0; } -int atl_ring_full ( const struct atl_ring *ring ) -{ +int atl_ring_full ( const struct atl_ring *ring ) { unsigned int tail = ring->sw_tail; atl_ring_next_dx ( &tail ); return tail == ring->sw_head; } -void atl_rx_ring_fill ( struct atl_nic *nic ) -{ +void atl_rx_ring_fill ( struct atl_nic *nic ) { struct atl_desc_rx *rx; struct io_buffer *iobuf; physaddr_t address; @@ -143,8 +138,8 @@ void atl_rx_ring_fill ( struct atl_nic *nic ) DBGC( nic, "AQUANTIA: RX[%d] is [%llx,%llx)\n", nic->rx_ring.sw_tail, - ( (unsigned long long)address), - ( (unsigned long long)address + ATL_RX_MAX_LEN) ); + ( ( unsigned long long )address ), + ( ( unsigned long long )address + ATL_RX_MAX_LEN ) ); atl_ring_next_dx ( &nic->rx_ring.sw_tail ); refilled++; @@ -163,23 +158,22 @@ void atl_rx_ring_fill ( struct atl_nic *nic ) * @v netdev Network device * @ret rc Return status code */ -static int atl_open ( struct net_device *netdev ) -{ +static int atl_open ( struct net_device *netdev ) { struct atl_nic *nic = netdev->priv; uint32_t ctrl = 0; /* Tx ring */ - if ( atl_ring_alloc ( nic, &nic->tx_ring, sizeof(struct atl_desc_tx), + if ( atl_ring_alloc ( nic, &nic->tx_ring, sizeof ( struct atl_desc_tx ), ATL_TX_DMA_DESC_ADDR ) != 0 ) goto err_tx_alloc; /* Rx ring */ - if ( atl_ring_alloc ( nic, &nic->rx_ring, sizeof(struct atl_desc_rx), + if ( atl_ring_alloc ( nic, &nic->rx_ring, sizeof ( struct atl_desc_rx ), ATL_RX_DMA_DESC_ADDR ) != 0 ) goto err_rx_alloc; /* Allocate interrupt vectors */ - ATL_WRITE_REG ( (ATL_IRQ_CTRL_COR_EN | ATL_IRQ_CTRL_REG_RST_DIS), + ATL_WRITE_REG ( ( ATL_IRQ_CTRL_COR_EN | ATL_IRQ_CTRL_REG_RST_DIS ), ATL_IRQ_CTRL ); /*TX & RX Interruprt Mapping*/ @@ -197,7 +191,7 @@ static int atl_open ( struct net_device *netdev ) ctrl = ATL_IRQ_TX | ATL_IRQ_RX; /* itr mask */ ATL_WRITE_REG ( ctrl, ATL_ITR_MSKS ); - ATL_WRITE_REG ( (uint32_t)ATL_RX_MAX_LEN / 1024U, + ATL_WRITE_REG ( ( uint32_t )ATL_RX_MAX_LEN / 1024U, ATL_RX_DMA_DESC_BUF_SIZE ); /*filter global ctrl */ @@ -219,8 +213,8 @@ static int atl_open ( struct net_device *netdev ) ATL_WRITE_REG ( ctrl, ATL_RPB0_CTRL2 ); /*RPB global ctrl*/ - ctrl = ATL_READ_REG(ATL_RPB_CTRL); - ctrl |= (ATL_RPB_CTRL_EN | ATL_RPB_CTRL_FC); + ctrl = ATL_READ_REG ( ATL_RPB_CTRL ); + ctrl |= ( ATL_RPB_CTRL_EN | ATL_RPB_CTRL_FC ); ATL_WRITE_REG ( ctrl, ATL_RPB_CTRL ); /*TX data path*/ @@ -266,8 +260,7 @@ err_tx_alloc: * * @v netdev Network device */ -static void atl_close ( struct net_device *netdev ) -{ +static void atl_close ( struct net_device *netdev ) { struct atl_nic *nic = netdev->priv; nic->hw_ops->stop ( nic ); @@ -276,9 +269,9 @@ static void atl_close ( struct net_device *netdev ) /* tgb global ctrl */ ATL_WRITE_REG ( ATL_TPB_CTRL_DIS, ATL_TPB_CTRL); - ATL_WRITE_REG ( ATL_READ_REG(ATL_RING_TX_CTRL) | (~ATL_RING_TX_CTRL_EN), + ATL_WRITE_REG ( ATL_READ_REG ( ATL_RING_TX_CTRL ) | ( ~ATL_RING_TX_CTRL_EN ), ATL_RING_TX_CTRL ); - ATL_WRITE_REG ( ATL_READ_REG(ATL_RING_RX_CTRL) | (~ATL_RING_RX_CTRL_EN), + ATL_WRITE_REG ( ATL_READ_REG ( ATL_RING_RX_CTRL ) | ( ~ATL_RING_RX_CTRL_EN ), ATL_RING_RX_CTRL ); /* clear itr mask */ @@ -298,8 +291,7 @@ static void atl_close ( struct net_device *netdev ) * @v iobuf I/O buffer * @ret rc Return status code */ -int atl_transmit ( struct net_device *netdev, struct io_buffer *iobuf ) -{ +int atl_transmit ( struct net_device *netdev, struct io_buffer *iobuf ) { struct atl_nic *nic = netdev->priv; struct atl_desc_tx *tx; physaddr_t address; @@ -311,7 +303,7 @@ int atl_transmit ( struct net_device *netdev, struct io_buffer *iobuf ) return -ENOBUFS; } - tx = (struct atl_desc_tx *)nic->tx_ring.ring + nic->tx_ring.sw_tail; + tx = ( struct atl_desc_tx * )nic->tx_ring.ring + nic->tx_ring.sw_tail; /* Populate transmit descriptor */ memset ( tx, 0, sizeof ( *tx ) ); @@ -320,17 +312,17 @@ int atl_transmit ( struct net_device *netdev, struct io_buffer *iobuf ) len = iob_len ( iobuf ); tx->status = 0x1; - tx->status = ( (tx->status) & ~ATL_DESC_TX_BUF_LEN_MASK) | - ((len << ATL_DESC_TX_BUF_LEN_OFFSET) & - ATL_DESC_TX_BUF_LEN_MASK ); - tx->status = ((tx->status) & ~ATL_DESC_TX_EOP_MASK) | + tx->status = ( (tx->status) & ~ATL_DESC_TX_BUF_LEN_MASK) | + ( (len << ATL_DESC_TX_BUF_LEN_OFFSET) & + ATL_DESC_TX_BUF_LEN_MASK ); + tx->status = ((tx->status) & ~ATL_DESC_TX_EOP_MASK) | ( (ATL_DESC_TX_DX_EOP_VALUE << ATL_DESC_TX_EOP_OFFSET) & ATL_DESC_TX_EOP_MASK ); - tx->status = ( (tx->status) & ~ATL_DESC_TX_CMD_MASK) | - ((ATL_DESC_TX_CMD_VALUE << ATL_DESC_TX_CMD_OFFSET) & - ATL_DESC_TX_CMD_MASK ); - tx->flag = ( (tx->flag) & ~ATL_DESC_TX_PAY_LEN_MASK) | - ((len << ATL_DESC_TX_PAY_LEN_OFFSET) & + tx->status = ( (tx->status) & ~ATL_DESC_TX_CMD_MASK) | + ( (ATL_DESC_TX_CMD_VALUE << ATL_DESC_TX_CMD_OFFSET) & + ATL_DESC_TX_CMD_MASK ); + tx->flag = ( (tx->flag) & ~ATL_DESC_TX_PAY_LEN_MASK) | + ( (len << ATL_DESC_TX_PAY_LEN_OFFSET) & ATL_DESC_TX_PAY_LEN_MASK ); wmb(); @@ -345,8 +337,7 @@ int atl_transmit ( struct net_device *netdev, struct io_buffer *iobuf ) return 0; } -void atl_check_link ( struct net_device *netdev ) -{ +void atl_check_link ( struct net_device *netdev ) { struct atl_nic *nic = netdev->priv; uint32_t link_state; @@ -372,8 +363,7 @@ void atl_check_link ( struct net_device *netdev ) * * @v netdev Network device */ -void atl_poll_tx ( struct net_device *netdev ) -{ +void atl_poll_tx ( struct net_device *netdev ) { struct atl_nic *nic = netdev->priv; struct atl_desc_tx_wb *tx; @@ -385,7 +375,7 @@ void atl_poll_tx ( struct net_device *netdev ) nic->tx_ring.sw_head; /* Stop if descriptor is still in use */ - if ( !(tx->status & cpu_to_le32 ( ATL_TX_DESC_STATUS_DD ) ) ) + if ( !( tx->status & cpu_to_le32 ( ATL_TX_DESC_STATUS_DD ) ) ) return; DBGC2 ( nic, "AQUANTIA: %p TX[%d] complete\n", @@ -402,8 +392,7 @@ void atl_poll_tx ( struct net_device *netdev ) * * @v netdev Network device */ -void atl_poll_rx ( struct net_device *netdev ) -{ +void atl_poll_rx ( struct net_device *netdev ) { struct atl_nic *nic = netdev->priv; struct atl_desc_rx_wb *rx; struct io_buffer *iobuf; @@ -413,11 +402,11 @@ void atl_poll_rx ( struct net_device *netdev ) while ( nic->rx_ring.sw_head != nic->rx_ring.sw_tail ) { /* Get next receive descriptor */ - rx = (struct atl_desc_rx_wb *)nic->rx_ring.ring + + rx = ( struct atl_desc_rx_wb * )nic->rx_ring.ring + nic->rx_ring.sw_head; /* Stop if descriptor is still in use */ - if ( !(rx->status & cpu_to_le16(ATL_RX_DESC_STATUS_DD)) ) + if ( !( rx->status & cpu_to_le16( ATL_RX_DESC_STATUS_DD ) ) ) return; /* Populate I/O buffer */ @@ -441,8 +430,7 @@ void atl_poll_rx ( struct net_device *netdev ) * * @v netdev Network device */ -static void atl_poll ( struct net_device *netdev ) -{ +static void atl_poll ( struct net_device *netdev ) { struct atl_nic *nic = netdev->priv; /* Check link state */ @@ -464,8 +452,7 @@ static void atl_poll ( struct net_device *netdev ) * @v netdev Network device * @v enable Interrupts should be enabled */ -static void atl_irq ( struct net_device *netdev, int enable ) -{ +static void atl_irq ( struct net_device *netdev, int enable ) { struct atl_nic *nic = netdev->priv; uint32_t mask; @@ -498,8 +485,7 @@ static struct net_device_operations atl_operations = { * @v pci PCI device * @ret rc Return status code */ -static int atl_probe ( struct pci_device *pci ) -{ +static int atl_probe ( struct pci_device *pci ) { struct net_device *netdev; struct atl_nic *nic; int rc = ENOERR; @@ -515,7 +501,7 @@ static int atl_probe ( struct pci_device *pci ) nic = netdev->priv; pci_set_drvdata ( pci, netdev ); netdev->dev = &pci->dev; - memset( nic, 0, sizeof( *nic ) ); + memset( nic, 0, sizeof ( *nic ) ); nic->flags = pci->id->driver_data; /* Fix up PCI device */ @@ -580,8 +566,7 @@ err_alloc: * * @v pci PCI device */ -static void atl_remove ( struct pci_device *pci ) -{ +static void atl_remove ( struct pci_device *pci ) { struct net_device *netdev = pci_get_drvdata ( pci ); struct atl_nic *nic = netdev->priv; @@ -601,43 +586,44 @@ static void atl_remove ( struct pci_device *pci ) static struct pci_device_id atl_nics[] = { /* Atlantic 1 */ /* 10G */ - PCI_ROM(0x1D6A, 0x0001, "AQC07", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A1), - PCI_ROM(0x1D6A, 0xD107, "AQC07", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A1), - PCI_ROM(0x1D6A, 0x07B1, "AQC07", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A1), - PCI_ROM(0x1D6A, 0x87B1, "AQC07", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A1), + PCI_ROM ( 0x1D6A, 0x0001, "AQC07", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A1 ), + PCI_ROM ( 0x1D6A, 0xD107, "AQC07", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A1 ), + PCI_ROM ( 0x1D6A, 0x07B1, "AQC07", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A1 ), + PCI_ROM ( 0x1D6A, 0x87B1, "AQC07", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A1 ), /* SFP */ - PCI_ROM(0x1D6A, 0xD100, "AQC00", "Felicity Network Adapter", ATL_FLAG_A1), - PCI_ROM(0x1D6A, 0x00B1, "AQC00", "Felicity Network Adapter", ATL_FLAG_A1), - PCI_ROM(0x1D6A, 0x80B1, "AQC00", "Felicity Network Adapter", ATL_FLAG_A1), + PCI_ROM ( 0x1D6A, 0xD100, "AQC00", "Felicity Network Adapter", ATL_FLAG_A1 ), + PCI_ROM ( 0x1D6A, 0x00B1, "AQC00", "Felicity Network Adapter", ATL_FLAG_A1 ), + PCI_ROM ( 0x1D6A, 0x80B1, "AQC00", "Felicity Network Adapter", ATL_FLAG_A1 ), /* 5G */ - PCI_ROM(0x1D6A, 0xD108, "AQC08", "Marvell AQtion 5Gbit Network Adapter", ATL_FLAG_A1), - PCI_ROM(0x1D6A, 0x08B1, "AQC08", "Marvell AQtion 5Gbit Network Adapter", ATL_FLAG_A1), - PCI_ROM(0x1D6A, 0x88B1, "AQC08", "Marvell AQtion 5Gbit Network Adapter", ATL_FLAG_A1), - PCI_ROM(0x1D6A, 0x11B1, "AQC11", "Marvell AQtion 5Gbit Network Adapter", ATL_FLAG_A1), - PCI_ROM(0x1D6A, 0x91B1, "AQC11", "Marvell AQtion 5Gbit Network Adapter", ATL_FLAG_A1), + PCI_ROM ( 0x1D6A, 0xD108, "AQC08", "Marvell AQtion 5Gbit Network Adapter", ATL_FLAG_A1 ), + PCI_ROM ( 0x1D6A, 0x08B1, "AQC08", "Marvell AQtion 5Gbit Network Adapter", ATL_FLAG_A1 ), + PCI_ROM ( 0x1D6A, 0x88B1, "AQC08", "Marvell AQtion 5Gbit Network Adapter", ATL_FLAG_A1 ), + PCI_ROM ( 0x1D6A, 0x11B1, "AQC11", "Marvell AQtion 5Gbit Network Adapter", ATL_FLAG_A1 ), + PCI_ROM ( 0x1D6A, 0x91B1, "AQC11", "Marvell AQtion 5Gbit Network Adapter", ATL_FLAG_A1 ), /* 2.5G */ - PCI_ROM(0x1D6A, 0xD109, "AQC09", "Marvell AQtion 2.5Gbit Network Adapter", ATL_FLAG_A1), - PCI_ROM(0x1D6A, 0x09B1, "AQC09", "Marvell AQtion 2.5Gbit Network Adapter", ATL_FLAG_A1), - PCI_ROM(0x1D6A, 0x89B1, "AQC09", "Marvell AQtion 2.5Gbit Network Adapter", ATL_FLAG_A1), - PCI_ROM(0x1D6A, 0x12B1, "AQC12", "Marvell AQtion 2.5Gbit Network Adapter", ATL_FLAG_A1), - PCI_ROM(0x1D6A, 0x92B1, "AQC12", "Marvell AQtion 2.5Gbit Network Adapter", ATL_FLAG_A1), + PCI_ROM ( 0x1D6A, 0xD109, "AQC09", "Marvell AQtion 2.5Gbit Network Adapter", ATL_FLAG_A1 ), + PCI_ROM ( 0x1D6A, 0x09B1, "AQC09", "Marvell AQtion 2.5Gbit Network Adapter", ATL_FLAG_A1 ), + PCI_ROM ( 0x1D6A, 0x89B1, "AQC09", "Marvell AQtion 2.5Gbit Network Adapter", ATL_FLAG_A1 ), + PCI_ROM ( 0x1D6A, 0x12B1, "AQC12", "Marvell AQtion 2.5Gbit Network Adapter", ATL_FLAG_A1 ), + PCI_ROM ( 0x1D6A, 0x92B1, "AQC12", "Marvell AQtion 2.5Gbit Network Adapter", ATL_FLAG_A1 ), /* Atlantic 2 */ - PCI_ROM(0x1D6A, 0x00C0, "AQC13", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A2), - PCI_ROM(0x1D6A, 0x94C0, "AQC13", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A2), - PCI_ROM(0x1D6A, 0x93C0, "AQC13", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A2), - PCI_ROM(0x1D6A, 0x04C0, "AQC13", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A2), - PCI_ROM(0x1D6A, 0x14C0, "AQC13", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A2), - PCI_ROM(0x1D6A, 0x12C0, "AQC13", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A2), + PCI_ROM ( 0x1D6A, 0x00C0, "AQC13", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A2 ), + PCI_ROM ( 0x1D6A, 0x94C0, "AQC13", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A2 ), + PCI_ROM ( 0x1D6A, 0x93C0, "AQC13", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A2 ), + PCI_ROM ( 0x1D6A, 0x04C0, "AQC13", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A2 ), + PCI_ROM ( 0x1D6A, 0x14C0, "AQC13", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A2 ), + PCI_ROM ( 0x1D6A, 0x12C0, "AQC13", "Marvell AQtion 10Gbit Network Adapter", ATL_FLAG_A2 ), + PCI_ROM ( 0x1D6A, 0x03C0, "AQC14", "Marvell AQtion 5Gbit Network Adapter", ATL_FLAG_A2 ), }; /** Marvell PCI driver */ struct pci_driver atl_driver __pci_driver = { .ids = atl_nics, - .id_count = (sizeof(atl_nics) / sizeof(atl_nics[0])), + .id_count = ( sizeof( atl_nics ) / sizeof ( atl_nics[0] ) ), .probe = atl_probe, .remove = atl_remove, -};
\ No newline at end of file +}; diff --git a/src/drivers/net/marvell/aqc1xx.h b/src/drivers/net/marvell/aqc1xx.h index c3e34e1e7..26bdd00f0 100644 --- a/src/drivers/net/marvell/aqc1xx.h +++ b/src/drivers/net/marvell/aqc1xx.h @@ -2,7 +2,7 @@ * * Marvell AQtion family network card driver definitions. * - * Copyright(C) 2017-2021 Marvell + * Copyright(C) 2017-2024 Marvell * * SPDX-License-Identifier: BSD-2-Clause * @@ -177,14 +177,14 @@ FILE_LICENCE ( BSD2 ); #define ATL_FLAG_A2 0x2 /*write register*/ -#define ATL_WRITE_REG(VAL, REG) writel(VAL, nic->regs + (REG)) -#define ATL_READ_REG(REG) readl(nic->regs + (REG)) /*read register*/ +#define ATL_WRITE_REG( VAL, REG ) writel( VAL, nic->regs + (REG) ) +#define ATL_READ_REG( REG ) readl( nic->regs + (REG) ) /*read register*/ struct atl_desc_tx { uint64_t address; uint32_t status; uint32_t flag; -} __attribute__((packed)); +} __attribute__ (( packed )); #define ATL_DESC_TX_DX_TYPE_VALUE 0x1 @@ -206,7 +206,7 @@ struct atl_desc_tx_wb { uint64_t rsvd1; uint32_t status; uint32_t rsvd4; -} __attribute__((packed)); +} __attribute__ (( packed )); #define ATL_TX_DESC_STATUS_DD 0x00100000UL @@ -214,14 +214,14 @@ struct atl_desc_rx { uint64_t data_addr; uint64_t hdr_addr; -} __attribute__((packed)); +} __attribute__ (( packed )); struct atl_desc_rx_wb { uint64_t rsvd2; uint16_t status; uint16_t pkt_len; uint32_t rsvd4; -} __attribute__((packed)); +} __attribute__ (( packed )); #define ATL_RX_DESC_STATUS_DD 0x0001UL #define ATL_RX_DESC_STATUS_EOP 0x0002UL @@ -237,11 +237,11 @@ struct atl_ring { struct atl_nic; struct atl_hw_ops { - int (*reset) (struct atl_nic *nic); - int (*start) (struct atl_nic *nic); - int (*stop) (struct atl_nic *nic); - int (*get_link) (struct atl_nic *nic); - int (*get_mac) (struct atl_nic *, uint8_t *mac); + int ( *reset ) ( struct atl_nic *nic ); + int ( *start ) ( struct atl_nic *nic ); + int ( *stop ) ( struct atl_nic *nic ); + int ( *get_link ) ( struct atl_nic *nic ); + int ( *get_mac ) ( struct atl_nic *, uint8_t *mac ); }; /** An aQuanita network card */ diff --git a/src/drivers/net/marvell/atl2_hw.c b/src/drivers/net/marvell/atl2_hw.c index 0c57a12fc..07822a9c2 100644 --- a/src/drivers/net/marvell/atl2_hw.c +++ b/src/drivers/net/marvell/atl2_hw.c @@ -2,20 +2,20 @@ * * Marvell AQtion family network card driver, hardware-specific functions. * - * Copyright(C) 2017-2021 Marvell + * Copyright(C) 2017-2024 Marvell * * SPDX-License-Identifier: BSD-2-Clause * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: - - * 1. Redistributions of source code must retain the above copyright notice, + + * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO,THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR HOLDER OR @@ -31,6 +31,7 @@ FILE_LICENCE ( BSD2 ); +#include <string.h> #include <errno.h> #include <stdio.h> #include <unistd.h> @@ -39,8 +40,7 @@ FILE_LICENCE ( BSD2 ); #include "aqc1xx.h" #include "atl2_hw.h" -static int atl2_hw_boot_completed_ ( struct atl_nic *nic ) -{ +static int atl2_hw_boot_completed_ ( struct atl_nic *nic ) { uint32_t reset_status = ATL_READ_REG ( ATL2_GLB_RST_CTRL2 ); return ( reset_status & ATL2_RESET_STATUS_BOOT_COMPLETED_MASK ) || @@ -49,8 +49,7 @@ static int atl2_hw_boot_completed_ ( struct atl_nic *nic ) } void atl2_hw_read_shared_in_ ( struct atl_nic *nic, uint32_t offset, - uint32_t *data, uint32_t len ) -{ + uint32_t *data, uint32_t len ) { uint32_t i; for (i = 0; i < len; ++i ) @@ -60,8 +59,7 @@ void atl2_hw_read_shared_in_ ( struct atl_nic *nic, uint32_t offset, } void atl2_hw_write_shared_in_ ( struct atl_nic *nic, uint32_t offset, - uint32_t *data, uint32_t len ) -{ + uint32_t *data, uint32_t len ) { uint32_t i; for ( i = 0; i < len; ++i ) @@ -70,17 +68,16 @@ void atl2_hw_write_shared_in_ ( struct atl_nic *nic, uint32_t offset, } } -int atl2_hw_finish_ack_ ( struct atl_nic *nic, uint32_t ms ) -{ +int atl2_hw_finish_ack_ ( struct atl_nic *nic, uint32_t ms ) { uint32_t i; int err = 0; - ATL_WRITE_REG ( ATL_READ_REG(ATL2_HOST_FINISHED_WRITE ) + ATL_WRITE_REG ( ATL_READ_REG ( ATL2_HOST_FINISHED_WRITE ) | 1, ATL2_HOST_FINISHED_WRITE ); - for ( i = 0; i < (ms / 100); ++i ) + for ( i = 0; i < ( ms / 100 ); ++i ) { - if ( ( ATL_READ_REG(ATL2_MCP_BUSY_WRITE ) & 1 ) == 0 ) + if ( ( ATL_READ_REG ( ATL2_MCP_BUSY_WRITE ) & 1 ) == 0 ) { break; } @@ -92,8 +89,7 @@ int atl2_hw_finish_ack_ ( struct atl_nic *nic, uint32_t ms ) return err; } -int atl2_hw_fw_init_ ( struct atl_nic *nic ) -{ +int atl2_hw_fw_init_ ( struct atl_nic *nic ) { uint32_t val; int err = 0; @@ -113,8 +109,7 @@ int atl2_hw_fw_init_ ( struct atl_nic *nic ) return err; } -int atl2_hw_reset ( struct atl_nic *nic ) -{ +int atl2_hw_reset ( struct atl_nic *nic ) { int completed = 0; uint32_t status = 0; uint32_t request; @@ -131,7 +126,7 @@ int atl2_hw_reset ( struct atl_nic *nic ) status = ATL_READ_REG ( ATL2_GLB_RST_CTRL2 ); if ( ( ( status & ATL2_RESET_STATUS_BC_STARTED ) && - (status != 0xFFFFFFFFu ) ) ) + ( status != 0xFFFFFFFFu ) ) ) break; udelay ( ATL2_DELAY_10 ); @@ -184,19 +179,17 @@ err_exit: return err; } -int atl2_hw_start ( struct atl_nic *nic ) -{ +int atl2_hw_start ( struct atl_nic *nic ) { uint32_t val; atl2_hw_read_shared_in_ ( nic, ATL2_LINK_OPTS_IN_OFF, &val, 1 ); val = 0x4B00FFE1; atl2_hw_write_shared_in_ ( nic, ATL2_LINK_OPTS_IN_OFF, &val, 1 ); - return atl2_hw_finish_ack_ ( nic, 100000); + return atl2_hw_finish_ack_ ( nic, 100000 ); } -int atl2_hw_stop ( struct atl_nic *nic ) -{ +int atl2_hw_stop ( struct atl_nic *nic ) { uint32_t val; atl2_hw_read_shared_in_ ( nic, ATL2_LINK_OPTS_IN_OFF, &val, 1 ); @@ -206,22 +199,20 @@ int atl2_hw_stop ( struct atl_nic *nic ) return atl2_hw_finish_ack_ ( nic, 100000 ); } -int atl2_hw_get_link ( struct atl_nic *nic ) -{ +int atl2_hw_get_link ( struct atl_nic *nic ) { uint32_t val; val = ATL_READ_REG ( ATL2_MIF_SHARED_BUF_OUT + ATL2_LINK_STS_OUT_OFF ); - return ( (val & 0xf) != 0) && ((val & 0xF0) != 0 ); + return ( ( val & 0xf ) != 0 ) && ( ( val & 0xF0 ) != 0 ); } -int atl2_hw_get_mac ( struct atl_nic *nic, uint8_t *mac ) -{ +int atl2_hw_get_mac ( struct atl_nic *nic, uint8_t *mac ) { uint32_t mac_addr[2] = {0}; atl2_hw_read_shared_in_ ( nic, ATL2_MAC_ADDR_IN_OFF, mac_addr, 2 ); - memcpy ( mac, (uint8_t *)mac_addr, 6 ); + memcpy ( mac, ( uint8_t * )mac_addr, 6 ); return 0; } @@ -232,4 +223,4 @@ struct atl_hw_ops atl2_hw = { .stop = atl2_hw_stop, .get_link = atl2_hw_get_link, .get_mac = atl2_hw_get_mac, -};
\ No newline at end of file +}; diff --git a/src/drivers/net/marvell/atl2_hw.h b/src/drivers/net/marvell/atl2_hw.h index ebd5466e2..d044c21fa 100644 --- a/src/drivers/net/marvell/atl2_hw.h +++ b/src/drivers/net/marvell/atl2_hw.h @@ -1,21 +1,21 @@ /* - * Copyright(C) 2017-2021 Marvell + * Copyright(C) 2017-2024 Marvell * * SPDX-License-Identifier: BSD-2-Clause * - * Redistribution and use in source and binary forms, with or without + * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: - - * 1. Redistributions of source code must retain the above copyright notice, + + * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO,THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR HOLDER OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR HOLDER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; @@ -37,21 +37,21 @@ FILE_LICENCE ( BSD2 ); #define ATL2_HOST_ITR_REQ 0xF00 -#define ATL2_RESET_STATUS_REQ_GSR (1U << 0x0) -#define ATL2_RESET_STATUS_REQ_HOST_BOOT (1U << 0x8) -#define ATL2_RESET_STATUS_REQ_MAC_FAST_BOOT (1U << 0xA) -#define ATL2_RESET_STATUS_REQ_PHY_FAST_BOOT (1U << 0xB) +#define ATL2_RESET_STATUS_REQ_GSR ( 1U << 0x0 ) +#define ATL2_RESET_STATUS_REQ_HOST_BOOT ( 1U << 0x8 ) +#define ATL2_RESET_STATUS_REQ_MAC_FAST_BOOT ( 1U << 0xA ) +#define ATL2_RESET_STATUS_REQ_PHY_FAST_BOOT ( 1U << 0xB ) -#define ATL2_RESET_STATUS_HOST_LOAD_COMPLETED (1U << 0x10) -#define ATL2_RESET_STATUS_REQUIRE_HOST_LOAD (1U << 0x11) -#define ATL2_RESET_STATUS_BC_STARTED (1U << 0x18) -#define ATL2_RESET_STATUS_CRASH_DURING_INIT (1U << 0x1B) -#define ATL2_RESET_STATUS_BC_FAILED (1U << 0x1C) -#define ATL2_RESET_STATUS_FW_FAILED (1U << 0x1D) -#define ATL2_RESET_STATUS_FW_SUCCEED (1U << 0x1F) +#define ATL2_RESET_STATUS_HOST_LOAD_COMPLETED ( 1U << 0x10 ) +#define ATL2_RESET_STATUS_REQUIRE_HOST_LOAD ( 1U << 0x11 ) +#define ATL2_RESET_STATUS_BC_STARTED ( 1U << 0x18 ) +#define ATL2_RESET_STATUS_CRASH_DURING_INIT ( 1U << 0x1B ) +#define ATL2_RESET_STATUS_BC_FAILED ( 1U << 0x1C ) +#define ATL2_RESET_STATUS_FW_FAILED ( 1U << 0x1D ) +#define ATL2_RESET_STATUS_FW_SUCCEED ( 1U << 0x1F ) -#define ATL2_RESET_STATUS_BOOT_FAILED_MASK (ATL2_RESET_STATUS_CRASH_DURING_INIT | ATL2_RESET_STATUS_BC_FAILED | ATL2_RESET_STATUS_FW_FAILED) -#define ATL2_RESET_STATUS_BOOT_COMPLETED_MASK (ATL2_RESET_STATUS_BOOT_FAILED_MASK | ATL2_RESET_STATUS_FW_SUCCEED) +#define ATL2_RESET_STATUS_BOOT_FAILED_MASK ( ATL2_RESET_STATUS_CRASH_DURING_INIT | ATL2_RESET_STATUS_BC_FAILED | ATL2_RESET_STATUS_FW_FAILED ) +#define ATL2_RESET_STATUS_BOOT_COMPLETED_MASK ( ATL2_RESET_STATUS_BOOT_FAILED_MASK | ATL2_RESET_STATUS_FW_SUCCEED ) #define ATL2_FW_HOST_INTERRUPT_REQUEST_READY 0x0001 #define ATL2_FW_HOST_INTERRUPT_MAC_READY 0x0004 @@ -91,4 +91,4 @@ FILE_LICENCE ( BSD2 ); #define ATL2_DELAY_10 10 #define ATL2_DELAY_100 100 -#endif
\ No newline at end of file +#endif diff --git a/src/drivers/net/marvell/atl_hw.c b/src/drivers/net/marvell/atl_hw.c index 2dddb7187..fa7f2a9b8 100644 --- a/src/drivers/net/marvell/atl_hw.c +++ b/src/drivers/net/marvell/atl_hw.c @@ -2,20 +2,20 @@ * * Marvell AQtion family network card driver, hardware-specific functions. * - * Copyright(C) 2017-2021 Marvell + * Copyright(C) 2017-2024 Marvell * * SPDX-License-Identifier: BSD-2-Clause * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: - - * 1. Redistributions of source code must retain the above copyright notice, + + * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO,THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR HOLDER OR @@ -31,6 +31,7 @@ FILE_LICENCE ( BSD2 ); +#include <string.h> #include <errno.h> #include <stdio.h> #include <unistd.h> @@ -41,8 +42,7 @@ FILE_LICENCE ( BSD2 ); #include <compiler.h> -int atl_hw_reset_flb_ ( struct atl_nic *nic ) -{ +int atl_hw_reset_flb_ ( struct atl_nic *nic ) { uint32_t val; int k = 0; @@ -53,8 +53,8 @@ int atl_hw_reset_flb_ ( struct atl_nic *nic ) val = ATL_READ_REG ( ATL_GLB_NVR_PROV4 ); ATL_WRITE_REG ( val | ATL_GBL_NVR_PROV4_RESET, ATL_GLB_NVR_PROV4 ); - ATL_WRITE_REG( (ATL_READ_REG(ATL_GLB_STD_CTRL) & - ~ATL_GLB_CTRL_RST_DIS) | ATL_GLB_STD_CTRL_RESET, + ATL_WRITE_REG( ( ATL_READ_REG ( ATL_GLB_STD_CTRL ) & + ~ATL_GLB_CTRL_RST_DIS ) | ATL_GLB_STD_CTRL_RESET, ATL_GLB_STD_CTRL ); /* Kickstart MAC */ @@ -94,7 +94,7 @@ int atl_hw_reset_flb_ ( struct atl_nic *nic ) ATL_WRITE_REG ( ATL_GBL_MCP_SEM1_RELEASE, ATL_GLB_MCP_SEM1 ); /* Global software reset*/ - ATL_WRITE_REG ( ATL_READ_REG ( ATL_RX_CTRL ) & + ATL_WRITE_REG ( ATL_READ_REG ( ATL_RX_CTRL ) & ~ATL_RX_CTRL_RST_DIS, ATL_RX_CTRL ); ATL_WRITE_REG ( ATL_READ_REG ( ATL_TX_CTRL ) & ~ATL_TX_CTRL_RST_DIS, ATL_TX_CTRL ); @@ -103,7 +103,7 @@ int atl_hw_reset_flb_ ( struct atl_nic *nic ) ~ATL_MAC_PHY_CTRL_RST_DIS, ATL_MAC_PHY_CTRL ); ATL_WRITE_REG ( ( ATL_READ_REG ( ATL_GLB_STD_CTRL ) & - ~ATL_GLB_CTRL_RST_DIS) | ATL_GLB_STD_CTRL_RESET, + ~ATL_GLB_CTRL_RST_DIS ) | ATL_GLB_STD_CTRL_RESET, ATL_GLB_STD_CTRL ); for (k = 0; k < 1000; k++) { @@ -123,14 +123,13 @@ int atl_hw_reset_flb_ ( struct atl_nic *nic ) return 0; } -int atl_hw_reset_rbl_ ( struct atl_nic *nic ) -{ +int atl_hw_reset_rbl_ ( struct atl_nic *nic ) { uint32_t val, rbl_status; int k; ATL_WRITE_REG ( ATL_GLB_CTRL2_MBOX_ERR_UP_RUN_STALL, ATL_GLB_CTRL2 ); ATL_WRITE_REG ( ATL_GBL_MCP_SEM1_RELEASE, ATL_GLB_MCP_SEM1 ); - ATL_WRITE_REG ( ATL_MIF_PWR_GATING_EN_CTRL_RESET, + ATL_WRITE_REG ( ATL_MIF_PWR_GATING_EN_CTRL_RESET, ATL_MIF_PWR_GATING_EN_CTRL ); /* Alter RBL status */ @@ -141,15 +140,15 @@ int atl_hw_reset_rbl_ ( struct atl_nic *nic ) ATL_WRITE_REG ( val | ATL_GBL_NVR_PROV4_RESET, ATL_GLB_NVR_PROV4 ); /* Global software reset*/ - ATL_WRITE_REG ( ATL_READ_REG(ATL_RX_CTRL) & ~ATL_RX_CTRL_RST_DIS, + ATL_WRITE_REG ( ATL_READ_REG ( ATL_RX_CTRL ) & ~ATL_RX_CTRL_RST_DIS, ATL_RX_CTRL ); - ATL_WRITE_REG ( ATL_READ_REG(ATL_TX_CTRL) & ~ATL_TX_CTRL_RST_DIS, + ATL_WRITE_REG ( ATL_READ_REG ( ATL_TX_CTRL ) & ~ATL_TX_CTRL_RST_DIS, ATL_TX_CTRL ); - ATL_WRITE_REG ( ATL_READ_REG(ATL_MAC_PHY_CTRL) & + ATL_WRITE_REG ( ATL_READ_REG ( ATL_MAC_PHY_CTRL ) & ~ATL_MAC_PHY_CTRL_RST_DIS, ATL_MAC_PHY_CTRL ); - ATL_WRITE_REG ( (ATL_READ_REG(ATL_GLB_STD_CTRL) & - ~ATL_GLB_CTRL_RST_DIS) | ATL_GLB_STD_CTRL_RESET, + ATL_WRITE_REG ( ( ATL_READ_REG ( ATL_GLB_STD_CTRL ) & + ~ATL_GLB_CTRL_RST_DIS ) | ATL_GLB_STD_CTRL_RESET, ATL_GLB_STD_CTRL ); ATL_WRITE_REG ( ATL_GLB_CTRL2_MBOX_ERR_UP_RUN_NORMAL, ATL_GLB_CTRL2 ); @@ -186,8 +185,7 @@ int atl_hw_reset_rbl_ ( struct atl_nic *nic ) return 0; } -int atl_hw_reset ( struct atl_nic *nic ) -{ +int atl_hw_reset ( struct atl_nic *nic ) { uint32_t boot_exit_code = 0; uint32_t k; int rbl_enabled; @@ -207,22 +205,22 @@ int atl_hw_reset ( struct atl_nic *nic ) return -ENOTSUP; } - rbl_enabled = (boot_exit_code != 0); + rbl_enabled = ( boot_exit_code != 0 ); fw_ver = ATL_READ_REG ( ATL_FW_VER ); - if ( ((fw_ver >> 24) & 0xFF) >= 4 ) { + if ( ( ( fw_ver >> 24 ) & 0xFF ) >= 4 ) { sem_timeout = ATL_READ_REG ( ATL_SEM_TIMEOUT ); if ( sem_timeout > ATL_SEM_MAX_TIMEOUT ) sem_timeout = ATL_SEM_MAX_TIMEOUT; for ( k = 0; k < sem_timeout; ++k ) { - if ( ATL_READ_REG ( ATL_GLB_MCP_SEM4) ) + if ( ATL_READ_REG ( ATL_GLB_MCP_SEM4 ) ) break; - mdelay (ATL_DELAY_1_MNS); + mdelay ( ATL_DELAY_1_MNS ); } for ( k = 0; k < sem_timeout; ++k ) { - if (ATL_READ_REG ( ATL_GLB_MCP_SEM5) ) + if ( ATL_READ_REG ( ATL_GLB_MCP_SEM5 ) ) break; mdelay ( ATL_DELAY_1_MNS ); @@ -236,35 +234,31 @@ int atl_hw_reset ( struct atl_nic *nic ) return atl_hw_reset_flb_ ( nic ); } -int atl_hw_start ( struct atl_nic *nic ) -{ +int atl_hw_start ( struct atl_nic *nic ) { ATL_WRITE_REG ( ATL_LINK_ADV_AUTONEG, ATL_LINK_ADV ); return 0; } -int atl_hw_stop ( struct atl_nic *nic ) -{ +int atl_hw_stop ( struct atl_nic *nic ) { ATL_WRITE_REG ( ATL_SHUT_LINK, ATL_LINK_ADV ); return 0; } -int atl_hw_get_link ( struct atl_nic *nic ) -{ +int atl_hw_get_link ( struct atl_nic *nic ) { return ( ATL_READ_REG ( ATL_LINK_ST) & ATL_LINK_ADV_AUTONEG ) != 0; } int atl_hw_read_mem ( struct atl_nic *nic, uint32_t addr, uint32_t *buffer, - uint32_t size ) -{ + uint32_t size ) { uint32_t i; for ( i = 0; i < 100; ++i ) { - if ( ATL_READ_REG( ATL_SEM_RAM) ) + if ( ATL_READ_REG( ATL_SEM_RAM ) ) break; mdelay ( ATL_DELAY_1_MNS ); } if ( i == 100 ) { - DBGC (nic, "Semaphore Register not set\n" ); + DBGC ( nic, "Semaphore Register not set\n" ); return -EIO; } @@ -280,7 +274,7 @@ int atl_hw_read_mem ( struct atl_nic *nic, uint32_t addr, uint32_t *buffer, udelay ( ATL_DELAY_10_MNS ); } if ( j == 10000 ) { - DBGC (nic, "Reading from CTRL3 Register Failed\n" ); + DBGC ( nic, "Reading from CTRL3 Register Failed\n" ); return -EIO; } @@ -292,14 +286,13 @@ int atl_hw_read_mem ( struct atl_nic *nic, uint32_t addr, uint32_t *buffer, return 0; } -int atl_hw_get_mac ( struct atl_nic *nic, uint8_t *mac ) -{ +int atl_hw_get_mac ( struct atl_nic *nic, uint8_t *mac ) { uint32_t mac_addr[2] = {0}; int err = 0; uint32_t efuse_addr = ATL_READ_REG ( ATL_GLB_MCP_SP26 ); if ( efuse_addr != 0) { - uint32_t mac_efuse_addr = efuse_addr + 40 * sizeof(uint32_t); + uint32_t mac_efuse_addr = efuse_addr + 40 * sizeof ( uint32_t ); err = atl_hw_read_mem ( nic, mac_efuse_addr, mac_addr, 2 ); if ( err != 0 ) return err; @@ -307,7 +300,7 @@ int atl_hw_get_mac ( struct atl_nic *nic, uint8_t *mac ) mac_addr[0] = cpu_to_be32 ( mac_addr[0] ); mac_addr[1] = cpu_to_be32 ( mac_addr[1] ); - memcpy ( mac, (uint8_t *)mac_addr, ATL_MAC_ADDRESS_SIZE ); + memcpy ( mac, ( uint8_t * )mac_addr, ATL_MAC_ADDRESS_SIZE ); } return 0; } @@ -318,4 +311,4 @@ struct atl_hw_ops atl_hw = { .stop = atl_hw_stop, .get_link = atl_hw_get_link, .get_mac = atl_hw_get_mac, -};
\ No newline at end of file +}; diff --git a/src/drivers/net/marvell/atl_hw.h b/src/drivers/net/marvell/atl_hw.h index 0a20fbfce..efc9f86c1 100644 --- a/src/drivers/net/marvell/atl_hw.h +++ b/src/drivers/net/marvell/atl_hw.h @@ -1,21 +1,21 @@ /* - * Copyright(C) 2017-2021 Marvell + * Copyright(C) 2017-2024 Marvell * * SPDX-License-Identifier: BSD-2-Clause * - * Redistribution and use in source and binary forms, with or without + * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions are met: - - * 1. Redistributions of source code must retain the above copyright notice, + + * 1. Redistributions of source code must retain the above copyright notice, * this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation + * 2. Redistributions in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation * and/or other materials provided with the distribution. - * - * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED * TO,THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR - * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR HOLDER OR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR HOLDER OR * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; |
