50 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
52 #include <linux/kernel.h>
53 #include <linux/module.h>
56 #include <linux/netdevice.h>
72 #define CLK_DEFAULT 16000000
73 #define COR_DEFAULT 0x00
74 #define BCR_DEFAULT BUSCFG_CBY
99 "(default=16000000 [16 MHz])");
110 #define CC770_IOSIZE 0x20
111 #define CC770_IOSIZE_INDIRECT 0x02
125 static void cc770_isa_mem_write_reg(
const struct cc770_priv *
priv,
136 static void cc770_isa_port_write_reg(
const struct cc770_priv *priv,
142 static u8 cc770_isa_port_read_reg_indirect(
const struct cc770_priv *priv,
152 spin_unlock_irqrestore(&cc770_isa_port_lock,
flags);
157 static void cc770_isa_port_write_reg_indirect(
const struct cc770_priv *priv,
166 spin_unlock_irqrestore(&cc770_isa_port_lock,
flags);
179 dev_dbg(&pdev->
dev,
"probing idx=%d: port=%#lx, mem=%#lx, irq=%d\n",
180 idx,
port[idx],
mem[idx], irq[idx]);
192 if (indirect[idx] > 0 ||
193 (indirect[idx] == -1 && indirect[0] > 0))
206 priv = netdev_priv(dev);
213 priv->
read_reg = cc770_isa_mem_read_reg;
214 priv->
write_reg = cc770_isa_mem_write_reg;
220 priv->
read_reg = cc770_isa_port_read_reg_indirect;
221 priv->
write_reg = cc770_isa_port_write_reg_indirect;
223 priv->
read_reg = cc770_isa_port_read_reg;
224 priv->
write_reg = cc770_isa_port_write_reg;
234 priv->
can.clock.freq = clktmp;
236 if (cir[idx] != 0xff) {
238 }
else if (cir[0] != 0xff) {
242 if (clktmp > 10000000) {
247 if (clktmp > 8000000)
252 priv->
can.clock.freq /= 2;
254 if (bcr[idx] != 0xff)
256 else if (bcr[0] != 0xff)
261 if (cor[idx] != 0xff)
263 else if (cor[0] != 0xff)
274 "couldn't register device (err=%d)\n", err);
278 dev_info(&pdev->
dev,
"device registered (reg_base=0x%p, irq=%d)\n",
307 if (priv->
read_reg == cc770_isa_port_read_reg_indirect)
318 .probe = cc770_isa_probe,
321 .name = KBUILD_MODNAME,
326 static int __init cc770_isa_init(
void)
330 for (idx = 0; idx <
ARRAY_SIZE(cc770_isa_devs); idx++) {
332 cc770_isa_devs[
idx] =
334 if (!cc770_isa_devs[idx]) {
336 goto exit_free_devices;
341 goto exit_free_devices;
343 pr_debug(
"platform device %d: port=%#lx, mem=%#lx, "
345 idx,
port[idx],
mem[idx], irq[idx]);
346 }
else if (idx == 0 ||
port[idx] ||
mem[idx]) {
347 pr_err(
"insufficient parameters supplied\n");
349 goto exit_free_devices;
355 goto exit_free_devices;
363 if (cc770_isa_devs[idx])
371 static void __exit cc770_isa_exit(
void)
376 for (idx = 0; idx <
ARRAY_SIZE(cc770_isa_devs); idx++) {
377 if (cc770_isa_devs[idx])