Re: [PATCH v4] mmc: Add ioctl to let userspace apps send ACMDs

Michał Mirosław
2011-04-12T14:21:59Z

2011/4/11 John Calixto <john.calixto@modsystems.com>:
[...]
> --- /dev/null
> +++ b/include/linux/mmc/ioctl.h
> @@ -0,0 +1,32 @@
> +#ifndef _MMC_IOCTL_H
> +#define _MMC_IOCTL_H
> +struct mmc_ioc_cmd {
> +       /* implies direction of data.  true = write, false = read */
> +       int write_flag;
> +
> +       __u32 opcode;
> +       __u32 arg;
> +       __u32 response[4];  /* CMD response */
> +       unsigned int flags;
> +       unsigned int blksz;
> +       unsigned int blocks;
> +
> +       /*
> +        * Sleep at least postsleep_min_us useconds, and at most
> +        * postsleep_max_us useconds *after* issuing command.  Needed for some
> +        * read commands for which cards have no other way of indicating
> +        * they're ready for the next command (i.e. there is no equivalent of a
> +        * "busy" indicator for read operations).
> +        */
> +       unsigned int postsleep_min_us;
> +       unsigned int postsleep_max_us;
> +
> +       /*
> +        * Override driver-computed timeouts.  Note the difference in units!
> +        */
> +       unsigned int data_timeout_ns;
> +       unsigned int cmd_timeout_ms;
> +       __u64 data_ptr;  /* DAT buffer */

This will be more natural if you have an anonymous union here:
union {
__u64 data_ptr_l;
void *data_ptr;
};

> +};
> +#define MMC_IOC_ACMD _IOWR(MMC_BLOCK_MAJOR, 0, struct mmc_ioc_cmd)
> +#endif  /* _MMC_IOCTL_H */

Best Regards,
Michał Mirosław