mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/chenhuacai/linux-loongson
synced 2025-09-01 06:39:05 +00:00

This is [1/3] part of hinic3 Ethernet driver initial submission. With this patch hinic3 is a valid kernel module but non-functional driver. The driver parts contained in this patch: Module initialization. PCI driver registration but with empty id_table. Auxiliary driver registration. Net device_ops registration but open/stop are empty stubs. tx/rx logic. All major data structures of the driver are fully introduced with the code that uses them but without their initialization code that requires management interface with the hw. Co-developed-by: Xin Guo <guoxin09@huawei.com> Signed-off-by: Xin Guo <guoxin09@huawei.com> Signed-off-by: Fan Gong <gongfan1@huawei.com> Co-developed-by: Gur Stavi <gur.stavi@huawei.com> Signed-off-by: Gur Stavi <gur.stavi@huawei.com> Link: https://patch.msgid.link/76a137ffdfe115c737c2c224f0c93b60ba53cc16.1747736586.git.gur.stavi@huawei.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
33 lines
891 B
C
33 lines
891 B
C
// SPDX-License-Identifier: GPL-2.0
|
|
// Copyright (c) Huawei Technologies Co., Ltd. 2025. All rights reserved.
|
|
|
|
#include <linux/delay.h>
|
|
|
|
#include "hinic3_hw_comm.h"
|
|
#include "hinic3_hwdev.h"
|
|
#include "hinic3_hwif.h"
|
|
#include "hinic3_mbox.h"
|
|
|
|
int hinic3_func_reset(struct hinic3_hwdev *hwdev, u16 func_id, u64 reset_flag)
|
|
{
|
|
struct comm_cmd_func_reset func_reset = {};
|
|
struct mgmt_msg_params msg_params = {};
|
|
int err;
|
|
|
|
func_reset.func_id = func_id;
|
|
func_reset.reset_flag = reset_flag;
|
|
|
|
mgmt_msg_params_init_default(&msg_params, &func_reset,
|
|
sizeof(func_reset));
|
|
|
|
err = hinic3_send_mbox_to_mgmt(hwdev, MGMT_MOD_COMM,
|
|
COMM_CMD_FUNC_RESET, &msg_params);
|
|
if (err || func_reset.head.status) {
|
|
dev_err(hwdev->dev, "Failed to reset func resources, reset_flag 0x%llx, err: %d, status: 0x%x\n",
|
|
reset_flag, err, func_reset.head.status);
|
|
return -EIO;
|
|
}
|
|
|
|
return 0;
|
|
}
|