Masahiro Yamada | 24572db | 2016-09-17 03:32:59 +0900 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2016 Socionext Inc. |
| 3 | * Author: Masahiro Yamada <yamada.masahiro@socionext.com> |
| 4 | * |
| 5 | * SPDX-License-Identifier: GPL-2.0+ |
| 6 | */ |
| 7 | |
| 8 | #include <dm/device.h> |
| 9 | #include <dm/pinctrl.h> |
| 10 | |
| 11 | #include "pinctrl-uniphier.h" |
| 12 | |
| 13 | static const unsigned emmc_pins[] = {55, 56, 60}; |
| 14 | static const int emmc_muxvals[] = {1, 1, 1}; |
| 15 | static const unsigned emmc_dat8_pins[] = {57}; |
| 16 | static const int emmc_dat8_muxvals[] = {1}; |
| 17 | static const unsigned ether_mii_pins[] = {35, 107, 108, 109, 110, 111, 112, |
| 18 | 113}; |
| 19 | static const int ether_mii_muxvals[] = {1, 2, 2, 2, 2, 2, 2, 2}; |
| 20 | static const unsigned ether_rmii_pins[] = {35}; |
| 21 | static const int ether_rmii_muxvals[] = {1}; |
| 22 | static const unsigned i2c0_pins[] = {36}; |
| 23 | static const int i2c0_muxvals[] = {0}; |
| 24 | static const unsigned nand_pins[] = {38, 39, 40, 58, 59}; |
| 25 | static const int nand_muxvals[] = {1, 1, 1, 1, 1}; |
| 26 | static const unsigned nand_cs1_pins[] = {41}; |
| 27 | static const int nand_cs1_muxvals[] = {1}; |
| 28 | static const unsigned sd_pins[] = {42, 43, 44, 45}; |
| 29 | static const int sd_muxvals[] = {1, 1, 1, 1}; |
| 30 | static const unsigned system_bus_pins[] = {46, 50, 51, 53, 54, 73, 74, 75, 76, |
| 31 | 77, 78, 79, 80, 88, 89, 91, 92, 99}; |
| 32 | static const int system_bus_muxvals[] = {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, |
| 33 | 1, 1, 1, 1, 1}; |
| 34 | static const unsigned system_bus_cs0_pins[] = {93}; |
| 35 | static const int system_bus_cs0_muxvals[] = {1}; |
| 36 | static const unsigned system_bus_cs1_pins[] = {94}; |
| 37 | static const int system_bus_cs1_muxvals[] = {1}; |
| 38 | static const unsigned system_bus_cs2_pins[] = {95}; |
| 39 | static const int system_bus_cs2_muxvals[] = {1}; |
| 40 | static const unsigned system_bus_cs3_pins[] = {96}; |
| 41 | static const int system_bus_cs3_muxvals[] = {1}; |
| 42 | static const unsigned system_bus_cs4_pins[] = {81}; |
| 43 | static const int system_bus_cs4_muxvals[] = {1}; |
| 44 | static const unsigned system_bus_cs5_pins[] = {82}; |
| 45 | static const int system_bus_cs5_muxvals[] = {1}; |
| 46 | static const unsigned uart0_pins[] = {63, 64}; |
| 47 | static const int uart0_muxvals[] = {0, 1}; |
| 48 | static const unsigned uart1_pins[] = {65, 66}; |
| 49 | static const int uart1_muxvals[] = {0, 1}; |
| 50 | static const unsigned uart2_pins[] = {96, 102}; |
| 51 | static const int uart2_muxvals[] = {2, 2}; |
| 52 | static const unsigned usb0_pins[] = {13, 14}; |
| 53 | static const int usb0_muxvals[] = {0, 1}; |
| 54 | static const unsigned usb1_pins[] = {15, 16}; |
| 55 | static const int usb1_muxvals[] = {0, 1}; |
| 56 | static const unsigned usb2_pins[] = {17, 18}; |
| 57 | static const int usb2_muxvals[] = {0, 1}; |
| 58 | static const unsigned usb3_pins[] = {19, 20}; |
| 59 | static const int usb3_muxvals[] = {0, 1}; |
| 60 | |
| 61 | static const struct uniphier_pinctrl_group uniphier_sld3_groups[] = { |
| 62 | UNIPHIER_PINCTRL_GROUP_SPL(emmc), |
| 63 | UNIPHIER_PINCTRL_GROUP_SPL(emmc_dat8), |
| 64 | UNIPHIER_PINCTRL_GROUP(ether_mii), |
| 65 | UNIPHIER_PINCTRL_GROUP(ether_rmii), |
| 66 | UNIPHIER_PINCTRL_GROUP(i2c0), |
| 67 | UNIPHIER_PINCTRL_GROUP(nand), |
| 68 | UNIPHIER_PINCTRL_GROUP(nand_cs1), |
| 69 | UNIPHIER_PINCTRL_GROUP(sd), |
| 70 | UNIPHIER_PINCTRL_GROUP(system_bus), |
| 71 | UNIPHIER_PINCTRL_GROUP(system_bus_cs0), |
| 72 | UNIPHIER_PINCTRL_GROUP(system_bus_cs1), |
| 73 | UNIPHIER_PINCTRL_GROUP(system_bus_cs2), |
| 74 | UNIPHIER_PINCTRL_GROUP(system_bus_cs3), |
| 75 | UNIPHIER_PINCTRL_GROUP(system_bus_cs4), |
| 76 | UNIPHIER_PINCTRL_GROUP(system_bus_cs5), |
| 77 | UNIPHIER_PINCTRL_GROUP_SPL(uart0), |
| 78 | UNIPHIER_PINCTRL_GROUP_SPL(uart1), |
| 79 | UNIPHIER_PINCTRL_GROUP_SPL(uart2), |
| 80 | UNIPHIER_PINCTRL_GROUP(usb0), |
| 81 | UNIPHIER_PINCTRL_GROUP(usb1), |
| 82 | UNIPHIER_PINCTRL_GROUP(usb2), |
| 83 | UNIPHIER_PINCTRL_GROUP(usb3) |
| 84 | }; |
| 85 | |
| 86 | static const char * const uniphier_sld3_functions[] = { |
| 87 | UNIPHIER_PINMUX_FUNCTION_SPL(emmc), |
| 88 | UNIPHIER_PINMUX_FUNCTION(ether_mii), |
| 89 | UNIPHIER_PINMUX_FUNCTION(ether_rmii), |
| 90 | UNIPHIER_PINMUX_FUNCTION(i2c0), |
| 91 | UNIPHIER_PINMUX_FUNCTION(nand), |
| 92 | UNIPHIER_PINMUX_FUNCTION(sd), |
| 93 | UNIPHIER_PINMUX_FUNCTION(system_bus), |
| 94 | UNIPHIER_PINMUX_FUNCTION_SPL(uart0), |
| 95 | UNIPHIER_PINMUX_FUNCTION_SPL(uart1), |
| 96 | UNIPHIER_PINMUX_FUNCTION_SPL(uart2), |
| 97 | UNIPHIER_PINMUX_FUNCTION(usb0), |
| 98 | UNIPHIER_PINMUX_FUNCTION(usb1), |
| 99 | UNIPHIER_PINMUX_FUNCTION(usb2), |
| 100 | UNIPHIER_PINMUX_FUNCTION(usb3), |
| 101 | }; |
| 102 | |
| 103 | static struct uniphier_pinctrl_socdata uniphier_sld3_pinctrl_socdata = { |
| 104 | .groups = uniphier_sld3_groups, |
| 105 | .groups_count = ARRAY_SIZE(uniphier_sld3_groups), |
| 106 | .functions = uniphier_sld3_functions, |
| 107 | .functions_count = ARRAY_SIZE(uniphier_sld3_functions), |
| 108 | .caps = UNIPHIER_PINCTRL_CAPS_MUX_4BIT, |
| 109 | }; |
| 110 | |
| 111 | static int uniphier_sld3_pinctrl_probe(struct udevice *dev) |
| 112 | { |
| 113 | return uniphier_pinctrl_probe(dev, &uniphier_sld3_pinctrl_socdata); |
| 114 | } |
| 115 | |
| 116 | static const struct udevice_id uniphier_sld3_pinctrl_match[] = { |
| 117 | { .compatible = "socionext,uniphier-sld3-pinctrl" }, |
| 118 | { /* sentinel */ } |
| 119 | }; |
| 120 | |
| 121 | U_BOOT_DRIVER(uniphier_sld3_pinctrl) = { |
| 122 | .name = "uniphier-sld3-pinctrl", |
| 123 | .id = UCLASS_PINCTRL, |
| 124 | .of_match = of_match_ptr(uniphier_sld3_pinctrl_match), |
| 125 | .probe = uniphier_sld3_pinctrl_probe, |
| 126 | .priv_auto_alloc_size = sizeof(struct uniphier_pinctrl_priv), |
| 127 | .ops = &uniphier_pinctrl_ops, |
| 128 | }; |