Duy Truong | 790f06d | 2013-02-13 16:38:12 -0800 | [diff] [blame] | 1 | /* Copyright (c) 2009-2012, The Linux Foundation. All rights reserved. |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 2 | * |
| 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 | |
| 35 | typedef int (suspend_handler_t)(struct sdio_func *); |
| 36 | typedef void (resume_handler_t)(struct sdio_func *); |
Pavan Kumar | 89f18c3 | 2012-03-21 14:55:22 +0530 | [diff] [blame] | 37 | typedef void (notify_card_removal_t)(void); |
Pavan Kumar | c2ee83a | 2012-03-30 13:39:35 +0530 | [diff] [blame] | 38 | typedef void (shutdown_handler_t)(void); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 39 | |
Pavan Kumar | 8832b23 | 2012-03-05 19:32:29 +0530 | [diff] [blame] | 40 | int libra_enable_sdio_irq_in_chip(struct sdio_func *func, u8 enable); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 41 | int libra_sdio_configure(sdio_irq_handler_t libra_sdio_rxhandler, |
| 42 | void (*func_drv_fn)(int *status), |
| 43 | u32 funcdrv_timeout, u32 blksize); |
| 44 | void libra_sdio_deconfigure(struct sdio_func *func); |
| 45 | struct sdio_func *libra_getsdio_funcdev(void); |
| 46 | void libra_sdio_setprivdata(struct sdio_func *sdio_func_dev, |
| 47 | void *padapter); |
| 48 | void *libra_sdio_getprivdata(struct sdio_func *sdio_func_dev); |
| 49 | void libra_claim_host(struct sdio_func *sdio_func_dev, |
| 50 | pid_t *curr_claimed, pid_t current_pid, |
| 51 | atomic_t *claim_count); |
| 52 | void libra_release_host(struct sdio_func *sdio_func_dev, |
| 53 | pid_t *curr_claimed, pid_t current_pid, |
| 54 | atomic_t *claim_count); |
| 55 | void libra_sdiocmd52(struct sdio_func *sdio_func_dev, |
| 56 | u32 addr, u8 *b, int write, int *err_ret); |
| 57 | u8 libra_sdio_readsb(struct sdio_func *func, void *dst, |
| 58 | unsigned int addr, int count); |
| 59 | int libra_sdio_memcpy_fromio(struct sdio_func *func, |
| 60 | void *dst, unsigned int addr, int count); |
| 61 | int libra_sdio_writesb(struct sdio_func *func, |
| 62 | unsigned int addr, void *src, int count); |
| 63 | int libra_sdio_memcpy_toio(struct sdio_func *func, |
| 64 | unsigned int addr, void *src, int count); |
| 65 | int libra_sdio_enable_polling(void); |
| 66 | |
| 67 | int libra_sdio_configure_suspend_resume( |
| 68 | suspend_handler_t *libra_sdio_suspend_hdlr, |
| 69 | resume_handler_t *libra_sdio_resume_hdlr); |
| 70 | |
| 71 | int libra_detect_card_change(void); |
| 72 | |
| 73 | void libra_sdio_set_clock(struct sdio_func *func, unsigned int clk_freq); |
| 74 | void libra_sdio_get_card_id(struct sdio_func *func, unsigned short *card_id); |
| 75 | void libra_sdio_release_irq(struct sdio_func *func); |
| 76 | int libra_enable_sdio_irq(struct sdio_func *func, u8 enable); |
| 77 | void libra_sdio_disable_func(struct sdio_func *func); |
| 78 | int libra_disable_sdio_irq_capability(struct sdio_func *func, u8 disable); |
Pavan Kumar | 89f18c3 | 2012-03-21 14:55:22 +0530 | [diff] [blame] | 79 | int libra_sdio_notify_card_removal( |
| 80 | notify_card_removal_t *libra_sdio_notify_card_removal_hdlr); |
Pavan Kumar | c2ee83a | 2012-03-30 13:39:35 +0530 | [diff] [blame] | 81 | int libra_sdio_register_shutdown_hdlr( |
| 82 | shutdown_handler_t *libra_shutdown_hdlr); |
Bryan Huntsman | 3f2bc4d | 2011-08-16 17:27:22 -0700 | [diff] [blame] | 83 | #endif /* __LIBRA_SDIOIF_H__ */ |