blob: bdb755d0e49a4385fb2a21951ccba5c9d0ef6e3d [file] [log] [blame]
Ramon Friedad970512018-05-16 12:13:40 +03001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Qualcomm APQ8016 pinctrl
4 *
5 * (C) Copyright 2018 Ramon Fried <ramon.fried@gmail.com>
6 *
7 */
8
9#include "pinctrl-snapdragon.h"
10#include <common.h>
11
12#define MAX_PIN_NAME_LEN 32
13static char pin_name[MAX_PIN_NAME_LEN];
14static const char * const msm_pinctrl_pins[] = {
15 "SDC1_CLK",
16 "SDC1_CMD",
17 "SDC1_DATA",
18 "SDC2_CLK",
19 "SDC2_CMD",
20 "SDC2_DATA",
21 "QDSD_CLK",
22 "QDSD_CMD",
23 "QDSD_DATA0",
24 "QDSD_DATA1",
25 "QDSD_DATA2",
26 "QDSD_DATA3",
27};
28
29static const struct pinctrl_function msm_pinctrl_functions[] = {
30 {"blsp1_uart", 2},
31};
32
33static const char *apq8016_get_function_name(struct udevice *dev,
34 unsigned int selector)
35{
36 return msm_pinctrl_functions[selector].name;
37}
38
39static const char *apq8016_get_pin_name(struct udevice *dev,
40 unsigned int selector)
41{
42 if (selector < 130) {
43 snprintf(pin_name, MAX_PIN_NAME_LEN, "GPIO_%u", selector);
44 return pin_name;
45 } else {
46 return msm_pinctrl_pins[selector - 130];
47 }
48}
49
50static unsigned int apq8016_get_function_mux(unsigned int selector)
51{
52 return msm_pinctrl_functions[selector].val;
53}
54
55struct msm_pinctrl_data apq8016_data = {
56 .pin_count = 140,
57 .functions_count = ARRAY_SIZE(msm_pinctrl_functions),
58 .get_function_name = apq8016_get_function_name,
59 .get_function_mux = apq8016_get_function_mux,
60 .get_pin_name = apq8016_get_pin_name,
61};
62