blob: a88eba3314d7fb02b812c7b8cf5055788da90fa4 [file] [log] [blame]
Bruce Losureff3eb552005-04-25 13:12:02 -07001/*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (c) 2005 Silicon Graphics, Inc. All rights reserved.
7 */
8
9#include <linux/module.h>
10#include <linux/kernel.h>
Bruce Losureff3eb552005-04-25 13:12:02 -070011#include <linux/slab.h>
12#include <linux/spinlock.h>
13#include <linux/proc_fs.h>
Randy Dunlapa9415642006-01-11 12:17:48 -080014#include <linux/capability.h>
Bruce Losureff3eb552005-04-25 13:12:02 -070015#include <linux/device.h>
16#include <linux/delay.h>
Jack Steiner21517a52005-07-07 09:14:00 -070017#include <asm/system.h>
Bruce Losureff3eb552005-04-25 13:12:02 -070018#include <asm/uaccess.h>
19#include <asm/sn/sn_sal.h>
20#include <asm/sn/addrs.h>
21#include <asm/sn/io.h>
22#include <asm/sn/types.h>
23#include <asm/sn/shubio.h>
24#include <asm/sn/tiocx.h>
Bruce Losurece0a3952005-04-25 19:41:00 -070025#include <asm/sn/l1.h>
26#include <asm/sn/module.h>
Bruce Losureff3eb552005-04-25 13:12:02 -070027#include "tio.h"
28#include "xtalk/xwidgetdev.h"
29#include "xtalk/hubdev.h"
30
31#define CX_DEV_NONE 0
32#define DEVICE_NAME "tiocx"
33#define WIDGET_ID 0
34#define TIOCX_DEBUG 0
35
36#if TIOCX_DEBUG
37#define DBG(fmt...) printk(KERN_ALERT fmt)
38#else
39#define DBG(fmt...)
40#endif
41
42struct device_attribute dev_attr_cxdev_control;
43
44/**
45 * tiocx_match - Try to match driver id list with device.
46 * @dev: device pointer
47 * @drv: driver pointer
48 *
49 * Returns 1 if match, 0 otherwise.
50 */
51static int tiocx_match(struct device *dev, struct device_driver *drv)
52{
53 struct cx_dev *cx_dev = to_cx_dev(dev);
54 struct cx_drv *cx_drv = to_cx_driver(drv);
55 const struct cx_device_id *ids = cx_drv->id_table;
56
57 if (!ids)
58 return 0;
59
60 while (ids->part_num) {
61 if (ids->part_num == cx_dev->cx_id.part_num)
62 return 1;
63 ids++;
64 }
65 return 0;
66
67}
68
Kay Sievers7eff2e72007-08-14 15:15:12 +020069static int tiocx_uevent(struct device *dev, struct kobj_uevent_env *env)
Bruce Losureff3eb552005-04-25 13:12:02 -070070{
71 return -ENODEV;
72}
73
74static void tiocx_bus_release(struct device *dev)
75{
76 kfree(to_cx_dev(dev));
77}
78
Bruce Losureff3eb552005-04-25 13:12:02 -070079/**
80 * cx_device_match - Find cx_device in the id table.
81 * @ids: id table from driver
82 * @cx_device: part/mfg id for the device
83 *
84 */
85static const struct cx_device_id *cx_device_match(const struct cx_device_id
86 *ids,
87 struct cx_dev *cx_device)
88{
89 /*
90 * NOTES: We may want to check for CX_ANY_ID too.
91 * Do we want to match against nasid too?
92 * CX_DEV_NONE == 0, if the driver tries to register for
93 * part/mfg == 0 we should return no-match (NULL) here.
94 */
95 while (ids->part_num && ids->mfg_num) {
96 if (ids->part_num == cx_device->cx_id.part_num &&
97 ids->mfg_num == cx_device->cx_id.mfg_num)
98 return ids;
99 ids++;
100 }
101
102 return NULL;
103}
104
105/**
106 * cx_device_probe - Look for matching device.
107 * Call driver probe routine if found.
108 * @cx_driver: driver table (cx_drv struct) from driver
109 * @cx_device: part/mfg id for the device
110 */
111static int cx_device_probe(struct device *dev)
112{
113 const struct cx_device_id *id;
114 struct cx_drv *cx_drv = to_cx_driver(dev->driver);
115 struct cx_dev *cx_dev = to_cx_dev(dev);
116 int error = 0;
117
118 if (!cx_dev->driver && cx_drv->probe) {
119 id = cx_device_match(cx_drv->id_table, cx_dev);
120 if (id) {
121 if ((error = cx_drv->probe(cx_dev, id)) < 0)
122 return error;
123 else
124 cx_dev->driver = cx_drv;
125 }
126 }
127
128 return error;
129}
130
131/**
132 * cx_driver_remove - Remove driver from device struct.
133 * @dev: device
134 */
135static int cx_driver_remove(struct device *dev)
136{
137 struct cx_dev *cx_dev = to_cx_dev(dev);
138 struct cx_drv *cx_drv = cx_dev->driver;
139 if (cx_drv->remove)
140 cx_drv->remove(cx_dev);
141 cx_dev->driver = NULL;
142 return 0;
143}
144
Russell King83dfb8b2006-01-05 14:34:06 +0000145struct bus_type tiocx_bus_type = {
146 .name = "tiocx",
147 .match = tiocx_match,
148 .uevent = tiocx_uevent,
149 .probe = cx_device_probe,
150 .remove = cx_driver_remove,
151};
152
Bruce Losureff3eb552005-04-25 13:12:02 -0700153/**
154 * cx_driver_register - Register the driver.
155 * @cx_driver: driver table (cx_drv struct) from driver
156 *
157 * Called from the driver init routine to register a driver.
158 * The cx_drv struct contains the driver name, a pointer to
159 * a table of part/mfg numbers and a pointer to the driver's
160 * probe/attach routine.
161 */
162int cx_driver_register(struct cx_drv *cx_driver)
163{
164 cx_driver->driver.name = cx_driver->name;
165 cx_driver->driver.bus = &tiocx_bus_type;
Bruce Losureff3eb552005-04-25 13:12:02 -0700166
167 return driver_register(&cx_driver->driver);
168}
169
170/**
171 * cx_driver_unregister - Unregister the driver.
172 * @cx_driver: driver table (cx_drv struct) from driver
173 */
174int cx_driver_unregister(struct cx_drv *cx_driver)
175{
176 driver_unregister(&cx_driver->driver);
177 return 0;
178}
179
180/**
181 * cx_device_register - Register a device.
182 * @nasid: device's nasid
183 * @part_num: device's part number
184 * @mfg_num: device's manufacturer number
185 * @hubdev: hub info associated with this device
Bruce Losure25732ad2005-09-02 15:16:35 -0500186 * @bt: board type of the device
Bruce Losureff3eb552005-04-25 13:12:02 -0700187 *
188 */
189int
190cx_device_register(nasid_t nasid, int part_num, int mfg_num,
Bruce Losure25732ad2005-09-02 15:16:35 -0500191 struct hubdev_info *hubdev, int bt)
Bruce Losureff3eb552005-04-25 13:12:02 -0700192{
193 struct cx_dev *cx_dev;
194
Pekka Enbergf96cb1f2005-09-06 15:18:31 -0700195 cx_dev = kzalloc(sizeof(struct cx_dev), GFP_KERNEL);
Bruce Losureff3eb552005-04-25 13:12:02 -0700196 DBG("cx_dev= 0x%p\n", cx_dev);
197 if (cx_dev == NULL)
198 return -ENOMEM;
199
200 cx_dev->cx_id.part_num = part_num;
201 cx_dev->cx_id.mfg_num = mfg_num;
202 cx_dev->cx_id.nasid = nasid;
203 cx_dev->hubdev = hubdev;
Bruce Losure25732ad2005-09-02 15:16:35 -0500204 cx_dev->bt = bt;
Bruce Losureff3eb552005-04-25 13:12:02 -0700205
206 cx_dev->dev.parent = NULL;
207 cx_dev->dev.bus = &tiocx_bus_type;
208 cx_dev->dev.release = tiocx_bus_release;
Bruce Losurec1ffb6a2005-05-24 08:30:00 -0700209 snprintf(cx_dev->dev.bus_id, BUS_ID_SIZE, "%d",
210 cx_dev->cx_id.nasid);
Bruce Losureff3eb552005-04-25 13:12:02 -0700211 device_register(&cx_dev->dev);
212 get_device(&cx_dev->dev);
213
214 device_create_file(&cx_dev->dev, &dev_attr_cxdev_control);
215
216 return 0;
217}
218
219/**
220 * cx_device_unregister - Unregister a device.
221 * @cx_dev: part/mfg id for the device
222 */
223int cx_device_unregister(struct cx_dev *cx_dev)
224{
225 put_device(&cx_dev->dev);
226 device_unregister(&cx_dev->dev);
227 return 0;
228}
229
230/**
231 * cx_device_reload - Reload the device.
232 * @nasid: device's nasid
233 * @part_num: device's part number
234 * @mfg_num: device's manufacturer number
235 *
236 * Remove the device associated with 'nasid' from device list and then
237 * call device-register with the given part/mfg numbers.
238 */
239static int cx_device_reload(struct cx_dev *cx_dev)
240{
Bruce Losureff3eb552005-04-25 13:12:02 -0700241 cx_device_unregister(cx_dev);
242 return cx_device_register(cx_dev->cx_id.nasid, cx_dev->cx_id.part_num,
Bruce Losure25732ad2005-09-02 15:16:35 -0500243 cx_dev->cx_id.mfg_num, cx_dev->hubdev,
244 cx_dev->bt);
Bruce Losureff3eb552005-04-25 13:12:02 -0700245}
246
Prarit Bhargava53493dc2006-01-16 19:54:40 -0800247static inline u64 tiocx_intr_alloc(nasid_t nasid, int widget,
Bruce Losureff3eb552005-04-25 13:12:02 -0700248 u64 sn_irq_info,
249 int req_irq, nasid_t req_nasid,
250 int req_slice)
251{
252 struct ia64_sal_retval rv;
253 rv.status = 0;
254 rv.v0 = 0;
255
256 ia64_sal_oemcall_nolock(&rv, SN_SAL_IOIF_INTERRUPT,
257 SAL_INTR_ALLOC, nasid,
258 widget, sn_irq_info, req_irq,
259 req_nasid, req_slice);
260 return rv.status;
261}
262
263static inline void tiocx_intr_free(nasid_t nasid, int widget,
264 struct sn_irq_info *sn_irq_info)
265{
266 struct ia64_sal_retval rv;
267 rv.status = 0;
268 rv.v0 = 0;
269
270 ia64_sal_oemcall_nolock(&rv, SN_SAL_IOIF_INTERRUPT,
271 SAL_INTR_FREE, nasid,
272 widget, sn_irq_info->irq_irq,
273 sn_irq_info->irq_cookie, 0, 0);
274}
275
276struct sn_irq_info *tiocx_irq_alloc(nasid_t nasid, int widget, int irq,
277 nasid_t req_nasid, int slice)
278{
279 struct sn_irq_info *sn_irq_info;
280 int status;
281 int sn_irq_size = sizeof(struct sn_irq_info);
282
283 if ((nasid & 1) == 0)
284 return NULL;
285
Jes Sorensen8ed9b2c2006-02-13 05:29:57 -0500286 sn_irq_info = kzalloc(sn_irq_size, GFP_KERNEL);
Bruce Losureff3eb552005-04-25 13:12:02 -0700287 if (sn_irq_info == NULL)
288 return NULL;
289
Bruce Losureff3eb552005-04-25 13:12:02 -0700290 status = tiocx_intr_alloc(nasid, widget, __pa(sn_irq_info), irq,
291 req_nasid, slice);
292 if (status) {
293 kfree(sn_irq_info);
294 return NULL;
295 } else {
296 return sn_irq_info;
297 }
298}
299
300void tiocx_irq_free(struct sn_irq_info *sn_irq_info)
301{
Prarit Bhargava53493dc2006-01-16 19:54:40 -0800302 u64 bridge = (u64) sn_irq_info->irq_bridge;
Bruce Losureff3eb552005-04-25 13:12:02 -0700303 nasid_t nasid = NASID_GET(bridge);
304 int widget;
305
306 if (nasid & 1) {
307 widget = TIO_SWIN_WIDGETNUM(bridge);
308 tiocx_intr_free(nasid, widget, sn_irq_info);
309 kfree(sn_irq_info);
310 }
311}
312
Prarit Bhargava53493dc2006-01-16 19:54:40 -0800313u64 tiocx_dma_addr(u64 addr)
Bruce Losureff3eb552005-04-25 13:12:02 -0700314{
315 return PHYS_TO_TIODMA(addr);
316}
317
Prarit Bhargava53493dc2006-01-16 19:54:40 -0800318u64 tiocx_swin_base(int nasid)
Bruce Losureff3eb552005-04-25 13:12:02 -0700319{
320 return TIO_SWIN_BASE(nasid, TIOCX_CORELET);
321}
322
323EXPORT_SYMBOL(cx_driver_register);
324EXPORT_SYMBOL(cx_driver_unregister);
325EXPORT_SYMBOL(cx_device_register);
326EXPORT_SYMBOL(cx_device_unregister);
327EXPORT_SYMBOL(tiocx_irq_alloc);
328EXPORT_SYMBOL(tiocx_irq_free);
329EXPORT_SYMBOL(tiocx_bus_type);
330EXPORT_SYMBOL(tiocx_dma_addr);
331EXPORT_SYMBOL(tiocx_swin_base);
332
Bruce Losureff3eb552005-04-25 13:12:02 -0700333static void tio_conveyor_set(nasid_t nasid, int enable_flag)
334{
Prarit Bhargava53493dc2006-01-16 19:54:40 -0800335 u64 ice_frz;
336 u64 disable_cb = (1ull << 61);
Bruce Losureff3eb552005-04-25 13:12:02 -0700337
338 if (!(nasid & 1))
339 return;
340
341 ice_frz = REMOTE_HUB_L(nasid, TIO_ICE_FRZ_CFG);
342 if (enable_flag) {
343 if (!(ice_frz & disable_cb)) /* already enabled */
344 return;
345 ice_frz &= ~disable_cb;
346 } else {
347 if (ice_frz & disable_cb) /* already disabled */
348 return;
349 ice_frz |= disable_cb;
350 }
351 DBG(KERN_ALERT "TIO_ICE_FRZ_CFG= 0x%lx\n", ice_frz);
352 REMOTE_HUB_S(nasid, TIO_ICE_FRZ_CFG, ice_frz);
353}
354
355#define tio_conveyor_enable(nasid) tio_conveyor_set(nasid, 1)
356#define tio_conveyor_disable(nasid) tio_conveyor_set(nasid, 0)
357
358static void tio_corelet_reset(nasid_t nasid, int corelet)
359{
360 if (!(nasid & 1))
361 return;
362
363 REMOTE_HUB_S(nasid, TIO_ICE_PMI_TX_CFG, 1 << corelet);
364 udelay(2000);
365 REMOTE_HUB_S(nasid, TIO_ICE_PMI_TX_CFG, 0);
366 udelay(2000);
367}
368
Bruce Losure25732ad2005-09-02 15:16:35 -0500369static int is_fpga_tio(int nasid, int *bt)
Bruce Losurece0a3952005-04-25 19:41:00 -0700370{
Jes Sorensen256a7e02007-07-11 17:26:30 +0200371 u16 uninitialized_var(ioboard_type); /* GCC be quiet */
Prarit Bhargavaf90aa8c2006-03-08 13:30:18 -0500372 s64 rc;
Bruce Losurece0a3952005-04-25 19:41:00 -0700373
Prarit Bhargavaf90aa8c2006-03-08 13:30:18 -0500374 rc = ia64_sn_sysctl_ioboard_get(nasid, &ioboard_type);
375 if (rc) {
376 printk(KERN_WARNING "ia64_sn_sysctl_ioboard_get failed: %ld\n",
377 rc);
378 return 0;
379 }
Bruce Losurece0a3952005-04-25 19:41:00 -0700380
Bruce Losure25732ad2005-09-02 15:16:35 -0500381 switch (ioboard_type) {
Bruce Losurece0a3952005-04-25 19:41:00 -0700382 case L1_BRICKTYPE_SA:
383 case L1_BRICKTYPE_ATHENA:
Bruce Losure25732ad2005-09-02 15:16:35 -0500384 case L1_BOARDTYPE_DAYTONA:
385 *bt = ioboard_type;
Bruce Losurece0a3952005-04-25 19:41:00 -0700386 return 1;
387 }
Bruce Losure25732ad2005-09-02 15:16:35 -0500388
Bruce Losurece0a3952005-04-25 19:41:00 -0700389 return 0;
390}
391
392static int bitstream_loaded(nasid_t nasid)
Bruce Losureff3eb552005-04-25 13:12:02 -0700393{
Prarit Bhargava53493dc2006-01-16 19:54:40 -0800394 u64 cx_credits;
Bruce Losureff3eb552005-04-25 13:12:02 -0700395
396 cx_credits = REMOTE_HUB_L(nasid, TIO_ICE_PMI_TX_DYN_CREDIT_STAT_CB3);
397 cx_credits &= TIO_ICE_PMI_TX_DYN_CREDIT_STAT_CB3_CREDIT_CNT_MASK;
398 DBG("cx_credits= 0x%lx\n", cx_credits);
399
400 return (cx_credits == 0xf) ? 1 : 0;
401}
402
403static int tiocx_reload(struct cx_dev *cx_dev)
404{
405 int part_num = CX_DEV_NONE;
406 int mfg_num = CX_DEV_NONE;
407 nasid_t nasid = cx_dev->cx_id.nasid;
408
Bruce Losurece0a3952005-04-25 19:41:00 -0700409 if (bitstream_loaded(nasid)) {
Prarit Bhargava53493dc2006-01-16 19:54:40 -0800410 u64 cx_id;
Bruce Losure25732ad2005-09-02 15:16:35 -0500411 int rv;
Bruce Losureff3eb552005-04-25 13:12:02 -0700412
Bruce Losure25732ad2005-09-02 15:16:35 -0500413 rv = ia64_sn_sysctl_tio_clock_reset(nasid);
414 if (rv) {
415 printk(KERN_ALERT "CX port JTAG reset failed.\n");
416 } else {
Prarit Bhargava53493dc2006-01-16 19:54:40 -0800417 cx_id = *(volatile u64 *)
Bruce Losure25732ad2005-09-02 15:16:35 -0500418 (TIO_SWIN_BASE(nasid, TIOCX_CORELET) +
Bruce Losureff3eb552005-04-25 13:12:02 -0700419 WIDGET_ID);
Bruce Losure25732ad2005-09-02 15:16:35 -0500420 part_num = XWIDGET_PART_NUM(cx_id);
421 mfg_num = XWIDGET_MFG_NUM(cx_id);
422 DBG("part= 0x%x, mfg= 0x%x\n", part_num, mfg_num);
423 /* just ignore it if it's a CE */
424 if (part_num == TIO_CE_ASIC_PARTNUM)
425 return 0;
426 }
Bruce Losureff3eb552005-04-25 13:12:02 -0700427 }
428
429 cx_dev->cx_id.part_num = part_num;
430 cx_dev->cx_id.mfg_num = mfg_num;
431
432 /*
433 * Delete old device and register the new one. It's ok if
434 * part_num/mfg_num == CX_DEV_NONE. We want to register
435 * devices in the table even if a bitstream isn't loaded.
436 * That allows use to see that a bitstream isn't loaded via
437 * TIOCX_IOCTL_DEV_LIST.
438 */
439 return cx_device_reload(cx_dev);
440}
441
Yani Ioannouff381d22005-05-17 06:40:51 -0400442static ssize_t show_cxdev_control(struct device *dev, struct device_attribute *attr, char *buf)
Bruce Losureff3eb552005-04-25 13:12:02 -0700443{
444 struct cx_dev *cx_dev = to_cx_dev(dev);
445
Bruce Losure25732ad2005-09-02 15:16:35 -0500446 return sprintf(buf, "0x%x 0x%x 0x%x 0x%x\n",
Bruce Losureff3eb552005-04-25 13:12:02 -0700447 cx_dev->cx_id.nasid,
Bruce Losurece0a3952005-04-25 19:41:00 -0700448 cx_dev->cx_id.part_num, cx_dev->cx_id.mfg_num,
Bruce Losure25732ad2005-09-02 15:16:35 -0500449 cx_dev->bt);
Bruce Losureff3eb552005-04-25 13:12:02 -0700450}
451
Yani Ioannouff381d22005-05-17 06:40:51 -0400452static ssize_t store_cxdev_control(struct device *dev, struct device_attribute *attr, const char *buf,
Bruce Losureff3eb552005-04-25 13:12:02 -0700453 size_t count)
454{
455 int n;
456 struct cx_dev *cx_dev = to_cx_dev(dev);
457
458 if (!capable(CAP_SYS_ADMIN))
459 return -EPERM;
460
461 if (count <= 0)
462 return 0;
463
464 n = simple_strtoul(buf, NULL, 0);
465
466 switch (n) {
467 case 1:
Bruce Losurec1ffb6a2005-05-24 08:30:00 -0700468 tio_corelet_reset(cx_dev->cx_id.nasid, TIOCX_CORELET);
469 tiocx_reload(cx_dev);
470 break;
471 case 2:
Bruce Losureff3eb552005-04-25 13:12:02 -0700472 tiocx_reload(cx_dev);
473 break;
474 case 3:
475 tio_corelet_reset(cx_dev->cx_id.nasid, TIOCX_CORELET);
476 break;
477 default:
478 break;
479 }
480
481 return count;
482}
483
484DEVICE_ATTR(cxdev_control, 0644, show_cxdev_control, store_cxdev_control);
485
486static int __init tiocx_init(void)
487{
488 cnodeid_t cnodeid;
489 int found_tiocx_device = 0;
490
Jack Steiner21517a52005-07-07 09:14:00 -0700491 if (!ia64_platform_is("sn2"))
Bjorn Helgaas6c5e6212006-03-03 15:33:47 -0700492 return 0;
Jack Steiner21517a52005-07-07 09:14:00 -0700493
Bruce Losureff3eb552005-04-25 13:12:02 -0700494 bus_register(&tiocx_bus_type);
495
Jack Steiner24ee0a62005-09-12 12:15:43 -0500496 for (cnodeid = 0; cnodeid < num_cnodes; cnodeid++) {
Bruce Losureff3eb552005-04-25 13:12:02 -0700497 nasid_t nasid;
Bruce Losure25732ad2005-09-02 15:16:35 -0500498 int bt;
Bruce Losureff3eb552005-04-25 13:12:02 -0700499
Jack Steiner24ee0a62005-09-12 12:15:43 -0500500 nasid = cnodeid_to_nasid(cnodeid);
Bruce Losureff3eb552005-04-25 13:12:02 -0700501
Bruce Losure25732ad2005-09-02 15:16:35 -0500502 if ((nasid & 0x1) && is_fpga_tio(nasid, &bt)) {
Bruce Losureff3eb552005-04-25 13:12:02 -0700503 struct hubdev_info *hubdev;
Bruce Losureff3eb552005-04-25 13:12:02 -0700504 struct xwidget_info *widgetp;
505
506 DBG("Found TIO at nasid 0x%x\n", nasid);
507
508 hubdev =
509 (struct hubdev_info *)(NODEPDA(cnodeid)->pdinfo);
Bruce Losureff3eb552005-04-25 13:12:02 -0700510
511 widgetp = &hubdev->hdi_xwidget_info[TIOCX_CORELET];
512
513 /* The CE hangs off of the CX port but is not an FPGA */
514 if (widgetp->xwi_hwid.part_num == TIO_CE_ASIC_PARTNUM)
515 continue;
516
517 tio_corelet_reset(nasid, TIOCX_CORELET);
518 tio_conveyor_enable(nasid);
519
520 if (cx_device_register
521 (nasid, widgetp->xwi_hwid.part_num,
Bruce Losure25732ad2005-09-02 15:16:35 -0500522 widgetp->xwi_hwid.mfg_num, hubdev, bt) < 0)
Bruce Losureff3eb552005-04-25 13:12:02 -0700523 return -ENXIO;
524 else
525 found_tiocx_device++;
526 }
527 }
528
529 /* It's ok if we find zero devices. */
530 DBG("found_tiocx_device= %d\n", found_tiocx_device);
531
532 return 0;
533}
534
Patrick Mochel66234152005-04-28 17:11:52 -0700535static int cx_remove_device(struct device * dev, void * data)
536{
537 struct cx_dev *cx_dev = to_cx_dev(dev);
538 device_remove_file(dev, &dev_attr_cxdev_control);
539 cx_device_unregister(cx_dev);
540 return 0;
541}
542
Bruce Losureff3eb552005-04-25 13:12:02 -0700543static void __exit tiocx_exit(void)
544{
Bruce Losureff3eb552005-04-25 13:12:02 -0700545 DBG("tiocx_exit\n");
546
547 /*
548 * Unregister devices.
549 */
Patrick Mochel66234152005-04-28 17:11:52 -0700550 bus_for_each_dev(&tiocx_bus_type, NULL, NULL, cx_remove_device);
Bruce Losureff3eb552005-04-25 13:12:02 -0700551 bus_unregister(&tiocx_bus_type);
552}
553
John Keller8ea60912006-10-04 16:49:25 -0500554fs_initcall(tiocx_init);
Bruce Losureff3eb552005-04-25 13:12:02 -0700555module_exit(tiocx_exit);
556
557/************************************************************************
558 * Module licensing and description
559 ************************************************************************/
560MODULE_LICENSE("GPL");
561MODULE_AUTHOR("Bruce Losure <blosure@sgi.com>");
562MODULE_DESCRIPTION("TIOCX module");
563MODULE_SUPPORTED_DEVICE(DEVICE_NAME);