1cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto#ifndef LINUX_MMC_IOCTL_H 2cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto#define LINUX_MMC_IOCTL_H 310db4e1e4e9a910a26b94045660e5ba7e7c71419Bobby Powers 410db4e1e4e9a910a26b94045660e5ba7e7c71419Bobby Powers#include <linux/types.h> 510db4e1e4e9a910a26b94045660e5ba7e7c71419Bobby Powers 6cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixtostruct mmc_ioc_cmd { 7cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto /* Implies direction of data. true = write, false = read */ 8cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto int write_flag; 9cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto 10cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto /* Application-specific command. true = precede with CMD55 */ 11cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto int is_acmd; 12cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto 13cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto __u32 opcode; 14cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto __u32 arg; 15cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto __u32 response[4]; /* CMD response */ 16cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto unsigned int flags; 17cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto unsigned int blksz; 18cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto unsigned int blocks; 19cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto 20cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto /* 21cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto * Sleep at least postsleep_min_us useconds, and at most 22cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto * postsleep_max_us useconds *after* issuing command. Needed for 23cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto * some read commands for which cards have no other way of indicating 24cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto * they're ready for the next command (i.e. there is no equivalent of 25cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto * a "busy" indicator for read operations). 26cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto */ 27cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto unsigned int postsleep_min_us; 28cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto unsigned int postsleep_max_us; 29cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto 30cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto /* 31cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto * Override driver-computed timeouts. Note the difference in units! 32cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto */ 33cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto unsigned int data_timeout_ns; 34cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto unsigned int cmd_timeout_ms; 35cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto 36cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto /* 37cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto * For 64-bit machines, the next member, ``__u64 data_ptr``, wants to 38cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto * be 8-byte aligned. Make sure this struct is the same size when 39cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto * built for 32-bit. 40cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto */ 41cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto __u32 __pad; 42cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto 43cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto /* DAT buffer */ 44cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto __u64 data_ptr; 45cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto}; 46cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto#define mmc_ioc_cmd_set_data(ic, ptr) ic.data_ptr = (__u64)(unsigned long) ptr 47cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto 48cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto#define MMC_IOC_CMD _IOWR(MMC_BLOCK_MAJOR, 0, struct mmc_ioc_cmd) 49cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto 50cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto/* 51cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto * Since this ioctl is only meant to enhance (and not replace) normal access 52cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto * to the mmc bus device, an upper data transfer limit of MMC_IOC_MAX_BYTES 53cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto * is enforced per ioctl call. For larger data transfers, use the normal 54cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto * block device operations. 55cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto */ 56cb87ea28ed9e75a41eb456bfcb547b4e6f10e750John Calixto#define MMC_IOC_MAX_BYTES (512L * 256) 57100e918610b7487fa18db97b3879cd8d1fdd5974Robert P. J. Day#endif /* LINUX_MMC_IOCTL_H */ 58