Lines Matching +full:mem +full:- +full:base

1 // SPDX-License-Identifier: GPL-2.0-only
9 * Bosch CC770 and Intel AN82527 CAN controllers on the ISA or PC-104 bus.
17 * insmod cc770_isa.ko mem=0xd1000,0xd1000 irq=7,11
32 * Note: for clk, cir, bcr and cor, the first argument re-defines the
35 * insmod cc770_isa.ko mem=0xd1000,0xd1000 irq=7,11 clk=24000000
39 * insmod cc770_isa.ko mem=0xd1000,0xd1000 irq=7,11 clk=24000000,24000000
61 MODULE_DESCRIPTION("Socket-CAN driver for CC770 on the ISA bus");
69 static unsigned long mem[MAXDEV]; variable
72 static u8 cir[MAXDEV] = {[0 ... (MAXDEV - 1)] = 0xff};
73 static u8 cor[MAXDEV] = {[0 ... (MAXDEV - 1)] = 0xff};
74 static u8 bcr[MAXDEV] = {[0 ... (MAXDEV - 1)] = 0xff};
75 static int indirect[MAXDEV] = {[0 ... (MAXDEV - 1)] = -1};
80 module_param_hw_array(mem, ulong, iomem, NULL, 0444);
81 MODULE_PARM_DESC(mem, "I/O memory address");
114 return readb(priv->reg_base + reg); in cc770_isa_mem_read_reg()
120 writeb(val, priv->reg_base + reg); in cc770_isa_mem_write_reg()
125 return inb((unsigned long)priv->reg_base + reg); in cc770_isa_port_read_reg()
131 outb(val, (unsigned long)priv->reg_base + reg); in cc770_isa_port_write_reg()
137 unsigned long base = (unsigned long)priv->reg_base; in cc770_isa_port_read_reg_indirect() local
142 outb(reg, base); in cc770_isa_port_read_reg_indirect()
143 val = inb(base + 1); in cc770_isa_port_read_reg_indirect()
152 unsigned long base = (unsigned long)priv->reg_base; in cc770_isa_port_write_reg_indirect() local
156 outb(reg, base); in cc770_isa_port_write_reg_indirect()
157 outb(val, base + 1); in cc770_isa_port_write_reg_indirect()
165 void __iomem *base = NULL; in cc770_isa_probe() local
167 int idx = pdev->id; in cc770_isa_probe()
171 dev_dbg(&pdev->dev, "probing idx=%d: port=%#lx, mem=%#lx, irq=%d\n", in cc770_isa_probe()
172 idx, port[idx], mem[idx], irq[idx]); in cc770_isa_probe()
173 if (mem[idx]) { in cc770_isa_probe()
174 if (!request_mem_region(mem[idx], iosize, KBUILD_MODNAME)) { in cc770_isa_probe()
175 err = -EBUSY; in cc770_isa_probe()
178 base = ioremap(mem[idx], iosize); in cc770_isa_probe()
179 if (!base) { in cc770_isa_probe()
180 err = -ENOMEM; in cc770_isa_probe()
185 (indirect[idx] == -1 && indirect[0] > 0)) in cc770_isa_probe()
188 err = -EBUSY; in cc770_isa_probe()
195 err = -ENOMEM; in cc770_isa_probe()
200 dev->irq = irq[idx]; in cc770_isa_probe()
201 priv->irq_flags = IRQF_SHARED; in cc770_isa_probe()
202 if (mem[idx]) { in cc770_isa_probe()
203 priv->reg_base = base; in cc770_isa_probe()
204 dev->base_addr = mem[idx]; in cc770_isa_probe()
205 priv->read_reg = cc770_isa_mem_read_reg; in cc770_isa_probe()
206 priv->write_reg = cc770_isa_mem_write_reg; in cc770_isa_probe()
208 priv->reg_base = (void __iomem *)port[idx]; in cc770_isa_probe()
209 dev->base_addr = port[idx]; in cc770_isa_probe()
212 priv->read_reg = cc770_isa_port_read_reg_indirect; in cc770_isa_probe()
213 priv->write_reg = cc770_isa_port_write_reg_indirect; in cc770_isa_probe()
215 priv->read_reg = cc770_isa_port_read_reg; in cc770_isa_probe()
216 priv->write_reg = cc770_isa_port_write_reg; in cc770_isa_probe()
226 priv->can.clock.freq = clktmp; in cc770_isa_probe()
229 priv->cpu_interface = cir[idx]; in cc770_isa_probe()
231 priv->cpu_interface = cir[0]; in cc770_isa_probe()
235 priv->cpu_interface |= CPUIF_DSC; in cc770_isa_probe()
240 priv->cpu_interface |= CPUIF_DMC; in cc770_isa_probe()
243 if (priv->cpu_interface & CPUIF_DSC) in cc770_isa_probe()
244 priv->can.clock.freq /= 2; in cc770_isa_probe()
247 priv->bus_config = bcr[idx]; in cc770_isa_probe()
249 priv->bus_config = bcr[0]; in cc770_isa_probe()
251 priv->bus_config = BCR_DEFAULT; in cc770_isa_probe()
254 priv->clkout = cor[idx]; in cc770_isa_probe()
256 priv->clkout = cor[0]; in cc770_isa_probe()
258 priv->clkout = COR_DEFAULT; in cc770_isa_probe()
261 SET_NETDEV_DEV(dev, &pdev->dev); in cc770_isa_probe()
265 dev_err(&pdev->dev, in cc770_isa_probe()
270 dev_info(&pdev->dev, "device registered (reg_base=0x%p, irq=%d)\n", in cc770_isa_probe()
271 priv->reg_base, dev->irq); in cc770_isa_probe()
277 if (mem[idx]) in cc770_isa_probe()
278 iounmap(base); in cc770_isa_probe()
280 if (mem[idx]) in cc770_isa_probe()
281 release_mem_region(mem[idx], iosize); in cc770_isa_probe()
292 int idx = pdev->id; in cc770_isa_remove()
296 if (mem[idx]) { in cc770_isa_remove()
297 iounmap(priv->reg_base); in cc770_isa_remove()
298 release_mem_region(mem[idx], CC770_IOSIZE); in cc770_isa_remove()
300 if (priv->read_reg == cc770_isa_port_read_reg_indirect) in cc770_isa_remove()
321 if ((port[idx] || mem[idx]) && irq[idx]) { in cc770_isa_init()
325 err = -ENOMEM; in cc770_isa_init()
333 pr_debug("platform device %d: port=%#lx, mem=%#lx, " in cc770_isa_init()
335 idx, port[idx], mem[idx], irq[idx]); in cc770_isa_init()
336 } else if (idx == 0 || port[idx] || mem[idx]) { in cc770_isa_init()
338 err = -EINVAL; in cc770_isa_init()
352 while (--idx >= 0) { in cc770_isa_init()