xref: /OK3568_Linux_fs/u-boot/arch/arm/mach-exynos/include/mach/pinmux.h (revision 4882a59341e53eb6f0b4789bf948001014eff981)
1*4882a593Smuzhiyun /*
2*4882a593Smuzhiyun  * Copyright (C) 2012 Samsung Electronics
3*4882a593Smuzhiyun  * Abhilash Kesavan <a.kesavan@samsung.com>
4*4882a593Smuzhiyun  *
5*4882a593Smuzhiyun  * SPDX-License-Identifier:	GPL-2.0+
6*4882a593Smuzhiyun  */
7*4882a593Smuzhiyun 
8*4882a593Smuzhiyun #ifndef __ASM_ARM_ARCH_PINMUX_H
9*4882a593Smuzhiyun #define __ASM_ARM_ARCH_PINMUX_H
10*4882a593Smuzhiyun 
11*4882a593Smuzhiyun #include "periph.h"
12*4882a593Smuzhiyun 
13*4882a593Smuzhiyun /*
14*4882a593Smuzhiyun  * Flags for setting specific configarations of peripherals.
15*4882a593Smuzhiyun  * List will grow with support for more devices getting added.
16*4882a593Smuzhiyun  */
17*4882a593Smuzhiyun enum {
18*4882a593Smuzhiyun 	PINMUX_FLAG_NONE	= 0x00000000,
19*4882a593Smuzhiyun 
20*4882a593Smuzhiyun 	/* Flags for eMMC */
21*4882a593Smuzhiyun 	PINMUX_FLAG_8BIT_MODE	= 1 << 0,       /* SDMMC 8-bit mode */
22*4882a593Smuzhiyun 
23*4882a593Smuzhiyun 	/* Flags for SROM controller */
24*4882a593Smuzhiyun 	PINMUX_FLAG_BANK	= 3 << 0,       /* bank number (0-3) */
25*4882a593Smuzhiyun 	PINMUX_FLAG_16BIT	= 1 << 2,       /* 16-bit width */
26*4882a593Smuzhiyun 
27*4882a593Smuzhiyun 	/* Flags for I2C */
28*4882a593Smuzhiyun 	PINMUX_FLAG_HS_MODE	= 1 << 1,       /* I2C High Speed Mode */
29*4882a593Smuzhiyun };
30*4882a593Smuzhiyun 
31*4882a593Smuzhiyun /**
32*4882a593Smuzhiyun  * Configures the pinmux for a particular peripheral.
33*4882a593Smuzhiyun  *
34*4882a593Smuzhiyun  * Each gpio can be configured in many different ways (4 bits on exynos)
35*4882a593Smuzhiyun  * such as "input", "output", "special function", "external interrupt"
36*4882a593Smuzhiyun  * etc. This function will configure the peripheral pinmux along with
37*4882a593Smuzhiyun  * pull-up/down and drive strength.
38*4882a593Smuzhiyun  *
39*4882a593Smuzhiyun  * @param peripheral	peripheral to be configured
40*4882a593Smuzhiyun  * @param flags		configure flags
41*4882a593Smuzhiyun  * @return 0 if ok, -1 on error (e.g. unsupported peripheral)
42*4882a593Smuzhiyun  */
43*4882a593Smuzhiyun int exynos_pinmux_config(int peripheral, int flags);
44*4882a593Smuzhiyun 
45*4882a593Smuzhiyun /**
46*4882a593Smuzhiyun  * Decode the peripheral id using the interrpt numbers.
47*4882a593Smuzhiyun  *
48*4882a593Smuzhiyun  * @param blob  Device tree blob
49*4882a593Smuzhiyun  * @param node  FDT I2C node to find
50*4882a593Smuzhiyun  * @return peripheral id if ok, PERIPH_ID_NONE on error
51*4882a593Smuzhiyun  */
52*4882a593Smuzhiyun int pinmux_decode_periph_id(const void *blob, int node);
53*4882a593Smuzhiyun #endif
54