1 /* SPDX-License-Identifier: GPL-2.0+ */
2 /* Header File for Loongson SPI Driver. */
3 /* Copyright (C) 2023 Loongson Technology Corporation Limited */
5 #ifndef __LINUX_SPI_LOONGSON_H
6 #define __LINUX_SPI_LOONGSON_H
8 #include <linux/bits.h>
10 #include <linux/types.h>
12 #define LOONGSON_SPI_SPCR_REG 0x00
13 #define LOONGSON_SPI_SPSR_REG 0x01
14 #define LOONGSON_SPI_FIFO_REG 0x02
15 #define LOONGSON_SPI_SPER_REG 0x03
16 #define LOONGSON_SPI_PARA_REG 0x04
17 #define LOONGSON_SPI_SFCS_REG 0x05
18 #define LOONGSON_SPI_TIMI_REG 0x06
20 /* Bits definition for Loongson SPI register */
21 #define LOONGSON_SPI_PARA_MEM_EN BIT(0)
22 #define LOONGSON_SPI_SPCR_CPHA BIT(2)
23 #define LOONGSON_SPI_SPCR_CPOL BIT(3)
24 #define LOONGSON_SPI_SPCR_SPE BIT(6)
25 #define LOONGSON_SPI_SPSR_RFEMPTY BIT(0)
26 #define LOONGSON_SPI_SPSR_WCOL BIT(6)
27 #define LOONGSON_SPI_SPSR_SPIF BIT(7)
30 struct spi_controller
;
33 struct spi_controller
*controller
;
47 int loongson_spi_init_controller(struct device
*dev
, void __iomem
*reg
);
48 extern const struct dev_pm_ops loongson_spi_dev_pm_ops
;
49 #endif /* __LINUX_SPI_LOONGSON_H */