Masahiro Yamada | a343812 | 2015-09-11 20:17:34 +0900 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 Masahiro Yamada <yamada.masahiro@socionext.com> |
| 3 | * |
| 4 | * SPDX-License-Identifier: GPL-2.0+ |
| 5 | */ |
| 6 | |
| 7 | #include <dm/device.h> |
| 8 | #include <dm/pinctrl.h> |
| 9 | |
| 10 | #include "pinctrl-uniphier.h" |
| 11 | |
| 12 | static const struct uniphier_pinctrl_pin ph1_pro4_pins[] = { |
| 13 | }; |
| 14 | |
| 15 | static const unsigned emmc_pins[] = {40, 41, 42, 43, 51, 52, 53}; |
| 16 | static const unsigned emmc_muxvals[] = {1, 1, 1, 1, 1, 1, 1}; |
| 17 | static const unsigned emmc_dat8_pins[] = {44, 45, 46, 47}; |
| 18 | static const unsigned emmc_dat8_muxvals[] = {1, 1, 1, 1}; |
| 19 | static const unsigned i2c0_pins[] = {142, 143}; |
| 20 | static const unsigned i2c0_muxvals[] = {0, 0}; |
| 21 | static const unsigned i2c1_pins[] = {144, 145}; |
| 22 | static const unsigned i2c1_muxvals[] = {0, 0}; |
| 23 | static const unsigned i2c2_pins[] = {146, 147}; |
| 24 | static const unsigned i2c2_muxvals[] = {0, 0}; |
| 25 | static const unsigned i2c3_pins[] = {148, 149}; |
| 26 | static const unsigned i2c3_muxvals[] = {0, 0}; |
| 27 | static const unsigned i2c6_pins[] = {308, 309}; |
| 28 | static const unsigned i2c6_muxvals[] = {6, 6}; |
| 29 | static const unsigned nand_pins[] = {40, 41, 42, 43, 44, 45, 46, 47, 48, 49, |
| 30 | 50, 51, 52, 53, 54}; |
| 31 | static const unsigned nand_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, |
| 32 | 0, 0}; |
| 33 | static const unsigned nand_cs1_pins[] = {131, 132}; |
| 34 | static const unsigned nand_cs1_muxvals[] = {1, 1}; |
| 35 | static const unsigned sd_pins[] = {150, 151, 152, 153, 154, 155, 156, 157, 158}; |
| 36 | static const unsigned sd_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; |
| 37 | static const unsigned sd1_pins[] = {319, 320, 321, 322, 323, 324, 325, 326, |
| 38 | 327}; |
| 39 | static const unsigned sd1_muxvals[] = {0, 0, 0, 0, 0, 0, 0, 0, 0}; |
| 40 | static const unsigned uart0_pins[] = {127, 128}; |
| 41 | static const unsigned uart0_muxvals[] = {0, 0}; |
| 42 | static const unsigned uart1_pins[] = {129, 130}; |
| 43 | static const unsigned uart1_muxvals[] = {0, 0}; |
| 44 | static const unsigned uart2_pins[] = {131, 132}; |
| 45 | static const unsigned uart2_muxvals[] = {0, 0}; |
| 46 | static const unsigned uart3_pins[] = {88, 89}; |
| 47 | static const unsigned uart3_muxvals[] = {2, 2}; |
| 48 | static const unsigned usb0_pins[] = {180, 181}; |
| 49 | static const unsigned usb0_muxvals[] = {0, 0}; |
| 50 | static const unsigned usb1_pins[] = {182, 183}; |
| 51 | static const unsigned usb1_muxvals[] = {0, 0}; |
| 52 | static const unsigned usb2_pins[] = {184, 185}; |
| 53 | static const unsigned usb2_muxvals[] = {0, 0}; |
| 54 | static const unsigned usb3_pins[] = {186, 187}; |
| 55 | static const unsigned usb3_muxvals[] = {0, 0}; |
| 56 | |
| 57 | static const struct uniphier_pinctrl_group ph1_pro4_groups[] = { |
| 58 | UNIPHIER_PINCTRL_GROUP(emmc), |
| 59 | UNIPHIER_PINCTRL_GROUP(emmc_dat8), |
| 60 | UNIPHIER_PINCTRL_GROUP(i2c0), |
| 61 | UNIPHIER_PINCTRL_GROUP(i2c1), |
| 62 | UNIPHIER_PINCTRL_GROUP(i2c2), |
| 63 | UNIPHIER_PINCTRL_GROUP(i2c3), |
| 64 | UNIPHIER_PINCTRL_GROUP(i2c6), |
| 65 | UNIPHIER_PINCTRL_GROUP(nand), |
| 66 | UNIPHIER_PINCTRL_GROUP(nand_cs1), |
| 67 | UNIPHIER_PINCTRL_GROUP(sd), |
| 68 | UNIPHIER_PINCTRL_GROUP(sd1), |
| 69 | UNIPHIER_PINCTRL_GROUP(uart0), |
| 70 | UNIPHIER_PINCTRL_GROUP(uart1), |
| 71 | UNIPHIER_PINCTRL_GROUP(uart2), |
| 72 | UNIPHIER_PINCTRL_GROUP(uart3), |
| 73 | UNIPHIER_PINCTRL_GROUP(usb0), |
| 74 | UNIPHIER_PINCTRL_GROUP(usb1), |
| 75 | UNIPHIER_PINCTRL_GROUP(usb2), |
| 76 | UNIPHIER_PINCTRL_GROUP(usb3), |
| 77 | }; |
| 78 | |
| 79 | static const char * const ph1_pro4_functions[] = { |
| 80 | "emmc", |
| 81 | "i2c0", |
| 82 | "i2c1", |
| 83 | "i2c2", |
| 84 | "i2c3", |
| 85 | "i2c6", |
| 86 | "nand", |
| 87 | "sd", |
| 88 | "sd1", |
| 89 | "uart0", |
| 90 | "uart1", |
| 91 | "uart2", |
| 92 | "uart3", |
| 93 | "usb0", |
| 94 | "usb1", |
| 95 | "usb2", |
| 96 | "usb3", |
| 97 | }; |
| 98 | |
| 99 | static struct uniphier_pinctrl_socdata ph1_pro4_pinctrl_socdata = { |
| 100 | .pins = ph1_pro4_pins, |
| 101 | .pins_count = ARRAY_SIZE(ph1_pro4_pins), |
| 102 | .groups = ph1_pro4_groups, |
| 103 | .groups_count = ARRAY_SIZE(ph1_pro4_groups), |
| 104 | .functions = ph1_pro4_functions, |
| 105 | .functions_count = ARRAY_SIZE(ph1_pro4_functions), |
| 106 | .mux_bits = 4, |
| 107 | .reg_stride = 8, |
| 108 | .load_pinctrl = true, |
| 109 | }; |
| 110 | |
| 111 | static int ph1_pro4_pinctrl_probe(struct udevice *dev) |
| 112 | { |
| 113 | return uniphier_pinctrl_probe(dev, &ph1_pro4_pinctrl_socdata); |
| 114 | } |
| 115 | |
| 116 | static const struct udevice_id ph1_pro4_pinctrl_match[] = { |
| 117 | { .compatible = "socionext,ph1-pro4-pinctrl" }, |
| 118 | { /* sentinel */ } |
| 119 | }; |
| 120 | |
| 121 | U_BOOT_DRIVER(ph1_pro4_pinctrl) = { |
| 122 | .name = "ph1-pro4-pinctrl", |
| 123 | .id = UCLASS_PINCTRL, |
| 124 | .of_match = of_match_ptr(ph1_pro4_pinctrl_match), |
| 125 | .probe = ph1_pro4_pinctrl_probe, |
| 126 | .remove = uniphier_pinctrl_remove, |
| 127 | .priv_auto_alloc_size = sizeof(struct uniphier_pinctrl_priv), |
| 128 | .ops = &uniphier_pinctrl_ops, |
| 129 | .flags = DM_FLAG_PRE_RELOC, |
| 130 | }; |