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

// SPDX-License-Identifier: GPL-2.0-only
/*
 * Copyright (C) 2010-2012 Stephane Grosjean <[email protected]>
 *
 * CAN driver for PEAK-System PCAN-PC Card
 * Derived from the PCAN project file driver/src/pcan_pccard.c
 * Copyright (C) 2006-2010 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/timer.h>
#include <linux/io.h>
#include <pcmcia/cistpl.h>
#include <pcmcia/ds.h>
#include <linux/can.h>
#include <linux/can/dev.h>
#include "sja1000.h"

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

/* PEAK-System PCMCIA driver name */
#define PCC_NAME

#define PCC_CHAN_MAX

#define PCC_CAN_CLOCK

#define PCC_MANF_ID
#define PCC_CARD_ID

#define PCC_CHAN_SIZE
#define PCC_CHAN_OFF(c)
#define PCC_COMN_OFF
#define PCC_COMN_SIZE

/* common area registers */
#define PCC_CCR
#define PCC_CSR
#define PCC_CPR
#define PCC_SPI_DIR
#define PCC_SPI_DOR
#define PCC_SPI_ADR
#define PCC_SPI_IR
#define PCC_FW_MAJOR
#define PCC_FW_MINOR

/* CCR bits */
#define PCC_CCR_CLK_16
#define PCC_CCR_CLK_10
#define PCC_CCR_CLK_21
#define PCC_CCR_CLK_8
#define PCC_CCR_CLK_MASK

#define PCC_CCR_RST_CHAN(c)
#define PCC_CCR_RST_ALL
#define PCC_CCR_RST_MASK

/* led selection bits */
#define PCC_LED(c)
#define PCC_LED_ALL

/* led state value */
#define PCC_LED_ON
#define PCC_LED_FAST
#define PCC_LED_SLOW
#define PCC_LED_OFF

#define PCC_CCR_LED_CHAN(s, c)

#define PCC_CCR_LED_ON_CHAN(c)
#define PCC_CCR_LED_FAST_CHAN(c)
#define PCC_CCR_LED_SLOW_CHAN(c)
#define PCC_CCR_LED_OFF_CHAN(c)
#define PCC_CCR_LED_MASK_CHAN(c)
#define PCC_CCR_LED_OFF_ALL
#define PCC_CCR_LED_MASK

#define PCC_CCR_INIT

/* CSR bits */
#define PCC_CSR_SPI_BUSY

/* time waiting for SPI busy (prevent from infinite loop) */
#define PCC_SPI_MAX_BUSY_WAIT_MS

/* max count of reading the SPI status register waiting for a change */
/* (prevent from infinite loop) */
#define PCC_WRITE_MAX_LOOP

/* max nb of int handled by that isr in one shot (prevent from infinite loop) */
#define PCC_ISR_MAX_LOOP

/* EEPROM chip instruction set */
/* note: EEPROM Read/Write instructions include A8 bit */
#define PCC_EEP_WRITE(a)
#define PCC_EEP_READ(a)
#define PCC_EEP_WRDI
#define PCC_EEP_RDSR
#define PCC_EEP_WREN

/* EEPROM Status Register bits */
#define PCC_EEP_SR_WEN
#define PCC_EEP_SR_WIP

/*
 * The board configuration is probably following:
 * RX1 is connected to ground.
 * TX1 is not connected.
 * CLKO is not connected.
 * Setting the OCR register to 0xDA is a good idea.
 * This means normal output mode, push-pull and the correct polarity.
 */
#define PCC_OCR

/*
 * In the CDR register, you should set CBP to 1.
 * You will probably also want to set the clock divider value to 7
 * (meaning direct oscillator output) because the second SJA1000 chip
 * is driven by the first one CLKOUT output.
 */
#define PCC_CDR

struct pcan_channel {};

/* PCAN-PC Card private structure */
struct pcan_pccard {};

static struct pcmcia_device_id pcan_table[] =;

MODULE_DEVICE_TABLE(pcmcia, pcan_table);

static void pcan_set_leds(struct pcan_pccard *card, u8 mask, u8 state);

/*
 * start timer which controls leds state
 */
static void pcan_start_led_timer(struct pcan_pccard *card)
{}

/*
 * stop the timer which controls leds state
 */
static void pcan_stop_led_timer(struct pcan_pccard *card)
{}

/*
 * read a sja1000 register
 */
static u8 pcan_read_canreg(const struct sja1000_priv *priv, int port)
{}

/*
 * write a sja1000 register
 */
static void pcan_write_canreg(const struct sja1000_priv *priv, int port, u8 v)
{}

/*
 * read a register from the common area
 */
static u8 pcan_read_reg(struct pcan_pccard *card, int port)
{}

/*
 * write a register into the common area
 */
static void pcan_write_reg(struct pcan_pccard *card, int port, u8 v)
{}

/*
 * check whether the card is present by checking its fw version numbers
 * against values read at probing time.
 */
static inline int pcan_pccard_present(struct pcan_pccard *card)
{}

/*
 * wait for SPI engine while it is busy
 */
static int pcan_wait_spi_busy(struct pcan_pccard *card)
{}

/*
 * write data in device eeprom
 */
static int pcan_write_eeprom(struct pcan_pccard *card, u16 addr, u8 v)
{}

static void pcan_set_leds(struct pcan_pccard *card, u8 led_mask, u8 state)
{}

/*
 * enable/disable CAN connectors power
 */
static inline void pcan_set_can_power(struct pcan_pccard *card, int onoff)
{}

/*
 * set leds state according to channel activity
 */
static void pcan_led_timer(struct timer_list *t)
{}

/*
 * interrupt service routine
 */
static irqreturn_t pcan_isr(int irq, void *dev_id)
{}

/*
 * free all resources used by the channels and switch off leds and can power
 */
static void pcan_free_channels(struct pcan_pccard *card)
{}

/*
 * check if a CAN controller is present at the specified location
 */
static inline int pcan_channel_present(struct sja1000_priv *priv)
{}

static int pcan_add_channels(struct pcan_pccard *card)
{}

static int pcan_conf_check(struct pcmcia_device *pdev, void *priv_data)
{}

/*
 * free all resources used by the device
 */
static void pcan_free(struct pcmcia_device *pdev)
{}

/*
 * setup PCMCIA socket and probe for PEAK-System PC-CARD
 */
static int pcan_probe(struct pcmcia_device *pdev)
{}

/*
 * release claimed resources
 */
static void pcan_remove(struct pcmcia_device *pdev)
{}

static struct pcmcia_driver pcan_driver =;
module_pcmcia_driver();