162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
262306a36Sopenharmony_ci/*
362306a36Sopenharmony_ci * Copyright (c) 2014 Zhang, Keguang <keguang.zhang@gmail.com>
462306a36Sopenharmony_ci *
562306a36Sopenharmony_ci * Loongson 1 MUX Register Definitions.
662306a36Sopenharmony_ci */
762306a36Sopenharmony_ci
862306a36Sopenharmony_ci#ifndef __ASM_MACH_LOONGSON32_REGS_MUX_H
962306a36Sopenharmony_ci#define __ASM_MACH_LOONGSON32_REGS_MUX_H
1062306a36Sopenharmony_ci
1162306a36Sopenharmony_ci#define LS1X_MUX_REG(x) \
1262306a36Sopenharmony_ci		((void __iomem *)KSEG1ADDR(LS1X_MUX_BASE + (x)))
1362306a36Sopenharmony_ci
1462306a36Sopenharmony_ci#define LS1X_MUX_CTRL0			LS1X_MUX_REG(0x0)
1562306a36Sopenharmony_ci#define LS1X_MUX_CTRL1			LS1X_MUX_REG(0x4)
1662306a36Sopenharmony_ci
1762306a36Sopenharmony_ci#if defined(CONFIG_LOONGSON1_LS1B)
1862306a36Sopenharmony_ci/* MUX CTRL0 Register Bits */
1962306a36Sopenharmony_ci#define UART0_USE_PWM23			BIT(28)
2062306a36Sopenharmony_ci#define UART0_USE_PWM01			BIT(27)
2162306a36Sopenharmony_ci#define UART1_USE_LCD0_5_6_11		BIT(26)
2262306a36Sopenharmony_ci#define I2C2_USE_CAN1			BIT(25)
2362306a36Sopenharmony_ci#define I2C1_USE_CAN0			BIT(24)
2462306a36Sopenharmony_ci#define NAND3_USE_UART5			BIT(23)
2562306a36Sopenharmony_ci#define NAND3_USE_UART4			BIT(22)
2662306a36Sopenharmony_ci#define NAND3_USE_UART1_DAT		BIT(21)
2762306a36Sopenharmony_ci#define NAND3_USE_UART1_CTS		BIT(20)
2862306a36Sopenharmony_ci#define NAND3_USE_PWM23			BIT(19)
2962306a36Sopenharmony_ci#define NAND3_USE_PWM01			BIT(18)
3062306a36Sopenharmony_ci#define NAND2_USE_UART5			BIT(17)
3162306a36Sopenharmony_ci#define NAND2_USE_UART4			BIT(16)
3262306a36Sopenharmony_ci#define NAND2_USE_UART1_DAT		BIT(15)
3362306a36Sopenharmony_ci#define NAND2_USE_UART1_CTS		BIT(14)
3462306a36Sopenharmony_ci#define NAND2_USE_PWM23			BIT(13)
3562306a36Sopenharmony_ci#define NAND2_USE_PWM01			BIT(12)
3662306a36Sopenharmony_ci#define NAND1_USE_UART5			BIT(11)
3762306a36Sopenharmony_ci#define NAND1_USE_UART4			BIT(10)
3862306a36Sopenharmony_ci#define NAND1_USE_UART1_DAT		BIT(9)
3962306a36Sopenharmony_ci#define NAND1_USE_UART1_CTS		BIT(8)
4062306a36Sopenharmony_ci#define NAND1_USE_PWM23			BIT(7)
4162306a36Sopenharmony_ci#define NAND1_USE_PWM01			BIT(6)
4262306a36Sopenharmony_ci#define GMAC1_USE_UART1			BIT(4)
4362306a36Sopenharmony_ci#define GMAC1_USE_UART0			BIT(3)
4462306a36Sopenharmony_ci#define LCD_USE_UART0_DAT		BIT(2)
4562306a36Sopenharmony_ci#define LCD_USE_UART15			BIT(1)
4662306a36Sopenharmony_ci#define LCD_USE_UART0			BIT(0)
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ci/* MUX CTRL1 Register Bits */
4962306a36Sopenharmony_ci#define USB_RESET			BIT(31)
5062306a36Sopenharmony_ci#define SPI1_CS_USE_PWM01		BIT(24)
5162306a36Sopenharmony_ci#define SPI1_USE_CAN			BIT(23)
5262306a36Sopenharmony_ci#define DISABLE_DDR_CONFSPACE		BIT(20)
5362306a36Sopenharmony_ci#define DDR32TO16EN			BIT(16)
5462306a36Sopenharmony_ci#define GMAC1_SHUT			BIT(13)
5562306a36Sopenharmony_ci#define GMAC0_SHUT			BIT(12)
5662306a36Sopenharmony_ci#define USB_SHUT			BIT(11)
5762306a36Sopenharmony_ci#define UART1_3_USE_CAN1		BIT(5)
5862306a36Sopenharmony_ci#define UART1_2_USE_CAN0		BIT(4)
5962306a36Sopenharmony_ci#define GMAC1_USE_TXCLK			BIT(3)
6062306a36Sopenharmony_ci#define GMAC0_USE_TXCLK			BIT(2)
6162306a36Sopenharmony_ci#define GMAC1_USE_PWM23			BIT(1)
6262306a36Sopenharmony_ci#define GMAC0_USE_PWM01			BIT(0)
6362306a36Sopenharmony_ci
6462306a36Sopenharmony_ci#elif defined(CONFIG_LOONGSON1_LS1C)
6562306a36Sopenharmony_ci
6662306a36Sopenharmony_ci/* SHUT_CTRL Register Bits */
6762306a36Sopenharmony_ci#define UART_SPLIT			GENMASK(31, 30)
6862306a36Sopenharmony_ci#define OUTPUT_CLK			GENMASK(29, 26)
6962306a36Sopenharmony_ci#define ADC_SHUT			BIT(25)
7062306a36Sopenharmony_ci#define SDIO_SHUT			BIT(24)
7162306a36Sopenharmony_ci#define DMA2_SHUT			BIT(23)
7262306a36Sopenharmony_ci#define DMA1_SHUT			BIT(22)
7362306a36Sopenharmony_ci#define DMA0_SHUT			BIT(21)
7462306a36Sopenharmony_ci#define SPI1_SHUT			BIT(20)
7562306a36Sopenharmony_ci#define SPI0_SHUT			BIT(19)
7662306a36Sopenharmony_ci#define I2C2_SHUT			BIT(18)
7762306a36Sopenharmony_ci#define I2C1_SHUT			BIT(17)
7862306a36Sopenharmony_ci#define I2C0_SHUT			BIT(16)
7962306a36Sopenharmony_ci#define AC97_SHUT			BIT(15)
8062306a36Sopenharmony_ci#define I2S_SHUT			BIT(14)
8162306a36Sopenharmony_ci#define UART3_SHUT			BIT(13)
8262306a36Sopenharmony_ci#define UART2_SHUT			BIT(12)
8362306a36Sopenharmony_ci#define UART1_SHUT			BIT(11)
8462306a36Sopenharmony_ci#define UART0_SHUT			BIT(10)
8562306a36Sopenharmony_ci#define CAN1_SHUT			BIT(9)
8662306a36Sopenharmony_ci#define CAN0_SHUT			BIT(8)
8762306a36Sopenharmony_ci#define ECC_SHUT			BIT(7)
8862306a36Sopenharmony_ci#define GMAC_SHUT			BIT(6)
8962306a36Sopenharmony_ci#define USBHOST_SHUT			BIT(5)
9062306a36Sopenharmony_ci#define USBOTG_SHUT			BIT(4)
9162306a36Sopenharmony_ci#define SDRAM_SHUT			BIT(3)
9262306a36Sopenharmony_ci#define SRAM_SHUT			BIT(2)
9362306a36Sopenharmony_ci#define CAM_SHUT			BIT(1)
9462306a36Sopenharmony_ci#define LCD_SHUT			BIT(0)
9562306a36Sopenharmony_ci
9662306a36Sopenharmony_ci#define UART_SPLIT_SHIFT                        30
9762306a36Sopenharmony_ci#define OUTPUT_CLK_SHIFT                        26
9862306a36Sopenharmony_ci
9962306a36Sopenharmony_ci/* MISC_CTRL Register Bits */
10062306a36Sopenharmony_ci#define USBHOST_RSTN			BIT(31)
10162306a36Sopenharmony_ci#define PHY_INTF_SELI			GENMASK(30, 28)
10262306a36Sopenharmony_ci#define AC97_EN				BIT(25)
10362306a36Sopenharmony_ci#define SDIO_DMA_EN			GENMASK(24, 23)
10462306a36Sopenharmony_ci#define ADC_DMA_EN			BIT(22)
10562306a36Sopenharmony_ci#define SDIO_USE_SPI1			BIT(17)
10662306a36Sopenharmony_ci#define SDIO_USE_SPI0			BIT(16)
10762306a36Sopenharmony_ci#define SRAM_CTRL			GENMASK(15, 0)
10862306a36Sopenharmony_ci
10962306a36Sopenharmony_ci#define PHY_INTF_SELI_SHIFT                     28
11062306a36Sopenharmony_ci#define SDIO_DMA_EN_SHIFT                       23
11162306a36Sopenharmony_ci#define SRAM_CTRL_SHIFT				0
11262306a36Sopenharmony_ci
11362306a36Sopenharmony_ci#define LS1X_CBUS_REG(n, x) \
11462306a36Sopenharmony_ci		((void __iomem *)KSEG1ADDR(LS1X_CBUS_BASE + (n * 0x04) + (x)))
11562306a36Sopenharmony_ci
11662306a36Sopenharmony_ci#define LS1X_CBUS_FIRST(n)		LS1X_CBUS_REG(n, 0x00)
11762306a36Sopenharmony_ci#define LS1X_CBUS_SECOND(n)		LS1X_CBUS_REG(n, 0x10)
11862306a36Sopenharmony_ci#define LS1X_CBUS_THIRD(n)		LS1X_CBUS_REG(n, 0x20)
11962306a36Sopenharmony_ci#define LS1X_CBUS_FOURTHT(n)		LS1X_CBUS_REG(n, 0x30)
12062306a36Sopenharmony_ci#define LS1X_CBUS_FIFTHT(n)		LS1X_CBUS_REG(n, 0x40)
12162306a36Sopenharmony_ci
12262306a36Sopenharmony_ci#endif
12362306a36Sopenharmony_ci
12462306a36Sopenharmony_ci#endif /* __ASM_MACH_LOONGSON32_REGS_MUX_H */
125