1*77b55e8cSThomas Abraham /* 2*77b55e8cSThomas Abraham * (C) Copyright 2012 Samsung Electronics 3*77b55e8cSThomas Abraham * Donghwa Lee <dh09.lee@samsung.com> 4*77b55e8cSThomas Abraham * 5*77b55e8cSThomas Abraham * SPDX-License-Identifier: GPL-2.0+ 6*77b55e8cSThomas Abraham */ 7*77b55e8cSThomas Abraham 8*77b55e8cSThomas Abraham #ifndef __ASM_ARM_ARCH_SYSTEM_H_ 9*77b55e8cSThomas Abraham #define __ASM_ARM_ARCH_SYSTEM_H_ 10*77b55e8cSThomas Abraham 11*77b55e8cSThomas Abraham #ifndef __ASSEMBLY__ 12*77b55e8cSThomas Abraham struct exynos4_sysreg { 13*77b55e8cSThomas Abraham unsigned char res1[0x210]; 14*77b55e8cSThomas Abraham unsigned int display_ctrl; 15*77b55e8cSThomas Abraham unsigned int display_ctrl2; 16*77b55e8cSThomas Abraham unsigned int camera_control; 17*77b55e8cSThomas Abraham unsigned int audio_endian; 18*77b55e8cSThomas Abraham unsigned int jtag_con; 19*77b55e8cSThomas Abraham }; 20*77b55e8cSThomas Abraham 21*77b55e8cSThomas Abraham struct exynos5_sysreg { 22*77b55e8cSThomas Abraham unsigned char res1[0x214]; 23*77b55e8cSThomas Abraham unsigned int disp1blk_cfg; 24*77b55e8cSThomas Abraham unsigned int disp2blk_cfg; 25*77b55e8cSThomas Abraham unsigned int hdcp_e_fuse; 26*77b55e8cSThomas Abraham unsigned int gsclblk_cfg0; 27*77b55e8cSThomas Abraham unsigned int gsclblk_cfg1; 28*77b55e8cSThomas Abraham unsigned int reserved; 29*77b55e8cSThomas Abraham unsigned int ispblk_cfg; 30*77b55e8cSThomas Abraham unsigned int usb20phy_cfg; 31*77b55e8cSThomas Abraham unsigned char res2[0x29c]; 32*77b55e8cSThomas Abraham unsigned int mipi_dphy; 33*77b55e8cSThomas Abraham unsigned int dptx_dphy; 34*77b55e8cSThomas Abraham unsigned int phyclk_sel; 35*77b55e8cSThomas Abraham }; 36*77b55e8cSThomas Abraham #endif 37*77b55e8cSThomas Abraham 38*77b55e8cSThomas Abraham #define USB20_PHY_CFG_HOST_LINK_EN (1 << 0) 39*77b55e8cSThomas Abraham 40*77b55e8cSThomas Abraham /* 41*77b55e8cSThomas Abraham * Data Synchronization Barrier acts as a special kind of memory barrier. 42*77b55e8cSThomas Abraham * No instruction in program order after this instruction executes until 43*77b55e8cSThomas Abraham * this instruction completes. This instruction completes when: 44*77b55e8cSThomas Abraham * - All explicit memory accesses before this instruction complete. 45*77b55e8cSThomas Abraham * - All Cache, Branch predictor and TLB maintenance operations before 46*77b55e8cSThomas Abraham * this instruction complete. 47*77b55e8cSThomas Abraham */ 48*77b55e8cSThomas Abraham #define dsb() __asm__ __volatile__ ("dsb\n\t" : : ); 49*77b55e8cSThomas Abraham 50*77b55e8cSThomas Abraham /* 51*77b55e8cSThomas Abraham * This instruction causes an event to be signaled to all cores 52*77b55e8cSThomas Abraham * within a multiprocessor system. If SEV is implemented, 53*77b55e8cSThomas Abraham * WFE must also be implemented. 54*77b55e8cSThomas Abraham */ 55*77b55e8cSThomas Abraham #define sev() __asm__ __volatile__ ("sev\n\t" : : ); 56*77b55e8cSThomas Abraham /* 57*77b55e8cSThomas Abraham * If the Event Register is not set, WFE suspends execution until 58*77b55e8cSThomas Abraham * one of the following events occurs: 59*77b55e8cSThomas Abraham * - an IRQ interrupt, unless masked by the CPSR I-bit 60*77b55e8cSThomas Abraham * - an FIQ interrupt, unless masked by the CPSR F-bit 61*77b55e8cSThomas Abraham * - an Imprecise Data abort, unless masked by the CPSR A-bit 62*77b55e8cSThomas Abraham * - a Debug Entry request, if Debug is enabled 63*77b55e8cSThomas Abraham * - an Event signaled by another processor using the SEV instruction. 64*77b55e8cSThomas Abraham * If the Event Register is set, WFE clears it and returns immediately. 65*77b55e8cSThomas Abraham * If WFE is implemented, SEV must also be implemented. 66*77b55e8cSThomas Abraham */ 67*77b55e8cSThomas Abraham #define wfe() __asm__ __volatile__ ("wfe\n\t" : : ); 68*77b55e8cSThomas Abraham 69*77b55e8cSThomas Abraham /* Move 0xd3 value to CPSR register to enable SVC mode */ 70*77b55e8cSThomas Abraham #define svc32_mode_en() __asm__ __volatile__ \ 71*77b55e8cSThomas Abraham ("@ I&F disable, Mode: 0x13 - SVC\n\t" \ 72*77b55e8cSThomas Abraham "msr cpsr_c, #0x13|0xC0\n\t" : : ) 73*77b55e8cSThomas Abraham 74*77b55e8cSThomas Abraham /* Set program counter with the given value */ 75*77b55e8cSThomas Abraham #define set_pc(x) __asm__ __volatile__ ("mov pc, %0\n\t" : : "r"(x)) 76*77b55e8cSThomas Abraham 77*77b55e8cSThomas Abraham /* Branch to the given location */ 78*77b55e8cSThomas Abraham #define branch_bx(x) __asm__ __volatile__ ("bx %0\n\t" : : "r"(x)) 79*77b55e8cSThomas Abraham 80*77b55e8cSThomas Abraham /* Read Main Id register */ 81*77b55e8cSThomas Abraham #define mrc_midr(x) __asm__ __volatile__ \ 82*77b55e8cSThomas Abraham ("mrc p15, 0, %0, c0, c0, 0\n\t" : "=r"(x) : ) 83*77b55e8cSThomas Abraham 84*77b55e8cSThomas Abraham /* Read Multiprocessor Affinity Register */ 85*77b55e8cSThomas Abraham #define mrc_mpafr(x) __asm__ __volatile__ \ 86*77b55e8cSThomas Abraham ("mrc p15, 0, %0, c0, c0, 5\n\t" : "=r"(x) : ) 87*77b55e8cSThomas Abraham 88*77b55e8cSThomas Abraham /* Read System Control Register */ 89*77b55e8cSThomas Abraham #define mrc_sctlr(x) __asm__ __volatile__ \ 90*77b55e8cSThomas Abraham ("mrc p15, 0, %0, c1, c0, 0\n\t" : "=r"(x) : ) 91*77b55e8cSThomas Abraham 92*77b55e8cSThomas Abraham /* Read Auxiliary Control Register */ 93*77b55e8cSThomas Abraham #define mrc_auxr(x) __asm__ __volatile__ \ 94*77b55e8cSThomas Abraham ("mrc p15, 0, %0, c1, c0, 1\n\t" : "=r"(x) : ) 95*77b55e8cSThomas Abraham 96*77b55e8cSThomas Abraham /* Read L2 Control register */ 97*77b55e8cSThomas Abraham #define mrc_l2_ctlr(x) __asm__ __volatile__ \ 98*77b55e8cSThomas Abraham ("mrc p15, 1, %0, c9, c0, 2\n\t" : "=r"(x) : ) 99*77b55e8cSThomas Abraham 100*77b55e8cSThomas Abraham /* Read L2 Auxilliary Control register */ 101*77b55e8cSThomas Abraham #define mrc_l2_aux_ctlr(x) __asm__ __volatile__ \ 102*77b55e8cSThomas Abraham ("mrc p15, 1, %0, c15, c0, 0\n\t" : "=r"(x) : ) 103*77b55e8cSThomas Abraham 104*77b55e8cSThomas Abraham /* Write System Control Register */ 105*77b55e8cSThomas Abraham #define mcr_sctlr(x) __asm__ __volatile__ \ 106*77b55e8cSThomas Abraham ("mcr p15, 0, %0, c1, c0, 0\n\t" : : "r"(x)) 107*77b55e8cSThomas Abraham 108*77b55e8cSThomas Abraham /* Write Auxiliary Control Register */ 109*77b55e8cSThomas Abraham #define mcr_auxr(x) __asm__ __volatile__ \ 110*77b55e8cSThomas Abraham ("mcr p15, 0, %0, c1, c0, 1\n\t" : : "r"(x)) 111*77b55e8cSThomas Abraham 112*77b55e8cSThomas Abraham /* Invalidate all instruction caches to PoU */ 113*77b55e8cSThomas Abraham #define mcr_icache(x) __asm__ __volatile__ \ 114*77b55e8cSThomas Abraham ("mcr p15, 0, %0, c7, c5, 0\n\t" : : "r"(x)) 115*77b55e8cSThomas Abraham 116*77b55e8cSThomas Abraham /* Invalidate unified TLB */ 117*77b55e8cSThomas Abraham #define mcr_tlb(x) __asm__ __volatile__ \ 118*77b55e8cSThomas Abraham ("mcr p15, 0, %0, c8, c7, 0\n\t" : : "r"(x)) 119*77b55e8cSThomas Abraham 120*77b55e8cSThomas Abraham /* Write L2 Control register */ 121*77b55e8cSThomas Abraham #define mcr_l2_ctlr(x) __asm__ __volatile__ \ 122*77b55e8cSThomas Abraham ("mcr p15, 1, %0, c9, c0, 2\n\t" : : "r"(x)) 123*77b55e8cSThomas Abraham 124*77b55e8cSThomas Abraham /* Write L2 Auxilliary Control register */ 125*77b55e8cSThomas Abraham #define mcr_l2_aux_ctlr(x) __asm__ __volatile__ \ 126*77b55e8cSThomas Abraham ("mcr p15, 1, %0, c15, c0, 0\n\t" : : "r"(x)) 127*77b55e8cSThomas Abraham 128*77b55e8cSThomas Abraham void set_usbhost_mode(unsigned int mode); 129*77b55e8cSThomas Abraham void set_system_display_ctrl(void); 130*77b55e8cSThomas Abraham int exynos_lcd_early_init(const void *blob); 131*77b55e8cSThomas Abraham 132*77b55e8cSThomas Abraham #endif /* _EXYNOS4_SYSTEM_H */ 133