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