13 #include <linux/kernel.h>
14 #include <linux/module.h>
15 #include <linux/netdevice.h>
16 #include <linux/pci.h>
48 static void c_can_pci_write_reg_aligned_to_16bit(
struct c_can_priv *
priv,
60 static void c_can_pci_write_reg_aligned_to_32bit(
struct c_can_priv *
priv,
77 dev_err(&pdev->
dev,
"pci_enable_device FAILED\n");
83 dev_err(&pdev->
dev,
"pci_request_regions FAILED\n");
84 goto out_disable_device;
93 "device has no PCI memory resources, "
96 goto out_release_regions;
107 pci_set_drvdata(pdev,
dev);
113 if (!c_can_pci_data->
freq) {
114 dev_err(&pdev->
dev,
"no clock frequency defined\n");
118 priv->can.clock.freq = c_can_pci_data->
freq;
122 switch (c_can_pci_data->
type) {
124 priv->regs = reg_map_c_can;
127 priv->regs = reg_map_d_can;
138 priv->read_reg = c_can_pci_read_reg_aligned_to_32bit;
139 priv->write_reg = c_can_pci_write_reg_aligned_to_32bit;
142 priv->read_reg = c_can_pci_read_reg_aligned_to_16bit;
143 priv->write_reg = c_can_pci_write_reg_aligned_to_16bit;
152 dev_err(&pdev->
dev,
"registering %s failed (err=%d)\n",
153 KBUILD_MODNAME,
ret);
157 dev_dbg(&pdev->
dev,
"%s device registered (regs=%p, irq=%d)\n",
158 KBUILD_MODNAME,
priv->regs,
dev->irq);
163 pci_set_drvdata(pdev,
NULL);
184 pci_set_drvdata(pdev,
NULL);
194 static struct c_can_pci_data c_can_sta2x11= {
200 #define C_CAN_ID(_vend, _dev, _driverdata) { \
201 PCI_DEVICE(_vend, _dev), \
202 .driver_data = (unsigned long)&_driverdata, \
210 .name = KBUILD_MODNAME,
211 .id_table = c_can_pci_tbl,
212 .probe = c_can_pci_probe,