18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * Copyright (c) 2014 Zhang, Keguang <keguang.zhang@gmail.com>
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Loongson 1 MUX Register Definitions.
68c2ecf20Sopenharmony_ci */
78c2ecf20Sopenharmony_ci
88c2ecf20Sopenharmony_ci#ifndef __ASM_MACH_LOONGSON32_REGS_MUX_H
98c2ecf20Sopenharmony_ci#define __ASM_MACH_LOONGSON32_REGS_MUX_H
108c2ecf20Sopenharmony_ci
118c2ecf20Sopenharmony_ci#define LS1X_MUX_REG(x) \
128c2ecf20Sopenharmony_ci		((void __iomem *)KSEG1ADDR(LS1X_MUX_BASE + (x)))
138c2ecf20Sopenharmony_ci
148c2ecf20Sopenharmony_ci#define LS1X_MUX_CTRL0			LS1X_MUX_REG(0x0)
158c2ecf20Sopenharmony_ci#define LS1X_MUX_CTRL1			LS1X_MUX_REG(0x4)
168c2ecf20Sopenharmony_ci
178c2ecf20Sopenharmony_ci#if defined(CONFIG_LOONGSON1_LS1B)
188c2ecf20Sopenharmony_ci/* MUX CTRL0 Register Bits */
198c2ecf20Sopenharmony_ci#define UART0_USE_PWM23			BIT(28)
208c2ecf20Sopenharmony_ci#define UART0_USE_PWM01			BIT(27)
218c2ecf20Sopenharmony_ci#define UART1_USE_LCD0_5_6_11		BIT(26)
228c2ecf20Sopenharmony_ci#define I2C2_USE_CAN1			BIT(25)
238c2ecf20Sopenharmony_ci#define I2C1_USE_CAN0			BIT(24)
248c2ecf20Sopenharmony_ci#define NAND3_USE_UART5			BIT(23)
258c2ecf20Sopenharmony_ci#define NAND3_USE_UART4			BIT(22)
268c2ecf20Sopenharmony_ci#define NAND3_USE_UART1_DAT		BIT(21)
278c2ecf20Sopenharmony_ci#define NAND3_USE_UART1_CTS		BIT(20)
288c2ecf20Sopenharmony_ci#define NAND3_USE_PWM23			BIT(19)
298c2ecf20Sopenharmony_ci#define NAND3_USE_PWM01			BIT(18)
308c2ecf20Sopenharmony_ci#define NAND2_USE_UART5			BIT(17)
318c2ecf20Sopenharmony_ci#define NAND2_USE_UART4			BIT(16)
328c2ecf20Sopenharmony_ci#define NAND2_USE_UART1_DAT		BIT(15)
338c2ecf20Sopenharmony_ci#define NAND2_USE_UART1_CTS		BIT(14)
348c2ecf20Sopenharmony_ci#define NAND2_USE_PWM23			BIT(13)
358c2ecf20Sopenharmony_ci#define NAND2_USE_PWM01			BIT(12)
368c2ecf20Sopenharmony_ci#define NAND1_USE_UART5			BIT(11)
378c2ecf20Sopenharmony_ci#define NAND1_USE_UART4			BIT(10)
388c2ecf20Sopenharmony_ci#define NAND1_USE_UART1_DAT		BIT(9)
398c2ecf20Sopenharmony_ci#define NAND1_USE_UART1_CTS		BIT(8)
408c2ecf20Sopenharmony_ci#define NAND1_USE_PWM23			BIT(7)
418c2ecf20Sopenharmony_ci#define NAND1_USE_PWM01			BIT(6)
428c2ecf20Sopenharmony_ci#define GMAC1_USE_UART1			BIT(4)
438c2ecf20Sopenharmony_ci#define GMAC1_USE_UART0			BIT(3)
448c2ecf20Sopenharmony_ci#define LCD_USE_UART0_DAT		BIT(2)
458c2ecf20Sopenharmony_ci#define LCD_USE_UART15			BIT(1)
468c2ecf20Sopenharmony_ci#define LCD_USE_UART0			BIT(0)
478c2ecf20Sopenharmony_ci
488c2ecf20Sopenharmony_ci/* MUX CTRL1 Register Bits */
498c2ecf20Sopenharmony_ci#define USB_RESET			BIT(31)
508c2ecf20Sopenharmony_ci#define SPI1_CS_USE_PWM01		BIT(24)
518c2ecf20Sopenharmony_ci#define SPI1_USE_CAN			BIT(23)
528c2ecf20Sopenharmony_ci#define DISABLE_DDR_CONFSPACE		BIT(20)
538c2ecf20Sopenharmony_ci#define DDR32TO16EN			BIT(16)
548c2ecf20Sopenharmony_ci#define GMAC1_SHUT			BIT(13)
558c2ecf20Sopenharmony_ci#define GMAC0_SHUT			BIT(12)
568c2ecf20Sopenharmony_ci#define USB_SHUT			BIT(11)
578c2ecf20Sopenharmony_ci#define UART1_3_USE_CAN1		BIT(5)
588c2ecf20Sopenharmony_ci#define UART1_2_USE_CAN0		BIT(4)
598c2ecf20Sopenharmony_ci#define GMAC1_USE_TXCLK			BIT(3)
608c2ecf20Sopenharmony_ci#define GMAC0_USE_TXCLK			BIT(2)
618c2ecf20Sopenharmony_ci#define GMAC1_USE_PWM23			BIT(1)
628c2ecf20Sopenharmony_ci#define GMAC0_USE_PWM01			BIT(0)
638c2ecf20Sopenharmony_ci
648c2ecf20Sopenharmony_ci#elif defined(CONFIG_LOONGSON1_LS1C)
658c2ecf20Sopenharmony_ci
668c2ecf20Sopenharmony_ci/* SHUT_CTRL Register Bits */
678c2ecf20Sopenharmony_ci#define UART_SPLIT			GENMASK(31, 30)
688c2ecf20Sopenharmony_ci#define OUTPUT_CLK			GENMASK(29, 26)
698c2ecf20Sopenharmony_ci#define ADC_SHUT			BIT(25)
708c2ecf20Sopenharmony_ci#define SDIO_SHUT			BIT(24)
718c2ecf20Sopenharmony_ci#define DMA2_SHUT			BIT(23)
728c2ecf20Sopenharmony_ci#define DMA1_SHUT			BIT(22)
738c2ecf20Sopenharmony_ci#define DMA0_SHUT			BIT(21)
748c2ecf20Sopenharmony_ci#define SPI1_SHUT			BIT(20)
758c2ecf20Sopenharmony_ci#define SPI0_SHUT			BIT(19)
768c2ecf20Sopenharmony_ci#define I2C2_SHUT			BIT(18)
778c2ecf20Sopenharmony_ci#define I2C1_SHUT			BIT(17)
788c2ecf20Sopenharmony_ci#define I2C0_SHUT			BIT(16)
798c2ecf20Sopenharmony_ci#define AC97_SHUT			BIT(15)
808c2ecf20Sopenharmony_ci#define I2S_SHUT			BIT(14)
818c2ecf20Sopenharmony_ci#define UART3_SHUT			BIT(13)
828c2ecf20Sopenharmony_ci#define UART2_SHUT			BIT(12)
838c2ecf20Sopenharmony_ci#define UART1_SHUT			BIT(11)
848c2ecf20Sopenharmony_ci#define UART0_SHUT			BIT(10)
858c2ecf20Sopenharmony_ci#define CAN1_SHUT			BIT(9)
868c2ecf20Sopenharmony_ci#define CAN0_SHUT			BIT(8)
878c2ecf20Sopenharmony_ci#define ECC_SHUT			BIT(7)
888c2ecf20Sopenharmony_ci#define GMAC_SHUT			BIT(6)
898c2ecf20Sopenharmony_ci#define USBHOST_SHUT			BIT(5)
908c2ecf20Sopenharmony_ci#define USBOTG_SHUT			BIT(4)
918c2ecf20Sopenharmony_ci#define SDRAM_SHUT			BIT(3)
928c2ecf20Sopenharmony_ci#define SRAM_SHUT			BIT(2)
938c2ecf20Sopenharmony_ci#define CAM_SHUT			BIT(1)
948c2ecf20Sopenharmony_ci#define LCD_SHUT			BIT(0)
958c2ecf20Sopenharmony_ci
968c2ecf20Sopenharmony_ci#define UART_SPLIT_SHIFT                        30
978c2ecf20Sopenharmony_ci#define OUTPUT_CLK_SHIFT                        26
988c2ecf20Sopenharmony_ci
998c2ecf20Sopenharmony_ci/* MISC_CTRL Register Bits */
1008c2ecf20Sopenharmony_ci#define USBHOST_RSTN			BIT(31)
1018c2ecf20Sopenharmony_ci#define PHY_INTF_SELI			GENMASK(30, 28)
1028c2ecf20Sopenharmony_ci#define AC97_EN				BIT(25)
1038c2ecf20Sopenharmony_ci#define SDIO_DMA_EN			GENMASK(24, 23)
1048c2ecf20Sopenharmony_ci#define ADC_DMA_EN			BIT(22)
1058c2ecf20Sopenharmony_ci#define SDIO_USE_SPI1			BIT(17)
1068c2ecf20Sopenharmony_ci#define SDIO_USE_SPI0			BIT(16)
1078c2ecf20Sopenharmony_ci#define SRAM_CTRL			GENMASK(15, 0)
1088c2ecf20Sopenharmony_ci
1098c2ecf20Sopenharmony_ci#define PHY_INTF_SELI_SHIFT                     28
1108c2ecf20Sopenharmony_ci#define SDIO_DMA_EN_SHIFT                       23
1118c2ecf20Sopenharmony_ci#define SRAM_CTRL_SHIFT				0
1128c2ecf20Sopenharmony_ci
1138c2ecf20Sopenharmony_ci#define LS1X_CBUS_REG(n, x) \
1148c2ecf20Sopenharmony_ci		((void __iomem *)KSEG1ADDR(LS1X_CBUS_BASE + (n * 0x04) + (x)))
1158c2ecf20Sopenharmony_ci
1168c2ecf20Sopenharmony_ci#define LS1X_CBUS_FIRST(n)		LS1X_CBUS_REG(n, 0x00)
1178c2ecf20Sopenharmony_ci#define LS1X_CBUS_SECOND(n)		LS1X_CBUS_REG(n, 0x10)
1188c2ecf20Sopenharmony_ci#define LS1X_CBUS_THIRD(n)		LS1X_CBUS_REG(n, 0x20)
1198c2ecf20Sopenharmony_ci#define LS1X_CBUS_FOURTHT(n)		LS1X_CBUS_REG(n, 0x30)
1208c2ecf20Sopenharmony_ci#define LS1X_CBUS_FIFTHT(n)		LS1X_CBUS_REG(n, 0x40)
1218c2ecf20Sopenharmony_ci
1228c2ecf20Sopenharmony_ci#endif
1238c2ecf20Sopenharmony_ci
1248c2ecf20Sopenharmony_ci#endif /* __ASM_MACH_LOONGSON32_REGS_MUX_H */
125