xref: /linux/drivers/staging/rtl8712/rtl8712_io.c (revision 2da68a77)
1 // SPDX-License-Identifier: GPL-2.0
2 /******************************************************************************
3  * rtl8712_io.c
4  *
5  * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
6  * Linux device driver for RTL8192SU
7  *
8  * Modifications for inclusion into the Linux staging tree are
9  * Copyright(c) 2010 Larry Finger. All rights reserved.
10  *
11  * Contact information:
12  * WLAN FAE <wlanfae@realtek.com>.
13  * Larry Finger <Larry.Finger@lwfinger.net>
14  *
15  ******************************************************************************/
16 
17 #define _RTL8712_IO_C_
18 
19 #include "osdep_service.h"
20 #include "drv_types.h"
21 #include "rtl871x_io.h"
22 #include "osdep_intf.h"
23 #include "usb_ops.h"
24 
25 u8 r8712_read8(struct _adapter *adapter, u32 addr)
26 {
27 	struct intf_hdl *hdl = &adapter->pio_queue->intf;
28 
29 	return hdl->io_ops._read8(hdl, addr);
30 }
31 
32 u16 r8712_read16(struct _adapter *adapter, u32 addr)
33 {
34 	struct intf_hdl *hdl = &adapter->pio_queue->intf;
35 
36 	return hdl->io_ops._read16(hdl, addr);
37 }
38 
39 u32 r8712_read32(struct _adapter *adapter, u32 addr)
40 {
41 	struct intf_hdl *hdl = &adapter->pio_queue->intf;
42 
43 	return hdl->io_ops._read32(hdl, addr);
44 }
45 
46 void r8712_write8(struct _adapter *adapter, u32 addr, u8 val)
47 {
48 	struct intf_hdl *hdl = &adapter->pio_queue->intf;
49 
50 	hdl->io_ops._write8(hdl, addr, val);
51 }
52 
53 void r8712_write16(struct _adapter *adapter, u32 addr, u16 val)
54 {
55 	struct intf_hdl *hdl = &adapter->pio_queue->intf;
56 
57 	hdl->io_ops._write16(hdl, addr, val);
58 }
59 
60 void r8712_write32(struct _adapter *adapter, u32 addr, u32 val)
61 {
62 	struct intf_hdl *hdl = &adapter->pio_queue->intf;
63 
64 	hdl->io_ops._write32(hdl, addr, val);
65 }
66 
67 void r8712_read_mem(struct _adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
68 {
69 	struct intf_hdl *hdl = &adapter->pio_queue->intf;
70 
71 	if (adapter->driver_stopped || adapter->surprise_removed)
72 		return;
73 
74 	hdl->io_ops._read_mem(hdl, addr, cnt, pmem);
75 }
76 
77 void r8712_write_mem(struct _adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
78 {
79 	struct intf_hdl *hdl = &adapter->pio_queue->intf;
80 
81 	hdl->io_ops._write_mem(hdl, addr, cnt, pmem);
82 }
83 
84 void r8712_read_port(struct _adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
85 {
86 	struct intf_hdl *hdl = &adapter->pio_queue->intf;
87 
88 	if (adapter->driver_stopped || adapter->surprise_removed)
89 		return;
90 
91 	hdl->io_ops._read_port(hdl, addr, cnt, pmem);
92 }
93 
94 void r8712_write_port(struct _adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
95 {
96 	struct intf_hdl *hdl = &adapter->pio_queue->intf;
97 
98 	hdl->io_ops._write_port(hdl, addr, cnt, pmem);
99 }
100