-
Notifications
You must be signed in to change notification settings - Fork 9
/
ecrnx_platform.h
executable file
·123 lines (102 loc) · 3.77 KB
/
ecrnx_platform.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
/**
******************************************************************************
*
* @file ecrnx_platorm.h
*
* Copyright (C) ESWIN 2015-2020
*
******************************************************************************
*/
#ifndef _ECRNX_PLAT_H_
#define _ECRNX_PLAT_H_
#include <linux/pci.h>
#define ECRNX_CONFIG_FW_NAME "wifi_ecr6600u.cfg"
#define ECRNX_CONFIG_AMT_NAME "amt.cfg"
#define ECRNX_PHY_CONFIG_TRD_NAME "ecrnx_trident.ini"
#define ECRNX_PHY_CONFIG_KARST_NAME "ecrnx_karst.ini"
#define ECRNX_AGC_FW_NAME "agcram.bin"
#define ECRNX_LDPC_RAM_NAME "ldpcram.bin"
#define ECRNX_CATAXIA_FW_NAME "cataxia.fw"
#if defined CONFIG_ECRNX_FULLMAC
#define ECRNX_MAC_FW_BASE_NAME "fmacfw"
#elif defined CONFIG_ECRNX_FHOST
#define ECRNX_MAC_FW_BASE_NAME "fhostfw"
#endif
#ifdef CONFIG_ECRNX_TL4
#define ECRNX_MAC_FW_NAME ECRNX_MAC_FW_BASE_NAME".hex"
#else
#define ECRNX_MAC_FW_NAME ECRNX_MAC_FW_BASE_NAME".ihex"
#define ECRNX_MAC_FW_NAME2 ECRNX_MAC_FW_BASE_NAME".bin"
#endif
#define ECRNX_FCU_FW_NAME "fcuram.bin"
/**
* Type of memory to access (cf ecrnx_plat.get_address)
*
* @ECRNX_ADDR_CPU To access memory of the embedded CPU
* @ECRNX_ADDR_SYSTEM To access memory/registers of one subsystem of the
* embedded system
*
*/
enum ecrnx_platform_addr {
ECRNX_ADDR_CPU,
ECRNX_ADDR_SYSTEM,
ECRNX_ADDR_MAX,
};
struct ecrnx_hw;
/**
* struct ecrnx_plat - Operation pointers for ECRNX PCI platform
*
* @pci_dev: pointer to pci dev
* @enabled: Set if embedded platform has been enabled (i.e. fw loaded and
* ipc started)
* @enable: Configure communication with the fw (i.e. configure the transfers
* enable and register interrupt)
* @disable: Stop communication with the fw
* @deinit: Free all ressources allocated for the embedded platform
* @get_address: Return the virtual address to access the requested address on
* the platform.
* @ack_irq: Acknowledge the irq at link level.
* @get_config_reg: Return the list (size + pointer) of registers to restore in
* order to reload the platform while keeping the current configuration.
*
* @priv Private data for the link driver
*/
struct ecrnx_plat {
struct pci_dev *pci_dev;
bool enabled;
int (*enable)(struct ecrnx_hw *ecrnx_hw);
int (*disable)(struct ecrnx_hw *ecrnx_hw);
void (*deinit)(struct ecrnx_plat *ecrnx_plat);
u8* (*get_address)(struct ecrnx_plat *ecrnx_plat, int addr_name,
unsigned int offset);
void (*ack_irq)(struct ecrnx_plat *ecrnx_plat);
int (*get_config_reg)(struct ecrnx_plat *ecrnx_plat, const u32 **list);
u8 priv[0] __aligned(sizeof(void *));
};
#define ECRNX_ADDR(plat, base, offset) \
plat->get_address(plat, base, offset)
#define ECRNX_REG_READ(plat, base, offset) \
readl(plat->get_address(plat, base, offset))
#define ECRNX_REG_WRITE(val, plat, base, offset) \
writel(val, plat->get_address(plat, base, offset))
int ecrnx_platform_init(void *ecrnx_plat, void **platform_data);
void ecrnx_platform_deinit(struct ecrnx_hw *ecrnx_hw);
int ecrnx_platform_on(struct ecrnx_hw *ecrnx_hw, void *config);
void ecrnx_platform_off(struct ecrnx_hw *ecrnx_hw, void **config);
int ecrnx_platform_register_drv(void);
void ecrnx_platform_unregister_drv(void);
#ifdef CONFIG_ECRNX_ESWIN_SDIO
extern struct device *eswin_sdio_get_dev(void *plat);
static inline struct device *ecrnx_platform_get_dev(void *ecrnx_plat)
{
return eswin_sdio_get_dev(ecrnx_plat);
}
#endif
#ifdef CONFIG_ECRNX_ESWIN_USB
struct device *eswin_usb_get_dev(void *plat);
static inline struct device *ecrnx_platform_get_dev(void *ecrnx_plat)
{
return eswin_usb_get_dev(ecrnx_plat);
}
#endif
#endif /* _ECRNX_PLAT_H_ */