1 /* SPDX-License-Identifier: GPL-2.0
2 * Marvell OcteonTx2 CGX driver
4 * Copyright (C) 2018 Marvell International Ltd.
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License version 2 as
8 * published by the Free Software Foundation.
14 #include "cgx_fw_if.h"
17 #define PCI_DEVID_OCTEONTX2_CGX 0xA059
20 #define PCI_CFG_REG_BAR_NUM 0
23 #define MAX_LMAC_PER_CGX 4
24 #define CGX_OFFSET(x) ((x) * MAX_LMAC_PER_CGX)
27 #define CGXX_CMRX_INT 0x040
28 #define FW_CGX_INT BIT_ULL(1)
29 #define CGXX_CMRX_INT_ENA_W1S 0x058
30 #define CGXX_CMRX_RX_ID_MAP 0x060
31 #define CGXX_CMRX_RX_LMACS 0x128
32 #define CGXX_SCRATCH0_REG 0x1050
33 #define CGXX_SCRATCH1_REG 0x1058
34 #define CGX_CONST 0x2000
36 #define CGX_COMMAND_REG CGXX_SCRATCH1_REG
37 #define CGX_EVENT_REG CGXX_SCRATCH0_REG
38 #define CGX_CMD_TIMEOUT 2200 /* msecs */
41 #define CGX_LMAC_FWI 0
43 struct cgx_link_event {
44 struct cgx_lnk_sts lstat;
51 * @notify_link_chg: callback for link change notification
52 * @data: data passed to callback function
55 int (*notify_link_chg)(struct cgx_link_event *event, void *data);
59 extern struct pci_driver cgx_driver;
61 int cgx_get_cgx_cnt(void);
62 int cgx_get_lmac_cnt(void *cgxd);
63 void *cgx_get_pdata(int cgx_id);
64 int cgx_lmac_evh_register(struct cgx_event_cb *cb, void *cgxd, int lmac_id);