~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/tifm.h

Version: ~ [ linux-5.3-rc5 ] ~ [ linux-5.2.9 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.67 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.139 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.189 ] ~ [ linux-4.8.17 ] ~ [ linux-4.7.10 ] ~ [ linux-4.6.7 ] ~ [ linux-4.5.7 ] ~ [ linux-4.4.189 ] ~ [ linux-4.3.6 ] ~ [ linux-4.2.8 ] ~ [ linux-4.1.52 ] ~ [ linux-4.0.9 ] ~ [ linux-3.19.8 ] ~ [ linux-3.18.140 ] ~ [ linux-3.17.8 ] ~ [ linux-3.16.72 ] ~ [ linux-3.15.10 ] ~ [ linux-3.14.79 ] ~ [ linux-3.13.11 ] ~ [ linux-3.12.74 ] ~ [ linux-3.11.10 ] ~ [ linux-3.10.108 ] ~ [ linux-3.9.11 ] ~ [ linux-3.8.13 ] ~ [ linux-3.7.10 ] ~ [ linux-3.6.11 ] ~ [ linux-3.5.7 ] ~ [ linux-3.4.113 ] ~ [ linux-3.3.8 ] ~ [ linux-3.2.102 ] ~ [ linux-3.1.10 ] ~ [ linux-3.0.101 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.5 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /*
  2  *  tifm.h - TI FlashMedia driver
  3  *
  4  *  Copyright (C) 2006 Alex Dubov <oakad@yahoo.com>
  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 version 2 as
  8  * published by the Free Software Foundation.
  9  *
 10  */
 11 
 12 #ifndef _TIFM_H
 13 #define _TIFM_H
 14 
 15 #include <linux/spinlock.h>
 16 #include <linux/interrupt.h>
 17 #include <linux/delay.h>
 18 #include <linux/pci.h>
 19 #include <linux/workqueue.h>
 20 
 21 /* Host registers (relative to pci base address): */
 22 enum {
 23         FM_SET_INTERRUPT_ENABLE   = 0x008,
 24         FM_CLEAR_INTERRUPT_ENABLE = 0x00c,
 25         FM_INTERRUPT_STATUS       = 0x014
 26 };
 27 
 28 /* Socket registers (relative to socket base address): */
 29 enum {
 30         SOCK_CONTROL                   = 0x004,
 31         SOCK_PRESENT_STATE             = 0x008,
 32         SOCK_DMA_ADDRESS               = 0x00c,
 33         SOCK_DMA_CONTROL               = 0x010,
 34         SOCK_DMA_FIFO_INT_ENABLE_SET   = 0x014,
 35         SOCK_DMA_FIFO_INT_ENABLE_CLEAR = 0x018,
 36         SOCK_DMA_FIFO_STATUS           = 0x020,
 37         SOCK_FIFO_CONTROL              = 0x024,
 38         SOCK_FIFO_PAGE_SIZE            = 0x028,
 39         SOCK_MMCSD_COMMAND             = 0x104,
 40         SOCK_MMCSD_ARG_LOW             = 0x108,
 41         SOCK_MMCSD_ARG_HIGH            = 0x10c,
 42         SOCK_MMCSD_CONFIG              = 0x110,
 43         SOCK_MMCSD_STATUS              = 0x114,
 44         SOCK_MMCSD_INT_ENABLE          = 0x118,
 45         SOCK_MMCSD_COMMAND_TO          = 0x11c,
 46         SOCK_MMCSD_DATA_TO             = 0x120,
 47         SOCK_MMCSD_DATA                = 0x124,
 48         SOCK_MMCSD_BLOCK_LEN           = 0x128,
 49         SOCK_MMCSD_NUM_BLOCKS          = 0x12c,
 50         SOCK_MMCSD_BUFFER_CONFIG       = 0x130,
 51         SOCK_MMCSD_SPI_CONFIG          = 0x134,
 52         SOCK_MMCSD_SDIO_MODE_CONFIG    = 0x138,
 53         SOCK_MMCSD_RESPONSE            = 0x144,
 54         SOCK_MMCSD_SDIO_SR             = 0x164,
 55         SOCK_MMCSD_SYSTEM_CONTROL      = 0x168,
 56         SOCK_MMCSD_SYSTEM_STATUS       = 0x16c,
 57         SOCK_MS_COMMAND                = 0x184,
 58         SOCK_MS_DATA                   = 0x188,
 59         SOCK_MS_STATUS                 = 0x18c,
 60         SOCK_MS_SYSTEM                 = 0x190,
 61         SOCK_FIFO_ACCESS               = 0x200
 62 };
 63 
 64 #define TIFM_CTRL_LED             0x00000040
 65 #define TIFM_CTRL_FAST_CLK        0x00000100
 66 #define TIFM_CTRL_POWER_MASK      0x00000007
 67 
 68 #define TIFM_SOCK_STATE_OCCUPIED  0x00000008
 69 #define TIFM_SOCK_STATE_POWERED   0x00000080
 70 
 71 #define TIFM_FIFO_ENABLE          0x00000001
 72 #define TIFM_FIFO_READY           0x00000001
 73 #define TIFM_FIFO_MORE            0x00000008
 74 #define TIFM_FIFO_INT_SETALL      0x0000ffff
 75 #define TIFM_FIFO_INTMASK         0x00000005
 76 
 77 #define TIFM_DMA_RESET            0x00000002
 78 #define TIFM_DMA_TX               0x00008000
 79 #define TIFM_DMA_EN               0x00000001
 80 #define TIFM_DMA_TSIZE            0x0000007f
 81 
 82 #define TIFM_TYPE_XD 1
 83 #define TIFM_TYPE_MS 2
 84 #define TIFM_TYPE_SD 3
 85 
 86 struct tifm_device_id {
 87         unsigned char type;
 88 };
 89 
 90 struct tifm_driver;
 91 struct tifm_dev {
 92         char __iomem  *addr;
 93         spinlock_t    lock;
 94         unsigned char type;
 95         unsigned int  socket_id;
 96 
 97         void          (*card_event)(struct tifm_dev *sock);
 98         void          (*data_event)(struct tifm_dev *sock);
 99 
100         struct device dev;
101 };
102 
103 struct tifm_driver {
104         struct tifm_device_id *id_table;
105         int                   (*probe)(struct tifm_dev *dev);
106         void                  (*remove)(struct tifm_dev *dev);
107         int                   (*suspend)(struct tifm_dev *dev,
108                                          pm_message_t state);
109         int                   (*resume)(struct tifm_dev *dev);
110 
111         struct device_driver  driver;
112 };
113 
114 struct tifm_adapter {
115         char __iomem        *addr;
116         spinlock_t          lock;
117         unsigned int        irq_status;
118         unsigned int        socket_change_set;
119         unsigned int        id;
120         unsigned int        num_sockets;
121         struct completion   *finish_me;
122 
123         struct work_struct  media_switcher;
124         struct device       dev;
125 
126         void                (*eject)(struct tifm_adapter *fm,
127                                      struct tifm_dev *sock);
128         int                 (*has_ms_pif)(struct tifm_adapter *fm,
129                                           struct tifm_dev *sock);
130 
131         struct tifm_dev     *sockets[0];
132 };
133 
134 struct tifm_adapter *tifm_alloc_adapter(unsigned int num_sockets,
135                                         struct device *dev);
136 int tifm_add_adapter(struct tifm_adapter *fm);
137 void tifm_remove_adapter(struct tifm_adapter *fm);
138 void tifm_free_adapter(struct tifm_adapter *fm);
139 
140 void tifm_free_device(struct device *dev);
141 struct tifm_dev *tifm_alloc_device(struct tifm_adapter *fm, unsigned int id,
142                                    unsigned char type);
143 
144 int tifm_register_driver(struct tifm_driver *drv);
145 void tifm_unregister_driver(struct tifm_driver *drv);
146 void tifm_eject(struct tifm_dev *sock);
147 int tifm_has_ms_pif(struct tifm_dev *sock);
148 int tifm_map_sg(struct tifm_dev *sock, struct scatterlist *sg, int nents,
149                 int direction);
150 void tifm_unmap_sg(struct tifm_dev *sock, struct scatterlist *sg, int nents,
151                    int direction);
152 void tifm_queue_work(struct work_struct *work);
153 
154 static inline void *tifm_get_drvdata(struct tifm_dev *dev)
155 {
156         return dev_get_drvdata(&dev->dev);
157 }
158 
159 static inline void tifm_set_drvdata(struct tifm_dev *dev, void *data)
160 {
161         dev_set_drvdata(&dev->dev, data);
162 }
163 
164 #endif
165 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | Wiki (Japanese) | Wiki (English) | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

osdn.jp