18c2ecf20Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */
28c2ecf20Sopenharmony_ci/*
38c2ecf20Sopenharmony_ci * arch/arm/mach-lpc32xx/include/mach/platform.h
48c2ecf20Sopenharmony_ci *
58c2ecf20Sopenharmony_ci * Author: Kevin Wells <kevin.wells@nxp.com>
68c2ecf20Sopenharmony_ci *
78c2ecf20Sopenharmony_ci * Copyright (C) 2010 NXP Semiconductors
88c2ecf20Sopenharmony_ci */
98c2ecf20Sopenharmony_ci
108c2ecf20Sopenharmony_ci#ifndef __ARM_LPC32XX_H
118c2ecf20Sopenharmony_ci#define __ARM_LPC32XX_H
128c2ecf20Sopenharmony_ci
138c2ecf20Sopenharmony_ci#define _SBF(f, v)				((v) << (f))
148c2ecf20Sopenharmony_ci#define _BIT(n)					_SBF(n, 1)
158c2ecf20Sopenharmony_ci
168c2ecf20Sopenharmony_ci/*
178c2ecf20Sopenharmony_ci * AHB 0 physical base addresses
188c2ecf20Sopenharmony_ci */
198c2ecf20Sopenharmony_ci#define LPC32XX_SLC_BASE			0x20020000
208c2ecf20Sopenharmony_ci#define LPC32XX_SSP0_BASE			0x20084000
218c2ecf20Sopenharmony_ci#define LPC32XX_SPI1_BASE			0x20088000
228c2ecf20Sopenharmony_ci#define LPC32XX_SSP1_BASE			0x2008C000
238c2ecf20Sopenharmony_ci#define LPC32XX_SPI2_BASE			0x20090000
248c2ecf20Sopenharmony_ci#define LPC32XX_I2S0_BASE			0x20094000
258c2ecf20Sopenharmony_ci#define LPC32XX_SD_BASE				0x20098000
268c2ecf20Sopenharmony_ci#define LPC32XX_I2S1_BASE			0x2009C000
278c2ecf20Sopenharmony_ci#define LPC32XX_MLC_BASE			0x200A8000
288c2ecf20Sopenharmony_ci#define LPC32XX_AHB0_START			LPC32XX_SLC_BASE
298c2ecf20Sopenharmony_ci#define LPC32XX_AHB0_SIZE			0x00089000
308c2ecf20Sopenharmony_ci
318c2ecf20Sopenharmony_ci/*
328c2ecf20Sopenharmony_ci * AHB 1 physical base addresses
338c2ecf20Sopenharmony_ci */
348c2ecf20Sopenharmony_ci#define LPC32XX_DMA_BASE			0x31000000
358c2ecf20Sopenharmony_ci#define LPC32XX_USB_BASE			0x31020000
368c2ecf20Sopenharmony_ci#define LPC32XX_USBH_BASE			0x31020000
378c2ecf20Sopenharmony_ci#define LPC32XX_USB_OTG_BASE			0x31020000
388c2ecf20Sopenharmony_ci#define LPC32XX_OTG_I2C_BASE			0x31020300
398c2ecf20Sopenharmony_ci#define LPC32XX_LCD_BASE			0x31040000
408c2ecf20Sopenharmony_ci#define LPC32XX_ETHERNET_BASE			0x31060000
418c2ecf20Sopenharmony_ci#define LPC32XX_EMC_BASE			0x31080000
428c2ecf20Sopenharmony_ci#define LPC32XX_ETB_CFG_BASE			0x310C0000
438c2ecf20Sopenharmony_ci#define LPC32XX_ETB_DATA_BASE			0x310E0000
448c2ecf20Sopenharmony_ci#define LPC32XX_AHB1_START			LPC32XX_DMA_BASE
458c2ecf20Sopenharmony_ci#define LPC32XX_AHB1_SIZE			0x000E1000
468c2ecf20Sopenharmony_ci
478c2ecf20Sopenharmony_ci/*
488c2ecf20Sopenharmony_ci * FAB physical base addresses
498c2ecf20Sopenharmony_ci */
508c2ecf20Sopenharmony_ci#define LPC32XX_CLK_PM_BASE			0x40004000
518c2ecf20Sopenharmony_ci#define LPC32XX_MIC_BASE			0x40008000
528c2ecf20Sopenharmony_ci#define LPC32XX_SIC1_BASE			0x4000C000
538c2ecf20Sopenharmony_ci#define LPC32XX_SIC2_BASE			0x40010000
548c2ecf20Sopenharmony_ci#define LPC32XX_HS_UART1_BASE			0x40014000
558c2ecf20Sopenharmony_ci#define LPC32XX_HS_UART2_BASE			0x40018000
568c2ecf20Sopenharmony_ci#define LPC32XX_HS_UART7_BASE			0x4001C000
578c2ecf20Sopenharmony_ci#define LPC32XX_RTC_BASE			0x40024000
588c2ecf20Sopenharmony_ci#define LPC32XX_RTC_RAM_BASE			0x40024080
598c2ecf20Sopenharmony_ci#define LPC32XX_GPIO_BASE			0x40028000
608c2ecf20Sopenharmony_ci#define LPC32XX_PWM3_BASE			0x4002C000
618c2ecf20Sopenharmony_ci#define LPC32XX_PWM4_BASE			0x40030000
628c2ecf20Sopenharmony_ci#define LPC32XX_MSTIM_BASE			0x40034000
638c2ecf20Sopenharmony_ci#define LPC32XX_HSTIM_BASE			0x40038000
648c2ecf20Sopenharmony_ci#define LPC32XX_WDTIM_BASE			0x4003C000
658c2ecf20Sopenharmony_ci#define LPC32XX_DEBUG_CTRL_BASE			0x40040000
668c2ecf20Sopenharmony_ci#define LPC32XX_TIMER0_BASE			0x40044000
678c2ecf20Sopenharmony_ci#define LPC32XX_ADC_BASE			0x40048000
688c2ecf20Sopenharmony_ci#define LPC32XX_TIMER1_BASE			0x4004C000
698c2ecf20Sopenharmony_ci#define LPC32XX_KSCAN_BASE			0x40050000
708c2ecf20Sopenharmony_ci#define LPC32XX_UART_CTRL_BASE			0x40054000
718c2ecf20Sopenharmony_ci#define LPC32XX_TIMER2_BASE			0x40058000
728c2ecf20Sopenharmony_ci#define LPC32XX_PWM1_BASE			0x4005C000
738c2ecf20Sopenharmony_ci#define LPC32XX_PWM2_BASE			0x4005C004
748c2ecf20Sopenharmony_ci#define LPC32XX_TIMER3_BASE			0x40060000
758c2ecf20Sopenharmony_ci
768c2ecf20Sopenharmony_ci/*
778c2ecf20Sopenharmony_ci * APB physical base addresses
788c2ecf20Sopenharmony_ci */
798c2ecf20Sopenharmony_ci#define LPC32XX_UART3_BASE			0x40080000
808c2ecf20Sopenharmony_ci#define LPC32XX_UART4_BASE			0x40088000
818c2ecf20Sopenharmony_ci#define LPC32XX_UART5_BASE			0x40090000
828c2ecf20Sopenharmony_ci#define LPC32XX_UART6_BASE			0x40098000
838c2ecf20Sopenharmony_ci#define LPC32XX_I2C1_BASE			0x400A0000
848c2ecf20Sopenharmony_ci#define LPC32XX_I2C2_BASE			0x400A8000
858c2ecf20Sopenharmony_ci
868c2ecf20Sopenharmony_ci/*
878c2ecf20Sopenharmony_ci * FAB and APB base and sizing
888c2ecf20Sopenharmony_ci */
898c2ecf20Sopenharmony_ci#define LPC32XX_FABAPB_START			LPC32XX_CLK_PM_BASE
908c2ecf20Sopenharmony_ci#define LPC32XX_FABAPB_SIZE			0x000A5000
918c2ecf20Sopenharmony_ci
928c2ecf20Sopenharmony_ci/*
938c2ecf20Sopenharmony_ci * Internal memory bases and sizes
948c2ecf20Sopenharmony_ci */
958c2ecf20Sopenharmony_ci#define LPC32XX_IRAM_BASE			0x08000000
968c2ecf20Sopenharmony_ci#define LPC32XX_IROM_BASE			0x0C000000
978c2ecf20Sopenharmony_ci
988c2ecf20Sopenharmony_ci/*
998c2ecf20Sopenharmony_ci * External Static Memory Bank Address Space Bases
1008c2ecf20Sopenharmony_ci */
1018c2ecf20Sopenharmony_ci#define LPC32XX_EMC_CS0_BASE			0xE0000000
1028c2ecf20Sopenharmony_ci#define LPC32XX_EMC_CS1_BASE			0xE1000000
1038c2ecf20Sopenharmony_ci#define LPC32XX_EMC_CS2_BASE			0xE2000000
1048c2ecf20Sopenharmony_ci#define LPC32XX_EMC_CS3_BASE			0xE3000000
1058c2ecf20Sopenharmony_ci
1068c2ecf20Sopenharmony_ci/*
1078c2ecf20Sopenharmony_ci * External SDRAM Memory Bank Address Space Bases
1088c2ecf20Sopenharmony_ci */
1098c2ecf20Sopenharmony_ci#define LPC32XX_EMC_DYCS0_BASE			0x80000000
1108c2ecf20Sopenharmony_ci#define LPC32XX_EMC_DYCS1_BASE			0xA0000000
1118c2ecf20Sopenharmony_ci
1128c2ecf20Sopenharmony_ci/*
1138c2ecf20Sopenharmony_ci * Clock and crystal information
1148c2ecf20Sopenharmony_ci */
1158c2ecf20Sopenharmony_ci#define LPC32XX_MAIN_OSC_FREQ			13000000
1168c2ecf20Sopenharmony_ci#define LPC32XX_CLOCK_OSC_FREQ			32768
1178c2ecf20Sopenharmony_ci
1188c2ecf20Sopenharmony_ci/*
1198c2ecf20Sopenharmony_ci * Clock and Power control register offsets
1208c2ecf20Sopenharmony_ci */
1218c2ecf20Sopenharmony_ci#define _PMREG(x)				io_p2v(LPC32XX_CLK_PM_BASE +\
1228c2ecf20Sopenharmony_ci						(x))
1238c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_DEBUG_CTRL		_PMREG(0x000)
1248c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_BOOTMAP			_PMREG(0x014)
1258c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_P01_ER			_PMREG(0x018)
1268c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_USBCLK_PDIV		_PMREG(0x01C)
1278c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_INT_ER			_PMREG(0x020)
1288c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_INT_RS			_PMREG(0x024)
1298c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_INT_SR			_PMREG(0x028)
1308c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_INT_AP			_PMREG(0x02C)
1318c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_PIN_ER			_PMREG(0x030)
1328c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_PIN_RS			_PMREG(0x034)
1338c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_PIN_SR			_PMREG(0x038)
1348c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_PIN_AP			_PMREG(0x03C)
1358c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_HCLK_DIV			_PMREG(0x040)
1368c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_PWR_CTRL			_PMREG(0x044)
1378c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_PLL397_CTRL		_PMREG(0x048)
1388c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_MAIN_OSC_CTRL		_PMREG(0x04C)
1398c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SYSCLK_CTRL		_PMREG(0x050)
1408c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_LCDCLK_CTRL		_PMREG(0x054)
1418c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_HCLKPLL_CTRL		_PMREG(0x058)
1428c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_ADC_CLK_CTRL_1		_PMREG(0x060)
1438c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_USB_CTRL			_PMREG(0x064)
1448c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SDRAMCLK_CTRL		_PMREG(0x068)
1458c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_DDR_LAP_NOM		_PMREG(0x06C)
1468c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_DDR_LAP_COUNT		_PMREG(0x070)
1478c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_DDR_LAP_DELAY		_PMREG(0x074)
1488c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SSP_CLK_CTRL		_PMREG(0x078)
1498c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_I2S_CLK_CTRL		_PMREG(0x07C)
1508c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_MS_CTRL			_PMREG(0x080)
1518c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_MACCLK_CTRL		_PMREG(0x090)
1528c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_TEST_CLK_SEL		_PMREG(0x0A4)
1538c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SFW_INT			_PMREG(0x0A8)
1548c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_I2C_CLK_CTRL		_PMREG(0x0AC)
1558c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_KEY_CLK_CTRL		_PMREG(0x0B0)
1568c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_ADC_CLK_CTRL		_PMREG(0x0B4)
1578c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_PWM_CLK_CTRL		_PMREG(0x0B8)
1588c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_TIMER_CLK_CTRL		_PMREG(0x0BC)
1598c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_TIMERS_PWMS_CLK_CTRL_1	_PMREG(0x0C0)
1608c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SPI_CLK_CTRL		_PMREG(0x0C4)
1618c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_NAND_CLK_CTRL		_PMREG(0x0C8)
1628c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_UART3_CLK_CTRL		_PMREG(0x0D0)
1638c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_UART4_CLK_CTRL		_PMREG(0x0D4)
1648c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_UART5_CLK_CTRL		_PMREG(0x0D8)
1658c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_UART6_CLK_CTRL		_PMREG(0x0DC)
1668c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_IRDA_CLK_CTRL		_PMREG(0x0E0)
1678c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_UART_CLK_CTRL		_PMREG(0x0E4)
1688c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_DMA_CLK_CTRL		_PMREG(0x0E8)
1698c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_AUTOCLOCK		_PMREG(0x0EC)
1708c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_DEVID(x)			_PMREG(0x130 + (x))
1718c2ecf20Sopenharmony_ci
1728c2ecf20Sopenharmony_ci/*
1738c2ecf20Sopenharmony_ci * clkpwr_debug_ctrl register definitions
1748c2ecf20Sopenharmony_ci*/
1758c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_VFP_CLOCK_ENABLE_BIT	_BIT(4)
1768c2ecf20Sopenharmony_ci
1778c2ecf20Sopenharmony_ci/*
1788c2ecf20Sopenharmony_ci * clkpwr_bootmap register definitions
1798c2ecf20Sopenharmony_ci */
1808c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_BOOTMAP_SEL_BIT		_BIT(1)
1818c2ecf20Sopenharmony_ci
1828c2ecf20Sopenharmony_ci/*
1838c2ecf20Sopenharmony_ci * clkpwr_start_gpio register bit definitions
1848c2ecf20Sopenharmony_ci */
1858c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO23_BIT	_BIT(31)
1868c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO22_BIT	_BIT(30)
1878c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO21_BIT	_BIT(29)
1888c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO20_BIT	_BIT(28)
1898c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO19_BIT	_BIT(27)
1908c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO18_BIT	_BIT(26)
1918c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO17_BIT	_BIT(25)
1928c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO16_BIT	_BIT(24)
1938c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO15_BIT	_BIT(23)
1948c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO14_BIT	_BIT(22)
1958c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO13_BIT	_BIT(21)
1968c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO12_BIT	_BIT(20)
1978c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO11_BIT	_BIT(19)
1988c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO10_BIT	_BIT(18)
1998c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO9_BIT	_BIT(17)
2008c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO8_BIT	_BIT(16)
2018c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO7_BIT	_BIT(15)
2028c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO6_BIT	_BIT(14)
2038c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO5_BIT	_BIT(13)
2048c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO4_BIT	_BIT(12)
2058c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO3_BIT	_BIT(11)
2068c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO2_BIT	_BIT(10)
2078c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO1_BIT	_BIT(9)
2088c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO0_BIT	_BIT(8)
2098c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P0IO7_BIT	_BIT(7)
2108c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P0IO6_BIT	_BIT(6)
2118c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P0IO5_BIT	_BIT(5)
2128c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P0IO4_BIT	_BIT(4)
2138c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P0IO3_BIT	_BIT(3)
2148c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P0IO2_BIT	_BIT(2)
2158c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P0IO1_BIT	_BIT(1)
2168c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P0IO0_BIT	_BIT(0)
2178c2ecf20Sopenharmony_ci
2188c2ecf20Sopenharmony_ci/*
2198c2ecf20Sopenharmony_ci * clkpwr_usbclk_pdiv register definitions
2208c2ecf20Sopenharmony_ci */
2218c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_USBPDIV_PLL_MASK		0xF
2228c2ecf20Sopenharmony_ci
2238c2ecf20Sopenharmony_ci/*
2248c2ecf20Sopenharmony_ci * clkpwr_start_int, clkpwr_start_raw_sts_int, clkpwr_start_sts_int,
2258c2ecf20Sopenharmony_ci * clkpwr_start_pol_int, register bit definitions
2268c2ecf20Sopenharmony_ci */
2278c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_ADC_BIT		_BIT(31)
2288c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_TS_P_BIT		_BIT(30)
2298c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_TS_AUX_BIT	_BIT(29)
2308c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_USBAHNEEDCLK_BIT	_BIT(26)
2318c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_MSTIMER_BIT	_BIT(25)
2328c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_RTC_BIT		_BIT(24)
2338c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_USBNEEDCLK_BIT	_BIT(23)
2348c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_USB_BIT		_BIT(22)
2358c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_I2C_BIT		_BIT(21)
2368c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_USBOTGTIMER_BIT	_BIT(20)
2378c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_USBATXINT_BIT	_BIT(19)
2388c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_KEY_BIT		_BIT(16)
2398c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_MAC_BIT		_BIT(7)
2408c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_P0P1_BIT		_BIT(6)
2418c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_GPIO_05_BIT	_BIT(5)
2428c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_GPIO_04_BIT	_BIT(4)
2438c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_GPIO_03_BIT	_BIT(3)
2448c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_GPIO_02_BIT	_BIT(2)
2458c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_GPIO_01_BIT	_BIT(1)
2468c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_GPIO_00_BIT	_BIT(0)
2478c2ecf20Sopenharmony_ci
2488c2ecf20Sopenharmony_ci/*
2498c2ecf20Sopenharmony_ci * clkpwr_start_pin, clkpwr_start_raw_sts_pin, clkpwr_start_sts_pin,
2508c2ecf20Sopenharmony_ci * clkpwr_start_pol_pin register bit definitions
2518c2ecf20Sopenharmony_ci */
2528c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_U7_RX_BIT		_BIT(31)
2538c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_U7_HCTS_BIT	_BIT(30)
2548c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_U6_IRRX_BIT	_BIT(28)
2558c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_U5_RX_BIT		_BIT(26)
2568c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_GPI_28_BIT	_BIT(25)
2578c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_U3_RX_BIT		_BIT(24)
2588c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_U2_HCTS_BIT	_BIT(23)
2598c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_U2_RX_BIT		_BIT(22)
2608c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_U1_RX_BIT		_BIT(21)
2618c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_MSDIO_INT_BIT	_BIT(18)
2628c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_MSDIO_SRT_BIT	_BIT(17)
2638c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_GPI_06_BIT	_BIT(16)
2648c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_GPI_05_BIT	_BIT(15)
2658c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_GPI_04_BIT	_BIT(14)
2668c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_GPI_03_BIT	_BIT(13)
2678c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_GPI_02_BIT	_BIT(12)
2688c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_GPI_01_BIT	_BIT(11)
2698c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_GPI_00_BIT	_BIT(10)
2708c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_SYSCLKEN_BIT	_BIT(9)
2718c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_SPI1_DATIN_BIT	_BIT(8)
2728c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_GPI_07_BIT	_BIT(7)
2738c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_SPI2_DATIN_BIT	_BIT(6)
2748c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_GPI_19_BIT	_BIT(5)
2758c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_GPI_09_BIT	_BIT(4)
2768c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_GPI_08_BIT	_BIT(3)
2778c2ecf20Sopenharmony_ci
2788c2ecf20Sopenharmony_ci/*
2798c2ecf20Sopenharmony_ci * clkpwr_hclk_div register definitions
2808c2ecf20Sopenharmony_ci */
2818c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_HCLKDIV_DDRCLK_STOP	(0x0 << 7)
2828c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_HCLKDIV_DDRCLK_NORM	(0x1 << 7)
2838c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_HCLKDIV_DDRCLK_HALF	(0x2 << 7)
2848c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_HCLKDIV_PCLK_DIV(n)	(((n) & 0x1F) << 2)
2858c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_HCLKDIV_DIV_2POW(n)	((n) & 0x3)
2868c2ecf20Sopenharmony_ci
2878c2ecf20Sopenharmony_ci/*
2888c2ecf20Sopenharmony_ci * clkpwr_pwr_ctrl register definitions
2898c2ecf20Sopenharmony_ci */
2908c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_CTRL_FORCE_PCLK		_BIT(10)
2918c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SDRAM_SELF_RFSH		_BIT(9)
2928c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_UPD_SDRAM_SELF_RFSH	_BIT(8)
2938c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_AUTO_SDRAM_SELF_RFSH	_BIT(7)
2948c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_HIGHCORE_STATE_BIT	_BIT(5)
2958c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SYSCLKEN_STATE_BIT	_BIT(4)
2968c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SYSCLKEN_GPIO_EN		_BIT(3)
2978c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SELECT_RUN_MODE		_BIT(2)
2988c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_HIGHCORE_GPIO_EN		_BIT(1)
2998c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_STOP_MODE_CTRL		_BIT(0)
3008c2ecf20Sopenharmony_ci
3018c2ecf20Sopenharmony_ci/*
3028c2ecf20Sopenharmony_ci * clkpwr_pll397_ctrl register definitions
3038c2ecf20Sopenharmony_ci */
3048c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_PLL397_MSLOCK_STS	_BIT(10)
3058c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_PLL397_BYPASS		_BIT(9)
3068c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_PLL397_BIAS_NORM		0x000
3078c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_PLL397_BIAS_N12_5	0x040
3088c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_PLL397_BIAS_N25		0x080
3098c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_PLL397_BIAS_N37_5	0x0C0
3108c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_PLL397_BIAS_P12_5	0x100
3118c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_PLL397_BIAS_P25		0x140
3128c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_PLL397_BIAS_P37_5	0x180
3138c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_PLL397_BIAS_P50		0x1C0
3148c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_PLL397_BIAS_MASK		0x1C0
3158c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SYSCTRL_PLL397_DIS	_BIT(1)
3168c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SYSCTRL_PLL397_STS	_BIT(0)
3178c2ecf20Sopenharmony_ci
3188c2ecf20Sopenharmony_ci/*
3198c2ecf20Sopenharmony_ci * clkpwr_main_osc_ctrl register definitions
3208c2ecf20Sopenharmony_ci */
3218c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_MOSC_ADD_CAP(n)		(((n) & 0x7F) << 2)
3228c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_MOSC_CAP_MASK		(0x7F << 2)
3238c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_TEST_MODE		_BIT(1)
3248c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_MOSC_DISABLE		_BIT(0)
3258c2ecf20Sopenharmony_ci
3268c2ecf20Sopenharmony_ci/*
3278c2ecf20Sopenharmony_ci * clkpwr_sysclk_ctrl register definitions
3288c2ecf20Sopenharmony_ci */
3298c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SYSCTRL_BP_TRIG(n)	(((n) & 0x3FF) << 2)
3308c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SYSCTRL_BP_MASK		(0x3FF << 2)
3318c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SYSCTRL_USEPLL397	_BIT(1)
3328c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SYSCTRL_SYSCLKMUX	_BIT(0)
3338c2ecf20Sopenharmony_ci
3348c2ecf20Sopenharmony_ci/*
3358c2ecf20Sopenharmony_ci * clkpwr_lcdclk_ctrl register definitions
3368c2ecf20Sopenharmony_ci */
3378c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_TFT12	0x000
3388c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_TFT16	0x040
3398c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_TFT15	0x080
3408c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_TFT24	0x0C0
3418c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_STN4M	0x100
3428c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_STN8C	0x140
3438c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_DSTN4M	0x180
3448c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_DSTN8C	0x1C0
3458c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_MSK	0x01C0
3468c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_LCDCTRL_CLK_EN		0x020
3478c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_LCDCTRL_SET_PSCALE(n)	((n - 1) & 0x1F)
3488c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_LCDCTRL_PSCALE_MSK	0x001F
3498c2ecf20Sopenharmony_ci
3508c2ecf20Sopenharmony_ci/*
3518c2ecf20Sopenharmony_ci * clkpwr_hclkpll_ctrl register definitions
3528c2ecf20Sopenharmony_ci */
3538c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_HCLKPLL_POWER_UP		_BIT(16)
3548c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_HCLKPLL_CCO_BYPASS	_BIT(15)
3558c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_HCLKPLL_POSTDIV_BYPASS	_BIT(14)
3568c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_HCLKPLL_FDBK_SEL_FCLK	_BIT(13)
3578c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_HCLKPLL_POSTDIV_2POW(n)	(((n) & 0x3) << 11)
3588c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_HCLKPLL_PREDIV_PLUS1(n)	(((n) & 0x3) << 9)
3598c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_HCLKPLL_PLLM(n)		(((n) & 0xFF) << 1)
3608c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_HCLKPLL_PLL_STS		_BIT(0)
3618c2ecf20Sopenharmony_ci
3628c2ecf20Sopenharmony_ci/*
3638c2ecf20Sopenharmony_ci * clkpwr_adc_clk_ctrl_1 register definitions
3648c2ecf20Sopenharmony_ci */
3658c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_ADCCTRL1_RTDIV(n)	(((n) & 0xFF) << 0)
3668c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_ADCCTRL1_PCLK_SEL	_BIT(8)
3678c2ecf20Sopenharmony_ci
3688c2ecf20Sopenharmony_ci/*
3698c2ecf20Sopenharmony_ci * clkpwr_usb_ctrl register definitions
3708c2ecf20Sopenharmony_ci */
3718c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_USBCTRL_HCLK_EN		_BIT(24)
3728c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_USBCTRL_USBI2C_EN	_BIT(23)
3738c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_USBCTRL_USBDVND_EN	_BIT(22)
3748c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_USBCTRL_USBHSTND_EN	_BIT(21)
3758c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_USBCTRL_PU_ADD		(0x0 << 19)
3768c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_USBCTRL_BUS_KEEPER	(0x1 << 19)
3778c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_USBCTRL_PD_ADD		(0x3 << 19)
3788c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_USBCTRL_CLK_EN2		_BIT(18)
3798c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_USBCTRL_CLK_EN1		_BIT(17)
3808c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_USBCTRL_PLL_PWRUP	_BIT(16)
3818c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_USBCTRL_CCO_BYPASS	_BIT(15)
3828c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_USBCTRL_POSTDIV_BYPASS	_BIT(14)
3838c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_USBCTRL_FDBK_SEL_FCLK	_BIT(13)
3848c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_USBCTRL_POSTDIV_2POW(n)	(((n) & 0x3) << 11)
3858c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_USBCTRL_PREDIV_PLUS1(n)	(((n) & 0x3) << 9)
3868c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_USBCTRL_FDBK_PLUS1(n)	(((n) & 0xFF) << 1)
3878c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_USBCTRL_PLL_STS		_BIT(0)
3888c2ecf20Sopenharmony_ci
3898c2ecf20Sopenharmony_ci/*
3908c2ecf20Sopenharmony_ci * clkpwr_sdramclk_ctrl register definitions
3918c2ecf20Sopenharmony_ci */
3928c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SDRCLK_FASTSLEW_CLK	_BIT(22)
3938c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SDRCLK_FASTSLEW		_BIT(21)
3948c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SDRCLK_FASTSLEW_DAT	_BIT(20)
3958c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SDRCLK_SW_DDR_RESET	_BIT(19)
3968c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SDRCLK_HCLK_DLY(n)	(((n) & 0x1F) << 14)
3978c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SDRCLK_DLY_ADDR_STS	_BIT(13)
3988c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SDRCLK_SENS_FACT(n)	(((n) & 0x7) << 10)
3998c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SDRCLK_USE_CAL		_BIT(9)
4008c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SDRCLK_DO_CAL		_BIT(8)
4018c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SDRCLK_CAL_ON_RTC	_BIT(7)
4028c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SDRCLK_DQS_DLY(n)	(((n) & 0x1F) << 2)
4038c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SDRCLK_USE_DDR		_BIT(1)
4048c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SDRCLK_CLK_DIS		_BIT(0)
4058c2ecf20Sopenharmony_ci
4068c2ecf20Sopenharmony_ci/*
4078c2ecf20Sopenharmony_ci * clkpwr_ssp_blk_ctrl register definitions
4088c2ecf20Sopenharmony_ci */
4098c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SSPCTRL_DMA_SSP1RX	_BIT(5)
4108c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SSPCTRL_DMA_SSP1TX	_BIT(4)
4118c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SSPCTRL_DMA_SSP0RX	_BIT(3)
4128c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SSPCTRL_DMA_SSP0TX	_BIT(2)
4138c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SSPCTRL_SSPCLK1_EN	_BIT(1)
4148c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SSPCTRL_SSPCLK0_EN	_BIT(0)
4158c2ecf20Sopenharmony_ci
4168c2ecf20Sopenharmony_ci/*
4178c2ecf20Sopenharmony_ci * clkpwr_i2s_clk_ctrl register definitions
4188c2ecf20Sopenharmony_ci */
4198c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_I2SCTRL_I2S1_RX_FOR_TX	_BIT(6)
4208c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_I2SCTRL_I2S1_TX_FOR_RX	_BIT(5)
4218c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_I2SCTRL_I2S1_USE_DMA	_BIT(4)
4228c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_I2SCTRL_I2S0_RX_FOR_TX	_BIT(3)
4238c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_I2SCTRL_I2S0_TX_FOR_RX	_BIT(2)
4248c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_I2SCTRL_I2SCLK1_EN	_BIT(1)
4258c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_I2SCTRL_I2SCLK0_EN	_BIT(0)
4268c2ecf20Sopenharmony_ci
4278c2ecf20Sopenharmony_ci/*
4288c2ecf20Sopenharmony_ci * clkpwr_ms_ctrl register definitions
4298c2ecf20Sopenharmony_ci */
4308c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_MSCARD_MSDIO_PIN_DIS	_BIT(10)
4318c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_MSCARD_MSDIO_PU_EN	_BIT(9)
4328c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_MSCARD_MSDIO23_DIS	_BIT(8)
4338c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_MSCARD_MSDIO1_DIS	_BIT(7)
4348c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_MSCARD_MSDIO0_DIS	_BIT(6)
4358c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_MSCARD_SDCARD_EN		_BIT(5)
4368c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_MSCARD_SDCARD_DIV(n)	((n) & 0xF)
4378c2ecf20Sopenharmony_ci
4388c2ecf20Sopenharmony_ci/*
4398c2ecf20Sopenharmony_ci * clkpwr_macclk_ctrl register definitions
4408c2ecf20Sopenharmony_ci */
4418c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_MACCTRL_NO_ENET_PIS	0x00
4428c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_MACCTRL_USE_MII_PINS	0x08
4438c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_MACCTRL_USE_RMII_PINS	0x18
4448c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_MACCTRL_PINS_MSK		0x18
4458c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_MACCTRL_DMACLK_EN	_BIT(2)
4468c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_MACCTRL_MMIOCLK_EN	_BIT(1)
4478c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_MACCTRL_HRCCLK_EN	_BIT(0)
4488c2ecf20Sopenharmony_ci
4498c2ecf20Sopenharmony_ci/*
4508c2ecf20Sopenharmony_ci * clkpwr_test_clk_sel register definitions
4518c2ecf20Sopenharmony_ci */
4528c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_TESTCLK1_SEL_PERCLK	(0x0 << 5)
4538c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_TESTCLK1_SEL_RTC		(0x1 << 5)
4548c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_TESTCLK1_SEL_MOSC	(0x2 << 5)
4558c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_TESTCLK1_SEL_MASK	(0x3 << 5)
4568c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_TESTCLK_TESTCLK1_EN	_BIT(4)
4578c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_TESTCLK2_SEL_HCLK	(0x0 << 1)
4588c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_TESTCLK2_SEL_PERCLK	(0x1 << 1)
4598c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_TESTCLK2_SEL_USBCLK	(0x2 << 1)
4608c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_TESTCLK2_SEL_MOSC	(0x5 << 1)
4618c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_TESTCLK2_SEL_PLL397	(0x7 << 1)
4628c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_TESTCLK2_SEL_MASK	(0x7 << 1)
4638c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_TESTCLK_TESTCLK2_EN	_BIT(0)
4648c2ecf20Sopenharmony_ci
4658c2ecf20Sopenharmony_ci/*
4668c2ecf20Sopenharmony_ci * clkpwr_sw_int register definitions
4678c2ecf20Sopenharmony_ci */
4688c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SW_INT(n)		(_BIT(0) | (((n) & 0x7F) << 1))
4698c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SW_GET_ARG(n)		(((n) & 0xFE) >> 1)
4708c2ecf20Sopenharmony_ci
4718c2ecf20Sopenharmony_ci/*
4728c2ecf20Sopenharmony_ci * clkpwr_i2c_clk_ctrl register definitions
4738c2ecf20Sopenharmony_ci */
4748c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_I2CCLK_USBI2CHI_DRIVE	_BIT(4)
4758c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_I2CCLK_I2C2HI_DRIVE	_BIT(3)
4768c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_I2CCLK_I2C1HI_DRIVE	_BIT(2)
4778c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_I2CCLK_I2C2CLK_EN	_BIT(1)
4788c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_I2CCLK_I2C1CLK_EN	_BIT(0)
4798c2ecf20Sopenharmony_ci
4808c2ecf20Sopenharmony_ci/*
4818c2ecf20Sopenharmony_ci * clkpwr_key_clk_ctrl register definitions
4828c2ecf20Sopenharmony_ci */
4838c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_KEYCLKCTRL_CLK_EN	0x1
4848c2ecf20Sopenharmony_ci
4858c2ecf20Sopenharmony_ci/*
4868c2ecf20Sopenharmony_ci * clkpwr_adc_clk_ctrl register definitions
4878c2ecf20Sopenharmony_ci */
4888c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_ADC32CLKCTRL_CLK_EN	0x1
4898c2ecf20Sopenharmony_ci
4908c2ecf20Sopenharmony_ci/*
4918c2ecf20Sopenharmony_ci * clkpwr_pwm_clk_ctrl register definitions
4928c2ecf20Sopenharmony_ci */
4938c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_PWMCLK_PWM2_DIV(n)	(((n) & 0xF) << 8)
4948c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_PWMCLK_PWM1_DIV(n)	(((n) & 0xF) << 4)
4958c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_PWMCLK_PWM2SEL_PCLK	0x8
4968c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_PWMCLK_PWM2CLK_EN	0x4
4978c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_PWMCLK_PWM1SEL_PCLK	0x2
4988c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_PWMCLK_PWM1CLK_EN	0x1
4998c2ecf20Sopenharmony_ci
5008c2ecf20Sopenharmony_ci/*
5018c2ecf20Sopenharmony_ci * clkpwr_timer_clk_ctrl register definitions
5028c2ecf20Sopenharmony_ci */
5038c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_PWMCLK_HSTIMER_EN	0x2
5048c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_PWMCLK_WDOG_EN		0x1
5058c2ecf20Sopenharmony_ci
5068c2ecf20Sopenharmony_ci/*
5078c2ecf20Sopenharmony_ci * clkpwr_timers_pwms_clk_ctrl_1 register definitions
5088c2ecf20Sopenharmony_ci */
5098c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_TMRPWMCLK_MPWM_EN	0x40
5108c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_TMRPWMCLK_TIMER3_EN	0x20
5118c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_TMRPWMCLK_TIMER2_EN	0x10
5128c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_TMRPWMCLK_TIMER1_EN	0x08
5138c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_TMRPWMCLK_TIMER0_EN	0x04
5148c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_TMRPWMCLK_PWM4_EN	0x02
5158c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_TMRPWMCLK_PWM3_EN	0x01
5168c2ecf20Sopenharmony_ci
5178c2ecf20Sopenharmony_ci/*
5188c2ecf20Sopenharmony_ci * clkpwr_spi_clk_ctrl register definitions
5198c2ecf20Sopenharmony_ci */
5208c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SPICLK_SET_SPI2DATIO	0x80
5218c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SPICLK_SET_SPI2CLK	0x40
5228c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SPICLK_USE_SPI2		0x20
5238c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SPICLK_SPI2CLK_EN	0x10
5248c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SPICLK_SET_SPI1DATIO	0x08
5258c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SPICLK_SET_SPI1CLK	0x04
5268c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SPICLK_USE_SPI1		0x02
5278c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_SPICLK_SPI1CLK_EN	0x01
5288c2ecf20Sopenharmony_ci
5298c2ecf20Sopenharmony_ci/*
5308c2ecf20Sopenharmony_ci * clkpwr_nand_clk_ctrl register definitions
5318c2ecf20Sopenharmony_ci */
5328c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_NANDCLK_INTSEL_MLC	0x20
5338c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_NANDCLK_DMA_RNB		0x10
5348c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_NANDCLK_DMA_INT		0x08
5358c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_NANDCLK_SEL_SLC		0x04
5368c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_NANDCLK_MLCCLK_EN	0x02
5378c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_NANDCLK_SLCCLK_EN	0x01
5388c2ecf20Sopenharmony_ci
5398c2ecf20Sopenharmony_ci/*
5408c2ecf20Sopenharmony_ci * clkpwr_uart3_clk_ctrl, clkpwr_uart4_clk_ctrl, clkpwr_uart5_clk_ctrl
5418c2ecf20Sopenharmony_ci * and clkpwr_uart6_clk_ctrl register definitions
5428c2ecf20Sopenharmony_ci */
5438c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_UART_Y_DIV(y)		((y) & 0xFF)
5448c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_UART_X_DIV(x)		(((x) & 0xFF) << 8)
5458c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_UART_USE_HCLK		_BIT(16)
5468c2ecf20Sopenharmony_ci
5478c2ecf20Sopenharmony_ci/*
5488c2ecf20Sopenharmony_ci * clkpwr_irda_clk_ctrl register definitions
5498c2ecf20Sopenharmony_ci */
5508c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_IRDA_Y_DIV(y)		((y) & 0xFF)
5518c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_IRDA_X_DIV(x)		(((x) & 0xFF) << 8)
5528c2ecf20Sopenharmony_ci
5538c2ecf20Sopenharmony_ci/*
5548c2ecf20Sopenharmony_ci * clkpwr_uart_clk_ctrl register definitions
5558c2ecf20Sopenharmony_ci */
5568c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_UARTCLKCTRL_UART6_EN	_BIT(3)
5578c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_UARTCLKCTRL_UART5_EN	_BIT(2)
5588c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_UARTCLKCTRL_UART4_EN	_BIT(1)
5598c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_UARTCLKCTRL_UART3_EN	_BIT(0)
5608c2ecf20Sopenharmony_ci
5618c2ecf20Sopenharmony_ci/*
5628c2ecf20Sopenharmony_ci * clkpwr_dmaclk_ctrl register definitions
5638c2ecf20Sopenharmony_ci */
5648c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_DMACLKCTRL_CLK_EN	0x1
5658c2ecf20Sopenharmony_ci
5668c2ecf20Sopenharmony_ci/*
5678c2ecf20Sopenharmony_ci * clkpwr_autoclock register definitions
5688c2ecf20Sopenharmony_ci */
5698c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_AUTOCLK_USB_EN		0x40
5708c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_AUTOCLK_IRAM_EN		0x02
5718c2ecf20Sopenharmony_ci#define LPC32XX_CLKPWR_AUTOCLK_IROM_EN		0x01
5728c2ecf20Sopenharmony_ci
5738c2ecf20Sopenharmony_ci/*
5748c2ecf20Sopenharmony_ci * Interrupt controller register offsets
5758c2ecf20Sopenharmony_ci */
5768c2ecf20Sopenharmony_ci#define LPC32XX_INTC_MASK(x)			io_p2v((x) + 0x00)
5778c2ecf20Sopenharmony_ci#define LPC32XX_INTC_RAW_STAT(x)		io_p2v((x) + 0x04)
5788c2ecf20Sopenharmony_ci#define LPC32XX_INTC_STAT(x)			io_p2v((x) + 0x08)
5798c2ecf20Sopenharmony_ci#define LPC32XX_INTC_POLAR(x)			io_p2v((x) + 0x0C)
5808c2ecf20Sopenharmony_ci#define LPC32XX_INTC_ACT_TYPE(x)		io_p2v((x) + 0x10)
5818c2ecf20Sopenharmony_ci#define LPC32XX_INTC_TYPE(x)			io_p2v((x) + 0x14)
5828c2ecf20Sopenharmony_ci
5838c2ecf20Sopenharmony_ci/*
5848c2ecf20Sopenharmony_ci * Timer/counter register offsets
5858c2ecf20Sopenharmony_ci */
5868c2ecf20Sopenharmony_ci#define LPC32XX_TIMER_IR(x)			io_p2v((x) + 0x00)
5878c2ecf20Sopenharmony_ci#define LPC32XX_TIMER_TCR(x)			io_p2v((x) + 0x04)
5888c2ecf20Sopenharmony_ci#define LPC32XX_TIMER_TC(x)			io_p2v((x) + 0x08)
5898c2ecf20Sopenharmony_ci#define LPC32XX_TIMER_PR(x)			io_p2v((x) + 0x0C)
5908c2ecf20Sopenharmony_ci#define LPC32XX_TIMER_PC(x)			io_p2v((x) + 0x10)
5918c2ecf20Sopenharmony_ci#define LPC32XX_TIMER_MCR(x)			io_p2v((x) + 0x14)
5928c2ecf20Sopenharmony_ci#define LPC32XX_TIMER_MR0(x)			io_p2v((x) + 0x18)
5938c2ecf20Sopenharmony_ci#define LPC32XX_TIMER_MR1(x)			io_p2v((x) + 0x1C)
5948c2ecf20Sopenharmony_ci#define LPC32XX_TIMER_MR2(x)			io_p2v((x) + 0x20)
5958c2ecf20Sopenharmony_ci#define LPC32XX_TIMER_MR3(x)			io_p2v((x) + 0x24)
5968c2ecf20Sopenharmony_ci#define LPC32XX_TIMER_CCR(x)			io_p2v((x) + 0x28)
5978c2ecf20Sopenharmony_ci#define LPC32XX_TIMER_CR0(x)			io_p2v((x) + 0x2C)
5988c2ecf20Sopenharmony_ci#define LPC32XX_TIMER_CR1(x)			io_p2v((x) + 0x30)
5998c2ecf20Sopenharmony_ci#define LPC32XX_TIMER_CR2(x)			io_p2v((x) + 0x34)
6008c2ecf20Sopenharmony_ci#define LPC32XX_TIMER_CR3(x)			io_p2v((x) + 0x38)
6018c2ecf20Sopenharmony_ci#define LPC32XX_TIMER_EMR(x)			io_p2v((x) + 0x3C)
6028c2ecf20Sopenharmony_ci#define LPC32XX_TIMER_CTCR(x)			io_p2v((x) + 0x70)
6038c2ecf20Sopenharmony_ci
6048c2ecf20Sopenharmony_ci/*
6058c2ecf20Sopenharmony_ci * ir register definitions
6068c2ecf20Sopenharmony_ci */
6078c2ecf20Sopenharmony_ci#define LPC32XX_TIMER_CNTR_MTCH_BIT(n)		(1 << ((n) & 0x3))
6088c2ecf20Sopenharmony_ci#define LPC32XX_TIMER_CNTR_CAPT_BIT(n)		(1 << (4 + ((n) & 0x3)))
6098c2ecf20Sopenharmony_ci
6108c2ecf20Sopenharmony_ci/*
6118c2ecf20Sopenharmony_ci * tcr register definitions
6128c2ecf20Sopenharmony_ci */
6138c2ecf20Sopenharmony_ci#define LPC32XX_TIMER_CNTR_TCR_EN		0x1
6148c2ecf20Sopenharmony_ci#define LPC32XX_TIMER_CNTR_TCR_RESET		0x2
6158c2ecf20Sopenharmony_ci
6168c2ecf20Sopenharmony_ci/*
6178c2ecf20Sopenharmony_ci * mcr register definitions
6188c2ecf20Sopenharmony_ci */
6198c2ecf20Sopenharmony_ci#define LPC32XX_TIMER_CNTR_MCR_MTCH(n)		(0x1 << ((n) * 3))
6208c2ecf20Sopenharmony_ci#define LPC32XX_TIMER_CNTR_MCR_RESET(n)		(0x1 << (((n) * 3) + 1))
6218c2ecf20Sopenharmony_ci#define LPC32XX_TIMER_CNTR_MCR_STOP(n)		(0x1 << (((n) * 3) + 2))
6228c2ecf20Sopenharmony_ci
6238c2ecf20Sopenharmony_ci/*
6248c2ecf20Sopenharmony_ci * Standard UART register offsets
6258c2ecf20Sopenharmony_ci */
6268c2ecf20Sopenharmony_ci#define LPC32XX_UART_DLL_FIFO(x)		io_p2v((x) + 0x00)
6278c2ecf20Sopenharmony_ci#define LPC32XX_UART_DLM_IER(x)			io_p2v((x) + 0x04)
6288c2ecf20Sopenharmony_ci#define LPC32XX_UART_IIR_FCR(x)			io_p2v((x) + 0x08)
6298c2ecf20Sopenharmony_ci#define LPC32XX_UART_LCR(x)			io_p2v((x) + 0x0C)
6308c2ecf20Sopenharmony_ci#define LPC32XX_UART_MODEM_CTRL(x)		io_p2v((x) + 0x10)
6318c2ecf20Sopenharmony_ci#define LPC32XX_UART_LSR(x)			io_p2v((x) + 0x14)
6328c2ecf20Sopenharmony_ci#define LPC32XX_UART_MODEM_STATUS(x)		io_p2v((x) + 0x18)
6338c2ecf20Sopenharmony_ci#define LPC32XX_UART_RXLEV(x)			io_p2v((x) + 0x1C)
6348c2ecf20Sopenharmony_ci
6358c2ecf20Sopenharmony_ci/*
6368c2ecf20Sopenharmony_ci * UART control structure offsets
6378c2ecf20Sopenharmony_ci */
6388c2ecf20Sopenharmony_ci#define _UCREG(x)				io_p2v(\
6398c2ecf20Sopenharmony_ci						LPC32XX_UART_CTRL_BASE + (x))
6408c2ecf20Sopenharmony_ci#define LPC32XX_UARTCTL_CTRL			_UCREG(0x00)
6418c2ecf20Sopenharmony_ci#define LPC32XX_UARTCTL_CLKMODE			_UCREG(0x04)
6428c2ecf20Sopenharmony_ci#define LPC32XX_UARTCTL_CLOOP			_UCREG(0x08)
6438c2ecf20Sopenharmony_ci
6448c2ecf20Sopenharmony_ci/*
6458c2ecf20Sopenharmony_ci * ctrl register definitions
6468c2ecf20Sopenharmony_ci */
6478c2ecf20Sopenharmony_ci#define LPC32XX_UART_U3_MD_CTRL_EN		_BIT(11)
6488c2ecf20Sopenharmony_ci#define LPC32XX_UART_IRRX6_INV_EN		_BIT(10)
6498c2ecf20Sopenharmony_ci#define LPC32XX_UART_HDPX_EN			_BIT(9)
6508c2ecf20Sopenharmony_ci#define LPC32XX_UART_UART6_IRDAMOD_BYPASS	_BIT(5)
6518c2ecf20Sopenharmony_ci#define LPC32XX_RT_IRTX6_INV_EN			_BIT(4)
6528c2ecf20Sopenharmony_ci#define LPC32XX_RT_IRTX6_INV_MIR_EN		_BIT(3)
6538c2ecf20Sopenharmony_ci#define LPC32XX_RT_RX_IRPULSE_3_16_115K		_BIT(2)
6548c2ecf20Sopenharmony_ci#define LPC32XX_RT_TX_IRPULSE_3_16_115K		_BIT(1)
6558c2ecf20Sopenharmony_ci#define LPC32XX_UART_U5_ROUTE_TO_USB		_BIT(0)
6568c2ecf20Sopenharmony_ci
6578c2ecf20Sopenharmony_ci/*
6588c2ecf20Sopenharmony_ci * clkmode register definitions
6598c2ecf20Sopenharmony_ci */
6608c2ecf20Sopenharmony_ci#define LPC32XX_UART_ENABLED_CLOCKS(n)		(((n) >> 16) & 0x7F)
6618c2ecf20Sopenharmony_ci#define LPC32XX_UART_ENABLED_CLOCK(n, u)	(((n) >> (16 + (u))) & 0x1)
6628c2ecf20Sopenharmony_ci#define LPC32XX_UART_ENABLED_CLKS_ANY		_BIT(14)
6638c2ecf20Sopenharmony_ci#define LPC32XX_UART_CLKMODE_OFF		0x0
6648c2ecf20Sopenharmony_ci#define LPC32XX_UART_CLKMODE_ON			0x1
6658c2ecf20Sopenharmony_ci#define LPC32XX_UART_CLKMODE_AUTO		0x2
6668c2ecf20Sopenharmony_ci#define LPC32XX_UART_CLKMODE_MASK(u)		(0x3 << ((((u) - 3) * 2) + 4))
6678c2ecf20Sopenharmony_ci#define LPC32XX_UART_CLKMODE_LOAD(m, u)		((m) << ((((u) - 3) * 2) + 4))
6688c2ecf20Sopenharmony_ci
6698c2ecf20Sopenharmony_ci/*
6708c2ecf20Sopenharmony_ci * GPIO Module Register offsets
6718c2ecf20Sopenharmony_ci */
6728c2ecf20Sopenharmony_ci#define _GPREG(x)				io_p2v(LPC32XX_GPIO_BASE + (x))
6738c2ecf20Sopenharmony_ci#define LPC32XX_GPIO_P_MUX_SET			_GPREG(0x100)
6748c2ecf20Sopenharmony_ci#define LPC32XX_GPIO_P_MUX_CLR			_GPREG(0x104)
6758c2ecf20Sopenharmony_ci#define LPC32XX_GPIO_P_MUX_STATE		_GPREG(0x108)
6768c2ecf20Sopenharmony_ci#define LPC32XX_GPIO_P3_MUX_SET			_GPREG(0x110)
6778c2ecf20Sopenharmony_ci#define LPC32XX_GPIO_P3_MUX_CLR			_GPREG(0x114)
6788c2ecf20Sopenharmony_ci#define LPC32XX_GPIO_P3_MUX_STATE		_GPREG(0x118)
6798c2ecf20Sopenharmony_ci#define LPC32XX_GPIO_P0_MUX_SET			_GPREG(0x120)
6808c2ecf20Sopenharmony_ci#define LPC32XX_GPIO_P0_MUX_CLR			_GPREG(0x124)
6818c2ecf20Sopenharmony_ci#define LPC32XX_GPIO_P0_MUX_STATE		_GPREG(0x128)
6828c2ecf20Sopenharmony_ci#define LPC32XX_GPIO_P1_MUX_SET			_GPREG(0x130)
6838c2ecf20Sopenharmony_ci#define LPC32XX_GPIO_P1_MUX_CLR			_GPREG(0x134)
6848c2ecf20Sopenharmony_ci#define LPC32XX_GPIO_P1_MUX_STATE		_GPREG(0x138)
6858c2ecf20Sopenharmony_ci#define LPC32XX_GPIO_P2_MUX_SET			_GPREG(0x028)
6868c2ecf20Sopenharmony_ci#define LPC32XX_GPIO_P2_MUX_CLR			_GPREG(0x02C)
6878c2ecf20Sopenharmony_ci#define LPC32XX_GPIO_P2_MUX_STATE		_GPREG(0x030)
6888c2ecf20Sopenharmony_ci
6898c2ecf20Sopenharmony_ci/*
6908c2ecf20Sopenharmony_ci * USB Otg Registers
6918c2ecf20Sopenharmony_ci */
6928c2ecf20Sopenharmony_ci#define _OTGREG(x)			io_p2v(LPC32XX_USB_OTG_BASE + (x))
6938c2ecf20Sopenharmony_ci#define LPC32XX_USB_OTG_CLK_CTRL	_OTGREG(0xFF4)
6948c2ecf20Sopenharmony_ci#define LPC32XX_USB_OTG_CLK_STAT	_OTGREG(0xFF8)
6958c2ecf20Sopenharmony_ci
6968c2ecf20Sopenharmony_ci/* USB OTG CLK CTRL bit defines */
6978c2ecf20Sopenharmony_ci#define LPC32XX_USB_OTG_AHB_M_CLOCK_ON	_BIT(4)
6988c2ecf20Sopenharmony_ci#define LPC32XX_USB_OTG_OTG_CLOCK_ON	_BIT(3)
6998c2ecf20Sopenharmony_ci#define LPC32XX_USB_OTG_I2C_CLOCK_ON	_BIT(2)
7008c2ecf20Sopenharmony_ci#define LPC32XX_USB_OTG_DEV_CLOCK_ON	_BIT(1)
7018c2ecf20Sopenharmony_ci#define LPC32XX_USB_OTG_HOST_CLOCK_ON	_BIT(0)
7028c2ecf20Sopenharmony_ci
7038c2ecf20Sopenharmony_ci/*
7048c2ecf20Sopenharmony_ci * Start of virtual addresses for IO devices
7058c2ecf20Sopenharmony_ci */
7068c2ecf20Sopenharmony_ci#define IO_BASE		0xF0000000
7078c2ecf20Sopenharmony_ci
7088c2ecf20Sopenharmony_ci/*
7098c2ecf20Sopenharmony_ci * This macro relies on fact that for all HW i/o addresses bits 20-23 are 0
7108c2ecf20Sopenharmony_ci */
7118c2ecf20Sopenharmony_ci#define IO_ADDRESS(x)	IOMEM(((((x) & 0xff000000) >> 4) | ((x) & 0xfffff)) |\
7128c2ecf20Sopenharmony_ci			 IO_BASE)
7138c2ecf20Sopenharmony_ci
7148c2ecf20Sopenharmony_ci#define io_p2v(x)	((void __iomem *) (unsigned long) IO_ADDRESS(x))
7158c2ecf20Sopenharmony_ci#define io_v2p(x)	((((x) & 0x0ff00000) << 4) | ((x) & 0x000fffff))
7168c2ecf20Sopenharmony_ci
7178c2ecf20Sopenharmony_ci#endif
718