sdio_func.h 2.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687
  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. #ifndef MMC_SDIO_FUNC_H
  12. #define MMC_SDIO_FUNC_H
  13. struct mmc_card;
  14. /*
  15. * SDIO function CIS tuple (unknown to the core)
  16. */
  17. struct sdio_func_tuple {
  18. struct sdio_func_tuple *next;
  19. unsigned char code;
  20. unsigned char size;
  21. unsigned char data[0];
  22. };
  23. /*
  24. * SDIO function devices
  25. */
  26. struct sdio_func {
  27. struct mmc_card *card; /* the card this device belongs to */
  28. struct device dev; /* the device */
  29. unsigned int num; /* function number */
  30. unsigned char class; /* standard interface class */
  31. unsigned short vendor; /* vendor id */
  32. unsigned short device; /* device id */
  33. unsigned short blksize; /* maximum block size */
  34. unsigned int state; /* function state */
  35. #define SDIO_STATE_PRESENT (1<<0) /* present in sysfs */
  36. struct sdio_func_tuple *tuples;
  37. };
  38. #define sdio_func_present(f) ((f)->state & SDIO_STATE_PRESENT)
  39. #define sdio_func_set_present(f) ((f)->state |= SDIO_STATE_PRESENT)
  40. #define sdio_func_id(f) ((f)->dev.bus_id)
  41. #define sdio_get_drvdata(f) dev_get_drvdata(&(f)->dev)
  42. #define sdio_set_drvdata(f,d) dev_set_drvdata(&(f)->dev, d)
  43. /*
  44. * SDIO function device driver
  45. */
  46. struct sdio_driver {
  47. char *name;
  48. int (*probe)(struct sdio_func *);
  49. void (*remove)(struct sdio_func *);
  50. struct device_driver drv;
  51. };
  52. extern int sdio_register_driver(struct sdio_driver *);
  53. extern void sdio_unregister_driver(struct sdio_driver *);
  54. /*
  55. * SDIO I/O operations
  56. */
  57. extern void sdio_claim_host(struct sdio_func *func);
  58. extern void sdio_release_host(struct sdio_func *func);
  59. extern int sdio_enable_func(struct sdio_func *func);
  60. extern int sdio_disable_func(struct sdio_func *func);
  61. extern unsigned char sdio_readb(struct sdio_func *func,
  62. unsigned int addr, int *err_ret);
  63. extern void sdio_writeb(struct sdio_func *func, unsigned char b,
  64. unsigned int addr, int *err_ret);
  65. #endif