blob: 20a71c319b3370ea2d48a5c6c200d16cb47bd021 [file] [log] [blame]
Ramon Fried94268f12019-01-12 11:47:25 +02001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Qualcomm APQ8096 pinctrl
4 *
5 * (C) Copyright 2019 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 "SDC1_RCLK",
22};
23
24static const struct pinctrl_function msm_pinctrl_functions[] = {
25 {"blsp_uart8", 2},
26};
27
28static const char *apq8096_get_function_name(struct udevice *dev,
29 unsigned int selector)
30{
31 return msm_pinctrl_functions[selector].name;
32}
33
34static const char *apq8096_get_pin_name(struct udevice *dev,
35 unsigned int selector)
36{
37 if (selector < 150) {
38 snprintf(pin_name, MAX_PIN_NAME_LEN, "GPIO_%u", selector);
39 return pin_name;
40 } else {
41 return msm_pinctrl_pins[selector - 150];
42 }
43}
44
45static unsigned int apq8096_get_function_mux(unsigned int selector)
46{
47 return msm_pinctrl_functions[selector].val;
48}
49
50struct msm_pinctrl_data apq8096_data = {
51 .pin_count = 157,
52 .functions_count = ARRAY_SIZE(msm_pinctrl_functions),
53 .get_function_name = apq8096_get_function_name,
54 .get_function_mux = apq8096_get_function_mux,
55 .get_pin_name = apq8096_get_pin_name,
56};