0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018 #ifndef _LINUX_TC_H
0019 #define _LINUX_TC_H
0020
0021 #include <linux/compiler.h>
0022 #include <linux/device.h>
0023 #include <linux/ioport.h>
0024 #include <linux/types.h>
0025
0026
0027
0028
0029 #define TC_OLDCARD 0x3c0000
0030 #define TC_NEWCARD 0x000000
0031
0032 #define TC_ROM_WIDTH 0x3e0
0033 #define TC_ROM_STRIDE 0x3e4
0034 #define TC_ROM_SIZE 0x3e8
0035 #define TC_SLOT_SIZE 0x3ec
0036 #define TC_PATTERN0 0x3f0
0037 #define TC_PATTERN1 0x3f4
0038 #define TC_PATTERN2 0x3f8
0039 #define TC_PATTERN3 0x3fc
0040 #define TC_FIRM_VER 0x400
0041 #define TC_VENDOR 0x420
0042 #define TC_MODULE 0x440
0043 #define TC_FIRM_TYPE 0x460
0044 #define TC_FLAGS 0x470
0045 #define TC_ROM_OBJECTS 0x480
0046
0047
0048
0049
0050 struct tcinfo {
0051 s32 revision;
0052 s32 clk_period;
0053 s32 slot_size;
0054 s32 io_timeout;
0055 s32 dma_range;
0056 s32 max_dma_burst;
0057 s32 parity;
0058 s32 reserved[4];
0059 };
0060
0061
0062
0063
0064 struct tc_bus {
0065 struct list_head devices;
0066 struct resource resource[2];
0067
0068 struct device dev;
0069 char name[13];
0070 resource_size_t slot_base;
0071 resource_size_t ext_slot_base;
0072 resource_size_t ext_slot_size;
0073 int num_tcslots;
0074 struct tcinfo info;
0075 };
0076
0077
0078
0079
0080 struct tc_dev {
0081 struct list_head node;
0082 struct tc_bus *bus;
0083 struct tc_driver *driver;
0084
0085 struct device dev;
0086 struct resource resource;
0087 u64 dma_mask;
0088 char vendor[9];
0089 char name[9];
0090 char firmware[9];
0091 int interrupt;
0092 int slot;
0093 };
0094
0095 #define to_tc_dev(n) container_of(n, struct tc_dev, dev)
0096
0097 struct tc_device_id {
0098 char vendor[9];
0099 char name[9];
0100 };
0101
0102
0103
0104
0105 struct tc_driver {
0106 struct list_head node;
0107 const struct tc_device_id *id_table;
0108 struct device_driver driver;
0109 };
0110
0111 #define to_tc_driver(drv) container_of(drv, struct tc_driver, driver)
0112
0113
0114
0115
0116 static inline unsigned long tc_get_speed(struct tc_bus *tbus)
0117 {
0118 return 100000 * (10000 / (unsigned long)tbus->info.clk_period);
0119 }
0120
0121 #ifdef CONFIG_TC
0122
0123 extern struct bus_type tc_bus_type;
0124
0125 extern int tc_register_driver(struct tc_driver *tdrv);
0126 extern void tc_unregister_driver(struct tc_driver *tdrv);
0127
0128 #else
0129
0130 static inline int tc_register_driver(struct tc_driver *tdrv) { return 0; }
0131 static inline void tc_unregister_driver(struct tc_driver *tdrv) { }
0132
0133 #endif
0134
0135
0136
0137
0138 extern int tc_preadb(u8 *valp, void __iomem *addr);
0139 extern int tc_bus_get_info(struct tc_bus *tbus);
0140 extern void tc_device_get_irq(struct tc_dev *tdev);
0141
0142 #endif