1*4882a593Smuzhiyun // SPDX-License-Identifier: GPL-2.0-only
2*4882a593Smuzhiyun /*
3*4882a593Smuzhiyun * ck804xrom.c
4*4882a593Smuzhiyun *
5*4882a593Smuzhiyun * Normal mappings of chips in physical memory
6*4882a593Smuzhiyun *
7*4882a593Smuzhiyun * Dave Olsen <dolsen@lnxi.com>
8*4882a593Smuzhiyun * Ryan Jackson <rjackson@lnxi.com>
9*4882a593Smuzhiyun */
10*4882a593Smuzhiyun
11*4882a593Smuzhiyun #include <linux/module.h>
12*4882a593Smuzhiyun #include <linux/types.h>
13*4882a593Smuzhiyun #include <linux/kernel.h>
14*4882a593Smuzhiyun #include <linux/init.h>
15*4882a593Smuzhiyun #include <linux/slab.h>
16*4882a593Smuzhiyun #include <asm/io.h>
17*4882a593Smuzhiyun #include <linux/mtd/mtd.h>
18*4882a593Smuzhiyun #include <linux/mtd/map.h>
19*4882a593Smuzhiyun #include <linux/mtd/cfi.h>
20*4882a593Smuzhiyun #include <linux/mtd/flashchip.h>
21*4882a593Smuzhiyun #include <linux/pci.h>
22*4882a593Smuzhiyun #include <linux/pci_ids.h>
23*4882a593Smuzhiyun #include <linux/list.h>
24*4882a593Smuzhiyun
25*4882a593Smuzhiyun
26*4882a593Smuzhiyun #define MOD_NAME KBUILD_BASENAME
27*4882a593Smuzhiyun
28*4882a593Smuzhiyun #define ADDRESS_NAME_LEN 18
29*4882a593Smuzhiyun
30*4882a593Smuzhiyun #define ROM_PROBE_STEP_SIZE (64*1024)
31*4882a593Smuzhiyun
32*4882a593Smuzhiyun #define DEV_CK804 1
33*4882a593Smuzhiyun #define DEV_MCP55 2
34*4882a593Smuzhiyun
35*4882a593Smuzhiyun struct ck804xrom_window {
36*4882a593Smuzhiyun void __iomem *virt;
37*4882a593Smuzhiyun unsigned long phys;
38*4882a593Smuzhiyun unsigned long size;
39*4882a593Smuzhiyun struct list_head maps;
40*4882a593Smuzhiyun struct resource rsrc;
41*4882a593Smuzhiyun struct pci_dev *pdev;
42*4882a593Smuzhiyun };
43*4882a593Smuzhiyun
44*4882a593Smuzhiyun struct ck804xrom_map_info {
45*4882a593Smuzhiyun struct list_head list;
46*4882a593Smuzhiyun struct map_info map;
47*4882a593Smuzhiyun struct mtd_info *mtd;
48*4882a593Smuzhiyun struct resource rsrc;
49*4882a593Smuzhiyun char map_name[sizeof(MOD_NAME) + 2 + ADDRESS_NAME_LEN];
50*4882a593Smuzhiyun };
51*4882a593Smuzhiyun
52*4882a593Smuzhiyun /*
53*4882a593Smuzhiyun * The following applies to ck804 only:
54*4882a593Smuzhiyun * The 2 bits controlling the window size are often set to allow reading
55*4882a593Smuzhiyun * the BIOS, but too small to allow writing, since the lock registers are
56*4882a593Smuzhiyun * 4MiB lower in the address space than the data.
57*4882a593Smuzhiyun *
58*4882a593Smuzhiyun * This is intended to prevent flashing the bios, perhaps accidentally.
59*4882a593Smuzhiyun *
60*4882a593Smuzhiyun * This parameter allows the normal driver to override the BIOS settings.
61*4882a593Smuzhiyun *
62*4882a593Smuzhiyun * The bits are 6 and 7. If both bits are set, it is a 5MiB window.
63*4882a593Smuzhiyun * If only the 7 Bit is set, it is a 4MiB window. Otherwise, a
64*4882a593Smuzhiyun * 64KiB window.
65*4882a593Smuzhiyun *
66*4882a593Smuzhiyun * The following applies to mcp55 only:
67*4882a593Smuzhiyun * The 15 bits controlling the window size are distributed as follows:
68*4882a593Smuzhiyun * byte @0x88: bit 0..7
69*4882a593Smuzhiyun * byte @0x8c: bit 8..15
70*4882a593Smuzhiyun * word @0x90: bit 16..30
71*4882a593Smuzhiyun * If all bits are enabled, we have a 16? MiB window
72*4882a593Smuzhiyun * Please set win_size_bits to 0x7fffffff if you actually want to do something
73*4882a593Smuzhiyun */
74*4882a593Smuzhiyun static uint win_size_bits = 0;
75*4882a593Smuzhiyun module_param(win_size_bits, uint, 0);
76*4882a593Smuzhiyun MODULE_PARM_DESC(win_size_bits, "ROM window size bits override, normally set by BIOS.");
77*4882a593Smuzhiyun
78*4882a593Smuzhiyun static struct ck804xrom_window ck804xrom_window = {
79*4882a593Smuzhiyun .maps = LIST_HEAD_INIT(ck804xrom_window.maps),
80*4882a593Smuzhiyun };
81*4882a593Smuzhiyun
ck804xrom_cleanup(struct ck804xrom_window * window)82*4882a593Smuzhiyun static void ck804xrom_cleanup(struct ck804xrom_window *window)
83*4882a593Smuzhiyun {
84*4882a593Smuzhiyun struct ck804xrom_map_info *map, *scratch;
85*4882a593Smuzhiyun u8 byte;
86*4882a593Smuzhiyun
87*4882a593Smuzhiyun if (window->pdev) {
88*4882a593Smuzhiyun /* Disable writes through the rom window */
89*4882a593Smuzhiyun pci_read_config_byte(window->pdev, 0x6d, &byte);
90*4882a593Smuzhiyun pci_write_config_byte(window->pdev, 0x6d, byte & ~1);
91*4882a593Smuzhiyun }
92*4882a593Smuzhiyun
93*4882a593Smuzhiyun /* Free all of the mtd devices */
94*4882a593Smuzhiyun list_for_each_entry_safe(map, scratch, &window->maps, list) {
95*4882a593Smuzhiyun if (map->rsrc.parent)
96*4882a593Smuzhiyun release_resource(&map->rsrc);
97*4882a593Smuzhiyun
98*4882a593Smuzhiyun mtd_device_unregister(map->mtd);
99*4882a593Smuzhiyun map_destroy(map->mtd);
100*4882a593Smuzhiyun list_del(&map->list);
101*4882a593Smuzhiyun kfree(map);
102*4882a593Smuzhiyun }
103*4882a593Smuzhiyun if (window->rsrc.parent)
104*4882a593Smuzhiyun release_resource(&window->rsrc);
105*4882a593Smuzhiyun
106*4882a593Smuzhiyun if (window->virt) {
107*4882a593Smuzhiyun iounmap(window->virt);
108*4882a593Smuzhiyun window->virt = NULL;
109*4882a593Smuzhiyun window->phys = 0;
110*4882a593Smuzhiyun window->size = 0;
111*4882a593Smuzhiyun }
112*4882a593Smuzhiyun pci_dev_put(window->pdev);
113*4882a593Smuzhiyun }
114*4882a593Smuzhiyun
115*4882a593Smuzhiyun
ck804xrom_init_one(struct pci_dev * pdev,const struct pci_device_id * ent)116*4882a593Smuzhiyun static int __init ck804xrom_init_one(struct pci_dev *pdev,
117*4882a593Smuzhiyun const struct pci_device_id *ent)
118*4882a593Smuzhiyun {
119*4882a593Smuzhiyun static char *rom_probe_types[] = { "cfi_probe", "jedec_probe", NULL };
120*4882a593Smuzhiyun u8 byte;
121*4882a593Smuzhiyun u16 word;
122*4882a593Smuzhiyun struct ck804xrom_window *window = &ck804xrom_window;
123*4882a593Smuzhiyun struct ck804xrom_map_info *map = NULL;
124*4882a593Smuzhiyun unsigned long map_top;
125*4882a593Smuzhiyun
126*4882a593Smuzhiyun /* Remember the pci dev I find the window in */
127*4882a593Smuzhiyun window->pdev = pci_dev_get(pdev);
128*4882a593Smuzhiyun
129*4882a593Smuzhiyun switch (ent->driver_data) {
130*4882a593Smuzhiyun case DEV_CK804:
131*4882a593Smuzhiyun /* Enable the selected rom window. This is often incorrectly
132*4882a593Smuzhiyun * set up by the BIOS, and the 4MiB offset for the lock registers
133*4882a593Smuzhiyun * requires the full 5MiB of window space.
134*4882a593Smuzhiyun *
135*4882a593Smuzhiyun * This 'write, then read' approach leaves the bits for
136*4882a593Smuzhiyun * other uses of the hardware info.
137*4882a593Smuzhiyun */
138*4882a593Smuzhiyun pci_read_config_byte(pdev, 0x88, &byte);
139*4882a593Smuzhiyun pci_write_config_byte(pdev, 0x88, byte | win_size_bits );
140*4882a593Smuzhiyun
141*4882a593Smuzhiyun /* Assume the rom window is properly setup, and find it's size */
142*4882a593Smuzhiyun pci_read_config_byte(pdev, 0x88, &byte);
143*4882a593Smuzhiyun
144*4882a593Smuzhiyun if ((byte & ((1<<7)|(1<<6))) == ((1<<7)|(1<<6)))
145*4882a593Smuzhiyun window->phys = 0xffb00000; /* 5MiB */
146*4882a593Smuzhiyun else if ((byte & (1<<7)) == (1<<7))
147*4882a593Smuzhiyun window->phys = 0xffc00000; /* 4MiB */
148*4882a593Smuzhiyun else
149*4882a593Smuzhiyun window->phys = 0xffff0000; /* 64KiB */
150*4882a593Smuzhiyun break;
151*4882a593Smuzhiyun
152*4882a593Smuzhiyun case DEV_MCP55:
153*4882a593Smuzhiyun pci_read_config_byte(pdev, 0x88, &byte);
154*4882a593Smuzhiyun pci_write_config_byte(pdev, 0x88, byte | (win_size_bits & 0xff));
155*4882a593Smuzhiyun
156*4882a593Smuzhiyun pci_read_config_byte(pdev, 0x8c, &byte);
157*4882a593Smuzhiyun pci_write_config_byte(pdev, 0x8c, byte | ((win_size_bits & 0xff00) >> 8));
158*4882a593Smuzhiyun
159*4882a593Smuzhiyun pci_read_config_word(pdev, 0x90, &word);
160*4882a593Smuzhiyun pci_write_config_word(pdev, 0x90, word | ((win_size_bits & 0x7fff0000) >> 16));
161*4882a593Smuzhiyun
162*4882a593Smuzhiyun window->phys = 0xff000000; /* 16MiB, hardcoded for now */
163*4882a593Smuzhiyun break;
164*4882a593Smuzhiyun }
165*4882a593Smuzhiyun
166*4882a593Smuzhiyun window->size = 0xffffffffUL - window->phys + 1UL;
167*4882a593Smuzhiyun
168*4882a593Smuzhiyun /*
169*4882a593Smuzhiyun * Try to reserve the window mem region. If this fails then
170*4882a593Smuzhiyun * it is likely due to a fragment of the window being
171*4882a593Smuzhiyun * "reserved" by the BIOS. In the case that the
172*4882a593Smuzhiyun * request_mem_region() fails then once the rom size is
173*4882a593Smuzhiyun * discovered we will try to reserve the unreserved fragment.
174*4882a593Smuzhiyun */
175*4882a593Smuzhiyun window->rsrc.name = MOD_NAME;
176*4882a593Smuzhiyun window->rsrc.start = window->phys;
177*4882a593Smuzhiyun window->rsrc.end = window->phys + window->size - 1;
178*4882a593Smuzhiyun window->rsrc.flags = IORESOURCE_MEM | IORESOURCE_BUSY;
179*4882a593Smuzhiyun if (request_resource(&iomem_resource, &window->rsrc)) {
180*4882a593Smuzhiyun window->rsrc.parent = NULL;
181*4882a593Smuzhiyun printk(KERN_ERR MOD_NAME
182*4882a593Smuzhiyun " %s(): Unable to register resource %pR - kernel bug?\n",
183*4882a593Smuzhiyun __func__, &window->rsrc);
184*4882a593Smuzhiyun }
185*4882a593Smuzhiyun
186*4882a593Smuzhiyun
187*4882a593Smuzhiyun /* Enable writes through the rom window */
188*4882a593Smuzhiyun pci_read_config_byte(pdev, 0x6d, &byte);
189*4882a593Smuzhiyun pci_write_config_byte(pdev, 0x6d, byte | 1);
190*4882a593Smuzhiyun
191*4882a593Smuzhiyun /* FIXME handle registers 0x80 - 0x8C the bios region locks */
192*4882a593Smuzhiyun
193*4882a593Smuzhiyun /* For write accesses caches are useless */
194*4882a593Smuzhiyun window->virt = ioremap(window->phys, window->size);
195*4882a593Smuzhiyun if (!window->virt) {
196*4882a593Smuzhiyun printk(KERN_ERR MOD_NAME ": ioremap(%08lx, %08lx) failed\n",
197*4882a593Smuzhiyun window->phys, window->size);
198*4882a593Smuzhiyun goto out;
199*4882a593Smuzhiyun }
200*4882a593Smuzhiyun
201*4882a593Smuzhiyun /* Get the first address to look for a rom chip at */
202*4882a593Smuzhiyun map_top = window->phys;
203*4882a593Smuzhiyun #if 1
204*4882a593Smuzhiyun /* The probe sequence run over the firmware hub lock
205*4882a593Smuzhiyun * registers sets them to 0x7 (no access).
206*4882a593Smuzhiyun * Probe at most the last 4MiB of the address space.
207*4882a593Smuzhiyun */
208*4882a593Smuzhiyun if (map_top < 0xffc00000)
209*4882a593Smuzhiyun map_top = 0xffc00000;
210*4882a593Smuzhiyun #endif
211*4882a593Smuzhiyun /* Loop through and look for rom chips. Since we don't know the
212*4882a593Smuzhiyun * starting address for each chip, probe every ROM_PROBE_STEP_SIZE
213*4882a593Smuzhiyun * bytes from the starting address of the window.
214*4882a593Smuzhiyun */
215*4882a593Smuzhiyun while((map_top - 1) < 0xffffffffUL) {
216*4882a593Smuzhiyun struct cfi_private *cfi;
217*4882a593Smuzhiyun unsigned long offset;
218*4882a593Smuzhiyun int i;
219*4882a593Smuzhiyun
220*4882a593Smuzhiyun if (!map)
221*4882a593Smuzhiyun map = kmalloc(sizeof(*map), GFP_KERNEL);
222*4882a593Smuzhiyun
223*4882a593Smuzhiyun if (!map) {
224*4882a593Smuzhiyun printk(KERN_ERR MOD_NAME ": kmalloc failed");
225*4882a593Smuzhiyun goto out;
226*4882a593Smuzhiyun }
227*4882a593Smuzhiyun memset(map, 0, sizeof(*map));
228*4882a593Smuzhiyun INIT_LIST_HEAD(&map->list);
229*4882a593Smuzhiyun map->map.name = map->map_name;
230*4882a593Smuzhiyun map->map.phys = map_top;
231*4882a593Smuzhiyun offset = map_top - window->phys;
232*4882a593Smuzhiyun map->map.virt = (void __iomem *)
233*4882a593Smuzhiyun (((unsigned long)(window->virt)) + offset);
234*4882a593Smuzhiyun map->map.size = 0xffffffffUL - map_top + 1UL;
235*4882a593Smuzhiyun /* Set the name of the map to the address I am trying */
236*4882a593Smuzhiyun sprintf(map->map_name, "%s @%08Lx",
237*4882a593Smuzhiyun MOD_NAME, (unsigned long long)map->map.phys);
238*4882a593Smuzhiyun
239*4882a593Smuzhiyun /* There is no generic VPP support */
240*4882a593Smuzhiyun for(map->map.bankwidth = 32; map->map.bankwidth;
241*4882a593Smuzhiyun map->map.bankwidth >>= 1)
242*4882a593Smuzhiyun {
243*4882a593Smuzhiyun char **probe_type;
244*4882a593Smuzhiyun /* Skip bankwidths that are not supported */
245*4882a593Smuzhiyun if (!map_bankwidth_supported(map->map.bankwidth))
246*4882a593Smuzhiyun continue;
247*4882a593Smuzhiyun
248*4882a593Smuzhiyun /* Setup the map methods */
249*4882a593Smuzhiyun simple_map_init(&map->map);
250*4882a593Smuzhiyun
251*4882a593Smuzhiyun /* Try all of the probe methods */
252*4882a593Smuzhiyun probe_type = rom_probe_types;
253*4882a593Smuzhiyun for(; *probe_type; probe_type++) {
254*4882a593Smuzhiyun map->mtd = do_map_probe(*probe_type, &map->map);
255*4882a593Smuzhiyun if (map->mtd)
256*4882a593Smuzhiyun goto found;
257*4882a593Smuzhiyun }
258*4882a593Smuzhiyun }
259*4882a593Smuzhiyun map_top += ROM_PROBE_STEP_SIZE;
260*4882a593Smuzhiyun continue;
261*4882a593Smuzhiyun found:
262*4882a593Smuzhiyun /* Trim the size if we are larger than the map */
263*4882a593Smuzhiyun if (map->mtd->size > map->map.size) {
264*4882a593Smuzhiyun printk(KERN_WARNING MOD_NAME
265*4882a593Smuzhiyun " rom(%llu) larger than window(%lu). fixing...\n",
266*4882a593Smuzhiyun (unsigned long long)map->mtd->size, map->map.size);
267*4882a593Smuzhiyun map->mtd->size = map->map.size;
268*4882a593Smuzhiyun }
269*4882a593Smuzhiyun if (window->rsrc.parent) {
270*4882a593Smuzhiyun /*
271*4882a593Smuzhiyun * Registering the MTD device in iomem may not be possible
272*4882a593Smuzhiyun * if there is a BIOS "reserved" and BUSY range. If this
273*4882a593Smuzhiyun * fails then continue anyway.
274*4882a593Smuzhiyun */
275*4882a593Smuzhiyun map->rsrc.name = map->map_name;
276*4882a593Smuzhiyun map->rsrc.start = map->map.phys;
277*4882a593Smuzhiyun map->rsrc.end = map->map.phys + map->mtd->size - 1;
278*4882a593Smuzhiyun map->rsrc.flags = IORESOURCE_MEM | IORESOURCE_BUSY;
279*4882a593Smuzhiyun if (request_resource(&window->rsrc, &map->rsrc)) {
280*4882a593Smuzhiyun printk(KERN_ERR MOD_NAME
281*4882a593Smuzhiyun ": cannot reserve MTD resource\n");
282*4882a593Smuzhiyun map->rsrc.parent = NULL;
283*4882a593Smuzhiyun }
284*4882a593Smuzhiyun }
285*4882a593Smuzhiyun
286*4882a593Smuzhiyun /* Make the whole region visible in the map */
287*4882a593Smuzhiyun map->map.virt = window->virt;
288*4882a593Smuzhiyun map->map.phys = window->phys;
289*4882a593Smuzhiyun cfi = map->map.fldrv_priv;
290*4882a593Smuzhiyun for(i = 0; i < cfi->numchips; i++)
291*4882a593Smuzhiyun cfi->chips[i].start += offset;
292*4882a593Smuzhiyun
293*4882a593Smuzhiyun /* Now that the mtd devices is complete claim and export it */
294*4882a593Smuzhiyun map->mtd->owner = THIS_MODULE;
295*4882a593Smuzhiyun if (mtd_device_register(map->mtd, NULL, 0)) {
296*4882a593Smuzhiyun map_destroy(map->mtd);
297*4882a593Smuzhiyun map->mtd = NULL;
298*4882a593Smuzhiyun goto out;
299*4882a593Smuzhiyun }
300*4882a593Smuzhiyun
301*4882a593Smuzhiyun
302*4882a593Smuzhiyun /* Calculate the new value of map_top */
303*4882a593Smuzhiyun map_top += map->mtd->size;
304*4882a593Smuzhiyun
305*4882a593Smuzhiyun /* File away the map structure */
306*4882a593Smuzhiyun list_add(&map->list, &window->maps);
307*4882a593Smuzhiyun map = NULL;
308*4882a593Smuzhiyun }
309*4882a593Smuzhiyun
310*4882a593Smuzhiyun out:
311*4882a593Smuzhiyun /* Free any left over map structures */
312*4882a593Smuzhiyun kfree(map);
313*4882a593Smuzhiyun
314*4882a593Smuzhiyun /* See if I have any map structures */
315*4882a593Smuzhiyun if (list_empty(&window->maps)) {
316*4882a593Smuzhiyun ck804xrom_cleanup(window);
317*4882a593Smuzhiyun return -ENODEV;
318*4882a593Smuzhiyun }
319*4882a593Smuzhiyun return 0;
320*4882a593Smuzhiyun }
321*4882a593Smuzhiyun
322*4882a593Smuzhiyun
ck804xrom_remove_one(struct pci_dev * pdev)323*4882a593Smuzhiyun static void ck804xrom_remove_one(struct pci_dev *pdev)
324*4882a593Smuzhiyun {
325*4882a593Smuzhiyun struct ck804xrom_window *window = &ck804xrom_window;
326*4882a593Smuzhiyun
327*4882a593Smuzhiyun ck804xrom_cleanup(window);
328*4882a593Smuzhiyun }
329*4882a593Smuzhiyun
330*4882a593Smuzhiyun static const struct pci_device_id ck804xrom_pci_tbl[] = {
331*4882a593Smuzhiyun { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0051), .driver_data = DEV_CK804 },
332*4882a593Smuzhiyun { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0360), .driver_data = DEV_MCP55 },
333*4882a593Smuzhiyun { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0361), .driver_data = DEV_MCP55 },
334*4882a593Smuzhiyun { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0362), .driver_data = DEV_MCP55 },
335*4882a593Smuzhiyun { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0363), .driver_data = DEV_MCP55 },
336*4882a593Smuzhiyun { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0364), .driver_data = DEV_MCP55 },
337*4882a593Smuzhiyun { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0365), .driver_data = DEV_MCP55 },
338*4882a593Smuzhiyun { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0366), .driver_data = DEV_MCP55 },
339*4882a593Smuzhiyun { PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, 0x0367), .driver_data = DEV_MCP55 },
340*4882a593Smuzhiyun { 0, }
341*4882a593Smuzhiyun };
342*4882a593Smuzhiyun
343*4882a593Smuzhiyun #if 0
344*4882a593Smuzhiyun MODULE_DEVICE_TABLE(pci, ck804xrom_pci_tbl);
345*4882a593Smuzhiyun
346*4882a593Smuzhiyun static struct pci_driver ck804xrom_driver = {
347*4882a593Smuzhiyun .name = MOD_NAME,
348*4882a593Smuzhiyun .id_table = ck804xrom_pci_tbl,
349*4882a593Smuzhiyun .probe = ck804xrom_init_one,
350*4882a593Smuzhiyun .remove = ck804xrom_remove_one,
351*4882a593Smuzhiyun };
352*4882a593Smuzhiyun #endif
353*4882a593Smuzhiyun
init_ck804xrom(void)354*4882a593Smuzhiyun static int __init init_ck804xrom(void)
355*4882a593Smuzhiyun {
356*4882a593Smuzhiyun struct pci_dev *pdev;
357*4882a593Smuzhiyun const struct pci_device_id *id;
358*4882a593Smuzhiyun int retVal;
359*4882a593Smuzhiyun pdev = NULL;
360*4882a593Smuzhiyun
361*4882a593Smuzhiyun for(id = ck804xrom_pci_tbl; id->vendor; id++) {
362*4882a593Smuzhiyun pdev = pci_get_device(id->vendor, id->device, NULL);
363*4882a593Smuzhiyun if (pdev)
364*4882a593Smuzhiyun break;
365*4882a593Smuzhiyun }
366*4882a593Smuzhiyun if (pdev) {
367*4882a593Smuzhiyun retVal = ck804xrom_init_one(pdev, id);
368*4882a593Smuzhiyun pci_dev_put(pdev);
369*4882a593Smuzhiyun return retVal;
370*4882a593Smuzhiyun }
371*4882a593Smuzhiyun return -ENXIO;
372*4882a593Smuzhiyun #if 0
373*4882a593Smuzhiyun return pci_register_driver(&ck804xrom_driver);
374*4882a593Smuzhiyun #endif
375*4882a593Smuzhiyun }
376*4882a593Smuzhiyun
cleanup_ck804xrom(void)377*4882a593Smuzhiyun static void __exit cleanup_ck804xrom(void)
378*4882a593Smuzhiyun {
379*4882a593Smuzhiyun ck804xrom_remove_one(ck804xrom_window.pdev);
380*4882a593Smuzhiyun }
381*4882a593Smuzhiyun
382*4882a593Smuzhiyun module_init(init_ck804xrom);
383*4882a593Smuzhiyun module_exit(cleanup_ck804xrom);
384*4882a593Smuzhiyun
385*4882a593Smuzhiyun MODULE_LICENSE("GPL");
386*4882a593Smuzhiyun MODULE_AUTHOR("Eric Biederman <ebiederman@lnxi.com>, Dave Olsen <dolsen@lnxi.com>");
387*4882a593Smuzhiyun MODULE_DESCRIPTION("MTD map driver for BIOS chips on the Nvidia ck804 southbridge");
388*4882a593Smuzhiyun
389