blob: 06a57f2e5efa289f0f07b28a3f2debe44af51560 [file] [log] [blame]
Robert Markoe7a34f12020-07-06 10:37:54 +02001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Qualcomm IPQ40xx pinctrl
4 *
5 * Copyright (c) 2019 Sartura Ltd.
6 *
7 * Author: Robert Marko <robert.marko@sartura.hr>
8 */
9
10#include "pinctrl-snapdragon.h"
11#include <common.h>
12
13#define MAX_PIN_NAME_LEN 32
14static char pin_name[MAX_PIN_NAME_LEN];
15
16static const struct pinctrl_function msm_pinctrl_functions[] = {
17 {"gpio", 0},
18 {"blsp_uart0_0", 1}, /* Only for GPIO:16,17 */
19 {"blsp_uart0_1", 2}, /* Only for GPIO:60,61 */
20 {"blsp_uart1", 1},
21};
22
23static const char *ipq4019_get_function_name(struct udevice *dev,
24 unsigned int selector)
25{
26 return msm_pinctrl_functions[selector].name;
27}
28
29static const char *ipq4019_get_pin_name(struct udevice *dev,
30 unsigned int selector)
31{
32 snprintf(pin_name, MAX_PIN_NAME_LEN, "GPIO_%u", selector);
33 return pin_name;
34}
35
36static unsigned int ipq4019_get_function_mux(unsigned int selector)
37{
38 return msm_pinctrl_functions[selector].val;
39}
40
41struct msm_pinctrl_data ipq4019_data = {
42 .pin_count = 100,
43 .functions_count = ARRAY_SIZE(msm_pinctrl_functions),
44 .get_function_name = ipq4019_get_function_name,
45 .get_function_mux = ipq4019_get_function_mux,
46 .get_pin_name = ipq4019_get_pin_name,
47};