Linux kernel & device driver programming

Cross-Referenced Linux and Device Driver Code

[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ]
Version: [ 2.6.11.8 ] [ 2.6.25 ] [ 2.6.25.8 ] [ 2.6.31.13 ] Architecture: [ i386 ]
  1 /*
  2  *  linux/include/linux/mmc/card.h
  3  *
  4  * This program is free software; you can redistribute it and/or modify
  5  * it under the terms of the GNU General Public License version 2 as
  6  * published by the Free Software Foundation.
  7  *
  8  *  Card driver specific definitions.
  9  */
 10 #ifndef LINUX_MMC_CARD_H
 11 #define LINUX_MMC_CARD_H
 12 
 13 #include <linux/mmc/mmc.h>
 14 
 15 struct mmc_cid {
 16         unsigned int            manfid;
 17         char                    prod_name[8];
 18         unsigned int            serial;
 19         unsigned short          oemid;
 20         unsigned short          year;
 21         unsigned char           hwrev;
 22         unsigned char           fwrev;
 23         unsigned char           month;
 24 };
 25 
 26 struct mmc_csd {
 27         unsigned char           mmca_vsn;
 28         unsigned short          cmdclass;
 29         unsigned short          tacc_clks;
 30         unsigned int            tacc_ns;
 31         unsigned int            max_dtr;
 32         unsigned int            read_blkbits;
 33         unsigned int            capacity;
 34 };
 35 
 36 struct mmc_host;
 37 
 38 /*
 39  * MMC device
 40  */
 41 struct mmc_card {
 42         struct list_head        node;           /* node in hosts devices list */
 43         struct mmc_host         *host;          /* the host this device belongs to */
 44         struct device           dev;            /* the device */
 45         unsigned int            rca;            /* relative card address of device */
 46         unsigned int            state;          /* (our) card state */
 47 #define MMC_STATE_PRESENT       (1<<0)          /* present in sysfs */
 48 #define MMC_STATE_DEAD          (1<<1)          /* device no longer in stack */
 49 #define MMC_STATE_BAD           (1<<2)          /* unrecognised device */
 50         u32                     raw_cid[4];     /* raw card CID */
 51         u32                     raw_csd[4];     /* raw card CSD */
 52         struct mmc_cid          cid;            /* card identification */
 53         struct mmc_csd          csd;            /* card specific */
 54 };
 55 
 56 #define mmc_card_present(c)     ((c)->state & MMC_STATE_PRESENT)
 57 #define mmc_card_dead(c)        ((c)->state & MMC_STATE_DEAD)
 58 #define mmc_card_bad(c)         ((c)->state & MMC_STATE_BAD)
 59 
 60 #define mmc_card_set_present(c) ((c)->state |= MMC_STATE_PRESENT)
 61 #define mmc_card_set_dead(c)    ((c)->state |= MMC_STATE_DEAD)
 62 #define mmc_card_set_bad(c)     ((c)->state |= MMC_STATE_BAD)
 63 
 64 #define mmc_card_name(c)        ((c)->cid.prod_name)
 65 #define mmc_card_id(c)          ((c)->dev.bus_id)
 66 
 67 #define mmc_list_to_card(l)     container_of(l, struct mmc_card, node)
 68 #define mmc_get_drvdata(c)      dev_get_drvdata(&(c)->dev)
 69 #define mmc_set_drvdata(c,d)    dev_set_drvdata(&(c)->dev, d)
 70 
 71 /*
 72  * MMC device driver (e.g., Flash card, I/O card...)
 73  */
 74 struct mmc_driver {
 75         struct device_driver drv;
 76         int (*probe)(struct mmc_card *);
 77         void (*remove)(struct mmc_card *);
 78         int (*suspend)(struct mmc_card *, u32);
 79         int (*resume)(struct mmc_card *);
 80 };
 81 
 82 extern int mmc_register_driver(struct mmc_driver *);
 83 extern void mmc_unregister_driver(struct mmc_driver *);
 84 
 85 static inline int mmc_card_claim_host(struct mmc_card *card)
 86 {
 87         return __mmc_claim_host(card->host, card);
 88 }
 89 
 90 #define mmc_card_release_host(c)        mmc_release_host((c)->host)
 91 
 92 #endif
 93 
  This page was automatically generated by the LXR engine.