11556Srgrimes/* SPDX-License-Identifier: GPL-2.0 OR BSD-2-Clause */ 21556Srgrimes/* 31556Srgrimes * Copyright (c) 2011, 2012, Qualcomm Atheros Communications Inc. 41556Srgrimes * Copyright (c) 2014, I2SE GmbH 51556Srgrimes */ 61556Srgrimes 71556Srgrimes/* Qualcomm Atheros SPI register definition. 81556Srgrimes * 91556Srgrimes * This module is designed to define the Qualcomm Atheros SPI 101556Srgrimes * register placeholders. 111556Srgrimes */ 121556Srgrimes 131556Srgrimes#ifndef _QCA_7K_H 141556Srgrimes#define _QCA_7K_H 151556Srgrimes 161556Srgrimes#include <linux/types.h> 171556Srgrimes 181556Srgrimes#include "qca_spi.h" 191556Srgrimes 201556Srgrimes#define QCA7K_SPI_READ (1 << 15) 211556Srgrimes#define QCA7K_SPI_WRITE (0 << 15) 221556Srgrimes#define QCA7K_SPI_INTERNAL (1 << 14) 231556Srgrimes#define QCA7K_SPI_EXTERNAL (0 << 14) 241556Srgrimes 251556Srgrimes#define QCASPI_CMD_LEN 2 261556Srgrimes#define QCASPI_HW_PKT_LEN 4 271556Srgrimes#define QCASPI_HW_BUF_LEN 0xC5B 281556Srgrimes 291556Srgrimes/* SPI registers; */ 301556Srgrimes#define SPI_REG_BFR_SIZE 0x0100 311556Srgrimes#define SPI_REG_WRBUF_SPC_AVA 0x0200 321556Srgrimes#define SPI_REG_RDBUF_BYTE_AVA 0x0300 331556Srgrimes#define SPI_REG_SPI_CONFIG 0x0400 341556Srgrimes#define SPI_REG_SPI_STATUS 0x0500 351556Srgrimes#define SPI_REG_INTR_CAUSE 0x0C00 361556Srgrimes#define SPI_REG_INTR_ENABLE 0x0D00 371556Srgrimes#define SPI_REG_RDBUF_WATERMARK 0x1200 3836150Scharnier#define SPI_REG_WRBUF_WATERMARK 0x1300 3936150Scharnier#define SPI_REG_SIGNATURE 0x1A00 4036150Scharnier#define SPI_REG_ACTION_CTRL 0x1B00 4136150Scharnier 4236150Scharnier/* SPI_CONFIG register definition; */ 431556Srgrimes#define QCASPI_SLAVE_RESET_BIT BIT(6) 441556Srgrimes 4517987Speter/* INTR_CAUSE/ENABLE register definition. */ 4617987Speter#define SPI_INT_WRBUF_BELOW_WM BIT(10) 4717987Speter#define SPI_INT_CPU_ON BIT(6) 4817987Speter#define SPI_INT_ADDR_ERR BIT(3) 491556Srgrimes#define SPI_INT_WRBUF_ERR BIT(2) 501556Srgrimes#define SPI_INT_RDBUF_ERR BIT(1) 511556Srgrimes#define SPI_INT_PKT_AVLBL BIT(0) 521556Srgrimes 531556Srgrimesvoid qcaspi_spi_error(struct qcaspi *qca); 5417987Speterint qcaspi_read_register(struct qcaspi *qca, u16 reg, u16 *result); 551556Srgrimesint qcaspi_write_register(struct qcaspi *qca, u16 reg, u16 value, int retry); 561556Srgrimes 571556Srgrimes#endif /* _QCA_7K_H */ 581556Srgrimes