1*d3532910SArnd Bergmann /* SPDX-License-Identifier: GPL-2.0-or-later */ 2*d3532910SArnd Bergmann /* 3*d3532910SArnd Bergmann * arch/arm/mach-lpc32xx/include/mach/platform.h 4*d3532910SArnd Bergmann * 5*d3532910SArnd Bergmann * Author: Kevin Wells <kevin.wells@nxp.com> 6*d3532910SArnd Bergmann * 7*d3532910SArnd Bergmann * Copyright (C) 2010 NXP Semiconductors 8*d3532910SArnd Bergmann */ 9*d3532910SArnd Bergmann 10*d3532910SArnd Bergmann #ifndef __ARM_LPC32XX_H 11*d3532910SArnd Bergmann #define __ARM_LPC32XX_H 12*d3532910SArnd Bergmann 13*d3532910SArnd Bergmann #define _SBF(f, v) ((v) << (f)) 14*d3532910SArnd Bergmann #define _BIT(n) _SBF(n, 1) 15*d3532910SArnd Bergmann 16*d3532910SArnd Bergmann /* 17*d3532910SArnd Bergmann * AHB 0 physical base addresses 18*d3532910SArnd Bergmann */ 19*d3532910SArnd Bergmann #define LPC32XX_SLC_BASE 0x20020000 20*d3532910SArnd Bergmann #define LPC32XX_SSP0_BASE 0x20084000 21*d3532910SArnd Bergmann #define LPC32XX_SPI1_BASE 0x20088000 22*d3532910SArnd Bergmann #define LPC32XX_SSP1_BASE 0x2008C000 23*d3532910SArnd Bergmann #define LPC32XX_SPI2_BASE 0x20090000 24*d3532910SArnd Bergmann #define LPC32XX_I2S0_BASE 0x20094000 25*d3532910SArnd Bergmann #define LPC32XX_SD_BASE 0x20098000 26*d3532910SArnd Bergmann #define LPC32XX_I2S1_BASE 0x2009C000 27*d3532910SArnd Bergmann #define LPC32XX_MLC_BASE 0x200A8000 28*d3532910SArnd Bergmann #define LPC32XX_AHB0_START LPC32XX_SLC_BASE 29*d3532910SArnd Bergmann #define LPC32XX_AHB0_SIZE 0x00089000 30*d3532910SArnd Bergmann 31*d3532910SArnd Bergmann /* 32*d3532910SArnd Bergmann * AHB 1 physical base addresses 33*d3532910SArnd Bergmann */ 34*d3532910SArnd Bergmann #define LPC32XX_DMA_BASE 0x31000000 35*d3532910SArnd Bergmann #define LPC32XX_USB_BASE 0x31020000 36*d3532910SArnd Bergmann #define LPC32XX_USBH_BASE 0x31020000 37*d3532910SArnd Bergmann #define LPC32XX_USB_OTG_BASE 0x31020000 38*d3532910SArnd Bergmann #define LPC32XX_OTG_I2C_BASE 0x31020300 39*d3532910SArnd Bergmann #define LPC32XX_LCD_BASE 0x31040000 40*d3532910SArnd Bergmann #define LPC32XX_ETHERNET_BASE 0x31060000 41*d3532910SArnd Bergmann #define LPC32XX_EMC_BASE 0x31080000 42*d3532910SArnd Bergmann #define LPC32XX_ETB_CFG_BASE 0x310C0000 43*d3532910SArnd Bergmann #define LPC32XX_ETB_DATA_BASE 0x310E0000 44*d3532910SArnd Bergmann #define LPC32XX_AHB1_START LPC32XX_DMA_BASE 45*d3532910SArnd Bergmann #define LPC32XX_AHB1_SIZE 0x000E1000 46*d3532910SArnd Bergmann 47*d3532910SArnd Bergmann /* 48*d3532910SArnd Bergmann * FAB physical base addresses 49*d3532910SArnd Bergmann */ 50*d3532910SArnd Bergmann #define LPC32XX_CLK_PM_BASE 0x40004000 51*d3532910SArnd Bergmann #define LPC32XX_MIC_BASE 0x40008000 52*d3532910SArnd Bergmann #define LPC32XX_SIC1_BASE 0x4000C000 53*d3532910SArnd Bergmann #define LPC32XX_SIC2_BASE 0x40010000 54*d3532910SArnd Bergmann #define LPC32XX_HS_UART1_BASE 0x40014000 55*d3532910SArnd Bergmann #define LPC32XX_HS_UART2_BASE 0x40018000 56*d3532910SArnd Bergmann #define LPC32XX_HS_UART7_BASE 0x4001C000 57*d3532910SArnd Bergmann #define LPC32XX_RTC_BASE 0x40024000 58*d3532910SArnd Bergmann #define LPC32XX_RTC_RAM_BASE 0x40024080 59*d3532910SArnd Bergmann #define LPC32XX_GPIO_BASE 0x40028000 60*d3532910SArnd Bergmann #define LPC32XX_PWM3_BASE 0x4002C000 61*d3532910SArnd Bergmann #define LPC32XX_PWM4_BASE 0x40030000 62*d3532910SArnd Bergmann #define LPC32XX_MSTIM_BASE 0x40034000 63*d3532910SArnd Bergmann #define LPC32XX_HSTIM_BASE 0x40038000 64*d3532910SArnd Bergmann #define LPC32XX_WDTIM_BASE 0x4003C000 65*d3532910SArnd Bergmann #define LPC32XX_DEBUG_CTRL_BASE 0x40040000 66*d3532910SArnd Bergmann #define LPC32XX_TIMER0_BASE 0x40044000 67*d3532910SArnd Bergmann #define LPC32XX_ADC_BASE 0x40048000 68*d3532910SArnd Bergmann #define LPC32XX_TIMER1_BASE 0x4004C000 69*d3532910SArnd Bergmann #define LPC32XX_KSCAN_BASE 0x40050000 70*d3532910SArnd Bergmann #define LPC32XX_UART_CTRL_BASE 0x40054000 71*d3532910SArnd Bergmann #define LPC32XX_TIMER2_BASE 0x40058000 72*d3532910SArnd Bergmann #define LPC32XX_PWM1_BASE 0x4005C000 73*d3532910SArnd Bergmann #define LPC32XX_PWM2_BASE 0x4005C004 74*d3532910SArnd Bergmann #define LPC32XX_TIMER3_BASE 0x40060000 75*d3532910SArnd Bergmann 76*d3532910SArnd Bergmann /* 77*d3532910SArnd Bergmann * APB physical base addresses 78*d3532910SArnd Bergmann */ 79*d3532910SArnd Bergmann #define LPC32XX_UART3_BASE 0x40080000 80*d3532910SArnd Bergmann #define LPC32XX_UART4_BASE 0x40088000 81*d3532910SArnd Bergmann #define LPC32XX_UART5_BASE 0x40090000 82*d3532910SArnd Bergmann #define LPC32XX_UART6_BASE 0x40098000 83*d3532910SArnd Bergmann #define LPC32XX_I2C1_BASE 0x400A0000 84*d3532910SArnd Bergmann #define LPC32XX_I2C2_BASE 0x400A8000 85*d3532910SArnd Bergmann 86*d3532910SArnd Bergmann /* 87*d3532910SArnd Bergmann * FAB and APB base and sizing 88*d3532910SArnd Bergmann */ 89*d3532910SArnd Bergmann #define LPC32XX_FABAPB_START LPC32XX_CLK_PM_BASE 90*d3532910SArnd Bergmann #define LPC32XX_FABAPB_SIZE 0x000A5000 91*d3532910SArnd Bergmann 92*d3532910SArnd Bergmann /* 93*d3532910SArnd Bergmann * Internal memory bases and sizes 94*d3532910SArnd Bergmann */ 95*d3532910SArnd Bergmann #define LPC32XX_IRAM_BASE 0x08000000 96*d3532910SArnd Bergmann #define LPC32XX_IROM_BASE 0x0C000000 97*d3532910SArnd Bergmann 98*d3532910SArnd Bergmann /* 99*d3532910SArnd Bergmann * External Static Memory Bank Address Space Bases 100*d3532910SArnd Bergmann */ 101*d3532910SArnd Bergmann #define LPC32XX_EMC_CS0_BASE 0xE0000000 102*d3532910SArnd Bergmann #define LPC32XX_EMC_CS1_BASE 0xE1000000 103*d3532910SArnd Bergmann #define LPC32XX_EMC_CS2_BASE 0xE2000000 104*d3532910SArnd Bergmann #define LPC32XX_EMC_CS3_BASE 0xE3000000 105*d3532910SArnd Bergmann 106*d3532910SArnd Bergmann /* 107*d3532910SArnd Bergmann * External SDRAM Memory Bank Address Space Bases 108*d3532910SArnd Bergmann */ 109*d3532910SArnd Bergmann #define LPC32XX_EMC_DYCS0_BASE 0x80000000 110*d3532910SArnd Bergmann #define LPC32XX_EMC_DYCS1_BASE 0xA0000000 111*d3532910SArnd Bergmann 112*d3532910SArnd Bergmann /* 113*d3532910SArnd Bergmann * Clock and crystal information 114*d3532910SArnd Bergmann */ 115*d3532910SArnd Bergmann #define LPC32XX_MAIN_OSC_FREQ 13000000 116*d3532910SArnd Bergmann #define LPC32XX_CLOCK_OSC_FREQ 32768 117*d3532910SArnd Bergmann 118*d3532910SArnd Bergmann /* 119*d3532910SArnd Bergmann * Clock and Power control register offsets 120*d3532910SArnd Bergmann */ 121*d3532910SArnd Bergmann #define _PMREG(x) io_p2v(LPC32XX_CLK_PM_BASE +\ 122*d3532910SArnd Bergmann (x)) 123*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_DEBUG_CTRL _PMREG(0x000) 124*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_BOOTMAP _PMREG(0x014) 125*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_P01_ER _PMREG(0x018) 126*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_USBCLK_PDIV _PMREG(0x01C) 127*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_INT_ER _PMREG(0x020) 128*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_INT_RS _PMREG(0x024) 129*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_INT_SR _PMREG(0x028) 130*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_INT_AP _PMREG(0x02C) 131*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_PIN_ER _PMREG(0x030) 132*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_PIN_RS _PMREG(0x034) 133*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_PIN_SR _PMREG(0x038) 134*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_PIN_AP _PMREG(0x03C) 135*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_HCLK_DIV _PMREG(0x040) 136*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_PWR_CTRL _PMREG(0x044) 137*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_PLL397_CTRL _PMREG(0x048) 138*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_MAIN_OSC_CTRL _PMREG(0x04C) 139*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SYSCLK_CTRL _PMREG(0x050) 140*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_LCDCLK_CTRL _PMREG(0x054) 141*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_HCLKPLL_CTRL _PMREG(0x058) 142*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_ADC_CLK_CTRL_1 _PMREG(0x060) 143*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_USB_CTRL _PMREG(0x064) 144*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SDRAMCLK_CTRL _PMREG(0x068) 145*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_DDR_LAP_NOM _PMREG(0x06C) 146*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_DDR_LAP_COUNT _PMREG(0x070) 147*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_DDR_LAP_DELAY _PMREG(0x074) 148*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SSP_CLK_CTRL _PMREG(0x078) 149*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_I2S_CLK_CTRL _PMREG(0x07C) 150*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_MS_CTRL _PMREG(0x080) 151*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_MACCLK_CTRL _PMREG(0x090) 152*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_TEST_CLK_SEL _PMREG(0x0A4) 153*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SFW_INT _PMREG(0x0A8) 154*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_I2C_CLK_CTRL _PMREG(0x0AC) 155*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_KEY_CLK_CTRL _PMREG(0x0B0) 156*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_ADC_CLK_CTRL _PMREG(0x0B4) 157*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_PWM_CLK_CTRL _PMREG(0x0B8) 158*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_TIMER_CLK_CTRL _PMREG(0x0BC) 159*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_TIMERS_PWMS_CLK_CTRL_1 _PMREG(0x0C0) 160*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SPI_CLK_CTRL _PMREG(0x0C4) 161*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_NAND_CLK_CTRL _PMREG(0x0C8) 162*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_UART3_CLK_CTRL _PMREG(0x0D0) 163*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_UART4_CLK_CTRL _PMREG(0x0D4) 164*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_UART5_CLK_CTRL _PMREG(0x0D8) 165*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_UART6_CLK_CTRL _PMREG(0x0DC) 166*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_IRDA_CLK_CTRL _PMREG(0x0E0) 167*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_UART_CLK_CTRL _PMREG(0x0E4) 168*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_DMA_CLK_CTRL _PMREG(0x0E8) 169*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_AUTOCLOCK _PMREG(0x0EC) 170*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_DEVID(x) _PMREG(0x130 + (x)) 171*d3532910SArnd Bergmann 172*d3532910SArnd Bergmann /* 173*d3532910SArnd Bergmann * clkpwr_debug_ctrl register definitions 174*d3532910SArnd Bergmann */ 175*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_VFP_CLOCK_ENABLE_BIT _BIT(4) 176*d3532910SArnd Bergmann 177*d3532910SArnd Bergmann /* 178*d3532910SArnd Bergmann * clkpwr_bootmap register definitions 179*d3532910SArnd Bergmann */ 180*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_BOOTMAP_SEL_BIT _BIT(1) 181*d3532910SArnd Bergmann 182*d3532910SArnd Bergmann /* 183*d3532910SArnd Bergmann * clkpwr_start_gpio register bit definitions 184*d3532910SArnd Bergmann */ 185*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_GPIOSRC_P1IO23_BIT _BIT(31) 186*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_GPIOSRC_P1IO22_BIT _BIT(30) 187*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_GPIOSRC_P1IO21_BIT _BIT(29) 188*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_GPIOSRC_P1IO20_BIT _BIT(28) 189*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_GPIOSRC_P1IO19_BIT _BIT(27) 190*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_GPIOSRC_P1IO18_BIT _BIT(26) 191*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_GPIOSRC_P1IO17_BIT _BIT(25) 192*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_GPIOSRC_P1IO16_BIT _BIT(24) 193*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_GPIOSRC_P1IO15_BIT _BIT(23) 194*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_GPIOSRC_P1IO14_BIT _BIT(22) 195*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_GPIOSRC_P1IO13_BIT _BIT(21) 196*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_GPIOSRC_P1IO12_BIT _BIT(20) 197*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_GPIOSRC_P1IO11_BIT _BIT(19) 198*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_GPIOSRC_P1IO10_BIT _BIT(18) 199*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_GPIOSRC_P1IO9_BIT _BIT(17) 200*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_GPIOSRC_P1IO8_BIT _BIT(16) 201*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_GPIOSRC_P1IO7_BIT _BIT(15) 202*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_GPIOSRC_P1IO6_BIT _BIT(14) 203*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_GPIOSRC_P1IO5_BIT _BIT(13) 204*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_GPIOSRC_P1IO4_BIT _BIT(12) 205*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_GPIOSRC_P1IO3_BIT _BIT(11) 206*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_GPIOSRC_P1IO2_BIT _BIT(10) 207*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_GPIOSRC_P1IO1_BIT _BIT(9) 208*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_GPIOSRC_P1IO0_BIT _BIT(8) 209*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_GPIOSRC_P0IO7_BIT _BIT(7) 210*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_GPIOSRC_P0IO6_BIT _BIT(6) 211*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_GPIOSRC_P0IO5_BIT _BIT(5) 212*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_GPIOSRC_P0IO4_BIT _BIT(4) 213*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_GPIOSRC_P0IO3_BIT _BIT(3) 214*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_GPIOSRC_P0IO2_BIT _BIT(2) 215*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_GPIOSRC_P0IO1_BIT _BIT(1) 216*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_GPIOSRC_P0IO0_BIT _BIT(0) 217*d3532910SArnd Bergmann 218*d3532910SArnd Bergmann /* 219*d3532910SArnd Bergmann * clkpwr_usbclk_pdiv register definitions 220*d3532910SArnd Bergmann */ 221*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_USBPDIV_PLL_MASK 0xF 222*d3532910SArnd Bergmann 223*d3532910SArnd Bergmann /* 224*d3532910SArnd Bergmann * clkpwr_start_int, clkpwr_start_raw_sts_int, clkpwr_start_sts_int, 225*d3532910SArnd Bergmann * clkpwr_start_pol_int, register bit definitions 226*d3532910SArnd Bergmann */ 227*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_INTSRC_ADC_BIT _BIT(31) 228*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_INTSRC_TS_P_BIT _BIT(30) 229*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_INTSRC_TS_AUX_BIT _BIT(29) 230*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_INTSRC_USBAHNEEDCLK_BIT _BIT(26) 231*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_INTSRC_MSTIMER_BIT _BIT(25) 232*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_INTSRC_RTC_BIT _BIT(24) 233*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_INTSRC_USBNEEDCLK_BIT _BIT(23) 234*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_INTSRC_USB_BIT _BIT(22) 235*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_INTSRC_I2C_BIT _BIT(21) 236*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_INTSRC_USBOTGTIMER_BIT _BIT(20) 237*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_INTSRC_USBATXINT_BIT _BIT(19) 238*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_INTSRC_KEY_BIT _BIT(16) 239*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_INTSRC_MAC_BIT _BIT(7) 240*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_INTSRC_P0P1_BIT _BIT(6) 241*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_INTSRC_GPIO_05_BIT _BIT(5) 242*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_INTSRC_GPIO_04_BIT _BIT(4) 243*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_INTSRC_GPIO_03_BIT _BIT(3) 244*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_INTSRC_GPIO_02_BIT _BIT(2) 245*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_INTSRC_GPIO_01_BIT _BIT(1) 246*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_INTSRC_GPIO_00_BIT _BIT(0) 247*d3532910SArnd Bergmann 248*d3532910SArnd Bergmann /* 249*d3532910SArnd Bergmann * clkpwr_start_pin, clkpwr_start_raw_sts_pin, clkpwr_start_sts_pin, 250*d3532910SArnd Bergmann * clkpwr_start_pol_pin register bit definitions 251*d3532910SArnd Bergmann */ 252*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_EXTSRC_U7_RX_BIT _BIT(31) 253*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_EXTSRC_U7_HCTS_BIT _BIT(30) 254*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_EXTSRC_U6_IRRX_BIT _BIT(28) 255*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_EXTSRC_U5_RX_BIT _BIT(26) 256*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_EXTSRC_GPI_28_BIT _BIT(25) 257*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_EXTSRC_U3_RX_BIT _BIT(24) 258*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_EXTSRC_U2_HCTS_BIT _BIT(23) 259*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_EXTSRC_U2_RX_BIT _BIT(22) 260*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_EXTSRC_U1_RX_BIT _BIT(21) 261*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_EXTSRC_MSDIO_INT_BIT _BIT(18) 262*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_EXTSRC_MSDIO_SRT_BIT _BIT(17) 263*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_EXTSRC_GPI_06_BIT _BIT(16) 264*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_EXTSRC_GPI_05_BIT _BIT(15) 265*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_EXTSRC_GPI_04_BIT _BIT(14) 266*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_EXTSRC_GPI_03_BIT _BIT(13) 267*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_EXTSRC_GPI_02_BIT _BIT(12) 268*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_EXTSRC_GPI_01_BIT _BIT(11) 269*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_EXTSRC_GPI_00_BIT _BIT(10) 270*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_EXTSRC_SYSCLKEN_BIT _BIT(9) 271*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_EXTSRC_SPI1_DATIN_BIT _BIT(8) 272*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_EXTSRC_GPI_07_BIT _BIT(7) 273*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_EXTSRC_SPI2_DATIN_BIT _BIT(6) 274*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_EXTSRC_GPI_19_BIT _BIT(5) 275*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_EXTSRC_GPI_09_BIT _BIT(4) 276*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_EXTSRC_GPI_08_BIT _BIT(3) 277*d3532910SArnd Bergmann 278*d3532910SArnd Bergmann /* 279*d3532910SArnd Bergmann * clkpwr_hclk_div register definitions 280*d3532910SArnd Bergmann */ 281*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_HCLKDIV_DDRCLK_STOP (0x0 << 7) 282*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_HCLKDIV_DDRCLK_NORM (0x1 << 7) 283*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_HCLKDIV_DDRCLK_HALF (0x2 << 7) 284*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_HCLKDIV_PCLK_DIV(n) (((n) & 0x1F) << 2) 285*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_HCLKDIV_DIV_2POW(n) ((n) & 0x3) 286*d3532910SArnd Bergmann 287*d3532910SArnd Bergmann /* 288*d3532910SArnd Bergmann * clkpwr_pwr_ctrl register definitions 289*d3532910SArnd Bergmann */ 290*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_CTRL_FORCE_PCLK _BIT(10) 291*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SDRAM_SELF_RFSH _BIT(9) 292*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_UPD_SDRAM_SELF_RFSH _BIT(8) 293*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_AUTO_SDRAM_SELF_RFSH _BIT(7) 294*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_HIGHCORE_STATE_BIT _BIT(5) 295*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SYSCLKEN_STATE_BIT _BIT(4) 296*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SYSCLKEN_GPIO_EN _BIT(3) 297*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SELECT_RUN_MODE _BIT(2) 298*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_HIGHCORE_GPIO_EN _BIT(1) 299*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_STOP_MODE_CTRL _BIT(0) 300*d3532910SArnd Bergmann 301*d3532910SArnd Bergmann /* 302*d3532910SArnd Bergmann * clkpwr_pll397_ctrl register definitions 303*d3532910SArnd Bergmann */ 304*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_PLL397_MSLOCK_STS _BIT(10) 305*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_PLL397_BYPASS _BIT(9) 306*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_PLL397_BIAS_NORM 0x000 307*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_PLL397_BIAS_N12_5 0x040 308*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_PLL397_BIAS_N25 0x080 309*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_PLL397_BIAS_N37_5 0x0C0 310*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_PLL397_BIAS_P12_5 0x100 311*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_PLL397_BIAS_P25 0x140 312*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_PLL397_BIAS_P37_5 0x180 313*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_PLL397_BIAS_P50 0x1C0 314*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_PLL397_BIAS_MASK 0x1C0 315*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SYSCTRL_PLL397_DIS _BIT(1) 316*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SYSCTRL_PLL397_STS _BIT(0) 317*d3532910SArnd Bergmann 318*d3532910SArnd Bergmann /* 319*d3532910SArnd Bergmann * clkpwr_main_osc_ctrl register definitions 320*d3532910SArnd Bergmann */ 321*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_MOSC_ADD_CAP(n) (((n) & 0x7F) << 2) 322*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_MOSC_CAP_MASK (0x7F << 2) 323*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_TEST_MODE _BIT(1) 324*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_MOSC_DISABLE _BIT(0) 325*d3532910SArnd Bergmann 326*d3532910SArnd Bergmann /* 327*d3532910SArnd Bergmann * clkpwr_sysclk_ctrl register definitions 328*d3532910SArnd Bergmann */ 329*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SYSCTRL_BP_TRIG(n) (((n) & 0x3FF) << 2) 330*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SYSCTRL_BP_MASK (0x3FF << 2) 331*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SYSCTRL_USEPLL397 _BIT(1) 332*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SYSCTRL_SYSCLKMUX _BIT(0) 333*d3532910SArnd Bergmann 334*d3532910SArnd Bergmann /* 335*d3532910SArnd Bergmann * clkpwr_lcdclk_ctrl register definitions 336*d3532910SArnd Bergmann */ 337*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_TFT12 0x000 338*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_TFT16 0x040 339*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_TFT15 0x080 340*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_TFT24 0x0C0 341*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_STN4M 0x100 342*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_STN8C 0x140 343*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_DSTN4M 0x180 344*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_DSTN8C 0x1C0 345*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_LCDCTRL_LCDTYPE_MSK 0x01C0 346*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_LCDCTRL_CLK_EN 0x020 347*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_LCDCTRL_SET_PSCALE(n) ((n - 1) & 0x1F) 348*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_LCDCTRL_PSCALE_MSK 0x001F 349*d3532910SArnd Bergmann 350*d3532910SArnd Bergmann /* 351*d3532910SArnd Bergmann * clkpwr_hclkpll_ctrl register definitions 352*d3532910SArnd Bergmann */ 353*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_HCLKPLL_POWER_UP _BIT(16) 354*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_HCLKPLL_CCO_BYPASS _BIT(15) 355*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_HCLKPLL_POSTDIV_BYPASS _BIT(14) 356*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_HCLKPLL_FDBK_SEL_FCLK _BIT(13) 357*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_HCLKPLL_POSTDIV_2POW(n) (((n) & 0x3) << 11) 358*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_HCLKPLL_PREDIV_PLUS1(n) (((n) & 0x3) << 9) 359*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_HCLKPLL_PLLM(n) (((n) & 0xFF) << 1) 360*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_HCLKPLL_PLL_STS _BIT(0) 361*d3532910SArnd Bergmann 362*d3532910SArnd Bergmann /* 363*d3532910SArnd Bergmann * clkpwr_adc_clk_ctrl_1 register definitions 364*d3532910SArnd Bergmann */ 365*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_ADCCTRL1_RTDIV(n) (((n) & 0xFF) << 0) 366*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_ADCCTRL1_PCLK_SEL _BIT(8) 367*d3532910SArnd Bergmann 368*d3532910SArnd Bergmann /* 369*d3532910SArnd Bergmann * clkpwr_usb_ctrl register definitions 370*d3532910SArnd Bergmann */ 371*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_USBCTRL_HCLK_EN _BIT(24) 372*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_USBCTRL_USBI2C_EN _BIT(23) 373*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_USBCTRL_USBDVND_EN _BIT(22) 374*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_USBCTRL_USBHSTND_EN _BIT(21) 375*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_USBCTRL_PU_ADD (0x0 << 19) 376*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_USBCTRL_BUS_KEEPER (0x1 << 19) 377*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_USBCTRL_PD_ADD (0x3 << 19) 378*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_USBCTRL_CLK_EN2 _BIT(18) 379*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_USBCTRL_CLK_EN1 _BIT(17) 380*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_USBCTRL_PLL_PWRUP _BIT(16) 381*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_USBCTRL_CCO_BYPASS _BIT(15) 382*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_USBCTRL_POSTDIV_BYPASS _BIT(14) 383*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_USBCTRL_FDBK_SEL_FCLK _BIT(13) 384*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_USBCTRL_POSTDIV_2POW(n) (((n) & 0x3) << 11) 385*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_USBCTRL_PREDIV_PLUS1(n) (((n) & 0x3) << 9) 386*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_USBCTRL_FDBK_PLUS1(n) (((n) & 0xFF) << 1) 387*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_USBCTRL_PLL_STS _BIT(0) 388*d3532910SArnd Bergmann 389*d3532910SArnd Bergmann /* 390*d3532910SArnd Bergmann * clkpwr_sdramclk_ctrl register definitions 391*d3532910SArnd Bergmann */ 392*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SDRCLK_FASTSLEW_CLK _BIT(22) 393*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SDRCLK_FASTSLEW _BIT(21) 394*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SDRCLK_FASTSLEW_DAT _BIT(20) 395*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SDRCLK_SW_DDR_RESET _BIT(19) 396*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SDRCLK_HCLK_DLY(n) (((n) & 0x1F) << 14) 397*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SDRCLK_DLY_ADDR_STS _BIT(13) 398*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SDRCLK_SENS_FACT(n) (((n) & 0x7) << 10) 399*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SDRCLK_USE_CAL _BIT(9) 400*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SDRCLK_DO_CAL _BIT(8) 401*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SDRCLK_CAL_ON_RTC _BIT(7) 402*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SDRCLK_DQS_DLY(n) (((n) & 0x1F) << 2) 403*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SDRCLK_USE_DDR _BIT(1) 404*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SDRCLK_CLK_DIS _BIT(0) 405*d3532910SArnd Bergmann 406*d3532910SArnd Bergmann /* 407*d3532910SArnd Bergmann * clkpwr_ssp_blk_ctrl register definitions 408*d3532910SArnd Bergmann */ 409*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SSPCTRL_DMA_SSP1RX _BIT(5) 410*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SSPCTRL_DMA_SSP1TX _BIT(4) 411*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SSPCTRL_DMA_SSP0RX _BIT(3) 412*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SSPCTRL_DMA_SSP0TX _BIT(2) 413*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SSPCTRL_SSPCLK1_EN _BIT(1) 414*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SSPCTRL_SSPCLK0_EN _BIT(0) 415*d3532910SArnd Bergmann 416*d3532910SArnd Bergmann /* 417*d3532910SArnd Bergmann * clkpwr_i2s_clk_ctrl register definitions 418*d3532910SArnd Bergmann */ 419*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_I2SCTRL_I2S1_RX_FOR_TX _BIT(6) 420*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_I2SCTRL_I2S1_TX_FOR_RX _BIT(5) 421*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_I2SCTRL_I2S1_USE_DMA _BIT(4) 422*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_I2SCTRL_I2S0_RX_FOR_TX _BIT(3) 423*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_I2SCTRL_I2S0_TX_FOR_RX _BIT(2) 424*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_I2SCTRL_I2SCLK1_EN _BIT(1) 425*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_I2SCTRL_I2SCLK0_EN _BIT(0) 426*d3532910SArnd Bergmann 427*d3532910SArnd Bergmann /* 428*d3532910SArnd Bergmann * clkpwr_ms_ctrl register definitions 429*d3532910SArnd Bergmann */ 430*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_MSCARD_MSDIO_PIN_DIS _BIT(10) 431*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_MSCARD_MSDIO_PU_EN _BIT(9) 432*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_MSCARD_MSDIO23_DIS _BIT(8) 433*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_MSCARD_MSDIO1_DIS _BIT(7) 434*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_MSCARD_MSDIO0_DIS _BIT(6) 435*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_MSCARD_SDCARD_EN _BIT(5) 436*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_MSCARD_SDCARD_DIV(n) ((n) & 0xF) 437*d3532910SArnd Bergmann 438*d3532910SArnd Bergmann /* 439*d3532910SArnd Bergmann * clkpwr_macclk_ctrl register definitions 440*d3532910SArnd Bergmann */ 441*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_MACCTRL_NO_ENET_PIS 0x00 442*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_MACCTRL_USE_MII_PINS 0x08 443*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_MACCTRL_USE_RMII_PINS 0x18 444*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_MACCTRL_PINS_MSK 0x18 445*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_MACCTRL_DMACLK_EN _BIT(2) 446*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_MACCTRL_MMIOCLK_EN _BIT(1) 447*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_MACCTRL_HRCCLK_EN _BIT(0) 448*d3532910SArnd Bergmann 449*d3532910SArnd Bergmann /* 450*d3532910SArnd Bergmann * clkpwr_test_clk_sel register definitions 451*d3532910SArnd Bergmann */ 452*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_TESTCLK1_SEL_PERCLK (0x0 << 5) 453*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_TESTCLK1_SEL_RTC (0x1 << 5) 454*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_TESTCLK1_SEL_MOSC (0x2 << 5) 455*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_TESTCLK1_SEL_MASK (0x3 << 5) 456*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_TESTCLK_TESTCLK1_EN _BIT(4) 457*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_TESTCLK2_SEL_HCLK (0x0 << 1) 458*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_TESTCLK2_SEL_PERCLK (0x1 << 1) 459*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_TESTCLK2_SEL_USBCLK (0x2 << 1) 460*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_TESTCLK2_SEL_MOSC (0x5 << 1) 461*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_TESTCLK2_SEL_PLL397 (0x7 << 1) 462*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_TESTCLK2_SEL_MASK (0x7 << 1) 463*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_TESTCLK_TESTCLK2_EN _BIT(0) 464*d3532910SArnd Bergmann 465*d3532910SArnd Bergmann /* 466*d3532910SArnd Bergmann * clkpwr_sw_int register definitions 467*d3532910SArnd Bergmann */ 468*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SW_INT(n) (_BIT(0) | (((n) & 0x7F) << 1)) 469*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SW_GET_ARG(n) (((n) & 0xFE) >> 1) 470*d3532910SArnd Bergmann 471*d3532910SArnd Bergmann /* 472*d3532910SArnd Bergmann * clkpwr_i2c_clk_ctrl register definitions 473*d3532910SArnd Bergmann */ 474*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_I2CCLK_USBI2CHI_DRIVE _BIT(4) 475*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_I2CCLK_I2C2HI_DRIVE _BIT(3) 476*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_I2CCLK_I2C1HI_DRIVE _BIT(2) 477*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_I2CCLK_I2C2CLK_EN _BIT(1) 478*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_I2CCLK_I2C1CLK_EN _BIT(0) 479*d3532910SArnd Bergmann 480*d3532910SArnd Bergmann /* 481*d3532910SArnd Bergmann * clkpwr_key_clk_ctrl register definitions 482*d3532910SArnd Bergmann */ 483*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_KEYCLKCTRL_CLK_EN 0x1 484*d3532910SArnd Bergmann 485*d3532910SArnd Bergmann /* 486*d3532910SArnd Bergmann * clkpwr_adc_clk_ctrl register definitions 487*d3532910SArnd Bergmann */ 488*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_ADC32CLKCTRL_CLK_EN 0x1 489*d3532910SArnd Bergmann 490*d3532910SArnd Bergmann /* 491*d3532910SArnd Bergmann * clkpwr_pwm_clk_ctrl register definitions 492*d3532910SArnd Bergmann */ 493*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_PWMCLK_PWM2_DIV(n) (((n) & 0xF) << 8) 494*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_PWMCLK_PWM1_DIV(n) (((n) & 0xF) << 4) 495*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_PWMCLK_PWM2SEL_PCLK 0x8 496*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_PWMCLK_PWM2CLK_EN 0x4 497*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_PWMCLK_PWM1SEL_PCLK 0x2 498*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_PWMCLK_PWM1CLK_EN 0x1 499*d3532910SArnd Bergmann 500*d3532910SArnd Bergmann /* 501*d3532910SArnd Bergmann * clkpwr_timer_clk_ctrl register definitions 502*d3532910SArnd Bergmann */ 503*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_PWMCLK_HSTIMER_EN 0x2 504*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_PWMCLK_WDOG_EN 0x1 505*d3532910SArnd Bergmann 506*d3532910SArnd Bergmann /* 507*d3532910SArnd Bergmann * clkpwr_timers_pwms_clk_ctrl_1 register definitions 508*d3532910SArnd Bergmann */ 509*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_TMRPWMCLK_MPWM_EN 0x40 510*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_TMRPWMCLK_TIMER3_EN 0x20 511*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_TMRPWMCLK_TIMER2_EN 0x10 512*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_TMRPWMCLK_TIMER1_EN 0x08 513*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_TMRPWMCLK_TIMER0_EN 0x04 514*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_TMRPWMCLK_PWM4_EN 0x02 515*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_TMRPWMCLK_PWM3_EN 0x01 516*d3532910SArnd Bergmann 517*d3532910SArnd Bergmann /* 518*d3532910SArnd Bergmann * clkpwr_spi_clk_ctrl register definitions 519*d3532910SArnd Bergmann */ 520*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SPICLK_SET_SPI2DATIO 0x80 521*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SPICLK_SET_SPI2CLK 0x40 522*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SPICLK_USE_SPI2 0x20 523*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SPICLK_SPI2CLK_EN 0x10 524*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SPICLK_SET_SPI1DATIO 0x08 525*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SPICLK_SET_SPI1CLK 0x04 526*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SPICLK_USE_SPI1 0x02 527*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_SPICLK_SPI1CLK_EN 0x01 528*d3532910SArnd Bergmann 529*d3532910SArnd Bergmann /* 530*d3532910SArnd Bergmann * clkpwr_nand_clk_ctrl register definitions 531*d3532910SArnd Bergmann */ 532*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_NANDCLK_INTSEL_MLC 0x20 533*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_NANDCLK_DMA_RNB 0x10 534*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_NANDCLK_DMA_INT 0x08 535*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_NANDCLK_SEL_SLC 0x04 536*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_NANDCLK_MLCCLK_EN 0x02 537*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_NANDCLK_SLCCLK_EN 0x01 538*d3532910SArnd Bergmann 539*d3532910SArnd Bergmann /* 540*d3532910SArnd Bergmann * clkpwr_uart3_clk_ctrl, clkpwr_uart4_clk_ctrl, clkpwr_uart5_clk_ctrl 541*d3532910SArnd Bergmann * and clkpwr_uart6_clk_ctrl register definitions 542*d3532910SArnd Bergmann */ 543*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_UART_Y_DIV(y) ((y) & 0xFF) 544*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_UART_X_DIV(x) (((x) & 0xFF) << 8) 545*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_UART_USE_HCLK _BIT(16) 546*d3532910SArnd Bergmann 547*d3532910SArnd Bergmann /* 548*d3532910SArnd Bergmann * clkpwr_irda_clk_ctrl register definitions 549*d3532910SArnd Bergmann */ 550*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_IRDA_Y_DIV(y) ((y) & 0xFF) 551*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_IRDA_X_DIV(x) (((x) & 0xFF) << 8) 552*d3532910SArnd Bergmann 553*d3532910SArnd Bergmann /* 554*d3532910SArnd Bergmann * clkpwr_uart_clk_ctrl register definitions 555*d3532910SArnd Bergmann */ 556*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_UARTCLKCTRL_UART6_EN _BIT(3) 557*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_UARTCLKCTRL_UART5_EN _BIT(2) 558*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_UARTCLKCTRL_UART4_EN _BIT(1) 559*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_UARTCLKCTRL_UART3_EN _BIT(0) 560*d3532910SArnd Bergmann 561*d3532910SArnd Bergmann /* 562*d3532910SArnd Bergmann * clkpwr_dmaclk_ctrl register definitions 563*d3532910SArnd Bergmann */ 564*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_DMACLKCTRL_CLK_EN 0x1 565*d3532910SArnd Bergmann 566*d3532910SArnd Bergmann /* 567*d3532910SArnd Bergmann * clkpwr_autoclock register definitions 568*d3532910SArnd Bergmann */ 569*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_AUTOCLK_USB_EN 0x40 570*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_AUTOCLK_IRAM_EN 0x02 571*d3532910SArnd Bergmann #define LPC32XX_CLKPWR_AUTOCLK_IROM_EN 0x01 572*d3532910SArnd Bergmann 573*d3532910SArnd Bergmann /* 574*d3532910SArnd Bergmann * Interrupt controller register offsets 575*d3532910SArnd Bergmann */ 576*d3532910SArnd Bergmann #define LPC32XX_INTC_MASK(x) io_p2v((x) + 0x00) 577*d3532910SArnd Bergmann #define LPC32XX_INTC_RAW_STAT(x) io_p2v((x) + 0x04) 578*d3532910SArnd Bergmann #define LPC32XX_INTC_STAT(x) io_p2v((x) + 0x08) 579*d3532910SArnd Bergmann #define LPC32XX_INTC_POLAR(x) io_p2v((x) + 0x0C) 580*d3532910SArnd Bergmann #define LPC32XX_INTC_ACT_TYPE(x) io_p2v((x) + 0x10) 581*d3532910SArnd Bergmann #define LPC32XX_INTC_TYPE(x) io_p2v((x) + 0x14) 582*d3532910SArnd Bergmann 583*d3532910SArnd Bergmann /* 584*d3532910SArnd Bergmann * Timer/counter register offsets 585*d3532910SArnd Bergmann */ 586*d3532910SArnd Bergmann #define LPC32XX_TIMER_IR(x) io_p2v((x) + 0x00) 587*d3532910SArnd Bergmann #define LPC32XX_TIMER_TCR(x) io_p2v((x) + 0x04) 588*d3532910SArnd Bergmann #define LPC32XX_TIMER_TC(x) io_p2v((x) + 0x08) 589*d3532910SArnd Bergmann #define LPC32XX_TIMER_PR(x) io_p2v((x) + 0x0C) 590*d3532910SArnd Bergmann #define LPC32XX_TIMER_PC(x) io_p2v((x) + 0x10) 591*d3532910SArnd Bergmann #define LPC32XX_TIMER_MCR(x) io_p2v((x) + 0x14) 592*d3532910SArnd Bergmann #define LPC32XX_TIMER_MR0(x) io_p2v((x) + 0x18) 593*d3532910SArnd Bergmann #define LPC32XX_TIMER_MR1(x) io_p2v((x) + 0x1C) 594*d3532910SArnd Bergmann #define LPC32XX_TIMER_MR2(x) io_p2v((x) + 0x20) 595*d3532910SArnd Bergmann #define LPC32XX_TIMER_MR3(x) io_p2v((x) + 0x24) 596*d3532910SArnd Bergmann #define LPC32XX_TIMER_CCR(x) io_p2v((x) + 0x28) 597*d3532910SArnd Bergmann #define LPC32XX_TIMER_CR0(x) io_p2v((x) + 0x2C) 598*d3532910SArnd Bergmann #define LPC32XX_TIMER_CR1(x) io_p2v((x) + 0x30) 599*d3532910SArnd Bergmann #define LPC32XX_TIMER_CR2(x) io_p2v((x) + 0x34) 600*d3532910SArnd Bergmann #define LPC32XX_TIMER_CR3(x) io_p2v((x) + 0x38) 601*d3532910SArnd Bergmann #define LPC32XX_TIMER_EMR(x) io_p2v((x) + 0x3C) 602*d3532910SArnd Bergmann #define LPC32XX_TIMER_CTCR(x) io_p2v((x) + 0x70) 603*d3532910SArnd Bergmann 604*d3532910SArnd Bergmann /* 605*d3532910SArnd Bergmann * ir register definitions 606*d3532910SArnd Bergmann */ 607*d3532910SArnd Bergmann #define LPC32XX_TIMER_CNTR_MTCH_BIT(n) (1 << ((n) & 0x3)) 608*d3532910SArnd Bergmann #define LPC32XX_TIMER_CNTR_CAPT_BIT(n) (1 << (4 + ((n) & 0x3))) 609*d3532910SArnd Bergmann 610*d3532910SArnd Bergmann /* 611*d3532910SArnd Bergmann * tcr register definitions 612*d3532910SArnd Bergmann */ 613*d3532910SArnd Bergmann #define LPC32XX_TIMER_CNTR_TCR_EN 0x1 614*d3532910SArnd Bergmann #define LPC32XX_TIMER_CNTR_TCR_RESET 0x2 615*d3532910SArnd Bergmann 616*d3532910SArnd Bergmann /* 617*d3532910SArnd Bergmann * mcr register definitions 618*d3532910SArnd Bergmann */ 619*d3532910SArnd Bergmann #define LPC32XX_TIMER_CNTR_MCR_MTCH(n) (0x1 << ((n) * 3)) 620*d3532910SArnd Bergmann #define LPC32XX_TIMER_CNTR_MCR_RESET(n) (0x1 << (((n) * 3) + 1)) 621*d3532910SArnd Bergmann #define LPC32XX_TIMER_CNTR_MCR_STOP(n) (0x1 << (((n) * 3) + 2)) 622*d3532910SArnd Bergmann 623*d3532910SArnd Bergmann /* 624*d3532910SArnd Bergmann * Standard UART register offsets 625*d3532910SArnd Bergmann */ 626*d3532910SArnd Bergmann #define LPC32XX_UART_DLL_FIFO(x) io_p2v((x) + 0x00) 627*d3532910SArnd Bergmann #define LPC32XX_UART_DLM_IER(x) io_p2v((x) + 0x04) 628*d3532910SArnd Bergmann #define LPC32XX_UART_IIR_FCR(x) io_p2v((x) + 0x08) 629*d3532910SArnd Bergmann #define LPC32XX_UART_LCR(x) io_p2v((x) + 0x0C) 630*d3532910SArnd Bergmann #define LPC32XX_UART_MODEM_CTRL(x) io_p2v((x) + 0x10) 631*d3532910SArnd Bergmann #define LPC32XX_UART_LSR(x) io_p2v((x) + 0x14) 632*d3532910SArnd Bergmann #define LPC32XX_UART_MODEM_STATUS(x) io_p2v((x) + 0x18) 633*d3532910SArnd Bergmann #define LPC32XX_UART_RXLEV(x) io_p2v((x) + 0x1C) 634*d3532910SArnd Bergmann 635*d3532910SArnd Bergmann /* 636*d3532910SArnd Bergmann * UART control structure offsets 637*d3532910SArnd Bergmann */ 638*d3532910SArnd Bergmann #define _UCREG(x) io_p2v(\ 639*d3532910SArnd Bergmann LPC32XX_UART_CTRL_BASE + (x)) 640*d3532910SArnd Bergmann #define LPC32XX_UARTCTL_CTRL _UCREG(0x00) 641*d3532910SArnd Bergmann #define LPC32XX_UARTCTL_CLKMODE _UCREG(0x04) 642*d3532910SArnd Bergmann #define LPC32XX_UARTCTL_CLOOP _UCREG(0x08) 643*d3532910SArnd Bergmann 644*d3532910SArnd Bergmann /* 645*d3532910SArnd Bergmann * ctrl register definitions 646*d3532910SArnd Bergmann */ 647*d3532910SArnd Bergmann #define LPC32XX_UART_U3_MD_CTRL_EN _BIT(11) 648*d3532910SArnd Bergmann #define LPC32XX_UART_IRRX6_INV_EN _BIT(10) 649*d3532910SArnd Bergmann #define LPC32XX_UART_HDPX_EN _BIT(9) 650*d3532910SArnd Bergmann #define LPC32XX_UART_UART6_IRDAMOD_BYPASS _BIT(5) 651*d3532910SArnd Bergmann #define LPC32XX_RT_IRTX6_INV_EN _BIT(4) 652*d3532910SArnd Bergmann #define LPC32XX_RT_IRTX6_INV_MIR_EN _BIT(3) 653*d3532910SArnd Bergmann #define LPC32XX_RT_RX_IRPULSE_3_16_115K _BIT(2) 654*d3532910SArnd Bergmann #define LPC32XX_RT_TX_IRPULSE_3_16_115K _BIT(1) 655*d3532910SArnd Bergmann #define LPC32XX_UART_U5_ROUTE_TO_USB _BIT(0) 656*d3532910SArnd Bergmann 657*d3532910SArnd Bergmann /* 658*d3532910SArnd Bergmann * clkmode register definitions 659*d3532910SArnd Bergmann */ 660*d3532910SArnd Bergmann #define LPC32XX_UART_ENABLED_CLOCKS(n) (((n) >> 16) & 0x7F) 661*d3532910SArnd Bergmann #define LPC32XX_UART_ENABLED_CLOCK(n, u) (((n) >> (16 + (u))) & 0x1) 662*d3532910SArnd Bergmann #define LPC32XX_UART_ENABLED_CLKS_ANY _BIT(14) 663*d3532910SArnd Bergmann #define LPC32XX_UART_CLKMODE_OFF 0x0 664*d3532910SArnd Bergmann #define LPC32XX_UART_CLKMODE_ON 0x1 665*d3532910SArnd Bergmann #define LPC32XX_UART_CLKMODE_AUTO 0x2 666*d3532910SArnd Bergmann #define LPC32XX_UART_CLKMODE_MASK(u) (0x3 << ((((u) - 3) * 2) + 4)) 667*d3532910SArnd Bergmann #define LPC32XX_UART_CLKMODE_LOAD(m, u) ((m) << ((((u) - 3) * 2) + 4)) 668*d3532910SArnd Bergmann 669*d3532910SArnd Bergmann /* 670*d3532910SArnd Bergmann * GPIO Module Register offsets 671*d3532910SArnd Bergmann */ 672*d3532910SArnd Bergmann #define _GPREG(x) io_p2v(LPC32XX_GPIO_BASE + (x)) 673*d3532910SArnd Bergmann #define LPC32XX_GPIO_P_MUX_SET _GPREG(0x100) 674*d3532910SArnd Bergmann #define LPC32XX_GPIO_P_MUX_CLR _GPREG(0x104) 675*d3532910SArnd Bergmann #define LPC32XX_GPIO_P_MUX_STATE _GPREG(0x108) 676*d3532910SArnd Bergmann #define LPC32XX_GPIO_P3_MUX_SET _GPREG(0x110) 677*d3532910SArnd Bergmann #define LPC32XX_GPIO_P3_MUX_CLR _GPREG(0x114) 678*d3532910SArnd Bergmann #define LPC32XX_GPIO_P3_MUX_STATE _GPREG(0x118) 679*d3532910SArnd Bergmann #define LPC32XX_GPIO_P0_MUX_SET _GPREG(0x120) 680*d3532910SArnd Bergmann #define LPC32XX_GPIO_P0_MUX_CLR _GPREG(0x124) 681*d3532910SArnd Bergmann #define LPC32XX_GPIO_P0_MUX_STATE _GPREG(0x128) 682*d3532910SArnd Bergmann #define LPC32XX_GPIO_P1_MUX_SET _GPREG(0x130) 683*d3532910SArnd Bergmann #define LPC32XX_GPIO_P1_MUX_CLR _GPREG(0x134) 684*d3532910SArnd Bergmann #define LPC32XX_GPIO_P1_MUX_STATE _GPREG(0x138) 685*d3532910SArnd Bergmann #define LPC32XX_GPIO_P2_MUX_SET _GPREG(0x028) 686*d3532910SArnd Bergmann #define LPC32XX_GPIO_P2_MUX_CLR _GPREG(0x02C) 687*d3532910SArnd Bergmann #define LPC32XX_GPIO_P2_MUX_STATE _GPREG(0x030) 688*d3532910SArnd Bergmann 689*d3532910SArnd Bergmann /* 690*d3532910SArnd Bergmann * USB Otg Registers 691*d3532910SArnd Bergmann */ 692*d3532910SArnd Bergmann #define _OTGREG(x) io_p2v(LPC32XX_USB_OTG_BASE + (x)) 693*d3532910SArnd Bergmann #define LPC32XX_USB_OTG_CLK_CTRL _OTGREG(0xFF4) 694*d3532910SArnd Bergmann #define LPC32XX_USB_OTG_CLK_STAT _OTGREG(0xFF8) 695*d3532910SArnd Bergmann 696*d3532910SArnd Bergmann /* USB OTG CLK CTRL bit defines */ 697*d3532910SArnd Bergmann #define LPC32XX_USB_OTG_AHB_M_CLOCK_ON _BIT(4) 698*d3532910SArnd Bergmann #define LPC32XX_USB_OTG_OTG_CLOCK_ON _BIT(3) 699*d3532910SArnd Bergmann #define LPC32XX_USB_OTG_I2C_CLOCK_ON _BIT(2) 700*d3532910SArnd Bergmann #define LPC32XX_USB_OTG_DEV_CLOCK_ON _BIT(1) 701*d3532910SArnd Bergmann #define LPC32XX_USB_OTG_HOST_CLOCK_ON _BIT(0) 702*d3532910SArnd Bergmann 703*d3532910SArnd Bergmann /* 704*d3532910SArnd Bergmann * Start of virtual addresses for IO devices 705*d3532910SArnd Bergmann */ 706*d3532910SArnd Bergmann #define IO_BASE 0xF0000000 707*d3532910SArnd Bergmann 708*d3532910SArnd Bergmann /* 709*d3532910SArnd Bergmann * This macro relies on fact that for all HW i/o addresses bits 20-23 are 0 710*d3532910SArnd Bergmann */ 711*d3532910SArnd Bergmann #define IO_ADDRESS(x) IOMEM(((((x) & 0xff000000) >> 4) | ((x) & 0xfffff)) |\ 712*d3532910SArnd Bergmann IO_BASE) 713*d3532910SArnd Bergmann 714*d3532910SArnd Bergmann #define io_p2v(x) ((void __iomem *) (unsigned long) IO_ADDRESS(x)) 715*d3532910SArnd Bergmann #define io_v2p(x) ((((x) & 0x0ff00000) << 4) | ((x) & 0x000fffff)) 716*d3532910SArnd Bergmann 717*d3532910SArnd Bergmann #endif 718