blob: 5a7fbfd4415f250617edf3deab41c1013a35dfb9 [file] [log] [blame]
Sumit Garg46ad40b2022-07-12 12:42:10 +05301// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Qualcomm QCS404 pinctrl
4 *
5 * (C) Copyright 2022 Sumit Garg <sumit.garg@linaro.org>
6 */
7
8#include "pinctrl-snapdragon.h"
9#include <common.h>
10
11#define MAX_PIN_NAME_LEN 32
12static char pin_name[MAX_PIN_NAME_LEN] __section(".data");
13static const char * const msm_pinctrl_pins[] = {
14 "SDC1_RCLK",
15 "SDC1_CLK",
16 "SDC1_CMD",
17 "SDC1_DATA",
18 "SDC2_CLK",
19 "SDC2_CMD",
20 "SDC2_DATA",
21};
22
23static const struct pinctrl_function msm_pinctrl_functions[] = {
24 {"blsp_uart2", 1},
Sumit Garg09aea5d2023-02-01 19:28:51 +053025 {"rgmii_int", 1},
26 {"rgmii_ck", 1},
27 {"rgmii_tx", 1},
28 {"rgmii_ctl", 1},
29 {"rgmii_rx", 1},
30 {"rgmii_mdio", 1},
31 {"rgmii_mdc", 1},
Sumit Garg46ad40b2022-07-12 12:42:10 +053032};
33
34static const char *qcs404_get_function_name(struct udevice *dev,
35 unsigned int selector)
36{
37 return msm_pinctrl_functions[selector].name;
38}
39
40static const char *qcs404_get_pin_name(struct udevice *dev,
41 unsigned int selector)
42{
43 if (selector < 120) {
44 snprintf(pin_name, MAX_PIN_NAME_LEN, "GPIO_%u", selector);
45 return pin_name;
46 } else {
47 return msm_pinctrl_pins[selector - 120];
48 }
49}
50
51static unsigned int qcs404_get_function_mux(unsigned int selector)
52{
53 return msm_pinctrl_functions[selector].val;
54}
55
56struct msm_pinctrl_data qcs404_data = {
57 .pin_count = 126,
58 .functions_count = ARRAY_SIZE(msm_pinctrl_functions),
59 .get_function_name = qcs404_get_function_name,
60 .get_function_mux = qcs404_get_function_mux,
61 .get_pin_name = qcs404_get_pin_name,
62};