1
2
3
4
5
6
7
8
9
10
11
12
13
14
15#include <linux/types.h>
16#include <linux/init.h>
17#include <linux/mm.h>
18#include <linux/slab.h>
19#include <linux/dma-mapping.h>
20#include <linux/ioport.h>
21
22#include <asm/io.h>
23#include <asm/hardware.h>
24#include <asm/parisc-device.h>
25
26struct hppb_card {
27 unsigned long hpa;
28 struct resource mmio_region;
29 struct hppb_card *next;
30};
31
32static struct hppb_card hppb_card_head = {
33 .hpa = 0,
34 .next = NULL,
35};
36
37#define IO_IO_LOW offsetof(struct bc_module, io_io_low)
38#define IO_IO_HIGH offsetof(struct bc_module, io_io_high)
39
40
41
42
43
44
45
46
47
48static int hppb_probe(struct parisc_device *dev)
49{
50 int status;
51 struct hppb_card *card = &hppb_card_head;
52
53 while(card->next) {
54 card = card->next;
55 }
56
57 if(card->hpa) {
58 card->next = kzalloc(sizeof(struct hppb_card), GFP_KERNEL);
59 if(!card->next) {
60 printk(KERN_ERR "HP-PB: Unable to allocate memory.\n");
61 return 1;
62 }
63 card = card->next;
64 }
65 printk(KERN_INFO "Found GeckoBoa at 0x%x\n", dev->hpa.start);
66
67 card->hpa = dev->hpa.start;
68 card->mmio_region.name = "HP-PB Bus";
69 card->mmio_region.flags = IORESOURCE_MEM;
70
71 card->mmio_region.start = gsc_readl(dev->hpa.start + IO_IO_LOW);
72 card->mmio_region.end = gsc_readl(dev->hpa.start + IO_IO_HIGH) - 1;
73
74 status = ccio_request_resource(dev, &card->mmio_region);
75 if(status < 0) {
76 printk(KERN_ERR "%s: failed to claim HP-PB bus space (%08x, %08x)\n",
77 __FILE__, card->mmio_region.start, card->mmio_region.end);
78 }
79
80 return 0;
81}
82
83static struct parisc_device_id hppb_tbl[] = {
84 { HPHW_BCPORT, HVERSION_REV_ANY_ID, 0x500, 0xc },
85 { HPHW_BCPORT, 0x0, 0x501, 0xc },
86 { HPHW_BCPORT, 0x0, 0x502, 0xc },
87 { HPHW_BCPORT, 0x0, 0x503, 0xc },
88 { 0, }
89};
90
91static struct parisc_driver hppb_driver = {
92 .name = "gecko_boa",
93 .id_table = hppb_tbl,
94 .probe = hppb_probe,
95};
96
97
98
99
100
101
102void __init hppb_init(void)
103{
104 register_parisc_driver(&hppb_driver);
105}
106