blob: d1a42cc52cf1c48667f41107c0eb24d7f47a53a9 [file] [log] [blame]
Duy Truong790f06d2013-02-13 16:38:12 -08001/* Copyright (c) 2009-2012, The Linux Foundation. All rights reserved.
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -07002 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License version 2 and
5 * only version 2 as published by the Free Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 */
13
14#ifndef __LIBRA_SDIOIF_H__
15#define __LIBRA_SDIOIF_H__
16
17/*
18 * Header for SDIO Card Interface Functions
19 */
20#include <linux/kthread.h>
21#include <linux/mmc/card.h>
22#include <linux/mmc/host.h>
23#include <linux/mmc/sdio_func.h>
24
25/*
26 * Common Defines
27 */
28#define LIBRA_MAN_ID 0x70
29#define LIBRA_REV_1_0_CARD_ID 0x0
30
31#define VOLANS_MAN_ID 0x70
32#define VOLANS_REV_1_0_CARD_ID 0x0
33#define VOLANS_REV_2_0_CARD_ID 0x2881
34
35typedef int (suspend_handler_t)(struct sdio_func *);
36typedef void (resume_handler_t)(struct sdio_func *);
Pavan Kumar89f18c32012-03-21 14:55:22 +053037typedef void (notify_card_removal_t)(void);
Pavan Kumarc2ee83a2012-03-30 13:39:35 +053038typedef void (shutdown_handler_t)(void);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070039
Pavan Kumar8832b232012-03-05 19:32:29 +053040int libra_enable_sdio_irq_in_chip(struct sdio_func *func, u8 enable);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070041int libra_sdio_configure(sdio_irq_handler_t libra_sdio_rxhandler,
42 void (*func_drv_fn)(int *status),
43 u32 funcdrv_timeout, u32 blksize);
44void libra_sdio_deconfigure(struct sdio_func *func);
45struct sdio_func *libra_getsdio_funcdev(void);
46void libra_sdio_setprivdata(struct sdio_func *sdio_func_dev,
47 void *padapter);
48void *libra_sdio_getprivdata(struct sdio_func *sdio_func_dev);
49void libra_claim_host(struct sdio_func *sdio_func_dev,
50 pid_t *curr_claimed, pid_t current_pid,
51 atomic_t *claim_count);
52void libra_release_host(struct sdio_func *sdio_func_dev,
53 pid_t *curr_claimed, pid_t current_pid,
54 atomic_t *claim_count);
55void libra_sdiocmd52(struct sdio_func *sdio_func_dev,
56 u32 addr, u8 *b, int write, int *err_ret);
57u8 libra_sdio_readsb(struct sdio_func *func, void *dst,
58 unsigned int addr, int count);
59int libra_sdio_memcpy_fromio(struct sdio_func *func,
60 void *dst, unsigned int addr, int count);
61int libra_sdio_writesb(struct sdio_func *func,
62 unsigned int addr, void *src, int count);
63int libra_sdio_memcpy_toio(struct sdio_func *func,
64 unsigned int addr, void *src, int count);
65int libra_sdio_enable_polling(void);
66
67int libra_sdio_configure_suspend_resume(
68 suspend_handler_t *libra_sdio_suspend_hdlr,
69 resume_handler_t *libra_sdio_resume_hdlr);
70
71int libra_detect_card_change(void);
72
73void libra_sdio_set_clock(struct sdio_func *func, unsigned int clk_freq);
74void libra_sdio_get_card_id(struct sdio_func *func, unsigned short *card_id);
75void libra_sdio_release_irq(struct sdio_func *func);
76int libra_enable_sdio_irq(struct sdio_func *func, u8 enable);
77void libra_sdio_disable_func(struct sdio_func *func);
78int libra_disable_sdio_irq_capability(struct sdio_func *func, u8 disable);
Pavan Kumar89f18c32012-03-21 14:55:22 +053079int libra_sdio_notify_card_removal(
80 notify_card_removal_t *libra_sdio_notify_card_removal_hdlr);
Pavan Kumarc2ee83a2012-03-30 13:39:35 +053081int libra_sdio_register_shutdown_hdlr(
82 shutdown_handler_t *libra_shutdown_hdlr);
Bryan Huntsman3f2bc4d2011-08-16 17:27:22 -070083#endif /* __LIBRA_SDIOIF_H__ */