linux/drivers/net/can/sja1000/sja1000.h

/*
 * sja1000.h -  Philips SJA1000 network device driver
 *
 * Copyright (c) 2003 Matthias Brukner, Trajet Gmbh, Rebenring 33,
 * 38106 Braunschweig, GERMANY
 *
 * Copyright (c) 2002-2007 Volkswagen Group Electronic Research
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. Neither the name of Volkswagen nor the names of its contributors
 *    may be used to endorse or promote products derived from this software
 *    without specific prior written permission.
 *
 * Alternatively, provided that this notice is retained in full, this
 * software may be distributed under the terms of the GNU General
 * Public License ("GPL") version 2, in which case the provisions of the
 * GPL apply INSTEAD OF those given above.
 *
 * The provided data structures and external interfaces from this code
 * are not restricted to be used by modules with a GPL compatible license.
 *
 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
 * DAMAGE.
 *
 */

#ifndef SJA1000_DEV_H
#define SJA1000_DEV_H

#include <linux/irqreturn.h>
#include <linux/can/dev.h>
#include <linux/can/platform/sja1000.h>

#define SJA1000_ECHO_SKB_MAX

#define SJA1000_MAX_IRQ

/* SJA1000 registers - manual section 6.4 (Pelican Mode) */
#define SJA1000_MOD
#define SJA1000_CMR
#define SJA1000_SR
#define SJA1000_IR
#define SJA1000_IER
#define SJA1000_ALC
#define SJA1000_ECC
#define SJA1000_EWL
#define SJA1000_RXERR
#define SJA1000_TXERR
#define SJA1000_ACCC0
#define SJA1000_ACCC1
#define SJA1000_ACCC2
#define SJA1000_ACCC3
#define SJA1000_ACCM0
#define SJA1000_ACCM1
#define SJA1000_ACCM2
#define SJA1000_ACCM3
#define SJA1000_RMC
#define SJA1000_RBSA

/* Common registers - manual section 6.5 */
#define SJA1000_BTR0
#define SJA1000_BTR1
#define SJA1000_OCR
#define SJA1000_CDR

#define SJA1000_FI
#define SJA1000_SFF_BUF
#define SJA1000_EFF_BUF

#define SJA1000_FI_FF
#define SJA1000_FI_RTR

#define SJA1000_ID1
#define SJA1000_ID2
#define SJA1000_ID3
#define SJA1000_ID4

#define SJA1000_CAN_RAM

/* mode register */
#define MOD_RM
#define MOD_LOM
#define MOD_STM
#define MOD_AFM
#define MOD_SM

/* commands */
#define CMD_SRR
#define CMD_CDO
#define CMD_RRB
#define CMD_AT
#define CMD_TR

/* interrupt sources */
#define IRQ_BEI
#define IRQ_ALI
#define IRQ_EPI
#define IRQ_WUI
#define IRQ_DOI
#define IRQ_EI
#define IRQ_TI
#define IRQ_RI
#define IRQ_ALL
#define IRQ_OFF

/* status register content */
#define SR_BS
#define SR_ES
#define SR_TS
#define SR_RS
#define SR_TCS
#define SR_TBS
#define SR_DOS
#define SR_RBS

#define SR_CRIT

/* ECC register */
#define ECC_SEG
#define ECC_DIR
#define ECC_ERR
#define ECC_BIT
#define ECC_FORM
#define ECC_STUFF
#define ECC_MASK

/*
 * Flags for sja1000priv.flags
 */
#define SJA1000_CUSTOM_IRQ_HANDLER
#define SJA1000_QUIRK_NO_CDR_REG
#define SJA1000_QUIRK_RESET_ON_OVERRUN

/*
 * SJA1000 private data structure
 */
struct sja1000_priv {};

struct net_device *alloc_sja1000dev(int sizeof_priv);
void free_sja1000dev(struct net_device *dev);
int register_sja1000dev(struct net_device *dev);
void unregister_sja1000dev(struct net_device *dev);

irqreturn_t sja1000_interrupt(int irq, void *dev_id);

#endif /* SJA1000_DEV_H */