blob: 479137398c3d65e66859114e4d892566dbc2149a [file] [log] [blame]
Micky Chingfa590c22013-11-12 17:16:08 +08001/* Driver for Realtek PCI-Express card reader
2 * Header file
3 *
4 * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
9 * later version.
10 *
11 * This program is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License along
17 * with this program; if not, see <http://www.gnu.org/licenses/>.
18 *
19 * Author:
20 * Wei WANG (wei_wang@realsil.com.cn)
21 * Micky Ching (micky_ching@realsil.com.cn)
22 */
23
24#ifndef __REALTEK_RTSX_TRANSPORT_H
25#define __REALTEK_RTSX_TRANSPORT_H
26
27#include "rtsx.h"
28#include "rtsx_chip.h"
29
30#define WAIT_TIME 2000
31
32unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer,
33 unsigned int buflen, struct scsi_cmnd *srb, unsigned int *index,
34 unsigned int *offset, enum xfer_buf_dir dir);
35void rtsx_stor_set_xfer_buf(unsigned char *buffer,
36 unsigned int buflen, struct scsi_cmnd *srb);
37void rtsx_stor_get_xfer_buf(unsigned char *buffer,
38 unsigned int buflen, struct scsi_cmnd *srb);
39void rtsx_invoke_transport(struct scsi_cmnd *srb, struct rtsx_chip *chip);
40
Micky Chingfa590c22013-11-12 17:16:08 +080041#define rtsx_init_cmd(chip) ((chip)->ci = 0)
42
43void rtsx_add_cmd(struct rtsx_chip *chip,
44 u8 cmd_type, u16 reg_addr, u8 mask, u8 data);
45void rtsx_send_cmd_no_wait(struct rtsx_chip *chip);
46int rtsx_send_cmd(struct rtsx_chip *chip, u8 card, int timeout);
47
Behan Webster33de8f22014-10-29 15:38:42 -070048static inline u8 *rtsx_get_cmd_data(struct rtsx_chip *chip)
Micky Chingfa590c22013-11-12 17:16:08 +080049{
50#ifdef CMD_USING_SG
51 return (u8 *)(chip->host_sg_tbl_ptr);
52#else
53 return (u8 *)(chip->host_cmds_ptr);
54#endif
55}
56
57int rtsx_transfer_data(struct rtsx_chip *chip, u8 card, void *buf, size_t len,
58 int use_sg, enum dma_data_direction dma_dir, int timeout);
59
60int rtsx_transfer_data_partial(struct rtsx_chip *chip, u8 card,
61 void *buf, size_t len,
62 int use_sg, unsigned int *index, unsigned int *offset,
63 enum dma_data_direction dma_dir, int timeout);
64
65#endif /* __REALTEK_RTSX_TRANSPORT_H */