blob: 391eff37f5737670a044cc88489653c49bd970c5 [file] [log] [blame]
Larry Finger2865d422010-08-20 10:15:30 -05001/******************************************************************************
2 * rtl8712_io.c
3 *
4 * Copyright(c) 2007 - 2010 Realtek Corporation. All rights reserved.
5 * Linux device driver for RTL8192SU
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of version 2 of the GNU General Public License as
9 * published by the Free Software Foundation.
10 *
11 * This program is distributed in the hope that it will be useful, but WITHOUT
12 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
13 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
14 * more details.
15 *
16 * You should have received a copy of the GNU General Public License along with
17 * this program; if not, write to the Free Software Foundation, Inc.,
18 * 51 Franklin Street, Fifth Floor, Boston, MA 02110, USA
19 *
20 * Modifications for inclusion into the Linux staging tree are
21 * Copyright(c) 2010 Larry Finger. All rights reserved.
22 *
23 * Contact information:
24 * WLAN FAE <wlanfae@realtek.com>.
25 * Larry Finger <Larry.Finger@lwfinger.net>
26 *
27 ******************************************************************************/
28
29#define _RTL8712_IO_C_
30
31#include "osdep_service.h"
32#include "drv_types.h"
33#include "rtl871x_io.h"
34#include "osdep_intf.h"
35#include "usb_ops.h"
36
37u8 r8712_read8(struct _adapter *adapter, u32 addr)
38{
Mauro Dreissig549d33d2015-11-22 20:02:19 -020039 struct intf_hdl *hdl = &adapter->pio_queue->intf;
Larry Finger2865d422010-08-20 10:15:30 -050040
Mauro Dreissig549d33d2015-11-22 20:02:19 -020041 return hdl->io_ops._read8(hdl, addr);
Larry Finger2865d422010-08-20 10:15:30 -050042}
43
44u16 r8712_read16(struct _adapter *adapter, u32 addr)
45{
Mauro Dreissig549d33d2015-11-22 20:02:19 -020046 struct intf_hdl *hdl = &adapter->pio_queue->intf;
Larry Finger2865d422010-08-20 10:15:30 -050047
Mauro Dreissig549d33d2015-11-22 20:02:19 -020048 return hdl->io_ops._read16(hdl, addr);
Larry Finger2865d422010-08-20 10:15:30 -050049}
50
51u32 r8712_read32(struct _adapter *adapter, u32 addr)
52{
Mauro Dreissig549d33d2015-11-22 20:02:19 -020053 struct intf_hdl *hdl = &adapter->pio_queue->intf;
Larry Finger2865d422010-08-20 10:15:30 -050054
Mauro Dreissig549d33d2015-11-22 20:02:19 -020055 return hdl->io_ops._read32(hdl, addr);
Larry Finger2865d422010-08-20 10:15:30 -050056}
57
58void r8712_write8(struct _adapter *adapter, u32 addr, u8 val)
59{
Mauro Dreissig549d33d2015-11-22 20:02:19 -020060 struct intf_hdl *hdl = &adapter->pio_queue->intf;
Larry Finger2865d422010-08-20 10:15:30 -050061
Mauro Dreissig549d33d2015-11-22 20:02:19 -020062 hdl->io_ops._write8(hdl, addr, val);
Larry Finger2865d422010-08-20 10:15:30 -050063}
64
65void r8712_write16(struct _adapter *adapter, u32 addr, u16 val)
66{
Mauro Dreissig549d33d2015-11-22 20:02:19 -020067 struct intf_hdl *hdl = &adapter->pio_queue->intf;
Tapasweni Pathak02a29d22014-09-24 16:34:56 +053068
Mauro Dreissig549d33d2015-11-22 20:02:19 -020069 hdl->io_ops._write16(hdl, addr, val);
Larry Finger2865d422010-08-20 10:15:30 -050070}
71
72void r8712_write32(struct _adapter *adapter, u32 addr, u32 val)
73{
Mauro Dreissig549d33d2015-11-22 20:02:19 -020074 struct intf_hdl *hdl = &adapter->pio_queue->intf;
Larry Finger2865d422010-08-20 10:15:30 -050075
Mauro Dreissig549d33d2015-11-22 20:02:19 -020076 hdl->io_ops._write32(hdl, addr, val);
Larry Finger2865d422010-08-20 10:15:30 -050077}
78
79void r8712_read_mem(struct _adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
80{
Mauro Dreissig549d33d2015-11-22 20:02:19 -020081 struct intf_hdl *hdl = &adapter->pio_queue->intf;
Larry Finger2865d422010-08-20 10:15:30 -050082
Luis de Bethencourt1ca96882015-10-19 18:14:29 +010083 if (adapter->bDriverStopped || adapter->bSurpriseRemoved)
Larry Finger2865d422010-08-20 10:15:30 -050084 return;
Mauro Dreissig549d33d2015-11-22 20:02:19 -020085
86 hdl->io_ops._read_mem(hdl, addr, cnt, pmem);
Larry Finger2865d422010-08-20 10:15:30 -050087}
88
89void r8712_write_mem(struct _adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
90{
Mauro Dreissig549d33d2015-11-22 20:02:19 -020091 struct intf_hdl *hdl = &adapter->pio_queue->intf;
Larry Finger2865d422010-08-20 10:15:30 -050092
Mauro Dreissig549d33d2015-11-22 20:02:19 -020093 hdl->io_ops._write_mem(hdl, addr, cnt, pmem);
Larry Finger2865d422010-08-20 10:15:30 -050094}
95
96void r8712_read_port(struct _adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
97{
Mauro Dreissig549d33d2015-11-22 20:02:19 -020098 struct intf_hdl *hdl = &adapter->pio_queue->intf;
Larry Finger2865d422010-08-20 10:15:30 -050099
Luis de Bethencourt1ca96882015-10-19 18:14:29 +0100100 if (adapter->bDriverStopped || adapter->bSurpriseRemoved)
Larry Finger2865d422010-08-20 10:15:30 -0500101 return;
Mauro Dreissig549d33d2015-11-22 20:02:19 -0200102
103 hdl->io_ops._read_port(hdl, addr, cnt, pmem);
Larry Finger2865d422010-08-20 10:15:30 -0500104}
105
106void r8712_write_port(struct _adapter *adapter, u32 addr, u32 cnt, u8 *pmem)
107{
Mauro Dreissig549d33d2015-11-22 20:02:19 -0200108 struct intf_hdl *hdl = &adapter->pio_queue->intf;
Larry Finger2865d422010-08-20 10:15:30 -0500109
Mauro Dreissig549d33d2015-11-22 20:02:19 -0200110 hdl->io_ops._write_port(hdl, addr, cnt, pmem);
Larry Finger2865d422010-08-20 10:15:30 -0500111}