Files
kernel_common_drivers/include/linux/amlogic/aml_spi.h
T
Sunny Luo d30056cc9f spicc: reset controller when busy [1/1]
PD#SWPL-183022

Problem:
ldim crash caused by spi abnormal transfer

Solution:
reset spicc controller when busy

Verify:
t5m

Change-Id: I1317e8e5b2ddec6198126e8cd4a9c569f13eb4d5
Signed-off-by: Sunny Luo <sunny.luo@amlogic.com>
2024-08-22 07:40:49 -07:00

70 lines
1.6 KiB
C

/* SPDX-License-Identifier: (GPL-2.0+ OR MIT) */
/*
* Copyright (c) 2019 Amlogic, Inc. All rights reserved.
*/
#ifndef __AML_SPI_H_
#define __AML_SPI_H_
enum {
DMA_TRIG_NORMAL = 0,
DMA_TRIG_VSYNC,
DMA_TRIG_LINE_N,
DMA_TRIG_PWM_VS,
};
struct spicc_controller_data {
unsigned use_dirspi:1;
unsigned ccxfer_en:1;
unsigned timing_en:1;
unsigned ss_leading_gap:4;
unsigned ss_trailing_gap:4;
unsigned tx_tuning:4;
unsigned rx_tuning:4;
unsigned dummy_ctl:1;
unsigned int dma_trig_delay;
void (*dirspi_start)(struct spi_device *spi);
void (*dirspi_stop)(struct spi_device *spi);
int (*dirspi_async)(struct spi_device *spi,
u8 *tx_buf,
u8 *rx_buf,
int len,
void (*complete)(void *context),
void *context);
int (*dirspi_sync)(struct spi_device *spi,
u8 *tx_buf,
u8 *rx_buf,
int len);
int (*dirspi_xfer)(struct spi_device *spi,
u8 *tx_buf,
u8 *rx_buf,
int len);
int (*dirspi_dma_trig)(struct spi_device *spi,
dma_addr_t tx_dma,
dma_addr_t rx_dma,
int len,
u8 src);
int (*dirspi_dma_trig_start)(struct spi_device *spi);
int (*dirspi_dma_trig_stop)(struct spi_device *spi);
int (*dirspi_dma_trig_release)(struct spi_device *spi);
int (*dirspi_busy_proc)(struct spi_device *spi);
};
struct spicc_transfer {
struct spi_transfer xfer;
unsigned dc_level:1;
#define DC_LEVEL_LOW 0
#define DC_LEVEL_HIGH 1
unsigned read_turn_around:2;
unsigned dc_mode:2;
#define DC_MODE_NONE 0
#define DC_MODE_PIN 1
#define DC_MODE_9BIT 2
void *tx_ccsg;
void *rx_ccsg;
int tx_ccsg_len;
int rx_ccsg_len;
};
#endif