linux/drivers/i2c/busses/i2c-at91.h

/* SPDX-License-Identifier: GPL-2.0 */
/*
 *  i2c Support for Atmel's AT91 Two-Wire Interface (TWI)
 *
 *  Copyright (C) 2011 Weinmann Medical GmbH
 *  Author: Nikolaus Voss <[email protected]>
 *
 *  Evolved from original work by:
 *  Copyright (C) 2004 Rick Bronson
 *  Converted to 2.6 by Andrew Victor <[email protected]>
 *
 *  Borrowed heavily from original work by:
 *  Copyright (C) 2000 Philip Edelbrock <[email protected]>
 */

#include <linux/clk.h>
#include <linux/completion.h>
#include <linux/dma-mapping.h>
#include <linux/dmaengine.h>
#include <linux/i2c.h>
#include <linux/platform_device.h>

#define AT91_I2C_TIMEOUT
#define AT91_I2C_DMA_THRESHOLD
#define AUTOSUSPEND_TIMEOUT
#define AT91_I2C_MAX_ALT_CMD_DATA_SIZE

/* AT91 TWI register definitions */
#define AT91_TWI_CR
#define AT91_TWI_START
#define AT91_TWI_STOP
#define AT91_TWI_MSEN
#define AT91_TWI_MSDIS
#define AT91_TWI_SVEN
#define AT91_TWI_SVDIS
#define AT91_TWI_QUICK
#define AT91_TWI_SWRST
#define AT91_TWI_CLEAR
#define AT91_TWI_ACMEN
#define AT91_TWI_ACMDIS
#define AT91_TWI_THRCLR
#define AT91_TWI_RHRCLR
#define AT91_TWI_LOCKCLR
#define AT91_TWI_FIFOEN
#define AT91_TWI_FIFODIS

#define AT91_TWI_MMR
#define AT91_TWI_IADRSZ_1
#define AT91_TWI_MREAD

#define AT91_TWI_SMR
#define AT91_TWI_SMR_SADR_MAX
#define AT91_TWI_SMR_SADR(x)

#define AT91_TWI_IADR

#define AT91_TWI_CWGR
#define AT91_TWI_CWGR_HOLD_MAX
#define AT91_TWI_CWGR_HOLD(x)

#define AT91_TWI_SR
#define AT91_TWI_TXCOMP
#define AT91_TWI_RXRDY
#define AT91_TWI_TXRDY
#define AT91_TWI_SVREAD
#define AT91_TWI_SVACC
#define AT91_TWI_OVRE
#define AT91_TWI_UNRE
#define AT91_TWI_NACK
#define AT91_TWI_EOSACC
#define AT91_TWI_LOCK
#define AT91_TWI_SCL
#define AT91_TWI_SDA

#define AT91_TWI_INT_MASK

#define AT91_TWI_IER
#define AT91_TWI_IDR
#define AT91_TWI_IMR
#define AT91_TWI_RHR
#define AT91_TWI_THR

#define AT91_TWI_ACR
#define AT91_TWI_ACR_DATAL_MASK
#define AT91_TWI_ACR_DATAL(len)
#define AT91_TWI_ACR_DIR

#define AT91_TWI_FILTR
#define AT91_TWI_FILTR_FILT
#define AT91_TWI_FILTR_PADFEN
#define AT91_TWI_FILTR_THRES(v)
#define AT91_TWI_FILTR_THRES_MAX
#define AT91_TWI_FILTR_THRES_MASK

#define AT91_TWI_FMR
#define AT91_TWI_FMR_TXRDYM(mode)
#define AT91_TWI_FMR_TXRDYM_MASK
#define AT91_TWI_FMR_RXRDYM(mode)
#define AT91_TWI_FMR_RXRDYM_MASK
#define AT91_TWI_ONE_DATA
#define AT91_TWI_TWO_DATA
#define AT91_TWI_FOUR_DATA

#define AT91_TWI_FLR

#define AT91_TWI_FSR
#define AT91_TWI_FIER
#define AT91_TWI_FIDR
#define AT91_TWI_FIMR

#define AT91_TWI_VER

struct at91_twi_pdata {};

struct at91_twi_dma {};

struct at91_twi_dev {};

unsigned at91_twi_read(struct at91_twi_dev *dev, unsigned reg);
void at91_twi_write(struct at91_twi_dev *dev, unsigned reg, unsigned val);
void at91_disable_twi_interrupts(struct at91_twi_dev *dev);
void at91_twi_irq_save(struct at91_twi_dev *dev);
void at91_twi_irq_restore(struct at91_twi_dev *dev);
void at91_init_twi_bus(struct at91_twi_dev *dev);

void at91_init_twi_bus_master(struct at91_twi_dev *dev);
int at91_twi_probe_master(struct platform_device *pdev, u32 phy_addr,
			  struct at91_twi_dev *dev);

#ifdef CONFIG_I2C_AT91_SLAVE_EXPERIMENTAL
void at91_init_twi_bus_slave(struct at91_twi_dev *dev);
int at91_twi_probe_slave(struct platform_device *pdev, u32 phy_addr,
			 struct at91_twi_dev *dev);

#else
static inline void at91_init_twi_bus_slave(struct at91_twi_dev *dev) {}
static inline int at91_twi_probe_slave(struct platform_device *pdev,
				       u32 phy_addr, struct at91_twi_dev *dev)
{
	return -EINVAL;
}

#endif