1 | /* SPDX-License-Identifier: GPL-2.0+ */ |
2 | /* |
3 | * Driver for Realtek PCI-Express card reader |
4 | * |
5 | * Copyright(c) 2009-2013 Realtek Semiconductor Corp. All rights reserved. |
6 | * |
7 | * Author: |
8 | * Wei WANG (wei_wang@realsil.com.cn) |
9 | * Micky Ching (micky_ching@realsil.com.cn) |
10 | */ |
11 | |
12 | #ifndef __REALTEK_RTSX_TRANSPORT_H |
13 | #define __REALTEK_RTSX_TRANSPORT_H |
14 | |
15 | #include "rtsx.h" |
16 | #include "rtsx_chip.h" |
17 | |
18 | #define WAIT_TIME 2000 |
19 | |
20 | unsigned int rtsx_stor_access_xfer_buf(unsigned char *buffer, |
21 | unsigned int buflen, |
22 | struct scsi_cmnd *srb, |
23 | unsigned int *index, |
24 | unsigned int *offset, |
25 | enum xfer_buf_dir dir); |
26 | void rtsx_stor_set_xfer_buf(unsigned char *buffer, unsigned int buflen, |
27 | struct scsi_cmnd *srb); |
28 | void rtsx_stor_get_xfer_buf(unsigned char *buffer, unsigned int buflen, |
29 | struct scsi_cmnd *srb); |
30 | void rtsx_invoke_transport(struct scsi_cmnd *srb, struct rtsx_chip *chip); |
31 | |
32 | #define rtsx_init_cmd(chip) ((chip)->ci = 0) |
33 | |
34 | void rtsx_add_cmd(struct rtsx_chip *chip, u8 cmd_type, u16 reg_addr, u8 mask, |
35 | u8 data); |
36 | void rtsx_send_cmd_no_wait(struct rtsx_chip *chip); |
37 | int rtsx_send_cmd(struct rtsx_chip *chip, u8 card, int timeout); |
38 | |
39 | static inline u8 *rtsx_get_cmd_data(struct rtsx_chip *chip) |
40 | { |
41 | #ifdef CMD_USING_SG |
42 | return (u8 *)(chip->host_sg_tbl_ptr); |
43 | #else |
44 | return (u8 *)(chip->host_cmds_ptr); |
45 | #endif |
46 | } |
47 | |
48 | int rtsx_transfer_data(struct rtsx_chip *chip, u8 card, void *buf, size_t len, |
49 | int use_sg, enum dma_data_direction dma_dir, |
50 | int timeout); |
51 | |
52 | int rtsx_transfer_data_partial(struct rtsx_chip *chip, u8 card, void *buf, |
53 | size_t len, int use_sg, unsigned int *index, |
54 | unsigned int *offset, |
55 | enum dma_data_direction dma_dir, int timeout); |
56 | |
57 | #endif /* __REALTEK_RTSX_TRANSPORT_H */ |
58 | |