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