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 * This instruction causes an event to be signaled to all cores 42*77b55e8cSThomas Abraham * within a multiprocessor system. If SEV is implemented, 43*77b55e8cSThomas Abraham * WFE must also be implemented. 44*77b55e8cSThomas Abraham */ 45*77b55e8cSThomas Abraham #define sev() __asm__ __volatile__ ("sev\n\t" : : ); 46*77b55e8cSThomas Abraham /* 47*77b55e8cSThomas Abraham * If the Event Register is not set, WFE suspends execution until 48*77b55e8cSThomas Abraham * one of the following events occurs: 49*77b55e8cSThomas Abraham * - an IRQ interrupt, unless masked by the CPSR I-bit 50*77b55e8cSThomas Abraham * - an FIQ interrupt, unless masked by the CPSR F-bit 51*77b55e8cSThomas Abraham * - an Imprecise Data abort, unless masked by the CPSR A-bit 52*77b55e8cSThomas Abraham * - a Debug Entry request, if Debug is enabled 53*77b55e8cSThomas Abraham * - an Event signaled by another processor using the SEV instruction. 54*77b55e8cSThomas Abraham * If the Event Register is set, WFE clears it and returns immediately. 55*77b55e8cSThomas Abraham * If WFE is implemented, SEV must also be implemented. 56*77b55e8cSThomas Abraham */ 57*77b55e8cSThomas Abraham #define wfe() __asm__ __volatile__ ("wfe\n\t" : : ); 58*77b55e8cSThomas Abraham 59*77b55e8cSThomas Abraham /* Move 0xd3 value to CPSR register to enable SVC mode */ 60*77b55e8cSThomas Abraham #define svc32_mode_en() __asm__ __volatile__ \ 61*77b55e8cSThomas Abraham ("@ I&F disable, Mode: 0x13 - SVC\n\t" \ 62*77b55e8cSThomas Abraham "msr cpsr_c, #0x13|0xC0\n\t" : : ) 63*77b55e8cSThomas Abraham 64*77b55e8cSThomas Abraham /* Set program counter with the given value */ 65*77b55e8cSThomas Abraham #define set_pc(x) __asm__ __volatile__ ("mov pc, %0\n\t" : : "r"(x)) 66*77b55e8cSThomas Abraham 67*77b55e8cSThomas Abraham /* Branch to the given location */ 68*77b55e8cSThomas Abraham #define branch_bx(x) __asm__ __volatile__ ("bx %0\n\t" : : "r"(x)) 69*77b55e8cSThomas Abraham 70*77b55e8cSThomas Abraham /* Read Main Id register */ 71*77b55e8cSThomas Abraham #define mrc_midr(x) __asm__ __volatile__ \ 72*77b55e8cSThomas Abraham ("mrc p15, 0, %0, c0, c0, 0\n\t" : "=r"(x) : ) 73*77b55e8cSThomas Abraham 74*77b55e8cSThomas Abraham /* Read Multiprocessor Affinity Register */ 75*77b55e8cSThomas Abraham #define mrc_mpafr(x) __asm__ __volatile__ \ 76*77b55e8cSThomas Abraham ("mrc p15, 0, %0, c0, c0, 5\n\t" : "=r"(x) : ) 77*77b55e8cSThomas Abraham 78*77b55e8cSThomas Abraham /* Read System Control Register */ 79*77b55e8cSThomas Abraham #define mrc_sctlr(x) __asm__ __volatile__ \ 80*77b55e8cSThomas Abraham ("mrc p15, 0, %0, c1, c0, 0\n\t" : "=r"(x) : ) 81*77b55e8cSThomas Abraham 82*77b55e8cSThomas Abraham /* Read Auxiliary Control Register */ 83*77b55e8cSThomas Abraham #define mrc_auxr(x) __asm__ __volatile__ \ 84*77b55e8cSThomas Abraham ("mrc p15, 0, %0, c1, c0, 1\n\t" : "=r"(x) : ) 85*77b55e8cSThomas Abraham 86*77b55e8cSThomas Abraham /* Read L2 Control register */ 87*77b55e8cSThomas Abraham #define mrc_l2_ctlr(x) __asm__ __volatile__ \ 88*77b55e8cSThomas Abraham ("mrc p15, 1, %0, c9, c0, 2\n\t" : "=r"(x) : ) 89*77b55e8cSThomas Abraham 90*77b55e8cSThomas Abraham /* Read L2 Auxilliary Control register */ 91*77b55e8cSThomas Abraham #define mrc_l2_aux_ctlr(x) __asm__ __volatile__ \ 92*77b55e8cSThomas Abraham ("mrc p15, 1, %0, c15, c0, 0\n\t" : "=r"(x) : ) 93*77b55e8cSThomas Abraham 94*77b55e8cSThomas Abraham /* Write System Control Register */ 95*77b55e8cSThomas Abraham #define mcr_sctlr(x) __asm__ __volatile__ \ 96*77b55e8cSThomas Abraham ("mcr p15, 0, %0, c1, c0, 0\n\t" : : "r"(x)) 97*77b55e8cSThomas Abraham 98*77b55e8cSThomas Abraham /* Write Auxiliary Control Register */ 99*77b55e8cSThomas Abraham #define mcr_auxr(x) __asm__ __volatile__ \ 100*77b55e8cSThomas Abraham ("mcr p15, 0, %0, c1, c0, 1\n\t" : : "r"(x)) 101*77b55e8cSThomas Abraham 102*77b55e8cSThomas Abraham /* Invalidate all instruction caches to PoU */ 103*77b55e8cSThomas Abraham #define mcr_icache(x) __asm__ __volatile__ \ 104*77b55e8cSThomas Abraham ("mcr p15, 0, %0, c7, c5, 0\n\t" : : "r"(x)) 105*77b55e8cSThomas Abraham 106*77b55e8cSThomas Abraham /* Invalidate unified TLB */ 107*77b55e8cSThomas Abraham #define mcr_tlb(x) __asm__ __volatile__ \ 108*77b55e8cSThomas Abraham ("mcr p15, 0, %0, c8, c7, 0\n\t" : : "r"(x)) 109*77b55e8cSThomas Abraham 110*77b55e8cSThomas Abraham /* Write L2 Control register */ 111*77b55e8cSThomas Abraham #define mcr_l2_ctlr(x) __asm__ __volatile__ \ 112*77b55e8cSThomas Abraham ("mcr p15, 1, %0, c9, c0, 2\n\t" : : "r"(x)) 113*77b55e8cSThomas Abraham 114*77b55e8cSThomas Abraham /* Write L2 Auxilliary Control register */ 115*77b55e8cSThomas Abraham #define mcr_l2_aux_ctlr(x) __asm__ __volatile__ \ 116*77b55e8cSThomas Abraham ("mcr p15, 1, %0, c15, c0, 0\n\t" : : "r"(x)) 117*77b55e8cSThomas Abraham 118*77b55e8cSThomas Abraham void set_usbhost_mode(unsigned int mode); 119*77b55e8cSThomas Abraham void set_system_display_ctrl(void); 120*77b55e8cSThomas Abraham int exynos_lcd_early_init(const void *blob); 121*77b55e8cSThomas Abraham 122*77b55e8cSThomas Abraham #endif /* _EXYNOS4_SYSTEM_H */ 123