]> git.proxmox.com Git - mirror_ubuntu-eoan-kernel.git/blame - include/linux/mmc/sdio_func.h
mmc: initialize mmc subsystem with subsys_initcall()
[mirror_ubuntu-eoan-kernel.git] / include / linux / mmc / sdio_func.h
CommitLineData
e29a7d73
PO
1/*
2 * include/linux/mmc/sdio_func.h
3 *
4 * Copyright 2007 Pierre Ossman
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or (at
9 * your option) any later version.
10 */
11
12#ifndef MMC_SDIO_FUNC_H
13#define MMC_SDIO_FUNC_H
14
15struct mmc_card;
16
b1538bcf
NP
17/*
18 * SDIO function CIS tuple (unknown to the core)
19 */
20struct sdio_func_tuple {
21 struct sdio_func_tuple *next;
22 unsigned char code;
23 unsigned char size;
24 unsigned char data[0];
25};
26
e29a7d73
PO
27/*
28 * SDIO function devices
29 */
30struct sdio_func {
31 struct mmc_card *card; /* the card this device belongs to */
32 struct device dev; /* the device */
33 unsigned int num; /* function number */
0597007f
PO
34
35 unsigned char class; /* standard interface class */
36 unsigned short vendor; /* vendor id */
37 unsigned short device; /* device id */
38
1a632f8c
PO
39 unsigned short blksize; /* maximum block size */
40
e29a7d73
PO
41 unsigned int state; /* function state */
42#define SDIO_STATE_PRESENT (1<<0) /* present in sysfs */
b1538bcf
NP
43
44 struct sdio_func_tuple *tuples;
e29a7d73
PO
45};
46
47#define sdio_func_present(f) ((f)->state & SDIO_STATE_PRESENT)
48
49#define sdio_func_set_present(f) ((f)->state |= SDIO_STATE_PRESENT)
50
51#define sdio_func_id(f) ((f)->dev.bus_id)
52
f76c8515
PO
53#define sdio_get_drvdata(f) dev_get_drvdata(&(f)->dev)
54#define sdio_set_drvdata(f,d) dev_set_drvdata(&(f)->dev, d)
55
56/*
57 * SDIO function device driver
58 */
59struct sdio_driver {
60 char *name;
61
62 int (*probe)(struct sdio_func *);
63 void (*remove)(struct sdio_func *);
64
65 struct device_driver drv;
66};
67
68extern int sdio_register_driver(struct sdio_driver *);
69extern void sdio_unregister_driver(struct sdio_driver *);
70
46f555f2
PO
71/*
72 * SDIO I/O operations
73 */
74extern void sdio_claim_host(struct sdio_func *func);
75extern void sdio_release_host(struct sdio_func *func);
76
fa64efa1
PO
77extern int sdio_enable_func(struct sdio_func *func);
78extern int sdio_disable_func(struct sdio_func *func);
79
46f555f2
PO
80extern unsigned char sdio_readb(struct sdio_func *func,
81 unsigned int addr, int *err_ret);
82
83extern void sdio_writeb(struct sdio_func *func, unsigned char b,
84 unsigned int addr, int *err_ret);
85
e29a7d73
PO
86#endif
87