1/*
2 * Copyright 2017, Data61
3 * Commonwealth Scientific and Industrial Research Organisation (CSIRO)
4 * ABN 41 687 119 230.
5 *
6 * This software may be distributed and modified according to the terms of
7 * the BSD 2-Clause license. Note that NO WARRANTY is provided.
8 * See "LICENSE_BSD2.txt" for details.
9 *
10 * @TAG(DATA61_BSD)
11 */
12#pragma once
13
14#include <autoconf.h>
15#include <platsupport/gen_config.h>
16
17#if defined(CONFIG_PLAT_EXYNOS5250)
18/* These are for the arndale */
19#define EXYNOS_GPIOLEFT_PADDR    0x11400000
20#define EXYNOS_GPIORIGHT_PADDR   0x13400000
21#define EXYNOS_GPIOC2C_PADDR     0x10D10000
22#define EXYNOS_GPIOAUDIO_PADDR   0x03860000
23#elif defined(CONFIG_PLAT_EXYNOS54XX)
24/* These are for Odroid-XU and XU3 */
25#define EXYNOS_GPIOLEFT_PADDR    0x13400000
26#define EXYNOS_GPIORIGHT_PADDR   0x14000000
27#define EXYNOS_GPIOC2C_PADDR     0x10D10000
28#define EXYNOS_GPIOAUDIO_PADDR   0x03860000
29#else
30#error Unidentified Exynos5 SoC
31#endif
32
33#define EXYNOS_GPIOX_SIZE        0x1000
34#define EXYNOS_GPIOLEFT_SIZE     EXYNOS_GPIOX_SIZE
35#define EXYNOS_GPIORIGHT_SIZE    EXYNOS_GPIOX_SIZE
36#define EXYNOS_GPIOC2C_SIZE      EXYNOS_GPIOX_SIZE
37#define EXYNOS_GPIOAUDIO_SIZE    EXYNOS_GPIOX_SIZE
38
39enum mux_feature {
40    MUX_I2C0,
41    MUX_I2C1,
42    MUX_I2C2,
43    MUX_I2C3,
44    MUX_I2C4,
45    MUX_I2C5,
46    MUX_I2C6,
47    MUX_I2C7,
48    MUX_I2C8,
49    MUX_I2C9,
50    MUX_I2C10,
51    MUX_I2C11,
52    MUX_UART0,
53    MUX_UART0_FLOW,
54    MUX_UART1,
55    MUX_UART1_FLOW,
56    MUX_UART2,
57    MUX_UART2_FLOW,
58    MUX_UART3,
59    MUX_UART3_FLOW,
60    MUX_SPI0,
61    MUX_SPI1,
62    MUX_SPI2,
63    MUX_SPI0_ISP,
64    MUX_SPI1_ISP,
65    NMUX_FEATURES,
66    MUX_I2C_HDMI    = MUX_I2C8,
67    MUX_I2C_0_ISP   = MUX_I2C9,
68    MUX_I2C_1_ISP   = MUX_I2C10,
69    MUX_I2C_SATAPHY = MUX_I2C11
70};
71
72/**
73 * Initialise the mux subsystem with pre-mapped regions.
74 * @param[in]  gpioleft  A virtual mapping for the left part of the MUX subsystem.
75 * @param[in]  gpioright A virtual mapping for the right part of the MUX subsystem.
76 * @param[in]  gpioc2c   A virtual mapping for c2c part of the MUX subsystem.
77 * @param[in]  gpioaudio A virtual mapping for audio part of the MUX subsystem.
78 * @param[out] mux    On success, this will be filled with the appropriate
79 *                    subsystem data.
80 * @return            0 on success
81 */
82int exynos_mux_init(void* gpioleft,
83                    void* gpioright,
84                    void* gpioc2c,
85                    void* gpioaudio,
86                    mux_sys_t* mux);
87
88