Lines Matching +full:per +full:- +full:board

1 // SPDX-License-Identifier: GPL-2.0-only
3 * Copyright (C) 2008 Per Dalen <per.dalen@cnw.se>
7 * - Kvaser linux driver, version 4.72 BETA
8 * Copyright (C) 2002-2007 KVASER AB
10 * - Lincan driver, version 0.3.3, OCERA project
14 * - Socketcan SJA1000 drivers
16 * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
34 MODULE_AUTHOR("Per Dalen <per.dalen@cnw.se>");
35 MODULE_DESCRIPTION("Socket-CAN driver for KVASER PCAN PCI cards");
44 struct net_device *slave_dev[MAX_NO_OF_CHANNELS-1];
54 * The board configuration is probably following:
59 * This means normal output mode , push-pull and the correct polarity.
66 * (meaning divide-by-2), the Pelican bit, and the clock-off bit
89 #define PCI_CONFIG_PORT_SIZE 0x80 /* size of the config io-memory */
90 #define PCI_PORT_SIZE 0x80 /* size of a channel io-memory */
91 #define PCI_PORT_XILINX_SIZE 0x08 /* size of a xilinx io-memory */
109 return ioread8(priv->reg_base + port); in kvaser_pci_read_reg()
115 iowrite8(val, priv->reg_base + port); in kvaser_pci_write_reg()
121 struct kvaser_pci *board = priv->priv; in kvaser_pci_disable_irq() local
125 intcsr = ioread32(board->conf_addr + S5920_INTCSR); in kvaser_pci_disable_irq()
127 iowrite32(intcsr, board->conf_addr + S5920_INTCSR); in kvaser_pci_disable_irq()
133 struct kvaser_pci *board = priv->priv; in kvaser_pci_enable_irq() local
137 tmp_en_io = ioread32(board->conf_addr + S5920_INTCSR); in kvaser_pci_enable_irq()
139 iowrite32(tmp_en_io, board->conf_addr + S5920_INTCSR); in kvaser_pci_enable_irq()
164 struct kvaser_pci *board; in kvaser_pci_del_chan() local
170 board = priv->priv; in kvaser_pci_del_chan()
171 if (!board) in kvaser_pci_del_chan()
174 dev_info(&board->pci_dev->dev, "Removing device %s\n", in kvaser_pci_del_chan()
175 dev->name); in kvaser_pci_del_chan()
180 for (i = 0; i < board->no_channels - 1; i++) { in kvaser_pci_del_chan()
181 if (board->slave_dev[i]) { in kvaser_pci_del_chan()
182 dev_info(&board->pci_dev->dev, "Removing device %s\n", in kvaser_pci_del_chan()
183 board->slave_dev[i]->name); in kvaser_pci_del_chan()
184 unregister_sja1000dev(board->slave_dev[i]); in kvaser_pci_del_chan()
185 free_sja1000dev(board->slave_dev[i]); in kvaser_pci_del_chan()
190 pci_iounmap(board->pci_dev, priv->reg_base); in kvaser_pci_del_chan()
191 pci_iounmap(board->pci_dev, board->conf_addr); in kvaser_pci_del_chan()
192 pci_iounmap(board->pci_dev, board->res_addr); in kvaser_pci_del_chan()
205 struct kvaser_pci *board; in kvaser_pci_add_chan() local
210 return -ENOMEM; in kvaser_pci_add_chan()
213 board = priv->priv; in kvaser_pci_add_chan()
215 board->pci_dev = pdev; in kvaser_pci_add_chan()
216 board->channel = channel; in kvaser_pci_add_chan()
219 board->conf_addr = conf_addr; in kvaser_pci_add_chan()
221 /* XILINX board wide address */ in kvaser_pci_add_chan()
222 board->res_addr = res_addr; in kvaser_pci_add_chan()
225 board->xilinx_ver = in kvaser_pci_add_chan()
226 ioread8(board->res_addr + XILINX_VERINT) >> 4; in kvaser_pci_add_chan()
228 /* Assert PTADR# - we're in passive mode so the other bits are in kvaser_pci_add_chan()
230 iowrite32(0x80808080UL, board->conf_addr + S5920_PTCR); in kvaser_pci_add_chan()
236 struct kvaser_pci *master_board = master_priv->priv; in kvaser_pci_add_chan()
237 master_board->slave_dev[channel - 1] = dev; in kvaser_pci_add_chan()
238 master_board->no_channels = channel + 1; in kvaser_pci_add_chan()
239 board->xilinx_ver = master_board->xilinx_ver; in kvaser_pci_add_chan()
242 priv->reg_base = base_addr + channel * KVASER_PCI_PORT_BYTES; in kvaser_pci_add_chan()
244 priv->read_reg = kvaser_pci_read_reg; in kvaser_pci_add_chan()
245 priv->write_reg = kvaser_pci_write_reg; in kvaser_pci_add_chan()
247 priv->can.clock.freq = KVASER_PCI_CAN_CLOCK; in kvaser_pci_add_chan()
249 priv->ocr = KVASER_PCI_OCR; in kvaser_pci_add_chan()
250 priv->cdr = KVASER_PCI_CDR; in kvaser_pci_add_chan()
252 priv->irq_flags = IRQF_SHARED; in kvaser_pci_add_chan()
253 dev->irq = pdev->irq; in kvaser_pci_add_chan()
255 dev_info(&pdev->dev, "reg_base=%p conf_addr=%p irq=%d\n", in kvaser_pci_add_chan()
256 priv->reg_base, board->conf_addr, dev->irq); in kvaser_pci_add_chan()
258 SET_NETDEV_DEV(dev, &pdev->dev); in kvaser_pci_add_chan()
259 dev->dev_id = channel; in kvaser_pci_add_chan()
264 dev_err(&pdev->dev, "Registering device failed (err=%d)\n", in kvaser_pci_add_chan()
285 struct kvaser_pci *board; in kvaser_pci_init_one() local
292 dev_info(&pdev->dev, "initializing device %04x:%04x\n", in kvaser_pci_init_one()
293 pdev->vendor, pdev->device); in kvaser_pci_init_one()
306 err = -ENODEV; in kvaser_pci_init_one()
310 /* XILINX board wide address */ in kvaser_pci_init_one()
313 err = -ENOMEM; in kvaser_pci_init_one()
319 err = -ENOMEM; in kvaser_pci_init_one()
325 err = -ENOMEM; in kvaser_pci_init_one()
338 board = priv->priv; in kvaser_pci_init_one()
340 dev_info(&pdev->dev, "xilinx version=%d number of channels=%d\n", in kvaser_pci_init_one()
341 board->xilinx_ver, board->no_channels); in kvaser_pci_init_one()