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