[PATCH] W1: w1_netlink: New init/fini netlink callbacks.
[linux-2.6/verdex.git] / drivers / parisc / hppb.c
blobe869c6020370a782c72de52d376dcf6c9b719377
1 /*
2 ** hppb.c:
3 ** HP-PB bus driver for the NOVA and K-Class systems.
4 **
5 ** (c) Copyright 2002 Ryan Bradetich
6 ** (c) Copyright 2002 Hewlett-Packard Company
7 **
8 ** This program is free software; you can redistribute it and/or modify
9 ** it under the terms of the GNU General Public License as published by
10 ** the Free Software Foundation; either version 2 of the License, or
11 ** (at your option) any later version.
13 ** This Driver currently only supports the console (port 0) on the MUX.
14 ** Additional work will be needed on this driver to enable the full
15 ** functionality of the MUX.
19 #include <linux/types.h>
20 #include <linux/init.h>
21 #include <linux/mm.h>
22 #include <linux/slab.h>
23 #include <linux/ioport.h>
25 #include <asm/io.h>
26 #include <asm/hardware.h>
27 #include <asm/parisc-device.h>
29 #include <linux/pci.h>
31 struct hppb_card {
32 unsigned long hpa;
33 struct resource mmio_region;
34 struct hppb_card *next;
37 struct hppb_card hppb_card_head = {
38 .hpa = 0,
39 .next = NULL,
42 #define IO_IO_LOW offsetof(struct bc_module, io_io_low)
43 #define IO_IO_HIGH offsetof(struct bc_module, io_io_high)
45 /**
46 * hppb_probe - Determine if the hppb driver should claim this device.
47 * @dev: The device which has been found
49 * Determine if hppb driver should claim this chip (return 0) or not
50 * (return 1). If so, initialize the chip and tell other partners in crime
51 * they have work to do.
53 static int hppb_probe(struct parisc_device *dev)
55 int status;
56 struct hppb_card *card = &hppb_card_head;
58 while(card->next) {
59 card = card->next;
62 if(card->hpa) {
63 card->next = kmalloc(sizeof(struct hppb_card), GFP_KERNEL);
64 if(!card->next) {
65 printk(KERN_ERR "HP-PB: Unable to allocate memory.\n");
66 return 1;
68 memset(card->next, '\0', sizeof(struct hppb_card));
69 card = card->next;
71 printk(KERN_INFO "Found GeckoBoa at 0x%lx\n", dev->hpa);
73 card->hpa = dev->hpa;
74 card->mmio_region.name = "HP-PB Bus";
75 card->mmio_region.flags = IORESOURCE_MEM;
77 card->mmio_region.start = __raw_readl(dev->hpa + IO_IO_LOW);
78 card->mmio_region.end = __raw_readl(dev->hpa + IO_IO_HIGH) - 1;
80 status = ccio_request_resource(dev, &card->mmio_region);
81 if(status < 0) {
82 printk(KERN_ERR "%s: failed to claim HP-PB bus space (%08lx, %08lx)\n",
83 __FILE__, card->mmio_region.start, card->mmio_region.end);
86 return 0;
90 static struct parisc_device_id hppb_tbl[] = {
91 { HPHW_BCPORT, HVERSION_REV_ANY_ID, 0x500, 0xc },
92 { 0, }
95 static struct parisc_driver hppb_driver = {
96 .name = "Gecko Boa",
97 .id_table = hppb_tbl,
98 .probe = hppb_probe,
102 * hppb_init - HP-PB bus initalization procedure.
104 * Register this driver.
106 void __init hppb_init(void)
108 register_parisc_driver(&hppb_driver);