summaryrefslogtreecommitdiff
path: root/drivers/mmc/card/unifi_fs/fs_sdio_api.h
blob: d23531509d62e67d07663beec605075e0ed4d9aa (plain)
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
/*
 *fs_sdio_api.h - Freescale SDIO glue module API for UniFi.
 *
 * Copyright (C) 2008 Cambridge Silicon Radio Ltd.
 *
 */
/*
 * Copyright 2008-2010 Freescale Semiconductor
 */
/*
 * The code contained herein is licensed under the GNU General Public
 * License. You may obtain a copy of the GNU General Public License
 * Version 2 or later at the following locations:
 *
 * http://www.opensource.org/licenses/gpl-license.html
 * http://www.gnu.org/copyleft/gpl.html
 */
#ifndef _FS_SDIO_API_H
#define _FS_SDIO_API_H

struct sdio_dev;

struct fs_driver {
	const char *name;
	int (*probe)(struct sdio_dev *fdev);
	void (*remove)(struct sdio_dev *fdev);
	void (*card_int_handler)(struct sdio_dev *fdev);
	void (*suspend)(struct sdio_dev *fdev, pm_message_t state);
	void (*resume)(struct sdio_dev *fdev);
};

int fs_sdio_readb(struct sdio_dev *fdev, int funcnum,
		  unsigned long addr, unsigned char *pdata);
int fs_sdio_writeb(struct sdio_dev *fdev, int funcnum,
		   unsigned long addr, unsigned char data);
int fs_sdio_block_rw(struct sdio_dev *fdev, int funcnum,
		     unsigned long addr, unsigned char *pdata,
		     unsigned int count, int direction);

int fs_sdio_register_driver(struct fs_driver *driver);
void fs_sdio_unregister_driver(struct fs_driver *driver);
int fs_sdio_set_block_size(struct sdio_dev *fdev, int blksz);
int fs_sdio_set_max_clock_speed(struct sdio_dev *fdev, int max_khz);
int fs_sdio_enable_interrupt(struct sdio_dev *fdev, int enable);
int fs_sdio_enable(struct sdio_dev *fdev);
int fs_sdio_hard_reset(struct sdio_dev *fdev);

struct sdio_dev {
	/**< Device driver for this module. */
	struct fs_driver *driver;

	struct sdio_func *func;

	/**< Data private to the device driver. */
	void *drv_data;

	int int_enabled;
	spinlock_t lock;

	uint16_t vendor_id;     /**< Vendor ID of the card. */
	uint16_t device_id;     /**< Device ID of the card. */

	/**< Maximum block size supported. */
	int max_blocksize;
};


#endif	/* #ifndef _FS_SDIO_API_H */