xref: /openbmc/u-boot/arch/arm/mach-exynos/include/mach/system.h (revision 7e40d0a38fc42de12696c835eded8945d650bfc1)
183d290c5STom Rini /* SPDX-License-Identifier: GPL-2.0+ */
277b55e8cSThomas Abraham /*
377b55e8cSThomas Abraham  * (C) Copyright 2012 Samsung Electronics
477b55e8cSThomas Abraham  * Donghwa Lee <dh09.lee@samsung.com>
577b55e8cSThomas Abraham  */
677b55e8cSThomas Abraham 
777b55e8cSThomas Abraham #ifndef __ASM_ARM_ARCH_SYSTEM_H_
877b55e8cSThomas Abraham #define __ASM_ARM_ARCH_SYSTEM_H_
977b55e8cSThomas Abraham 
1077b55e8cSThomas Abraham #ifndef __ASSEMBLY__
1177b55e8cSThomas Abraham struct exynos4_sysreg {
1277b55e8cSThomas Abraham 	unsigned char	res1[0x210];
1377b55e8cSThomas Abraham 	unsigned int	display_ctrl;
1477b55e8cSThomas Abraham 	unsigned int	display_ctrl2;
1577b55e8cSThomas Abraham 	unsigned int	camera_control;
1677b55e8cSThomas Abraham 	unsigned int	audio_endian;
1777b55e8cSThomas Abraham 	unsigned int	jtag_con;
1877b55e8cSThomas Abraham };
1977b55e8cSThomas Abraham 
2077b55e8cSThomas Abraham struct exynos5_sysreg {
2177b55e8cSThomas Abraham 	unsigned char	res1[0x214];
2277b55e8cSThomas Abraham 	unsigned int	disp1blk_cfg;
2377b55e8cSThomas Abraham 	unsigned int	disp2blk_cfg;
2477b55e8cSThomas Abraham 	unsigned int	hdcp_e_fuse;
2577b55e8cSThomas Abraham 	unsigned int	gsclblk_cfg0;
2677b55e8cSThomas Abraham 	unsigned int	gsclblk_cfg1;
2777b55e8cSThomas Abraham 	unsigned int	reserved;
2877b55e8cSThomas Abraham 	unsigned int	ispblk_cfg;
2977b55e8cSThomas Abraham 	unsigned int	usb20phy_cfg;
3077b55e8cSThomas Abraham 	unsigned char	res2[0x29c];
3177b55e8cSThomas Abraham 	unsigned int	mipi_dphy;
3277b55e8cSThomas Abraham 	unsigned int	dptx_dphy;
3377b55e8cSThomas Abraham 	unsigned int	phyclk_sel;
3477b55e8cSThomas Abraham };
3577b55e8cSThomas Abraham #endif
3677b55e8cSThomas Abraham 
3777b55e8cSThomas Abraham #define USB20_PHY_CFG_HOST_LINK_EN	(1 << 0)
3877b55e8cSThomas Abraham 
3977b55e8cSThomas Abraham /*
4077b55e8cSThomas Abraham  * This instruction causes an event to be signaled to all cores
4177b55e8cSThomas Abraham  * within a multiprocessor system. If SEV is implemented,
4277b55e8cSThomas Abraham  * WFE must also be implemented.
4377b55e8cSThomas Abraham  */
4477b55e8cSThomas Abraham #define sev() __asm__ __volatile__ ("sev\n\t" : : );
4577b55e8cSThomas Abraham /*
4677b55e8cSThomas Abraham  * If the Event Register is not set, WFE suspends execution until
4777b55e8cSThomas Abraham  * one of the following events occurs:
4877b55e8cSThomas Abraham  * - an IRQ interrupt, unless masked by the CPSR I-bit
4977b55e8cSThomas Abraham  * - an FIQ interrupt, unless masked by the CPSR F-bit
5077b55e8cSThomas Abraham  * - an Imprecise Data abort, unless masked by the CPSR A-bit
5177b55e8cSThomas Abraham  * - a Debug Entry request, if Debug is enabled
5277b55e8cSThomas Abraham  * - an Event signaled by another processor using the SEV instruction.
5377b55e8cSThomas Abraham  * If the Event Register is set, WFE clears it and returns immediately.
5477b55e8cSThomas Abraham  * If WFE is implemented, SEV must also be implemented.
5577b55e8cSThomas Abraham  */
5677b55e8cSThomas Abraham #define wfe() __asm__ __volatile__ ("wfe\n\t" : : );
5777b55e8cSThomas Abraham 
5877b55e8cSThomas Abraham /* Move 0xd3 value to CPSR register to enable SVC mode */
5977b55e8cSThomas Abraham #define svc32_mode_en() __asm__ __volatile__				\
6077b55e8cSThomas Abraham 			("@ I&F disable, Mode: 0x13 - SVC\n\t"		\
61*df1ff4d6SGuillaume GARDET 			 "msr     cpsr_c, %0\n\t" : : "r"(0x13|0xC0))
6277b55e8cSThomas Abraham 
6377b55e8cSThomas Abraham /* Set program counter with the given value */
6477b55e8cSThomas Abraham #define set_pc(x) __asm__ __volatile__ ("mov     pc, %0\n\t" : : "r"(x))
6577b55e8cSThomas Abraham 
6677b55e8cSThomas Abraham /* Branch to the given location */
6777b55e8cSThomas Abraham #define branch_bx(x) __asm__ __volatile__ ("bx	%0\n\t" : : "r"(x))
6877b55e8cSThomas Abraham 
6977b55e8cSThomas Abraham /* Read Main Id register */
7077b55e8cSThomas Abraham #define mrc_midr(x) __asm__ __volatile__	\
7177b55e8cSThomas Abraham 			("mrc     p15, 0, %0, c0, c0, 0\n\t" : "=r"(x) : )
7277b55e8cSThomas Abraham 
7377b55e8cSThomas Abraham /* Read Multiprocessor Affinity Register */
7477b55e8cSThomas Abraham #define mrc_mpafr(x) __asm__ __volatile__	\
7577b55e8cSThomas Abraham 			("mrc     p15, 0, %0, c0, c0, 5\n\t" : "=r"(x) : )
7677b55e8cSThomas Abraham 
7777b55e8cSThomas Abraham /* Read System Control Register */
7877b55e8cSThomas Abraham #define mrc_sctlr(x) __asm__ __volatile__	\
7977b55e8cSThomas Abraham 			("mrc     p15, 0, %0, c1, c0, 0\n\t" : "=r"(x) : )
8077b55e8cSThomas Abraham 
8177b55e8cSThomas Abraham /* Read Auxiliary Control Register */
8277b55e8cSThomas Abraham #define mrc_auxr(x) __asm__ __volatile__	\
8377b55e8cSThomas Abraham 			("mrc     p15, 0, %0, c1, c0, 1\n\t" : "=r"(x) : )
8477b55e8cSThomas Abraham 
8577b55e8cSThomas Abraham /* Read L2 Control register */
8677b55e8cSThomas Abraham #define mrc_l2_ctlr(x) __asm__ __volatile__	\
8777b55e8cSThomas Abraham 			("mrc     p15, 1, %0, c9, c0, 2\n\t" : "=r"(x) : )
8877b55e8cSThomas Abraham 
8977b55e8cSThomas Abraham /* Read L2 Auxilliary Control register */
9077b55e8cSThomas Abraham #define mrc_l2_aux_ctlr(x) __asm__ __volatile__	\
9177b55e8cSThomas Abraham 			("mrc     p15, 1, %0, c15, c0, 0\n\t" : "=r"(x) : )
9277b55e8cSThomas Abraham 
9377b55e8cSThomas Abraham /* Write System Control Register */
9477b55e8cSThomas Abraham #define mcr_sctlr(x) __asm__ __volatile__	\
9577b55e8cSThomas Abraham 			("mcr     p15, 0, %0, c1, c0, 0\n\t" : : "r"(x))
9677b55e8cSThomas Abraham 
9777b55e8cSThomas Abraham /* Write Auxiliary Control Register */
9877b55e8cSThomas Abraham #define mcr_auxr(x) __asm__ __volatile__	\
9977b55e8cSThomas Abraham 			("mcr     p15, 0, %0, c1, c0, 1\n\t" : : "r"(x))
10077b55e8cSThomas Abraham 
10177b55e8cSThomas Abraham /* Invalidate all instruction caches to PoU */
10277b55e8cSThomas Abraham #define mcr_icache(x) __asm__ __volatile__	\
10377b55e8cSThomas Abraham 			("mcr     p15, 0, %0, c7, c5, 0\n\t" : : "r"(x))
10477b55e8cSThomas Abraham 
10577b55e8cSThomas Abraham /* Invalidate unified TLB */
10677b55e8cSThomas Abraham #define mcr_tlb(x) __asm__ __volatile__	\
10777b55e8cSThomas Abraham 			("mcr     p15, 0, %0, c8, c7, 0\n\t" : : "r"(x))
10877b55e8cSThomas Abraham 
10977b55e8cSThomas Abraham /* Write L2 Control register */
11077b55e8cSThomas Abraham #define mcr_l2_ctlr(x) __asm__ __volatile__	\
11177b55e8cSThomas Abraham 			("mcr     p15, 1, %0, c9, c0, 2\n\t" : : "r"(x))
11277b55e8cSThomas Abraham 
11377b55e8cSThomas Abraham /* Write L2 Auxilliary Control register */
11477b55e8cSThomas Abraham #define mcr_l2_aux_ctlr(x) __asm__ __volatile__	\
11577b55e8cSThomas Abraham 			("mcr     p15, 1, %0, c15, c0, 0\n\t" : : "r"(x))
11677b55e8cSThomas Abraham 
11777b55e8cSThomas Abraham void set_usbhost_mode(unsigned int mode);
11877b55e8cSThomas Abraham void set_system_display_ctrl(void);
11977b55e8cSThomas Abraham int exynos_lcd_early_init(const void *blob);
12077b55e8cSThomas Abraham 
12177b55e8cSThomas Abraham #endif	/* _EXYNOS4_SYSTEM_H */
122