Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  *  Interface to the TURBOchannel related routines.
0003  *
0004  *  Copyright (c) 1998  Harald Koerfgen
0005  *  Copyright (c) 2005  James Simmons
0006  *  Copyright (c) 2006  Maciej W. Rozycki
0007  *
0008  *  Based on:
0009  *
0010  *  "TURBOchannel Firmware Specification", EK-TCAAD-FS-004
0011  *
0012  *  from Digital Equipment Corporation.
0013  *
0014  *  This file is subject to the terms and conditions of the GNU
0015  *  General Public License.  See the file "COPYING" in the main
0016  *  directory of this archive for more details.
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  * Offsets for the ROM header locations for TURBOchannel cards.
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  * Information obtained through the get_tcinfo() PROM call.
0049  */
0050 struct tcinfo {
0051     s32     revision;   /* Hardware revision level. */
0052     s32     clk_period; /* Clock period in nanoseconds. */
0053     s32     slot_size;  /* Slot size in megabytes. */
0054     s32     io_timeout; /* I/O timeout in cycles. */
0055     s32     dma_range;  /* DMA address range in megabytes. */
0056     s32     max_dma_burst;  /* Maximum DMA burst length. */
0057     s32     parity;     /* System module supports TC parity. */
0058     s32     reserved[4];
0059 };
0060 
0061 /*
0062  * TURBOchannel bus.
0063  */
0064 struct tc_bus {
0065     struct list_head devices;   /* List of devices on this bus. */
0066     struct resource resource[2];    /* Address space routed to this bus. */
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  * TURBOchannel device.
0079  */
0080 struct tc_dev {
0081     struct list_head node;      /* Node in list of all TC devices. */
0082     struct tc_bus   *bus;       /* Bus this device is on. */
0083     struct tc_driver *driver;   /* Which driver has allocated this
0084                        device. */
0085     struct device   dev;        /* Generic device interface. */
0086     struct resource resource;   /* Address space of this device. */
0087     u64     dma_mask;   /* DMA addressable range. */
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  * TURBOchannel driver.
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  * Return TURBOchannel clock frequency in Hz.
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 /* !CONFIG_TC */
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 /* CONFIG_TC */
0134 
0135 /*
0136  * These have to be provided by the architecture.
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 /* _LINUX_TC_H */