162306a36Sopenharmony_ci/* SPDX-License-Identifier: GPL-2.0-or-later */ 262306a36Sopenharmony_ci/* 362306a36Sopenharmony_ci * arch/arm/mach-lpc32xx/include/mach/platform.h 462306a36Sopenharmony_ci * 562306a36Sopenharmony_ci * Author: Kevin Wells <kevin.wells@nxp.com> 662306a36Sopenharmony_ci * 762306a36Sopenharmony_ci * Copyright (C) 2010 NXP Semiconductors 862306a36Sopenharmony_ci */ 962306a36Sopenharmony_ci 1062306a36Sopenharmony_ci#ifndef __ARM_LPC32XX_H 1162306a36Sopenharmony_ci#define __ARM_LPC32XX_H 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci#define _SBF(f, v) ((v) << (f)) 1462306a36Sopenharmony_ci#define _BIT(n) _SBF(n, 1) 1562306a36Sopenharmony_ci 1662306a36Sopenharmony_ci/* 1762306a36Sopenharmony_ci * AHB 0 physical base addresses 1862306a36Sopenharmony_ci */ 1962306a36Sopenharmony_ci#define LPC32XX_SLC_BASE 0x20020000 2062306a36Sopenharmony_ci#define LPC32XX_SSP0_BASE 0x20084000 2162306a36Sopenharmony_ci#define LPC32XX_SPI1_BASE 0x20088000 2262306a36Sopenharmony_ci#define LPC32XX_SSP1_BASE 0x2008C000 2362306a36Sopenharmony_ci#define LPC32XX_SPI2_BASE 0x20090000 2462306a36Sopenharmony_ci#define LPC32XX_I2S0_BASE 0x20094000 2562306a36Sopenharmony_ci#define LPC32XX_SD_BASE 0x20098000 2662306a36Sopenharmony_ci#define LPC32XX_I2S1_BASE 0x2009C000 2762306a36Sopenharmony_ci#define LPC32XX_MLC_BASE 0x200A8000 2862306a36Sopenharmony_ci#define LPC32XX_AHB0_START LPC32XX_SLC_BASE 2962306a36Sopenharmony_ci#define LPC32XX_AHB0_SIZE 0x00089000 3062306a36Sopenharmony_ci 3162306a36Sopenharmony_ci/* 3262306a36Sopenharmony_ci * AHB 1 physical base addresses 3362306a36Sopenharmony_ci */ 3462306a36Sopenharmony_ci#define LPC32XX_DMA_BASE 0x31000000 3562306a36Sopenharmony_ci#define LPC32XX_USB_BASE 0x31020000 3662306a36Sopenharmony_ci#define LPC32XX_USBH_BASE 0x31020000 3762306a36Sopenharmony_ci#define LPC32XX_USB_OTG_BASE 0x31020000 3862306a36Sopenharmony_ci#define LPC32XX_OTG_I2C_BASE 0x31020300 3962306a36Sopenharmony_ci#define LPC32XX_LCD_BASE 0x31040000 4062306a36Sopenharmony_ci#define LPC32XX_ETHERNET_BASE 0x31060000 4162306a36Sopenharmony_ci#define LPC32XX_EMC_BASE 0x31080000 4262306a36Sopenharmony_ci#define LPC32XX_ETB_CFG_BASE 0x310C0000 4362306a36Sopenharmony_ci#define LPC32XX_ETB_DATA_BASE 0x310E0000 4462306a36Sopenharmony_ci#define LPC32XX_AHB1_START LPC32XX_DMA_BASE 4562306a36Sopenharmony_ci#define LPC32XX_AHB1_SIZE 0x000E1000 4662306a36Sopenharmony_ci 4762306a36Sopenharmony_ci/* 4862306a36Sopenharmony_ci * FAB physical base addresses 4962306a36Sopenharmony_ci */ 5062306a36Sopenharmony_ci#define LPC32XX_CLK_PM_BASE 0x40004000 5162306a36Sopenharmony_ci#define LPC32XX_MIC_BASE 0x40008000 5262306a36Sopenharmony_ci#define LPC32XX_SIC1_BASE 0x4000C000 5362306a36Sopenharmony_ci#define LPC32XX_SIC2_BASE 0x40010000 5462306a36Sopenharmony_ci#define LPC32XX_HS_UART1_BASE 0x40014000 5562306a36Sopenharmony_ci#define LPC32XX_HS_UART2_BASE 0x40018000 5662306a36Sopenharmony_ci#define LPC32XX_HS_UART7_BASE 0x4001C000 5762306a36Sopenharmony_ci#define LPC32XX_RTC_BASE 0x40024000 5862306a36Sopenharmony_ci#define LPC32XX_RTC_RAM_BASE 0x40024080 5962306a36Sopenharmony_ci#define LPC32XX_GPIO_BASE 0x40028000 6062306a36Sopenharmony_ci#define LPC32XX_PWM3_BASE 0x4002C000 6162306a36Sopenharmony_ci#define LPC32XX_PWM4_BASE 0x40030000 6262306a36Sopenharmony_ci#define LPC32XX_MSTIM_BASE 0x40034000 6362306a36Sopenharmony_ci#define LPC32XX_HSTIM_BASE 0x40038000 6462306a36Sopenharmony_ci#define LPC32XX_WDTIM_BASE 0x4003C000 6562306a36Sopenharmony_ci#define LPC32XX_DEBUG_CTRL_BASE 0x40040000 6662306a36Sopenharmony_ci#define LPC32XX_TIMER0_BASE 0x40044000 6762306a36Sopenharmony_ci#define LPC32XX_ADC_BASE 0x40048000 6862306a36Sopenharmony_ci#define LPC32XX_TIMER1_BASE 0x4004C000 6962306a36Sopenharmony_ci#define LPC32XX_KSCAN_BASE 0x40050000 7062306a36Sopenharmony_ci#define LPC32XX_UART_CTRL_BASE 0x40054000 7162306a36Sopenharmony_ci#define LPC32XX_TIMER2_BASE 0x40058000 7262306a36Sopenharmony_ci#define LPC32XX_PWM1_BASE 0x4005C000 7362306a36Sopenharmony_ci#define LPC32XX_PWM2_BASE 0x4005C004 7462306a36Sopenharmony_ci#define LPC32XX_TIMER3_BASE 0x40060000 7562306a36Sopenharmony_ci 7662306a36Sopenharmony_ci/* 7762306a36Sopenharmony_ci * APB physical base addresses 7862306a36Sopenharmony_ci */ 7962306a36Sopenharmony_ci#define LPC32XX_UART3_BASE 0x40080000 8062306a36Sopenharmony_ci#define LPC32XX_UART4_BASE 0x40088000 8162306a36Sopenharmony_ci#define LPC32XX_UART5_BASE 0x40090000 8262306a36Sopenharmony_ci#define LPC32XX_UART6_BASE 0x40098000 8362306a36Sopenharmony_ci#define LPC32XX_I2C1_BASE 0x400A0000 8462306a36Sopenharmony_ci#define LPC32XX_I2C2_BASE 0x400A8000 8562306a36Sopenharmony_ci 8662306a36Sopenharmony_ci/* 8762306a36Sopenharmony_ci * FAB and APB base and sizing 8862306a36Sopenharmony_ci */ 8962306a36Sopenharmony_ci#define LPC32XX_FABAPB_START LPC32XX_CLK_PM_BASE 9062306a36Sopenharmony_ci#define LPC32XX_FABAPB_SIZE 0x000A5000 9162306a36Sopenharmony_ci 9262306a36Sopenharmony_ci/* 9362306a36Sopenharmony_ci * Internal memory bases and sizes 9462306a36Sopenharmony_ci */ 9562306a36Sopenharmony_ci#define LPC32XX_IRAM_BASE 0x08000000 9662306a36Sopenharmony_ci#define LPC32XX_IROM_BASE 0x0C000000 9762306a36Sopenharmony_ci 9862306a36Sopenharmony_ci/* 9962306a36Sopenharmony_ci * External Static Memory Bank Address Space Bases 10062306a36Sopenharmony_ci */ 10162306a36Sopenharmony_ci#define LPC32XX_EMC_CS0_BASE 0xE0000000 10262306a36Sopenharmony_ci#define LPC32XX_EMC_CS1_BASE 0xE1000000 10362306a36Sopenharmony_ci#define LPC32XX_EMC_CS2_BASE 0xE2000000 10462306a36Sopenharmony_ci#define LPC32XX_EMC_CS3_BASE 0xE3000000 10562306a36Sopenharmony_ci 10662306a36Sopenharmony_ci/* 10762306a36Sopenharmony_ci * External SDRAM Memory Bank Address Space Bases 10862306a36Sopenharmony_ci */ 10962306a36Sopenharmony_ci#define LPC32XX_EMC_DYCS0_BASE 0x80000000 11062306a36Sopenharmony_ci#define LPC32XX_EMC_DYCS1_BASE 0xA0000000 11162306a36Sopenharmony_ci 11262306a36Sopenharmony_ci/* 11362306a36Sopenharmony_ci * Clock and crystal information 11462306a36Sopenharmony_ci */ 11562306a36Sopenharmony_ci#define LPC32XX_MAIN_OSC_FREQ 13000000 11662306a36Sopenharmony_ci#define LPC32XX_CLOCK_OSC_FREQ 32768 11762306a36Sopenharmony_ci 11862306a36Sopenharmony_ci/* 11962306a36Sopenharmony_ci * Clock and Power control register offsets 12062306a36Sopenharmony_ci */ 12162306a36Sopenharmony_ci#define _PMREG(x) io_p2v(LPC32XX_CLK_PM_BASE +\ 12262306a36Sopenharmony_ci (x)) 12362306a36Sopenharmony_ci#define LPC32XX_CLKPWR_DEBUG_CTRL _PMREG(0x000) 12462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_BOOTMAP _PMREG(0x014) 12562306a36Sopenharmony_ci#define LPC32XX_CLKPWR_P01_ER _PMREG(0x018) 12662306a36Sopenharmony_ci#define LPC32XX_CLKPWR_USBCLK_PDIV _PMREG(0x01C) 12762306a36Sopenharmony_ci#define LPC32XX_CLKPWR_INT_ER _PMREG(0x020) 12862306a36Sopenharmony_ci#define LPC32XX_CLKPWR_INT_RS _PMREG(0x024) 12962306a36Sopenharmony_ci#define LPC32XX_CLKPWR_INT_SR _PMREG(0x028) 13062306a36Sopenharmony_ci#define LPC32XX_CLKPWR_INT_AP _PMREG(0x02C) 13162306a36Sopenharmony_ci#define LPC32XX_CLKPWR_PIN_ER _PMREG(0x030) 13262306a36Sopenharmony_ci#define LPC32XX_CLKPWR_PIN_RS _PMREG(0x034) 13362306a36Sopenharmony_ci#define LPC32XX_CLKPWR_PIN_SR _PMREG(0x038) 13462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_PIN_AP _PMREG(0x03C) 13562306a36Sopenharmony_ci#define LPC32XX_CLKPWR_HCLK_DIV _PMREG(0x040) 13662306a36Sopenharmony_ci#define LPC32XX_CLKPWR_PWR_CTRL _PMREG(0x044) 13762306a36Sopenharmony_ci#define LPC32XX_CLKPWR_PLL397_CTRL _PMREG(0x048) 13862306a36Sopenharmony_ci#define LPC32XX_CLKPWR_MAIN_OSC_CTRL _PMREG(0x04C) 13962306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SYSCLK_CTRL _PMREG(0x050) 14062306a36Sopenharmony_ci#define LPC32XX_CLKPWR_LCDCLK_CTRL _PMREG(0x054) 14162306a36Sopenharmony_ci#define LPC32XX_CLKPWR_HCLKPLL_CTRL _PMREG(0x058) 14262306a36Sopenharmony_ci#define LPC32XX_CLKPWR_ADC_CLK_CTRL_1 _PMREG(0x060) 14362306a36Sopenharmony_ci#define LPC32XX_CLKPWR_USB_CTRL _PMREG(0x064) 14462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SDRAMCLK_CTRL _PMREG(0x068) 14562306a36Sopenharmony_ci#define LPC32XX_CLKPWR_DDR_LAP_NOM _PMREG(0x06C) 14662306a36Sopenharmony_ci#define LPC32XX_CLKPWR_DDR_LAP_COUNT _PMREG(0x070) 14762306a36Sopenharmony_ci#define LPC32XX_CLKPWR_DDR_LAP_DELAY _PMREG(0x074) 14862306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SSP_CLK_CTRL _PMREG(0x078) 14962306a36Sopenharmony_ci#define LPC32XX_CLKPWR_I2S_CLK_CTRL _PMREG(0x07C) 15062306a36Sopenharmony_ci#define LPC32XX_CLKPWR_MS_CTRL _PMREG(0x080) 15162306a36Sopenharmony_ci#define LPC32XX_CLKPWR_MACCLK_CTRL _PMREG(0x090) 15262306a36Sopenharmony_ci#define LPC32XX_CLKPWR_TEST_CLK_SEL _PMREG(0x0A4) 15362306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SFW_INT _PMREG(0x0A8) 15462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_I2C_CLK_CTRL _PMREG(0x0AC) 15562306a36Sopenharmony_ci#define LPC32XX_CLKPWR_KEY_CLK_CTRL _PMREG(0x0B0) 15662306a36Sopenharmony_ci#define LPC32XX_CLKPWR_ADC_CLK_CTRL _PMREG(0x0B4) 15762306a36Sopenharmony_ci#define LPC32XX_CLKPWR_PWM_CLK_CTRL _PMREG(0x0B8) 15862306a36Sopenharmony_ci#define LPC32XX_CLKPWR_TIMER_CLK_CTRL _PMREG(0x0BC) 15962306a36Sopenharmony_ci#define LPC32XX_CLKPWR_TIMERS_PWMS_CLK_CTRL_1 _PMREG(0x0C0) 16062306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SPI_CLK_CTRL _PMREG(0x0C4) 16162306a36Sopenharmony_ci#define LPC32XX_CLKPWR_NAND_CLK_CTRL _PMREG(0x0C8) 16262306a36Sopenharmony_ci#define LPC32XX_CLKPWR_UART3_CLK_CTRL _PMREG(0x0D0) 16362306a36Sopenharmony_ci#define LPC32XX_CLKPWR_UART4_CLK_CTRL _PMREG(0x0D4) 16462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_UART5_CLK_CTRL _PMREG(0x0D8) 16562306a36Sopenharmony_ci#define LPC32XX_CLKPWR_UART6_CLK_CTRL _PMREG(0x0DC) 16662306a36Sopenharmony_ci#define LPC32XX_CLKPWR_IRDA_CLK_CTRL _PMREG(0x0E0) 16762306a36Sopenharmony_ci#define LPC32XX_CLKPWR_UART_CLK_CTRL _PMREG(0x0E4) 16862306a36Sopenharmony_ci#define LPC32XX_CLKPWR_DMA_CLK_CTRL _PMREG(0x0E8) 16962306a36Sopenharmony_ci#define LPC32XX_CLKPWR_AUTOCLOCK _PMREG(0x0EC) 17062306a36Sopenharmony_ci#define LPC32XX_CLKPWR_DEVID(x) _PMREG(0x130 + (x)) 17162306a36Sopenharmony_ci 17262306a36Sopenharmony_ci/* 17362306a36Sopenharmony_ci * clkpwr_debug_ctrl register definitions 17462306a36Sopenharmony_ci*/ 17562306a36Sopenharmony_ci#define LPC32XX_CLKPWR_VFP_CLOCK_ENABLE_BIT _BIT(4) 17662306a36Sopenharmony_ci 17762306a36Sopenharmony_ci/* 17862306a36Sopenharmony_ci * clkpwr_bootmap register definitions 17962306a36Sopenharmony_ci */ 18062306a36Sopenharmony_ci#define LPC32XX_CLKPWR_BOOTMAP_SEL_BIT _BIT(1) 18162306a36Sopenharmony_ci 18262306a36Sopenharmony_ci/* 18362306a36Sopenharmony_ci * clkpwr_start_gpio register bit definitions 18462306a36Sopenharmony_ci */ 18562306a36Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO23_BIT _BIT(31) 18662306a36Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO22_BIT _BIT(30) 18762306a36Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO21_BIT _BIT(29) 18862306a36Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO20_BIT _BIT(28) 18962306a36Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO19_BIT _BIT(27) 19062306a36Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO18_BIT _BIT(26) 19162306a36Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO17_BIT _BIT(25) 19262306a36Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO16_BIT _BIT(24) 19362306a36Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO15_BIT _BIT(23) 19462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO14_BIT _BIT(22) 19562306a36Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO13_BIT _BIT(21) 19662306a36Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO12_BIT _BIT(20) 19762306a36Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO11_BIT _BIT(19) 19862306a36Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO10_BIT _BIT(18) 19962306a36Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO9_BIT _BIT(17) 20062306a36Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO8_BIT _BIT(16) 20162306a36Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO7_BIT _BIT(15) 20262306a36Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO6_BIT _BIT(14) 20362306a36Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO5_BIT _BIT(13) 20462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO4_BIT _BIT(12) 20562306a36Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO3_BIT _BIT(11) 20662306a36Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO2_BIT _BIT(10) 20762306a36Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO1_BIT _BIT(9) 20862306a36Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P1IO0_BIT _BIT(8) 20962306a36Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P0IO7_BIT _BIT(7) 21062306a36Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P0IO6_BIT _BIT(6) 21162306a36Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P0IO5_BIT _BIT(5) 21262306a36Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P0IO4_BIT _BIT(4) 21362306a36Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P0IO3_BIT _BIT(3) 21462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P0IO2_BIT _BIT(2) 21562306a36Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P0IO1_BIT _BIT(1) 21662306a36Sopenharmony_ci#define LPC32XX_CLKPWR_GPIOSRC_P0IO0_BIT _BIT(0) 21762306a36Sopenharmony_ci 21862306a36Sopenharmony_ci/* 21962306a36Sopenharmony_ci * clkpwr_usbclk_pdiv register definitions 22062306a36Sopenharmony_ci */ 22162306a36Sopenharmony_ci#define LPC32XX_CLKPWR_USBPDIV_PLL_MASK 0xF 22262306a36Sopenharmony_ci 22362306a36Sopenharmony_ci/* 22462306a36Sopenharmony_ci * clkpwr_start_int, clkpwr_start_raw_sts_int, clkpwr_start_sts_int, 22562306a36Sopenharmony_ci * clkpwr_start_pol_int, register bit definitions 22662306a36Sopenharmony_ci */ 22762306a36Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_ADC_BIT _BIT(31) 22862306a36Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_TS_P_BIT _BIT(30) 22962306a36Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_TS_AUX_BIT _BIT(29) 23062306a36Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_USBAHNEEDCLK_BIT _BIT(26) 23162306a36Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_MSTIMER_BIT _BIT(25) 23262306a36Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_RTC_BIT _BIT(24) 23362306a36Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_USBNEEDCLK_BIT _BIT(23) 23462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_USB_BIT _BIT(22) 23562306a36Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_I2C_BIT _BIT(21) 23662306a36Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_USBOTGTIMER_BIT _BIT(20) 23762306a36Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_USBATXINT_BIT _BIT(19) 23862306a36Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_KEY_BIT _BIT(16) 23962306a36Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_MAC_BIT _BIT(7) 24062306a36Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_P0P1_BIT _BIT(6) 24162306a36Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_GPIO_05_BIT _BIT(5) 24262306a36Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_GPIO_04_BIT _BIT(4) 24362306a36Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_GPIO_03_BIT _BIT(3) 24462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_GPIO_02_BIT _BIT(2) 24562306a36Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_GPIO_01_BIT _BIT(1) 24662306a36Sopenharmony_ci#define LPC32XX_CLKPWR_INTSRC_GPIO_00_BIT _BIT(0) 24762306a36Sopenharmony_ci 24862306a36Sopenharmony_ci/* 24962306a36Sopenharmony_ci * clkpwr_start_pin, clkpwr_start_raw_sts_pin, clkpwr_start_sts_pin, 25062306a36Sopenharmony_ci * clkpwr_start_pol_pin register bit definitions 25162306a36Sopenharmony_ci */ 25262306a36Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_U7_RX_BIT _BIT(31) 25362306a36Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_U7_HCTS_BIT _BIT(30) 25462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_U6_IRRX_BIT _BIT(28) 25562306a36Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_U5_RX_BIT _BIT(26) 25662306a36Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_GPI_28_BIT _BIT(25) 25762306a36Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_U3_RX_BIT _BIT(24) 25862306a36Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_U2_HCTS_BIT _BIT(23) 25962306a36Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_U2_RX_BIT _BIT(22) 26062306a36Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_U1_RX_BIT _BIT(21) 26162306a36Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_MSDIO_INT_BIT _BIT(18) 26262306a36Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_MSDIO_SRT_BIT _BIT(17) 26362306a36Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_GPI_06_BIT _BIT(16) 26462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_GPI_05_BIT _BIT(15) 26562306a36Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_GPI_04_BIT _BIT(14) 26662306a36Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_GPI_03_BIT _BIT(13) 26762306a36Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_GPI_02_BIT _BIT(12) 26862306a36Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_GPI_01_BIT _BIT(11) 26962306a36Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_GPI_00_BIT _BIT(10) 27062306a36Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_SYSCLKEN_BIT _BIT(9) 27162306a36Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_SPI1_DATIN_BIT _BIT(8) 27262306a36Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_GPI_07_BIT _BIT(7) 27362306a36Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_SPI2_DATIN_BIT _BIT(6) 27462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_GPI_19_BIT _BIT(5) 27562306a36Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_GPI_09_BIT _BIT(4) 27662306a36Sopenharmony_ci#define LPC32XX_CLKPWR_EXTSRC_GPI_08_BIT _BIT(3) 27762306a36Sopenharmony_ci 27862306a36Sopenharmony_ci/* 27962306a36Sopenharmony_ci * clkpwr_hclk_div register definitions 28062306a36Sopenharmony_ci */ 28162306a36Sopenharmony_ci#define LPC32XX_CLKPWR_HCLKDIV_DDRCLK_STOP (0x0 << 7) 28262306a36Sopenharmony_ci#define LPC32XX_CLKPWR_HCLKDIV_DDRCLK_NORM (0x1 << 7) 28362306a36Sopenharmony_ci#define LPC32XX_CLKPWR_HCLKDIV_DDRCLK_HALF (0x2 << 7) 28462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_HCLKDIV_PCLK_DIV(n) (((n) & 0x1F) << 2) 28562306a36Sopenharmony_ci#define LPC32XX_CLKPWR_HCLKDIV_DIV_2POW(n) ((n) & 0x3) 28662306a36Sopenharmony_ci 28762306a36Sopenharmony_ci/* 28862306a36Sopenharmony_ci * clkpwr_pwr_ctrl register definitions 28962306a36Sopenharmony_ci */ 29062306a36Sopenharmony_ci#define LPC32XX_CLKPWR_CTRL_FORCE_PCLK _BIT(10) 29162306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SDRAM_SELF_RFSH _BIT(9) 29262306a36Sopenharmony_ci#define LPC32XX_CLKPWR_UPD_SDRAM_SELF_RFSH _BIT(8) 29362306a36Sopenharmony_ci#define LPC32XX_CLKPWR_AUTO_SDRAM_SELF_RFSH _BIT(7) 29462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_HIGHCORE_STATE_BIT _BIT(5) 29562306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SYSCLKEN_STATE_BIT _BIT(4) 29662306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SYSCLKEN_GPIO_EN _BIT(3) 29762306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SELECT_RUN_MODE _BIT(2) 29862306a36Sopenharmony_ci#define LPC32XX_CLKPWR_HIGHCORE_GPIO_EN _BIT(1) 29962306a36Sopenharmony_ci#define LPC32XX_CLKPWR_STOP_MODE_CTRL _BIT(0) 30062306a36Sopenharmony_ci 30162306a36Sopenharmony_ci/* 30262306a36Sopenharmony_ci * clkpwr_pll397_ctrl register definitions 30362306a36Sopenharmony_ci */ 30462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_PLL397_MSLOCK_STS _BIT(10) 30562306a36Sopenharmony_ci#define LPC32XX_CLKPWR_PLL397_BYPASS _BIT(9) 30662306a36Sopenharmony_ci#define LPC32XX_CLKPWR_PLL397_BIAS_NORM 0x000 30762306a36Sopenharmony_ci#define LPC32XX_CLKPWR_PLL397_BIAS_N12_5 0x040 30862306a36Sopenharmony_ci#define LPC32XX_CLKPWR_PLL397_BIAS_N25 0x080 30962306a36Sopenharmony_ci#define LPC32XX_CLKPWR_PLL397_BIAS_N37_5 0x0C0 31062306a36Sopenharmony_ci#define LPC32XX_CLKPWR_PLL397_BIAS_P12_5 0x100 31162306a36Sopenharmony_ci#define LPC32XX_CLKPWR_PLL397_BIAS_P25 0x140 31262306a36Sopenharmony_ci#define LPC32XX_CLKPWR_PLL397_BIAS_P37_5 0x180 31362306a36Sopenharmony_ci#define LPC32XX_CLKPWR_PLL397_BIAS_P50 0x1C0 31462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_PLL397_BIAS_MASK 0x1C0 31562306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SYSCTRL_PLL397_DIS _BIT(1) 31662306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SYSCTRL_PLL397_STS _BIT(0) 31762306a36Sopenharmony_ci 31862306a36Sopenharmony_ci/* 31962306a36Sopenharmony_ci * clkpwr_main_osc_ctrl register definitions 32062306a36Sopenharmony_ci */ 32162306a36Sopenharmony_ci#define LPC32XX_CLKPWR_MOSC_ADD_CAP(n) (((n) & 0x7F) << 2) 32262306a36Sopenharmony_ci#define LPC32XX_CLKPWR_MOSC_CAP_MASK (0x7F << 2) 32362306a36Sopenharmony_ci#define LPC32XX_CLKPWR_TEST_MODE _BIT(1) 32462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_MOSC_DISABLE _BIT(0) 32562306a36Sopenharmony_ci 32662306a36Sopenharmony_ci/* 32762306a36Sopenharmony_ci * clkpwr_sysclk_ctrl register definitions 32862306a36Sopenharmony_ci */ 32962306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SYSCTRL_BP_TRIG(n) (((n) & 0x3FF) << 2) 33062306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SYSCTRL_BP_MASK (0x3FF << 2) 33162306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SYSCTRL_USEPLL397 _BIT(1) 33262306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SYSCTRL_SYSCLKMUX _BIT(0) 33362306a36Sopenharmony_ci 33462306a36Sopenharmony_ci/* 33562306a36Sopenharmony_ci * clkpwr_lcdclk_ctrl register definitions 33662306a36Sopenharmony_ci */ 33762306a36Sopenharmony_ci#define LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_TFT12 0x000 33862306a36Sopenharmony_ci#define LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_TFT16 0x040 33962306a36Sopenharmony_ci#define LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_TFT15 0x080 34062306a36Sopenharmony_ci#define LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_TFT24 0x0C0 34162306a36Sopenharmony_ci#define LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_STN4M 0x100 34262306a36Sopenharmony_ci#define LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_STN8C 0x140 34362306a36Sopenharmony_ci#define LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_DSTN4M 0x180 34462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_DSTN8C 0x1C0 34562306a36Sopenharmony_ci#define LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_MSK 0x01C0 34662306a36Sopenharmony_ci#define LPC32XX_CLKPWR_LCDCTRL_CLK_EN 0x020 34762306a36Sopenharmony_ci#define LPC32XX_CLKPWR_LCDCTRL_SET_PSCALE(n) ((n - 1) & 0x1F) 34862306a36Sopenharmony_ci#define LPC32XX_CLKPWR_LCDCTRL_PSCALE_MSK 0x001F 34962306a36Sopenharmony_ci 35062306a36Sopenharmony_ci/* 35162306a36Sopenharmony_ci * clkpwr_hclkpll_ctrl register definitions 35262306a36Sopenharmony_ci */ 35362306a36Sopenharmony_ci#define LPC32XX_CLKPWR_HCLKPLL_POWER_UP _BIT(16) 35462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_HCLKPLL_CCO_BYPASS _BIT(15) 35562306a36Sopenharmony_ci#define LPC32XX_CLKPWR_HCLKPLL_POSTDIV_BYPASS _BIT(14) 35662306a36Sopenharmony_ci#define LPC32XX_CLKPWR_HCLKPLL_FDBK_SEL_FCLK _BIT(13) 35762306a36Sopenharmony_ci#define LPC32XX_CLKPWR_HCLKPLL_POSTDIV_2POW(n) (((n) & 0x3) << 11) 35862306a36Sopenharmony_ci#define LPC32XX_CLKPWR_HCLKPLL_PREDIV_PLUS1(n) (((n) & 0x3) << 9) 35962306a36Sopenharmony_ci#define LPC32XX_CLKPWR_HCLKPLL_PLLM(n) (((n) & 0xFF) << 1) 36062306a36Sopenharmony_ci#define LPC32XX_CLKPWR_HCLKPLL_PLL_STS _BIT(0) 36162306a36Sopenharmony_ci 36262306a36Sopenharmony_ci/* 36362306a36Sopenharmony_ci * clkpwr_adc_clk_ctrl_1 register definitions 36462306a36Sopenharmony_ci */ 36562306a36Sopenharmony_ci#define LPC32XX_CLKPWR_ADCCTRL1_RTDIV(n) (((n) & 0xFF) << 0) 36662306a36Sopenharmony_ci#define LPC32XX_CLKPWR_ADCCTRL1_PCLK_SEL _BIT(8) 36762306a36Sopenharmony_ci 36862306a36Sopenharmony_ci/* 36962306a36Sopenharmony_ci * clkpwr_usb_ctrl register definitions 37062306a36Sopenharmony_ci */ 37162306a36Sopenharmony_ci#define LPC32XX_CLKPWR_USBCTRL_HCLK_EN _BIT(24) 37262306a36Sopenharmony_ci#define LPC32XX_CLKPWR_USBCTRL_USBI2C_EN _BIT(23) 37362306a36Sopenharmony_ci#define LPC32XX_CLKPWR_USBCTRL_USBDVND_EN _BIT(22) 37462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_USBCTRL_USBHSTND_EN _BIT(21) 37562306a36Sopenharmony_ci#define LPC32XX_CLKPWR_USBCTRL_PU_ADD (0x0 << 19) 37662306a36Sopenharmony_ci#define LPC32XX_CLKPWR_USBCTRL_BUS_KEEPER (0x1 << 19) 37762306a36Sopenharmony_ci#define LPC32XX_CLKPWR_USBCTRL_PD_ADD (0x3 << 19) 37862306a36Sopenharmony_ci#define LPC32XX_CLKPWR_USBCTRL_CLK_EN2 _BIT(18) 37962306a36Sopenharmony_ci#define LPC32XX_CLKPWR_USBCTRL_CLK_EN1 _BIT(17) 38062306a36Sopenharmony_ci#define LPC32XX_CLKPWR_USBCTRL_PLL_PWRUP _BIT(16) 38162306a36Sopenharmony_ci#define LPC32XX_CLKPWR_USBCTRL_CCO_BYPASS _BIT(15) 38262306a36Sopenharmony_ci#define LPC32XX_CLKPWR_USBCTRL_POSTDIV_BYPASS _BIT(14) 38362306a36Sopenharmony_ci#define LPC32XX_CLKPWR_USBCTRL_FDBK_SEL_FCLK _BIT(13) 38462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_USBCTRL_POSTDIV_2POW(n) (((n) & 0x3) << 11) 38562306a36Sopenharmony_ci#define LPC32XX_CLKPWR_USBCTRL_PREDIV_PLUS1(n) (((n) & 0x3) << 9) 38662306a36Sopenharmony_ci#define LPC32XX_CLKPWR_USBCTRL_FDBK_PLUS1(n) (((n) & 0xFF) << 1) 38762306a36Sopenharmony_ci#define LPC32XX_CLKPWR_USBCTRL_PLL_STS _BIT(0) 38862306a36Sopenharmony_ci 38962306a36Sopenharmony_ci/* 39062306a36Sopenharmony_ci * clkpwr_sdramclk_ctrl register definitions 39162306a36Sopenharmony_ci */ 39262306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SDRCLK_FASTSLEW_CLK _BIT(22) 39362306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SDRCLK_FASTSLEW _BIT(21) 39462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SDRCLK_FASTSLEW_DAT _BIT(20) 39562306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SDRCLK_SW_DDR_RESET _BIT(19) 39662306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SDRCLK_HCLK_DLY(n) (((n) & 0x1F) << 14) 39762306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SDRCLK_DLY_ADDR_STS _BIT(13) 39862306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SDRCLK_SENS_FACT(n) (((n) & 0x7) << 10) 39962306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SDRCLK_USE_CAL _BIT(9) 40062306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SDRCLK_DO_CAL _BIT(8) 40162306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SDRCLK_CAL_ON_RTC _BIT(7) 40262306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SDRCLK_DQS_DLY(n) (((n) & 0x1F) << 2) 40362306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SDRCLK_USE_DDR _BIT(1) 40462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SDRCLK_CLK_DIS _BIT(0) 40562306a36Sopenharmony_ci 40662306a36Sopenharmony_ci/* 40762306a36Sopenharmony_ci * clkpwr_ssp_blk_ctrl register definitions 40862306a36Sopenharmony_ci */ 40962306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SSPCTRL_DMA_SSP1RX _BIT(5) 41062306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SSPCTRL_DMA_SSP1TX _BIT(4) 41162306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SSPCTRL_DMA_SSP0RX _BIT(3) 41262306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SSPCTRL_DMA_SSP0TX _BIT(2) 41362306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SSPCTRL_SSPCLK1_EN _BIT(1) 41462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SSPCTRL_SSPCLK0_EN _BIT(0) 41562306a36Sopenharmony_ci 41662306a36Sopenharmony_ci/* 41762306a36Sopenharmony_ci * clkpwr_i2s_clk_ctrl register definitions 41862306a36Sopenharmony_ci */ 41962306a36Sopenharmony_ci#define LPC32XX_CLKPWR_I2SCTRL_I2S1_RX_FOR_TX _BIT(6) 42062306a36Sopenharmony_ci#define LPC32XX_CLKPWR_I2SCTRL_I2S1_TX_FOR_RX _BIT(5) 42162306a36Sopenharmony_ci#define LPC32XX_CLKPWR_I2SCTRL_I2S1_USE_DMA _BIT(4) 42262306a36Sopenharmony_ci#define LPC32XX_CLKPWR_I2SCTRL_I2S0_RX_FOR_TX _BIT(3) 42362306a36Sopenharmony_ci#define LPC32XX_CLKPWR_I2SCTRL_I2S0_TX_FOR_RX _BIT(2) 42462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_I2SCTRL_I2SCLK1_EN _BIT(1) 42562306a36Sopenharmony_ci#define LPC32XX_CLKPWR_I2SCTRL_I2SCLK0_EN _BIT(0) 42662306a36Sopenharmony_ci 42762306a36Sopenharmony_ci/* 42862306a36Sopenharmony_ci * clkpwr_ms_ctrl register definitions 42962306a36Sopenharmony_ci */ 43062306a36Sopenharmony_ci#define LPC32XX_CLKPWR_MSCARD_MSDIO_PIN_DIS _BIT(10) 43162306a36Sopenharmony_ci#define LPC32XX_CLKPWR_MSCARD_MSDIO_PU_EN _BIT(9) 43262306a36Sopenharmony_ci#define LPC32XX_CLKPWR_MSCARD_MSDIO23_DIS _BIT(8) 43362306a36Sopenharmony_ci#define LPC32XX_CLKPWR_MSCARD_MSDIO1_DIS _BIT(7) 43462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_MSCARD_MSDIO0_DIS _BIT(6) 43562306a36Sopenharmony_ci#define LPC32XX_CLKPWR_MSCARD_SDCARD_EN _BIT(5) 43662306a36Sopenharmony_ci#define LPC32XX_CLKPWR_MSCARD_SDCARD_DIV(n) ((n) & 0xF) 43762306a36Sopenharmony_ci 43862306a36Sopenharmony_ci/* 43962306a36Sopenharmony_ci * clkpwr_macclk_ctrl register definitions 44062306a36Sopenharmony_ci */ 44162306a36Sopenharmony_ci#define LPC32XX_CLKPWR_MACCTRL_NO_ENET_PIS 0x00 44262306a36Sopenharmony_ci#define LPC32XX_CLKPWR_MACCTRL_USE_MII_PINS 0x08 44362306a36Sopenharmony_ci#define LPC32XX_CLKPWR_MACCTRL_USE_RMII_PINS 0x18 44462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_MACCTRL_PINS_MSK 0x18 44562306a36Sopenharmony_ci#define LPC32XX_CLKPWR_MACCTRL_DMACLK_EN _BIT(2) 44662306a36Sopenharmony_ci#define LPC32XX_CLKPWR_MACCTRL_MMIOCLK_EN _BIT(1) 44762306a36Sopenharmony_ci#define LPC32XX_CLKPWR_MACCTRL_HRCCLK_EN _BIT(0) 44862306a36Sopenharmony_ci 44962306a36Sopenharmony_ci/* 45062306a36Sopenharmony_ci * clkpwr_test_clk_sel register definitions 45162306a36Sopenharmony_ci */ 45262306a36Sopenharmony_ci#define LPC32XX_CLKPWR_TESTCLK1_SEL_PERCLK (0x0 << 5) 45362306a36Sopenharmony_ci#define LPC32XX_CLKPWR_TESTCLK1_SEL_RTC (0x1 << 5) 45462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_TESTCLK1_SEL_MOSC (0x2 << 5) 45562306a36Sopenharmony_ci#define LPC32XX_CLKPWR_TESTCLK1_SEL_MASK (0x3 << 5) 45662306a36Sopenharmony_ci#define LPC32XX_CLKPWR_TESTCLK_TESTCLK1_EN _BIT(4) 45762306a36Sopenharmony_ci#define LPC32XX_CLKPWR_TESTCLK2_SEL_HCLK (0x0 << 1) 45862306a36Sopenharmony_ci#define LPC32XX_CLKPWR_TESTCLK2_SEL_PERCLK (0x1 << 1) 45962306a36Sopenharmony_ci#define LPC32XX_CLKPWR_TESTCLK2_SEL_USBCLK (0x2 << 1) 46062306a36Sopenharmony_ci#define LPC32XX_CLKPWR_TESTCLK2_SEL_MOSC (0x5 << 1) 46162306a36Sopenharmony_ci#define LPC32XX_CLKPWR_TESTCLK2_SEL_PLL397 (0x7 << 1) 46262306a36Sopenharmony_ci#define LPC32XX_CLKPWR_TESTCLK2_SEL_MASK (0x7 << 1) 46362306a36Sopenharmony_ci#define LPC32XX_CLKPWR_TESTCLK_TESTCLK2_EN _BIT(0) 46462306a36Sopenharmony_ci 46562306a36Sopenharmony_ci/* 46662306a36Sopenharmony_ci * clkpwr_sw_int register definitions 46762306a36Sopenharmony_ci */ 46862306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SW_INT(n) (_BIT(0) | (((n) & 0x7F) << 1)) 46962306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SW_GET_ARG(n) (((n) & 0xFE) >> 1) 47062306a36Sopenharmony_ci 47162306a36Sopenharmony_ci/* 47262306a36Sopenharmony_ci * clkpwr_i2c_clk_ctrl register definitions 47362306a36Sopenharmony_ci */ 47462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_I2CCLK_USBI2CHI_DRIVE _BIT(4) 47562306a36Sopenharmony_ci#define LPC32XX_CLKPWR_I2CCLK_I2C2HI_DRIVE _BIT(3) 47662306a36Sopenharmony_ci#define LPC32XX_CLKPWR_I2CCLK_I2C1HI_DRIVE _BIT(2) 47762306a36Sopenharmony_ci#define LPC32XX_CLKPWR_I2CCLK_I2C2CLK_EN _BIT(1) 47862306a36Sopenharmony_ci#define LPC32XX_CLKPWR_I2CCLK_I2C1CLK_EN _BIT(0) 47962306a36Sopenharmony_ci 48062306a36Sopenharmony_ci/* 48162306a36Sopenharmony_ci * clkpwr_key_clk_ctrl register definitions 48262306a36Sopenharmony_ci */ 48362306a36Sopenharmony_ci#define LPC32XX_CLKPWR_KEYCLKCTRL_CLK_EN 0x1 48462306a36Sopenharmony_ci 48562306a36Sopenharmony_ci/* 48662306a36Sopenharmony_ci * clkpwr_adc_clk_ctrl register definitions 48762306a36Sopenharmony_ci */ 48862306a36Sopenharmony_ci#define LPC32XX_CLKPWR_ADC32CLKCTRL_CLK_EN 0x1 48962306a36Sopenharmony_ci 49062306a36Sopenharmony_ci/* 49162306a36Sopenharmony_ci * clkpwr_pwm_clk_ctrl register definitions 49262306a36Sopenharmony_ci */ 49362306a36Sopenharmony_ci#define LPC32XX_CLKPWR_PWMCLK_PWM2_DIV(n) (((n) & 0xF) << 8) 49462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_PWMCLK_PWM1_DIV(n) (((n) & 0xF) << 4) 49562306a36Sopenharmony_ci#define LPC32XX_CLKPWR_PWMCLK_PWM2SEL_PCLK 0x8 49662306a36Sopenharmony_ci#define LPC32XX_CLKPWR_PWMCLK_PWM2CLK_EN 0x4 49762306a36Sopenharmony_ci#define LPC32XX_CLKPWR_PWMCLK_PWM1SEL_PCLK 0x2 49862306a36Sopenharmony_ci#define LPC32XX_CLKPWR_PWMCLK_PWM1CLK_EN 0x1 49962306a36Sopenharmony_ci 50062306a36Sopenharmony_ci/* 50162306a36Sopenharmony_ci * clkpwr_timer_clk_ctrl register definitions 50262306a36Sopenharmony_ci */ 50362306a36Sopenharmony_ci#define LPC32XX_CLKPWR_PWMCLK_HSTIMER_EN 0x2 50462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_PWMCLK_WDOG_EN 0x1 50562306a36Sopenharmony_ci 50662306a36Sopenharmony_ci/* 50762306a36Sopenharmony_ci * clkpwr_timers_pwms_clk_ctrl_1 register definitions 50862306a36Sopenharmony_ci */ 50962306a36Sopenharmony_ci#define LPC32XX_CLKPWR_TMRPWMCLK_MPWM_EN 0x40 51062306a36Sopenharmony_ci#define LPC32XX_CLKPWR_TMRPWMCLK_TIMER3_EN 0x20 51162306a36Sopenharmony_ci#define LPC32XX_CLKPWR_TMRPWMCLK_TIMER2_EN 0x10 51262306a36Sopenharmony_ci#define LPC32XX_CLKPWR_TMRPWMCLK_TIMER1_EN 0x08 51362306a36Sopenharmony_ci#define LPC32XX_CLKPWR_TMRPWMCLK_TIMER0_EN 0x04 51462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_TMRPWMCLK_PWM4_EN 0x02 51562306a36Sopenharmony_ci#define LPC32XX_CLKPWR_TMRPWMCLK_PWM3_EN 0x01 51662306a36Sopenharmony_ci 51762306a36Sopenharmony_ci/* 51862306a36Sopenharmony_ci * clkpwr_spi_clk_ctrl register definitions 51962306a36Sopenharmony_ci */ 52062306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SPICLK_SET_SPI2DATIO 0x80 52162306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SPICLK_SET_SPI2CLK 0x40 52262306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SPICLK_USE_SPI2 0x20 52362306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SPICLK_SPI2CLK_EN 0x10 52462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SPICLK_SET_SPI1DATIO 0x08 52562306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SPICLK_SET_SPI1CLK 0x04 52662306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SPICLK_USE_SPI1 0x02 52762306a36Sopenharmony_ci#define LPC32XX_CLKPWR_SPICLK_SPI1CLK_EN 0x01 52862306a36Sopenharmony_ci 52962306a36Sopenharmony_ci/* 53062306a36Sopenharmony_ci * clkpwr_nand_clk_ctrl register definitions 53162306a36Sopenharmony_ci */ 53262306a36Sopenharmony_ci#define LPC32XX_CLKPWR_NANDCLK_INTSEL_MLC 0x20 53362306a36Sopenharmony_ci#define LPC32XX_CLKPWR_NANDCLK_DMA_RNB 0x10 53462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_NANDCLK_DMA_INT 0x08 53562306a36Sopenharmony_ci#define LPC32XX_CLKPWR_NANDCLK_SEL_SLC 0x04 53662306a36Sopenharmony_ci#define LPC32XX_CLKPWR_NANDCLK_MLCCLK_EN 0x02 53762306a36Sopenharmony_ci#define LPC32XX_CLKPWR_NANDCLK_SLCCLK_EN 0x01 53862306a36Sopenharmony_ci 53962306a36Sopenharmony_ci/* 54062306a36Sopenharmony_ci * clkpwr_uart3_clk_ctrl, clkpwr_uart4_clk_ctrl, clkpwr_uart5_clk_ctrl 54162306a36Sopenharmony_ci * and clkpwr_uart6_clk_ctrl register definitions 54262306a36Sopenharmony_ci */ 54362306a36Sopenharmony_ci#define LPC32XX_CLKPWR_UART_Y_DIV(y) ((y) & 0xFF) 54462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_UART_X_DIV(x) (((x) & 0xFF) << 8) 54562306a36Sopenharmony_ci#define LPC32XX_CLKPWR_UART_USE_HCLK _BIT(16) 54662306a36Sopenharmony_ci 54762306a36Sopenharmony_ci/* 54862306a36Sopenharmony_ci * clkpwr_irda_clk_ctrl register definitions 54962306a36Sopenharmony_ci */ 55062306a36Sopenharmony_ci#define LPC32XX_CLKPWR_IRDA_Y_DIV(y) ((y) & 0xFF) 55162306a36Sopenharmony_ci#define LPC32XX_CLKPWR_IRDA_X_DIV(x) (((x) & 0xFF) << 8) 55262306a36Sopenharmony_ci 55362306a36Sopenharmony_ci/* 55462306a36Sopenharmony_ci * clkpwr_uart_clk_ctrl register definitions 55562306a36Sopenharmony_ci */ 55662306a36Sopenharmony_ci#define LPC32XX_CLKPWR_UARTCLKCTRL_UART6_EN _BIT(3) 55762306a36Sopenharmony_ci#define LPC32XX_CLKPWR_UARTCLKCTRL_UART5_EN _BIT(2) 55862306a36Sopenharmony_ci#define LPC32XX_CLKPWR_UARTCLKCTRL_UART4_EN _BIT(1) 55962306a36Sopenharmony_ci#define LPC32XX_CLKPWR_UARTCLKCTRL_UART3_EN _BIT(0) 56062306a36Sopenharmony_ci 56162306a36Sopenharmony_ci/* 56262306a36Sopenharmony_ci * clkpwr_dmaclk_ctrl register definitions 56362306a36Sopenharmony_ci */ 56462306a36Sopenharmony_ci#define LPC32XX_CLKPWR_DMACLKCTRL_CLK_EN 0x1 56562306a36Sopenharmony_ci 56662306a36Sopenharmony_ci/* 56762306a36Sopenharmony_ci * clkpwr_autoclock register definitions 56862306a36Sopenharmony_ci */ 56962306a36Sopenharmony_ci#define LPC32XX_CLKPWR_AUTOCLK_USB_EN 0x40 57062306a36Sopenharmony_ci#define LPC32XX_CLKPWR_AUTOCLK_IRAM_EN 0x02 57162306a36Sopenharmony_ci#define LPC32XX_CLKPWR_AUTOCLK_IROM_EN 0x01 57262306a36Sopenharmony_ci 57362306a36Sopenharmony_ci/* 57462306a36Sopenharmony_ci * Interrupt controller register offsets 57562306a36Sopenharmony_ci */ 57662306a36Sopenharmony_ci#define LPC32XX_INTC_MASK(x) io_p2v((x) + 0x00) 57762306a36Sopenharmony_ci#define LPC32XX_INTC_RAW_STAT(x) io_p2v((x) + 0x04) 57862306a36Sopenharmony_ci#define LPC32XX_INTC_STAT(x) io_p2v((x) + 0x08) 57962306a36Sopenharmony_ci#define LPC32XX_INTC_POLAR(x) io_p2v((x) + 0x0C) 58062306a36Sopenharmony_ci#define LPC32XX_INTC_ACT_TYPE(x) io_p2v((x) + 0x10) 58162306a36Sopenharmony_ci#define LPC32XX_INTC_TYPE(x) io_p2v((x) + 0x14) 58262306a36Sopenharmony_ci 58362306a36Sopenharmony_ci/* 58462306a36Sopenharmony_ci * Timer/counter register offsets 58562306a36Sopenharmony_ci */ 58662306a36Sopenharmony_ci#define LPC32XX_TIMER_IR(x) io_p2v((x) + 0x00) 58762306a36Sopenharmony_ci#define LPC32XX_TIMER_TCR(x) io_p2v((x) + 0x04) 58862306a36Sopenharmony_ci#define LPC32XX_TIMER_TC(x) io_p2v((x) + 0x08) 58962306a36Sopenharmony_ci#define LPC32XX_TIMER_PR(x) io_p2v((x) + 0x0C) 59062306a36Sopenharmony_ci#define LPC32XX_TIMER_PC(x) io_p2v((x) + 0x10) 59162306a36Sopenharmony_ci#define LPC32XX_TIMER_MCR(x) io_p2v((x) + 0x14) 59262306a36Sopenharmony_ci#define LPC32XX_TIMER_MR0(x) io_p2v((x) + 0x18) 59362306a36Sopenharmony_ci#define LPC32XX_TIMER_MR1(x) io_p2v((x) + 0x1C) 59462306a36Sopenharmony_ci#define LPC32XX_TIMER_MR2(x) io_p2v((x) + 0x20) 59562306a36Sopenharmony_ci#define LPC32XX_TIMER_MR3(x) io_p2v((x) + 0x24) 59662306a36Sopenharmony_ci#define LPC32XX_TIMER_CCR(x) io_p2v((x) + 0x28) 59762306a36Sopenharmony_ci#define LPC32XX_TIMER_CR0(x) io_p2v((x) + 0x2C) 59862306a36Sopenharmony_ci#define LPC32XX_TIMER_CR1(x) io_p2v((x) + 0x30) 59962306a36Sopenharmony_ci#define LPC32XX_TIMER_CR2(x) io_p2v((x) + 0x34) 60062306a36Sopenharmony_ci#define LPC32XX_TIMER_CR3(x) io_p2v((x) + 0x38) 60162306a36Sopenharmony_ci#define LPC32XX_TIMER_EMR(x) io_p2v((x) + 0x3C) 60262306a36Sopenharmony_ci#define LPC32XX_TIMER_CTCR(x) io_p2v((x) + 0x70) 60362306a36Sopenharmony_ci 60462306a36Sopenharmony_ci/* 60562306a36Sopenharmony_ci * ir register definitions 60662306a36Sopenharmony_ci */ 60762306a36Sopenharmony_ci#define LPC32XX_TIMER_CNTR_MTCH_BIT(n) (1 << ((n) & 0x3)) 60862306a36Sopenharmony_ci#define LPC32XX_TIMER_CNTR_CAPT_BIT(n) (1 << (4 + ((n) & 0x3))) 60962306a36Sopenharmony_ci 61062306a36Sopenharmony_ci/* 61162306a36Sopenharmony_ci * tcr register definitions 61262306a36Sopenharmony_ci */ 61362306a36Sopenharmony_ci#define LPC32XX_TIMER_CNTR_TCR_EN 0x1 61462306a36Sopenharmony_ci#define LPC32XX_TIMER_CNTR_TCR_RESET 0x2 61562306a36Sopenharmony_ci 61662306a36Sopenharmony_ci/* 61762306a36Sopenharmony_ci * mcr register definitions 61862306a36Sopenharmony_ci */ 61962306a36Sopenharmony_ci#define LPC32XX_TIMER_CNTR_MCR_MTCH(n) (0x1 << ((n) * 3)) 62062306a36Sopenharmony_ci#define LPC32XX_TIMER_CNTR_MCR_RESET(n) (0x1 << (((n) * 3) + 1)) 62162306a36Sopenharmony_ci#define LPC32XX_TIMER_CNTR_MCR_STOP(n) (0x1 << (((n) * 3) + 2)) 62262306a36Sopenharmony_ci 62362306a36Sopenharmony_ci/* 62462306a36Sopenharmony_ci * Standard UART register offsets 62562306a36Sopenharmony_ci */ 62662306a36Sopenharmony_ci#define LPC32XX_UART_DLL_FIFO(x) io_p2v((x) + 0x00) 62762306a36Sopenharmony_ci#define LPC32XX_UART_DLM_IER(x) io_p2v((x) + 0x04) 62862306a36Sopenharmony_ci#define LPC32XX_UART_IIR_FCR(x) io_p2v((x) + 0x08) 62962306a36Sopenharmony_ci#define LPC32XX_UART_LCR(x) io_p2v((x) + 0x0C) 63062306a36Sopenharmony_ci#define LPC32XX_UART_MODEM_CTRL(x) io_p2v((x) + 0x10) 63162306a36Sopenharmony_ci#define LPC32XX_UART_LSR(x) io_p2v((x) + 0x14) 63262306a36Sopenharmony_ci#define LPC32XX_UART_MODEM_STATUS(x) io_p2v((x) + 0x18) 63362306a36Sopenharmony_ci#define LPC32XX_UART_RXLEV(x) io_p2v((x) + 0x1C) 63462306a36Sopenharmony_ci 63562306a36Sopenharmony_ci/* 63662306a36Sopenharmony_ci * UART control structure offsets 63762306a36Sopenharmony_ci */ 63862306a36Sopenharmony_ci#define _UCREG(x) io_p2v(\ 63962306a36Sopenharmony_ci LPC32XX_UART_CTRL_BASE + (x)) 64062306a36Sopenharmony_ci#define LPC32XX_UARTCTL_CTRL _UCREG(0x00) 64162306a36Sopenharmony_ci#define LPC32XX_UARTCTL_CLKMODE _UCREG(0x04) 64262306a36Sopenharmony_ci#define LPC32XX_UARTCTL_CLOOP _UCREG(0x08) 64362306a36Sopenharmony_ci 64462306a36Sopenharmony_ci/* 64562306a36Sopenharmony_ci * ctrl register definitions 64662306a36Sopenharmony_ci */ 64762306a36Sopenharmony_ci#define LPC32XX_UART_U3_MD_CTRL_EN _BIT(11) 64862306a36Sopenharmony_ci#define LPC32XX_UART_IRRX6_INV_EN _BIT(10) 64962306a36Sopenharmony_ci#define LPC32XX_UART_HDPX_EN _BIT(9) 65062306a36Sopenharmony_ci#define LPC32XX_UART_UART6_IRDAMOD_BYPASS _BIT(5) 65162306a36Sopenharmony_ci#define LPC32XX_RT_IRTX6_INV_EN _BIT(4) 65262306a36Sopenharmony_ci#define LPC32XX_RT_IRTX6_INV_MIR_EN _BIT(3) 65362306a36Sopenharmony_ci#define LPC32XX_RT_RX_IRPULSE_3_16_115K _BIT(2) 65462306a36Sopenharmony_ci#define LPC32XX_RT_TX_IRPULSE_3_16_115K _BIT(1) 65562306a36Sopenharmony_ci#define LPC32XX_UART_U5_ROUTE_TO_USB _BIT(0) 65662306a36Sopenharmony_ci 65762306a36Sopenharmony_ci/* 65862306a36Sopenharmony_ci * clkmode register definitions 65962306a36Sopenharmony_ci */ 66062306a36Sopenharmony_ci#define LPC32XX_UART_ENABLED_CLOCKS(n) (((n) >> 16) & 0x7F) 66162306a36Sopenharmony_ci#define LPC32XX_UART_ENABLED_CLOCK(n, u) (((n) >> (16 + (u))) & 0x1) 66262306a36Sopenharmony_ci#define LPC32XX_UART_ENABLED_CLKS_ANY _BIT(14) 66362306a36Sopenharmony_ci#define LPC32XX_UART_CLKMODE_OFF 0x0 66462306a36Sopenharmony_ci#define LPC32XX_UART_CLKMODE_ON 0x1 66562306a36Sopenharmony_ci#define LPC32XX_UART_CLKMODE_AUTO 0x2 66662306a36Sopenharmony_ci#define LPC32XX_UART_CLKMODE_MASK(u) (0x3 << ((((u) - 3) * 2) + 4)) 66762306a36Sopenharmony_ci#define LPC32XX_UART_CLKMODE_LOAD(m, u) ((m) << ((((u) - 3) * 2) + 4)) 66862306a36Sopenharmony_ci 66962306a36Sopenharmony_ci/* 67062306a36Sopenharmony_ci * GPIO Module Register offsets 67162306a36Sopenharmony_ci */ 67262306a36Sopenharmony_ci#define _GPREG(x) io_p2v(LPC32XX_GPIO_BASE + (x)) 67362306a36Sopenharmony_ci#define LPC32XX_GPIO_P_MUX_SET _GPREG(0x100) 67462306a36Sopenharmony_ci#define LPC32XX_GPIO_P_MUX_CLR _GPREG(0x104) 67562306a36Sopenharmony_ci#define LPC32XX_GPIO_P_MUX_STATE _GPREG(0x108) 67662306a36Sopenharmony_ci#define LPC32XX_GPIO_P3_MUX_SET _GPREG(0x110) 67762306a36Sopenharmony_ci#define LPC32XX_GPIO_P3_MUX_CLR _GPREG(0x114) 67862306a36Sopenharmony_ci#define LPC32XX_GPIO_P3_MUX_STATE _GPREG(0x118) 67962306a36Sopenharmony_ci#define LPC32XX_GPIO_P0_MUX_SET _GPREG(0x120) 68062306a36Sopenharmony_ci#define LPC32XX_GPIO_P0_MUX_CLR _GPREG(0x124) 68162306a36Sopenharmony_ci#define LPC32XX_GPIO_P0_MUX_STATE _GPREG(0x128) 68262306a36Sopenharmony_ci#define LPC32XX_GPIO_P1_MUX_SET _GPREG(0x130) 68362306a36Sopenharmony_ci#define LPC32XX_GPIO_P1_MUX_CLR _GPREG(0x134) 68462306a36Sopenharmony_ci#define LPC32XX_GPIO_P1_MUX_STATE _GPREG(0x138) 68562306a36Sopenharmony_ci#define LPC32XX_GPIO_P2_MUX_SET _GPREG(0x028) 68662306a36Sopenharmony_ci#define LPC32XX_GPIO_P2_MUX_CLR _GPREG(0x02C) 68762306a36Sopenharmony_ci#define LPC32XX_GPIO_P2_MUX_STATE _GPREG(0x030) 68862306a36Sopenharmony_ci 68962306a36Sopenharmony_ci/* 69062306a36Sopenharmony_ci * USB Otg Registers 69162306a36Sopenharmony_ci */ 69262306a36Sopenharmony_ci#define _OTGREG(x) io_p2v(LPC32XX_USB_OTG_BASE + (x)) 69362306a36Sopenharmony_ci#define LPC32XX_USB_OTG_CLK_CTRL _OTGREG(0xFF4) 69462306a36Sopenharmony_ci#define LPC32XX_USB_OTG_CLK_STAT _OTGREG(0xFF8) 69562306a36Sopenharmony_ci 69662306a36Sopenharmony_ci/* USB OTG CLK CTRL bit defines */ 69762306a36Sopenharmony_ci#define LPC32XX_USB_OTG_AHB_M_CLOCK_ON _BIT(4) 69862306a36Sopenharmony_ci#define LPC32XX_USB_OTG_OTG_CLOCK_ON _BIT(3) 69962306a36Sopenharmony_ci#define LPC32XX_USB_OTG_I2C_CLOCK_ON _BIT(2) 70062306a36Sopenharmony_ci#define LPC32XX_USB_OTG_DEV_CLOCK_ON _BIT(1) 70162306a36Sopenharmony_ci#define LPC32XX_USB_OTG_HOST_CLOCK_ON _BIT(0) 70262306a36Sopenharmony_ci 70362306a36Sopenharmony_ci/* 70462306a36Sopenharmony_ci * Start of virtual addresses for IO devices 70562306a36Sopenharmony_ci */ 70662306a36Sopenharmony_ci#define IO_BASE 0xF0000000 70762306a36Sopenharmony_ci 70862306a36Sopenharmony_ci/* 70962306a36Sopenharmony_ci * This macro relies on fact that for all HW i/o addresses bits 20-23 are 0 71062306a36Sopenharmony_ci */ 71162306a36Sopenharmony_ci#define IO_ADDRESS(x) IOMEM(((((x) & 0xff000000) >> 4) | ((x) & 0xfffff)) |\ 71262306a36Sopenharmony_ci IO_BASE) 71362306a36Sopenharmony_ci 71462306a36Sopenharmony_ci#define io_p2v(x) ((void __iomem *) (unsigned long) IO_ADDRESS(x)) 71562306a36Sopenharmony_ci#define io_v2p(x) ((((x) & 0x0ff00000) << 4) | ((x) & 0x000fffff)) 71662306a36Sopenharmony_ci 71762306a36Sopenharmony_ci#endif 718