linux/drivers/net/can/sja1000/peak_pci.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (C) 2007, 2011 Wolfgang Grandegger <[email protected]>
 * Copyright (C) 2012 Stephane Grosjean <[email protected]>
 *
 * Derived from the PCAN project file driver/src/pcan_pci.c:
 *
 * Copyright (C) 2001-2006  PEAK System-Technik GmbH
 */

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/interrupt.h>
#include <linux/netdevice.h>
#include <linux/delay.h>
#include <linux/pci.h>
#include <linux/io.h>
#include <linux/i2c.h>
#include <linux/i2c-algo-bit.h>
#include <linux/can.h>
#include <linux/can/dev.h>

#include "sja1000.h"

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_LICENSE();

#define DRV_NAME

/* FPGA cards FW version registers */
#define PEAK_VER_REG1
#define PEAK_VER_REG2

struct peak_pciec_card;
struct peak_pci_chan {};

#define PEAK_PCI_CAN_CLOCK

#define PEAK_PCI_CDR
#define PEAK_PCI_OCR

/* Important PITA registers */
#define PITA_ICR
#define PITA_GPIOICR
#define PITA_MISC

#define PEAK_PCI_CFG_SIZE
#define PEAK_PCI_CHAN_SIZE

#define PEAK_PCI_VENDOR_ID
#define PEAK_PCI_DEVICE_ID
#define PEAK_PCIEC_DEVICE_ID
#define PEAK_PCIE_DEVICE_ID
#define PEAK_CPCI_DEVICE_ID
#define PEAK_MPCI_DEVICE_ID
#define PEAK_PC_104P_DEVICE_ID
#define PEAK_PCI_104E_DEVICE_ID
#define PEAK_MPCIE_DEVICE_ID
#define PEAK_PCIE_OEM_ID
#define PEAK_PCIEC34_DEVICE_ID

#define PEAK_PCI_CHAN_MAX

static const u16 peak_pci_icr_masks[PEAK_PCI_CHAN_MAX] =;

static const struct pci_device_id peak_pci_tbl[] =;

MODULE_DEVICE_TABLE(pci, peak_pci_tbl);

#ifdef CONFIG_CAN_PEAK_PCIEC
/* PCAN-ExpressCard needs I2C bit-banging configuration option. */

/* GPIOICR byte access offsets */
#define PITA_GPOUT
#define PITA_GPIN
#define PITA_GPOEN

/* I2C GP bits */
#define PITA_GPIN_SCL
#define PITA_GPIN_SDA

#define PCA9553_1_SLAVEADDR

/* PCA9553 LS0 fields values */
enum {};

/* LEDs control */
#define PCA9553_ON
#define PCA9553_OFF
#define PCA9553_SLOW
#define PCA9553_FAST

#define PCA9553_LED(c)
#define PCA9553_LED_STATE(s, c)

#define PCA9553_LED_ON(c)
#define PCA9553_LED_OFF(c)
#define PCA9553_LED_SLOW(c)
#define PCA9553_LED_FAST(c)
#define PCA9553_LED_MASK(c)

#define PCA9553_LED_OFF_ALL

#define PCA9553_LS0_INIT

struct peak_pciec_chan {};

struct peak_pciec_card {};

/* "normal" pci register write callback is overloaded for leds control */
static void peak_pci_write_reg(const struct sja1000_priv *priv,
			       int port, u8 val);

static inline void pita_set_scl_highz(struct peak_pciec_card *card)
{}

static inline void pita_set_sda_highz(struct peak_pciec_card *card)
{}

static void peak_pciec_init_pita_gpio(struct peak_pciec_card *card)
{}

static void pita_setsda(void *data, int state)
{}

static void pita_setscl(void *data, int state)
{}

static int pita_getsda(void *data)
{}

static int pita_getscl(void *data)
{}

/* write commands to the LED chip though the I2C-bus of the PCAN-PCIeC */
static int peak_pciec_write_pca9553(struct peak_pciec_card *card,
				    u8 offset, u8 data)
{}

/* delayed work callback used to control the LEDs */
static void peak_pciec_led_work(struct work_struct *work)
{}

/* set LEDs blinking state */
static void peak_pciec_set_leds(struct peak_pciec_card *card, u8 led_mask, u8 s)
{}

/* start one second delayed work to control LEDs */
static void peak_pciec_start_led_work(struct peak_pciec_card *card)
{}

/* stop LEDs delayed work */
static void peak_pciec_stop_led_work(struct peak_pciec_card *card)
{}

/* initialize the PCA9553 4-bit I2C-bus LED chip */
static int peak_pciec_init_leds(struct peak_pciec_card *card)
{}

/* restore LEDs state to off peak_pciec_leds_exit */
static void peak_pciec_leds_exit(struct peak_pciec_card *card)
{}

/* normal write sja1000 register method overloaded to catch when controller
 * is started or stopped, to control leds
 */
static void peak_pciec_write_reg(const struct sja1000_priv *priv,
				 int port, u8 val)
{}

static const struct i2c_algo_bit_data peak_pciec_i2c_bit_ops =;

static int peak_pciec_probe(struct pci_dev *pdev, struct net_device *dev)
{}

static void peak_pciec_remove(struct peak_pciec_card *card)
{}

#else /* CONFIG_CAN_PEAK_PCIEC */

/* Placebo functions when PCAN-ExpressCard support is not selected */
static inline int peak_pciec_probe(struct pci_dev *pdev, struct net_device *dev)
{
	return -ENODEV;
}

static inline void peak_pciec_remove(struct peak_pciec_card *card)
{
}
#endif /* CONFIG_CAN_PEAK_PCIEC */

static u8 peak_pci_read_reg(const struct sja1000_priv *priv, int port)
{}

static void peak_pci_write_reg(const struct sja1000_priv *priv,
			       int port, u8 val)
{}

static void peak_pci_post_irq(const struct sja1000_priv *priv)
{}

static int peak_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
{}

static void peak_pci_remove(struct pci_dev *pdev)
{}

static struct pci_driver peak_pci_driver =;

module_pci_driver();