12c8086a5Seric miao /* 22c8086a5Seric miao * linux/arch/arm/mach-pxa/pxa3xx.c 32c8086a5Seric miao * 42c8086a5Seric miao * code specific to pxa3xx aka Monahans 52c8086a5Seric miao * 62c8086a5Seric miao * Copyright (C) 2006 Marvell International Ltd. 72c8086a5Seric miao * 8e9bba8eeSeric miao * 2007-09-02: eric miao <eric.miao@marvell.com> 92c8086a5Seric miao * initial version 102c8086a5Seric miao * 112c8086a5Seric miao * This program is free software; you can redistribute it and/or modify 122c8086a5Seric miao * it under the terms of the GNU General Public License version 2 as 132c8086a5Seric miao * published by the Free Software Foundation. 142c8086a5Seric miao */ 152c8086a5Seric miao #include <linux/module.h> 162c8086a5Seric miao #include <linux/kernel.h> 172c8086a5Seric miao #include <linux/init.h> 18b8f649f1SHaojian Zhuang #include <linux/gpio-pxa.h> 192c8086a5Seric miao #include <linux/pm.h> 202c8086a5Seric miao #include <linux/platform_device.h> 212c8086a5Seric miao #include <linux/irq.h> 227b5dea12SRussell King #include <linux/io.h> 2382ce44d1SDaniel Mack #include <linux/of.h> 242eaa03b5SRafael J. Wysocki #include <linux/syscore_ops.h> 25b459396eSSebastian Andrzej Siewior #include <linux/i2c/pxa-i2c.h> 262c8086a5Seric miao 27851982c1SMarek Vasut #include <asm/mach/map.h> 282c74a0ceSRussell King #include <asm/suspend.h> 29a09e64fbSRussell King #include <mach/hardware.h> 30a09e64fbSRussell King #include <mach/pxa3xx-regs.h> 31afd2fc02SRussell King #include <mach/reset.h> 32293b2da1SArnd Bergmann #include <linux/platform_data/usb-ohci-pxa27x.h> 33a09e64fbSRussell King #include <mach/pm.h> 34a09e64fbSRussell King #include <mach/dma.h> 35ad68bb9fSMarek Vasut #include <mach/smemc.h> 364e611091SRob Herring #include <mach/irqs.h> 372c8086a5Seric miao 382c8086a5Seric miao #include "generic.h" 392c8086a5Seric miao #include "devices.h" 402c8086a5Seric miao 41bf293aecSMike Rapoport #define PECR_IE(n) ((1 << ((n) * 2)) << 28) 42bf293aecSMike Rapoport #define PECR_IS(n) ((1 << ((n) * 2)) << 29) 43bf293aecSMike Rapoport 44089d0362SDaniel Mack extern void __init pxa_dt_irq_init(int (*fn)(struct irq_data *, unsigned int)); 457b5dea12SRussell King #ifdef CONFIG_PM 467b5dea12SRussell King 477b5dea12SRussell King #define ISRAM_START 0x5c000000 487b5dea12SRussell King #define ISRAM_SIZE SZ_256K 497b5dea12SRussell King 507b5dea12SRussell King static void __iomem *sram; 517b5dea12SRussell King static unsigned long wakeup_src; 527b5dea12SRussell King 537b5dea12SRussell King /* 547b5dea12SRussell King * Enter a standby mode (S0D1C2 or S0D2C2). Upon wakeup, the dynamic 557b5dea12SRussell King * memory controller has to be reinitialised, so we place some code 567b5dea12SRussell King * in the SRAM to perform this function. 577b5dea12SRussell King * 587b5dea12SRussell King * We disable FIQs across the standby - otherwise, we might receive a 597b5dea12SRussell King * FIQ while the SDRAM is unavailable. 607b5dea12SRussell King */ 617b5dea12SRussell King static void pxa3xx_cpu_standby(unsigned int pwrmode) 627b5dea12SRussell King { 637b5dea12SRussell King extern const char pm_enter_standby_start[], pm_enter_standby_end[]; 647b5dea12SRussell King void (*fn)(unsigned int) = (void __force *)(sram + 0x8000); 657b5dea12SRussell King 667b5dea12SRussell King memcpy_toio(sram + 0x8000, pm_enter_standby_start, 677b5dea12SRussell King pm_enter_standby_end - pm_enter_standby_start); 687b5dea12SRussell King 697b5dea12SRussell King AD2D0SR = ~0; 707b5dea12SRussell King AD2D1SR = ~0; 717b5dea12SRussell King AD2D0ER = wakeup_src; 727b5dea12SRussell King AD2D1ER = 0; 737b5dea12SRussell King ASCR = ASCR; 747b5dea12SRussell King ARSR = ARSR; 757b5dea12SRussell King 767b5dea12SRussell King local_fiq_disable(); 777b5dea12SRussell King fn(pwrmode); 787b5dea12SRussell King local_fiq_enable(); 797b5dea12SRussell King 807b5dea12SRussell King AD2D0ER = 0; 817b5dea12SRussell King AD2D1ER = 0; 827b5dea12SRussell King } 837b5dea12SRussell King 84c4d1fb62Seric miao /* 85c4d1fb62Seric miao * NOTE: currently, the OBM (OEM Boot Module) binary comes along with 86c4d1fb62Seric miao * PXA3xx development kits assumes that the resuming process continues 87c4d1fb62Seric miao * with the address stored within the first 4 bytes of SDRAM. The PSPR 88c4d1fb62Seric miao * register is used privately by BootROM and OBM, and _must_ be set to 89c4d1fb62Seric miao * 0x5c014000 for the moment. 90c4d1fb62Seric miao */ 91c4d1fb62Seric miao static void pxa3xx_cpu_pm_suspend(void) 92c4d1fb62Seric miao { 93c4d1fb62Seric miao volatile unsigned long *p = (volatile void *)0xc0000000; 94c4d1fb62Seric miao unsigned long saved_data = *p; 95a9503d21SRussell King #ifndef CONFIG_IWMMXT 96a9503d21SRussell King u64 acc0; 97c4d1fb62Seric miao 98a9503d21SRussell King asm volatile("mra %Q0, %R0, acc0" : "=r" (acc0)); 99a9503d21SRussell King #endif 100a9503d21SRussell King 10129cb3cd2SRussell King extern int pxa3xx_finish_suspend(unsigned long); 102c4d1fb62Seric miao 103c4d1fb62Seric miao /* resuming from D2 requires the HSIO2/BOOT/TPM clocks enabled */ 104c4d1fb62Seric miao CKENA |= (1 << CKEN_BOOT) | (1 << CKEN_TPM); 105c4d1fb62Seric miao CKENB |= 1 << (CKEN_HSIO2 & 0x1f); 106c4d1fb62Seric miao 107c4d1fb62Seric miao /* clear and setup wakeup source */ 108c4d1fb62Seric miao AD3SR = ~0; 109c4d1fb62Seric miao AD3ER = wakeup_src; 110c4d1fb62Seric miao ASCR = ASCR; 111c4d1fb62Seric miao ARSR = ARSR; 112c4d1fb62Seric miao 113c4d1fb62Seric miao PCFR |= (1u << 13); /* L1_DIS */ 114c4d1fb62Seric miao PCFR &= ~((1u << 12) | (1u << 1)); /* L0_EN | SL_ROD */ 115c4d1fb62Seric miao 116c4d1fb62Seric miao PSPR = 0x5c014000; 117c4d1fb62Seric miao 118c4d1fb62Seric miao /* overwrite with the resume address */ 1194f5ad99bSRussell King *p = virt_to_phys(cpu_resume); 120c4d1fb62Seric miao 1212c74a0ceSRussell King cpu_suspend(0, pxa3xx_finish_suspend); 122c4d1fb62Seric miao 123c4d1fb62Seric miao *p = saved_data; 124c4d1fb62Seric miao 125c4d1fb62Seric miao AD3ER = 0; 126a9503d21SRussell King 127a9503d21SRussell King #ifndef CONFIG_IWMMXT 128a9503d21SRussell King asm volatile("mar acc0, %Q0, %R0" : "=r" (acc0)); 129a9503d21SRussell King #endif 130c4d1fb62Seric miao } 131c4d1fb62Seric miao 1327b5dea12SRussell King static void pxa3xx_cpu_pm_enter(suspend_state_t state) 1337b5dea12SRussell King { 1347b5dea12SRussell King /* 1357b5dea12SRussell King * Don't sleep if no wakeup sources are defined 1367b5dea12SRussell King */ 137b86a5da8SMark Brown if (wakeup_src == 0) { 138b86a5da8SMark Brown printk(KERN_ERR "Not suspending: no wakeup sources\n"); 1397b5dea12SRussell King return; 140b86a5da8SMark Brown } 1417b5dea12SRussell King 1427b5dea12SRussell King switch (state) { 1437b5dea12SRussell King case PM_SUSPEND_STANDBY: 1447b5dea12SRussell King pxa3xx_cpu_standby(PXA3xx_PM_S0D2C2); 1457b5dea12SRussell King break; 1467b5dea12SRussell King 1477b5dea12SRussell King case PM_SUSPEND_MEM: 148c4d1fb62Seric miao pxa3xx_cpu_pm_suspend(); 1497b5dea12SRussell King break; 1507b5dea12SRussell King } 1517b5dea12SRussell King } 1527b5dea12SRussell King 1537b5dea12SRussell King static int pxa3xx_cpu_pm_valid(suspend_state_t state) 1547b5dea12SRussell King { 1557b5dea12SRussell King return state == PM_SUSPEND_MEM || state == PM_SUSPEND_STANDBY; 1567b5dea12SRussell King } 1577b5dea12SRussell King 1587b5dea12SRussell King static struct pxa_cpu_pm_fns pxa3xx_cpu_pm_fns = { 1597b5dea12SRussell King .valid = pxa3xx_cpu_pm_valid, 1607b5dea12SRussell King .enter = pxa3xx_cpu_pm_enter, 1617b5dea12SRussell King }; 1627b5dea12SRussell King 1637b5dea12SRussell King static void __init pxa3xx_init_pm(void) 1647b5dea12SRussell King { 1657b5dea12SRussell King sram = ioremap(ISRAM_START, ISRAM_SIZE); 1667b5dea12SRussell King if (!sram) { 1677b5dea12SRussell King printk(KERN_ERR "Unable to map ISRAM: disabling standby/suspend\n"); 1687b5dea12SRussell King return; 1697b5dea12SRussell King } 1707b5dea12SRussell King 1717b5dea12SRussell King /* 1727b5dea12SRussell King * Since we copy wakeup code into the SRAM, we need to ensure 1737b5dea12SRussell King * that it is preserved over the low power modes. Note: bit 8 1747b5dea12SRussell King * is undocumented in the developer manual, but must be set. 1757b5dea12SRussell King */ 1767b5dea12SRussell King AD1R |= ADXR_L2 | ADXR_R0; 1777b5dea12SRussell King AD2R |= ADXR_L2 | ADXR_R0; 1787b5dea12SRussell King AD3R |= ADXR_L2 | ADXR_R0; 1797b5dea12SRussell King 1807b5dea12SRussell King /* 1817b5dea12SRussell King * Clear the resume enable registers. 1827b5dea12SRussell King */ 1837b5dea12SRussell King AD1D0ER = 0; 1847b5dea12SRussell King AD2D0ER = 0; 1857b5dea12SRussell King AD2D1ER = 0; 1867b5dea12SRussell King AD3ER = 0; 1877b5dea12SRussell King 1887b5dea12SRussell King pxa_cpu_pm_fns = &pxa3xx_cpu_pm_fns; 1897b5dea12SRussell King } 1907b5dea12SRussell King 191a3f4c927SLennert Buytenhek static int pxa3xx_set_wake(struct irq_data *d, unsigned int on) 1927b5dea12SRussell King { 1937b5dea12SRussell King unsigned long flags, mask = 0; 1947b5dea12SRussell King 195a3f4c927SLennert Buytenhek switch (d->irq) { 1967b5dea12SRussell King case IRQ_SSP3: 1977b5dea12SRussell King mask = ADXER_MFP_WSSP3; 1987b5dea12SRussell King break; 1997b5dea12SRussell King case IRQ_MSL: 2007b5dea12SRussell King mask = ADXER_WMSL0; 2017b5dea12SRussell King break; 2027b5dea12SRussell King case IRQ_USBH2: 2037b5dea12SRussell King case IRQ_USBH1: 2047b5dea12SRussell King mask = ADXER_WUSBH; 2057b5dea12SRussell King break; 2067b5dea12SRussell King case IRQ_KEYPAD: 2077b5dea12SRussell King mask = ADXER_WKP; 2087b5dea12SRussell King break; 2097b5dea12SRussell King case IRQ_AC97: 2107b5dea12SRussell King mask = ADXER_MFP_WAC97; 2117b5dea12SRussell King break; 2127b5dea12SRussell King case IRQ_USIM: 2137b5dea12SRussell King mask = ADXER_WUSIM0; 2147b5dea12SRussell King break; 2157b5dea12SRussell King case IRQ_SSP2: 2167b5dea12SRussell King mask = ADXER_MFP_WSSP2; 2177b5dea12SRussell King break; 2187b5dea12SRussell King case IRQ_I2C: 2197b5dea12SRussell King mask = ADXER_MFP_WI2C; 2207b5dea12SRussell King break; 2217b5dea12SRussell King case IRQ_STUART: 2227b5dea12SRussell King mask = ADXER_MFP_WUART3; 2237b5dea12SRussell King break; 2247b5dea12SRussell King case IRQ_BTUART: 2257b5dea12SRussell King mask = ADXER_MFP_WUART2; 2267b5dea12SRussell King break; 2277b5dea12SRussell King case IRQ_FFUART: 2287b5dea12SRussell King mask = ADXER_MFP_WUART1; 2297b5dea12SRussell King break; 2307b5dea12SRussell King case IRQ_MMC: 2317b5dea12SRussell King mask = ADXER_MFP_WMMC1; 2327b5dea12SRussell King break; 2337b5dea12SRussell King case IRQ_SSP: 2347b5dea12SRussell King mask = ADXER_MFP_WSSP1; 2357b5dea12SRussell King break; 2367b5dea12SRussell King case IRQ_RTCAlrm: 2377b5dea12SRussell King mask = ADXER_WRTC; 2387b5dea12SRussell King break; 2397b5dea12SRussell King case IRQ_SSP4: 2407b5dea12SRussell King mask = ADXER_MFP_WSSP4; 2417b5dea12SRussell King break; 2427b5dea12SRussell King case IRQ_TSI: 2437b5dea12SRussell King mask = ADXER_WTSI; 2447b5dea12SRussell King break; 2457b5dea12SRussell King case IRQ_USIM2: 2467b5dea12SRussell King mask = ADXER_WUSIM1; 2477b5dea12SRussell King break; 2487b5dea12SRussell King case IRQ_MMC2: 2497b5dea12SRussell King mask = ADXER_MFP_WMMC2; 2507b5dea12SRussell King break; 2517b5dea12SRussell King case IRQ_NAND: 2527b5dea12SRussell King mask = ADXER_MFP_WFLASH; 2537b5dea12SRussell King break; 2547b5dea12SRussell King case IRQ_USB2: 2557b5dea12SRussell King mask = ADXER_WUSB2; 2567b5dea12SRussell King break; 2577b5dea12SRussell King case IRQ_WAKEUP0: 2587b5dea12SRussell King mask = ADXER_WEXTWAKE0; 2597b5dea12SRussell King break; 2607b5dea12SRussell King case IRQ_WAKEUP1: 2617b5dea12SRussell King mask = ADXER_WEXTWAKE1; 2627b5dea12SRussell King break; 2637b5dea12SRussell King case IRQ_MMC3: 2647b5dea12SRussell King mask = ADXER_MFP_GEN12; 2657b5dea12SRussell King break; 266e1217707SMark Brown default: 267e1217707SMark Brown return -EINVAL; 2687b5dea12SRussell King } 2697b5dea12SRussell King 2707b5dea12SRussell King local_irq_save(flags); 2717b5dea12SRussell King if (on) 2727b5dea12SRussell King wakeup_src |= mask; 2737b5dea12SRussell King else 2747b5dea12SRussell King wakeup_src &= ~mask; 2757b5dea12SRussell King local_irq_restore(flags); 2767b5dea12SRussell King 2777b5dea12SRussell King return 0; 2787b5dea12SRussell King } 2797b5dea12SRussell King #else 2807b5dea12SRussell King static inline void pxa3xx_init_pm(void) {} 281b9e25aceSeric miao #define pxa3xx_set_wake NULL 2827b5dea12SRussell King #endif 2837b5dea12SRussell King 284a3f4c927SLennert Buytenhek static void pxa_ack_ext_wakeup(struct irq_data *d) 285bf293aecSMike Rapoport { 286a3f4c927SLennert Buytenhek PECR |= PECR_IS(d->irq - IRQ_WAKEUP0); 287bf293aecSMike Rapoport } 288bf293aecSMike Rapoport 289a3f4c927SLennert Buytenhek static void pxa_mask_ext_wakeup(struct irq_data *d) 290bf293aecSMike Rapoport { 2915d284e35SEric Miao pxa_mask_irq(d); 292a3f4c927SLennert Buytenhek PECR &= ~PECR_IE(d->irq - IRQ_WAKEUP0); 293bf293aecSMike Rapoport } 294bf293aecSMike Rapoport 295a3f4c927SLennert Buytenhek static void pxa_unmask_ext_wakeup(struct irq_data *d) 296bf293aecSMike Rapoport { 2975d284e35SEric Miao pxa_unmask_irq(d); 298a3f4c927SLennert Buytenhek PECR |= PECR_IE(d->irq - IRQ_WAKEUP0); 299bf293aecSMike Rapoport } 300bf293aecSMike Rapoport 301a3f4c927SLennert Buytenhek static int pxa_set_ext_wakeup_type(struct irq_data *d, unsigned int flow_type) 30212882096SIgor Grinberg { 30312882096SIgor Grinberg if (flow_type & IRQ_TYPE_EDGE_RISING) 304a3f4c927SLennert Buytenhek PWER |= 1 << (d->irq - IRQ_WAKEUP0); 30512882096SIgor Grinberg 30612882096SIgor Grinberg if (flow_type & IRQ_TYPE_EDGE_FALLING) 307a3f4c927SLennert Buytenhek PWER |= 1 << (d->irq - IRQ_WAKEUP0 + 2); 30812882096SIgor Grinberg 30912882096SIgor Grinberg return 0; 31012882096SIgor Grinberg } 31112882096SIgor Grinberg 312bf293aecSMike Rapoport static struct irq_chip pxa_ext_wakeup_chip = { 313bf293aecSMike Rapoport .name = "WAKEUP", 314a3f4c927SLennert Buytenhek .irq_ack = pxa_ack_ext_wakeup, 315a3f4c927SLennert Buytenhek .irq_mask = pxa_mask_ext_wakeup, 316a3f4c927SLennert Buytenhek .irq_unmask = pxa_unmask_ext_wakeup, 317a3f4c927SLennert Buytenhek .irq_set_type = pxa_set_ext_wakeup_type, 318bf293aecSMike Rapoport }; 319bf293aecSMike Rapoport 320157d2644SHaojian Zhuang static void __init pxa_init_ext_wakeup_irq(int (*fn)(struct irq_data *, 321157d2644SHaojian Zhuang unsigned int)) 322bf293aecSMike Rapoport { 323bf293aecSMike Rapoport int irq; 324bf293aecSMike Rapoport 325bf293aecSMike Rapoport for (irq = IRQ_WAKEUP0; irq <= IRQ_WAKEUP1; irq++) { 326f38c02f3SThomas Gleixner irq_set_chip_and_handler(irq, &pxa_ext_wakeup_chip, 327f38c02f3SThomas Gleixner handle_edge_irq); 328e8d36d5dSRob Herring irq_clear_status_flags(irq, IRQ_NOREQUEST); 329bf293aecSMike Rapoport } 330bf293aecSMike Rapoport 331a3f4c927SLennert Buytenhek pxa_ext_wakeup_chip.irq_set_wake = fn; 332bf293aecSMike Rapoport } 333bf293aecSMike Rapoport 334089d0362SDaniel Mack static void __init __pxa3xx_init_irq(void) 3352c8086a5Seric miao { 3362c8086a5Seric miao /* enable CP6 access */ 3372c8086a5Seric miao u32 value; 3382c8086a5Seric miao __asm__ __volatile__("mrc p15, 0, %0, c15, c1, 0\n": "=r"(value)); 3392c8086a5Seric miao value |= (1 << 6); 3402c8086a5Seric miao __asm__ __volatile__("mcr p15, 0, %0, c15, c1, 0\n": :"r"(value)); 3412c8086a5Seric miao 342bf293aecSMike Rapoport pxa_init_ext_wakeup_irq(pxa3xx_set_wake); 3432c8086a5Seric miao } 3442c8086a5Seric miao 345089d0362SDaniel Mack void __init pxa3xx_init_irq(void) 346089d0362SDaniel Mack { 347089d0362SDaniel Mack __pxa3xx_init_irq(); 348089d0362SDaniel Mack pxa_init_irq(56, pxa3xx_set_wake); 349089d0362SDaniel Mack } 350089d0362SDaniel Mack 351e6c509c8SHaojian Zhuang #ifdef CONFIG_OF 352089d0362SDaniel Mack void __init pxa3xx_dt_init_irq(void) 353089d0362SDaniel Mack { 354089d0362SDaniel Mack __pxa3xx_init_irq(); 355089d0362SDaniel Mack pxa_dt_irq_init(pxa3xx_set_wake); 356089d0362SDaniel Mack } 357e6c509c8SHaojian Zhuang #endif /* CONFIG_OF */ 358089d0362SDaniel Mack 359851982c1SMarek Vasut static struct map_desc pxa3xx_io_desc[] __initdata = { 360851982c1SMarek Vasut { /* Mem Ctl */ 36197b09da4SArnd Bergmann .virtual = (unsigned long)SMEMC_VIRT, 362ad68bb9fSMarek Vasut .pfn = __phys_to_pfn(PXA3XX_SMEMC_BASE), 3630e32986cSLaurent Pinchart .length = SMEMC_SIZE, 364851982c1SMarek Vasut .type = MT_DEVICE 365851982c1SMarek Vasut } 366851982c1SMarek Vasut }; 367851982c1SMarek Vasut 368851982c1SMarek Vasut void __init pxa3xx_map_io(void) 369851982c1SMarek Vasut { 370851982c1SMarek Vasut pxa_map_io(); 371851982c1SMarek Vasut iotable_init(ARRAY_AND_SIZE(pxa3xx_io_desc)); 372851982c1SMarek Vasut pxa3xx_get_clk_frequency_khz(1); 373851982c1SMarek Vasut } 374851982c1SMarek Vasut 3752c8086a5Seric miao /* 3762c8086a5Seric miao * device registration specific to PXA3xx. 3772c8086a5Seric miao */ 3782c8086a5Seric miao 3799ba63c4fSMike Rapoport void __init pxa3xx_set_i2c_power_info(struct i2c_pxa_platform_data *info) 3809ba63c4fSMike Rapoport { 38114758220SEric Miao pxa_register_device(&pxa3xx_device_i2c_power, info); 3829ba63c4fSMike Rapoport } 3839ba63c4fSMike Rapoport 384b8f649f1SHaojian Zhuang static struct pxa_gpio_platform_data pxa3xx_gpio_pdata = { 385b8f649f1SHaojian Zhuang .irq_base = PXA_GPIO_TO_IRQ(0), 386b8f649f1SHaojian Zhuang }; 387b8f649f1SHaojian Zhuang 3882c8086a5Seric miao static struct platform_device *devices[] __initdata = { 38994c35a6bSRobert Jarzmik &pxa27x_device_udc, 39009a5358dSEric Miao &pxa_device_pmu, 3912c8086a5Seric miao &pxa_device_i2s, 392f0fba2adSLiam Girdwood &pxa_device_asoc_ssp1, 393f0fba2adSLiam Girdwood &pxa_device_asoc_ssp2, 394f0fba2adSLiam Girdwood &pxa_device_asoc_ssp3, 395f0fba2adSLiam Girdwood &pxa_device_asoc_ssp4, 396f0fba2adSLiam Girdwood &pxa_device_asoc_platform, 39772493146SRobert Jarzmik &sa1100_device_rtc, 3982c8086a5Seric miao &pxa_device_rtc, 3990da0e227SDaniel Mack &pxa3xx_device_ssp1, 4000da0e227SDaniel Mack &pxa3xx_device_ssp2, 4010da0e227SDaniel Mack &pxa3xx_device_ssp3, 402d8e0db11Seric miao &pxa3xx_device_ssp4, 40375540c1aSeric miao &pxa27x_device_pwm0, 40475540c1aSeric miao &pxa27x_device_pwm1, 4052c8086a5Seric miao }; 4062c8086a5Seric miao 4072c8086a5Seric miao static int __init pxa3xx_init(void) 4082c8086a5Seric miao { 4092eaa03b5SRafael J. Wysocki int ret = 0; 4102c8086a5Seric miao 4112c8086a5Seric miao if (cpu_is_pxa3xx()) { 41204fef228SEric Miao 41304fef228SEric Miao reset_status = ARSR; 41404fef228SEric Miao 41586260f98SDmitry Krivoschekov /* 41686260f98SDmitry Krivoschekov * clear RDH bit every time after reset 41786260f98SDmitry Krivoschekov * 41886260f98SDmitry Krivoschekov * Note: the last 3 bits DxS are write-1-to-clear so carefully 41986260f98SDmitry Krivoschekov * preserve them here in case they will be referenced later 42086260f98SDmitry Krivoschekov */ 42186260f98SDmitry Krivoschekov ASCR &= ~(ASCR_RDH | ASCR_D1S | ASCR_D2S | ASCR_D3S); 42286260f98SDmitry Krivoschekov 423fef1f99aSEric Miao if ((ret = pxa_init_dma(IRQ_DMA, 32))) 4242c8086a5Seric miao return ret; 4252c8086a5Seric miao 4267b5dea12SRussell King pxa3xx_init_pm(); 4277b5dea12SRussell King 4282eaa03b5SRafael J. Wysocki register_syscore_ops(&pxa_irq_syscore_ops); 4292eaa03b5SRafael J. Wysocki register_syscore_ops(&pxa3xx_mfp_syscore_ops); 430c0165504Seric miao 4312cab0292SHaojian Zhuang if (of_have_populated_dt()) 4322cab0292SHaojian Zhuang return 0; 4332cab0292SHaojian Zhuang 434c0165504Seric miao ret = platform_add_devices(devices, ARRAY_SIZE(devices)); 4352cab0292SHaojian Zhuang if (ret) 4362cab0292SHaojian Zhuang return ret; 437b8f649f1SHaojian Zhuang if (cpu_is_pxa300() || cpu_is_pxa310() || cpu_is_pxa320()) { 438b8f649f1SHaojian Zhuang platform_device_add_data(&pxa3xx_device_gpio, 439b8f649f1SHaojian Zhuang &pxa3xx_gpio_pdata, 440b8f649f1SHaojian Zhuang sizeof(pxa3xx_gpio_pdata)); 4412cab0292SHaojian Zhuang ret = platform_device_register(&pxa3xx_device_gpio); 442c0165504Seric miao } 443b8f649f1SHaojian Zhuang } 444c0165504Seric miao 445c0165504Seric miao return ret; 4462c8086a5Seric miao } 4472c8086a5Seric miao 4481c104e0eSRussell King postcore_initcall(pxa3xx_init); 449