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 28*4882a593Smuzhiyun /** 29*4882a593Smuzhiyun * Configures the pinmux for a particular peripheral. 30*4882a593Smuzhiyun * 31*4882a593Smuzhiyun * Each gpio can be configured in many different ways (4 bits on exynos) 32*4882a593Smuzhiyun * such as "input", "output", "special function", "external interrupt" 33*4882a593Smuzhiyun * etc. This function will configure the peripheral pinmux along with 34*4882a593Smuzhiyun * pull-up/down and drive strength. 35*4882a593Smuzhiyun * 36*4882a593Smuzhiyun * @param peripheral peripheral to be configured 37*4882a593Smuzhiyun * @param flags configure flags 38*4882a593Smuzhiyun * @return 0 if ok, -1 on error (e.g. unsupported peripheral) 39*4882a593Smuzhiyun */ 40*4882a593Smuzhiyun int exynos_pinmux_config(int peripheral, int flags); 41*4882a593Smuzhiyun 42*4882a593Smuzhiyun /** 43*4882a593Smuzhiyun * Decode the peripheral id using the interrpt numbers. 44*4882a593Smuzhiyun * 45*4882a593Smuzhiyun * @param blob Device tree blob 46*4882a593Smuzhiyun * @param node FDT I2C node to find 47*4882a593Smuzhiyun * @return peripheral id if ok, PERIPH_ID_NONE on error 48*4882a593Smuzhiyun */ 49*4882a593Smuzhiyun int pinmux_decode_periph_id(const void *blob, int node); 50*4882a593Smuzhiyun #endif 51