summaryrefslogtreecommitdiffstats
path: root/src/drivers/net/marvell/atl2_hw.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/drivers/net/marvell/atl2_hw.c')
-rw-r--r--src/drivers/net/marvell/atl2_hw.c59
1 files changed, 25 insertions, 34 deletions
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
+};