18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-only */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci *  Atheros AR933X UART defines
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci *  Copyright (C) 2011 Gabor Juhos <juhosg@openwrt.org>
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef __AR933X_UART_H
98c2ecf20Sopenharmony_ci#define __AR933X_UART_H
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#define AR933X_UART_REGS_SIZE		20
128c2ecf20Sopenharmony_ci#define AR933X_UART_FIFO_SIZE		16
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#define AR933X_UART_DATA_REG		0x00
158c2ecf20Sopenharmony_ci#define AR933X_UART_CS_REG		0x04
168c2ecf20Sopenharmony_ci#define AR933X_UART_CLOCK_REG		0x08
178c2ecf20Sopenharmony_ci#define AR933X_UART_INT_REG		0x0c
188c2ecf20Sopenharmony_ci#define AR933X_UART_INT_EN_REG		0x10
198c2ecf20Sopenharmony_ci
208c2ecf20Sopenharmony_ci#define AR933X_UART_DATA_TX_RX_MASK	0xff
218c2ecf20Sopenharmony_ci#define AR933X_UART_DATA_RX_CSR		BIT(8)
228c2ecf20Sopenharmony_ci#define AR933X_UART_DATA_TX_CSR		BIT(9)
238c2ecf20Sopenharmony_ci
248c2ecf20Sopenharmony_ci#define AR933X_UART_CS_PARITY_S		0
258c2ecf20Sopenharmony_ci#define AR933X_UART_CS_PARITY_M		0x3
268c2ecf20Sopenharmony_ci#define	  AR933X_UART_CS_PARITY_NONE	0
278c2ecf20Sopenharmony_ci#define	  AR933X_UART_CS_PARITY_ODD	2
288c2ecf20Sopenharmony_ci#define	  AR933X_UART_CS_PARITY_EVEN	3
298c2ecf20Sopenharmony_ci#define AR933X_UART_CS_IF_MODE_S	2
308c2ecf20Sopenharmony_ci#define AR933X_UART_CS_IF_MODE_M	0x3
318c2ecf20Sopenharmony_ci#define	  AR933X_UART_CS_IF_MODE_NONE	0
328c2ecf20Sopenharmony_ci#define	  AR933X_UART_CS_IF_MODE_DTE	1
338c2ecf20Sopenharmony_ci#define	  AR933X_UART_CS_IF_MODE_DCE	2
348c2ecf20Sopenharmony_ci#define AR933X_UART_CS_FLOW_CTRL_S	4
358c2ecf20Sopenharmony_ci#define AR933X_UART_CS_FLOW_CTRL_M	0x3
368c2ecf20Sopenharmony_ci#define AR933X_UART_CS_DMA_EN		BIT(6)
378c2ecf20Sopenharmony_ci#define AR933X_UART_CS_TX_READY_ORIDE	BIT(7)
388c2ecf20Sopenharmony_ci#define AR933X_UART_CS_RX_READY_ORIDE	BIT(8)
398c2ecf20Sopenharmony_ci#define AR933X_UART_CS_TX_READY		BIT(9)
408c2ecf20Sopenharmony_ci#define AR933X_UART_CS_RX_BREAK		BIT(10)
418c2ecf20Sopenharmony_ci#define AR933X_UART_CS_TX_BREAK		BIT(11)
428c2ecf20Sopenharmony_ci#define AR933X_UART_CS_HOST_INT		BIT(12)
438c2ecf20Sopenharmony_ci#define AR933X_UART_CS_HOST_INT_EN	BIT(13)
448c2ecf20Sopenharmony_ci#define AR933X_UART_CS_TX_BUSY		BIT(14)
458c2ecf20Sopenharmony_ci#define AR933X_UART_CS_RX_BUSY		BIT(15)
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci#define AR933X_UART_CLOCK_STEP_M	0xffff
488c2ecf20Sopenharmony_ci#define AR933X_UART_CLOCK_SCALE_M	0xfff
498c2ecf20Sopenharmony_ci#define AR933X_UART_CLOCK_SCALE_S	16
508c2ecf20Sopenharmony_ci#define AR933X_UART_CLOCK_STEP_M	0xffff
518c2ecf20Sopenharmony_ci
528c2ecf20Sopenharmony_ci#define AR933X_UART_INT_RX_VALID	BIT(0)
538c2ecf20Sopenharmony_ci#define AR933X_UART_INT_TX_READY	BIT(1)
548c2ecf20Sopenharmony_ci#define AR933X_UART_INT_RX_FRAMING_ERR	BIT(2)
558c2ecf20Sopenharmony_ci#define AR933X_UART_INT_RX_OFLOW_ERR	BIT(3)
568c2ecf20Sopenharmony_ci#define AR933X_UART_INT_TX_OFLOW_ERR	BIT(4)
578c2ecf20Sopenharmony_ci#define AR933X_UART_INT_RX_PARITY_ERR	BIT(5)
588c2ecf20Sopenharmony_ci#define AR933X_UART_INT_RX_BREAK_ON	BIT(6)
598c2ecf20Sopenharmony_ci#define AR933X_UART_INT_RX_BREAK_OFF	BIT(7)
608c2ecf20Sopenharmony_ci#define AR933X_UART_INT_RX_FULL		BIT(8)
618c2ecf20Sopenharmony_ci#define AR933X_UART_INT_TX_EMPTY	BIT(9)
628c2ecf20Sopenharmony_ci#define AR933X_UART_INT_ALLINTS		0x3ff
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci#endif /* __AR933X_UART_H */
65