Skip to content
Navigation Menu
Toggle navigation
Sign in
In this repository
All GitHub Enterprise
↵
Jump to
↵
No suggested jump to results
In this repository
All GitHub Enterprise
↵
Jump to
↵
In this organization
All GitHub Enterprise
↵
Jump to
↵
In this repository
All GitHub Enterprise
↵
Jump to
↵
Sign in
Reseting focus
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
mariux64
/
linux
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
2
Pull requests
0
Actions
Projects
0
Wiki
Security
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Wiki
Security
Insights
Files
a8b1de7
Documentation
LICENSES
arch
block
certs
crypto
drivers
accessibility
acpi
amba
android
ata
atm
auxdisplay
base
bcma
block
bluetooth
bus
cdrom
char
clk
clocksource
comedi
connector
counter
cpufreq
cpuidle
crypto
cxl
dax
dca
devfreq
dio
dma-buf
dma
edac
eisa
extcon
firewire
firmware
fpga
fsi
gnss
gpio
gpu
greybus
hid
hsi
hv
hwmon
hwspinlock
hwtracing
i2c
i3c
ide
idle
iio
infiniband
input
interconnect
iommu
ipack
irqchip
isdn
leds
lightnvm
macintosh
mailbox
mcb
md
media
memory
memstick
message
mfd
misc
mmc
most
mtd
mux
net
appletalk
arcnet
bonding
caif
can
dsa
ethernet
fddi
fjes
hamradio
hippi
hyperv
ieee802154
ipa
ipvlan
mdio
mhi
netdevsim
pcs
phy
plip
ppp
slip
team
usb
vmxnet3
wan
wireguard
wireless
admtek
ath
ar5523
ath10k
Kconfig
Makefile
ahb.c
ahb.h
bmi.c
bmi.h
ce.c
ce.h
core.c
core.h
coredump.c
coredump.h
debug.c
debug.h
debugfs_sta.c
hif.h
htc.c
htc.h
htt.c
htt.h
htt_rx.c
htt_tx.c
hw.c
hw.h
mac.c
mac.h
p2p.c
p2p.h
pci.c
pci.h
qmi.c
qmi.h
qmi_wlfw_v01.c
qmi_wlfw_v01.h
rx_desc.h
sdio.c
sdio.h
snoc.c
snoc.h
spectral.c
spectral.h
swap.c
swap.h
targaddrs.h
testmode.c
testmode.h
testmode_i.h
thermal.c
thermal.h
trace.c
trace.h
txrx.c
txrx.h
usb.c
usb.h
wmi-ops.h
wmi-tlv.c
wmi-tlv.h
wmi.c
wmi.h
wow.c
wow.h
ath11k
ath5k
ath6kl
ath9k
carl9170
wcn36xx
wil6210
Kconfig
Makefile
ath.h
debug.c
dfs_pattern_detector.c
dfs_pattern_detector.h
dfs_pri_detector.c
dfs_pri_detector.h
hw.c
key.c
main.c
reg.h
regd.c
regd.h
regd_common.h
spectral_common.h
trace.c
trace.h
atmel
broadcom
cisco
intel
intersil
marvell
mediatek
microchip
quantenna
ralink
realtek
rsi
st
ti
zydas
Kconfig
Makefile
mac80211_hwsim.c
mac80211_hwsim.h
ray_cs.c
ray_cs.h
rayctl.h
rndis_wlan.c
virt_wifi.c
wl3501.h
wl3501_cs.c
wwan
xen-netback
Kconfig
LICENSE.SRC
Makefile
Space.c
bareudp.c
dummy.c
eql.c
geneve.c
gtp.c
ifb.c
loopback.c
macsec.c
macvlan.c
macvtap.c
mdio.c
mii.c
net_failover.c
netconsole.c
nlmon.c
ntb_netdev.c
rionet.c
sb1000.c
sungem_phy.c
tap.c
thunderbolt.c
tun.c
veth.c
virtio_net.c
vrf.c
vsockmon.c
vxlan.c
xen-netfront.c
nfc
ntb
nubus
nvdimm
nvme
nvmem
of
opp
parisc
parport
pci
pcmcia
perf
phy
pinctrl
platform
pnp
power
powercap
pps
ps3
ptp
pwm
rapidio
ras
regulator
remoteproc
reset
rpmsg
rtc
s390
sbus
scsi
sh
siox
slimbus
soc
soundwire
spi
spmi
ssb
staging
target
tc
tee
thermal
thunderbolt
tty
uio
usb
vdpa
vfio
vhost
video
virt
virtio
visorbus
vlynq
vme
w1
watchdog
xen
zorro
Kconfig
Makefile
fs
include
init
ipc
kernel
lib
mm
net
samples
scripts
security
sound
tools
usr
virt
.clang-format
.cocciconfig
.get_maintainer.ignore
.gitattributes
.gitignore
.mailmap
COPYING
CREDITS
Kbuild
Kconfig
MAINTAINERS
Makefile
README
Breadcrumbs
linux
/
drivers
/
net
/
wireless
/
ath
/
ath10k
/
pci.h
Blame
Blame
Latest commit
History
History
259 lines (209 loc) · 7.48 KB
Breadcrumbs
linux
/
drivers
/
net
/
wireless
/
ath
/
ath10k
/
pci.h
Top
File metadata and controls
Code
Blame
259 lines (209 loc) · 7.48 KB
Raw
/* SPDX-License-Identifier: ISC */ /* * Copyright (c) 2005-2011 Atheros Communications Inc. * Copyright (c) 2011-2017 Qualcomm Atheros, Inc. */ #ifndef _PCI_H_ #define _PCI_H_ #include <linux/interrupt.h> #include <linux/mutex.h> #include "hw.h" #include "ce.h" #include "ahb.h" /* * maximum number of bytes that can be * handled atomically by DiagRead/DiagWrite */ #define DIAG_TRANSFER_LIMIT 2048 struct bmi_xfer { bool tx_done; bool rx_done; bool wait_for_resp; u32 resp_len; }; /* * PCI-specific Target state * * NOTE: Structure is shared between Host software and Target firmware! * * Much of this may be of interest to the Host so * HOST_INTEREST->hi_interconnect_state points here * (and all members are 32-bit quantities in order to * facilitate Host access). In particular, Host software is * required to initialize pipe_cfg_addr and svc_to_pipe_map. */ struct pcie_state { /* Pipe configuration Target address */ /* NB: ce_pipe_config[CE_COUNT] */ u32 pipe_cfg_addr; /* Service to pipe map Target address */ /* NB: service_to_pipe[PIPE_TO_CE_MAP_CN] */ u32 svc_to_pipe_map; /* number of MSI interrupts requested */ u32 msi_requested; /* number of MSI interrupts granted */ u32 msi_granted; /* Message Signalled Interrupt address */ u32 msi_addr; /* Base data */ u32 msi_data; /* * Data for firmware interrupt; * MSI data for other interrupts are * in various SoC registers */ u32 msi_fw_intr_data; /* PCIE_PWR_METHOD_* */ u32 power_mgmt_method; /* PCIE_CONFIG_FLAG_* */ u32 config_flags; }; /* PCIE_CONFIG_FLAG definitions */ #define PCIE_CONFIG_FLAG_ENABLE_L1 0x0000001 /* Per-pipe state. */ struct ath10k_pci_pipe { /* Handle of underlying Copy Engine */ struct ath10k_ce_pipe *ce_hdl; /* Our pipe number; facilitiates use of pipe_info ptrs. */ u8 pipe_num; /* Convenience back pointer to hif_ce_state. */ struct ath10k *hif_ce_state; size_t buf_sz; /* protects compl_free and num_send_allowed */ spinlock_t pipe_lock; }; struct ath10k_pci_supp_chip { u32 dev_id; u32 rev_id; }; enum ath10k_pci_irq_mode { ATH10K_PCI_IRQ_AUTO = 0, ATH10K_PCI_IRQ_LEGACY = 1, ATH10K_PCI_IRQ_MSI = 2, }; struct ath10k_pci { struct pci_dev *pdev; struct device *dev; struct ath10k *ar; void __iomem *mem; size_t mem_len; /* Operating interrupt mode */ enum ath10k_pci_irq_mode oper_irq_mode; struct ath10k_pci_pipe pipe_info[CE_COUNT_MAX]; /* Copy Engine used for Diagnostic Accesses */ struct ath10k_ce_pipe *ce_diag; /* For protecting ce_diag */ struct mutex ce_diag_mutex; struct work_struct dump_work; struct ath10k_ce ce; struct timer_list rx_post_retry; /* Due to HW quirks it is recommended to disable ASPM during device * bootup. To do that the original PCI-E Link Control is stored before * device bootup is executed and re-programmed later. */ u16 link_ctl; /* Protects ps_awake and ps_wake_refcount */ spinlock_t ps_lock; /* The device has a special powersave-oriented register. When device is * considered asleep it drains less power and driver is forbidden from * accessing most MMIO registers. If host were to access them without * waking up the device might scribble over host memory or return * 0xdeadbeef readouts. */ unsigned long ps_wake_refcount; /* Waking up takes some time (up to 2ms in some cases) so it can be bad * for latency. To mitigate this the device isn't immediately allowed * to sleep after all references are undone - instead there's a grace * period after which the powersave register is updated unless some * activity to/from device happened in the meantime. * * Also see comments on ATH10K_PCI_SLEEP_GRACE_PERIOD_MSEC. */ struct timer_list ps_timer; /* MMIO registers are used to communicate with the device. With * intensive traffic accessing powersave register would be a bit * wasteful overhead and would needlessly stall CPU. It is far more * efficient to rely on a variable in RAM and update it only upon * powersave register state changes. */ bool ps_awake; /* pci power save, disable for QCA988X and QCA99X0. * Writing 'false' to this variable avoids frequent locking * on MMIO read/write. */ bool pci_ps; /* Chip specific pci reset routine used to do a safe reset */ int (*pci_soft_reset)(struct ath10k *ar); /* Chip specific pci full reset function */ int (*pci_hard_reset)(struct ath10k *ar); /* chip specific methods for converting target CPU virtual address * space to CE address space */ u32 (*targ_cpu_to_ce_addr)(struct ath10k *ar, u32 addr); struct ce_attr *attr; struct ce_pipe_config *pipe_config; struct ce_service_to_pipe *serv_to_pipe; /* Keep this entry in the last, memory for struct ath10k_ahb is * allocated (ahb support enabled case) in the continuation of * this struct. */ struct ath10k_ahb ahb[]; }; static inline struct ath10k_pci *ath10k_pci_priv(struct ath10k *ar) { return (struct ath10k_pci *)ar->drv_priv; } #define ATH10K_PCI_RX_POST_RETRY_MS 50 #define ATH_PCI_RESET_WAIT_MAX 10 /* ms */ #define PCIE_WAKE_TIMEOUT 30000 /* 30ms */ #define PCIE_WAKE_LATE_US 10000 /* 10ms */ #define BAR_NUM 0 #define CDC_WAR_MAGIC_STR 0xceef0000 #define CDC_WAR_DATA_CE 4 /* Wait up to this many Ms for a Diagnostic Access CE operation to complete */ #define DIAG_ACCESS_CE_TIMEOUT_US 10000 /* 10 ms */ #define DIAG_ACCESS_CE_WAIT_US 50 void ath10k_pci_write32(struct ath10k *ar, u32 offset, u32 value); void ath10k_pci_soc_write32(struct ath10k *ar, u32 addr, u32 val); void ath10k_pci_reg_write32(struct ath10k *ar, u32 addr, u32 val); u32 ath10k_pci_read32(struct ath10k *ar, u32 offset); u32 ath10k_pci_soc_read32(struct ath10k *ar, u32 addr); u32 ath10k_pci_reg_read32(struct ath10k *ar, u32 addr); int ath10k_pci_hif_tx_sg(struct ath10k *ar, u8 pipe_id, struct ath10k_hif_sg_item *items, int n_items); int ath10k_pci_hif_diag_read(struct ath10k *ar, u32 address, void *buf, size_t buf_len); int ath10k_pci_diag_write_mem(struct ath10k *ar, u32 address, const void *data, int nbytes); int ath10k_pci_hif_exchange_bmi_msg(struct ath10k *ar, void *req, u32 req_len, void *resp, u32 *resp_len); int ath10k_pci_hif_map_service_to_pipe(struct ath10k *ar, u16 service_id, u8 *ul_pipe, u8 *dl_pipe); void ath10k_pci_hif_get_default_pipe(struct ath10k *ar, u8 *ul_pipe, u8 *dl_pipe); void ath10k_pci_hif_send_complete_check(struct ath10k *ar, u8 pipe, int force); u16 ath10k_pci_hif_get_free_queue_number(struct ath10k *ar, u8 pipe); void ath10k_pci_hif_power_down(struct ath10k *ar); int ath10k_pci_alloc_pipes(struct ath10k *ar); void ath10k_pci_free_pipes(struct ath10k *ar); void ath10k_pci_rx_replenish_retry(struct timer_list *t); void ath10k_pci_ce_deinit(struct ath10k *ar); void ath10k_pci_init_napi(struct ath10k *ar); int ath10k_pci_init_pipes(struct ath10k *ar); int ath10k_pci_init_config(struct ath10k *ar); void ath10k_pci_rx_post(struct ath10k *ar); void ath10k_pci_flush(struct ath10k *ar); void ath10k_pci_enable_legacy_irq(struct ath10k *ar); bool ath10k_pci_irq_pending(struct ath10k *ar); void ath10k_pci_disable_and_clear_legacy_irq(struct ath10k *ar); void ath10k_pci_irq_msi_fw_mask(struct ath10k *ar); int ath10k_pci_wait_for_target_init(struct ath10k *ar); int ath10k_pci_setup_resource(struct ath10k *ar); void ath10k_pci_release_resource(struct ath10k *ar); /* QCA6174 is known to have Tx/Rx issues when SOC_WAKE register is poked too * frequently. To avoid this put SoC to sleep after a very conservative grace * period. Adjust with great care. */ #define ATH10K_PCI_SLEEP_GRACE_PERIOD_MSEC 60 #endif /* _PCI_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
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
You can’t perform that action at this time.