aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/pinctrl.txt311
-rw-r--r--arch/arm/mach-tegra/Kconfig4
-rw-r--r--arch/arm/mach-tegra/include/mach/pinconf-tegra.h63
-rw-r--r--arch/arm/mach-u300/core.c80
-rw-r--r--arch/arm/mach-u300/include/mach/gpio-u300.h2
-rw-r--r--drivers/pinctrl/Kconfig42
-rw-r--r--drivers/pinctrl/Makefile8
-rw-r--r--drivers/pinctrl/core.c826
-rw-r--r--drivers/pinctrl/core.h117
-rw-r--r--drivers/pinctrl/pinconf-generic.c120
-rw-r--r--drivers/pinctrl/pinconf.c306
-rw-r--r--drivers/pinctrl/pinconf.h78
-rw-r--r--drivers/pinctrl/pinctrl-coh901.c139
-rw-r--r--drivers/pinctrl/pinctrl-coh901.h5
-rw-r--r--drivers/pinctrl/pinctrl-mmp2.c722
-rw-r--r--drivers/pinctrl/pinctrl-pxa168.c651
-rw-r--r--drivers/pinctrl/pinctrl-pxa3xx.c244
-rw-r--r--drivers/pinctrl/pinctrl-pxa3xx.h264
-rw-r--r--drivers/pinctrl/pinctrl-pxa910.c1007
-rw-r--r--drivers/pinctrl/pinctrl-tegra.c559
-rw-r--r--drivers/pinctrl/pinctrl-tegra.h163
-rw-r--r--drivers/pinctrl/pinctrl-tegra20.c2860
-rw-r--r--drivers/pinctrl/pinctrl-tegra30.c3726
-rw-r--r--drivers/pinctrl/pinctrl-u300.c80
-rw-r--r--drivers/pinctrl/pinmux.c1205
-rw-r--r--drivers/pinctrl/pinmux.h76
-rw-r--r--drivers/tty/serial/sirfsoc_uart.c24
-rw-r--r--drivers/tty/serial/sirfsoc_uart.h2
-rw-r--r--include/linux/pinctrl/consumer.h159
-rw-r--r--include/linux/pinctrl/machine.h190
-rw-r--r--include/linux/pinctrl/pinconf-generic.h114
-rw-r--r--include/linux/pinctrl/pinconf.h44
-rw-r--r--include/linux/pinctrl/pinctrl-state.h6
-rw-r--r--include/linux/pinctrl/pinctrl.h3
-rw-r--r--include/linux/pinctrl/pinmux.h52
35 files changed, 12805 insertions, 1447 deletions
diff --git a/Documentation/pinctrl.txt b/Documentation/pinctrl.txt
index 150fd3833d0b..d97bccf46147 100644
--- a/Documentation/pinctrl.txt
+++ b/Documentation/pinctrl.txt
@@ -206,12 +206,21 @@ using a certain resistor value - pull up and pull down - so that the pin has a
206stable value when nothing is driving the rail it is connected to, or when it's 206stable value when nothing is driving the rail it is connected to, or when it's
207unconnected. 207unconnected.
208 208
209For example, a platform may do this: 209Pin configuration can be programmed either using the explicit APIs described
210immediately below, or by adding configuration entries into the mapping table;
211see section "Board/machine configuration" below.
212
213For example, a platform may do the following to pull up a pin to VDD:
214
215#include <linux/pinctrl/consumer.h>
210 216
211ret = pin_config_set("foo-dev", "FOO_GPIO_PIN", PLATFORM_X_PULL_UP); 217ret = pin_config_set("foo-dev", "FOO_GPIO_PIN", PLATFORM_X_PULL_UP);
212 218
213To pull up a pin to VDD. The pin configuration driver implements callbacks for 219The format and meaning of the configuration parameter, PLATFORM_X_PULL_UP
214changing pin configuration in the pin controller ops like this: 220above, is entirely defined by the pin controller driver.
221
222The pin configuration driver implements callbacks for changing pin
223configuration in the pin controller ops like this:
215 224
216#include <linux/pinctrl/pinctrl.h> 225#include <linux/pinctrl/pinctrl.h>
217#include <linux/pinctrl/pinconf.h> 226#include <linux/pinctrl/pinconf.h>
@@ -492,14 +501,10 @@ Definitions:
492 {"map-i2c0", i2c0, pinctrl0, fi2c0, gi2c0} 501 {"map-i2c0", i2c0, pinctrl0, fi2c0, gi2c0}
493 } 502 }
494 503
495 Every map must be assigned a symbolic name, pin controller and function. 504 Every map must be assigned a state name, pin controller, device and
496 The group is not compulsory - if it is omitted the first group presented by 505 function. The group is not compulsory - if it is omitted the first group
497 the driver as applicable for the function will be selected, which is 506 presented by the driver as applicable for the function will be selected,
498 useful for simple cases. 507 which is useful for simple cases.
499
500 The device name is present in map entries tied to specific devices. Maps
501 without device names are referred to as SYSTEM pinmuxes, such as can be taken
502 by the machine implementation on boot and not tied to any specific device.
503 508
504 It is possible to map several groups to the same combination of device, 509 It is possible to map several groups to the same combination of device,
505 pin controller and function. This is for cases where a certain function on 510 pin controller and function. This is for cases where a certain function on
@@ -726,19 +731,19 @@ same time.
726All the above functions are mandatory to implement for a pinmux driver. 731All the above functions are mandatory to implement for a pinmux driver.
727 732
728 733
729Pinmux interaction with the GPIO subsystem 734Pin control interaction with the GPIO subsystem
730========================================== 735===============================================
731 736
732The public pinmux API contains two functions named pinmux_request_gpio() 737The public pinmux API contains two functions named pinctrl_request_gpio()
733and pinmux_free_gpio(). These two functions shall *ONLY* be called from 738and pinctrl_free_gpio(). These two functions shall *ONLY* be called from
734gpiolib-based drivers as part of their gpio_request() and 739gpiolib-based drivers as part of their gpio_request() and
735gpio_free() semantics. Likewise the pinmux_gpio_direction_[input|output] 740gpio_free() semantics. Likewise the pinctrl_gpio_direction_[input|output]
736shall only be called from within respective gpio_direction_[input|output] 741shall only be called from within respective gpio_direction_[input|output]
737gpiolib implementation. 742gpiolib implementation.
738 743
739NOTE that platforms and individual drivers shall *NOT* request GPIO pins to be 744NOTE that platforms and individual drivers shall *NOT* request GPIO pins to be
740muxed in. Instead, implement a proper gpiolib driver and have that driver 745controlled e.g. muxed in. Instead, implement a proper gpiolib driver and have
741request proper muxing for its pins. 746that driver request proper muxing and other control for its pins.
742 747
743The function list could become long, especially if you can convert every 748The function list could become long, especially if you can convert every
744individual pin into a GPIO pin independent of any other pins, and then try 749individual pin into a GPIO pin independent of any other pins, and then try
@@ -747,7 +752,7 @@ the approach to define every pin as a function.
747In this case, the function array would become 64 entries for each GPIO 752In this case, the function array would become 64 entries for each GPIO
748setting and then the device functions. 753setting and then the device functions.
749 754
750For this reason there are two functions a pinmux driver can implement 755For this reason there are two functions a pin control driver can implement
751to enable only GPIO on an individual pin: .gpio_request_enable() and 756to enable only GPIO on an individual pin: .gpio_request_enable() and
752.gpio_disable_free(). 757.gpio_disable_free().
753 758
@@ -762,12 +767,12 @@ gpiolib driver and the affected GPIO range, pin offset and desired direction
762will be passed along to this function. 767will be passed along to this function.
763 768
764Alternatively to using these special functions, it is fully allowed to use 769Alternatively to using these special functions, it is fully allowed to use
765named functions for each GPIO pin, the pinmux_request_gpio() will attempt to 770named functions for each GPIO pin, the pinctrl_request_gpio() will attempt to
766obtain the function "gpioN" where "N" is the global GPIO pin number if no 771obtain the function "gpioN" where "N" is the global GPIO pin number if no
767special GPIO-handler is registered. 772special GPIO-handler is registered.
768 773
769 774
770Pinmux board/machine configuration 775Board/machine configuration
771================================== 776==================================
772 777
773Boards and machines define how a certain complete running system is put 778Boards and machines define how a certain complete running system is put
@@ -775,27 +780,33 @@ together, including how GPIOs and devices are muxed, how regulators are
775constrained and how the clock tree looks. Of course pinmux settings are also 780constrained and how the clock tree looks. Of course pinmux settings are also
776part of this. 781part of this.
777 782
778A pinmux config for a machine looks pretty much like a simple regulator 783A pin controller configuration for a machine looks pretty much like a simple
779configuration, so for the example array above we want to enable i2c and 784regulator configuration, so for the example array above we want to enable i2c
780spi on the second function mapping: 785and spi on the second function mapping:
781 786
782#include <linux/pinctrl/machine.h> 787#include <linux/pinctrl/machine.h>
783 788
784static const struct pinmux_map __initdata pmx_mapping[] = { 789static const struct pinctrl_map __initdata mapping[] = {
785 { 790 {
786 .ctrl_dev_name = "pinctrl-foo",
787 .function = "spi0",
788 .dev_name = "foo-spi.0", 791 .dev_name = "foo-spi.0",
792 .name = PINCTRL_STATE_DEFAULT,
793 .type = PIN_MAP_TYPE_MUX_GROUP,
794 .ctrl_dev_name = "pinctrl-foo",
795 .data.mux.function = "spi0",
789 }, 796 },
790 { 797 {
791 .ctrl_dev_name = "pinctrl-foo",
792 .function = "i2c0",
793 .dev_name = "foo-i2c.0", 798 .dev_name = "foo-i2c.0",
799 .name = PINCTRL_STATE_DEFAULT,
800 .type = PIN_MAP_TYPE_MUX_GROUP,
801 .ctrl_dev_name = "pinctrl-foo",
802 .data.mux.function = "i2c0",
794 }, 803 },
795 { 804 {
796 .ctrl_dev_name = "pinctrl-foo",
797 .function = "mmc0",
798 .dev_name = "foo-mmc.0", 805 .dev_name = "foo-mmc.0",
806 .name = PINCTRL_STATE_DEFAULT,
807 .type = PIN_MAP_TYPE_MUX_GROUP,
808 .ctrl_dev_name = "pinctrl-foo",
809 .data.mux.function = "mmc0",
799 }, 810 },
800}; 811};
801 812
@@ -805,21 +816,51 @@ must match a function provided by the pinmux driver handling this pin range.
805 816
806As you can see we may have several pin controllers on the system and thus 817As you can see we may have several pin controllers on the system and thus
807we need to specify which one of them that contain the functions we wish 818we need to specify which one of them that contain the functions we wish
808to map. The map can also use struct device * directly, so there is no 819to map.
809inherent need to use strings to specify .dev_name or .ctrl_dev_name, these
810are for the situation where you do not have a handle to the struct device *,
811for example if they are not yet instantiated or cumbersome to obtain.
812 820
813You register this pinmux mapping to the pinmux subsystem by simply: 821You register this pinmux mapping to the pinmux subsystem by simply:
814 822
815 ret = pinmux_register_mappings(pmx_mapping, ARRAY_SIZE(pmx_mapping)); 823 ret = pinctrl_register_mappings(mapping, ARRAY_SIZE(mapping));
816 824
817Since the above construct is pretty common there is a helper macro to make 825Since the above construct is pretty common there is a helper macro to make
818it even more compact which assumes you want to use pinctrl-foo and position 826it even more compact which assumes you want to use pinctrl-foo and position
8190 for mapping, for example: 8270 for mapping, for example:
820 828
821static struct pinmux_map __initdata pmx_mapping[] = { 829static struct pinctrl_map __initdata mapping[] = {
822 PINMUX_MAP("I2CMAP", "pinctrl-foo", "i2c0", "foo-i2c.0"), 830 PIN_MAP_MUX_GROUP("foo-i2c.o", PINCTRL_STATE_DEFAULT, "pinctrl-foo", NULL, "i2c0"),
831};
832
833The mapping table may also contain pin configuration entries. It's common for
834each pin/group to have a number of configuration entries that affect it, so
835the table entries for configuration reference an array of config parameters
836and values. An example using the convenience macros is shown below:
837
838static unsigned long i2c_grp_configs[] = {
839 FOO_PIN_DRIVEN,
840 FOO_PIN_PULLUP,
841};
842
843static unsigned long i2c_pin_configs[] = {
844 FOO_OPEN_COLLECTOR,
845 FOO_SLEW_RATE_SLOW,
846};
847
848static struct pinctrl_map __initdata mapping[] = {
849 PIN_MAP_MUX_GROUP("foo-i2c.0", PINCTRL_STATE_DEFAULT, "pinctrl-foo", "i2c0", "i2c0"),
850 PIN_MAP_MUX_CONFIGS_GROUP("foo-i2c.0", PINCTRL_STATE_DEFAULT, "pinctrl-foo", "i2c0", i2c_grp_configs),
851 PIN_MAP_MUX_CONFIGS_PIN("foo-i2c.0", PINCTRL_STATE_DEFAULT, "pinctrl-foo", "i2c0scl", i2c_pin_configs),
852 PIN_MAP_MUX_CONFIGS_PIN("foo-i2c.0", PINCTRL_STATE_DEFAULT, "pinctrl-foo", "i2c0sda", i2c_pin_configs),
853};
854
855Finally, some devices expect the mapping table to contain certain specific
856named states. When running on hardware that doesn't need any pin controller
857configuration, the mapping table must still contain those named states, in
858order to explicitly indicate that the states were provided and intended to
859be empty. Table entry macro PIN_MAP_DUMMY_STATE serves the purpose of defining
860a named state without causing any pin controller to be programmed:
861
862static struct pinctrl_map __initdata mapping[] = {
863 PIN_MAP_DUMMY_STATE("foo-i2c.0", PINCTRL_STATE_DEFAULT),
823}; 864};
824 865
825 866
@@ -831,81 +872,96 @@ As it is possible to map a function to different groups of pins an optional
831 872
832... 873...
833{ 874{
875 .dev_name = "foo-spi.0",
834 .name = "spi0-pos-A", 876 .name = "spi0-pos-A",
877 .type = PIN_MAP_TYPE_MUX_GROUP,
835 .ctrl_dev_name = "pinctrl-foo", 878 .ctrl_dev_name = "pinctrl-foo",
836 .function = "spi0", 879 .function = "spi0",
837 .group = "spi0_0_grp", 880 .group = "spi0_0_grp",
838 .dev_name = "foo-spi.0",
839}, 881},
840{ 882{
883 .dev_name = "foo-spi.0",
841 .name = "spi0-pos-B", 884 .name = "spi0-pos-B",
885 .type = PIN_MAP_TYPE_MUX_GROUP,
842 .ctrl_dev_name = "pinctrl-foo", 886 .ctrl_dev_name = "pinctrl-foo",
843 .function = "spi0", 887 .function = "spi0",
844 .group = "spi0_1_grp", 888 .group = "spi0_1_grp",
845 .dev_name = "foo-spi.0",
846}, 889},
847... 890...
848 891
849This example mapping is used to switch between two positions for spi0 at 892This example mapping is used to switch between two positions for spi0 at
850runtime, as described further below under the heading "Runtime pinmuxing". 893runtime, as described further below under the heading "Runtime pinmuxing".
851 894
852Further it is possible to match several groups of pins to the same function 895Further it is possible for one named state to affect the muxing of several
853for a single device, say for example in the mmc0 example above, where you can 896groups of pins, say for example in the mmc0 example above, where you can
854additively expand the mmc0 bus from 2 to 4 to 8 pins. If we want to use all 897additively expand the mmc0 bus from 2 to 4 to 8 pins. If we want to use all
855three groups for a total of 2+2+4 = 8 pins (for an 8-bit MMC bus as is the 898three groups for a total of 2+2+4 = 8 pins (for an 8-bit MMC bus as is the
856case), we define a mapping like this: 899case), we define a mapping like this:
857 900
858... 901...
859{ 902{
903 .dev_name = "foo-mmc.0",
860 .name = "2bit" 904 .name = "2bit"
905 .type = PIN_MAP_TYPE_MUX_GROUP,
861 .ctrl_dev_name = "pinctrl-foo", 906 .ctrl_dev_name = "pinctrl-foo",
862 .function = "mmc0", 907 .function = "mmc0",
863 .group = "mmc0_1_grp", 908 .group = "mmc0_1_grp",
864 .dev_name = "foo-mmc.0",
865}, 909},
866{ 910{
911 .dev_name = "foo-mmc.0",
867 .name = "4bit" 912 .name = "4bit"
913 .type = PIN_MAP_TYPE_MUX_GROUP,
868 .ctrl_dev_name = "pinctrl-foo", 914 .ctrl_dev_name = "pinctrl-foo",
869 .function = "mmc0", 915 .function = "mmc0",
870 .group = "mmc0_1_grp", 916 .group = "mmc0_1_grp",
871 .dev_name = "foo-mmc.0",
872}, 917},
873{ 918{
919 .dev_name = "foo-mmc.0",
874 .name = "4bit" 920 .name = "4bit"
921 .type = PIN_MAP_TYPE_MUX_GROUP,
875 .ctrl_dev_name = "pinctrl-foo", 922 .ctrl_dev_name = "pinctrl-foo",
876 .function = "mmc0", 923 .function = "mmc0",
877 .group = "mmc0_2_grp", 924 .group = "mmc0_2_grp",
878 .dev_name = "foo-mmc.0",
879}, 925},
880{ 926{
927 .dev_name = "foo-mmc.0",
881 .name = "8bit" 928 .name = "8bit"
929 .type = PIN_MAP_TYPE_MUX_GROUP,
882 .ctrl_dev_name = "pinctrl-foo", 930 .ctrl_dev_name = "pinctrl-foo",
931 .function = "mmc0",
883 .group = "mmc0_1_grp", 932 .group = "mmc0_1_grp",
884 .dev_name = "foo-mmc.0",
885}, 933},
886{ 934{
935 .dev_name = "foo-mmc.0",
887 .name = "8bit" 936 .name = "8bit"
937 .type = PIN_MAP_TYPE_MUX_GROUP,
888 .ctrl_dev_name = "pinctrl-foo", 938 .ctrl_dev_name = "pinctrl-foo",
889 .function = "mmc0", 939 .function = "mmc0",
890 .group = "mmc0_2_grp", 940 .group = "mmc0_2_grp",
891 .dev_name = "foo-mmc.0",
892}, 941},
893{ 942{
943 .dev_name = "foo-mmc.0",
894 .name = "8bit" 944 .name = "8bit"
945 .type = PIN_MAP_TYPE_MUX_GROUP,
895 .ctrl_dev_name = "pinctrl-foo", 946 .ctrl_dev_name = "pinctrl-foo",
896 .function = "mmc0", 947 .function = "mmc0",
897 .group = "mmc0_3_grp", 948 .group = "mmc0_3_grp",
898 .dev_name = "foo-mmc.0",
899}, 949},
900... 950...
901 951
902The result of grabbing this mapping from the device with something like 952The result of grabbing this mapping from the device with something like
903this (see next paragraph): 953this (see next paragraph):
904 954
905 pmx = pinmux_get(&device, "8bit"); 955 p = pinctrl_get(dev);
956 s = pinctrl_lookup_state(p, "8bit");
957 ret = pinctrl_select_state(p, s);
958
959or more simply:
960
961 p = pinctrl_get_select(dev, "8bit");
906 962
907Will be that you activate all the three bottom records in the mapping at 963Will be that you activate all the three bottom records in the mapping at
908once. Since they share the same name, pin controller device, funcion and 964once. Since they share the same name, pin controller device, function and
909device, and since we allow multiple groups to match to a single device, they 965device, and since we allow multiple groups to match to a single device, they
910all get selected, and they all get enabled and disable simultaneously by the 966all get selected, and they all get enabled and disable simultaneously by the
911pinmux core. 967pinmux core.
@@ -914,97 +970,111 @@ pinmux core.
914Pinmux requests from drivers 970Pinmux requests from drivers
915============================ 971============================
916 972
917Generally it is discouraged to let individual drivers get and enable pinmuxes. 973Generally it is discouraged to let individual drivers get and enable pin
918So if possible, handle the pinmuxes in platform code or some other place where 974control. So if possible, handle the pin control in platform code or some other
919you have access to all the affected struct device * pointers. In some cases 975place where you have access to all the affected struct device * pointers. In
920where a driver needs to switch between different mux mappings at runtime 976some cases where a driver needs to e.g. switch between different mux mappings
921this is not possible. 977at runtime this is not possible.
922 978
923A driver may request a certain mux to be activated, usually just the default 979A driver may request a certain control state to be activated, usually just the
924mux like this: 980default state like this:
925 981
926#include <linux/pinctrl/pinmux.h> 982#include <linux/pinctrl/consumer.h>
927 983
928struct foo_state { 984struct foo_state {
929 struct pinmux *pmx; 985 struct pinctrl *p;
986 struct pinctrl_state *s;
930 ... 987 ...
931}; 988};
932 989
933foo_probe() 990foo_probe()
934{ 991{
935 /* Allocate a state holder named "state" etc */ 992 /* Allocate a state holder named "foo" etc */
936 struct pinmux pmx; 993 struct foo_state *foo = ...;
994
995 foo->p = pinctrl_get(&device);
996 if (IS_ERR(foo->p)) {
997 /* FIXME: clean up "foo" here */
998 return PTR_ERR(foo->p);
999 }
937 1000
938 pmx = pinmux_get(&device, NULL); 1001 foo->s = pinctrl_lookup_state(foo->p, PINCTRL_STATE_DEFAULT);
939 if IS_ERR(pmx) 1002 if (IS_ERR(foo->s)) {
940 return PTR_ERR(pmx); 1003 pinctrl_put(foo->p);
941 pinmux_enable(pmx); 1004 /* FIXME: clean up "foo" here */
1005 return PTR_ERR(s);
1006 }
942 1007
943 state->pmx = pmx; 1008 ret = pinctrl_select_state(foo->s);
1009 if (ret < 0) {
1010 pinctrl_put(foo->p);
1011 /* FIXME: clean up "foo" here */
1012 return ret;
1013 }
944} 1014}
945 1015
946foo_remove() 1016foo_remove()
947{ 1017{
948 pinmux_disable(state->pmx); 1018 pinctrl_put(state->p);
949 pinmux_put(state->pmx);
950} 1019}
951 1020
952If you want to grab a specific mux mapping and not just the first one found for 1021This get/lookup/select/put sequence can just as well be handled by bus drivers
953this device you can specify a specific mapping name, for example in the above
954example the second i2c0 setting: pinmux_get(&device, "spi0-pos-B");
955
956This get/enable/disable/put sequence can just as well be handled by bus drivers
957if you don't want each and every driver to handle it and you know the 1022if you don't want each and every driver to handle it and you know the
958arrangement on your bus. 1023arrangement on your bus.
959 1024
960The semantics of the get/enable respective disable/put is as follows: 1025The semantics of the pinctrl APIs are:
1026
1027- pinctrl_get() is called in process context to obtain a handle to all pinctrl
1028 information for a given client device. It will allocate a struct from the
1029 kernel memory to hold the pinmux state. All mapping table parsing or similar
1030 slow operations take place within this API.
961 1031
962- pinmux_get() is called in process context to reserve the pins affected with 1032- pinctrl_lookup_state() is called in process context to obtain a handle to a
963 a certain mapping and set up the pinmux core and the driver. It will allocate 1033 specific state for a the client device. This operation may be slow too.
964 a struct from the kernel memory to hold the pinmux state.
965 1034
966- pinmux_enable()/pinmux_disable() is quick and can be called from fastpath 1035- pinctrl_select_state() programs pin controller hardware according to the
967 (irq context) when you quickly want to set up/tear down the hardware muxing 1036 definition of the state as given by the mapping table. In theory this is a
968 when running a device driver. Usually it will just poke some values into a 1037 fast-path operation, since it only involved blasting some register settings
969 register. 1038 into hardware. However, note that some pin controllers may have their
1039 registers on a slow/IRQ-based bus, so client devices should not assume they
1040 can call pinctrl_select_state() from non-blocking contexts.
970 1041
971- pinmux_disable() is called in process context to tear down the pin requests 1042- pinctrl_put() frees all information associated with a pinctrl handle.
972 and release the state holder struct for the mux setting.
973 1043
974Usually the pinmux core handled the get/put pair and call out to the device 1044Usually the pin control core handled the get/put pair and call out to the
975drivers bookkeeping operations, like checking available functions and the 1045device drivers bookkeeping operations, like checking available functions and
976associated pins, whereas the enable/disable pass on to the pin controller 1046the associated pins, whereas the enable/disable pass on to the pin controller
977driver which takes care of activating and/or deactivating the mux setting by 1047driver which takes care of activating and/or deactivating the mux setting by
978quickly poking some registers. 1048quickly poking some registers.
979 1049
980The pins are allocated for your device when you issue the pinmux_get() call, 1050The pins are allocated for your device when you issue the pinctrl_get() call,
981after this you should be able to see this in the debugfs listing of all pins. 1051after this you should be able to see this in the debugfs listing of all pins.
982 1052
983 1053
984System pinmux hogging 1054System pin control hogging
985===================== 1055==========================
986 1056
987A system pinmux map entry, i.e. a pinmux setting that does not have a device 1057Pin control map entries can be hogged by the core when the pin controller
988associated with it, can be hogged by the core when the pin controller is 1058is registered. This means that the core will attempt to call pinctrl_get(),
989registered. This means that the core will attempt to call pinmux_get() and 1059lookup_state() and select_state() on it immediately after the pin control
990pinmux_enable() on it immediately after the pin control device has been 1060device has been registered.
991registered.
992 1061
993This is enabled by simply setting the .hog_on_boot field in the map to true, 1062This occurs for mapping table entries where the client device name is equal
994like this: 1063to the pin controller device name, and the state name is PINCTRL_STATE_DEFAULT.
995 1064
996{ 1065{
997 .name = "POWERMAP" 1066 .dev_name = "pinctrl-foo",
1067 .name = PINCTRL_STATE_DEFAULT,
1068 .type = PIN_MAP_TYPE_MUX_GROUP,
998 .ctrl_dev_name = "pinctrl-foo", 1069 .ctrl_dev_name = "pinctrl-foo",
999 .function = "power_func", 1070 .function = "power_func",
1000 .hog_on_boot = true,
1001}, 1071},
1002 1072
1003Since it may be common to request the core to hog a few always-applicable 1073Since it may be common to request the core to hog a few always-applicable
1004mux settings on the primary pin controller, there is a convenience macro for 1074mux settings on the primary pin controller, there is a convenience macro for
1005this: 1075this:
1006 1076
1007PINMUX_MAP_PRIMARY_SYS_HOG("POWERMAP", "power_func") 1077PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-foo", NULL /* group */, "power_func")
1008 1078
1009This gives the exact same result as the above construction. 1079This gives the exact same result as the above construction.
1010 1080
@@ -1016,32 +1086,47 @@ It is possible to mux a certain function in and out at runtime, say to move
1016an SPI port from one set of pins to another set of pins. Say for example for 1086an SPI port from one set of pins to another set of pins. Say for example for
1017spi0 in the example above, we expose two different groups of pins for the same 1087spi0 in the example above, we expose two different groups of pins for the same
1018function, but with different named in the mapping as described under 1088function, but with different named in the mapping as described under
1019"Advanced mapping" above. So we have two mappings named "spi0-pos-A" and 1089"Advanced mapping" above. So that for an SPI device, we have two states named
1020"spi0-pos-B". 1090"pos-A" and "pos-B".
1021 1091
1022This snippet first muxes the function in the pins defined by group A, enables 1092This snippet first muxes the function in the pins defined by group A, enables
1023it, disables and releases it, and muxes it in on the pins defined by group B: 1093it, disables and releases it, and muxes it in on the pins defined by group B:
1024 1094
1095#include <linux/pinctrl/consumer.h>
1096
1025foo_switch() 1097foo_switch()
1026{ 1098{
1027 struct pinmux *pmx; 1099 struct pinctrl *p;
1100 struct pinctrl_state *s1, *s2;
1101
1102 /* Setup */
1103 p = pinctrl_get(&device);
1104 if (IS_ERR(p))
1105 ...
1106
1107 s1 = pinctrl_lookup_state(foo->p, "pos-A");
1108 if (IS_ERR(s1))
1109 ...
1110
1111 s2 = pinctrl_lookup_state(foo->p, "pos-B");
1112 if (IS_ERR(s2))
1113 ...
1028 1114
1029 /* Enable on position A */ 1115 /* Enable on position A */
1030 pmx = pinmux_get(&device, "spi0-pos-A"); 1116 ret = pinctrl_select_state(s1);
1031 if IS_ERR(pmx) 1117 if (ret < 0)
1032 return PTR_ERR(pmx); 1118 ...
1033 pinmux_enable(pmx);
1034 1119
1035 /* This releases the pins again */ 1120 ...
1036 pinmux_disable(pmx);
1037 pinmux_put(pmx);
1038 1121
1039 /* Enable on position B */ 1122 /* Enable on position B */
1040 pmx = pinmux_get(&device, "spi0-pos-B"); 1123 ret = pinctrl_select_state(s2);
1041 if IS_ERR(pmx) 1124 if (ret < 0)
1042 return PTR_ERR(pmx); 1125 ...
1043 pinmux_enable(pmx); 1126
1044 ... 1127 ...
1128
1129 pinctrl_put(p);
1045} 1130}
1046 1131
1047The above has to be done from process context. 1132The above has to be done from process context.
diff --git a/arch/arm/mach-tegra/Kconfig b/arch/arm/mach-tegra/Kconfig
index 373652d76b90..32b420a90c3d 100644
--- a/arch/arm/mach-tegra/Kconfig
+++ b/arch/arm/mach-tegra/Kconfig
@@ -7,6 +7,8 @@ config ARCH_TEGRA_2x_SOC
7 select CPU_V7 7 select CPU_V7
8 select ARM_GIC 8 select ARM_GIC
9 select ARCH_REQUIRE_GPIOLIB 9 select ARCH_REQUIRE_GPIOLIB
10 select PINCTRL
11 select PINCTRL_TEGRA20
10 select USB_ARCH_HAS_EHCI if USB_SUPPORT 12 select USB_ARCH_HAS_EHCI if USB_SUPPORT
11 select USB_ULPI if USB_SUPPORT 13 select USB_ULPI if USB_SUPPORT
12 select USB_ULPI_VIEWPORT if USB_SUPPORT 14 select USB_ULPI_VIEWPORT if USB_SUPPORT
@@ -19,6 +21,8 @@ config ARCH_TEGRA_3x_SOC
19 select CPU_V7 21 select CPU_V7
20 select ARM_GIC 22 select ARM_GIC
21 select ARCH_REQUIRE_GPIOLIB 23 select ARCH_REQUIRE_GPIOLIB
24 select PINCTRL
25 select PINCTRL_TEGRA30
22 select USB_ARCH_HAS_EHCI if USB_SUPPORT 26 select USB_ARCH_HAS_EHCI if USB_SUPPORT
23 select USB_ULPI if USB_SUPPORT 27 select USB_ULPI if USB_SUPPORT
24 select USB_ULPI_VIEWPORT if USB_SUPPORT 28 select USB_ULPI_VIEWPORT if USB_SUPPORT
diff --git a/arch/arm/mach-tegra/include/mach/pinconf-tegra.h b/arch/arm/mach-tegra/include/mach/pinconf-tegra.h
new file mode 100644
index 000000000000..1f24d304921e
--- /dev/null
+++ b/arch/arm/mach-tegra/include/mach/pinconf-tegra.h
@@ -0,0 +1,63 @@
1/*
2 * pinctrl configuration definitions for the NVIDIA Tegra pinmux
3 *
4 * Copyright (c) 2011, NVIDIA CORPORATION. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 */
15
16#ifndef __PINCONF_TEGRA_H__
17#define __PINCONF_TEGRA_H__
18
19enum tegra_pinconf_param {
20 /* argument: tegra_pinconf_pull */
21 TEGRA_PINCONF_PARAM_PULL,
22 /* argument: tegra_pinconf_tristate */
23 TEGRA_PINCONF_PARAM_TRISTATE,
24 /* argument: Boolean */
25 TEGRA_PINCONF_PARAM_ENABLE_INPUT,
26 /* argument: Boolean */
27 TEGRA_PINCONF_PARAM_OPEN_DRAIN,
28 /* argument: Boolean */
29 TEGRA_PINCONF_PARAM_LOCK,
30 /* argument: Boolean */
31 TEGRA_PINCONF_PARAM_IORESET,
32 /* argument: Boolean */
33 TEGRA_PINCONF_PARAM_HIGH_SPEED_MODE,
34 /* argument: Boolean */
35 TEGRA_PINCONF_PARAM_SCHMITT,
36 /* argument: Boolean */
37 TEGRA_PINCONF_PARAM_LOW_POWER_MODE,
38 /* argument: Integer, range is HW-dependant */
39 TEGRA_PINCONF_PARAM_DRIVE_DOWN_STRENGTH,
40 /* argument: Integer, range is HW-dependant */
41 TEGRA_PINCONF_PARAM_DRIVE_UP_STRENGTH,
42 /* argument: Integer, range is HW-dependant */
43 TEGRA_PINCONF_PARAM_SLEW_RATE_FALLING,
44 /* argument: Integer, range is HW-dependant */
45 TEGRA_PINCONF_PARAM_SLEW_RATE_RISING,
46};
47
48enum tegra_pinconf_pull {
49 TEGRA_PINCONFIG_PULL_NONE,
50 TEGRA_PINCONFIG_PULL_DOWN,
51 TEGRA_PINCONFIG_PULL_UP,
52};
53
54enum tegra_pinconf_tristate {
55 TEGRA_PINCONFIG_DRIVEN,
56 TEGRA_PINCONFIG_TRISTATE,
57};
58
59#define TEGRA_PINCONF_PACK(_param_, _arg_) ((_param_) << 16 | (_arg_))
60#define TEGRA_PINCONF_UNPACK_PARAM(_conf_) ((_conf_) >> 16)
61#define TEGRA_PINCONF_UNPACK_ARG(_conf_) ((_conf_) & 0xffff)
62
63#endif
diff --git a/arch/arm/mach-u300/core.c b/arch/arm/mach-u300/core.c
index b4c6926a700c..a7b3f36e2262 100644
--- a/arch/arm/mach-u300/core.c
+++ b/arch/arm/mach-u300/core.c
@@ -26,7 +26,8 @@
26#include <linux/mtd/nand.h> 26#include <linux/mtd/nand.h>
27#include <linux/mtd/fsmc.h> 27#include <linux/mtd/fsmc.h>
28#include <linux/pinctrl/machine.h> 28#include <linux/pinctrl/machine.h>
29#include <linux/pinctrl/pinmux.h> 29#include <linux/pinctrl/consumer.h>
30#include <linux/pinctrl/pinconf-generic.h>
30#include <linux/dma-mapping.h> 31#include <linux/dma-mapping.h>
31 32
32#include <asm/types.h> 33#include <asm/types.h>
@@ -1477,7 +1478,7 @@ static struct coh901318_platform coh901318_platform = {
1477 .max_channels = U300_DMA_CHANNELS, 1478 .max_channels = U300_DMA_CHANNELS,
1478}; 1479};
1479 1480
1480static struct resource pinmux_resources[] = { 1481static struct resource pinctrl_resources[] = {
1481 { 1482 {
1482 .start = U300_SYSCON_BASE, 1483 .start = U300_SYSCON_BASE,
1483 .end = U300_SYSCON_BASE + SZ_4K - 1, 1484 .end = U300_SYSCON_BASE + SZ_4K - 1,
@@ -1506,6 +1507,13 @@ static struct platform_device i2c1_device = {
1506 .resource = i2c1_resources, 1507 .resource = i2c1_resources,
1507}; 1508};
1508 1509
1510static struct platform_device pinctrl_device = {
1511 .name = "pinctrl-u300",
1512 .id = -1,
1513 .num_resources = ARRAY_SIZE(pinctrl_resources),
1514 .resource = pinctrl_resources,
1515};
1516
1509/* 1517/*
1510 * The different variants have a few different versions of the 1518 * The different variants have a few different versions of the
1511 * GPIO block, with different number of ports. 1519 * GPIO block, with different number of ports.
@@ -1525,6 +1533,7 @@ static struct u300_gpio_platform u300_gpio_plat = {
1525#endif 1533#endif
1526 .gpio_base = 0, 1534 .gpio_base = 0,
1527 .gpio_irq_base = IRQ_U300_GPIO_BASE, 1535 .gpio_irq_base = IRQ_U300_GPIO_BASE,
1536 .pinctrl_device = &pinctrl_device,
1528}; 1537};
1529 1538
1530static struct platform_device gpio_device = { 1539static struct platform_device gpio_device = {
@@ -1597,71 +1606,67 @@ static struct platform_device dma_device = {
1597 }, 1606 },
1598}; 1607};
1599 1608
1600static struct platform_device pinmux_device = { 1609static unsigned long pin_pullup_conf[] = {
1601 .name = "pinmux-u300", 1610 PIN_CONF_PACKED(PIN_CONFIG_BIAS_PULL_UP, 1),
1602 .id = -1,
1603 .num_resources = ARRAY_SIZE(pinmux_resources),
1604 .resource = pinmux_resources,
1605}; 1611};
1606 1612
1607/* Pinmux settings */ 1613static unsigned long pin_highz_conf[] = {
1608static struct pinmux_map __initdata u300_pinmux_map[] = { 1614 PIN_CONF_PACKED(PIN_CONFIG_BIAS_HIGH_IMPEDANCE, 0),
1615};
1616
1617/* Pin control settings */
1618static struct pinctrl_map __initdata u300_pinmux_map[] = {
1609 /* anonymous maps for chip power and EMIFs */ 1619 /* anonymous maps for chip power and EMIFs */
1610 PINMUX_MAP_SYS_HOG("POWER", "pinmux-u300", "power"), 1620 PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-u300", NULL, "power"),
1611 PINMUX_MAP_SYS_HOG("EMIF0", "pinmux-u300", "emif0"), 1621 PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-u300", NULL, "emif0"),
1612 PINMUX_MAP_SYS_HOG("EMIF1", "pinmux-u300", "emif1"), 1622 PIN_MAP_MUX_GROUP_HOG_DEFAULT("pinctrl-u300", NULL, "emif1"),
1613 /* per-device maps for MMC/SD, SPI and UART */ 1623 /* per-device maps for MMC/SD, SPI and UART */
1614 PINMUX_MAP("MMCSD", "pinmux-u300", "mmc0", "mmci"), 1624 PIN_MAP_MUX_GROUP_DEFAULT("mmci", "pinctrl-u300", NULL, "mmc0"),
1615 PINMUX_MAP("SPI", "pinmux-u300", "spi0", "pl022"), 1625 PIN_MAP_MUX_GROUP_DEFAULT("pl022", "pinctrl-u300", NULL, "spi0"),
1616 PINMUX_MAP("UART0", "pinmux-u300", "uart0", "uart0"), 1626 PIN_MAP_MUX_GROUP_DEFAULT("uart0", "pinctrl-u300", NULL, "uart0"),
1627 /* This pin is used for clock return rather than GPIO */
1628 PIN_MAP_CONFIGS_PIN_DEFAULT("mmci", "pinctrl-u300", "PIO APP GPIO 11",
1629 pin_pullup_conf),
1630 /* This pin is used for card detect */
1631 PIN_MAP_CONFIGS_PIN_DEFAULT("mmci", "pinctrl-u300", "PIO MS INS",
1632 pin_highz_conf),
1617}; 1633};
1618 1634
1619struct u300_mux_hog { 1635struct u300_mux_hog {
1620 const char *name;
1621 struct device *dev; 1636 struct device *dev;
1622 struct pinmux *pmx; 1637 struct pinctrl *p;
1623}; 1638};
1624 1639
1625static struct u300_mux_hog u300_mux_hogs[] = { 1640static struct u300_mux_hog u300_mux_hogs[] = {
1626 { 1641 {
1627 .name = "uart0",
1628 .dev = &uart0_device.dev, 1642 .dev = &uart0_device.dev,
1629 }, 1643 },
1630 { 1644 {
1631 .name = "spi0",
1632 .dev = &pl022_device.dev, 1645 .dev = &pl022_device.dev,
1633 }, 1646 },
1634 { 1647 {
1635 .name = "mmc0",
1636 .dev = &mmcsd_device.dev, 1648 .dev = &mmcsd_device.dev,
1637 }, 1649 },
1638}; 1650};
1639 1651
1640static int __init u300_pinmux_fetch(void) 1652static int __init u300_pinctrl_fetch(void)
1641{ 1653{
1642 int i; 1654 int i;
1643 1655
1644 for (i = 0; i < ARRAY_SIZE(u300_mux_hogs); i++) { 1656 for (i = 0; i < ARRAY_SIZE(u300_mux_hogs); i++) {
1645 struct pinmux *pmx; 1657 struct pinctrl *p;
1646 int ret;
1647 1658
1648 pmx = pinmux_get(u300_mux_hogs[i].dev, NULL); 1659 p = pinctrl_get_select_default(u300_mux_hogs[i].dev);
1649 if (IS_ERR(pmx)) { 1660 if (IS_ERR(p)) {
1650 pr_err("u300: could not get pinmux hog %s\n", 1661 pr_err("u300: could not get pinmux hog for dev %s\n",
1651 u300_mux_hogs[i].name); 1662 dev_name(u300_mux_hogs[i].dev));
1652 continue;
1653 }
1654 ret = pinmux_enable(pmx);
1655 if (ret) {
1656 pr_err("u300: could enable pinmux hog %s\n",
1657 u300_mux_hogs[i].name);
1658 continue; 1663 continue;
1659 } 1664 }
1660 u300_mux_hogs[i].pmx = pmx; 1665 u300_mux_hogs[i].p = p;
1661 } 1666 }
1662 return 0; 1667 return 0;
1663} 1668}
1664subsys_initcall(u300_pinmux_fetch); 1669subsys_initcall(u300_pinctrl_fetch);
1665 1670
1666/* 1671/*
1667 * Notice that AMBA devices are initialized before platform devices. 1672 * Notice that AMBA devices are initialized before platform devices.
@@ -1676,7 +1681,6 @@ static struct platform_device *platform_devs[] __initdata = {
1676 &gpio_device, 1681 &gpio_device,
1677 &nand_device, 1682 &nand_device,
1678 &wdog_device, 1683 &wdog_device,
1679 &pinmux_device,
1680}; 1684};
1681 1685
1682/* 1686/*
@@ -1861,8 +1865,8 @@ void __init u300_init_devices(void)
1861 u300_assign_physmem(); 1865 u300_assign_physmem();
1862 1866
1863 /* Initialize pinmuxing */ 1867 /* Initialize pinmuxing */
1864 pinmux_register_mappings(u300_pinmux_map, 1868 pinctrl_register_mappings(u300_pinmux_map,
1865 ARRAY_SIZE(u300_pinmux_map)); 1869 ARRAY_SIZE(u300_pinmux_map));
1866 1870
1867 /* Register subdevices on the I2C buses */ 1871 /* Register subdevices on the I2C buses */
1868 u300_i2c_register_board_devices(); 1872 u300_i2c_register_board_devices();
diff --git a/arch/arm/mach-u300/include/mach/gpio-u300.h b/arch/arm/mach-u300/include/mach/gpio-u300.h
index bf4c7935aecd..e81400c1753a 100644
--- a/arch/arm/mach-u300/include/mach/gpio-u300.h
+++ b/arch/arm/mach-u300/include/mach/gpio-u300.h
@@ -24,12 +24,14 @@ enum u300_gpio_variant {
24 * @ports: number of GPIO block ports 24 * @ports: number of GPIO block ports
25 * @gpio_base: first GPIO number for this block (use a free range) 25 * @gpio_base: first GPIO number for this block (use a free range)
26 * @gpio_irq_base: first GPIO IRQ number for this block (use a free range) 26 * @gpio_irq_base: first GPIO IRQ number for this block (use a free range)
27 * @pinctrl_device: pin control device to spawn as child
27 */ 28 */
28struct u300_gpio_platform { 29struct u300_gpio_platform {
29 enum u300_gpio_variant variant; 30 enum u300_gpio_variant variant;
30 u8 ports; 31 u8 ports;
31 int gpio_base; 32 int gpio_base;
32 int gpio_irq_base; 33 int gpio_irq_base;
34 struct platform_device *pinctrl_device;
33}; 35};
34 36
35#endif /* __MACH_U300_GPIO_U300_H */ 37#endif /* __MACH_U300_GPIO_U300_H */
diff --git a/drivers/pinctrl/Kconfig b/drivers/pinctrl/Kconfig
index afaf88558125..abfb96408779 100644
--- a/drivers/pinctrl/Kconfig
+++ b/drivers/pinctrl/Kconfig
@@ -17,21 +17,63 @@ config PINMUX
17config PINCONF 17config PINCONF
18 bool "Support pin configuration controllers" 18 bool "Support pin configuration controllers"
19 19
20config GENERIC_PINCONF
21 bool
22 select PINCONF
23
20config DEBUG_PINCTRL 24config DEBUG_PINCTRL
21 bool "Debug PINCTRL calls" 25 bool "Debug PINCTRL calls"
22 depends on DEBUG_KERNEL 26 depends on DEBUG_KERNEL
23 help 27 help
24 Say Y here to add some extra checks and diagnostics to PINCTRL calls. 28 Say Y here to add some extra checks and diagnostics to PINCTRL calls.
25 29
30config PINCTRL_PXA3xx
31 bool
32 select PINMUX
33
34config PINCTRL_MMP2
35 bool "MMP2 pin controller driver"
36 depends on ARCH_MMP
37 select PINCTRL_PXA3xx
38 select PINCONF
39
40config PINCTRL_PXA168
41 bool "PXA168 pin controller driver"
42 depends on ARCH_MMP
43 select PINCTRL_PXA3xx
44 select PINCONF
45
46config PINCTRL_PXA910
47 bool "PXA910 pin controller driver"
48 depends on ARCH_MMP
49 select PINCTRL_PXA3xx
50 select PINCONF
51
26config PINCTRL_SIRF 52config PINCTRL_SIRF
27 bool "CSR SiRFprimaII pin controller driver" 53 bool "CSR SiRFprimaII pin controller driver"
28 depends on ARCH_PRIMA2 54 depends on ARCH_PRIMA2
29 select PINMUX 55 select PINMUX
30 56
57config PINCTRL_TEGRA
58 bool
59
60config PINCTRL_TEGRA20
61 bool
62 select PINMUX
63 select PINCONF
64 select PINCTRL_TEGRA
65
66config PINCTRL_TEGRA30
67 bool
68 select PINMUX
69 select PINCONF
70 select PINCTRL_TEGRA
71
31config PINCTRL_U300 72config PINCTRL_U300
32 bool "U300 pin controller driver" 73 bool "U300 pin controller driver"
33 depends on ARCH_U300 74 depends on ARCH_U300
34 select PINMUX 75 select PINMUX
76 select GENERIC_PINCONF
35 77
36config PINCTRL_COH901 78config PINCTRL_COH901
37 bool "ST-Ericsson U300 COH 901 335/571 GPIO" 79 bool "ST-Ericsson U300 COH 901 335/571 GPIO"
diff --git a/drivers/pinctrl/Makefile b/drivers/pinctrl/Makefile
index 827601cc68f6..6d4150b4eced 100644
--- a/drivers/pinctrl/Makefile
+++ b/drivers/pinctrl/Makefile
@@ -5,6 +5,14 @@ ccflags-$(CONFIG_DEBUG_PINCTRL) += -DDEBUG
5obj-$(CONFIG_PINCTRL) += core.o 5obj-$(CONFIG_PINCTRL) += core.o
6obj-$(CONFIG_PINMUX) += pinmux.o 6obj-$(CONFIG_PINMUX) += pinmux.o
7obj-$(CONFIG_PINCONF) += pinconf.o 7obj-$(CONFIG_PINCONF) += pinconf.o
8obj-$(CONFIG_GENERIC_PINCONF) += pinconf-generic.o
9obj-$(CONFIG_PINCTRL_PXA3xx) += pinctrl-pxa3xx.o
10obj-$(CONFIG_PINCTRL_MMP2) += pinctrl-mmp2.o
11obj-$(CONFIG_PINCTRL_PXA168) += pinctrl-pxa168.o
12obj-$(CONFIG_PINCTRL_PXA910) += pinctrl-pxa910.o
8obj-$(CONFIG_PINCTRL_SIRF) += pinctrl-sirf.o 13obj-$(CONFIG_PINCTRL_SIRF) += pinctrl-sirf.o
14obj-$(CONFIG_PINCTRL_TEGRA) += pinctrl-tegra.o
15obj-$(CONFIG_PINCTRL_TEGRA20) += pinctrl-tegra20.o
16obj-$(CONFIG_PINCTRL_TEGRA30) += pinctrl-tegra30.o
9obj-$(CONFIG_PINCTRL_U300) += pinctrl-u300.o 17obj-$(CONFIG_PINCTRL_U300) += pinctrl-u300.o
10obj-$(CONFIG_PINCTRL_COH901) += pinctrl-coh901.o 18obj-$(CONFIG_PINCTRL_COH901) += pinctrl-coh901.o
diff --git a/drivers/pinctrl/core.c b/drivers/pinctrl/core.c
index 894cd5e103da..ec3b8cc188af 100644
--- a/drivers/pinctrl/core.c
+++ b/drivers/pinctrl/core.c
@@ -1,12 +1,14 @@
1/* 1/*
2 * Core driver for the pin control subsystem 2 * Core driver for the pin control subsystem
3 * 3 *
4 * Copyright (C) 2011 ST-Ericsson SA 4 * Copyright (C) 2011-2012 ST-Ericsson SA
5 * Written on behalf of Linaro for ST-Ericsson 5 * Written on behalf of Linaro for ST-Ericsson
6 * Based on bits of regulator core, gpio core and clk core 6 * Based on bits of regulator core, gpio core and clk core
7 * 7 *
8 * Author: Linus Walleij <linus.walleij@linaro.org> 8 * Author: Linus Walleij <linus.walleij@linaro.org>
9 * 9 *
10 * Copyright (C) 2012 NVIDIA CORPORATION. All rights reserved.
11 *
10 * License terms: GNU General Public License (GPL) version 2 12 * License terms: GNU General Public License (GPL) version 2
11 */ 13 */
12#define pr_fmt(fmt) "pinctrl core: " fmt 14#define pr_fmt(fmt) "pinctrl core: " fmt
@@ -16,11 +18,8 @@
16#include <linux/init.h> 18#include <linux/init.h>
17#include <linux/device.h> 19#include <linux/device.h>
18#include <linux/slab.h> 20#include <linux/slab.h>
19#include <linux/radix-tree.h>
20#include <linux/err.h> 21#include <linux/err.h>
21#include <linux/list.h> 22#include <linux/list.h>
22#include <linux/mutex.h>
23#include <linux/spinlock.h>
24#include <linux/sysfs.h> 23#include <linux/sysfs.h>
25#include <linux/debugfs.h> 24#include <linux/debugfs.h>
26#include <linux/seq_file.h> 25#include <linux/seq_file.h>
@@ -30,10 +29,36 @@
30#include "pinmux.h" 29#include "pinmux.h"
31#include "pinconf.h" 30#include "pinconf.h"
32 31
33/* Global list of pin control devices */ 32/**
34static DEFINE_MUTEX(pinctrldev_list_mutex); 33 * struct pinctrl_maps - a list item containing part of the mapping table
34 * @node: mapping table list node
35 * @maps: array of mapping table entries
36 * @num_maps: the number of entries in @maps
37 */
38struct pinctrl_maps {
39 struct list_head node;
40 struct pinctrl_map const *maps;
41 unsigned num_maps;
42};
43
44/* Mutex taken by all entry points */
45DEFINE_MUTEX(pinctrl_mutex);
46
47/* Global list of pin control devices (struct pinctrl_dev) */
35static LIST_HEAD(pinctrldev_list); 48static LIST_HEAD(pinctrldev_list);
36 49
50/* List of pin controller handles (struct pinctrl) */
51static LIST_HEAD(pinctrl_list);
52
53/* List of pinctrl maps (struct pinctrl_maps) */
54static LIST_HEAD(pinctrl_maps);
55
56#define for_each_maps(_maps_node_, _i_, _map_) \
57 list_for_each_entry(_maps_node_, &pinctrl_maps, node) \
58 for (_i_ = 0, _map_ = &_maps_node_->maps[_i_]; \
59 _i_ < _maps_node_->num_maps; \
60 i++, _map_ = &_maps_node_->maps[_i_])
61
37const char *pinctrl_dev_get_name(struct pinctrl_dev *pctldev) 62const char *pinctrl_dev_get_name(struct pinctrl_dev *pctldev)
38{ 63{
39 /* We're not allowed to register devices without name */ 64 /* We're not allowed to register devices without name */
@@ -48,53 +73,31 @@ void *pinctrl_dev_get_drvdata(struct pinctrl_dev *pctldev)
48EXPORT_SYMBOL_GPL(pinctrl_dev_get_drvdata); 73EXPORT_SYMBOL_GPL(pinctrl_dev_get_drvdata);
49 74
50/** 75/**
51 * get_pinctrl_dev_from_dev() - look up pin controller device 76 * get_pinctrl_dev_from_devname() - look up pin controller device
52 * @dev: a device pointer, this may be NULL but then devname needs to be 77 * @devname: the name of a device instance, as returned by dev_name()
53 * defined instead
54 * @devname: the name of a device instance, as returned by dev_name(), this
55 * may be NULL but then dev needs to be defined instead
56 * 78 *
57 * Looks up a pin control device matching a certain device name or pure device 79 * Looks up a pin control device matching a certain device name or pure device
58 * pointer, the pure device pointer will take precedence. 80 * pointer, the pure device pointer will take precedence.
59 */ 81 */
60struct pinctrl_dev *get_pinctrl_dev_from_dev(struct device *dev, 82struct pinctrl_dev *get_pinctrl_dev_from_devname(const char *devname)
61 const char *devname)
62{ 83{
63 struct pinctrl_dev *pctldev = NULL; 84 struct pinctrl_dev *pctldev = NULL;
64 bool found = false; 85 bool found = false;
65 86
66 mutex_lock(&pinctrldev_list_mutex); 87 if (!devname)
67 list_for_each_entry(pctldev, &pinctrldev_list, node) { 88 return NULL;
68 if (dev && pctldev->dev == dev) {
69 /* Matched on device pointer */
70 found = true;
71 break;
72 }
73 89
74 if (devname && 90 list_for_each_entry(pctldev, &pinctrldev_list, node) {
75 !strcmp(dev_name(pctldev->dev), devname)) { 91 if (!strcmp(dev_name(pctldev->dev), devname)) {
76 /* Matched on device name */ 92 /* Matched on device name */
77 found = true; 93 found = true;
78 break; 94 break;
79 } 95 }
80 } 96 }
81 mutex_unlock(&pinctrldev_list_mutex);
82 97
83 return found ? pctldev : NULL; 98 return found ? pctldev : NULL;
84} 99}
85 100
86struct pin_desc *pin_desc_get(struct pinctrl_dev *pctldev, unsigned int pin)
87{
88 struct pin_desc *pindesc;
89 unsigned long flags;
90
91 spin_lock_irqsave(&pctldev->pin_desc_tree_lock, flags);
92 pindesc = radix_tree_lookup(&pctldev->pin_desc_tree, pin);
93 spin_unlock_irqrestore(&pctldev->pin_desc_tree_lock, flags);
94
95 return pindesc;
96}
97
98/** 101/**
99 * pin_get_from_name() - look up a pin number from a name 102 * pin_get_from_name() - look up a pin number from a name
100 * @pctldev: the pin control device to lookup the pin on 103 * @pctldev: the pin control device to lookup the pin on
@@ -135,11 +138,11 @@ bool pin_is_valid(struct pinctrl_dev *pctldev, int pin)
135 if (pin < 0) 138 if (pin < 0)
136 return false; 139 return false;
137 140
141 mutex_lock(&pinctrl_mutex);
138 pindesc = pin_desc_get(pctldev, pin); 142 pindesc = pin_desc_get(pctldev, pin);
139 if (pindesc == NULL) 143 mutex_unlock(&pinctrl_mutex);
140 return false;
141 144
142 return true; 145 return pindesc != NULL;
143} 146}
144EXPORT_SYMBOL_GPL(pin_is_valid); 147EXPORT_SYMBOL_GPL(pin_is_valid);
145 148
@@ -150,7 +153,6 @@ static void pinctrl_free_pindescs(struct pinctrl_dev *pctldev,
150{ 153{
151 int i; 154 int i;
152 155
153 spin_lock(&pctldev->pin_desc_tree_lock);
154 for (i = 0; i < num_pins; i++) { 156 for (i = 0; i < num_pins; i++) {
155 struct pin_desc *pindesc; 157 struct pin_desc *pindesc;
156 158
@@ -164,7 +166,6 @@ static void pinctrl_free_pindescs(struct pinctrl_dev *pctldev,
164 } 166 }
165 kfree(pindesc); 167 kfree(pindesc);
166 } 168 }
167 spin_unlock(&pctldev->pin_desc_tree_lock);
168} 169}
169 170
170static int pinctrl_register_one_pin(struct pinctrl_dev *pctldev, 171static int pinctrl_register_one_pin(struct pinctrl_dev *pctldev,
@@ -180,10 +181,10 @@ static int pinctrl_register_one_pin(struct pinctrl_dev *pctldev,
180 } 181 }
181 182
182 pindesc = kzalloc(sizeof(*pindesc), GFP_KERNEL); 183 pindesc = kzalloc(sizeof(*pindesc), GFP_KERNEL);
183 if (pindesc == NULL) 184 if (pindesc == NULL) {
185 dev_err(pctldev->dev, "failed to alloc struct pin_desc\n");
184 return -ENOMEM; 186 return -ENOMEM;
185 187 }
186 spin_lock_init(&pindesc->lock);
187 188
188 /* Set owner */ 189 /* Set owner */
189 pindesc->pctldev = pctldev; 190 pindesc->pctldev = pctldev;
@@ -198,9 +199,7 @@ static int pinctrl_register_one_pin(struct pinctrl_dev *pctldev,
198 pindesc->dynamic_name = true; 199 pindesc->dynamic_name = true;
199 } 200 }
200 201
201 spin_lock(&pctldev->pin_desc_tree_lock);
202 radix_tree_insert(&pctldev->pin_desc_tree, number, pindesc); 202 radix_tree_insert(&pctldev->pin_desc_tree, number, pindesc);
203 spin_unlock(&pctldev->pin_desc_tree_lock);
204 pr_debug("registered pin %d (%s) on %s\n", 203 pr_debug("registered pin %d (%s) on %s\n",
205 number, pindesc->name, pctldev->desc->name); 204 number, pindesc->name, pctldev->desc->name);
206 return 0; 205 return 0;
@@ -237,16 +236,13 @@ pinctrl_match_gpio_range(struct pinctrl_dev *pctldev, unsigned gpio)
237 struct pinctrl_gpio_range *range = NULL; 236 struct pinctrl_gpio_range *range = NULL;
238 237
239 /* Loop over the ranges */ 238 /* Loop over the ranges */
240 mutex_lock(&pctldev->gpio_ranges_lock);
241 list_for_each_entry(range, &pctldev->gpio_ranges, node) { 239 list_for_each_entry(range, &pctldev->gpio_ranges, node) {
242 /* Check if we're in the valid range */ 240 /* Check if we're in the valid range */
243 if (gpio >= range->base && 241 if (gpio >= range->base &&
244 gpio < range->base + range->npins) { 242 gpio < range->base + range->npins) {
245 mutex_unlock(&pctldev->gpio_ranges_lock);
246 return range; 243 return range;
247 } 244 }
248 } 245 }
249 mutex_unlock(&pctldev->gpio_ranges_lock);
250 246
251 return NULL; 247 return NULL;
252} 248}
@@ -261,14 +257,13 @@ pinctrl_match_gpio_range(struct pinctrl_dev *pctldev, unsigned gpio)
261 * the GPIO subsystem, return the device and the matching GPIO range. Returns 257 * the GPIO subsystem, return the device and the matching GPIO range. Returns
262 * negative if the GPIO range could not be found in any device. 258 * negative if the GPIO range could not be found in any device.
263 */ 259 */
264int pinctrl_get_device_gpio_range(unsigned gpio, 260static int pinctrl_get_device_gpio_range(unsigned gpio,
265 struct pinctrl_dev **outdev, 261 struct pinctrl_dev **outdev,
266 struct pinctrl_gpio_range **outrange) 262 struct pinctrl_gpio_range **outrange)
267{ 263{
268 struct pinctrl_dev *pctldev = NULL; 264 struct pinctrl_dev *pctldev = NULL;
269 265
270 /* Loop over the pin controllers */ 266 /* Loop over the pin controllers */
271 mutex_lock(&pinctrldev_list_mutex);
272 list_for_each_entry(pctldev, &pinctrldev_list, node) { 267 list_for_each_entry(pctldev, &pinctrldev_list, node) {
273 struct pinctrl_gpio_range *range; 268 struct pinctrl_gpio_range *range;
274 269
@@ -276,11 +271,9 @@ int pinctrl_get_device_gpio_range(unsigned gpio,
276 if (range != NULL) { 271 if (range != NULL) {
277 *outdev = pctldev; 272 *outdev = pctldev;
278 *outrange = range; 273 *outrange = range;
279 mutex_unlock(&pinctrldev_list_mutex);
280 return 0; 274 return 0;
281 } 275 }
282 } 276 }
283 mutex_unlock(&pinctrldev_list_mutex);
284 277
285 return -EINVAL; 278 return -EINVAL;
286} 279}
@@ -296,10 +289,11 @@ int pinctrl_get_device_gpio_range(unsigned gpio,
296void pinctrl_add_gpio_range(struct pinctrl_dev *pctldev, 289void pinctrl_add_gpio_range(struct pinctrl_dev *pctldev,
297 struct pinctrl_gpio_range *range) 290 struct pinctrl_gpio_range *range)
298{ 291{
299 mutex_lock(&pctldev->gpio_ranges_lock); 292 mutex_lock(&pinctrl_mutex);
300 list_add(&range->node, &pctldev->gpio_ranges); 293 list_add_tail(&range->node, &pctldev->gpio_ranges);
301 mutex_unlock(&pctldev->gpio_ranges_lock); 294 mutex_unlock(&pinctrl_mutex);
302} 295}
296EXPORT_SYMBOL_GPL(pinctrl_add_gpio_range);
303 297
304/** 298/**
305 * pinctrl_remove_gpio_range() - remove a range of GPIOs fro a pin controller 299 * pinctrl_remove_gpio_range() - remove a range of GPIOs fro a pin controller
@@ -309,10 +303,11 @@ void pinctrl_add_gpio_range(struct pinctrl_dev *pctldev,
309void pinctrl_remove_gpio_range(struct pinctrl_dev *pctldev, 303void pinctrl_remove_gpio_range(struct pinctrl_dev *pctldev,
310 struct pinctrl_gpio_range *range) 304 struct pinctrl_gpio_range *range)
311{ 305{
312 mutex_lock(&pctldev->gpio_ranges_lock); 306 mutex_lock(&pinctrl_mutex);
313 list_del(&range->node); 307 list_del(&range->node);
314 mutex_unlock(&pctldev->gpio_ranges_lock); 308 mutex_unlock(&pinctrl_mutex);
315} 309}
310EXPORT_SYMBOL_GPL(pinctrl_remove_gpio_range);
316 311
317/** 312/**
318 * pinctrl_get_group_selector() - returns the group selector for a group 313 * pinctrl_get_group_selector() - returns the group selector for a group
@@ -345,6 +340,531 @@ int pinctrl_get_group_selector(struct pinctrl_dev *pctldev,
345 return -EINVAL; 340 return -EINVAL;
346} 341}
347 342
343/**
344 * pinctrl_request_gpio() - request a single pin to be used in as GPIO
345 * @gpio: the GPIO pin number from the GPIO subsystem number space
346 *
347 * This function should *ONLY* be used from gpiolib-based GPIO drivers,
348 * as part of their gpio_request() semantics, platforms and individual drivers
349 * shall *NOT* request GPIO pins to be muxed in.
350 */
351int pinctrl_request_gpio(unsigned gpio)
352{
353 struct pinctrl_dev *pctldev;
354 struct pinctrl_gpio_range *range;
355 int ret;
356 int pin;
357
358 mutex_lock(&pinctrl_mutex);
359
360 ret = pinctrl_get_device_gpio_range(gpio, &pctldev, &range);
361 if (ret) {
362 mutex_unlock(&pinctrl_mutex);
363 return -EINVAL;
364 }
365
366 /* Convert to the pin controllers number space */
367 pin = gpio - range->base + range->pin_base;
368
369 ret = pinmux_request_gpio(pctldev, range, pin, gpio);
370
371 mutex_unlock(&pinctrl_mutex);
372 return ret;
373}
374EXPORT_SYMBOL_GPL(pinctrl_request_gpio);
375
376/**
377 * pinctrl_free_gpio() - free control on a single pin, currently used as GPIO
378 * @gpio: the GPIO pin number from the GPIO subsystem number space
379 *
380 * This function should *ONLY* be used from gpiolib-based GPIO drivers,
381 * as part of their gpio_free() semantics, platforms and individual drivers
382 * shall *NOT* request GPIO pins to be muxed out.
383 */
384void pinctrl_free_gpio(unsigned gpio)
385{
386 struct pinctrl_dev *pctldev;
387 struct pinctrl_gpio_range *range;
388 int ret;
389 int pin;
390
391 mutex_lock(&pinctrl_mutex);
392
393 ret = pinctrl_get_device_gpio_range(gpio, &pctldev, &range);
394 if (ret) {
395 mutex_unlock(&pinctrl_mutex);
396 return;
397 }
398
399 /* Convert to the pin controllers number space */
400 pin = gpio - range->base + range->pin_base;
401
402 pinmux_free_gpio(pctldev, pin, range);
403
404 mutex_unlock(&pinctrl_mutex);
405}
406EXPORT_SYMBOL_GPL(pinctrl_free_gpio);
407
408static int pinctrl_gpio_direction(unsigned gpio, bool input)
409{
410 struct pinctrl_dev *pctldev;
411 struct pinctrl_gpio_range *range;
412 int ret;
413 int pin;
414
415 ret = pinctrl_get_device_gpio_range(gpio, &pctldev, &range);
416 if (ret)
417 return ret;
418
419 /* Convert to the pin controllers number space */
420 pin = gpio - range->base + range->pin_base;
421
422 return pinmux_gpio_direction(pctldev, range, pin, input);
423}
424
425/**
426 * pinctrl_gpio_direction_input() - request a GPIO pin to go into input mode
427 * @gpio: the GPIO pin number from the GPIO subsystem number space
428 *
429 * This function should *ONLY* be used from gpiolib-based GPIO drivers,
430 * as part of their gpio_direction_input() semantics, platforms and individual
431 * drivers shall *NOT* touch pin control GPIO calls.
432 */
433int pinctrl_gpio_direction_input(unsigned gpio)
434{
435 int ret;
436 mutex_lock(&pinctrl_mutex);
437 ret = pinctrl_gpio_direction(gpio, true);
438 mutex_unlock(&pinctrl_mutex);
439 return ret;
440}
441EXPORT_SYMBOL_GPL(pinctrl_gpio_direction_input);
442
443/**
444 * pinctrl_gpio_direction_output() - request a GPIO pin to go into output mode
445 * @gpio: the GPIO pin number from the GPIO subsystem number space
446 *
447 * This function should *ONLY* be used from gpiolib-based GPIO drivers,
448 * as part of their gpio_direction_output() semantics, platforms and individual
449 * drivers shall *NOT* touch pin control GPIO calls.
450 */
451int pinctrl_gpio_direction_output(unsigned gpio)
452{
453 int ret;
454 mutex_lock(&pinctrl_mutex);
455 ret = pinctrl_gpio_direction(gpio, false);
456 mutex_unlock(&pinctrl_mutex);
457 return ret;
458}
459EXPORT_SYMBOL_GPL(pinctrl_gpio_direction_output);
460
461static struct pinctrl_state *find_state(struct pinctrl *p,
462 const char *name)
463{
464 struct pinctrl_state *state;
465
466 list_for_each_entry(state, &p->states, node)
467 if (!strcmp(state->name, name))
468 return state;
469
470 return NULL;
471}
472
473static struct pinctrl_state *create_state(struct pinctrl *p,
474 const char *name)
475{
476 struct pinctrl_state *state;
477
478 state = kzalloc(sizeof(*state), GFP_KERNEL);
479 if (state == NULL) {
480 dev_err(p->dev,
481 "failed to alloc struct pinctrl_state\n");
482 return ERR_PTR(-ENOMEM);
483 }
484
485 state->name = name;
486 INIT_LIST_HEAD(&state->settings);
487
488 list_add_tail(&state->node, &p->states);
489
490 return state;
491}
492
493static int add_setting(struct pinctrl *p, struct pinctrl_map const *map)
494{
495 struct pinctrl_state *state;
496 struct pinctrl_setting *setting;
497 int ret;
498
499 state = find_state(p, map->name);
500 if (!state)
501 state = create_state(p, map->name);
502 if (IS_ERR(state))
503 return PTR_ERR(state);
504
505 if (map->type == PIN_MAP_TYPE_DUMMY_STATE)
506 return 0;
507
508 setting = kzalloc(sizeof(*setting), GFP_KERNEL);
509 if (setting == NULL) {
510 dev_err(p->dev,
511 "failed to alloc struct pinctrl_setting\n");
512 return -ENOMEM;
513 }
514
515 setting->type = map->type;
516
517 setting->pctldev = get_pinctrl_dev_from_devname(map->ctrl_dev_name);
518 if (setting->pctldev == NULL) {
519 dev_err(p->dev, "unknown pinctrl device %s in map entry",
520 map->ctrl_dev_name);
521 kfree(setting);
522 /* Eventually, this should trigger deferred probe */
523 return -ENODEV;
524 }
525
526 switch (map->type) {
527 case PIN_MAP_TYPE_MUX_GROUP:
528 ret = pinmux_map_to_setting(map, setting);
529 break;
530 case PIN_MAP_TYPE_CONFIGS_PIN:
531 case PIN_MAP_TYPE_CONFIGS_GROUP:
532 ret = pinconf_map_to_setting(map, setting);
533 break;
534 default:
535 ret = -EINVAL;
536 break;
537 }
538 if (ret < 0) {
539 kfree(setting);
540 return ret;
541 }
542
543 list_add_tail(&setting->node, &state->settings);
544
545 return 0;
546}
547
548static struct pinctrl *find_pinctrl(struct device *dev)
549{
550 struct pinctrl *p;
551
552 list_for_each_entry(p, &pinctrl_list, node)
553 if (p->dev == dev)
554 return p;
555
556 return NULL;
557}
558
559static void pinctrl_put_locked(struct pinctrl *p, bool inlist);
560
561static struct pinctrl *create_pinctrl(struct device *dev)
562{
563 struct pinctrl *p;
564 const char *devname;
565 struct pinctrl_maps *maps_node;
566 int i;
567 struct pinctrl_map const *map;
568 int ret;
569
570 /*
571 * create the state cookie holder struct pinctrl for each
572 * mapping, this is what consumers will get when requesting
573 * a pin control handle with pinctrl_get()
574 */
575 p = kzalloc(sizeof(*p), GFP_KERNEL);
576 if (p == NULL) {
577 dev_err(dev, "failed to alloc struct pinctrl\n");
578 return ERR_PTR(-ENOMEM);
579 }
580 p->dev = dev;
581 INIT_LIST_HEAD(&p->states);
582
583 devname = dev_name(dev);
584
585 /* Iterate over the pin control maps to locate the right ones */
586 for_each_maps(maps_node, i, map) {
587 /* Map must be for this device */
588 if (strcmp(map->dev_name, devname))
589 continue;
590
591 ret = add_setting(p, map);
592 if (ret < 0) {
593 pinctrl_put_locked(p, false);
594 return ERR_PTR(ret);
595 }
596 }
597
598 /* Add the pinmux to the global list */
599 list_add_tail(&p->node, &pinctrl_list);
600
601 return p;
602}
603
604static struct pinctrl *pinctrl_get_locked(struct device *dev)
605{
606 struct pinctrl *p;
607
608 if (WARN_ON(!dev))
609 return ERR_PTR(-EINVAL);
610
611 p = find_pinctrl(dev);
612 if (p != NULL)
613 return ERR_PTR(-EBUSY);
614
615 p = create_pinctrl(dev);
616 if (IS_ERR(p))
617 return p;
618
619 return p;
620}
621
622/**
623 * pinctrl_get() - retrieves the pinctrl handle for a device
624 * @dev: the device to obtain the handle for
625 */
626struct pinctrl *pinctrl_get(struct device *dev)
627{
628 struct pinctrl *p;
629
630 mutex_lock(&pinctrl_mutex);
631 p = pinctrl_get_locked(dev);
632 mutex_unlock(&pinctrl_mutex);
633
634 return p;
635}
636EXPORT_SYMBOL_GPL(pinctrl_get);
637
638static void pinctrl_put_locked(struct pinctrl *p, bool inlist)
639{
640 struct pinctrl_state *state, *n1;
641 struct pinctrl_setting *setting, *n2;
642
643 list_for_each_entry_safe(state, n1, &p->states, node) {
644 list_for_each_entry_safe(setting, n2, &state->settings, node) {
645 switch (setting->type) {
646 case PIN_MAP_TYPE_MUX_GROUP:
647 if (state == p->state)
648 pinmux_disable_setting(setting);
649 pinmux_free_setting(setting);
650 break;
651 case PIN_MAP_TYPE_CONFIGS_PIN:
652 case PIN_MAP_TYPE_CONFIGS_GROUP:
653 pinconf_free_setting(setting);
654 break;
655 default:
656 break;
657 }
658 list_del(&setting->node);
659 kfree(setting);
660 }
661 list_del(&state->node);
662 kfree(state);
663 }
664
665 if (inlist)
666 list_del(&p->node);
667 kfree(p);
668}
669
670/**
671 * pinctrl_put() - release a previously claimed pinctrl handle
672 * @p: the pinctrl handle to release
673 */
674void pinctrl_put(struct pinctrl *p)
675{
676 mutex_lock(&pinctrl_mutex);
677 pinctrl_put_locked(p, true);
678 mutex_unlock(&pinctrl_mutex);
679}
680EXPORT_SYMBOL_GPL(pinctrl_put);
681
682static struct pinctrl_state *pinctrl_lookup_state_locked(struct pinctrl *p,
683 const char *name)
684{
685 struct pinctrl_state *state;
686
687 state = find_state(p, name);
688 if (!state)
689 return ERR_PTR(-ENODEV);
690
691 return state;
692}
693
694/**
695 * pinctrl_lookup_state() - retrieves a state handle from a pinctrl handle
696 * @p: the pinctrl handle to retrieve the state from
697 * @name: the state name to retrieve
698 */
699struct pinctrl_state *pinctrl_lookup_state(struct pinctrl *p, const char *name)
700{
701 struct pinctrl_state *s;
702
703 mutex_lock(&pinctrl_mutex);
704 s = pinctrl_lookup_state_locked(p, name);
705 mutex_unlock(&pinctrl_mutex);
706
707 return s;
708}
709EXPORT_SYMBOL_GPL(pinctrl_lookup_state);
710
711static int pinctrl_select_state_locked(struct pinctrl *p,
712 struct pinctrl_state *state)
713{
714 struct pinctrl_setting *setting, *setting2;
715 int ret;
716
717 if (p->state == state)
718 return 0;
719
720 if (p->state) {
721 /*
722 * The set of groups with a mux configuration in the old state
723 * may not be identical to the set of groups with a mux setting
724 * in the new state. While this might be unusual, it's entirely
725 * possible for the "user"-supplied mapping table to be written
726 * that way. For each group that was configured in the old state
727 * but not in the new state, this code puts that group into a
728 * safe/disabled state.
729 */
730 list_for_each_entry(setting, &p->state->settings, node) {
731 bool found = false;
732 if (setting->type != PIN_MAP_TYPE_MUX_GROUP)
733 continue;
734 list_for_each_entry(setting2, &state->settings, node) {
735 if (setting2->type != PIN_MAP_TYPE_MUX_GROUP)
736 continue;
737 if (setting2->data.mux.group ==
738 setting->data.mux.group) {
739 found = true;
740 break;
741 }
742 }
743 if (!found)
744 pinmux_disable_setting(setting);
745 }
746 }
747
748 p->state = state;
749
750 /* Apply all the settings for the new state */
751 list_for_each_entry(setting, &state->settings, node) {
752 switch (setting->type) {
753 case PIN_MAP_TYPE_MUX_GROUP:
754 ret = pinmux_enable_setting(setting);
755 break;
756 case PIN_MAP_TYPE_CONFIGS_PIN:
757 case PIN_MAP_TYPE_CONFIGS_GROUP:
758 ret = pinconf_apply_setting(setting);
759 break;
760 default:
761 ret = -EINVAL;
762 break;
763 }
764 if (ret < 0) {
765 /* FIXME: Difficult to return to prev state */
766 return ret;
767 }
768 }
769
770 return 0;
771}
772
773/**
774 * pinctrl_select() - select/activate/program a pinctrl state to HW
775 * @p: the pinctrl handle for the device that requests configuratio
776 * @state: the state handle to select/activate/program
777 */
778int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *state)
779{
780 int ret;
781
782 mutex_lock(&pinctrl_mutex);
783 ret = pinctrl_select_state_locked(p, state);
784 mutex_unlock(&pinctrl_mutex);
785
786 return ret;
787}
788EXPORT_SYMBOL_GPL(pinctrl_select_state);
789
790/**
791 * pinctrl_register_mappings() - register a set of pin controller mappings
792 * @maps: the pincontrol mappings table to register. This should probably be
793 * marked with __initdata so it can be discarded after boot. This
794 * function will perform a shallow copy for the mapping entries.
795 * @num_maps: the number of maps in the mapping table
796 */
797int pinctrl_register_mappings(struct pinctrl_map const *maps,
798 unsigned num_maps)
799{
800 int i, ret;
801 struct pinctrl_maps *maps_node;
802
803 pr_debug("add %d pinmux maps\n", num_maps);
804
805 /* First sanity check the new mapping */
806 for (i = 0; i < num_maps; i++) {
807 if (!maps[i].dev_name) {
808 pr_err("failed to register map %s (%d): no device given\n",
809 maps[i].name, i);
810 return -EINVAL;
811 }
812
813 if (!maps[i].name) {
814 pr_err("failed to register map %d: no map name given\n",
815 i);
816 return -EINVAL;
817 }
818
819 if (maps[i].type != PIN_MAP_TYPE_DUMMY_STATE &&
820 !maps[i].ctrl_dev_name) {
821 pr_err("failed to register map %s (%d): no pin control device given\n",
822 maps[i].name, i);
823 return -EINVAL;
824 }
825
826 switch (maps[i].type) {
827 case PIN_MAP_TYPE_DUMMY_STATE:
828 break;
829 case PIN_MAP_TYPE_MUX_GROUP:
830 ret = pinmux_validate_map(&maps[i], i);
831 if (ret < 0)
832 return 0;
833 break;
834 case PIN_MAP_TYPE_CONFIGS_PIN:
835 case PIN_MAP_TYPE_CONFIGS_GROUP:
836 ret = pinconf_validate_map(&maps[i], i);
837 if (ret < 0)
838 return 0;
839 break;
840 default:
841 pr_err("failed to register map %s (%d): invalid type given\n",
842 maps[i].name, i);
843 return -EINVAL;
844 }
845 }
846
847 maps_node = kzalloc(sizeof(*maps_node), GFP_KERNEL);
848 if (!maps_node) {
849 pr_err("failed to alloc struct pinctrl_maps\n");
850 return -ENOMEM;
851 }
852
853 maps_node->num_maps = num_maps;
854 maps_node->maps = kmemdup(maps, sizeof(*maps) * num_maps, GFP_KERNEL);
855 if (!maps_node->maps) {
856 pr_err("failed to duplicate mapping table\n");
857 kfree(maps_node);
858 return -ENOMEM;
859 }
860
861 mutex_lock(&pinctrl_mutex);
862 list_add_tail(&maps_node->node, &pinctrl_maps);
863 mutex_unlock(&pinctrl_mutex);
864
865 return 0;
866}
867
348#ifdef CONFIG_DEBUG_FS 868#ifdef CONFIG_DEBUG_FS
349 869
350static int pinctrl_pins_show(struct seq_file *s, void *what) 870static int pinctrl_pins_show(struct seq_file *s, void *what)
@@ -355,6 +875,8 @@ static int pinctrl_pins_show(struct seq_file *s, void *what)
355 875
356 seq_printf(s, "registered pins: %d\n", pctldev->desc->npins); 876 seq_printf(s, "registered pins: %d\n", pctldev->desc->npins);
357 877
878 mutex_lock(&pinctrl_mutex);
879
358 /* The pin number can be retrived from the pin controller descriptor */ 880 /* The pin number can be retrived from the pin controller descriptor */
359 for (i = 0; i < pctldev->desc->npins; i++) { 881 for (i = 0; i < pctldev->desc->npins; i++) {
360 struct pin_desc *desc; 882 struct pin_desc *desc;
@@ -375,6 +897,8 @@ static int pinctrl_pins_show(struct seq_file *s, void *what)
375 seq_puts(s, "\n"); 897 seq_puts(s, "\n");
376 } 898 }
377 899
900 mutex_unlock(&pinctrl_mutex);
901
378 return 0; 902 return 0;
379} 903}
380 904
@@ -388,6 +912,8 @@ static int pinctrl_groups_show(struct seq_file *s, void *what)
388 if (!ops) 912 if (!ops)
389 return 0; 913 return 0;
390 914
915 mutex_lock(&pinctrl_mutex);
916
391 seq_puts(s, "registered pin groups:\n"); 917 seq_puts(s, "registered pin groups:\n");
392 while (ops->list_groups(pctldev, selector) >= 0) { 918 while (ops->list_groups(pctldev, selector) >= 0) {
393 const unsigned *pins; 919 const unsigned *pins;
@@ -410,6 +936,7 @@ static int pinctrl_groups_show(struct seq_file *s, void *what)
410 selector++; 936 selector++;
411 } 937 }
412 938
939 mutex_unlock(&pinctrl_mutex);
413 940
414 return 0; 941 return 0;
415} 942}
@@ -421,8 +948,9 @@ static int pinctrl_gpioranges_show(struct seq_file *s, void *what)
421 948
422 seq_puts(s, "GPIO ranges handled:\n"); 949 seq_puts(s, "GPIO ranges handled:\n");
423 950
951 mutex_lock(&pinctrl_mutex);
952
424 /* Loop over the ranges */ 953 /* Loop over the ranges */
425 mutex_lock(&pctldev->gpio_ranges_lock);
426 list_for_each_entry(range, &pctldev->gpio_ranges, node) { 954 list_for_each_entry(range, &pctldev->gpio_ranges, node) {
427 seq_printf(s, "%u: %s GPIOS [%u - %u] PINS [%u - %u]\n", 955 seq_printf(s, "%u: %s GPIOS [%u - %u] PINS [%u - %u]\n",
428 range->id, range->name, 956 range->id, range->name,
@@ -430,7 +958,8 @@ static int pinctrl_gpioranges_show(struct seq_file *s, void *what)
430 range->pin_base, 958 range->pin_base,
431 (range->pin_base + range->npins - 1)); 959 (range->pin_base + range->npins - 1));
432 } 960 }
433 mutex_unlock(&pctldev->gpio_ranges_lock); 961
962 mutex_unlock(&pinctrl_mutex);
434 963
435 return 0; 964 return 0;
436} 965}
@@ -440,7 +969,9 @@ static int pinctrl_devices_show(struct seq_file *s, void *what)
440 struct pinctrl_dev *pctldev; 969 struct pinctrl_dev *pctldev;
441 970
442 seq_puts(s, "name [pinmux] [pinconf]\n"); 971 seq_puts(s, "name [pinmux] [pinconf]\n");
443 mutex_lock(&pinctrldev_list_mutex); 972
973 mutex_lock(&pinctrl_mutex);
974
444 list_for_each_entry(pctldev, &pinctrldev_list, node) { 975 list_for_each_entry(pctldev, &pinctrldev_list, node) {
445 seq_printf(s, "%s ", pctldev->desc->name); 976 seq_printf(s, "%s ", pctldev->desc->name);
446 if (pctldev->desc->pmxops) 977 if (pctldev->desc->pmxops)
@@ -453,7 +984,108 @@ static int pinctrl_devices_show(struct seq_file *s, void *what)
453 seq_puts(s, "no"); 984 seq_puts(s, "no");
454 seq_puts(s, "\n"); 985 seq_puts(s, "\n");
455 } 986 }
456 mutex_unlock(&pinctrldev_list_mutex); 987
988 mutex_unlock(&pinctrl_mutex);
989
990 return 0;
991}
992
993static inline const char *map_type(enum pinctrl_map_type type)
994{
995 static const char * const names[] = {
996 "INVALID",
997 "DUMMY_STATE",
998 "MUX_GROUP",
999 "CONFIGS_PIN",
1000 "CONFIGS_GROUP",
1001 };
1002
1003 if (type >= ARRAY_SIZE(names))
1004 return "UNKNOWN";
1005
1006 return names[type];
1007}
1008
1009static int pinctrl_maps_show(struct seq_file *s, void *what)
1010{
1011 struct pinctrl_maps *maps_node;
1012 int i;
1013 struct pinctrl_map const *map;
1014
1015 seq_puts(s, "Pinctrl maps:\n");
1016
1017 mutex_lock(&pinctrl_mutex);
1018
1019 for_each_maps(maps_node, i, map) {
1020 seq_printf(s, "device %s\nstate %s\ntype %s (%d)\n",
1021 map->dev_name, map->name, map_type(map->type),
1022 map->type);
1023
1024 if (map->type != PIN_MAP_TYPE_DUMMY_STATE)
1025 seq_printf(s, "controlling device %s\n",
1026 map->ctrl_dev_name);
1027
1028 switch (map->type) {
1029 case PIN_MAP_TYPE_MUX_GROUP:
1030 pinmux_show_map(s, map);
1031 break;
1032 case PIN_MAP_TYPE_CONFIGS_PIN:
1033 case PIN_MAP_TYPE_CONFIGS_GROUP:
1034 pinconf_show_map(s, map);
1035 break;
1036 default:
1037 break;
1038 }
1039
1040 seq_printf(s, "\n");
1041 }
1042
1043 mutex_unlock(&pinctrl_mutex);
1044
1045 return 0;
1046}
1047
1048static int pinctrl_show(struct seq_file *s, void *what)
1049{
1050 struct pinctrl *p;
1051 struct pinctrl_state *state;
1052 struct pinctrl_setting *setting;
1053
1054 seq_puts(s, "Requested pin control handlers their pinmux maps:\n");
1055
1056 mutex_lock(&pinctrl_mutex);
1057
1058 list_for_each_entry(p, &pinctrl_list, node) {
1059 seq_printf(s, "device: %s current state: %s\n",
1060 dev_name(p->dev),
1061 p->state ? p->state->name : "none");
1062
1063 list_for_each_entry(state, &p->states, node) {
1064 seq_printf(s, " state: %s\n", state->name);
1065
1066 list_for_each_entry(setting, &state->settings, node) {
1067 struct pinctrl_dev *pctldev = setting->pctldev;
1068
1069 seq_printf(s, " type: %s controller %s ",
1070 map_type(setting->type),
1071 pinctrl_dev_get_name(pctldev));
1072
1073 switch (setting->type) {
1074 case PIN_MAP_TYPE_MUX_GROUP:
1075 pinmux_show_setting(s, setting);
1076 break;
1077 case PIN_MAP_TYPE_CONFIGS_PIN:
1078 case PIN_MAP_TYPE_CONFIGS_GROUP:
1079 pinconf_show_setting(s, setting);
1080 break;
1081 default:
1082 break;
1083 }
1084 }
1085 }
1086 }
1087
1088 mutex_unlock(&pinctrl_mutex);
457 1089
458 return 0; 1090 return 0;
459} 1091}
@@ -478,6 +1110,16 @@ static int pinctrl_devices_open(struct inode *inode, struct file *file)
478 return single_open(file, pinctrl_devices_show, NULL); 1110 return single_open(file, pinctrl_devices_show, NULL);
479} 1111}
480 1112
1113static int pinctrl_maps_open(struct inode *inode, struct file *file)
1114{
1115 return single_open(file, pinctrl_maps_show, NULL);
1116}
1117
1118static int pinctrl_open(struct inode *inode, struct file *file)
1119{
1120 return single_open(file, pinctrl_show, NULL);
1121}
1122
481static const struct file_operations pinctrl_pins_ops = { 1123static const struct file_operations pinctrl_pins_ops = {
482 .open = pinctrl_pins_open, 1124 .open = pinctrl_pins_open,
483 .read = seq_read, 1125 .read = seq_read,
@@ -506,6 +1148,20 @@ static const struct file_operations pinctrl_devices_ops = {
506 .release = single_release, 1148 .release = single_release,
507}; 1149};
508 1150
1151static const struct file_operations pinctrl_maps_ops = {
1152 .open = pinctrl_maps_open,
1153 .read = seq_read,
1154 .llseek = seq_lseek,
1155 .release = single_release,
1156};
1157
1158static const struct file_operations pinctrl_ops = {
1159 .open = pinctrl_open,
1160 .read = seq_read,
1161 .llseek = seq_lseek,
1162 .release = single_release,
1163};
1164
509static struct dentry *debugfs_root; 1165static struct dentry *debugfs_root;
510 1166
511static void pinctrl_init_device_debugfs(struct pinctrl_dev *pctldev) 1167static void pinctrl_init_device_debugfs(struct pinctrl_dev *pctldev)
@@ -547,7 +1203,10 @@ static void pinctrl_init_debugfs(void)
547 1203
548 debugfs_create_file("pinctrl-devices", S_IFREG | S_IRUGO, 1204 debugfs_create_file("pinctrl-devices", S_IFREG | S_IRUGO,
549 debugfs_root, NULL, &pinctrl_devices_ops); 1205 debugfs_root, NULL, &pinctrl_devices_ops);
550 pinmux_init_debugfs(debugfs_root); 1206 debugfs_create_file("pinctrl-maps", S_IFREG | S_IRUGO,
1207 debugfs_root, NULL, &pinctrl_maps_ops);
1208 debugfs_create_file("pinctrl-handles", S_IFREG | S_IRUGO,
1209 debugfs_root, NULL, &pinctrl_ops);
551} 1210}
552 1211
553#else /* CONFIG_DEBUG_FS */ 1212#else /* CONFIG_DEBUG_FS */
@@ -583,18 +1242,18 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,
583 if (pctldesc->name == NULL) 1242 if (pctldesc->name == NULL)
584 return NULL; 1243 return NULL;
585 1244
586 pctldev = kzalloc(sizeof(struct pinctrl_dev), GFP_KERNEL); 1245 pctldev = kzalloc(sizeof(*pctldev), GFP_KERNEL);
587 if (pctldev == NULL) 1246 if (pctldev == NULL) {
1247 dev_err(dev, "failed to alloc struct pinctrl_dev\n");
588 return NULL; 1248 return NULL;
1249 }
589 1250
590 /* Initialize pin control device struct */ 1251 /* Initialize pin control device struct */
591 pctldev->owner = pctldesc->owner; 1252 pctldev->owner = pctldesc->owner;
592 pctldev->desc = pctldesc; 1253 pctldev->desc = pctldesc;
593 pctldev->driver_data = driver_data; 1254 pctldev->driver_data = driver_data;
594 INIT_RADIX_TREE(&pctldev->pin_desc_tree, GFP_KERNEL); 1255 INIT_RADIX_TREE(&pctldev->pin_desc_tree, GFP_KERNEL);
595 spin_lock_init(&pctldev->pin_desc_tree_lock);
596 INIT_LIST_HEAD(&pctldev->gpio_ranges); 1256 INIT_LIST_HEAD(&pctldev->gpio_ranges);
597 mutex_init(&pctldev->gpio_ranges_lock);
598 pctldev->dev = dev; 1257 pctldev->dev = dev;
599 1258
600 /* If we're implementing pinmuxing, check the ops for sanity */ 1259 /* If we're implementing pinmuxing, check the ops for sanity */
@@ -628,11 +1287,23 @@ struct pinctrl_dev *pinctrl_register(struct pinctrl_desc *pctldesc,
628 goto out_err; 1287 goto out_err;
629 } 1288 }
630 1289
1290 mutex_lock(&pinctrl_mutex);
1291
1292 list_add_tail(&pctldev->node, &pinctrldev_list);
1293
1294 pctldev->p = pinctrl_get_locked(pctldev->dev);
1295 if (!IS_ERR(pctldev->p)) {
1296 struct pinctrl_state *s =
1297 pinctrl_lookup_state_locked(pctldev->p,
1298 PINCTRL_STATE_DEFAULT);
1299 if (!IS_ERR(s))
1300 pinctrl_select_state_locked(pctldev->p, s);
1301 }
1302
1303 mutex_unlock(&pinctrl_mutex);
1304
631 pinctrl_init_device_debugfs(pctldev); 1305 pinctrl_init_device_debugfs(pctldev);
632 mutex_lock(&pinctrldev_list_mutex); 1306
633 list_add(&pctldev->node, &pinctrldev_list);
634 mutex_unlock(&pinctrldev_list_mutex);
635 pinmux_hog_maps(pctldev);
636 return pctldev; 1307 return pctldev;
637 1308
638out_err: 1309out_err:
@@ -653,15 +1324,20 @@ void pinctrl_unregister(struct pinctrl_dev *pctldev)
653 return; 1324 return;
654 1325
655 pinctrl_remove_device_debugfs(pctldev); 1326 pinctrl_remove_device_debugfs(pctldev);
656 pinmux_unhog_maps(pctldev); 1327
1328 mutex_lock(&pinctrl_mutex);
1329
1330 if (!IS_ERR(pctldev->p))
1331 pinctrl_put_locked(pctldev->p, true);
1332
657 /* TODO: check that no pinmuxes are still active? */ 1333 /* TODO: check that no pinmuxes are still active? */
658 mutex_lock(&pinctrldev_list_mutex);
659 list_del(&pctldev->node); 1334 list_del(&pctldev->node);
660 mutex_unlock(&pinctrldev_list_mutex);
661 /* Destroy descriptor tree */ 1335 /* Destroy descriptor tree */
662 pinctrl_free_pindescs(pctldev, pctldev->desc->pins, 1336 pinctrl_free_pindescs(pctldev, pctldev->desc->pins,
663 pctldev->desc->npins); 1337 pctldev->desc->npins);
664 kfree(pctldev); 1338 kfree(pctldev);
1339
1340 mutex_unlock(&pinctrl_mutex);
665} 1341}
666EXPORT_SYMBOL_GPL(pinctrl_unregister); 1342EXPORT_SYMBOL_GPL(pinctrl_unregister);
667 1343
diff --git a/drivers/pinctrl/core.h b/drivers/pinctrl/core.h
index cfa86da6b4b1..17ecf651b123 100644
--- a/drivers/pinctrl/core.h
+++ b/drivers/pinctrl/core.h
@@ -9,7 +9,10 @@
9 * License terms: GNU General Public License (GPL) version 2 9 * License terms: GNU General Public License (GPL) version 2
10 */ 10 */
11 11
12#include <linux/mutex.h>
13#include <linux/radix-tree.h>
12#include <linux/pinctrl/pinconf.h> 14#include <linux/pinctrl/pinconf.h>
15#include <linux/pinctrl/machine.h>
13 16
14struct pinctrl_gpio_range; 17struct pinctrl_gpio_range;
15 18
@@ -20,34 +23,94 @@ struct pinctrl_gpio_range;
20 * controller 23 * controller
21 * @pin_desc_tree: each pin descriptor for this pin controller is stored in 24 * @pin_desc_tree: each pin descriptor for this pin controller is stored in
22 * this radix tree 25 * this radix tree
23 * @pin_desc_tree_lock: lock for the descriptor tree
24 * @gpio_ranges: a list of GPIO ranges that is handled by this pin controller, 26 * @gpio_ranges: a list of GPIO ranges that is handled by this pin controller,
25 * ranges are added to this list at runtime 27 * ranges are added to this list at runtime
26 * @gpio_ranges_lock: lock for the GPIO ranges list
27 * @dev: the device entry for this pin controller 28 * @dev: the device entry for this pin controller
28 * @owner: module providing the pin controller, used for refcounting 29 * @owner: module providing the pin controller, used for refcounting
29 * @driver_data: driver data for drivers registering to the pin controller 30 * @driver_data: driver data for drivers registering to the pin controller
30 * subsystem 31 * subsystem
31 * @pinmux_hogs_lock: lock for the pinmux hog list 32 * @p: result of pinctrl_get() for this device
32 * @pinmux_hogs: list of pinmux maps hogged by this device 33 * @device_root: debugfs root for this device
33 */ 34 */
34struct pinctrl_dev { 35struct pinctrl_dev {
35 struct list_head node; 36 struct list_head node;
36 struct pinctrl_desc *desc; 37 struct pinctrl_desc *desc;
37 struct radix_tree_root pin_desc_tree; 38 struct radix_tree_root pin_desc_tree;
38 spinlock_t pin_desc_tree_lock;
39 struct list_head gpio_ranges; 39 struct list_head gpio_ranges;
40 struct mutex gpio_ranges_lock;
41 struct device *dev; 40 struct device *dev;
42 struct module *owner; 41 struct module *owner;
43 void *driver_data; 42 void *driver_data;
43 struct pinctrl *p;
44#ifdef CONFIG_DEBUG_FS 44#ifdef CONFIG_DEBUG_FS
45 struct dentry *device_root; 45 struct dentry *device_root;
46#endif 46#endif
47#ifdef CONFIG_PINMUX 47};
48 struct mutex pinmux_hogs_lock; 48
49 struct list_head pinmux_hogs; 49/**
50#endif 50 * struct pinctrl - per-device pin control state holder
51 * @node: global list node
52 * @dev: the device using this pin control handle
53 * @states: a list of states for this device
54 * @state: the current state
55 */
56struct pinctrl {
57 struct list_head node;
58 struct device *dev;
59 struct list_head states;
60 struct pinctrl_state *state;
61};
62
63/**
64 * struct pinctrl_state - a pinctrl state for a device
65 * @node: list not for struct pinctrl's @states field
66 * @name: the name of this state
67 * @settings: a list of settings for this state
68 */
69struct pinctrl_state {
70 struct list_head node;
71 const char *name;
72 struct list_head settings;
73};
74
75/**
76 * struct pinctrl_setting_mux - setting data for MAP_TYPE_MUX_GROUP
77 * @group: the group selector to program
78 * @func: the function selector to program
79 */
80struct pinctrl_setting_mux {
81 unsigned group;
82 unsigned func;
83};
84
85/**
86 * struct pinctrl_setting_configs - setting data for MAP_TYPE_CONFIGS_*
87 * @group_or_pin: the group selector or pin ID to program
88 * @configs: a pointer to an array of config parameters/values to program into
89 * hardware. Each individual pin controller defines the format and meaning
90 * of config parameters.
91 * @num_configs: the number of entries in array @configs
92 */
93struct pinctrl_setting_configs {
94 unsigned group_or_pin;
95 unsigned long *configs;
96 unsigned num_configs;
97};
98
99/**
100 * struct pinctrl_setting - an individual mux or config setting
101 * @node: list node for struct pinctrl_settings's @settings field
102 * @type: the type of setting
103 * @pctldev: pin control device handling to be programmed
104 * @data: Data specific to the setting type
105 */
106struct pinctrl_setting {
107 struct list_head node;
108 enum pinctrl_map_type type;
109 struct pinctrl_dev *pctldev;
110 union {
111 struct pinctrl_setting_mux mux;
112 struct pinctrl_setting_configs configs;
113 } data;
51}; 114};
52 115
53/** 116/**
@@ -56,28 +119,38 @@ struct pinctrl_dev {
56 * @name: a name for the pin, e.g. the name of the pin/pad/finger on a 119 * @name: a name for the pin, e.g. the name of the pin/pad/finger on a
57 * datasheet or such 120 * datasheet or such
58 * @dynamic_name: if the name of this pin was dynamically allocated 121 * @dynamic_name: if the name of this pin was dynamically allocated
59 * @lock: a lock to protect the descriptor structure 122 * @mux_usecount: If zero, the pin is not claimed, and @owner should be NULL.
60 * @mux_requested: whether the pin is already requested by pinmux or not 123 * If non-zero, this pin is claimed by @owner. This field is an integer
61 * @mux_function: a named muxing function for the pin that will be passed to 124 * rather than a boolean, since pinctrl_get() might process multiple
62 * subdrivers and shown in debugfs etc 125 * mapping table entries that refer to, and hence claim, the same group
126 * or pin, and each of these will increment the @usecount.
127 * @mux_owner: The name of device that called pinctrl_get().
128 * @mux_setting: The most recent selected mux setting for this pin, if any.
129 * @gpio_owner: If pinctrl_request_gpio() was called for this pin, this is
130 * the name of the GPIO that "owns" this pin.
63 */ 131 */
64struct pin_desc { 132struct pin_desc {
65 struct pinctrl_dev *pctldev; 133 struct pinctrl_dev *pctldev;
66 const char *name; 134 const char *name;
67 bool dynamic_name; 135 bool dynamic_name;
68 spinlock_t lock;
69 /* These fields only added when supporting pinmux drivers */ 136 /* These fields only added when supporting pinmux drivers */
70#ifdef CONFIG_PINMUX 137#ifdef CONFIG_PINMUX
71 const char *mux_function; 138 unsigned mux_usecount;
139 const char *mux_owner;
140 const struct pinctrl_setting_mux *mux_setting;
141 const char *gpio_owner;
72#endif 142#endif
73}; 143};
74 144
75struct pinctrl_dev *get_pinctrl_dev_from_dev(struct device *dev, 145struct pinctrl_dev *get_pinctrl_dev_from_devname(const char *dev_name);
76 const char *dev_name);
77struct pin_desc *pin_desc_get(struct pinctrl_dev *pctldev, unsigned int pin);
78int pin_get_from_name(struct pinctrl_dev *pctldev, const char *name); 146int pin_get_from_name(struct pinctrl_dev *pctldev, const char *name);
79int pinctrl_get_device_gpio_range(unsigned gpio,
80 struct pinctrl_dev **outdev,
81 struct pinctrl_gpio_range **outrange);
82int pinctrl_get_group_selector(struct pinctrl_dev *pctldev, 147int pinctrl_get_group_selector(struct pinctrl_dev *pctldev,
83 const char *pin_group); 148 const char *pin_group);
149
150static inline struct pin_desc *pin_desc_get(struct pinctrl_dev *pctldev,
151 unsigned int pin)
152{
153 return radix_tree_lookup(&pctldev->pin_desc_tree, pin);
154}
155
156extern struct mutex pinctrl_mutex;
diff --git a/drivers/pinctrl/pinconf-generic.c b/drivers/pinctrl/pinconf-generic.c
new file mode 100644
index 000000000000..33fbaeaa65dd
--- /dev/null
+++ b/drivers/pinctrl/pinconf-generic.c
@@ -0,0 +1,120 @@
1/*
2 * Core driver for the generic pin config portions of the pin control subsystem
3 *
4 * Copyright (C) 2011 ST-Ericsson SA
5 * Written on behalf of Linaro for ST-Ericsson
6 *
7 * Author: Linus Walleij <linus.walleij@linaro.org>
8 *
9 * License terms: GNU General Public License (GPL) version 2
10 */
11
12#define pr_fmt(fmt) "generic pinconfig core: " fmt
13
14#include <linux/kernel.h>
15#include <linux/init.h>
16#include <linux/device.h>
17#include <linux/slab.h>
18#include <linux/debugfs.h>
19#include <linux/seq_file.h>
20#include <linux/pinctrl/pinctrl.h>
21#include <linux/pinctrl/pinconf.h>
22#include <linux/pinctrl/pinconf-generic.h>
23#include "core.h"
24#include "pinconf.h"
25
26#ifdef CONFIG_DEBUG_FS
27
28struct pin_config_item {
29 const enum pin_config_param param;
30 const char * const display;
31 const char * const format;
32};
33
34#define PCONFDUMP(a, b, c) { .param = a, .display = b, .format = c }
35
36struct pin_config_item conf_items[] = {
37 PCONFDUMP(PIN_CONFIG_BIAS_DISABLE, "input bias disabled", NULL),
38 PCONFDUMP(PIN_CONFIG_BIAS_HIGH_IMPEDANCE, "input bias high impedance", NULL),
39 PCONFDUMP(PIN_CONFIG_BIAS_PULL_UP, "input bias pull up", NULL),
40 PCONFDUMP(PIN_CONFIG_BIAS_PULL_DOWN, "input bias pull down", NULL),
41 PCONFDUMP(PIN_CONFIG_DRIVE_PUSH_PULL, "output drive push pull", NULL),
42 PCONFDUMP(PIN_CONFIG_DRIVE_OPEN_DRAIN, "output drive open drain", NULL),
43 PCONFDUMP(PIN_CONFIG_DRIVE_OPEN_SOURCE, "output drive open source", NULL),
44 PCONFDUMP(PIN_CONFIG_INPUT_SCHMITT, "input schmitt trigger", NULL),
45 PCONFDUMP(PIN_CONFIG_INPUT_DEBOUNCE, "input debounce", "time units"),
46 PCONFDUMP(PIN_CONFIG_POWER_SOURCE, "pin power source", "selector"),
47 PCONFDUMP(PIN_CONFIG_LOW_POWER_MODE, "pin low power", "mode"),
48};
49
50void pinconf_generic_dump_pin(struct pinctrl_dev *pctldev,
51 struct seq_file *s, unsigned pin)
52{
53 const struct pinconf_ops *ops = pctldev->desc->confops;
54 int i;
55
56 if (!ops->is_generic)
57 return;
58
59 for(i = 0; i < ARRAY_SIZE(conf_items); i++) {
60 unsigned long config;
61 int ret;
62
63 /* We want to check out this parameter */
64 config = pinconf_to_config_packed(conf_items[i].param, 0);
65 ret = pin_config_get_for_pin(pctldev, pin, &config);
66 /* These are legal errors */
67 if (ret == -EINVAL || ret == -ENOTSUPP)
68 continue;
69 if (ret) {
70 seq_printf(s, "ERROR READING CONFIG SETTING %d ", i);
71 continue;
72 }
73 /* Space between multiple configs */
74 seq_puts(s, " ");
75 seq_puts(s, conf_items[i].display);
76 /* Print unit if available */
77 if (conf_items[i].format &&
78 pinconf_to_config_argument(config) != 0)
79 seq_printf(s, " (%u %s)",
80 pinconf_to_config_argument(config),
81 conf_items[i].format);
82 }
83}
84
85void pinconf_generic_dump_group(struct pinctrl_dev *pctldev,
86 struct seq_file *s, const char *gname)
87{
88 const struct pinconf_ops *ops = pctldev->desc->confops;
89 int i;
90
91 if (!ops->is_generic)
92 return;
93
94 for(i = 0; i < ARRAY_SIZE(conf_items); i++) {
95 unsigned long config;
96 int ret;
97
98 /* We want to check out this parameter */
99 config = pinconf_to_config_packed(conf_items[i].param, 0);
100 ret = pin_config_group_get(dev_name(pctldev->dev), gname,
101 &config);
102 /* These are legal errors */
103 if (ret == -EINVAL || ret == -ENOTSUPP)
104 continue;
105 if (ret) {
106 seq_printf(s, "ERROR READING CONFIG SETTING %d ", i);
107 continue;
108 }
109 /* Space between multiple configs */
110 seq_puts(s, " ");
111 seq_puts(s, conf_items[i].display);
112 /* Print unit if available */
113 if (conf_items[i].format && config != 0)
114 seq_printf(s, " (%u %s)",
115 pinconf_to_config_argument(config),
116 conf_items[i].format);
117 }
118}
119
120#endif
diff --git a/drivers/pinctrl/pinconf.c b/drivers/pinctrl/pinconf.c
index 9fb75456824c..7321e8601294 100644
--- a/drivers/pinctrl/pinconf.c
+++ b/drivers/pinctrl/pinconf.c
@@ -23,6 +23,37 @@
23#include "core.h" 23#include "core.h"
24#include "pinconf.h" 24#include "pinconf.h"
25 25
26int pinconf_check_ops(struct pinctrl_dev *pctldev)
27{
28 const struct pinconf_ops *ops = pctldev->desc->confops;
29
30 /* We must be able to read out pin status */
31 if (!ops->pin_config_get && !ops->pin_config_group_get)
32 return -EINVAL;
33 /* We have to be able to config the pins in SOME way */
34 if (!ops->pin_config_set && !ops->pin_config_group_set)
35 return -EINVAL;
36 return 0;
37}
38
39int pinconf_validate_map(struct pinctrl_map const *map, int i)
40{
41 if (!map->data.configs.group_or_pin) {
42 pr_err("failed to register map %s (%d): no group/pin given\n",
43 map->name, i);
44 return -EINVAL;
45 }
46
47 if (map->data.configs.num_configs &&
48 !map->data.configs.configs) {
49 pr_err("failed to register map %s (%d): no configs ptr given\n",
50 map->name, i);
51 return -EINVAL;
52 }
53
54 return 0;
55}
56
26int pin_config_get_for_pin(struct pinctrl_dev *pctldev, unsigned pin, 57int pin_config_get_for_pin(struct pinctrl_dev *pctldev, unsigned pin,
27 unsigned long *config) 58 unsigned long *config)
28{ 59{
@@ -51,19 +82,27 @@ int pin_config_get(const char *dev_name, const char *name,
51 struct pinctrl_dev *pctldev; 82 struct pinctrl_dev *pctldev;
52 int pin; 83 int pin;
53 84
54 pctldev = get_pinctrl_dev_from_dev(NULL, dev_name); 85 mutex_lock(&pinctrl_mutex);
55 if (!pctldev) 86
56 return -EINVAL; 87 pctldev = get_pinctrl_dev_from_devname(dev_name);
88 if (!pctldev) {
89 pin = -EINVAL;
90 goto unlock;
91 }
57 92
58 pin = pin_get_from_name(pctldev, name); 93 pin = pin_get_from_name(pctldev, name);
59 if (pin < 0) 94 if (pin < 0)
60 return pin; 95 goto unlock;
96
97 pin = pin_config_get_for_pin(pctldev, pin, config);
61 98
62 return pin_config_get_for_pin(pctldev, pin, config); 99unlock:
100 mutex_unlock(&pinctrl_mutex);
101 return pin;
63} 102}
64EXPORT_SYMBOL(pin_config_get); 103EXPORT_SYMBOL(pin_config_get);
65 104
66int pin_config_set_for_pin(struct pinctrl_dev *pctldev, unsigned pin, 105static int pin_config_set_for_pin(struct pinctrl_dev *pctldev, unsigned pin,
67 unsigned long config) 106 unsigned long config)
68{ 107{
69 const struct pinconf_ops *ops = pctldev->desc->confops; 108 const struct pinconf_ops *ops = pctldev->desc->confops;
@@ -97,17 +136,27 @@ int pin_config_set(const char *dev_name, const char *name,
97 unsigned long config) 136 unsigned long config)
98{ 137{
99 struct pinctrl_dev *pctldev; 138 struct pinctrl_dev *pctldev;
100 int pin; 139 int pin, ret;
101 140
102 pctldev = get_pinctrl_dev_from_dev(NULL, dev_name); 141 mutex_lock(&pinctrl_mutex);
103 if (!pctldev) 142
104 return -EINVAL; 143 pctldev = get_pinctrl_dev_from_devname(dev_name);
144 if (!pctldev) {
145 ret = -EINVAL;
146 goto unlock;
147 }
105 148
106 pin = pin_get_from_name(pctldev, name); 149 pin = pin_get_from_name(pctldev, name);
107 if (pin < 0) 150 if (pin < 0) {
108 return pin; 151 ret = pin;
152 goto unlock;
153 }
154
155 ret = pin_config_set_for_pin(pctldev, pin, config);
109 156
110 return pin_config_set_for_pin(pctldev, pin, config); 157unlock:
158 mutex_unlock(&pinctrl_mutex);
159 return ret;
111} 160}
112EXPORT_SYMBOL(pin_config_set); 161EXPORT_SYMBOL(pin_config_set);
113 162
@@ -116,29 +165,39 @@ int pin_config_group_get(const char *dev_name, const char *pin_group,
116{ 165{
117 struct pinctrl_dev *pctldev; 166 struct pinctrl_dev *pctldev;
118 const struct pinconf_ops *ops; 167 const struct pinconf_ops *ops;
119 int selector; 168 int selector, ret;
120 169
121 pctldev = get_pinctrl_dev_from_dev(NULL, dev_name); 170 mutex_lock(&pinctrl_mutex);
122 if (!pctldev) 171
123 return -EINVAL; 172 pctldev = get_pinctrl_dev_from_devname(dev_name);
173 if (!pctldev) {
174 ret = -EINVAL;
175 goto unlock;
176 }
124 ops = pctldev->desc->confops; 177 ops = pctldev->desc->confops;
125 178
126 if (!ops || !ops->pin_config_group_get) { 179 if (!ops || !ops->pin_config_group_get) {
127 dev_err(pctldev->dev, "cannot get configuration for pin " 180 dev_err(pctldev->dev, "cannot get configuration for pin "
128 "group, missing group config get function in " 181 "group, missing group config get function in "
129 "driver\n"); 182 "driver\n");
130 return -EINVAL; 183 ret = -EINVAL;
184 goto unlock;
131 } 185 }
132 186
133 selector = pinctrl_get_group_selector(pctldev, pin_group); 187 selector = pinctrl_get_group_selector(pctldev, pin_group);
134 if (selector < 0) 188 if (selector < 0) {
135 return selector; 189 ret = selector;
190 goto unlock;
191 }
192
193 ret = ops->pin_config_group_get(pctldev, selector, config);
136 194
137 return ops->pin_config_group_get(pctldev, selector, config); 195unlock:
196 mutex_unlock(&pinctrl_mutex);
197 return ret;
138} 198}
139EXPORT_SYMBOL(pin_config_group_get); 199EXPORT_SYMBOL(pin_config_group_get);
140 200
141
142int pin_config_group_set(const char *dev_name, const char *pin_group, 201int pin_config_group_set(const char *dev_name, const char *pin_group,
143 unsigned long config) 202 unsigned long config)
144{ 203{
@@ -151,27 +210,34 @@ int pin_config_group_set(const char *dev_name, const char *pin_group,
151 int ret; 210 int ret;
152 int i; 211 int i;
153 212
154 pctldev = get_pinctrl_dev_from_dev(NULL, dev_name); 213 mutex_lock(&pinctrl_mutex);
155 if (!pctldev) 214
156 return -EINVAL; 215 pctldev = get_pinctrl_dev_from_devname(dev_name);
216 if (!pctldev) {
217 ret = -EINVAL;
218 goto unlock;
219 }
157 ops = pctldev->desc->confops; 220 ops = pctldev->desc->confops;
158 pctlops = pctldev->desc->pctlops; 221 pctlops = pctldev->desc->pctlops;
159 222
160 if (!ops || (!ops->pin_config_group_set && !ops->pin_config_set)) { 223 if (!ops || (!ops->pin_config_group_set && !ops->pin_config_set)) {
161 dev_err(pctldev->dev, "cannot configure pin group, missing " 224 dev_err(pctldev->dev, "cannot configure pin group, missing "
162 "config function in driver\n"); 225 "config function in driver\n");
163 return -EINVAL; 226 ret = -EINVAL;
227 goto unlock;
164 } 228 }
165 229
166 selector = pinctrl_get_group_selector(pctldev, pin_group); 230 selector = pinctrl_get_group_selector(pctldev, pin_group);
167 if (selector < 0) 231 if (selector < 0) {
168 return selector; 232 ret = selector;
233 goto unlock;
234 }
169 235
170 ret = pctlops->get_group_pins(pctldev, selector, &pins, &num_pins); 236 ret = pctlops->get_group_pins(pctldev, selector, &pins, &num_pins);
171 if (ret) { 237 if (ret) {
172 dev_err(pctldev->dev, "cannot configure pin group, error " 238 dev_err(pctldev->dev, "cannot configure pin group, error "
173 "getting pins\n"); 239 "getting pins\n");
174 return ret; 240 goto unlock;
175 } 241 }
176 242
177 /* 243 /*
@@ -185,46 +251,196 @@ int pin_config_group_set(const char *dev_name, const char *pin_group,
185 * pin-by-pin as well, it returns -EAGAIN. 251 * pin-by-pin as well, it returns -EAGAIN.
186 */ 252 */
187 if (ret != -EAGAIN) 253 if (ret != -EAGAIN)
188 return ret; 254 goto unlock;
189 } 255 }
190 256
191 /* 257 /*
192 * If the controller cannot handle entire groups, we configure each pin 258 * If the controller cannot handle entire groups, we configure each pin
193 * individually. 259 * individually.
194 */ 260 */
195 if (!ops->pin_config_set) 261 if (!ops->pin_config_set) {
196 return 0; 262 ret = 0;
263 goto unlock;
264 }
197 265
198 for (i = 0; i < num_pins; i++) { 266 for (i = 0; i < num_pins; i++) {
199 ret = ops->pin_config_set(pctldev, pins[i], config); 267 ret = ops->pin_config_set(pctldev, pins[i], config);
200 if (ret < 0) 268 if (ret < 0)
201 return ret; 269 goto unlock;
202 } 270 }
203 271
204 return 0; 272 ret = 0;
273
274unlock:
275 mutex_unlock(&pinctrl_mutex);
276
277 return ret;
205} 278}
206EXPORT_SYMBOL(pin_config_group_set); 279EXPORT_SYMBOL(pin_config_group_set);
207 280
208int pinconf_check_ops(struct pinctrl_dev *pctldev) 281int pinconf_map_to_setting(struct pinctrl_map const *map,
282 struct pinctrl_setting *setting)
209{ 283{
284 struct pinctrl_dev *pctldev = setting->pctldev;
285 int pin;
286
287 switch (setting->type) {
288 case PIN_MAP_TYPE_CONFIGS_PIN:
289 pin = pin_get_from_name(pctldev,
290 map->data.configs.group_or_pin);
291 if (pin < 0) {
292 dev_err(pctldev->dev, "could not map pin config for \"%s\"",
293 map->data.configs.group_or_pin);
294 return pin;
295 }
296 setting->data.configs.group_or_pin = pin;
297 break;
298 case PIN_MAP_TYPE_CONFIGS_GROUP:
299 pin = pinctrl_get_group_selector(pctldev,
300 map->data.configs.group_or_pin);
301 if (pin < 0) {
302 dev_err(pctldev->dev, "could not map group config for \"%s\"",
303 map->data.configs.group_or_pin);
304 return pin;
305 }
306 setting->data.configs.group_or_pin = pin;
307 break;
308 default:
309 return -EINVAL;
310 }
311
312 setting->data.configs.num_configs = map->data.configs.num_configs;
313 setting->data.configs.configs = map->data.configs.configs;
314
315 return 0;
316}
317
318void pinconf_free_setting(struct pinctrl_setting const *setting)
319{
320}
321
322int pinconf_apply_setting(struct pinctrl_setting const *setting)
323{
324 struct pinctrl_dev *pctldev = setting->pctldev;
210 const struct pinconf_ops *ops = pctldev->desc->confops; 325 const struct pinconf_ops *ops = pctldev->desc->confops;
326 int i, ret;
211 327
212 /* We must be able to read out pin status */ 328 if (!ops) {
213 if (!ops->pin_config_get && !ops->pin_config_group_get) 329 dev_err(pctldev->dev, "missing confops\n");
214 return -EINVAL; 330 return -EINVAL;
215 /* We have to be able to config the pins in SOME way */ 331 }
216 if (!ops->pin_config_set && !ops->pin_config_group_set) 332
333 switch (setting->type) {
334 case PIN_MAP_TYPE_CONFIGS_PIN:
335 if (!ops->pin_config_set) {
336 dev_err(pctldev->dev, "missing pin_config_set op\n");
337 return -EINVAL;
338 }
339 for (i = 0; i < setting->data.configs.num_configs; i++) {
340 ret = ops->pin_config_set(pctldev,
341 setting->data.configs.group_or_pin,
342 setting->data.configs.configs[i]);
343 if (ret < 0) {
344 dev_err(pctldev->dev,
345 "pin_config_set op failed for pin %d config %08lx\n",
346 setting->data.configs.group_or_pin,
347 setting->data.configs.configs[i]);
348 return ret;
349 }
350 }
351 break;
352 case PIN_MAP_TYPE_CONFIGS_GROUP:
353 if (!ops->pin_config_group_set) {
354 dev_err(pctldev->dev,
355 "missing pin_config_group_set op\n");
356 return -EINVAL;
357 }
358 for (i = 0; i < setting->data.configs.num_configs; i++) {
359 ret = ops->pin_config_group_set(pctldev,
360 setting->data.configs.group_or_pin,
361 setting->data.configs.configs[i]);
362 if (ret < 0) {
363 dev_err(pctldev->dev,
364 "pin_config_group_set op failed for group %d config %08lx\n",
365 setting->data.configs.group_or_pin,
366 setting->data.configs.configs[i]);
367 return ret;
368 }
369 }
370 break;
371 default:
217 return -EINVAL; 372 return -EINVAL;
373 }
374
218 return 0; 375 return 0;
219} 376}
220 377
221#ifdef CONFIG_DEBUG_FS 378#ifdef CONFIG_DEBUG_FS
222 379
380void pinconf_show_map(struct seq_file *s, struct pinctrl_map const *map)
381{
382 int i;
383
384 switch (map->type) {
385 case PIN_MAP_TYPE_CONFIGS_PIN:
386 seq_printf(s, "pin ");
387 break;
388 case PIN_MAP_TYPE_CONFIGS_GROUP:
389 seq_printf(s, "group ");
390 break;
391 default:
392 break;
393 }
394
395 seq_printf(s, "%s\n", map->data.configs.group_or_pin);
396
397 for (i = 0; i < map->data.configs.num_configs; i++)
398 seq_printf(s, "config %08lx\n", map->data.configs.configs[i]);
399}
400
401void pinconf_show_setting(struct seq_file *s,
402 struct pinctrl_setting const *setting)
403{
404 struct pinctrl_dev *pctldev = setting->pctldev;
405 const struct pinctrl_ops *pctlops = pctldev->desc->pctlops;
406 struct pin_desc *desc;
407 int i;
408
409 switch (setting->type) {
410 case PIN_MAP_TYPE_CONFIGS_PIN:
411 desc = pin_desc_get(setting->pctldev,
412 setting->data.configs.group_or_pin);
413 seq_printf(s, "pin %s (%d)",
414 desc->name ? desc->name : "unnamed",
415 setting->data.configs.group_or_pin);
416 break;
417 case PIN_MAP_TYPE_CONFIGS_GROUP:
418 seq_printf(s, "group %s (%d)",
419 pctlops->get_group_name(pctldev,
420 setting->data.configs.group_or_pin),
421 setting->data.configs.group_or_pin);
422 break;
423 default:
424 break;
425 }
426
427 /*
428 * FIXME: We should really get the pin controler to dump the config
429 * values, so they can be decoded to something meaningful.
430 */
431 for (i = 0; i < setting->data.configs.num_configs; i++)
432 seq_printf(s, " %08lx", setting->data.configs.configs[i]);
433
434 seq_printf(s, "\n");
435}
436
223static void pinconf_dump_pin(struct pinctrl_dev *pctldev, 437static void pinconf_dump_pin(struct pinctrl_dev *pctldev,
224 struct seq_file *s, int pin) 438 struct seq_file *s, int pin)
225{ 439{
226 const struct pinconf_ops *ops = pctldev->desc->confops; 440 const struct pinconf_ops *ops = pctldev->desc->confops;
227 441
442 /* no-op when not using generic pin config */
443 pinconf_generic_dump_pin(pctldev, s, pin);
228 if (ops && ops->pin_config_dbg_show) 444 if (ops && ops->pin_config_dbg_show)
229 ops->pin_config_dbg_show(pctldev, s, pin); 445 ops->pin_config_dbg_show(pctldev, s, pin);
230} 446}
@@ -237,6 +453,8 @@ static int pinconf_pins_show(struct seq_file *s, void *what)
237 seq_puts(s, "Pin config settings per pin\n"); 453 seq_puts(s, "Pin config settings per pin\n");
238 seq_puts(s, "Format: pin (name): pinmux setting array\n"); 454 seq_puts(s, "Format: pin (name): pinmux setting array\n");
239 455
456 mutex_lock(&pinctrl_mutex);
457
240 /* The pin number can be retrived from the pin controller descriptor */ 458 /* The pin number can be retrived from the pin controller descriptor */
241 for (i = 0; i < pctldev->desc->npins; i++) { 459 for (i = 0; i < pctldev->desc->npins; i++) {
242 struct pin_desc *desc; 460 struct pin_desc *desc;
@@ -255,6 +473,8 @@ static int pinconf_pins_show(struct seq_file *s, void *what)
255 seq_printf(s, "\n"); 473 seq_printf(s, "\n");
256 } 474 }
257 475
476 mutex_unlock(&pinctrl_mutex);
477
258 return 0; 478 return 0;
259} 479}
260 480
@@ -264,6 +484,8 @@ static void pinconf_dump_group(struct pinctrl_dev *pctldev,
264{ 484{
265 const struct pinconf_ops *ops = pctldev->desc->confops; 485 const struct pinconf_ops *ops = pctldev->desc->confops;
266 486
487 /* no-op when not using generic pin config */
488 pinconf_generic_dump_group(pctldev, s, gname);
267 if (ops && ops->pin_config_group_dbg_show) 489 if (ops && ops->pin_config_group_dbg_show)
268 ops->pin_config_group_dbg_show(pctldev, s, selector); 490 ops->pin_config_group_dbg_show(pctldev, s, selector);
269} 491}
@@ -281,14 +503,20 @@ static int pinconf_groups_show(struct seq_file *s, void *what)
281 seq_puts(s, "Pin config settings per pin group\n"); 503 seq_puts(s, "Pin config settings per pin group\n");
282 seq_puts(s, "Format: group (name): pinmux setting array\n"); 504 seq_puts(s, "Format: group (name): pinmux setting array\n");
283 505
506 mutex_lock(&pinctrl_mutex);
507
284 while (pctlops->list_groups(pctldev, selector) >= 0) { 508 while (pctlops->list_groups(pctldev, selector) >= 0) {
285 const char *gname = pctlops->get_group_name(pctldev, selector); 509 const char *gname = pctlops->get_group_name(pctldev, selector);
286 510
287 seq_printf(s, "%u (%s):", selector, gname); 511 seq_printf(s, "%u (%s):", selector, gname);
288 pinconf_dump_group(pctldev, s, selector, gname); 512 pinconf_dump_group(pctldev, s, selector, gname);
513 seq_printf(s, "\n");
514
289 selector++; 515 selector++;
290 } 516 }
291 517
518 mutex_unlock(&pinctrl_mutex);
519
292 return 0; 520 return 0;
293} 521}
294 522
diff --git a/drivers/pinctrl/pinconf.h b/drivers/pinctrl/pinconf.h
index 006b77fa737e..54510de5e8c6 100644
--- a/drivers/pinctrl/pinconf.h
+++ b/drivers/pinctrl/pinconf.h
@@ -14,12 +14,25 @@
14#ifdef CONFIG_PINCONF 14#ifdef CONFIG_PINCONF
15 15
16int pinconf_check_ops(struct pinctrl_dev *pctldev); 16int pinconf_check_ops(struct pinctrl_dev *pctldev);
17int pinconf_validate_map(struct pinctrl_map const *map, int i);
18int pinconf_map_to_setting(struct pinctrl_map const *map,
19 struct pinctrl_setting *setting);
20void pinconf_free_setting(struct pinctrl_setting const *setting);
21int pinconf_apply_setting(struct pinctrl_setting const *setting);
22void pinconf_show_map(struct seq_file *s, struct pinctrl_map const *map);
23void pinconf_show_setting(struct seq_file *s,
24 struct pinctrl_setting const *setting);
17void pinconf_init_device_debugfs(struct dentry *devroot, 25void pinconf_init_device_debugfs(struct dentry *devroot,
18 struct pinctrl_dev *pctldev); 26 struct pinctrl_dev *pctldev);
27
28/*
29 * You will only be interested in these if you're using PINCONF
30 * so don't supply any stubs for these.
31 */
19int pin_config_get_for_pin(struct pinctrl_dev *pctldev, unsigned pin, 32int pin_config_get_for_pin(struct pinctrl_dev *pctldev, unsigned pin,
20 unsigned long *config); 33 unsigned long *config);
21int pin_config_set_for_pin(struct pinctrl_dev *pctldev, unsigned pin, 34int pin_config_group_get(const char *dev_name, const char *pin_group,
22 unsigned long config); 35 unsigned long *config);
23 36
24#else 37#else
25 38
@@ -28,9 +41,70 @@ static inline int pinconf_check_ops(struct pinctrl_dev *pctldev)
28 return 0; 41 return 0;
29} 42}
30 43
44static inline int pinconf_validate_map(struct pinctrl_map const *map, int i)
45{
46 return 0;
47}
48
49static inline int pinconf_map_to_setting(struct pinctrl_map const *map,
50 struct pinctrl_setting *setting)
51{
52 return 0;
53}
54
55static inline void pinconf_free_setting(struct pinctrl_setting const *setting)
56{
57}
58
59static inline int pinconf_apply_setting(struct pinctrl_setting const *setting)
60{
61 return 0;
62}
63
64static inline void pinconf_show_map(struct seq_file *s,
65 struct pinctrl_map const *map)
66{
67}
68
69static inline void pinconf_show_setting(struct seq_file *s,
70 struct pinctrl_setting const *setting)
71{
72}
73
31static inline void pinconf_init_device_debugfs(struct dentry *devroot, 74static inline void pinconf_init_device_debugfs(struct dentry *devroot,
32 struct pinctrl_dev *pctldev) 75 struct pinctrl_dev *pctldev)
33{ 76{
34} 77}
35 78
36#endif 79#endif
80
81/*
82 * The following functions are available if the driver uses the generic
83 * pin config.
84 */
85
86#ifdef CONFIG_GENERIC_PINCONF
87
88void pinconf_generic_dump_pin(struct pinctrl_dev *pctldev,
89 struct seq_file *s, unsigned pin);
90
91void pinconf_generic_dump_group(struct pinctrl_dev *pctldev,
92 struct seq_file *s, const char *gname);
93
94#else
95
96static inline void pinconf_generic_dump_pin(struct pinctrl_dev *pctldev,
97 struct seq_file *s,
98 unsigned pin)
99{
100 return;
101}
102
103static inline void pinconf_generic_dump_group(struct pinctrl_dev *pctldev,
104 struct seq_file *s,
105 const char *gname)
106{
107 return;
108}
109
110#endif
diff --git a/drivers/pinctrl/pinctrl-coh901.c b/drivers/pinctrl/pinctrl-coh901.c
index 69fb7072a23e..0797eba3e33a 100644
--- a/drivers/pinctrl/pinctrl-coh901.c
+++ b/drivers/pinctrl/pinctrl-coh901.c
@@ -22,38 +22,10 @@
22#include <linux/gpio.h> 22#include <linux/gpio.h>
23#include <linux/list.h> 23#include <linux/list.h>
24#include <linux/slab.h> 24#include <linux/slab.h>
25#include <linux/pinctrl/pinmux.h> 25#include <linux/pinctrl/consumer.h>
26#include <linux/pinctrl/pinconf-generic.h>
26#include <mach/gpio-u300.h> 27#include <mach/gpio-u300.h>
27 28#include "pinctrl-coh901.h"
28/*
29 * Bias modes for U300 GPIOs
30 *
31 * GPIO_U300_CONFIG_BIAS_UNKNOWN: this bias mode is not known to us
32 * GPIO_U300_CONFIG_BIAS_FLOAT: no specific bias, the GPIO will float or state
33 * is not controlled by software
34 * GPIO_U300_CONFIG_BIAS_PULL_UP: the GPIO will be pulled up (usually with high
35 * impedance to VDD)
36 */
37#define GPIO_U300_CONFIG_BIAS_UNKNOWN 0x1000
38#define GPIO_U300_CONFIG_BIAS_FLOAT 0x1001
39#define GPIO_U300_CONFIG_BIAS_PULL_UP 0x1002
40
41/*
42 * Drive modes for U300 GPIOs (output)
43 *
44 * GPIO_U300_CONFIG_DRIVE_PUSH_PULL: the GPIO will be driven actively high and
45 * low, this is the most typical case and is typically achieved with two
46 * active transistors on the output
47 * GPIO_U300_CONFIG_DRIVE_OPEN_DRAIN: the GPIO will be driven with open drain
48 * (open collector) which means it is usually wired with other output
49 * ports which are then pulled up with an external resistor
50 * GPIO_U300_CONFIG_DRIVE_OPEN_SOURCE: the GPIO will be driven with open drain
51 * (open emitter) which is the same as open drain mutatis mutandis but
52 * pulled to ground
53 */
54#define GPIO_U300_CONFIG_DRIVE_PUSH_PULL 0x2000
55#define GPIO_U300_CONFIG_DRIVE_OPEN_DRAIN 0x2001
56#define GPIO_U300_CONFIG_DRIVE_OPEN_SOURCE 0x2002
57 29
58/* 30/*
59 * Register definitions for COH 901 335 variant 31 * Register definitions for COH 901 335 variant
@@ -181,12 +153,12 @@ struct u300_gpio_confdata {
181#define BS365_GPIO_NUM_PORTS 5 153#define BS365_GPIO_NUM_PORTS 5
182 154
183#define U300_FLOATING_INPUT { \ 155#define U300_FLOATING_INPUT { \
184 .bias_mode = GPIO_U300_CONFIG_BIAS_FLOAT, \ 156 .bias_mode = PIN_CONFIG_BIAS_HIGH_IMPEDANCE, \
185 .output = false, \ 157 .output = false, \
186} 158}
187 159
188#define U300_PULL_UP_INPUT { \ 160#define U300_PULL_UP_INPUT { \
189 .bias_mode = GPIO_U300_CONFIG_BIAS_PULL_UP, \ 161 .bias_mode = PIN_CONFIG_BIAS_PULL_UP, \
190 .output = false, \ 162 .output = false, \
191} 163}
192 164
@@ -360,14 +332,14 @@ static int u300_gpio_request(struct gpio_chip *chip, unsigned offset)
360 */ 332 */
361 int gpio = chip->base + offset; 333 int gpio = chip->base + offset;
362 334
363 return pinmux_request_gpio(gpio); 335 return pinctrl_request_gpio(gpio);
364} 336}
365 337
366static void u300_gpio_free(struct gpio_chip *chip, unsigned offset) 338static void u300_gpio_free(struct gpio_chip *chip, unsigned offset)
367{ 339{
368 int gpio = chip->base + offset; 340 int gpio = chip->base + offset;
369 341
370 pinmux_free_gpio(gpio); 342 pinctrl_free_gpio(gpio);
371} 343}
372 344
373static int u300_gpio_get(struct gpio_chip *chip, unsigned offset) 345static int u300_gpio_get(struct gpio_chip *chip, unsigned offset)
@@ -448,8 +420,68 @@ static int u300_gpio_to_irq(struct gpio_chip *chip, unsigned offset)
448 return retirq; 420 return retirq;
449} 421}
450 422
451static int u300_gpio_config(struct gpio_chip *chip, unsigned offset, 423/* Returning -EINVAL means "supported but not available" */
452 u16 param, unsigned long *data) 424int u300_gpio_config_get(struct gpio_chip *chip,
425 unsigned offset,
426 unsigned long *config)
427{
428 struct u300_gpio *gpio = to_u300_gpio(chip);
429 enum pin_config_param param = (enum pin_config_param) *config;
430 bool biasmode;
431 u32 drmode;
432
433 /* One bit per pin, clamp to bool range */
434 biasmode = !!(readl(U300_PIN_REG(offset, per)) & U300_PIN_BIT(offset));
435
436 /* Mask out the two bits for this pin and shift to bits 0,1 */
437 drmode = readl(U300_PIN_REG(offset, pcr));
438 drmode &= (U300_GPIO_PXPCR_PIN_MODE_MASK << ((offset & 0x07) << 1));
439 drmode >>= ((offset & 0x07) << 1);
440
441 switch(param) {
442 case PIN_CONFIG_BIAS_HIGH_IMPEDANCE:
443 *config = 0;
444 if (biasmode)
445 return 0;
446 else
447 return -EINVAL;
448 break;
449 case PIN_CONFIG_BIAS_PULL_UP:
450 *config = 0;
451 if (!biasmode)
452 return 0;
453 else
454 return -EINVAL;
455 break;
456 case PIN_CONFIG_DRIVE_PUSH_PULL:
457 *config = 0;
458 if (drmode == U300_GPIO_PXPCR_PIN_MODE_OUTPUT_PUSH_PULL)
459 return 0;
460 else
461 return -EINVAL;
462 break;
463 case PIN_CONFIG_DRIVE_OPEN_DRAIN:
464 *config = 0;
465 if (drmode == U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_DRAIN)
466 return 0;
467 else
468 return -EINVAL;
469 break;
470 case PIN_CONFIG_DRIVE_OPEN_SOURCE:
471 *config = 0;
472 if (drmode == U300_GPIO_PXPCR_PIN_MODE_OUTPUT_OPEN_SOURCE)
473 return 0;
474 else
475 return -EINVAL;
476 break;
477 default:
478 break;
479 }
480 return -ENOTSUPP;
481}
482
483int u300_gpio_config_set(struct gpio_chip *chip, unsigned offset,
484 enum pin_config_param param)
453{ 485{
454 struct u300_gpio *gpio = to_u300_gpio(chip); 486 struct u300_gpio *gpio = to_u300_gpio(chip);
455 unsigned long flags; 487 unsigned long flags;
@@ -457,16 +489,16 @@ static int u300_gpio_config(struct gpio_chip *chip, unsigned offset,
457 489
458 local_irq_save(flags); 490 local_irq_save(flags);
459 switch (param) { 491 switch (param) {
460 case GPIO_U300_CONFIG_BIAS_UNKNOWN: 492 case PIN_CONFIG_BIAS_DISABLE:
461 case GPIO_U300_CONFIG_BIAS_FLOAT: 493 case PIN_CONFIG_BIAS_HIGH_IMPEDANCE:
462 val = readl(U300_PIN_REG(offset, per)); 494 val = readl(U300_PIN_REG(offset, per));
463 writel(val | U300_PIN_BIT(offset), U300_PIN_REG(offset, per)); 495 writel(val | U300_PIN_BIT(offset), U300_PIN_REG(offset, per));
464 break; 496 break;
465 case GPIO_U300_CONFIG_BIAS_PULL_UP: 497 case PIN_CONFIG_BIAS_PULL_UP:
466 val = readl(U300_PIN_REG(offset, per)); 498 val = readl(U300_PIN_REG(offset, per));
467 writel(val & ~U300_PIN_BIT(offset), U300_PIN_REG(offset, per)); 499 writel(val & ~U300_PIN_BIT(offset), U300_PIN_REG(offset, per));
468 break; 500 break;
469 case GPIO_U300_CONFIG_DRIVE_PUSH_PULL: 501 case PIN_CONFIG_DRIVE_PUSH_PULL:
470 val = readl(U300_PIN_REG(offset, pcr)); 502 val = readl(U300_PIN_REG(offset, pcr));
471 val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK 503 val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK
472 << ((offset & 0x07) << 1)); 504 << ((offset & 0x07) << 1));
@@ -474,7 +506,7 @@ static int u300_gpio_config(struct gpio_chip *chip, unsigned offset,
474 << ((offset & 0x07) << 1)); 506 << ((offset & 0x07) << 1));
475 writel(val, U300_PIN_REG(offset, pcr)); 507 writel(val, U300_PIN_REG(offset, pcr));
476 break; 508 break;
477 case GPIO_U300_CONFIG_DRIVE_OPEN_DRAIN: 509 case PIN_CONFIG_DRIVE_OPEN_DRAIN:
478 val = readl(U300_PIN_REG(offset, pcr)); 510 val = readl(U300_PIN_REG(offset, pcr));
479 val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK 511 val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK
480 << ((offset & 0x07) << 1)); 512 << ((offset & 0x07) << 1));
@@ -482,7 +514,7 @@ static int u300_gpio_config(struct gpio_chip *chip, unsigned offset,
482 << ((offset & 0x07) << 1)); 514 << ((offset & 0x07) << 1));
483 writel(val, U300_PIN_REG(offset, pcr)); 515 writel(val, U300_PIN_REG(offset, pcr));
484 break; 516 break;
485 case GPIO_U300_CONFIG_DRIVE_OPEN_SOURCE: 517 case PIN_CONFIG_DRIVE_OPEN_SOURCE:
486 val = readl(U300_PIN_REG(offset, pcr)); 518 val = readl(U300_PIN_REG(offset, pcr));
487 val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK 519 val &= ~(U300_GPIO_PXPCR_PIN_MODE_MASK
488 << ((offset & 0x07) << 1)); 520 << ((offset & 0x07) << 1));
@@ -650,13 +682,12 @@ static void __init u300_gpio_init_pin(struct u300_gpio *gpio,
650 u300_gpio_direction_output(&gpio->chip, offset, conf->outval); 682 u300_gpio_direction_output(&gpio->chip, offset, conf->outval);
651 683
652 /* Deactivate bias mode for output */ 684 /* Deactivate bias mode for output */
653 u300_gpio_config(&gpio->chip, offset, 685 u300_gpio_config_set(&gpio->chip, offset,
654 GPIO_U300_CONFIG_BIAS_FLOAT, 686 PIN_CONFIG_BIAS_HIGH_IMPEDANCE);
655 NULL);
656 687
657 /* Set drive mode for output */ 688 /* Set drive mode for output */
658 u300_gpio_config(&gpio->chip, offset, 689 u300_gpio_config_set(&gpio->chip, offset,
659 GPIO_U300_CONFIG_DRIVE_PUSH_PULL, NULL); 690 PIN_CONFIG_DRIVE_PUSH_PULL);
660 691
661 dev_dbg(gpio->dev, "set up pin %d as output, value: %d\n", 692 dev_dbg(gpio->dev, "set up pin %d as output, value: %d\n",
662 offset, conf->outval); 693 offset, conf->outval);
@@ -667,7 +698,7 @@ static void __init u300_gpio_init_pin(struct u300_gpio *gpio,
667 u300_gpio_set(&gpio->chip, offset, 0); 698 u300_gpio_set(&gpio->chip, offset, 0);
668 699
669 /* Set bias mode for input */ 700 /* Set bias mode for input */
670 u300_gpio_config(&gpio->chip, offset, conf->bias_mode, NULL); 701 u300_gpio_config_set(&gpio->chip, offset, conf->bias_mode);
671 702
672 dev_dbg(gpio->dev, "set up pin %d as input, bias: %04x\n", 703 dev_dbg(gpio->dev, "set up pin %d as input, bias: %04x\n",
673 offset, conf->bias_mode); 704 offset, conf->bias_mode);
@@ -705,7 +736,6 @@ static inline void u300_gpio_free_ports(struct u300_gpio *gpio)
705 list_for_each_safe(p, n, &gpio->port_list) { 736 list_for_each_safe(p, n, &gpio->port_list) {
706 port = list_entry(p, struct u300_gpio_port, node); 737 port = list_entry(p, struct u300_gpio_port, node);
707 list_del(&port->node); 738 list_del(&port->node);
708 free_irq(port->irq, port);
709 kfree(port); 739 kfree(port);
710 } 740 }
711} 741}
@@ -861,10 +891,18 @@ static int __init u300_gpio_probe(struct platform_device *pdev)
861 goto err_no_chip; 891 goto err_no_chip;
862 } 892 }
863 893
894 /* Spawn pin controller device as child of the GPIO, pass gpio chip */
895 plat->pinctrl_device->dev.platform_data = &gpio->chip;
896 err = platform_device_register(plat->pinctrl_device);
897 if (err)
898 goto err_no_pinctrl;
899
864 platform_set_drvdata(pdev, gpio); 900 platform_set_drvdata(pdev, gpio);
865 901
866 return 0; 902 return 0;
867 903
904err_no_pinctrl:
905 err = gpiochip_remove(&gpio->chip);
868err_no_chip: 906err_no_chip:
869err_no_port: 907err_no_port:
870 u300_gpio_free_ports(gpio); 908 u300_gpio_free_ports(gpio);
@@ -919,7 +957,6 @@ static struct platform_driver u300_gpio_driver = {
919 .remove = __exit_p(u300_gpio_remove), 957 .remove = __exit_p(u300_gpio_remove),
920}; 958};
921 959
922
923static int __init u300_gpio_init(void) 960static int __init u300_gpio_init(void)
924{ 961{
925 return platform_driver_probe(&u300_gpio_driver, u300_gpio_probe); 962 return platform_driver_probe(&u300_gpio_driver, u300_gpio_probe);
diff --git a/drivers/pinctrl/pinctrl-coh901.h b/drivers/pinctrl/pinctrl-coh901.h
new file mode 100644
index 000000000000..87294222583e
--- /dev/null
+++ b/drivers/pinctrl/pinctrl-coh901.h
@@ -0,0 +1,5 @@
1int u300_gpio_config_get(struct gpio_chip *chip,
2 unsigned offset,
3 unsigned long *config);
4int u300_gpio_config_set(struct gpio_chip *chip, unsigned offset,
5 enum pin_config_param param);
diff --git a/drivers/pinctrl/pinctrl-mmp2.c b/drivers/pinctrl/pinctrl-mmp2.c
new file mode 100644
index 000000000000..2cfed552bbe4
--- /dev/null
+++ b/drivers/pinctrl/pinctrl-mmp2.c
@@ -0,0 +1,722 @@
1/*
2 * linux/drivers/pinctrl/pinmux-mmp2.c
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * publishhed by the Free Software Foundation.
7 *
8 * Copyright (C) 2011, Marvell Technology Group Ltd.
9 *
10 * Author: Haojian Zhuang <haojian.zhuang@marvell.com>
11 *
12 */
13
14#include <linux/device.h>
15#include <linux/module.h>
16#include <linux/io.h>
17#include <linux/platform_device.h>
18#include "pinctrl-pxa3xx.h"
19
20#define MMP2_DS_MASK 0x1800
21#define MMP2_DS_SHIFT 11
22#define MMP2_SLEEP_MASK 0x38
23#define MMP2_SLEEP_SELECT (1 << 9)
24#define MMP2_SLEEP_DATA (1 << 8)
25#define MMP2_SLEEP_DIR (1 << 7)
26
27#define MFPR_MMP2(a, r, f0, f1, f2, f3, f4, f5, f6, f7) \
28 { \
29 .name = #a, \
30 .pin = a, \
31 .mfpr = r, \
32 .func = { \
33 MMP2_MUX_##f0, \
34 MMP2_MUX_##f1, \
35 MMP2_MUX_##f2, \
36 MMP2_MUX_##f3, \
37 MMP2_MUX_##f4, \
38 MMP2_MUX_##f5, \
39 MMP2_MUX_##f6, \
40 MMP2_MUX_##f7, \
41 }, \
42 }
43
44#define GRP_MMP2(a, m, p) \
45 { .name = a, .mux = MMP2_MUX_##m, .pins = p, .npins = ARRAY_SIZE(p), }
46
47/* 174 pins */
48enum mmp2_pin_list {
49 /* 0~168: GPIO0~GPIO168 */
50 TWSI4_SCL = 169,
51 TWSI4_SDA, /* 170 */
52 G_CLKREQ,
53 VCXO_REQ,
54 VCXO_OUT,
55};
56
57enum mmp2_mux {
58 /* PXA3xx_MUX_GPIO = 0 (predefined in pinctrl-pxa3xx.h) */
59 MMP2_MUX_GPIO = 0,
60 MMP2_MUX_G_CLKREQ,
61 MMP2_MUX_VCXO_REQ,
62 MMP2_MUX_VCXO_OUT,
63 MMP2_MUX_KP_MK,
64 MMP2_MUX_KP_DK,
65 MMP2_MUX_CCIC1,
66 MMP2_MUX_CCIC2,
67 MMP2_MUX_SPI,
68 MMP2_MUX_SSPA2,
69 MMP2_MUX_ROT,
70 MMP2_MUX_I2S,
71 MMP2_MUX_TB,
72 MMP2_MUX_CAM2,
73 MMP2_MUX_HDMI,
74 MMP2_MUX_TWSI2,
75 MMP2_MUX_TWSI3,
76 MMP2_MUX_TWSI4,
77 MMP2_MUX_TWSI5,
78 MMP2_MUX_TWSI6,
79 MMP2_MUX_UART1,
80 MMP2_MUX_UART2,
81 MMP2_MUX_UART3,
82 MMP2_MUX_UART4,
83 MMP2_MUX_SSP1_RX,
84 MMP2_MUX_SSP1_FRM,
85 MMP2_MUX_SSP1_TXRX,
86 MMP2_MUX_SSP2_RX,
87 MMP2_MUX_SSP2_FRM,
88 MMP2_MUX_SSP1,
89 MMP2_MUX_SSP2,
90 MMP2_MUX_SSP3,
91 MMP2_MUX_SSP4,
92 MMP2_MUX_MMC1,
93 MMP2_MUX_MMC2,
94 MMP2_MUX_MMC3,
95 MMP2_MUX_MMC4,
96 MMP2_MUX_ULPI,
97 MMP2_MUX_AC,
98 MMP2_MUX_CA,
99 MMP2_MUX_PWM,
100 MMP2_MUX_USIM,
101 MMP2_MUX_TIPU,
102 MMP2_MUX_PLL,
103 MMP2_MUX_NAND,
104 MMP2_MUX_FSIC,
105 MMP2_MUX_SLEEP_IND,
106 MMP2_MUX_EXT_DMA,
107 MMP2_MUX_ONE_WIRE,
108 MMP2_MUX_LCD,
109 MMP2_MUX_SMC,
110 MMP2_MUX_SMC_INT,
111 MMP2_MUX_MSP,
112 MMP2_MUX_G_CLKOUT,
113 MMP2_MUX_32K_CLKOUT,
114 MMP2_MUX_PRI_JTAG,
115 MMP2_MUX_AAS_JTAG,
116 MMP2_MUX_AAS_GPIO,
117 MMP2_MUX_AAS_SPI,
118 MMP2_MUX_AAS_TWSI,
119 MMP2_MUX_AAS_DEU_EX,
120 MMP2_MUX_NONE = 0xffff,
121};
122
123static struct pinctrl_pin_desc mmp2_pads[] = {
124 /*
125 * The name indicates function 0 of this pin.
126 * After reset, function 0 is the default function of pin.
127 */
128 PINCTRL_PIN(GPIO0, "GPIO0"),
129 PINCTRL_PIN(GPIO1, "GPIO1"),
130 PINCTRL_PIN(GPIO2, "GPIO2"),
131 PINCTRL_PIN(GPIO3, "GPIO3"),
132 PINCTRL_PIN(GPIO4, "GPIO4"),
133 PINCTRL_PIN(GPIO5, "GPIO5"),
134 PINCTRL_PIN(GPIO6, "GPIO6"),
135 PINCTRL_PIN(GPIO7, "GPIO7"),
136 PINCTRL_PIN(GPIO8, "GPIO8"),
137 PINCTRL_PIN(GPIO9, "GPIO9"),
138 PINCTRL_PIN(GPIO10, "GPIO10"),
139 PINCTRL_PIN(GPIO11, "GPIO11"),
140 PINCTRL_PIN(GPIO12, "GPIO12"),
141 PINCTRL_PIN(GPIO13, "GPIO13"),
142 PINCTRL_PIN(GPIO14, "GPIO14"),
143 PINCTRL_PIN(GPIO15, "GPIO15"),
144 PINCTRL_PIN(GPIO16, "GPIO16"),
145 PINCTRL_PIN(GPIO17, "GPIO17"),
146 PINCTRL_PIN(GPIO18, "GPIO18"),
147 PINCTRL_PIN(GPIO19, "GPIO19"),
148 PINCTRL_PIN(GPIO20, "GPIO20"),
149 PINCTRL_PIN(GPIO21, "GPIO21"),
150 PINCTRL_PIN(GPIO22, "GPIO22"),
151 PINCTRL_PIN(GPIO23, "GPIO23"),
152 PINCTRL_PIN(GPIO24, "GPIO24"),
153 PINCTRL_PIN(GPIO25, "GPIO25"),
154 PINCTRL_PIN(GPIO26, "GPIO26"),
155 PINCTRL_PIN(GPIO27, "GPIO27"),
156 PINCTRL_PIN(GPIO28, "GPIO28"),
157 PINCTRL_PIN(GPIO29, "GPIO29"),
158 PINCTRL_PIN(GPIO30, "GPIO30"),
159 PINCTRL_PIN(GPIO31, "GPIO31"),
160 PINCTRL_PIN(GPIO32, "GPIO32"),
161 PINCTRL_PIN(GPIO33, "GPIO33"),
162 PINCTRL_PIN(GPIO34, "GPIO34"),
163 PINCTRL_PIN(GPIO35, "GPIO35"),
164 PINCTRL_PIN(GPIO36, "GPIO36"),
165 PINCTRL_PIN(GPIO37, "GPIO37"),
166 PINCTRL_PIN(GPIO38, "GPIO38"),
167 PINCTRL_PIN(GPIO39, "GPIO39"),
168 PINCTRL_PIN(GPIO40, "GPIO40"),
169 PINCTRL_PIN(GPIO41, "GPIO41"),
170 PINCTRL_PIN(GPIO42, "GPIO42"),
171 PINCTRL_PIN(GPIO43, "GPIO43"),
172 PINCTRL_PIN(GPIO44, "GPIO44"),
173 PINCTRL_PIN(GPIO45, "GPIO45"),
174 PINCTRL_PIN(GPIO46, "GPIO46"),
175 PINCTRL_PIN(GPIO47, "GPIO47"),
176 PINCTRL_PIN(GPIO48, "GPIO48"),
177 PINCTRL_PIN(GPIO49, "GPIO49"),
178 PINCTRL_PIN(GPIO50, "GPIO50"),
179 PINCTRL_PIN(GPIO51, "GPIO51"),
180 PINCTRL_PIN(GPIO52, "GPIO52"),
181 PINCTRL_PIN(GPIO53, "GPIO53"),
182 PINCTRL_PIN(GPIO54, "GPIO54"),
183 PINCTRL_PIN(GPIO55, "GPIO55"),
184 PINCTRL_PIN(GPIO56, "GPIO56"),
185 PINCTRL_PIN(GPIO57, "GPIO57"),
186 PINCTRL_PIN(GPIO58, "GPIO58"),
187 PINCTRL_PIN(GPIO59, "GPIO59"),
188 PINCTRL_PIN(GPIO60, "GPIO60"),
189 PINCTRL_PIN(GPIO61, "GPIO61"),
190 PINCTRL_PIN(GPIO62, "GPIO62"),
191 PINCTRL_PIN(GPIO63, "GPIO63"),
192 PINCTRL_PIN(GPIO64, "GPIO64"),
193 PINCTRL_PIN(GPIO65, "GPIO65"),
194 PINCTRL_PIN(GPIO66, "GPIO66"),
195 PINCTRL_PIN(GPIO67, "GPIO67"),
196 PINCTRL_PIN(GPIO68, "GPIO68"),
197 PINCTRL_PIN(GPIO69, "GPIO69"),
198 PINCTRL_PIN(GPIO70, "GPIO70"),
199 PINCTRL_PIN(GPIO71, "GPIO71"),
200 PINCTRL_PIN(GPIO72, "GPIO72"),
201 PINCTRL_PIN(GPIO73, "GPIO73"),
202 PINCTRL_PIN(GPIO74, "GPIO74"),
203 PINCTRL_PIN(GPIO75, "GPIO75"),
204 PINCTRL_PIN(GPIO76, "GPIO76"),
205 PINCTRL_PIN(GPIO77, "GPIO77"),
206 PINCTRL_PIN(GPIO78, "GPIO78"),
207 PINCTRL_PIN(GPIO79, "GPIO79"),
208 PINCTRL_PIN(GPIO80, "GPIO80"),
209 PINCTRL_PIN(GPIO81, "GPIO81"),
210 PINCTRL_PIN(GPIO82, "GPIO82"),
211 PINCTRL_PIN(GPIO83, "GPIO83"),
212 PINCTRL_PIN(GPIO84, "GPIO84"),
213 PINCTRL_PIN(GPIO85, "GPIO85"),
214 PINCTRL_PIN(GPIO86, "GPIO86"),
215 PINCTRL_PIN(GPIO87, "GPIO87"),
216 PINCTRL_PIN(GPIO88, "GPIO88"),
217 PINCTRL_PIN(GPIO89, "GPIO89"),
218 PINCTRL_PIN(GPIO90, "GPIO90"),
219 PINCTRL_PIN(GPIO91, "GPIO91"),
220 PINCTRL_PIN(GPIO92, "GPIO92"),
221 PINCTRL_PIN(GPIO93, "GPIO93"),
222 PINCTRL_PIN(GPIO94, "GPIO94"),
223 PINCTRL_PIN(GPIO95, "GPIO95"),
224 PINCTRL_PIN(GPIO96, "GPIO96"),
225 PINCTRL_PIN(GPIO97, "GPIO97"),
226 PINCTRL_PIN(GPIO98, "GPIO98"),
227 PINCTRL_PIN(GPIO99, "GPIO99"),
228 PINCTRL_PIN(GPIO100, "GPIO100"),
229 PINCTRL_PIN(GPIO101, "GPIO101"),
230 PINCTRL_PIN(GPIO102, "GPIO102"),
231 PINCTRL_PIN(GPIO103, "GPIO103"),
232 PINCTRL_PIN(GPIO104, "GPIO104"),
233 PINCTRL_PIN(GPIO105, "GPIO105"),
234 PINCTRL_PIN(GPIO106, "GPIO106"),
235 PINCTRL_PIN(GPIO107, "GPIO107"),
236 PINCTRL_PIN(GPIO108, "GPIO108"),
237 PINCTRL_PIN(GPIO109, "GPIO109"),
238 PINCTRL_PIN(GPIO110, "GPIO110"),
239 PINCTRL_PIN(GPIO111, "GPIO111"),
240 PINCTRL_PIN(GPIO112, "GPIO112"),
241 PINCTRL_PIN(GPIO113, "GPIO113"),
242 PINCTRL_PIN(GPIO114, "GPIO114"),
243 PINCTRL_PIN(GPIO115, "GPIO115"),
244 PINCTRL_PIN(GPIO116, "GPIO116"),
245 PINCTRL_PIN(GPIO117, "GPIO117"),
246 PINCTRL_PIN(GPIO118, "GPIO118"),
247 PINCTRL_PIN(GPIO119, "GPIO119"),
248 PINCTRL_PIN(GPIO120, "GPIO120"),
249 PINCTRL_PIN(GPIO121, "GPIO121"),
250 PINCTRL_PIN(GPIO122, "GPIO122"),
251 PINCTRL_PIN(GPIO123, "GPIO123"),
252 PINCTRL_PIN(GPIO124, "GPIO124"),
253 PINCTRL_PIN(GPIO125, "GPIO125"),
254 PINCTRL_PIN(GPIO126, "GPIO126"),
255 PINCTRL_PIN(GPIO127, "GPIO127"),
256 PINCTRL_PIN(GPIO128, "GPIO128"),
257 PINCTRL_PIN(GPIO129, "GPIO129"),
258 PINCTRL_PIN(GPIO130, "GPIO130"),
259 PINCTRL_PIN(GPIO131, "GPIO131"),
260 PINCTRL_PIN(GPIO132, "GPIO132"),
261 PINCTRL_PIN(GPIO133, "GPIO133"),
262 PINCTRL_PIN(GPIO134, "GPIO134"),
263 PINCTRL_PIN(GPIO135, "GPIO135"),
264 PINCTRL_PIN(GPIO136, "GPIO136"),
265 PINCTRL_PIN(GPIO137, "GPIO137"),
266 PINCTRL_PIN(GPIO138, "GPIO138"),
267 PINCTRL_PIN(GPIO139, "GPIO139"),
268 PINCTRL_PIN(GPIO140, "GPIO140"),
269 PINCTRL_PIN(GPIO141, "GPIO141"),
270 PINCTRL_PIN(GPIO142, "GPIO142"),
271 PINCTRL_PIN(GPIO143, "GPIO143"),
272 PINCTRL_PIN(GPIO144, "GPIO144"),
273 PINCTRL_PIN(GPIO145, "GPIO145"),
274 PINCTRL_PIN(GPIO146, "GPIO146"),
275 PINCTRL_PIN(GPIO147, "GPIO147"),
276 PINCTRL_PIN(GPIO148, "GPIO148"),
277 PINCTRL_PIN(GPIO149, "GPIO149"),
278 PINCTRL_PIN(GPIO150, "GPIO150"),
279 PINCTRL_PIN(GPIO151, "GPIO151"),
280 PINCTRL_PIN(GPIO152, "GPIO152"),
281 PINCTRL_PIN(GPIO153, "GPIO153"),
282 PINCTRL_PIN(GPIO154, "GPIO154"),
283 PINCTRL_PIN(GPIO155, "GPIO155"),
284 PINCTRL_PIN(GPIO156, "GPIO156"),
285 PINCTRL_PIN(GPIO157, "GPIO157"),
286 PINCTRL_PIN(GPIO158, "GPIO158"),
287 PINCTRL_PIN(GPIO159, "GPIO159"),
288 PINCTRL_PIN(GPIO160, "GPIO160"),
289 PINCTRL_PIN(GPIO161, "GPIO161"),
290 PINCTRL_PIN(GPIO162, "GPIO162"),
291 PINCTRL_PIN(GPIO163, "GPIO163"),
292 PINCTRL_PIN(GPIO164, "GPIO164"),
293 PINCTRL_PIN(GPIO165, "GPIO165"),
294 PINCTRL_PIN(GPIO166, "GPIO166"),
295 PINCTRL_PIN(GPIO167, "GPIO167"),
296 PINCTRL_PIN(GPIO168, "GPIO168"),
297 PINCTRL_PIN(TWSI4_SCL, "TWSI4_SCL"),
298 PINCTRL_PIN(TWSI4_SDA, "TWSI4_SDA"),
299 PINCTRL_PIN(G_CLKREQ, "G_CLKREQ"),
300 PINCTRL_PIN(VCXO_REQ, "VCXO_REQ"),
301 PINCTRL_PIN(VCXO_OUT, "VCXO_OUT"),
302};
303
304struct pxa3xx_mfp_pin mmp2_mfp[] = {
305 /* pin offs f0 f1 f2 f3 f4 f5 f6 f7 */
306 MFPR_MMP2(GPIO0, 0x054, GPIO, KP_MK, NONE, SPI, NONE, NONE, NONE, NONE),
307 MFPR_MMP2(GPIO1, 0x058, GPIO, KP_MK, NONE, SPI, NONE, NONE, NONE, NONE),
308 MFPR_MMP2(GPIO2, 0x05C, GPIO, KP_MK, NONE, SPI, NONE, NONE, NONE, NONE),
309 MFPR_MMP2(GPIO3, 0x060, GPIO, KP_MK, NONE, SPI, NONE, NONE, NONE, NONE),
310 MFPR_MMP2(GPIO4, 0x064, GPIO, KP_MK, NONE, NONE, NONE, NONE, NONE, NONE),
311 MFPR_MMP2(GPIO5, 0x068, GPIO, KP_MK, NONE, SPI, NONE, NONE, NONE, NONE),
312 MFPR_MMP2(GPIO6, 0x06C, GPIO, KP_MK, NONE, SPI, NONE, NONE, NONE, NONE),
313 MFPR_MMP2(GPIO7, 0x070, GPIO, KP_MK, NONE, SPI, NONE, NONE, NONE, NONE),
314 MFPR_MMP2(GPIO8, 0x074, GPIO, KP_MK, NONE, NONE, NONE, NONE, NONE, NONE),
315 MFPR_MMP2(GPIO9, 0x078, GPIO, KP_MK, NONE, NONE, NONE, NONE, NONE, NONE),
316 MFPR_MMP2(GPIO10, 0x07C, GPIO, KP_MK, NONE, NONE, NONE, NONE, NONE, NONE),
317 MFPR_MMP2(GPIO11, 0x080, GPIO, KP_MK, NONE, NONE, NONE, NONE, NONE, NONE),
318 MFPR_MMP2(GPIO12, 0x084, GPIO, KP_MK, NONE, CCIC1, NONE, NONE, NONE, NONE),
319 MFPR_MMP2(GPIO13, 0x088, GPIO, KP_MK, NONE, CCIC1, NONE, NONE, NONE, NONE),
320 MFPR_MMP2(GPIO14, 0x08C, GPIO, KP_MK, NONE, CCIC1, NONE, NONE, NONE, NONE),
321 MFPR_MMP2(GPIO15, 0x090, GPIO, KP_MK, KP_DK, CCIC1, NONE, NONE, NONE, NONE),
322 MFPR_MMP2(GPIO16, 0x094, GPIO, KP_DK, ROT, CCIC1, NONE, NONE, NONE, NONE),
323 MFPR_MMP2(GPIO17, 0x098, GPIO, KP_DK, ROT, CCIC1, NONE, NONE, NONE, NONE),
324 MFPR_MMP2(GPIO18, 0x09C, GPIO, KP_DK, ROT, CCIC1, NONE, NONE, NONE, NONE),
325 MFPR_MMP2(GPIO19, 0x0A0, GPIO, KP_DK, ROT, CCIC1, NONE, NONE, NONE, NONE),
326 MFPR_MMP2(GPIO20, 0x0A4, GPIO, KP_DK, TB, CCIC1, NONE, NONE, NONE, NONE),
327 MFPR_MMP2(GPIO21, 0x0A8, GPIO, KP_DK, TB, CCIC1, NONE, NONE, NONE, NONE),
328 MFPR_MMP2(GPIO22, 0x0AC, GPIO, KP_DK, TB, CCIC1, NONE, NONE, NONE, NONE),
329 MFPR_MMP2(GPIO23, 0x0B0, GPIO, KP_DK, TB, CCIC1, NONE, NONE, NONE, NONE),
330 MFPR_MMP2(GPIO24, 0x0B4, GPIO, I2S, VCXO_OUT, NONE, NONE, NONE, NONE, NONE),
331 MFPR_MMP2(GPIO25, 0x0B8, GPIO, I2S, HDMI, SSPA2, NONE, NONE, NONE, NONE),
332 MFPR_MMP2(GPIO26, 0x0BC, GPIO, I2S, HDMI, SSPA2, NONE, NONE, NONE, NONE),
333 MFPR_MMP2(GPIO27, 0x0C0, GPIO, I2S, HDMI, SSPA2, NONE, NONE, NONE, NONE),
334 MFPR_MMP2(GPIO28, 0x0C4, GPIO, I2S, NONE, SSPA2, NONE, NONE, NONE, NONE),
335 MFPR_MMP2(GPIO29, 0x0C8, GPIO, UART1, KP_MK, NONE, NONE, NONE, AAS_SPI, NONE),
336 MFPR_MMP2(GPIO30, 0x0CC, GPIO, UART1, KP_MK, NONE, NONE, NONE, AAS_SPI, NONE),
337 MFPR_MMP2(GPIO31, 0x0D0, GPIO, UART1, KP_MK, NONE, NONE, NONE, AAS_SPI, NONE),
338 MFPR_MMP2(GPIO32, 0x0D4, GPIO, UART1, KP_MK, NONE, NONE, NONE, AAS_SPI, NONE),
339 MFPR_MMP2(GPIO33, 0x0D8, GPIO, SSPA2, I2S, NONE, NONE, NONE, NONE, NONE),
340 MFPR_MMP2(GPIO34, 0x0DC, GPIO, SSPA2, I2S, NONE, NONE, NONE, NONE, NONE),
341 MFPR_MMP2(GPIO35, 0x0E0, GPIO, SSPA2, I2S, NONE, NONE, NONE, NONE, NONE),
342 MFPR_MMP2(GPIO36, 0x0E4, GPIO, SSPA2, I2S, NONE, NONE, NONE, NONE, NONE),
343 MFPR_MMP2(GPIO37, 0x0E8, GPIO, MMC2, SSP1, TWSI2, UART2, UART3, AAS_SPI, AAS_TWSI),
344 MFPR_MMP2(GPIO38, 0x0EC, GPIO, MMC2, SSP1, TWSI2, UART2, UART3, AAS_SPI, AAS_TWSI),
345 MFPR_MMP2(GPIO39, 0x0F0, GPIO, MMC2, SSP1, TWSI2, UART2, UART3, AAS_SPI, AAS_TWSI),
346 MFPR_MMP2(GPIO40, 0x0F4, GPIO, MMC2, SSP1, TWSI2, UART2, UART3, AAS_SPI, AAS_TWSI),
347 MFPR_MMP2(GPIO41, 0x0F8, GPIO, MMC2, TWSI5, NONE, NONE, NONE, NONE, NONE),
348 MFPR_MMP2(GPIO42, 0x0FC, GPIO, MMC2, TWSI5, NONE, NONE, NONE, NONE, NONE),
349 MFPR_MMP2(GPIO43, 0x100, GPIO, TWSI2, UART4, SSP1, UART2, UART3, NONE, AAS_TWSI),
350 MFPR_MMP2(GPIO44, 0x104, GPIO, TWSI2, UART4, SSP1, UART2, UART3, NONE, AAS_TWSI),
351 MFPR_MMP2(GPIO45, 0x108, GPIO, UART1, UART4, SSP1, UART2, UART3, NONE, NONE),
352 MFPR_MMP2(GPIO46, 0x10C, GPIO, UART1, UART4, SSP1, UART2, UART3, NONE, NONE),
353 MFPR_MMP2(GPIO47, 0x110, GPIO, UART2, SSP2, TWSI6, CAM2, AAS_SPI, AAS_GPIO, NONE),
354 MFPR_MMP2(GPIO48, 0x114, GPIO, UART2, SSP2, TWSI6, CAM2, AAS_SPI, AAS_GPIO, NONE),
355 MFPR_MMP2(GPIO49, 0x118, GPIO, UART2, SSP2, PWM, CCIC2, AAS_SPI, NONE, NONE),
356 MFPR_MMP2(GPIO50, 0x11C, GPIO, UART2, SSP2, PWM, CCIC2, AAS_SPI, NONE, NONE),
357 MFPR_MMP2(GPIO51, 0x120, GPIO, UART3, ROT, AAS_GPIO, PWM, NONE, NONE, NONE),
358 MFPR_MMP2(GPIO52, 0x124, GPIO, UART3, ROT, AAS_GPIO, PWM, NONE, NONE, NONE),
359 MFPR_MMP2(GPIO53, 0x128, GPIO, UART3, TWSI2, VCXO_REQ, NONE, PWM, NONE, AAS_TWSI),
360 MFPR_MMP2(GPIO54, 0x12C, GPIO, UART3, TWSI2, VCXO_OUT, HDMI, PWM, NONE, AAS_TWSI),
361 MFPR_MMP2(GPIO55, 0x130, GPIO, SSP2, SSP1, UART2, ROT, TWSI2, SSP3, AAS_TWSI),
362 MFPR_MMP2(GPIO56, 0x134, GPIO, SSP2, SSP1, UART2, ROT, TWSI2, KP_DK, AAS_TWSI),
363 MFPR_MMP2(GPIO57, 0x138, GPIO, SSP2_RX, SSP1_TXRX, SSP2_FRM, SSP1_RX, VCXO_REQ, KP_DK, NONE),
364 MFPR_MMP2(GPIO58, 0x13C, GPIO, SSP2, SSP1_RX, SSP1_FRM, SSP1_TXRX, VCXO_REQ, KP_DK, NONE),
365 MFPR_MMP2(GPIO59, 0x280, GPIO, CCIC1, ULPI, MMC3, CCIC2, UART3, UART4, NONE),
366 MFPR_MMP2(GPIO60, 0x284, GPIO, CCIC1, ULPI, MMC3, CCIC2, UART3, UART4, NONE),
367 MFPR_MMP2(GPIO61, 0x288, GPIO, CCIC1, ULPI, MMC3, CCIC2, UART3, HDMI, NONE),
368 MFPR_MMP2(GPIO62, 0x28C, GPIO, CCIC1, ULPI, MMC3, CCIC2, UART3, NONE, NONE),
369 MFPR_MMP2(GPIO63, 0x290, GPIO, CCIC1, ULPI, MMC3, CCIC2, MSP, UART4, NONE),
370 MFPR_MMP2(GPIO64, 0x294, GPIO, CCIC1, ULPI, MMC3, CCIC2, MSP, UART4, NONE),
371 MFPR_MMP2(GPIO65, 0x298, GPIO, CCIC1, ULPI, MMC3, CCIC2, MSP, UART4, NONE),
372 MFPR_MMP2(GPIO66, 0x29C, GPIO, CCIC1, ULPI, MMC3, CCIC2, MSP, UART4, NONE),
373 MFPR_MMP2(GPIO67, 0x2A0, GPIO, CCIC1, ULPI, MMC3, CCIC2, MSP, NONE, NONE),
374 MFPR_MMP2(GPIO68, 0x2A4, GPIO, CCIC1, ULPI, MMC3, CCIC2, MSP, LCD, NONE),
375 MFPR_MMP2(GPIO69, 0x2A8, GPIO, CCIC1, ULPI, MMC3, CCIC2, NONE, LCD, NONE),
376 MFPR_MMP2(GPIO70, 0x2AC, GPIO, CCIC1, ULPI, MMC3, CCIC2, MSP, LCD, NONE),
377 MFPR_MMP2(GPIO71, 0x2B0, GPIO, TWSI3, NONE, PWM, NONE, NONE, LCD, AAS_TWSI),
378 MFPR_MMP2(GPIO72, 0x2B4, GPIO, TWSI3, HDMI, PWM, NONE, NONE, LCD, AAS_TWSI),
379 MFPR_MMP2(GPIO73, 0x2B8, GPIO, VCXO_REQ, 32K_CLKOUT, PWM, VCXO_OUT, NONE, LCD, NONE),
380 MFPR_MMP2(GPIO74, 0x170, GPIO, LCD, SMC, MMC4, SSP3, UART2, UART4, TIPU),
381 MFPR_MMP2(GPIO75, 0x174, GPIO, LCD, SMC, MMC4, SSP3, UART2, UART4, TIPU),
382 MFPR_MMP2(GPIO76, 0x178, GPIO, LCD, SMC, MMC4, SSP3, UART2, UART4, TIPU),
383 MFPR_MMP2(GPIO77, 0x17C, GPIO, LCD, SMC, MMC4, SSP3, UART2, UART4, TIPU),
384 MFPR_MMP2(GPIO78, 0x180, GPIO, LCD, HDMI, MMC4, NONE, SSP4, AAS_SPI, TIPU),
385 MFPR_MMP2(GPIO79, 0x184, GPIO, LCD, AAS_GPIO, MMC4, NONE, SSP4, AAS_SPI, TIPU),
386 MFPR_MMP2(GPIO80, 0x188, GPIO, LCD, AAS_GPIO, MMC4, NONE, SSP4, AAS_SPI, TIPU),
387 MFPR_MMP2(GPIO81, 0x18C, GPIO, LCD, AAS_GPIO, MMC4, NONE, SSP4, AAS_SPI, TIPU),
388 MFPR_MMP2(GPIO82, 0x190, GPIO, LCD, NONE, MMC4, NONE, NONE, CCIC2, TIPU),
389 MFPR_MMP2(GPIO83, 0x194, GPIO, LCD, NONE, MMC4, NONE, NONE, CCIC2, TIPU),
390 MFPR_MMP2(GPIO84, 0x198, GPIO, LCD, SMC, MMC2, NONE, TWSI5, AAS_TWSI, TIPU),
391 MFPR_MMP2(GPIO85, 0x19C, GPIO, LCD, SMC, MMC2, NONE, TWSI5, AAS_TWSI, TIPU),
392 MFPR_MMP2(GPIO86, 0x1A0, GPIO, LCD, SMC, MMC2, NONE, TWSI6, CCIC2, TIPU),
393 MFPR_MMP2(GPIO87, 0x1A4, GPIO, LCD, SMC, MMC2, NONE, TWSI6, CCIC2, TIPU),
394 MFPR_MMP2(GPIO88, 0x1A8, GPIO, LCD, AAS_GPIO, MMC2, NONE, NONE, CCIC2, TIPU),
395 MFPR_MMP2(GPIO89, 0x1AC, GPIO, LCD, AAS_GPIO, MMC2, NONE, NONE, CCIC2, TIPU),
396 MFPR_MMP2(GPIO90, 0x1B0, GPIO, LCD, AAS_GPIO, MMC2, NONE, NONE, CCIC2, TIPU),
397 MFPR_MMP2(GPIO91, 0x1B4, GPIO, LCD, AAS_GPIO, MMC2, NONE, NONE, CCIC2, TIPU),
398 MFPR_MMP2(GPIO92, 0x1B8, GPIO, LCD, AAS_GPIO, MMC2, NONE, NONE, CCIC2, TIPU),
399 MFPR_MMP2(GPIO93, 0x1BC, GPIO, LCD, AAS_GPIO, MMC2, NONE, NONE, CCIC2, TIPU),
400 MFPR_MMP2(GPIO94, 0x1C0, GPIO, LCD, AAS_GPIO, SPI, NONE, AAS_SPI, CCIC2, TIPU),
401 MFPR_MMP2(GPIO95, 0x1C4, GPIO, LCD, TWSI3, SPI, AAS_DEU_EX, AAS_SPI, CCIC2, TIPU),
402 MFPR_MMP2(GPIO96, 0x1C8, GPIO, LCD, TWSI3, SPI, AAS_DEU_EX, AAS_SPI, NONE, TIPU),
403 MFPR_MMP2(GPIO97, 0x1CC, GPIO, LCD, TWSI6, SPI, AAS_DEU_EX, AAS_SPI, NONE, TIPU),
404 MFPR_MMP2(GPIO98, 0x1D0, GPIO, LCD, TWSI6, SPI, ONE_WIRE, NONE, NONE, TIPU),
405 MFPR_MMP2(GPIO99, 0x1D4, GPIO, LCD, SMC, SPI, TWSI5, NONE, NONE, TIPU),
406 MFPR_MMP2(GPIO100, 0x1D8, GPIO, LCD, SMC, SPI, TWSI5, NONE, NONE, TIPU),
407 MFPR_MMP2(GPIO101, 0x1DC, GPIO, LCD, SMC, SPI, NONE, NONE, NONE, TIPU),
408 MFPR_MMP2(GPIO102, 0x000, USIM, GPIO, FSIC, KP_DK, LCD, NONE, NONE, NONE),
409 MFPR_MMP2(GPIO103, 0x004, USIM, GPIO, FSIC, KP_DK, LCD, NONE, NONE, NONE),
410 MFPR_MMP2(GPIO104, 0x1FC, NAND, GPIO, NONE, NONE, NAND, NONE, NONE, NONE),
411 MFPR_MMP2(GPIO105, 0x1F8, NAND, GPIO, NONE, NONE, NAND, NONE, NONE, NONE),
412 MFPR_MMP2(GPIO106, 0x1F4, NAND, GPIO, NONE, NONE, NAND, NONE, NONE, NONE),
413 MFPR_MMP2(GPIO107, 0x1F0, NAND, GPIO, NONE, NONE, NAND, NONE, NONE, NONE),
414 MFPR_MMP2(GPIO108, 0x21C, NAND, GPIO, NONE, NONE, NAND, NONE, NONE, NONE),
415 MFPR_MMP2(GPIO109, 0x218, NAND, GPIO, NONE, NONE, NAND, NONE, NONE, NONE),
416 MFPR_MMP2(GPIO110, 0x214, NAND, GPIO, NONE, NONE, NAND, NONE, NONE, NONE),
417 MFPR_MMP2(GPIO111, 0x200, NAND, GPIO, MMC3, NONE, NONE, NONE, NONE, NONE),
418 MFPR_MMP2(GPIO112, 0x244, NAND, GPIO, MMC3, SMC, NONE, NONE, NONE, NONE),
419 MFPR_MMP2(GPIO113, 0x25C, SMC, GPIO, EXT_DMA, MMC3, SMC, HDMI, NONE, NONE),
420 MFPR_MMP2(GPIO114, 0x164, G_CLKOUT, 32K_CLKOUT, HDMI, NONE, NONE, NONE, NONE, NONE),
421 MFPR_MMP2(GPIO115, 0x260, GPIO, NONE, AC, UART4, UART3, SSP1, NONE, NONE),
422 MFPR_MMP2(GPIO116, 0x264, GPIO, NONE, AC, UART4, UART3, SSP1, NONE, NONE),
423 MFPR_MMP2(GPIO117, 0x268, GPIO, NONE, AC, UART4, UART3, SSP1, NONE, NONE),
424 MFPR_MMP2(GPIO118, 0x26C, GPIO, NONE, AC, UART4, UART3, SSP1, NONE, NONE),
425 MFPR_MMP2(GPIO119, 0x270, GPIO, NONE, CA, SSP3, NONE, NONE, NONE, NONE),
426 MFPR_MMP2(GPIO120, 0x274, GPIO, NONE, CA, SSP3, NONE, NONE, NONE, NONE),
427 MFPR_MMP2(GPIO121, 0x278, GPIO, NONE, CA, SSP3, NONE, NONE, NONE, NONE),
428 MFPR_MMP2(GPIO122, 0x27C, GPIO, NONE, CA, SSP3, NONE, NONE, NONE, NONE),
429 MFPR_MMP2(GPIO123, 0x148, GPIO, SLEEP_IND, ONE_WIRE, 32K_CLKOUT, NONE, NONE, NONE, NONE),
430 MFPR_MMP2(GPIO124, 0x00C, GPIO, MMC1, LCD, MMC3, NAND, NONE, NONE, NONE),
431 MFPR_MMP2(GPIO125, 0x010, GPIO, MMC1, LCD, MMC3, NAND, NONE, NONE, NONE),
432 MFPR_MMP2(GPIO126, 0x014, GPIO, MMC1, LCD, MMC3, NAND, NONE, NONE, NONE),
433 MFPR_MMP2(GPIO127, 0x018, GPIO, NONE, LCD, MMC3, NAND, NONE, NONE, NONE),
434 MFPR_MMP2(GPIO128, 0x01C, GPIO, NONE, LCD, MMC3, NAND, NONE, NONE, NONE),
435 MFPR_MMP2(GPIO129, 0x020, GPIO, MMC1, LCD, MMC3, NAND, NONE, NONE, NONE),
436 MFPR_MMP2(GPIO130, 0x024, GPIO, MMC1, LCD, MMC3, NAND, NONE, NONE, NONE),
437 MFPR_MMP2(GPIO131, 0x028, GPIO, MMC1, NONE, MSP, NONE, NONE, NONE, NONE),
438 MFPR_MMP2(GPIO132, 0x02C, GPIO, MMC1, PRI_JTAG, MSP, SSP3, AAS_JTAG, NONE, NONE),
439 MFPR_MMP2(GPIO133, 0x030, GPIO, MMC1, PRI_JTAG, MSP, SSP3, AAS_JTAG, NONE, NONE),
440 MFPR_MMP2(GPIO134, 0x034, GPIO, MMC1, PRI_JTAG, MSP, SSP3, AAS_JTAG, NONE, NONE),
441 MFPR_MMP2(GPIO135, 0x038, GPIO, NONE, LCD, MMC3, NAND, NONE, NONE, NONE),
442 MFPR_MMP2(GPIO136, 0x03C, GPIO, MMC1, PRI_JTAG, MSP, SSP3, AAS_JTAG, NONE, NONE),
443 MFPR_MMP2(GPIO137, 0x040, GPIO, HDMI, LCD, MSP, NONE, NONE, NONE, NONE),
444 MFPR_MMP2(GPIO138, 0x044, GPIO, NONE, LCD, MMC3, SMC, NONE, NONE, NONE),
445 MFPR_MMP2(GPIO139, 0x048, GPIO, MMC1, PRI_JTAG, MSP, NONE, AAS_JTAG, NONE, NONE),
446 MFPR_MMP2(GPIO140, 0x04C, GPIO, MMC1, LCD, NONE, NONE, UART2, UART1, NONE),
447 MFPR_MMP2(GPIO141, 0x050, GPIO, MMC1, LCD, NONE, NONE, UART2, UART1, NONE),
448 MFPR_MMP2(GPIO142, 0x008, USIM, GPIO, FSIC, KP_DK, NONE, NONE, NONE, NONE),
449 MFPR_MMP2(GPIO143, 0x220, NAND, GPIO, SMC, NONE, NAND, NONE, NONE, NONE),
450 MFPR_MMP2(GPIO144, 0x224, NAND, GPIO, SMC_INT, SMC, NAND, NONE, NONE, NONE),
451 MFPR_MMP2(GPIO145, 0x228, SMC, GPIO, NONE, NONE, SMC, NONE, NONE, NONE),
452 MFPR_MMP2(GPIO146, 0x22C, SMC, GPIO, NONE, NONE, SMC, NONE, NONE, NONE),
453 MFPR_MMP2(GPIO147, 0x230, NAND, GPIO, NONE, NONE, NAND, NONE, NONE, NONE),
454 MFPR_MMP2(GPIO148, 0x234, NAND, GPIO, NONE, NONE, NAND, NONE, NONE, NONE),
455 MFPR_MMP2(GPIO149, 0x238, NAND, GPIO, NONE, NONE, NONE, NONE, NONE, NONE),
456 MFPR_MMP2(GPIO150, 0x23C, NAND, GPIO, NONE, NONE, NAND, NONE, NONE, NONE),
457 MFPR_MMP2(GPIO151, 0x240, SMC, GPIO, MMC3, NONE, NONE, NONE, NONE, NONE),
458 MFPR_MMP2(GPIO152, 0x248, SMC, GPIO, NONE, NONE, SMC, NONE, NONE, NONE),
459 MFPR_MMP2(GPIO153, 0x24C, SMC, GPIO, NONE, NONE, SMC, NONE, NONE, NONE),
460 MFPR_MMP2(GPIO154, 0x254, SMC_INT, GPIO, SMC, NONE, NAND, NONE, NONE, NONE),
461 MFPR_MMP2(GPIO155, 0x258, EXT_DMA, GPIO, SMC, NONE, EXT_DMA, NONE, NONE, NONE),
462 MFPR_MMP2(GPIO156, 0x14C, PRI_JTAG, GPIO, PWM, NONE, NONE, NONE, NONE, NONE),
463 MFPR_MMP2(GPIO157, 0x150, PRI_JTAG, GPIO, PWM, NONE, NONE, NONE, NONE, NONE),
464 MFPR_MMP2(GPIO158, 0x154, PRI_JTAG, GPIO, PWM, NONE, NONE, NONE, NONE, NONE),
465 MFPR_MMP2(GPIO159, 0x158, PRI_JTAG, GPIO, PWM, NONE, NONE, NONE, NONE, NONE),
466 MFPR_MMP2(GPIO160, 0x250, NAND, GPIO, SMC, NONE, NAND, NONE, NONE, NONE),
467 MFPR_MMP2(GPIO161, 0x210, NAND, GPIO, NONE, NONE, NAND, NONE, NONE, NONE),
468 MFPR_MMP2(GPIO162, 0x20C, NAND, GPIO, MMC3, NONE, NONE, NONE, NONE, NONE),
469 MFPR_MMP2(GPIO163, 0x208, NAND, GPIO, MMC3, NONE, NONE, NONE, NONE, NONE),
470 MFPR_MMP2(GPIO164, 0x204, NAND, GPIO, MMC3, NONE, NONE, NONE, NONE, NONE),
471 MFPR_MMP2(GPIO165, 0x1EC, NAND, GPIO, MMC3, NONE, NONE, NONE, NONE, NONE),
472 MFPR_MMP2(GPIO166, 0x1E8, NAND, GPIO, MMC3, NONE, NONE, NONE, NONE, NONE),
473 MFPR_MMP2(GPIO167, 0x1E4, NAND, GPIO, MMC3, NONE, NONE, NONE, NONE, NONE),
474 MFPR_MMP2(GPIO168, 0x1E0, NAND, GPIO, MMC3, NONE, NONE, NONE, NONE, NONE),
475 MFPR_MMP2(TWSI4_SCL, 0x2BC, TWSI4, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
476 MFPR_MMP2(TWSI4_SDA, 0x2C0, TWSI4, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
477 MFPR_MMP2(G_CLKREQ, 0x160, G_CLKREQ, ONE_WIRE, NONE, NONE, NONE, NONE, NONE, NONE),
478 MFPR_MMP2(VCXO_REQ, 0x168, VCXO_REQ, ONE_WIRE, PLL, NONE, NONE, NONE, NONE, NONE),
479 MFPR_MMP2(VCXO_OUT, 0x16C, VCXO_OUT, 32K_CLKOUT, NONE, NONE, NONE, NONE, NONE, NONE),
480};
481
482static const unsigned mmp2_uart1_pin1[] = {GPIO29, GPIO30, GPIO31, GPIO32};
483static const unsigned mmp2_uart1_pin2[] = {GPIO45, GPIO46};
484static const unsigned mmp2_uart1_pin3[] = {GPIO140, GPIO141};
485static const unsigned mmp2_uart2_pin1[] = {GPIO37, GPIO38, GPIO39, GPIO40};
486static const unsigned mmp2_uart2_pin2[] = {GPIO43, GPIO44, GPIO45, GPIO46};
487static const unsigned mmp2_uart2_pin3[] = {GPIO47, GPIO48, GPIO49, GPIO50};
488static const unsigned mmp2_uart2_pin4[] = {GPIO74, GPIO75, GPIO76, GPIO77};
489static const unsigned mmp2_uart2_pin5[] = {GPIO55, GPIO56};
490static const unsigned mmp2_uart2_pin6[] = {GPIO140, GPIO141};
491static const unsigned mmp2_uart3_pin1[] = {GPIO37, GPIO38, GPIO39, GPIO40};
492static const unsigned mmp2_uart3_pin2[] = {GPIO43, GPIO44, GPIO45, GPIO46};
493static const unsigned mmp2_uart3_pin3[] = {GPIO51, GPIO52, GPIO53, GPIO54};
494static const unsigned mmp2_uart3_pin4[] = {GPIO59, GPIO60, GPIO61, GPIO62};
495static const unsigned mmp2_uart3_pin5[] = {GPIO115, GPIO116, GPIO117, GPIO118};
496static const unsigned mmp2_uart3_pin6[] = {GPIO51, GPIO52};
497static const unsigned mmp2_uart4_pin1[] = {GPIO43, GPIO44, GPIO45, GPIO46};
498static const unsigned mmp2_uart4_pin2[] = {GPIO63, GPIO64, GPIO65, GPIO66};
499static const unsigned mmp2_uart4_pin3[] = {GPIO74, GPIO75, GPIO76, GPIO77};
500static const unsigned mmp2_uart4_pin4[] = {GPIO115, GPIO116, GPIO117, GPIO118};
501static const unsigned mmp2_uart4_pin5[] = {GPIO59, GPIO60};
502static const unsigned mmp2_kpdk_pin1[] = {GPIO16, GPIO17, GPIO18, GPIO19};
503static const unsigned mmp2_kpdk_pin2[] = {GPIO16, GPIO17};
504static const unsigned mmp2_twsi2_pin1[] = {GPIO37, GPIO38};
505static const unsigned mmp2_twsi2_pin2[] = {GPIO39, GPIO40};
506static const unsigned mmp2_twsi2_pin3[] = {GPIO43, GPIO44};
507static const unsigned mmp2_twsi2_pin4[] = {GPIO53, GPIO54};
508static const unsigned mmp2_twsi2_pin5[] = {GPIO55, GPIO56};
509static const unsigned mmp2_twsi3_pin1[] = {GPIO71, GPIO72};
510static const unsigned mmp2_twsi3_pin2[] = {GPIO95, GPIO96};
511static const unsigned mmp2_twsi4_pin1[] = {TWSI4_SCL, TWSI4_SDA};
512static const unsigned mmp2_twsi5_pin1[] = {GPIO41, GPIO42};
513static const unsigned mmp2_twsi5_pin2[] = {GPIO84, GPIO85};
514static const unsigned mmp2_twsi5_pin3[] = {GPIO99, GPIO100};
515static const unsigned mmp2_twsi6_pin1[] = {GPIO47, GPIO48};
516static const unsigned mmp2_twsi6_pin2[] = {GPIO86, GPIO87};
517static const unsigned mmp2_twsi6_pin3[] = {GPIO97, GPIO98};
518static const unsigned mmp2_ccic1_pin1[] = {GPIO12, GPIO13, GPIO14, GPIO15,
519 GPIO16, GPIO17, GPIO18, GPIO19, GPIO20, GPIO21, GPIO22, GPIO23};
520static const unsigned mmp2_ccic1_pin2[] = {GPIO59, GPIO60, GPIO61, GPIO62,
521 GPIO63, GPIO64, GPIO65, GPIO66, GPIO67, GPIO68, GPIO69, GPIO70};
522static const unsigned mmp2_ccic2_pin1[] = {GPIO59, GPIO60, GPIO61, GPIO62,
523 GPIO63, GPIO64, GPIO65, GPIO66, GPIO67, GPIO68, GPIO69, GPIO70};
524static const unsigned mmp2_ccic2_pin2[] = {GPIO82, GPIO83, GPIO86, GPIO87,
525 GPIO88, GPIO89, GPIO90, GPIO91, GPIO92, GPIO93, GPIO94, GPIO95};
526static const unsigned mmp2_ulpi_pin1[] = {GPIO59, GPIO60, GPIO61, GPIO62,
527 GPIO63, GPIO64, GPIO65, GPIO66, GPIO67, GPIO68, GPIO69, GPIO70};
528static const unsigned mmp2_ro_pin1[] = {GPIO16, GPIO17};
529static const unsigned mmp2_ro_pin2[] = {GPIO18, GPIO19};
530static const unsigned mmp2_ro_pin3[] = {GPIO51, GPIO52};
531static const unsigned mmp2_ro_pin4[] = {GPIO55, GPIO56};
532static const unsigned mmp2_i2s_pin1[] = {GPIO24, GPIO25, GPIO26, GPIO27,
533 GPIO28};
534static const unsigned mmp2_i2s_pin2[] = {GPIO33, GPIO34, GPIO35, GPIO36};
535static const unsigned mmp2_ssp1_pin1[] = {GPIO37, GPIO38, GPIO39, GPIO40};
536static const unsigned mmp2_ssp1_pin2[] = {GPIO43, GPIO44, GPIO45, GPIO46};
537static const unsigned mmp2_ssp1_pin3[] = {GPIO115, GPIO116, GPIO117, GPIO118};
538static const unsigned mmp2_ssp2_pin1[] = {GPIO47, GPIO48, GPIO49, GPIO50};
539static const unsigned mmp2_ssp3_pin1[] = {GPIO119, GPIO120, GPIO121, GPIO122};
540static const unsigned mmp2_ssp3_pin2[] = {GPIO132, GPIO133, GPIO133, GPIO136};
541static const unsigned mmp2_sspa2_pin1[] = {GPIO25, GPIO26, GPIO27, GPIO28};
542static const unsigned mmp2_sspa2_pin2[] = {GPIO33, GPIO34, GPIO35, GPIO36};
543static const unsigned mmp2_mmc1_pin1[] = {GPIO131, GPIO132, GPIO133, GPIO134,
544 GPIO136, GPIO139, GPIO140, GPIO141};
545static const unsigned mmp2_mmc2_pin1[] = {GPIO37, GPIO38, GPIO39, GPIO40,
546 GPIO41, GPIO42};
547static const unsigned mmp2_mmc3_pin1[] = {GPIO111, GPIO112, GPIO151, GPIO162,
548 GPIO163, GPIO164, GPIO165, GPIO166, GPIO167, GPIO168};
549
550static struct pxa3xx_pin_group mmp2_grps[] = {
551 GRP_MMP2("uart1 4p1", UART1, mmp2_uart1_pin1),
552 GRP_MMP2("uart1 2p2", UART1, mmp2_uart1_pin2),
553 GRP_MMP2("uart1 2p3", UART1, mmp2_uart1_pin3),
554 GRP_MMP2("uart2 4p1", UART2, mmp2_uart2_pin1),
555 GRP_MMP2("uart2 4p2", UART2, mmp2_uart2_pin2),
556 GRP_MMP2("uart2 4p3", UART2, mmp2_uart2_pin3),
557 GRP_MMP2("uart2 4p4", UART2, mmp2_uart2_pin4),
558 GRP_MMP2("uart2 2p5", UART2, mmp2_uart2_pin5),
559 GRP_MMP2("uart2 2p6", UART2, mmp2_uart2_pin6),
560 GRP_MMP2("uart3 4p1", UART3, mmp2_uart3_pin1),
561 GRP_MMP2("uart3 4p2", UART3, mmp2_uart3_pin2),
562 GRP_MMP2("uart3 4p3", UART3, mmp2_uart3_pin3),
563 GRP_MMP2("uart3 4p4", UART3, mmp2_uart3_pin4),
564 GRP_MMP2("uart3 4p5", UART3, mmp2_uart3_pin5),
565 GRP_MMP2("uart3 2p6", UART3, mmp2_uart3_pin6),
566 GRP_MMP2("uart4 4p1", UART4, mmp2_uart4_pin1),
567 GRP_MMP2("uart4 4p2", UART4, mmp2_uart4_pin2),
568 GRP_MMP2("uart4 4p3", UART4, mmp2_uart4_pin3),
569 GRP_MMP2("uart4 4p4", UART4, mmp2_uart4_pin4),
570 GRP_MMP2("uart4 2p5", UART4, mmp2_uart4_pin5),
571 GRP_MMP2("kpdk 4p1", KP_DK, mmp2_kpdk_pin1),
572 GRP_MMP2("kpdk 4p2", KP_DK, mmp2_kpdk_pin2),
573 GRP_MMP2("twsi2-1", TWSI2, mmp2_twsi2_pin1),
574 GRP_MMP2("twsi2-2", TWSI2, mmp2_twsi2_pin2),
575 GRP_MMP2("twsi2-3", TWSI2, mmp2_twsi2_pin3),
576 GRP_MMP2("twsi2-4", TWSI2, mmp2_twsi2_pin4),
577 GRP_MMP2("twsi2-5", TWSI2, mmp2_twsi2_pin5),
578 GRP_MMP2("twsi3-1", TWSI3, mmp2_twsi3_pin1),
579 GRP_MMP2("twsi3-2", TWSI3, mmp2_twsi3_pin2),
580 GRP_MMP2("twsi4", TWSI4, mmp2_twsi4_pin1),
581 GRP_MMP2("twsi5-1", TWSI5, mmp2_twsi5_pin1),
582 GRP_MMP2("twsi5-2", TWSI5, mmp2_twsi5_pin2),
583 GRP_MMP2("twsi5-3", TWSI5, mmp2_twsi5_pin3),
584 GRP_MMP2("twsi6-1", TWSI6, mmp2_twsi6_pin1),
585 GRP_MMP2("twsi6-2", TWSI6, mmp2_twsi6_pin2),
586 GRP_MMP2("twsi6-3", TWSI6, mmp2_twsi6_pin3),
587 GRP_MMP2("ccic1-1", CCIC1, mmp2_ccic1_pin1),
588 GRP_MMP2("ccic1-2", CCIC1, mmp2_ccic1_pin2),
589 GRP_MMP2("ccic2-1", CCIC2, mmp2_ccic2_pin1),
590 GRP_MMP2("ccic2-1", CCIC2, mmp2_ccic2_pin2),
591 GRP_MMP2("ulpi", ULPI, mmp2_ulpi_pin1),
592 GRP_MMP2("ro-1", ROT, mmp2_ro_pin1),
593 GRP_MMP2("ro-2", ROT, mmp2_ro_pin2),
594 GRP_MMP2("ro-3", ROT, mmp2_ro_pin3),
595 GRP_MMP2("ro-4", ROT, mmp2_ro_pin4),
596 GRP_MMP2("i2s 5p1", I2S, mmp2_i2s_pin1),
597 GRP_MMP2("i2s 4p2", I2S, mmp2_i2s_pin2),
598 GRP_MMP2("ssp1 4p1", SSP1, mmp2_ssp1_pin1),
599 GRP_MMP2("ssp1 4p2", SSP1, mmp2_ssp1_pin2),
600 GRP_MMP2("ssp1 4p3", SSP1, mmp2_ssp1_pin3),
601 GRP_MMP2("ssp2 4p1", SSP2, mmp2_ssp2_pin1),
602 GRP_MMP2("ssp3 4p1", SSP3, mmp2_ssp3_pin1),
603 GRP_MMP2("ssp3 4p2", SSP3, mmp2_ssp3_pin2),
604 GRP_MMP2("sspa2 4p1", SSPA2, mmp2_sspa2_pin1),
605 GRP_MMP2("sspa2 4p2", SSPA2, mmp2_sspa2_pin2),
606 GRP_MMP2("mmc1 8p1", MMC1, mmp2_mmc1_pin1),
607 GRP_MMP2("mmc2 6p1", MMC2, mmp2_mmc2_pin1),
608 GRP_MMP2("mmc3 10p1", MMC3, mmp2_mmc3_pin1),
609};
610
611static const char * const mmp2_uart1_grps[] = {"uart1 4p1", "uart1 2p2",
612 "uart1 2p3"};
613static const char * const mmp2_uart2_grps[] = {"uart2 4p1", "uart2 4p2",
614 "uart2 4p3", "uart2 4p4", "uart2 4p5", "uart2 4p6"};
615static const char * const mmp2_uart3_grps[] = {"uart3 4p1", "uart3 4p2",
616 "uart3 4p3", "uart3 4p4", "uart3 4p5", "uart3 2p6"};
617static const char * const mmp2_uart4_grps[] = {"uart4 4p1", "uart4 4p2",
618 "uart4 4p3", "uart4 4p4", "uart4 2p5"};
619static const char * const mmp2_kpdk_grps[] = {"kpdk 4p1", "kpdk 4p2"};
620static const char * const mmp2_twsi2_grps[] = {"twsi2-1", "twsi2-2",
621 "twsi2-3", "twsi2-4", "twsi2-5"};
622static const char * const mmp2_twsi3_grps[] = {"twsi3-1", "twsi3-2"};
623static const char * const mmp2_twsi4_grps[] = {"twsi4"};
624static const char * const mmp2_twsi5_grps[] = {"twsi5-1", "twsi5-2",
625 "twsi5-3"};
626static const char * const mmp2_twsi6_grps[] = {"twsi6-1", "twsi6-2",
627 "twsi6-3"};
628static const char * const mmp2_ccic1_grps[] = {"ccic1-1", "ccic1-2"};
629static const char * const mmp2_ccic2_grps[] = {"ccic2-1", "ccic2-2"};
630static const char * const mmp2_ulpi_grps[] = {"ulpi"};
631static const char * const mmp2_ro_grps[] = {"ro-1", "ro-2", "ro-3", "ro-4"};
632static const char * const mmp2_i2s_grps[] = {"i2s 5p1", "i2s 4p2"};
633static const char * const mmp2_ssp1_grps[] = {"ssp1 4p1", "ssp1 4p2",
634 "ssp1 4p3"};
635static const char * const mmp2_ssp2_grps[] = {"ssp2 4p1"};
636static const char * const mmp2_ssp3_grps[] = {"ssp3 4p1", "ssp3 4p2"};
637static const char * const mmp2_sspa2_grps[] = {"sspa2 4p1", "sspa2 4p2"};
638static const char * const mmp2_mmc1_grps[] = {"mmc1 8p1"};
639static const char * const mmp2_mmc2_grps[] = {"mmc2 6p1"};
640static const char * const mmp2_mmc3_grps[] = {"mmc3 10p1"};
641
642static struct pxa3xx_pmx_func mmp2_funcs[] = {
643 {"uart1", ARRAY_AND_SIZE(mmp2_uart1_grps)},
644 {"uart2", ARRAY_AND_SIZE(mmp2_uart2_grps)},
645 {"uart3", ARRAY_AND_SIZE(mmp2_uart3_grps)},
646 {"uart4", ARRAY_AND_SIZE(mmp2_uart4_grps)},
647 {"kpdk", ARRAY_AND_SIZE(mmp2_kpdk_grps)},
648 {"twsi2", ARRAY_AND_SIZE(mmp2_twsi2_grps)},
649 {"twsi3", ARRAY_AND_SIZE(mmp2_twsi3_grps)},
650 {"twsi4", ARRAY_AND_SIZE(mmp2_twsi4_grps)},
651 {"twsi5", ARRAY_AND_SIZE(mmp2_twsi5_grps)},
652 {"twsi6", ARRAY_AND_SIZE(mmp2_twsi6_grps)},
653 {"ccic1", ARRAY_AND_SIZE(mmp2_ccic1_grps)},
654 {"ccic2", ARRAY_AND_SIZE(mmp2_ccic2_grps)},
655 {"ulpi", ARRAY_AND_SIZE(mmp2_ulpi_grps)},
656 {"ro", ARRAY_AND_SIZE(mmp2_ro_grps)},
657 {"i2s", ARRAY_AND_SIZE(mmp2_i2s_grps)},
658 {"ssp1", ARRAY_AND_SIZE(mmp2_ssp1_grps)},
659 {"ssp2", ARRAY_AND_SIZE(mmp2_ssp2_grps)},
660 {"ssp3", ARRAY_AND_SIZE(mmp2_ssp3_grps)},
661 {"sspa2", ARRAY_AND_SIZE(mmp2_sspa2_grps)},
662 {"mmc1", ARRAY_AND_SIZE(mmp2_mmc1_grps)},
663 {"mmc2", ARRAY_AND_SIZE(mmp2_mmc2_grps)},
664 {"mmc3", ARRAY_AND_SIZE(mmp2_mmc3_grps)},
665};
666
667static struct pinctrl_desc mmp2_pctrl_desc = {
668 .name = "mmp2-pinctrl",
669 .owner = THIS_MODULE,
670};
671
672static struct pxa3xx_pinmux_info mmp2_info = {
673 .mfp = mmp2_mfp,
674 .num_mfp = ARRAY_SIZE(mmp2_mfp),
675 .grps = mmp2_grps,
676 .num_grps = ARRAY_SIZE(mmp2_grps),
677 .funcs = mmp2_funcs,
678 .num_funcs = ARRAY_SIZE(mmp2_funcs),
679 .num_gpio = 169,
680 .desc = &mmp2_pctrl_desc,
681 .pads = mmp2_pads,
682 .num_pads = ARRAY_SIZE(mmp2_pads),
683
684 .cputype = PINCTRL_MMP2,
685 .ds_mask = MMP2_DS_MASK,
686 .ds_shift = MMP2_DS_SHIFT,
687};
688
689static int __devinit mmp2_pinmux_probe(struct platform_device *pdev)
690{
691 return pxa3xx_pinctrl_register(pdev, &mmp2_info);
692}
693
694static int __devexit mmp2_pinmux_remove(struct platform_device *pdev)
695{
696 return pxa3xx_pinctrl_unregister(pdev);
697}
698
699static struct platform_driver mmp2_pinmux_driver = {
700 .driver = {
701 .name = "mmp2-pinmux",
702 .owner = THIS_MODULE,
703 },
704 .probe = mmp2_pinmux_probe,
705 .remove = __devexit_p(mmp2_pinmux_remove),
706};
707
708static int __init mmp2_pinmux_init(void)
709{
710 return platform_driver_register(&mmp2_pinmux_driver);
711}
712core_initcall_sync(mmp2_pinmux_init);
713
714static void __exit mmp2_pinmux_exit(void)
715{
716 platform_driver_unregister(&mmp2_pinmux_driver);
717}
718module_exit(mmp2_pinmux_exit);
719
720MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>");
721MODULE_DESCRIPTION("PXA3xx pin control driver");
722MODULE_LICENSE("GPL v2");
diff --git a/drivers/pinctrl/pinctrl-pxa168.c b/drivers/pinctrl/pinctrl-pxa168.c
new file mode 100644
index 000000000000..c1997fa7f28c
--- /dev/null
+++ b/drivers/pinctrl/pinctrl-pxa168.c
@@ -0,0 +1,651 @@
1/*
2 * linux/drivers/pinctrl/pinmux-pxa168.c
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * publishhed by the Free Software Foundation.
7 *
8 * Copyright (C) 2011, Marvell Technology Group Ltd.
9 *
10 * Author: Haojian Zhuang <haojian.zhuang@marvell.com>
11 *
12 */
13
14#include <linux/device.h>
15#include <linux/module.h>
16#include <linux/io.h>
17#include <linux/platform_device.h>
18#include "pinctrl-pxa3xx.h"
19
20#define PXA168_DS_MASK 0x1800
21#define PXA168_DS_SHIFT 11
22#define PXA168_SLEEP_MASK 0x38
23#define PXA168_SLEEP_SELECT (1 << 9)
24#define PXA168_SLEEP_DATA (1 << 8)
25#define PXA168_SLEEP_DIR (1 << 7)
26
27#define MFPR_168(a, r, f0, f1, f2, f3, f4, f5, f6, f7) \
28 { \
29 .name = #a, \
30 .pin = a, \
31 .mfpr = r, \
32 .func = { \
33 PXA168_MUX_##f0, \
34 PXA168_MUX_##f1, \
35 PXA168_MUX_##f2, \
36 PXA168_MUX_##f3, \
37 PXA168_MUX_##f4, \
38 PXA168_MUX_##f5, \
39 PXA168_MUX_##f6, \
40 PXA168_MUX_##f7, \
41 }, \
42 }
43
44#define GRP_168(a, m, p) \
45 { .name = a, .mux = PXA168_MUX_##m, .pins = p, .npins = ARRAY_SIZE(p), }
46
47/* 131 pins */
48enum pxa168_pin_list {
49 /* 0~122: GPIO0~GPIO122 */
50 PWR_SCL = 123,
51 PWR_SDA,
52 TDI,
53 TMS,
54 TCK,
55 TDO,
56 TRST,
57 WAKEUP = 130,
58};
59
60enum pxa168_mux {
61 /* PXA3xx_MUX_GPIO = 0 (predefined in pinctrl-pxa3xx.h) */
62 PXA168_MUX_GPIO = 0,
63 PXA168_MUX_DFIO,
64 PXA168_MUX_NAND,
65 PXA168_MUX_SMC,
66 PXA168_MUX_SMC_CS0,
67 PXA168_MUX_SMC_CS1,
68 PXA168_MUX_SMC_INT,
69 PXA168_MUX_SMC_RDY,
70 PXA168_MUX_MMC1,
71 PXA168_MUX_MMC2,
72 PXA168_MUX_MMC2_CMD,
73 PXA168_MUX_MMC2_CLK,
74 PXA168_MUX_MMC3,
75 PXA168_MUX_MMC3_CMD,
76 PXA168_MUX_MMC3_CLK,
77 PXA168_MUX_MMC4,
78 PXA168_MUX_MSP,
79 PXA168_MUX_MSP_DAT3,
80 PXA168_MUX_MSP_INS,
81 PXA168_MUX_I2C,
82 PXA168_MUX_PWRI2C,
83 PXA168_MUX_AC97,
84 PXA168_MUX_AC97_SYSCLK,
85 PXA168_MUX_PWM,
86 PXA168_MUX_PWM1,
87 PXA168_MUX_XD,
88 PXA168_MUX_XP,
89 PXA168_MUX_LCD,
90 PXA168_MUX_CCIC,
91 PXA168_MUX_CF,
92 PXA168_MUX_CF_RDY,
93 PXA168_MUX_CF_nINPACK,
94 PXA168_MUX_CF_nWAIT,
95 PXA168_MUX_KP_MKOUT,
96 PXA168_MUX_KP_MKIN,
97 PXA168_MUX_KP_DK,
98 PXA168_MUX_ETH,
99 PXA168_MUX_ETH_TX,
100 PXA168_MUX_ETH_RX,
101 PXA168_MUX_ONE_WIRE,
102 PXA168_MUX_UART1,
103 PXA168_MUX_UART1_TX,
104 PXA168_MUX_UART1_CTS,
105 PXA168_MUX_UART1_nRI,
106 PXA168_MUX_UART1_DTR,
107 PXA168_MUX_UART2,
108 PXA168_MUX_UART2_TX,
109 PXA168_MUX_UART3,
110 PXA168_MUX_UART3_TX,
111 PXA168_MUX_UART3_CTS,
112 PXA168_MUX_SSP1,
113 PXA168_MUX_SSP1_TX,
114 PXA168_MUX_SSP2,
115 PXA168_MUX_SSP2_TX,
116 PXA168_MUX_SSP3,
117 PXA168_MUX_SSP3_TX,
118 PXA168_MUX_SSP4,
119 PXA168_MUX_SSP4_TX,
120 PXA168_MUX_SSP5,
121 PXA168_MUX_SSP5_TX,
122 PXA168_MUX_USB,
123 PXA168_MUX_JTAG,
124 PXA168_MUX_RESET,
125 PXA168_MUX_WAKEUP,
126 PXA168_MUX_EXT_32K_IN,
127 PXA168_MUX_NONE = 0xffff,
128};
129
130static struct pinctrl_pin_desc pxa168_pads[] = {
131 PINCTRL_PIN(GPIO0, "GPIO0"),
132 PINCTRL_PIN(GPIO1, "GPIO1"),
133 PINCTRL_PIN(GPIO2, "GPIO2"),
134 PINCTRL_PIN(GPIO3, "GPIO3"),
135 PINCTRL_PIN(GPIO4, "GPIO4"),
136 PINCTRL_PIN(GPIO5, "GPIO5"),
137 PINCTRL_PIN(GPIO6, "GPIO6"),
138 PINCTRL_PIN(GPIO7, "GPIO7"),
139 PINCTRL_PIN(GPIO8, "GPIO8"),
140 PINCTRL_PIN(GPIO9, "GPIO9"),
141 PINCTRL_PIN(GPIO10, "GPIO10"),
142 PINCTRL_PIN(GPIO11, "GPIO11"),
143 PINCTRL_PIN(GPIO12, "GPIO12"),
144 PINCTRL_PIN(GPIO13, "GPIO13"),
145 PINCTRL_PIN(GPIO14, "GPIO14"),
146 PINCTRL_PIN(GPIO15, "GPIO15"),
147 PINCTRL_PIN(GPIO16, "GPIO16"),
148 PINCTRL_PIN(GPIO17, "GPIO17"),
149 PINCTRL_PIN(GPIO18, "GPIO18"),
150 PINCTRL_PIN(GPIO19, "GPIO19"),
151 PINCTRL_PIN(GPIO20, "GPIO20"),
152 PINCTRL_PIN(GPIO21, "GPIO21"),
153 PINCTRL_PIN(GPIO22, "GPIO22"),
154 PINCTRL_PIN(GPIO23, "GPIO23"),
155 PINCTRL_PIN(GPIO24, "GPIO24"),
156 PINCTRL_PIN(GPIO25, "GPIO25"),
157 PINCTRL_PIN(GPIO26, "GPIO26"),
158 PINCTRL_PIN(GPIO27, "GPIO27"),
159 PINCTRL_PIN(GPIO28, "GPIO28"),
160 PINCTRL_PIN(GPIO29, "GPIO29"),
161 PINCTRL_PIN(GPIO30, "GPIO30"),
162 PINCTRL_PIN(GPIO31, "GPIO31"),
163 PINCTRL_PIN(GPIO32, "GPIO32"),
164 PINCTRL_PIN(GPIO33, "GPIO33"),
165 PINCTRL_PIN(GPIO34, "GPIO34"),
166 PINCTRL_PIN(GPIO35, "GPIO35"),
167 PINCTRL_PIN(GPIO36, "GPIO36"),
168 PINCTRL_PIN(GPIO37, "GPIO37"),
169 PINCTRL_PIN(GPIO38, "GPIO38"),
170 PINCTRL_PIN(GPIO39, "GPIO39"),
171 PINCTRL_PIN(GPIO40, "GPIO40"),
172 PINCTRL_PIN(GPIO41, "GPIO41"),
173 PINCTRL_PIN(GPIO42, "GPIO42"),
174 PINCTRL_PIN(GPIO43, "GPIO43"),
175 PINCTRL_PIN(GPIO44, "GPIO44"),
176 PINCTRL_PIN(GPIO45, "GPIO45"),
177 PINCTRL_PIN(GPIO46, "GPIO46"),
178 PINCTRL_PIN(GPIO47, "GPIO47"),
179 PINCTRL_PIN(GPIO48, "GPIO48"),
180 PINCTRL_PIN(GPIO49, "GPIO49"),
181 PINCTRL_PIN(GPIO50, "GPIO50"),
182 PINCTRL_PIN(GPIO51, "GPIO51"),
183 PINCTRL_PIN(GPIO52, "GPIO52"),
184 PINCTRL_PIN(GPIO53, "GPIO53"),
185 PINCTRL_PIN(GPIO54, "GPIO54"),
186 PINCTRL_PIN(GPIO55, "GPIO55"),
187 PINCTRL_PIN(GPIO56, "GPIO56"),
188 PINCTRL_PIN(GPIO57, "GPIO57"),
189 PINCTRL_PIN(GPIO58, "GPIO58"),
190 PINCTRL_PIN(GPIO59, "GPIO59"),
191 PINCTRL_PIN(GPIO60, "GPIO60"),
192 PINCTRL_PIN(GPIO61, "GPIO61"),
193 PINCTRL_PIN(GPIO62, "GPIO62"),
194 PINCTRL_PIN(GPIO63, "GPIO63"),
195 PINCTRL_PIN(GPIO64, "GPIO64"),
196 PINCTRL_PIN(GPIO65, "GPIO65"),
197 PINCTRL_PIN(GPIO66, "GPIO66"),
198 PINCTRL_PIN(GPIO67, "GPIO67"),
199 PINCTRL_PIN(GPIO68, "GPIO68"),
200 PINCTRL_PIN(GPIO69, "GPIO69"),
201 PINCTRL_PIN(GPIO70, "GPIO70"),
202 PINCTRL_PIN(GPIO71, "GPIO71"),
203 PINCTRL_PIN(GPIO72, "GPIO72"),
204 PINCTRL_PIN(GPIO73, "GPIO73"),
205 PINCTRL_PIN(GPIO74, "GPIO74"),
206 PINCTRL_PIN(GPIO75, "GPIO75"),
207 PINCTRL_PIN(GPIO76, "GPIO76"),
208 PINCTRL_PIN(GPIO77, "GPIO77"),
209 PINCTRL_PIN(GPIO78, "GPIO78"),
210 PINCTRL_PIN(GPIO79, "GPIO79"),
211 PINCTRL_PIN(GPIO80, "GPIO80"),
212 PINCTRL_PIN(GPIO81, "GPIO81"),
213 PINCTRL_PIN(GPIO82, "GPIO82"),
214 PINCTRL_PIN(GPIO83, "GPIO83"),
215 PINCTRL_PIN(GPIO84, "GPIO84"),
216 PINCTRL_PIN(GPIO85, "GPIO85"),
217 PINCTRL_PIN(GPIO86, "GPIO86"),
218 PINCTRL_PIN(GPIO87, "GPIO87"),
219 PINCTRL_PIN(GPIO88, "GPIO88"),
220 PINCTRL_PIN(GPIO89, "GPIO89"),
221 PINCTRL_PIN(GPIO90, "GPIO90"),
222 PINCTRL_PIN(GPIO91, "GPIO91"),
223 PINCTRL_PIN(GPIO92, "GPIO92"),
224 PINCTRL_PIN(GPIO93, "GPIO93"),
225 PINCTRL_PIN(GPIO94, "GPIO94"),
226 PINCTRL_PIN(GPIO95, "GPIO95"),
227 PINCTRL_PIN(GPIO96, "GPIO96"),
228 PINCTRL_PIN(GPIO97, "GPIO97"),
229 PINCTRL_PIN(GPIO98, "GPIO98"),
230 PINCTRL_PIN(GPIO99, "GPIO99"),
231 PINCTRL_PIN(GPIO100, "GPIO100"),
232 PINCTRL_PIN(GPIO101, "GPIO101"),
233 PINCTRL_PIN(GPIO102, "GPIO102"),
234 PINCTRL_PIN(GPIO103, "GPIO103"),
235 PINCTRL_PIN(GPIO104, "GPIO104"),
236 PINCTRL_PIN(GPIO105, "GPIO105"),
237 PINCTRL_PIN(GPIO106, "GPIO106"),
238 PINCTRL_PIN(GPIO107, "GPIO107"),
239 PINCTRL_PIN(GPIO108, "GPIO108"),
240 PINCTRL_PIN(GPIO109, "GPIO109"),
241 PINCTRL_PIN(GPIO110, "GPIO110"),
242 PINCTRL_PIN(GPIO111, "GPIO111"),
243 PINCTRL_PIN(GPIO112, "GPIO112"),
244 PINCTRL_PIN(GPIO113, "GPIO113"),
245 PINCTRL_PIN(GPIO114, "GPIO114"),
246 PINCTRL_PIN(GPIO115, "GPIO115"),
247 PINCTRL_PIN(GPIO116, "GPIO116"),
248 PINCTRL_PIN(GPIO117, "GPIO117"),
249 PINCTRL_PIN(GPIO118, "GPIO118"),
250 PINCTRL_PIN(GPIO119, "GPIO119"),
251 PINCTRL_PIN(GPIO120, "GPIO120"),
252 PINCTRL_PIN(GPIO121, "GPIO121"),
253 PINCTRL_PIN(GPIO122, "GPIO122"),
254 PINCTRL_PIN(PWR_SCL, "PWR_SCL"),
255 PINCTRL_PIN(PWR_SDA, "PWR_SDA"),
256 PINCTRL_PIN(TDI, "TDI"),
257 PINCTRL_PIN(TMS, "TMS"),
258 PINCTRL_PIN(TCK, "TCK"),
259 PINCTRL_PIN(TDO, "TDO"),
260 PINCTRL_PIN(TRST, "TRST"),
261 PINCTRL_PIN(WAKEUP, "WAKEUP"),
262};
263
264struct pxa3xx_mfp_pin pxa168_mfp[] = {
265 /* pin offs f0 f1 f2 f3 f4 f5 f6 f7 */
266 MFPR_168(GPIO0, 0x04C, DFIO, NONE, NONE, MSP, MMC3_CMD, GPIO, MMC3, NONE),
267 MFPR_168(GPIO1, 0x050, DFIO, NONE, NONE, MSP, MMC3_CLK, GPIO, MMC3, NONE),
268 MFPR_168(GPIO2, 0x054, DFIO, NONE, NONE, MSP, NONE, GPIO, MMC3, NONE),
269 MFPR_168(GPIO3, 0x058, DFIO, NONE, NONE, NONE, NONE, GPIO, MMC3, NONE),
270 MFPR_168(GPIO4, 0x05C, DFIO, NONE, NONE, MSP_DAT3, NONE, GPIO, MMC3, NONE),
271 MFPR_168(GPIO5, 0x060, DFIO, NONE, NONE, MSP, NONE, GPIO, MMC3, NONE),
272 MFPR_168(GPIO6, 0x064, DFIO, NONE, NONE, MSP, NONE, GPIO, MMC3, NONE),
273 MFPR_168(GPIO7, 0x068, DFIO, NONE, NONE, MSP, NONE, GPIO, MMC3, NONE),
274 MFPR_168(GPIO8, 0x06C, DFIO, MMC2, UART3_TX, NONE, MMC2_CMD, GPIO, MMC3_CLK, NONE),
275 MFPR_168(GPIO9, 0x070, DFIO, MMC2, UART3, NONE, MMC2_CLK, GPIO, MMC3_CMD, NONE),
276 MFPR_168(GPIO10, 0x074, DFIO, MMC2, UART3, NONE, NONE, GPIO, MSP_DAT3, NONE),
277 MFPR_168(GPIO11, 0x078, DFIO, MMC2, UART3, NONE, NONE, GPIO, MSP, NONE),
278 MFPR_168(GPIO12, 0x07C, DFIO, MMC2, UART3, NONE, NONE, GPIO, MSP, NONE),
279 MFPR_168(GPIO13, 0x080, DFIO, MMC2, UART3, NONE, NONE, GPIO, MSP, NONE),
280 MFPR_168(GPIO14, 0x084, DFIO, MMC2, NONE, NONE, NONE, GPIO, MSP, NONE),
281 MFPR_168(GPIO15, 0x088, DFIO, MMC2, NONE, NONE, NONE, GPIO, MSP, NONE),
282 MFPR_168(GPIO16, 0x08C, GPIO, NAND, SMC_CS0, SMC_CS1, NONE, NONE, MMC3, NONE),
283 MFPR_168(GPIO17, 0x090, NAND, NONE, NONE, NONE, NONE, GPIO, MSP, NONE),
284 MFPR_168(GPIO18, 0x094, GPIO, NAND, SMC_CS1, SMC_CS0, NONE, NONE, NONE, NONE),
285 MFPR_168(GPIO19, 0x098, SMC_CS0, NONE, NONE, CF, NONE, GPIO, NONE, NONE),
286 MFPR_168(GPIO20, 0x09C, GPIO, NONE, SMC_CS1, CF, CF_RDY, NONE, NONE, NONE),
287 MFPR_168(GPIO21, 0x0A0, NAND, MMC2_CLK, NONE, NONE, NONE, GPIO, NONE, NONE),
288 MFPR_168(GPIO22, 0x0A4, NAND, MMC2_CMD, NONE, NONE, NONE, GPIO, NONE, NONE),
289 MFPR_168(GPIO23, 0x0A8, SMC, NAND, NONE, CF, NONE, GPIO, NONE, NONE),
290 MFPR_168(GPIO24, 0x0AC, NAND, NONE, NONE, NONE, NONE, GPIO, NONE, NONE),
291 MFPR_168(GPIO25, 0x0B0, SMC, NAND, NONE, CF, NONE, GPIO, NONE, NONE),
292 MFPR_168(GPIO26, 0x0B4, GPIO, NAND, NONE, NONE, CF, NONE, NONE, NONE),
293 MFPR_168(GPIO27, 0x0B8, SMC_INT, NAND, SMC, NONE, SMC_RDY, GPIO, NONE, NONE),
294 MFPR_168(GPIO28, 0x0BC, SMC_RDY, MMC4, SMC, CF_RDY, NONE, GPIO, MMC2_CMD, NONE),
295 MFPR_168(GPIO29, 0x0C0, SMC, MMC4, NONE, CF, NONE, GPIO, MMC2_CLK, KP_DK),
296 MFPR_168(GPIO30, 0x0C4, SMC, MMC4, UART3_TX, CF, NONE, GPIO, MMC2, KP_DK),
297 MFPR_168(GPIO31, 0x0C8, SMC, MMC4, UART3, CF, NONE, GPIO, MMC2, KP_DK),
298 MFPR_168(GPIO32, 0x0CC, SMC, MMC4, UART3, CF, NONE, GPIO, MMC2, KP_DK),
299 MFPR_168(GPIO33, 0x0D0, SMC, MMC4, UART3, CF, CF_nINPACK, GPIO, MMC2, KP_DK),
300 MFPR_168(GPIO34, 0x0D4, GPIO, NONE, SMC_CS1, CF, CF_nWAIT, NONE, MMC3, KP_DK),
301 MFPR_168(GPIO35, 0x0D8, GPIO, NONE, SMC, CF_nINPACK, NONE, NONE, MMC3_CMD, KP_DK),
302 MFPR_168(GPIO36, 0x0DC, GPIO, NONE, SMC, CF_nWAIT, NONE, NONE, MMC3_CLK, KP_DK),
303 MFPR_168(GPIO37, 0x000, GPIO, MMC1, NONE, KP_MKOUT, CCIC, XP, KP_MKIN, KP_DK),
304 MFPR_168(GPIO38, 0x004, GPIO, MMC1, NONE, KP_MKOUT, CCIC, XP, KP_MKIN, KP_DK),
305 MFPR_168(GPIO39, 0x008, GPIO, NONE, NONE, KP_MKOUT, CCIC, XP, KP_MKIN, KP_DK),
306 MFPR_168(GPIO40, 0x00C, GPIO, MMC1, MSP, KP_MKOUT, CCIC, XP, KP_MKIN, KP_DK),
307 MFPR_168(GPIO41, 0x010, GPIO, MMC1, MSP, NONE, CCIC, XP, KP_MKIN, KP_DK),
308 MFPR_168(GPIO42, 0x014, GPIO, I2C, NONE, MSP, CCIC, XP, KP_MKIN, KP_DK),
309 MFPR_168(GPIO43, 0x018, GPIO, MMC1, MSP, MSP_INS, NONE, NONE, KP_MKIN, KP_DK),
310 MFPR_168(GPIO44, 0x01C, GPIO, MMC1, MSP_DAT3, MSP, CCIC, XP, KP_MKIN, KP_DK),
311 MFPR_168(GPIO45, 0x020, GPIO, NONE, NONE, MSP, CCIC, XP, NONE, KP_DK),
312 MFPR_168(GPIO46, 0x024, GPIO, MMC1, MSP_INS, MSP, CCIC, NONE, KP_MKOUT, KP_DK),
313 MFPR_168(GPIO47, 0x028, GPIO, NONE, NONE, MSP_INS, NONE, XP, NONE, KP_DK),
314 MFPR_168(GPIO48, 0x02C, GPIO, MMC1, NONE, MSP_DAT3, CCIC, NONE, NONE, KP_DK),
315 MFPR_168(GPIO49, 0x030, GPIO, MMC1, NONE, MSP, NONE, XD, KP_MKOUT, NONE),
316 MFPR_168(GPIO50, 0x034, GPIO, I2C, NONE, MSP, CCIC, XD, KP_MKOUT, NONE),
317 MFPR_168(GPIO51, 0x038, GPIO, MMC1, NONE, MSP, NONE, XD, KP_MKOUT, NONE),
318 MFPR_168(GPIO52, 0x03C, GPIO, MMC1, NONE, MSP, NONE, XD, KP_MKOUT, NONE),
319 MFPR_168(GPIO53, 0x040, GPIO, MMC1, NONE, NONE, NONE, XD, KP_MKOUT, NONE),
320 MFPR_168(GPIO54, 0x044, GPIO, MMC1, NONE, NONE, CCIC, XD, KP_MKOUT, NONE),
321 MFPR_168(GPIO55, 0x048, GPIO, NONE, NONE, MSP, CCIC, XD, KP_MKOUT, NONE),
322 MFPR_168(GPIO56, 0x0E0, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
323 MFPR_168(GPIO57, 0x0E4, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
324 MFPR_168(GPIO58, 0x0E8, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
325 MFPR_168(GPIO59, 0x0EC, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
326 MFPR_168(GPIO60, 0x0F0, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
327 MFPR_168(GPIO61, 0x0F4, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
328 MFPR_168(GPIO62, 0x0F8, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
329 MFPR_168(GPIO63, 0x0FC, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
330 MFPR_168(GPIO64, 0x100, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
331 MFPR_168(GPIO65, 0x104, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
332 MFPR_168(GPIO66, 0x108, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
333 MFPR_168(GPIO67, 0x10C, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
334 MFPR_168(GPIO68, 0x110, GPIO, LCD, NONE, XD, NONE, NONE, NONE, NONE),
335 MFPR_168(GPIO69, 0x114, GPIO, LCD, NONE, XD, NONE, NONE, NONE, NONE),
336 MFPR_168(GPIO70, 0x118, GPIO, LCD, NONE, XD, NONE, NONE, NONE, NONE),
337 MFPR_168(GPIO71, 0x11C, GPIO, LCD, NONE, XD, NONE, NONE, NONE, NONE),
338 MFPR_168(GPIO72, 0x120, GPIO, LCD, NONE, XD, NONE, NONE, NONE, NONE),
339 MFPR_168(GPIO73, 0x124, GPIO, LCD, NONE, XD, NONE, NONE, NONE, NONE),
340 MFPR_168(GPIO74, 0x128, GPIO, LCD, PWM, XD, NONE, NONE, NONE, NONE),
341 MFPR_168(GPIO75, 0x12C, GPIO, LCD, PWM, XD, ONE_WIRE, NONE, NONE, NONE),
342 MFPR_168(GPIO76, 0x130, GPIO, LCD, PWM, I2C, NONE, NONE, MSP_INS, NONE),
343 MFPR_168(GPIO77, 0x134, GPIO, LCD, PWM1, I2C, ONE_WIRE, NONE, XD, NONE),
344 MFPR_168(GPIO78, 0x138, GPIO, LCD, NONE, NONE, NONE, MMC4, NONE, NONE),
345 MFPR_168(GPIO79, 0x13C, GPIO, LCD, NONE, NONE, ONE_WIRE, MMC4, NONE, NONE),
346 MFPR_168(GPIO80, 0x140, GPIO, LCD, NONE, I2C, NONE, MMC4, NONE, NONE),
347 MFPR_168(GPIO81, 0x144, GPIO, LCD, NONE, I2C, ONE_WIRE, MMC4, NONE, NONE),
348 MFPR_168(GPIO82, 0x148, GPIO, LCD, PWM, NONE, NONE, MMC4, NONE, NONE),
349 MFPR_168(GPIO83, 0x14C, GPIO, LCD, PWM, NONE, RESET, MMC4, NONE, NONE),
350 MFPR_168(GPIO84, 0x150, GPIO, NONE, PWM, ONE_WIRE, PWM1, NONE, NONE, EXT_32K_IN),
351 MFPR_168(GPIO85, 0x154, GPIO, NONE, PWM1, NONE, NONE, NONE, NONE, USB),
352 MFPR_168(GPIO86, 0x158, GPIO, MMC2, UART2, NONE, JTAG, ETH_TX, SSP5_TX, SSP5),
353 MFPR_168(GPIO87, 0x15C, GPIO, MMC2, UART2, NONE, JTAG, ETH_TX, SSP5, SSP5_TX),
354 MFPR_168(GPIO88, 0x160, GPIO, MMC2, UART2, UART2_TX, JTAG, ETH_TX, ETH_RX, SSP5),
355 MFPR_168(GPIO89, 0x164, GPIO, MMC2, UART2_TX, UART2, JTAG, ETH_TX, ETH_RX, SSP5),
356 MFPR_168(GPIO90, 0x168, GPIO, MMC2, NONE, SSP3, JTAG, ETH_TX, ETH_RX, NONE),
357 MFPR_168(GPIO91, 0x16C, GPIO, MMC2, NONE, SSP3, SSP4, ETH_TX, ETH_RX, NONE),
358 MFPR_168(GPIO92, 0x170, GPIO, MMC2, NONE, SSP3, SSP3_TX, ETH, NONE, NONE),
359 MFPR_168(GPIO93, 0x174, GPIO, MMC2, NONE, SSP3_TX, SSP3, ETH, NONE, NONE),
360 MFPR_168(GPIO94, 0x178, GPIO, MMC2_CMD, SSP3, AC97_SYSCLK, AC97, ETH, NONE, NONE),
361 MFPR_168(GPIO95, 0x17C, GPIO, MMC2_CLK, NONE, NONE, AC97, ETH, NONE, NONE),
362 MFPR_168(GPIO96, 0x180, GPIO, PWM, NONE, MMC2, NONE, ETH_RX, ETH_TX, NONE),
363 MFPR_168(GPIO97, 0x184, GPIO, PWM, ONE_WIRE, NONE, NONE, ETH_RX, ETH_TX, NONE),
364 MFPR_168(GPIO98, 0x188, GPIO, PWM1, UART3_TX, UART3, NONE, ETH_RX, ETH_TX, NONE),
365 MFPR_168(GPIO99, 0x18C, GPIO, ONE_WIRE, UART3, UART3_TX, NONE, ETH_RX, ETH_TX, NONE),
366 MFPR_168(GPIO100, 0x190, GPIO, NONE, UART3_CTS, UART3, NONE, ETH, NONE, NONE),
367 MFPR_168(GPIO101, 0x194, GPIO, NONE, UART3, UART3_CTS, NONE, ETH, NONE, NONE),
368 MFPR_168(GPIO102, 0x198, GPIO, I2C, UART3, SSP4, NONE, NONE, NONE, NONE),
369 MFPR_168(GPIO103, 0x19C, GPIO, I2C, UART3, SSP4, SSP2, ETH, NONE, NONE),
370 MFPR_168(GPIO104, 0x1A0, GPIO, PWM, UART1, SSP4, SSP4_TX, AC97, KP_MKOUT, NONE),
371 MFPR_168(GPIO105, 0x1A4, GPIO, I2C, UART1, SSP4_TX, SSP4, AC97, KP_MKOUT, NONE),
372 MFPR_168(GPIO106, 0x1A8, GPIO, I2C, PWM1, AC97_SYSCLK, MMC2, NONE, KP_MKOUT, NONE),
373 MFPR_168(GPIO107, 0x1AC, GPIO, UART1_TX, UART1, NONE, SSP2, MSP_DAT3, NONE, KP_MKIN),
374 MFPR_168(GPIO108, 0x1B0, GPIO, UART1, UART1_TX, NONE, SSP2_TX, MSP, NONE, KP_MKIN),
375 MFPR_168(GPIO109, 0x1B4, GPIO, UART1_CTS, UART1, NONE, AC97_SYSCLK, MSP, NONE, KP_MKIN),
376 MFPR_168(GPIO110, 0x1B8, GPIO, UART1, UART1_CTS, NONE, SMC_RDY, MSP, NONE, KP_MKIN),
377 MFPR_168(GPIO111, 0x1BC, GPIO, UART1_nRI, UART1, SSP3, SSP2, MSP, XD, KP_MKOUT),
378 MFPR_168(GPIO112, 0x1C0, GPIO, UART1_DTR, UART1, ONE_WIRE, SSP2, MSP, XD, KP_MKOUT),
379 MFPR_168(GPIO113, 0x1C4, GPIO, NONE, NONE, NONE, NONE, NONE, AC97_SYSCLK, NONE),
380 MFPR_168(GPIO114, 0x1C8, GPIO, SSP1, NONE, NONE, NONE, NONE, AC97, NONE),
381 MFPR_168(GPIO115, 0x1CC, GPIO, SSP1, NONE, NONE, NONE, NONE, AC97, NONE),
382 MFPR_168(GPIO116, 0x1D0, GPIO, SSP1_TX, SSP1, NONE, NONE, NONE, AC97, NONE),
383 MFPR_168(GPIO117, 0x1D4, GPIO, SSP1, SSP1_TX, NONE, MMC2_CMD, NONE, AC97, NONE),
384 MFPR_168(GPIO118, 0x1D8, GPIO, SSP2, NONE, NONE, MMC2_CLK, NONE, AC97, KP_MKIN),
385 MFPR_168(GPIO119, 0x1DC, GPIO, SSP2, NONE, NONE, MMC2, NONE, AC97, KP_MKIN),
386 MFPR_168(GPIO120, 0x1E0, GPIO, SSP2, SSP2_TX, NONE, MMC2, NONE, NONE, KP_MKIN),
387 MFPR_168(GPIO121, 0x1E4, GPIO, SSP2_TX, SSP2, NONE, MMC2, NONE, NONE, KP_MKIN),
388 MFPR_168(GPIO122, 0x1E8, GPIO, AC97_SYSCLK, SSP2, PWM, MMC2, NONE, NONE, NONE),
389 MFPR_168(PWR_SCL, 0x1EC, PWRI2C, NONE, NONE, NONE, NONE, NONE, GPIO, MMC4),
390 MFPR_168(PWR_SDA, 0x1F0, PWRI2C, NONE, NONE, NONE, NONE, NONE, GPIO, NONE),
391 MFPR_168(TDI, 0x1F4, JTAG, PWM1, UART2, MMC4, SSP5, NONE, XD, MMC4),
392 MFPR_168(TMS, 0x1F8, JTAG, PWM, UART2, NONE, SSP5, NONE, XD, MMC4),
393 MFPR_168(TCK, 0x1FC, JTAG, PWM, UART2, UART2_TX, SSP5, NONE, XD, MMC4),
394 MFPR_168(TDO, 0x200, JTAG, PWM, UART2_TX, UART2, SSP5_TX, NONE, XD, MMC4),
395 MFPR_168(TRST, 0x204, JTAG, ONE_WIRE, SSP2, SSP3, AC97_SYSCLK, NONE, XD, MMC4),
396 MFPR_168(WAKEUP, 0x208, WAKEUP, ONE_WIRE, PWM1, PWM, SSP2, NONE, GPIO, MMC4),
397};
398
399static const unsigned p168_jtag_pin1[] = {TDI, TMS, TCK, TDO, TRST};
400static const unsigned p168_wakeup_pin1[] = {WAKEUP};
401static const unsigned p168_ssp1rx_pin1[] = {GPIO114, GPIO115, GPIO116};
402static const unsigned p168_ssp1tx_pin1[] = {GPIO117};
403static const unsigned p168_ssp4rx_pin1[] = {GPIO102, GPIO103, GPIO104};
404static const unsigned p168_ssp4tx_pin1[] = {GPIO105};
405static const unsigned p168_ssp5rx_pin1[] = {GPIO86, GPIO88, GPIO89};
406static const unsigned p168_ssp5tx_pin1[] = {GPIO87};
407static const unsigned p168_i2c_pin1[] = {GPIO105, GPIO106};
408static const unsigned p168_pwri2c_pin1[] = {PWR_SCL, PWR_SDA};
409static const unsigned p168_mmc1_pin1[] = {GPIO40, GPIO41, GPIO43, GPIO46,
410 GPIO49, GPIO51, GPIO52, GPIO53};
411static const unsigned p168_mmc2_data_pin1[] = {GPIO90, GPIO91, GPIO92, GPIO93};
412static const unsigned p168_mmc2_cmd_pin1[] = {GPIO94};
413static const unsigned p168_mmc2_clk_pin1[] = {GPIO95};
414static const unsigned p168_mmc3_data_pin1[] = {GPIO0, GPIO1, GPIO2, GPIO3,
415 GPIO4, GPIO5, GPIO6, GPIO7};
416static const unsigned p168_mmc3_cmd_pin1[] = {GPIO9};
417static const unsigned p168_mmc3_clk_pin1[] = {GPIO8};
418static const unsigned p168_eth_pin1[] = {GPIO92, GPIO93, GPIO100, GPIO101,
419 GPIO103};
420static const unsigned p168_ethtx_pin1[] = {GPIO86, GPIO87, GPIO88, GPIO89,
421 GPIO90, GPIO91};
422static const unsigned p168_ethrx_pin1[] = {GPIO94, GPIO95, GPIO96, GPIO97,
423 GPIO98, GPIO99};
424static const unsigned p168_uart1rx_pin1[] = {GPIO107};
425static const unsigned p168_uart1tx_pin1[] = {GPIO108};
426static const unsigned p168_uart3rx_pin1[] = {GPIO98, GPIO100, GPIO101};
427static const unsigned p168_uart3tx_pin1[] = {GPIO99};
428static const unsigned p168_msp_pin1[] = {GPIO40, GPIO41, GPIO42, GPIO43,
429 GPIO44, GPIO50};
430static const unsigned p168_ccic_pin1[] = {GPIO37, GPIO38, GPIO39, GPIO40,
431 GPIO41, GPIO42, GPIO44, GPIO45, GPIO46, GPIO48, GPIO54, GPIO55};
432static const unsigned p168_xd_pin1[] = {GPIO37, GPIO38, GPIO39, GPIO40,
433 GPIO41, GPIO42, GPIO44, GPIO45, GPIO47, GPIO48, GPIO49, GPIO50,
434 GPIO51, GPIO52};
435static const unsigned p168_lcd_pin1[] = {GPIO56, GPIO57, GPIO58, GPIO59,
436 GPIO60, GPIO61, GPIO62, GPIO63, GPIO64, GPIO65, GPIO66, GPIO67,
437 GPIO68, GPIO69, GPIO70, GPIO71, GPIO72, GPIO73, GPIO74, GPIO75,
438 GPIO76, GPIO77, GPIO78, GPIO79, GPIO80, GPIO81, GPIO82, GPIO83};
439static const unsigned p168_dfio_pin1[] = {GPIO0, GPIO1, GPIO2, GPIO3,
440 GPIO4, GPIO5, GPIO6, GPIO7, GPIO8, GPIO9, GPIO10, GPIO11, GPIO12,
441 GPIO13, GPIO14, GPIO15};
442static const unsigned p168_nand_pin1[] = {GPIO16, GPIO17, GPIO21, GPIO22,
443 GPIO24, GPIO26};
444static const unsigned p168_smc_pin1[] = {GPIO23, GPIO25, GPIO29, GPIO35,
445 GPIO36};
446static const unsigned p168_smccs0_pin1[] = {GPIO18};
447static const unsigned p168_smccs1_pin1[] = {GPIO34};
448static const unsigned p168_smcrdy_pin1[] = {GPIO28};
449static const unsigned p168_ac97sysclk_pin1[] = {GPIO113};
450static const unsigned p168_ac97_pin1[] = {GPIO114, GPIO115, GPIO117, GPIO118,
451 GPIO119};
452static const unsigned p168_cf_pin1[] = {GPIO19, GPIO20, GPIO23, GPIO25,
453 GPIO28, GPIO29, GPIO30, GPIO31, GPIO32, GPIO33, GPIO34, GPIO35,
454 GPIO36};
455static const unsigned p168_kpmkin_pin1[] = {GPIO109, GPIO110, GPIO121};
456static const unsigned p168_kpmkout_pin1[] = {GPIO111, GPIO112};
457static const unsigned p168_gpio86_pin1[] = {WAKEUP};
458static const unsigned p168_gpio86_pin2[] = {GPIO86};
459static const unsigned p168_gpio87_pin1[] = {GPIO87};
460static const unsigned p168_gpio87_pin2[] = {PWR_SDA};
461static const unsigned p168_gpio88_pin1[] = {GPIO88};
462static const unsigned p168_gpio88_pin2[] = {PWR_SCL};
463
464static struct pxa3xx_pin_group pxa168_grps[] = {
465 GRP_168("uart1rx-1", UART1, p168_uart1rx_pin1),
466 GRP_168("uart1tx-1", UART1_TX, p168_uart1tx_pin1),
467 GRP_168("uart3rx-1", UART3, p168_uart3rx_pin1),
468 GRP_168("uart3tx-1", UART3_TX, p168_uart3tx_pin1),
469 GRP_168("ssp1rx-1", SSP1, p168_ssp1rx_pin1),
470 GRP_168("ssp1tx-1", SSP1_TX, p168_ssp1tx_pin1),
471 GRP_168("ssp4rx-1", SSP4, p168_ssp4rx_pin1),
472 GRP_168("ssp4tx-1", SSP4_TX, p168_ssp4tx_pin1),
473 GRP_168("ssp5rx-1", SSP5, p168_ssp5rx_pin1),
474 GRP_168("ssp5tx-1", SSP5_TX, p168_ssp5tx_pin1),
475 GRP_168("jtag", JTAG, p168_jtag_pin1),
476 GRP_168("wakeup", WAKEUP, p168_wakeup_pin1),
477 GRP_168("i2c", I2C, p168_i2c_pin1),
478 GRP_168("pwri2c", PWRI2C, p168_pwri2c_pin1),
479 GRP_168("mmc1 8p1", MMC1, p168_mmc1_pin1),
480 GRP_168("mmc2 4p1", MMC2, p168_mmc2_data_pin1),
481 GRP_168("mmc2 cmd1", MMC2_CMD, p168_mmc2_cmd_pin1),
482 GRP_168("mmc2 clk1", MMC2_CLK, p168_mmc2_clk_pin1),
483 GRP_168("mmc3 8p1", MMC3, p168_mmc3_data_pin1),
484 GRP_168("mmc3 cmd1", MMC3_CMD, p168_mmc3_cmd_pin1),
485 GRP_168("mmc3 clk1", MMC3_CLK, p168_mmc3_clk_pin1),
486 GRP_168("eth", ETH, p168_eth_pin1),
487 GRP_168("eth rx", ETH_RX, p168_ethrx_pin1),
488 GRP_168("eth tx", ETH_TX, p168_ethtx_pin1),
489 GRP_168("msp", MSP, p168_msp_pin1),
490 GRP_168("ccic", CCIC, p168_ccic_pin1),
491 GRP_168("xd", XD, p168_xd_pin1),
492 GRP_168("lcd", LCD, p168_lcd_pin1),
493 GRP_168("dfio", DFIO, p168_dfio_pin1),
494 GRP_168("nand", NAND, p168_nand_pin1),
495 GRP_168("smc", SMC, p168_smc_pin1),
496 GRP_168("smc cs0", SMC_CS0, p168_smccs0_pin1),
497 GRP_168("smc cs1", SMC_CS1, p168_smccs1_pin1),
498 GRP_168("smc rdy", SMC_RDY, p168_smcrdy_pin1),
499 GRP_168("ac97 sysclk", AC97_SYSCLK, p168_ac97sysclk_pin1),
500 GRP_168("ac97", AC97, p168_ac97_pin1),
501 GRP_168("cf", CF, p168_cf_pin1),
502 GRP_168("kp mkin 3p1", KP_MKIN, p168_kpmkin_pin1),
503 GRP_168("kp mkout 2p1", KP_MKOUT, p168_kpmkout_pin1),
504 GRP_168("gpio86-1", GPIO, p168_gpio86_pin1),
505 GRP_168("gpio86-2", GPIO, p168_gpio86_pin2),
506 GRP_168("gpio87-1", GPIO, p168_gpio87_pin1),
507 GRP_168("gpio87-2", GPIO, p168_gpio87_pin2),
508 GRP_168("gpio88-1", GPIO, p168_gpio88_pin1),
509 GRP_168("gpio88-2", GPIO, p168_gpio88_pin2),
510};
511
512static const char * const p168_uart1rx_grps[] = {"uart1rx-1"};
513static const char * const p168_uart1tx_grps[] = {"uart1tx-1"};
514static const char * const p168_uart3rx_grps[] = {"uart3rx-1"};
515static const char * const p168_uart3tx_grps[] = {"uart3tx-1"};
516static const char * const p168_ssp1rx_grps[] = {"ssp1rx-1"};
517static const char * const p168_ssp1tx_grps[] = {"ssp1tx-1"};
518static const char * const p168_ssp4rx_grps[] = {"ssp4rx-1"};
519static const char * const p168_ssp4tx_grps[] = {"ssp4tx-1"};
520static const char * const p168_ssp5rx_grps[] = {"ssp5rx-1"};
521static const char * const p168_ssp5tx_grps[] = {"ssp5tx-1"};
522static const char * const p168_i2c_grps[] = {"i2c"};
523static const char * const p168_pwri2c_grps[] = {"pwri2c"};
524static const char * const p168_mmc1_grps[] = {"mmc1 8p1"};
525static const char * const p168_mmc2_data_grps[] = {"mmc2 4p1"};
526static const char * const p168_mmc2_cmd_grps[] = {"mmc2 cmd1"};
527static const char * const p168_mmc2_clk_grps[] = {"mmc2 clk1"};
528static const char * const p168_mmc3_data_grps[] = {"mmc3 8p1"};
529static const char * const p168_mmc3_cmd_grps[] = {"mmc3 cmd1"};
530static const char * const p168_mmc3_clk_grps[] = {"mmc3 clk1"};
531static const char * const p168_eth_grps[] = {"eth"};
532static const char * const p168_ethrx_grps[] = {"eth rx"};
533static const char * const p168_ethtx_grps[] = {"eth tx"};
534static const char * const p168_msp_grps[] = {"msp"};
535static const char * const p168_ccic_grps[] = {"ccic"};
536static const char * const p168_xd_grps[] = {"xd"};
537static const char * const p168_lcd_grps[] = {"lcd"};
538static const char * const p168_dfio_grps[] = {"dfio"};
539static const char * const p168_nand_grps[] = {"nand"};
540static const char * const p168_smc_grps[] = {"smc"};
541static const char * const p168_smccs0_grps[] = {"smc cs0"};
542static const char * const p168_smccs1_grps[] = {"smc cs1"};
543static const char * const p168_smcrdy_grps[] = {"smc rdy"};
544static const char * const p168_ac97sysclk_grps[] = {"ac97 sysclk"};
545static const char * const p168_ac97_grps[] = {"ac97"};
546static const char * const p168_cf_grps[] = {"cf"};
547static const char * const p168_kpmkin_grps[] = {"kp mkin 3p1"};
548static const char * const p168_kpmkout_grps[] = {"kp mkout 2p1"};
549static const char * const p168_gpio86_grps[] = {"gpio86-1", "gpio86-2"};
550static const char * const p168_gpio87_grps[] = {"gpio87-1", "gpio87-2"};
551static const char * const p168_gpio88_grps[] = {"gpio88-1", "gpio88-2"};
552
553static struct pxa3xx_pmx_func pxa168_funcs[] = {
554 {"uart1 rx", ARRAY_AND_SIZE(p168_uart1rx_grps)},
555 {"uart1 tx", ARRAY_AND_SIZE(p168_uart1tx_grps)},
556 {"uart3 rx", ARRAY_AND_SIZE(p168_uart3rx_grps)},
557 {"uart3 tx", ARRAY_AND_SIZE(p168_uart3tx_grps)},
558 {"ssp1 rx", ARRAY_AND_SIZE(p168_ssp1rx_grps)},
559 {"ssp1 tx", ARRAY_AND_SIZE(p168_ssp1tx_grps)},
560 {"ssp4 rx", ARRAY_AND_SIZE(p168_ssp4rx_grps)},
561 {"ssp4 tx", ARRAY_AND_SIZE(p168_ssp4tx_grps)},
562 {"ssp5 rx", ARRAY_AND_SIZE(p168_ssp5rx_grps)},
563 {"ssp5 tx", ARRAY_AND_SIZE(p168_ssp5tx_grps)},
564 {"i2c", ARRAY_AND_SIZE(p168_i2c_grps)},
565 {"pwri2c", ARRAY_AND_SIZE(p168_pwri2c_grps)},
566 {"mmc1", ARRAY_AND_SIZE(p168_mmc1_grps)},
567 {"mmc2", ARRAY_AND_SIZE(p168_mmc2_data_grps)},
568 {"mmc2 cmd", ARRAY_AND_SIZE(p168_mmc2_cmd_grps)},
569 {"mmc2 clk", ARRAY_AND_SIZE(p168_mmc2_clk_grps)},
570 {"mmc3", ARRAY_AND_SIZE(p168_mmc3_data_grps)},
571 {"mmc3 cmd", ARRAY_AND_SIZE(p168_mmc3_cmd_grps)},
572 {"mmc3 clk", ARRAY_AND_SIZE(p168_mmc3_clk_grps)},
573 {"eth", ARRAY_AND_SIZE(p168_eth_grps)},
574 {"eth rx", ARRAY_AND_SIZE(p168_ethrx_grps)},
575 {"eth tx", ARRAY_AND_SIZE(p168_ethtx_grps)},
576 {"msp", ARRAY_AND_SIZE(p168_msp_grps)},
577 {"ccic", ARRAY_AND_SIZE(p168_ccic_grps)},
578 {"xd", ARRAY_AND_SIZE(p168_xd_grps)},
579 {"lcd", ARRAY_AND_SIZE(p168_lcd_grps)},
580 {"dfio", ARRAY_AND_SIZE(p168_dfio_grps)},
581 {"nand", ARRAY_AND_SIZE(p168_nand_grps)},
582 {"smc", ARRAY_AND_SIZE(p168_smc_grps)},
583 {"smc cs0", ARRAY_AND_SIZE(p168_smccs0_grps)},
584 {"smc cs1", ARRAY_AND_SIZE(p168_smccs1_grps)},
585 {"smc rdy", ARRAY_AND_SIZE(p168_smcrdy_grps)},
586 {"ac97", ARRAY_AND_SIZE(p168_ac97_grps)},
587 {"ac97 sysclk", ARRAY_AND_SIZE(p168_ac97sysclk_grps)},
588 {"cf", ARRAY_AND_SIZE(p168_cf_grps)},
589 {"kpmkin", ARRAY_AND_SIZE(p168_kpmkin_grps)},
590 {"kpmkout", ARRAY_AND_SIZE(p168_kpmkout_grps)},
591 {"gpio86", ARRAY_AND_SIZE(p168_gpio86_grps)},
592 {"gpio87", ARRAY_AND_SIZE(p168_gpio87_grps)},
593 {"gpio88", ARRAY_AND_SIZE(p168_gpio88_grps)},
594};
595
596static struct pinctrl_desc pxa168_pctrl_desc = {
597 .name = "pxa168-pinctrl",
598 .owner = THIS_MODULE,
599};
600
601static struct pxa3xx_pinmux_info pxa168_info = {
602 .mfp = pxa168_mfp,
603 .num_mfp = ARRAY_SIZE(pxa168_mfp),
604 .grps = pxa168_grps,
605 .num_grps = ARRAY_SIZE(pxa168_grps),
606 .funcs = pxa168_funcs,
607 .num_funcs = ARRAY_SIZE(pxa168_funcs),
608 .num_gpio = 128,
609 .desc = &pxa168_pctrl_desc,
610 .pads = pxa168_pads,
611 .num_pads = ARRAY_SIZE(pxa168_pads),
612
613 .cputype = PINCTRL_PXA168,
614 .ds_mask = PXA168_DS_MASK,
615 .ds_shift = PXA168_DS_SHIFT,
616};
617
618static int __devinit pxa168_pinmux_probe(struct platform_device *pdev)
619{
620 return pxa3xx_pinctrl_register(pdev, &pxa168_info);
621}
622
623static int __devexit pxa168_pinmux_remove(struct platform_device *pdev)
624{
625 return pxa3xx_pinctrl_unregister(pdev);
626}
627
628static struct platform_driver pxa168_pinmux_driver = {
629 .driver = {
630 .name = "pxa168-pinmux",
631 .owner = THIS_MODULE,
632 },
633 .probe = pxa168_pinmux_probe,
634 .remove = __devexit_p(pxa168_pinmux_remove),
635};
636
637static int __init pxa168_pinmux_init(void)
638{
639 return platform_driver_register(&pxa168_pinmux_driver);
640}
641core_initcall_sync(pxa168_pinmux_init);
642
643static void __exit pxa168_pinmux_exit(void)
644{
645 platform_driver_unregister(&pxa168_pinmux_driver);
646}
647module_exit(pxa168_pinmux_exit);
648
649MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>");
650MODULE_DESCRIPTION("PXA3xx pin control driver");
651MODULE_LICENSE("GPL v2");
diff --git a/drivers/pinctrl/pinctrl-pxa3xx.c b/drivers/pinctrl/pinctrl-pxa3xx.c
new file mode 100644
index 000000000000..079dce0e93e9
--- /dev/null
+++ b/drivers/pinctrl/pinctrl-pxa3xx.c
@@ -0,0 +1,244 @@
1/*
2 * linux/drivers/pinctrl/pinctrl-pxa3xx.c
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * publishhed by the Free Software Foundation.
7 *
8 * Copyright (C) 2011, Marvell Technology Group Ltd.
9 *
10 * Author: Haojian Zhuang <haojian.zhuang@marvell.com>
11 *
12 */
13
14#include <linux/module.h>
15#include <linux/device.h>
16#include <linux/io.h>
17#include <linux/platform_device.h>
18#include <linux/slab.h>
19#include "pinctrl-pxa3xx.h"
20
21static struct pinctrl_gpio_range pxa3xx_pinctrl_gpio_range = {
22 .name = "PXA3xx GPIO",
23 .id = 0,
24 .base = 0,
25 .pin_base = 0,
26};
27
28static int pxa3xx_list_groups(struct pinctrl_dev *pctrldev, unsigned selector)
29{
30 struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
31 if (selector >= info->num_grps)
32 return -EINVAL;
33 return 0;
34}
35
36static const char *pxa3xx_get_group_name(struct pinctrl_dev *pctrldev,
37 unsigned selector)
38{
39 struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
40 if (selector >= info->num_grps)
41 return NULL;
42 return info->grps[selector].name;
43}
44
45static int pxa3xx_get_group_pins(struct pinctrl_dev *pctrldev,
46 unsigned selector,
47 const unsigned **pins,
48 unsigned *num_pins)
49{
50 struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
51 if (selector >= info->num_grps)
52 return -EINVAL;
53 *pins = info->grps[selector].pins;
54 *num_pins = info->grps[selector].npins;
55 return 0;
56}
57
58static struct pinctrl_ops pxa3xx_pctrl_ops = {
59 .list_groups = pxa3xx_list_groups,
60 .get_group_name = pxa3xx_get_group_name,
61 .get_group_pins = pxa3xx_get_group_pins,
62};
63
64static int pxa3xx_pmx_list_func(struct pinctrl_dev *pctrldev, unsigned func)
65{
66 struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
67 if (func >= info->num_funcs)
68 return -EINVAL;
69 return 0;
70}
71
72static const char *pxa3xx_pmx_get_func_name(struct pinctrl_dev *pctrldev,
73 unsigned func)
74{
75 struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
76 return info->funcs[func].name;
77}
78
79static int pxa3xx_pmx_get_groups(struct pinctrl_dev *pctrldev, unsigned func,
80 const char * const **groups,
81 unsigned * const num_groups)
82{
83 struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
84 *groups = info->funcs[func].groups;
85 *num_groups = info->funcs[func].num_groups;
86 return 0;
87}
88
89/* Return function number. If failure, return negative value. */
90static int match_mux(struct pxa3xx_mfp_pin *mfp, unsigned mux)
91{
92 int i;
93 for (i = 0; i < PXA3xx_MAX_MUX; i++) {
94 if (mfp->func[i] == mux)
95 break;
96 }
97 if (i >= PXA3xx_MAX_MUX)
98 return -EINVAL;
99 return i;
100}
101
102/* check whether current pin configuration is valid. Negative for failure */
103static int match_group_mux(struct pxa3xx_pin_group *grp,
104 struct pxa3xx_pinmux_info *info,
105 unsigned mux)
106{
107 int i, pin, ret = 0;
108 for (i = 0; i < grp->npins; i++) {
109 pin = grp->pins[i];
110 ret = match_mux(&info->mfp[pin], mux);
111 if (ret < 0) {
112 dev_err(info->dev, "Can't find mux %d on pin%d\n",
113 mux, pin);
114 break;
115 }
116 }
117 return ret;
118}
119
120static int pxa3xx_pmx_enable(struct pinctrl_dev *pctrldev, unsigned func,
121 unsigned group)
122{
123 struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
124 struct pxa3xx_pin_group *pin_grp = &info->grps[group];
125 unsigned int data;
126 int i, mfpr, pin, pin_func;
127
128 if (!pin_grp->npins ||
129 (match_group_mux(pin_grp, info, pin_grp->mux) < 0)) {
130 dev_err(info->dev, "Failed to set the pin group: %d\n", group);
131 return -EINVAL;
132 }
133 for (i = 0; i < pin_grp->npins; i++) {
134 pin = pin_grp->pins[i];
135 pin_func = match_mux(&info->mfp[pin], pin_grp->mux);
136 mfpr = info->mfp[pin].mfpr;
137 data = readl_relaxed(info->virt_base + mfpr);
138 data &= ~MFPR_FUNC_MASK;
139 data |= pin_func;
140 writel_relaxed(data, info->virt_base + mfpr);
141 }
142 return 0;
143}
144
145static void pxa3xx_pmx_disable(struct pinctrl_dev *pctrldev, unsigned func,
146 unsigned group)
147{
148}
149
150static int pxa3xx_pmx_request_gpio(struct pinctrl_dev *pctrldev,
151 struct pinctrl_gpio_range *range,
152 unsigned pin)
153{
154 struct pxa3xx_pinmux_info *info = pinctrl_dev_get_drvdata(pctrldev);
155 unsigned int data;
156 int pin_func, mfpr;
157
158 pin_func = match_mux(&info->mfp[pin], PXA3xx_MUX_GPIO);
159 if (pin_func < 0) {
160 dev_err(info->dev, "No GPIO function on pin%d (%s)\n",
161 pin, info->pads[pin].name);
162 return -EINVAL;
163 }
164 mfpr = info->mfp[pin].mfpr;
165 /* write gpio function into mfpr register */
166 data = readl_relaxed(info->virt_base + mfpr) & ~MFPR_FUNC_MASK;
167 data |= pin_func;
168 writel_relaxed(data, info->virt_base + mfpr);
169 return 0;
170}
171
172static struct pinmux_ops pxa3xx_pmx_ops = {
173 .list_functions = pxa3xx_pmx_list_func,
174 .get_function_name = pxa3xx_pmx_get_func_name,
175 .get_function_groups = pxa3xx_pmx_get_groups,
176 .enable = pxa3xx_pmx_enable,
177 .disable = pxa3xx_pmx_disable,
178 .gpio_request_enable = pxa3xx_pmx_request_gpio,
179};
180
181int pxa3xx_pinctrl_register(struct platform_device *pdev,
182 struct pxa3xx_pinmux_info *info)
183{
184 struct pinctrl_desc *desc;
185 struct resource *res;
186 int ret = 0;
187
188 if (!info || !info->cputype)
189 return -EINVAL;
190 desc = info->desc;
191 desc->pins = info->pads;
192 desc->npins = info->num_pads;
193 desc->pctlops = &pxa3xx_pctrl_ops;
194 desc->pmxops = &pxa3xx_pmx_ops;
195 info->dev = &pdev->dev;
196 pxa3xx_pinctrl_gpio_range.npins = info->num_gpio;
197
198 res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
199 if (!res)
200 return -ENOENT;
201 info->phy_base = res->start;
202 info->phy_size = resource_size(res);
203 info->virt_base = ioremap(info->phy_base, info->phy_size);
204 if (!info->virt_base)
205 return -ENOMEM;
206 info->pctrl = pinctrl_register(desc, &pdev->dev, info);
207 if (!info->pctrl) {
208 dev_err(&pdev->dev, "failed to register PXA pinmux driver\n");
209 ret = -EINVAL;
210 goto err;
211 }
212 pinctrl_add_gpio_range(info->pctrl, &pxa3xx_pinctrl_gpio_range);
213 platform_set_drvdata(pdev, info);
214 return 0;
215err:
216 iounmap(info->virt_base);
217 return ret;
218}
219
220int pxa3xx_pinctrl_unregister(struct platform_device *pdev)
221{
222 struct pxa3xx_pinmux_info *info = platform_get_drvdata(pdev);
223
224 pinctrl_unregister(info->pctrl);
225 iounmap(info->virt_base);
226 platform_set_drvdata(pdev, NULL);
227 return 0;
228}
229
230static int __init pxa3xx_pinctrl_init(void)
231{
232 pr_info("pxa3xx-pinctrl: PXA3xx pinctrl driver initializing\n");
233 return 0;
234}
235core_initcall_sync(pxa3xx_pinctrl_init);
236
237static void __exit pxa3xx_pinctrl_exit(void)
238{
239}
240module_exit(pxa3xx_pinctrl_exit);
241
242MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>");
243MODULE_DESCRIPTION("PXA3xx pin control driver");
244MODULE_LICENSE("GPL v2");
diff --git a/drivers/pinctrl/pinctrl-pxa3xx.h b/drivers/pinctrl/pinctrl-pxa3xx.h
new file mode 100644
index 000000000000..8135744d6599
--- /dev/null
+++ b/drivers/pinctrl/pinctrl-pxa3xx.h
@@ -0,0 +1,264 @@
1/*
2 * linux/drivers/pinctrl/pinctrl-pxa3xx.h
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * publishhed by the Free Software Foundation.
7 *
8 * Copyright (C) 2011, Marvell Technology Group Ltd.
9 *
10 * Author: Haojian Zhuang <haojian.zhuang@marvell.com>
11 *
12 */
13
14#ifndef __PINCTRL_PXA3XX_H
15
16#include <linux/pinctrl/pinctrl.h>
17#include <linux/pinctrl/pinmux.h>
18
19#define ARRAY_AND_SIZE(x) (x), ARRAY_SIZE(x)
20
21#define PXA3xx_MUX_GPIO 0
22
23#define PXA3xx_MAX_MUX 8
24#define MFPR_FUNC_MASK 0x7
25
26enum pxa_cpu_type {
27 PINCTRL_INVALID = 0,
28 PINCTRL_PXA300,
29 PINCTRL_PXA310,
30 PINCTRL_PXA320,
31 PINCTRL_PXA168,
32 PINCTRL_PXA910,
33 PINCTRL_PXA930,
34 PINCTRL_PXA955,
35 PINCTRL_MMP2,
36 PINCTRL_MAX,
37};
38
39struct pxa3xx_mfp_pin {
40 const char *name;
41 const unsigned int pin;
42 const unsigned int mfpr; /* register offset */
43 const unsigned short func[8];
44};
45
46struct pxa3xx_pin_group {
47 const char *name;
48 const unsigned mux;
49 const unsigned *pins;
50 const unsigned npins;
51};
52
53struct pxa3xx_pmx_func {
54 const char *name;
55 const char * const * groups;
56 const unsigned num_groups;
57};
58
59struct pxa3xx_pinmux_info {
60 struct device *dev;
61 struct pinctrl_dev *pctrl;
62 enum pxa_cpu_type cputype;
63 unsigned int phy_base;
64 unsigned int phy_size;
65 void __iomem *virt_base;
66
67 struct pxa3xx_mfp_pin *mfp;
68 unsigned int num_mfp;
69 struct pxa3xx_pin_group *grps;
70 unsigned int num_grps;
71 struct pxa3xx_pmx_func *funcs;
72 unsigned int num_funcs;
73 unsigned int num_gpio;
74 struct pinctrl_desc *desc;
75 struct pinctrl_pin_desc *pads;
76 unsigned int num_pads;
77
78 unsigned ds_mask; /* drive strength mask */
79 unsigned ds_shift; /* drive strength shift */
80 unsigned slp_mask; /* sleep mask */
81 unsigned slp_input_low;
82 unsigned slp_input_high;
83 unsigned slp_output_low;
84 unsigned slp_output_high;
85 unsigned slp_float;
86};
87
88enum pxa3xx_pin_list {
89 GPIO0 = 0,
90 GPIO1,
91 GPIO2,
92 GPIO3,
93 GPIO4,
94 GPIO5,
95 GPIO6,
96 GPIO7,
97 GPIO8,
98 GPIO9,
99 GPIO10, /* 10 */
100 GPIO11,
101 GPIO12,
102 GPIO13,
103 GPIO14,
104 GPIO15,
105 GPIO16,
106 GPIO17,
107 GPIO18,
108 GPIO19,
109 GPIO20, /* 20 */
110 GPIO21,
111 GPIO22,
112 GPIO23,
113 GPIO24,
114 GPIO25,
115 GPIO26,
116 GPIO27,
117 GPIO28,
118 GPIO29,
119 GPIO30, /* 30 */
120 GPIO31,
121 GPIO32,
122 GPIO33,
123 GPIO34,
124 GPIO35,
125 GPIO36,
126 GPIO37,
127 GPIO38,
128 GPIO39,
129 GPIO40, /* 40 */
130 GPIO41,
131 GPIO42,
132 GPIO43,
133 GPIO44,
134 GPIO45,
135 GPIO46,
136 GPIO47,
137 GPIO48,
138 GPIO49,
139 GPIO50, /* 50 */
140 GPIO51,
141 GPIO52,
142 GPIO53,
143 GPIO54,
144 GPIO55,
145 GPIO56,
146 GPIO57,
147 GPIO58,
148 GPIO59,
149 GPIO60, /* 60 */
150 GPIO61,
151 GPIO62,
152 GPIO63,
153 GPIO64,
154 GPIO65,
155 GPIO66,
156 GPIO67,
157 GPIO68,
158 GPIO69,
159 GPIO70, /* 70 */
160 GPIO71,
161 GPIO72,
162 GPIO73,
163 GPIO74,
164 GPIO75,
165 GPIO76,
166 GPIO77,
167 GPIO78,
168 GPIO79,
169 GPIO80, /* 80 */
170 GPIO81,
171 GPIO82,
172 GPIO83,
173 GPIO84,
174 GPIO85,
175 GPIO86,
176 GPIO87,
177 GPIO88,
178 GPIO89,
179 GPIO90, /* 90 */
180 GPIO91,
181 GPIO92,
182 GPIO93,
183 GPIO94,
184 GPIO95,
185 GPIO96,
186 GPIO97,
187 GPIO98,
188 GPIO99,
189 GPIO100, /* 100 */
190 GPIO101,
191 GPIO102,
192 GPIO103,
193 GPIO104,
194 GPIO105,
195 GPIO106,
196 GPIO107,
197 GPIO108,
198 GPIO109,
199 GPIO110, /* 110 */
200 GPIO111,
201 GPIO112,
202 GPIO113,
203 GPIO114,
204 GPIO115,
205 GPIO116,
206 GPIO117,
207 GPIO118,
208 GPIO119,
209 GPIO120, /* 120 */
210 GPIO121,
211 GPIO122,
212 GPIO123,
213 GPIO124,
214 GPIO125,
215 GPIO126,
216 GPIO127,
217 GPIO128,
218 GPIO129,
219 GPIO130, /* 130 */
220 GPIO131,
221 GPIO132,
222 GPIO133,
223 GPIO134,
224 GPIO135,
225 GPIO136,
226 GPIO137,
227 GPIO138,
228 GPIO139,
229 GPIO140, /* 140 */
230 GPIO141,
231 GPIO142,
232 GPIO143,
233 GPIO144,
234 GPIO145,
235 GPIO146,
236 GPIO147,
237 GPIO148,
238 GPIO149,
239 GPIO150, /* 150 */
240 GPIO151,
241 GPIO152,
242 GPIO153,
243 GPIO154,
244 GPIO155,
245 GPIO156,
246 GPIO157,
247 GPIO158,
248 GPIO159,
249 GPIO160, /* 160 */
250 GPIO161,
251 GPIO162,
252 GPIO163,
253 GPIO164,
254 GPIO165,
255 GPIO166,
256 GPIO167,
257 GPIO168,
258 GPIO169,
259};
260
261extern int pxa3xx_pinctrl_register(struct platform_device *pdev,
262 struct pxa3xx_pinmux_info *info);
263extern int pxa3xx_pinctrl_unregister(struct platform_device *pdev);
264#endif /* __PINCTRL_PXA3XX_H */
diff --git a/drivers/pinctrl/pinctrl-pxa910.c b/drivers/pinctrl/pinctrl-pxa910.c
new file mode 100644
index 000000000000..c72ab4b9cc8c
--- /dev/null
+++ b/drivers/pinctrl/pinctrl-pxa910.c
@@ -0,0 +1,1007 @@
1/*
2 * linux/drivers/pinctrl/pinmux-pxa910.c
3 *
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * publishhed by the Free Software Foundation.
7 *
8 * Copyright (C) 2011, Marvell Technology Group Ltd.
9 *
10 * Author: Haojian Zhuang <haojian.zhuang@marvell.com>
11 *
12 */
13
14#include <linux/device.h>
15#include <linux/module.h>
16#include <linux/io.h>
17#include <linux/platform_device.h>
18#include "pinctrl-pxa3xx.h"
19
20#define PXA910_DS_MASK 0x1800
21#define PXA910_DS_SHIFT 11
22#define PXA910_SLEEP_MASK 0x38
23#define PXA910_SLEEP_SELECT (1 << 9)
24#define PXA910_SLEEP_DATA (1 << 8)
25#define PXA910_SLEEP_DIR (1 << 7)
26
27#define MFPR_910(a, r, f0, f1, f2, f3, f4, f5, f6, f7) \
28 { \
29 .name = #a, \
30 .pin = a, \
31 .mfpr = r, \
32 .func = { \
33 PXA910_MUX_##f0, \
34 PXA910_MUX_##f1, \
35 PXA910_MUX_##f2, \
36 PXA910_MUX_##f3, \
37 PXA910_MUX_##f4, \
38 PXA910_MUX_##f5, \
39 PXA910_MUX_##f6, \
40 PXA910_MUX_##f7, \
41 }, \
42 }
43
44#define GRP_910(a, m, p) \
45 { .name = a, .mux = PXA910_MUX_##m, .pins = p, .npins = ARRAY_SIZE(p), }
46
47/* 170 pins */
48enum pxa910_pin_list {
49 /* 0~127: GPIO0~GPIO127 */
50 ND_IO15 = 128,
51 ND_IO14,
52 ND_IO13, /* 130 */
53 ND_IO12,
54 ND_IO11,
55 ND_IO10,
56 ND_IO9,
57 ND_IO8,
58 ND_IO7,
59 ND_IO6,
60 ND_IO5,
61 ND_IO4,
62 ND_IO3, /* 140 */
63 ND_IO2,
64 ND_IO1,
65 ND_IO0,
66 ND_NCS0,
67 ND_NCS1,
68 SM_NCS0,
69 SM_NCS1,
70 ND_NWE,
71 ND_NRE,
72 ND_CLE, /* 150 */
73 ND_ALE,
74 SM_SCLK,
75 ND_RDY0,
76 SM_ADV,
77 ND_RDY1,
78 SM_ADVMUX,
79 SM_RDY,
80 MMC1_DAT7,
81 MMC1_DAT6,
82 MMC1_DAT5, /* 160 */
83 MMC1_DAT4,
84 MMC1_DAT3,
85 MMC1_DAT2,
86 MMC1_DAT1,
87 MMC1_DAT0,
88 MMC1_CMD,
89 MMC1_CLK,
90 MMC1_CD,
91 VCXO_OUT,
92};
93
94enum pxa910_mux {
95 /* PXA3xx_MUX_GPIO = 0 (predefined in pinctrl-pxa3xx.h) */
96 PXA910_MUX_GPIO = 0,
97 PXA910_MUX_NAND,
98 PXA910_MUX_USIM2,
99 PXA910_MUX_EXT_DMA,
100 PXA910_MUX_EXT_INT,
101 PXA910_MUX_MMC1,
102 PXA910_MUX_MMC2,
103 PXA910_MUX_MMC3,
104 PXA910_MUX_SM_INT,
105 PXA910_MUX_PRI_JTAG,
106 PXA910_MUX_SEC1_JTAG,
107 PXA910_MUX_SEC2_JTAG,
108 PXA910_MUX_RESET, /* SLAVE RESET OUT */
109 PXA910_MUX_CLK_REQ,
110 PXA910_MUX_VCXO_REQ,
111 PXA910_MUX_VCXO_OUT,
112 PXA910_MUX_VCXO_REQ2,
113 PXA910_MUX_VCXO_OUT2,
114 PXA910_MUX_SPI,
115 PXA910_MUX_SPI2,
116 PXA910_MUX_GSSP,
117 PXA910_MUX_SSP0,
118 PXA910_MUX_SSP1,
119 PXA910_MUX_SSP2,
120 PXA910_MUX_DSSP2,
121 PXA910_MUX_DSSP3,
122 PXA910_MUX_UART0,
123 PXA910_MUX_UART1,
124 PXA910_MUX_UART2,
125 PXA910_MUX_TWSI,
126 PXA910_MUX_CCIC,
127 PXA910_MUX_PWM0,
128 PXA910_MUX_PWM1,
129 PXA910_MUX_PWM2,
130 PXA910_MUX_PWM3,
131 PXA910_MUX_HSL,
132 PXA910_MUX_ONE_WIRE,
133 PXA910_MUX_LCD,
134 PXA910_MUX_DAC_ST23,
135 PXA910_MUX_ULPI,
136 PXA910_MUX_TB,
137 PXA910_MUX_KP_MK,
138 PXA910_MUX_KP_DK,
139 PXA910_MUX_TCU_GPOA,
140 PXA910_MUX_TCU_GPOB,
141 PXA910_MUX_ROT,
142 PXA910_MUX_TDS,
143 PXA910_MUX_32K_CLK, /* 32KHz CLK OUT */
144 PXA910_MUX_MN_CLK, /* MN CLK OUT */
145 PXA910_MUX_SMC,
146 PXA910_MUX_SM_ADDR18,
147 PXA910_MUX_SM_ADDR19,
148 PXA910_MUX_SM_ADDR20,
149 PXA910_MUX_NONE = 0xffff,
150};
151
152
153static struct pinctrl_pin_desc pxa910_pads[] = {
154 PINCTRL_PIN(GPIO0, "GPIO0"),
155 PINCTRL_PIN(GPIO1, "GPIO1"),
156 PINCTRL_PIN(GPIO2, "GPIO2"),
157 PINCTRL_PIN(GPIO3, "GPIO3"),
158 PINCTRL_PIN(GPIO4, "GPIO4"),
159 PINCTRL_PIN(GPIO5, "GPIO5"),
160 PINCTRL_PIN(GPIO6, "GPIO6"),
161 PINCTRL_PIN(GPIO7, "GPIO7"),
162 PINCTRL_PIN(GPIO8, "GPIO8"),
163 PINCTRL_PIN(GPIO9, "GPIO9"),
164 PINCTRL_PIN(GPIO10, "GPIO10"),
165 PINCTRL_PIN(GPIO11, "GPIO11"),
166 PINCTRL_PIN(GPIO12, "GPIO12"),
167 PINCTRL_PIN(GPIO13, "GPIO13"),
168 PINCTRL_PIN(GPIO14, "GPIO14"),
169 PINCTRL_PIN(GPIO15, "GPIO15"),
170 PINCTRL_PIN(GPIO16, "GPIO16"),
171 PINCTRL_PIN(GPIO17, "GPIO17"),
172 PINCTRL_PIN(GPIO18, "GPIO18"),
173 PINCTRL_PIN(GPIO19, "GPIO19"),
174 PINCTRL_PIN(GPIO20, "GPIO20"),
175 PINCTRL_PIN(GPIO21, "GPIO21"),
176 PINCTRL_PIN(GPIO22, "GPIO22"),
177 PINCTRL_PIN(GPIO23, "GPIO23"),
178 PINCTRL_PIN(GPIO24, "GPIO24"),
179 PINCTRL_PIN(GPIO25, "GPIO25"),
180 PINCTRL_PIN(GPIO26, "GPIO26"),
181 PINCTRL_PIN(GPIO27, "GPIO27"),
182 PINCTRL_PIN(GPIO28, "GPIO28"),
183 PINCTRL_PIN(GPIO29, "GPIO29"),
184 PINCTRL_PIN(GPIO30, "GPIO30"),
185 PINCTRL_PIN(GPIO31, "GPIO31"),
186 PINCTRL_PIN(GPIO32, "GPIO32"),
187 PINCTRL_PIN(GPIO33, "GPIO33"),
188 PINCTRL_PIN(GPIO34, "GPIO34"),
189 PINCTRL_PIN(GPIO35, "GPIO35"),
190 PINCTRL_PIN(GPIO36, "GPIO36"),
191 PINCTRL_PIN(GPIO37, "GPIO37"),
192 PINCTRL_PIN(GPIO38, "GPIO38"),
193 PINCTRL_PIN(GPIO39, "GPIO39"),
194 PINCTRL_PIN(GPIO40, "GPIO40"),
195 PINCTRL_PIN(GPIO41, "GPIO41"),
196 PINCTRL_PIN(GPIO42, "GPIO42"),
197 PINCTRL_PIN(GPIO43, "GPIO43"),
198 PINCTRL_PIN(GPIO44, "GPIO44"),
199 PINCTRL_PIN(GPIO45, "GPIO45"),
200 PINCTRL_PIN(GPIO46, "GPIO46"),
201 PINCTRL_PIN(GPIO47, "GPIO47"),
202 PINCTRL_PIN(GPIO48, "GPIO48"),
203 PINCTRL_PIN(GPIO49, "GPIO49"),
204 PINCTRL_PIN(GPIO50, "GPIO50"),
205 PINCTRL_PIN(GPIO51, "GPIO51"),
206 PINCTRL_PIN(GPIO52, "GPIO52"),
207 PINCTRL_PIN(GPIO53, "GPIO53"),
208 PINCTRL_PIN(GPIO54, "GPIO54"),
209 PINCTRL_PIN(GPIO55, "GPIO55"),
210 PINCTRL_PIN(GPIO56, "GPIO56"),
211 PINCTRL_PIN(GPIO57, "GPIO57"),
212 PINCTRL_PIN(GPIO58, "GPIO58"),
213 PINCTRL_PIN(GPIO59, "GPIO59"),
214 PINCTRL_PIN(GPIO60, "GPIO60"),
215 PINCTRL_PIN(GPIO61, "GPIO61"),
216 PINCTRL_PIN(GPIO62, "GPIO62"),
217 PINCTRL_PIN(GPIO63, "GPIO63"),
218 PINCTRL_PIN(GPIO64, "GPIO64"),
219 PINCTRL_PIN(GPIO65, "GPIO65"),
220 PINCTRL_PIN(GPIO66, "GPIO66"),
221 PINCTRL_PIN(GPIO67, "GPIO67"),
222 PINCTRL_PIN(GPIO68, "GPIO68"),
223 PINCTRL_PIN(GPIO69, "GPIO69"),
224 PINCTRL_PIN(GPIO70, "GPIO70"),
225 PINCTRL_PIN(GPIO71, "GPIO71"),
226 PINCTRL_PIN(GPIO72, "GPIO72"),
227 PINCTRL_PIN(GPIO73, "GPIO73"),
228 PINCTRL_PIN(GPIO74, "GPIO74"),
229 PINCTRL_PIN(GPIO75, "GPIO75"),
230 PINCTRL_PIN(GPIO76, "GPIO76"),
231 PINCTRL_PIN(GPIO77, "GPIO77"),
232 PINCTRL_PIN(GPIO78, "GPIO78"),
233 PINCTRL_PIN(GPIO79, "GPIO79"),
234 PINCTRL_PIN(GPIO80, "GPIO80"),
235 PINCTRL_PIN(GPIO81, "GPIO81"),
236 PINCTRL_PIN(GPIO82, "GPIO82"),
237 PINCTRL_PIN(GPIO83, "GPIO83"),
238 PINCTRL_PIN(GPIO84, "GPIO84"),
239 PINCTRL_PIN(GPIO85, "GPIO85"),
240 PINCTRL_PIN(GPIO86, "GPIO86"),
241 PINCTRL_PIN(GPIO87, "GPIO87"),
242 PINCTRL_PIN(GPIO88, "GPIO88"),
243 PINCTRL_PIN(GPIO89, "GPIO89"),
244 PINCTRL_PIN(GPIO90, "GPIO90"),
245 PINCTRL_PIN(GPIO91, "GPIO91"),
246 PINCTRL_PIN(GPIO92, "GPIO92"),
247 PINCTRL_PIN(GPIO93, "GPIO93"),
248 PINCTRL_PIN(GPIO94, "GPIO94"),
249 PINCTRL_PIN(GPIO95, "GPIO95"),
250 PINCTRL_PIN(GPIO96, "GPIO96"),
251 PINCTRL_PIN(GPIO97, "GPIO97"),
252 PINCTRL_PIN(GPIO98, "GPIO98"),
253 PINCTRL_PIN(GPIO99, "GPIO99"),
254 PINCTRL_PIN(GPIO100, "GPIO100"),
255 PINCTRL_PIN(GPIO101, "GPIO101"),
256 PINCTRL_PIN(GPIO102, "GPIO102"),
257 PINCTRL_PIN(GPIO103, "GPIO103"),
258 PINCTRL_PIN(GPIO104, "GPIO104"),
259 PINCTRL_PIN(GPIO105, "GPIO105"),
260 PINCTRL_PIN(GPIO106, "GPIO106"),
261 PINCTRL_PIN(GPIO107, "GPIO107"),
262 PINCTRL_PIN(GPIO108, "GPIO108"),
263 PINCTRL_PIN(GPIO109, "GPIO109"),
264 PINCTRL_PIN(GPIO110, "GPIO110"),
265 PINCTRL_PIN(GPIO111, "GPIO111"),
266 PINCTRL_PIN(GPIO112, "GPIO112"),
267 PINCTRL_PIN(GPIO113, "GPIO113"),
268 PINCTRL_PIN(GPIO114, "GPIO114"),
269 PINCTRL_PIN(GPIO115, "GPIO115"),
270 PINCTRL_PIN(GPIO116, "GPIO116"),
271 PINCTRL_PIN(GPIO117, "GPIO117"),
272 PINCTRL_PIN(GPIO118, "GPIO118"),
273 PINCTRL_PIN(GPIO119, "GPIO119"),
274 PINCTRL_PIN(GPIO120, "GPIO120"),
275 PINCTRL_PIN(GPIO121, "GPIO121"),
276 PINCTRL_PIN(GPIO122, "GPIO122"),
277 PINCTRL_PIN(GPIO123, "GPIO123"),
278 PINCTRL_PIN(GPIO124, "GPIO124"),
279 PINCTRL_PIN(GPIO125, "GPIO125"),
280 PINCTRL_PIN(GPIO126, "GPIO126"),
281 PINCTRL_PIN(GPIO127, "GPIO127"),
282 PINCTRL_PIN(ND_IO15, "ND_IO15"),
283 PINCTRL_PIN(ND_IO14, "ND_IO14"),
284 PINCTRL_PIN(ND_IO13, "ND_IO13"),
285 PINCTRL_PIN(ND_IO12, "ND_IO12"),
286 PINCTRL_PIN(ND_IO11, "ND_IO11"),
287 PINCTRL_PIN(ND_IO10, "ND_IO10"),
288 PINCTRL_PIN(ND_IO9, "ND_IO9"),
289 PINCTRL_PIN(ND_IO8, "ND_IO8"),
290 PINCTRL_PIN(ND_IO7, "ND_IO7"),
291 PINCTRL_PIN(ND_IO6, "ND_IO6"),
292 PINCTRL_PIN(ND_IO5, "ND_IO5"),
293 PINCTRL_PIN(ND_IO4, "ND_IO4"),
294 PINCTRL_PIN(ND_IO3, "ND_IO3"),
295 PINCTRL_PIN(ND_IO2, "ND_IO2"),
296 PINCTRL_PIN(ND_IO1, "ND_IO1"),
297 PINCTRL_PIN(ND_IO0, "ND_IO0"),
298 PINCTRL_PIN(ND_NCS0, "ND_NCS0_SM_NCS2"),
299 PINCTRL_PIN(ND_NCS1, "ND_NCS1_SM_NCS3"),
300 PINCTRL_PIN(SM_NCS0, "SM_NCS0"),
301 PINCTRL_PIN(SM_NCS1, "SM_NCS1"),
302 PINCTRL_PIN(ND_NWE, "ND_NWE"),
303 PINCTRL_PIN(ND_NRE, "ND_NRE"),
304 PINCTRL_PIN(ND_CLE, "ND_CLE_SM_NOE"),
305 PINCTRL_PIN(ND_ALE, "ND_ALE_SM_NWE"),
306 PINCTRL_PIN(SM_SCLK, "SM_SCLK"),
307 PINCTRL_PIN(ND_RDY0, "ND_RDY0"),
308 PINCTRL_PIN(SM_ADV, "SM_ADV"),
309 PINCTRL_PIN(ND_RDY1, "ND_RDY1"),
310 PINCTRL_PIN(SM_RDY, "SM_RDY"),
311 PINCTRL_PIN(MMC1_DAT7, "MMC1_DAT7"),
312 PINCTRL_PIN(MMC1_DAT6, "MMC1_DAT6"),
313 PINCTRL_PIN(MMC1_DAT5, "MMC1_DAT5"),
314 PINCTRL_PIN(MMC1_DAT4, "MMC1_DAT4"),
315 PINCTRL_PIN(MMC1_DAT3, "MMC1_DAT3"),
316 PINCTRL_PIN(MMC1_DAT2, "MMC1_DAT2"),
317 PINCTRL_PIN(MMC1_DAT1, "MMC1_DAT1"),
318 PINCTRL_PIN(MMC1_DAT0, "MMC1_DAT0"),
319 PINCTRL_PIN(MMC1_CMD, "MMC1 CMD"),
320 PINCTRL_PIN(MMC1_CLK, "MMC1 CLK"),
321 PINCTRL_PIN(MMC1_CD, "MMC1 CD"),
322 PINCTRL_PIN(VCXO_OUT, "VCXO_OUT"),
323};
324
325struct pxa3xx_mfp_pin pxa910_mfp[] = {
326 /* pin offs f0 f1 f2 f3 f4 f5 f6 f7 */
327 MFPR_910(GPIO0, 0x0DC, GPIO, KP_MK, NONE, NONE, NONE, NONE, NONE, NONE),
328 MFPR_910(GPIO1, 0x0E0, GPIO, KP_MK, NONE, NONE, NONE, NONE, NONE, NONE),
329 MFPR_910(GPIO2, 0x0E4, GPIO, KP_MK, NONE, NONE, NONE, NONE, NONE, NONE),
330 MFPR_910(GPIO3, 0x0E8, GPIO, KP_MK, NONE, NONE, NONE, NONE, NONE, NONE),
331 MFPR_910(GPIO4, 0x0EC, GPIO, KP_MK, NONE, NONE, NONE, NONE, NONE, NONE),
332 MFPR_910(GPIO5, 0x0F0, GPIO, KP_MK, NONE, NONE, NONE, NONE, NONE, NONE),
333 MFPR_910(GPIO6, 0x0F4, GPIO, KP_MK, NONE, NONE, NONE, NONE, NONE, NONE),
334 MFPR_910(GPIO7, 0x0F8, GPIO, KP_MK, NONE, NONE, NONE, NONE, NONE, NONE),
335 MFPR_910(GPIO8, 0x0FC, GPIO, KP_MK, NONE, NONE, NONE, NONE, NONE, NONE),
336 MFPR_910(GPIO9, 0x100, GPIO, KP_MK, NONE, NONE, NONE, NONE, NONE, NONE),
337 MFPR_910(GPIO10, 0x104, GPIO, KP_MK, NONE, NONE, NONE, NONE, NONE, NONE),
338 MFPR_910(GPIO11, 0x108, GPIO, KP_MK, NONE, NONE, NONE, NONE, NONE, NONE),
339 MFPR_910(GPIO12, 0x10C, GPIO, KP_MK, NONE, NONE, KP_DK, NONE, NONE, NONE),
340 MFPR_910(GPIO13, 0x110, GPIO, KP_MK, NONE, NONE, KP_DK, NONE, NONE, NONE),
341 MFPR_910(GPIO14, 0x114, GPIO, KP_MK, NONE, NONE, KP_DK, TB, NONE, NONE),
342 MFPR_910(GPIO15, 0x118, GPIO, KP_MK, NONE, NONE, KP_DK, TB, NONE, NONE),
343 MFPR_910(GPIO16, 0x11C, GPIO, KP_DK, NONE, NONE, NONE, TB, NONE, NONE),
344 MFPR_910(GPIO17, 0x120, GPIO, KP_DK, NONE, NONE, NONE, TB, NONE, NONE),
345 MFPR_910(GPIO18, 0x124, GPIO, KP_DK, NONE, NONE, ROT, NONE, NONE, NONE),
346 MFPR_910(GPIO19, 0x128, GPIO, KP_DK, NONE, NONE, ROT, NONE, NONE, NONE),
347 MFPR_910(GPIO20, 0x12C, GPIO, SSP1, NONE, NONE, VCXO_OUT, NONE, NONE, NONE),
348 MFPR_910(GPIO21, 0x130, GPIO, SSP1, NONE, NONE, NONE, NONE, NONE, NONE),
349 MFPR_910(GPIO22, 0x134, GPIO, SSP1, NONE, NONE, NONE, NONE, NONE, NONE),
350 MFPR_910(GPIO23, 0x138, GPIO, SSP1, NONE, NONE, NONE, NONE, NONE, NONE),
351 MFPR_910(GPIO24, 0x13C, GPIO, SSP1, NONE, NONE, NONE, NONE, NONE, NONE),
352 MFPR_910(GPIO25, 0x140, GPIO, GSSP, NONE, NONE, NONE, NONE, NONE, NONE),
353 MFPR_910(GPIO26, 0x144, GPIO, GSSP, NONE, NONE, NONE, NONE, NONE, NONE),
354 MFPR_910(GPIO27, 0x148, GPIO, GSSP, NONE, NONE, NONE, NONE, NONE, NONE),
355 MFPR_910(GPIO28, 0x14C, GPIO, GSSP, NONE, NONE, NONE, NONE, NONE, NONE),
356 MFPR_910(GPIO29, 0x150, GPIO, UART0, NONE, NONE, UART1, NONE, NONE, NONE),
357 MFPR_910(GPIO30, 0x154, GPIO, UART0, NONE, NONE, UART1, NONE, NONE, NONE),
358 MFPR_910(GPIO31, 0x158, GPIO, UART0, NONE, NONE, UART1, NONE, NONE, NONE),
359 MFPR_910(GPIO32, 0x15C, GPIO, UART0, DAC_ST23, NONE, UART1, NONE, NONE, NONE),
360 MFPR_910(GPIO33, 0x160, GPIO, MMC2, SSP0, SSP2, NONE, SPI, NONE, MMC3),
361 MFPR_910(GPIO34, 0x164, GPIO, MMC2, SSP0, SSP2, NONE, SPI, NONE, MMC3),
362 MFPR_910(GPIO35, 0x168, GPIO, MMC2, SSP0, SSP2, NONE, SPI, NONE, MMC3),
363 MFPR_910(GPIO36, 0x16C, GPIO, MMC2, SSP0, SSP2, NONE, SPI, NONE, MMC3),
364 MFPR_910(GPIO37, 0x170, GPIO, MMC2, NONE, NONE, NONE, SPI, HSL, NONE),
365 MFPR_910(GPIO38, 0x174, GPIO, MMC2, NONE, NONE, NONE, NONE, HSL, NONE),
366 MFPR_910(GPIO39, 0x178, GPIO, MMC2, NONE, NONE, NONE, NONE, HSL, NONE),
367 MFPR_910(GPIO40, 0x17C, GPIO, MMC2, NONE, NONE, NONE, NONE, HSL, NONE),
368 MFPR_910(GPIO41, 0x180, GPIO, MMC2, NONE, NONE, NONE, NONE, HSL, NONE),
369 MFPR_910(GPIO42, 0x184, GPIO, MMC2, NONE, NONE, NONE, NONE, HSL, NONE),
370 MFPR_910(GPIO43, 0x188, GPIO, UART1, NONE, DAC_ST23, NONE, DSSP2, SPI, UART2),
371 MFPR_910(GPIO44, 0x18C, GPIO, UART1, NONE, EXT_INT, NONE, DSSP2, SPI, UART2),
372 MFPR_910(GPIO45, 0x190, GPIO, UART1, NONE, EXT_INT, NONE, DSSP2, SPI, UART2),
373 MFPR_910(GPIO46, 0x194, GPIO, UART1, NONE, EXT_INT, NONE, DSSP2, SPI, UART2),
374 MFPR_910(GPIO47, 0x198, GPIO, SSP0, NONE, NONE, NONE, SSP2, UART1, NONE),
375 MFPR_910(GPIO48, 0x19C, GPIO, SSP0, NONE, NONE, NONE, SSP2, UART1, NONE),
376 MFPR_910(GPIO49, 0x1A0, GPIO, SSP0, UART0, VCXO_REQ, NONE, SSP2, NONE, MMC3),
377 MFPR_910(GPIO50, 0x1A4, GPIO, SSP0, UART0, VCXO_OUT, NONE, SSP2, NONE, MMC3),
378 MFPR_910(GPIO51, 0x1A8, GPIO, UART2, PWM1, TWSI, SSP0, NONE, DSSP3, NONE),
379 MFPR_910(GPIO52, 0x1AC, GPIO, UART2, DAC_ST23, TWSI, SSP0, NONE, DSSP3, NONE),
380 MFPR_910(GPIO53, 0x1B0, GPIO, UART2, TWSI, NONE, SSP0, NONE, DSSP3, NONE),
381 MFPR_910(GPIO54, 0x1B4, GPIO, UART2, TWSI, SSP0, NONE, NONE, DSSP3, NONE),
382 MFPR_910(GPIO55, 0x2F0, TDS, GPIO, TB, NONE, NONE, NONE, NONE, NONE),
383 MFPR_910(GPIO56, 0x2F4, TDS, GPIO, TB, NONE, NONE, NONE, NONE, NONE),
384 MFPR_910(GPIO57, 0x2F8, TDS, GPIO, TB, NONE, NONE, NONE, NONE, NONE),
385 MFPR_910(GPIO58, 0x2FC, TDS, GPIO, TB, NONE, NONE, NONE, NONE, NONE),
386 MFPR_910(GPIO59, 0x300, TDS, GPIO, TCU_GPOA, TCU_GPOB, ONE_WIRE, NONE, NONE, NONE),
387 MFPR_910(GPIO60, 0x304, GPIO, NONE, NONE, NONE, NONE, NONE, NONE, NONE),
388 MFPR_910(GPIO61, 0x308, GPIO, NONE, NONE, NONE, NONE, NONE, NONE, HSL),
389 MFPR_910(GPIO62, 0x30C, GPIO, NONE, NONE, NONE, NONE, NONE, NONE, HSL),
390 MFPR_910(GPIO63, 0x310, GPIO, NONE, NONE, NONE, NONE, NONE, NONE, HSL),
391 MFPR_910(GPIO64, 0x314, GPIO, SPI2, NONE, NONE, NONE, NONE, NONE, HSL),
392 MFPR_910(GPIO65, 0x318, GPIO, SPI2, NONE, NONE, NONE, NONE, ONE_WIRE, HSL),
393 MFPR_910(GPIO66, 0x31C, GPIO, NONE, NONE, NONE, NONE, NONE, NONE, HSL),
394 MFPR_910(GPIO67, 0x1B8, GPIO, CCIC, SPI, NONE, NONE, ULPI, NONE, USIM2),
395 MFPR_910(GPIO68, 0x1BC, GPIO, CCIC, SPI, NONE, NONE, ULPI, NONE, USIM2),
396 MFPR_910(GPIO69, 0x1C0, GPIO, CCIC, SPI, NONE, NONE, ULPI, NONE, USIM2),
397 MFPR_910(GPIO70, 0x1C4, GPIO, CCIC, SPI, NONE, NONE, ULPI, NONE, NONE),
398 MFPR_910(GPIO71, 0x1C8, GPIO, CCIC, SPI, NONE, NONE, ULPI, NONE, NONE),
399 MFPR_910(GPIO72, 0x1CC, GPIO, CCIC, EXT_DMA, NONE, NONE, ULPI, NONE, NONE),
400 MFPR_910(GPIO73, 0x1D0, GPIO, CCIC, EXT_DMA, NONE, NONE, ULPI, NONE, NONE),
401 MFPR_910(GPIO74, 0x1D4, GPIO, CCIC, EXT_DMA, NONE, NONE, ULPI, NONE, NONE),
402 MFPR_910(GPIO75, 0x1D8, GPIO, CCIC, NONE, NONE, NONE, ULPI, NONE, NONE),
403 MFPR_910(GPIO76, 0x1DC, GPIO, CCIC, NONE, NONE, NONE, ULPI, NONE, NONE),
404 MFPR_910(GPIO77, 0x1E0, GPIO, CCIC, NONE, NONE, NONE, ULPI, NONE, NONE),
405 MFPR_910(GPIO78, 0x1E4, GPIO, CCIC, NONE, NONE, NONE, ULPI, NONE, NONE),
406 MFPR_910(GPIO79, 0x1E8, GPIO, TWSI, NONE, NONE, NONE, NONE, NONE, NONE),
407 MFPR_910(GPIO80, 0x1EC, GPIO, TWSI, NONE, NONE, NONE, NONE, NONE, NONE),
408 MFPR_910(GPIO81, 0x1F0, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
409 MFPR_910(GPIO82, 0x1F4, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
410 MFPR_910(GPIO83, 0x1F8, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
411 MFPR_910(GPIO84, 0x1FC, GPIO, LCD, VCXO_REQ2, NONE, NONE, NONE, NONE, NONE),
412 MFPR_910(GPIO85, 0x200, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
413 MFPR_910(GPIO86, 0x204, GPIO, LCD, VCXO_OUT2, NONE, NONE, NONE, NONE, NONE),
414 MFPR_910(GPIO87, 0x208, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
415 MFPR_910(GPIO88, 0x20C, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
416 MFPR_910(GPIO89, 0x210, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
417 MFPR_910(GPIO90, 0x214, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
418 MFPR_910(GPIO91, 0x218, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
419 MFPR_910(GPIO92, 0x21C, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
420 MFPR_910(GPIO93, 0x220, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
421 MFPR_910(GPIO94, 0x224, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
422 MFPR_910(GPIO95, 0x228, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
423 MFPR_910(GPIO96, 0x22C, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
424 MFPR_910(GPIO97, 0x230, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
425 MFPR_910(GPIO98, 0x234, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
426 MFPR_910(GPIO99, 0x0B0, MMC1, GPIO, NONE, NONE, NONE, NONE, NONE, NONE),
427 MFPR_910(GPIO100, 0x238, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
428 MFPR_910(GPIO101, 0x23C, GPIO, LCD, NONE, NONE, NONE, NONE, NONE, NONE),
429 MFPR_910(GPIO102, 0x240, GPIO, LCD, DSSP2, SPI, NONE, NONE, NONE, SPI2),
430 MFPR_910(GPIO103, 0x244, GPIO, LCD, DSSP2, SPI, NONE, NONE, NONE, SPI2),
431 MFPR_910(GPIO104, 0x248, GPIO, LCD, DSSP2, SPI, NONE, NONE, NONE, NONE),
432 MFPR_910(GPIO105, 0x24C, GPIO, LCD, DSSP2, SPI, NONE, NONE, NONE, NONE),
433 MFPR_910(GPIO106, 0x250, GPIO, LCD, DSSP3, ONE_WIRE, NONE, NONE, NONE, NONE),
434 MFPR_910(GPIO107, 0x254, GPIO, LCD, DSSP3, SPI, NONE, NONE, NONE, NONE),
435 MFPR_910(GPIO108, 0x258, GPIO, LCD, DSSP3, SPI, NONE, NONE, NONE, NONE),
436 MFPR_910(GPIO109, 0x25C, GPIO, LCD, DSSP3, SPI, NONE, NONE, NONE, NONE),
437 MFPR_910(GPIO110, 0x298, GPIO, NONE, NONE, NONE, NONE, NONE, NONE, NONE),
438 MFPR_910(GPIO111, 0x29C, GPIO, NONE, DSSP2, NONE, NONE, NONE, NONE, NONE),
439 MFPR_910(GPIO112, 0x2A0, GPIO, NONE, DSSP2, NONE, NONE, NONE, NONE, NONE),
440 MFPR_910(GPIO113, 0x2A4, GPIO, NONE, DSSP2, NONE, NONE, NONE, NONE, NONE),
441 MFPR_910(GPIO114, 0x2A8, GPIO, NONE, DSSP3, NONE, NONE, NONE, NONE, NONE),
442 MFPR_910(GPIO115, 0x2AC, GPIO, NONE, DSSP3, NONE, NONE, NONE, NONE, NONE),
443 MFPR_910(GPIO116, 0x2B0, GPIO, NONE, DSSP3, NONE, NONE, NONE, NONE, NONE),
444 MFPR_910(GPIO117, 0x0B4, PRI_JTAG, GPIO, PWM0, NONE, NONE, NONE, NONE, NONE),
445 MFPR_910(GPIO118, 0x0B8, PRI_JTAG, GPIO, PWM1, NONE, NONE, NONE, NONE, NONE),
446 MFPR_910(GPIO119, 0x0BC, PRI_JTAG, GPIO, PWM2, NONE, NONE, NONE, NONE, NONE),
447 MFPR_910(GPIO120, 0x0C0, PRI_JTAG, GPIO, PWM3, NONE, NONE, NONE, NONE, NONE),
448 MFPR_910(GPIO121, 0x32C, GPIO, NONE, NONE, NONE, NONE, NONE, NONE, NONE),
449 MFPR_910(GPIO122, 0x0C8, RESET, GPIO, 32K_CLK, NONE, NONE, NONE, NONE, NONE),
450 MFPR_910(GPIO123, 0x0CC, CLK_REQ, GPIO, ONE_WIRE, EXT_DMA, NONE, NONE, NONE, NONE),
451 MFPR_910(GPIO124, 0x0D0, GPIO, MN_CLK, DAC_ST23, NONE, NONE, NONE, NONE, NONE),
452 MFPR_910(GPIO125, 0x0D4, VCXO_REQ, GPIO, NONE, EXT_INT, NONE, NONE, NONE, NONE),
453 MFPR_910(GPIO126, 0x06C, GPIO, SMC, NONE, SM_ADDR18, NONE, EXT_DMA, NONE, NONE),
454 MFPR_910(GPIO127, 0x070, GPIO, SMC, NONE, NONE, NONE, NONE, NONE, NONE),
455 MFPR_910(ND_IO15, 0x004, NAND, GPIO, USIM2, EXT_DMA, NONE, NONE, NONE, NONE),
456 MFPR_910(ND_IO14, 0x008, NAND, GPIO, USIM2, NONE, NONE, NONE, NONE, NONE),
457 MFPR_910(ND_IO13, 0x00C, NAND, GPIO, USIM2, EXT_INT, NONE, NONE, NONE, NONE),
458 MFPR_910(ND_IO12, 0x010, NAND, GPIO, SSP2, EXT_INT, NONE, NONE, NONE, NONE),
459 MFPR_910(ND_IO11, 0x014, NAND, GPIO, SSP2, NONE, NONE, NONE, NONE, NONE),
460 MFPR_910(ND_IO10, 0x018, NAND, GPIO, SSP2, NONE, NONE, NONE, NONE, NONE),
461 MFPR_910(ND_IO9, 0x01C, NAND, GPIO, SSP2, NONE, VCXO_OUT2, NONE, NONE, NONE),
462 MFPR_910(ND_IO8, 0x020, NAND, GPIO, NONE, NONE, PWM3, NONE, NONE, NONE),
463 MFPR_910(ND_IO7, 0x024, NAND, MMC3, NONE, NONE, NONE, NONE, NONE, NONE),
464 MFPR_910(ND_IO6, 0x028, NAND, MMC3, NONE, NONE, NONE, NONE, NONE, NONE),
465 MFPR_910(ND_IO5, 0x02C, NAND, MMC3, NONE, NONE, NONE, NONE, NONE, NONE),
466 MFPR_910(ND_IO4, 0x030, NAND, MMC3, NONE, NONE, NONE, NONE, NONE, NONE),
467 MFPR_910(ND_IO3, 0x034, NAND, MMC3, NONE, NONE, NONE, NONE, NONE, NONE),
468 MFPR_910(ND_IO2, 0x038, NAND, MMC3, NONE, NONE, NONE, NONE, NONE, NONE),
469 MFPR_910(ND_IO1, 0x03C, NAND, MMC3, NONE, NONE, NONE, NONE, NONE, NONE),
470 MFPR_910(ND_IO0, 0x040, NAND, MMC3, NONE, NONE, NONE, NONE, NONE, NONE),
471 MFPR_910(ND_NCS0, 0x044, NAND, GPIO, NONE, NONE, NONE, NONE, NONE, NONE),
472 MFPR_910(ND_NCS1, 0x048, NAND, GPIO, NONE, NONE, NONE, NONE, NONE, NONE),
473 MFPR_910(SM_NCS0, 0x04C, SMC, GPIO, NONE, NONE, NONE, NONE, NONE, NONE),
474 MFPR_910(SM_NCS1, 0x050, SMC, GPIO, NONE, NONE, NONE, NONE, NONE, NONE),
475 MFPR_910(ND_NWE, 0x054, GPIO, NAND, NONE, SM_ADDR20, NONE, SMC, NONE, NONE),
476 MFPR_910(ND_NRE, 0x058, GPIO, NAND, NONE, SMC, NONE, EXT_DMA, NONE, NONE),
477 MFPR_910(ND_CLE, 0x05C, NAND, MMC3, NONE, NONE, NONE, NONE, NONE, NONE),
478 MFPR_910(ND_ALE, 0x060, GPIO, NAND, NONE, NONE, NONE, NONE, NONE, NONE),
479 MFPR_910(SM_SCLK, 0x064, MMC3, NONE, NONE, NONE, NONE, NONE, NONE, NONE),
480 MFPR_910(ND_RDY0, 0x068, NAND, GPIO, NONE, SMC, NONE, NONE, NONE, NONE),
481 MFPR_910(SM_ADV, 0x074, SMC, GPIO, NONE, NONE, NONE, NONE, NONE, NONE),
482 MFPR_910(ND_RDY1, 0x078, NAND, GPIO, NONE, SMC, NONE, NONE, NONE, NONE),
483 MFPR_910(SM_ADVMUX, 0x07C, SMC, GPIO, NONE, SM_ADDR19, NONE, NONE, NONE, NONE),
484 MFPR_910(SM_RDY, 0x080, SMC, GPIO, NONE, NONE, NONE, NONE, NONE, NONE),
485 MFPR_910(MMC1_DAT7, 0x084, MMC1, GPIO, SEC1_JTAG, TB, NONE, NONE, NONE, NONE),
486 MFPR_910(MMC1_DAT6, 0x088, MMC1, GPIO, SEC1_JTAG, TB, NONE, NONE, NONE, NONE),
487 MFPR_910(MMC1_DAT5, 0x08C, MMC1, GPIO, SEC1_JTAG, TB, NONE, NONE, NONE, NONE),
488 MFPR_910(MMC1_DAT4, 0x090, MMC1, GPIO, NONE, TB, NONE, NONE, NONE, NONE),
489 MFPR_910(MMC1_DAT3, 0x094, MMC1, HSL, SEC2_JTAG, SSP0, NONE, NONE, NONE, NONE),
490 MFPR_910(MMC1_DAT2, 0x098, MMC1, HSL, SEC2_JTAG, SSP2, SSP0, NONE, NONE, NONE),
491 MFPR_910(MMC1_DAT1, 0x09C, MMC1, HSL, SEC2_JTAG, SSP2, SSP0, NONE, NONE, NONE),
492 MFPR_910(MMC1_DAT0, 0x0A0, MMC1, HSL, SEC2_JTAG, SSP2, NONE, NONE, NONE, NONE),
493 MFPR_910(MMC1_CMD, 0x0A4, MMC1, HSL, SEC1_JTAG, SSP2, NONE, NONE, NONE, NONE),
494 MFPR_910(MMC1_CLK, 0x0A8, MMC1, HSL, SEC2_JTAG, SSP0, NONE, NONE, NONE, NONE),
495 MFPR_910(MMC1_CD, 0x0AC, MMC1, GPIO, SEC1_JTAG, NONE, NONE, NONE, NONE, NONE),
496 MFPR_910(VCXO_OUT, 0x0D8, VCXO_OUT, PWM3, NONE, NONE, NONE, NONE, NONE, NONE),
497};
498
499
500static const unsigned p910_usim2_pin1[] = {GPIO67, GPIO68, GPIO69};
501static const unsigned p910_usim2_pin2[] = {ND_IO15, ND_IO14, ND_IO13};
502static const unsigned p910_mmc1_pin1[] = {MMC1_DAT7, MMC1_DAT6, MMC1_DAT5,
503 MMC1_DAT4, MMC1_DAT3, MMC1_DAT2, MMC1_DAT1, MMC1_DAT0, MMC1_CMD,
504 MMC1_CLK, MMC1_CD, GPIO99};
505static const unsigned p910_mmc2_pin1[] = {GPIO33, GPIO34, GPIO35, GPIO36,
506 GPIO37, GPIO38, GPIO39, GPIO40, GPIO41, GPIO42};
507static const unsigned p910_mmc3_pin1[] = {GPIO33, GPIO34, GPIO35, GPIO36,
508 GPIO49, GPIO50};
509static const unsigned p910_mmc3_pin2[] = {ND_IO7, ND_IO6, ND_IO5, ND_IO4,
510 ND_IO3, ND_IO2, ND_IO1, ND_IO0, ND_CLE, SM_SCLK};
511static const unsigned p910_uart0_pin1[] = {GPIO29, GPIO30, GPIO31, GPIO32};
512static const unsigned p910_uart1_pin1[] = {GPIO47, GPIO48};
513static const unsigned p910_uart1_pin2[] = {GPIO31, GPIO32};
514static const unsigned p910_uart1_pin3[] = {GPIO45, GPIO46};
515static const unsigned p910_uart1_pin4[] = {GPIO29, GPIO30, GPIO31, GPIO32};
516static const unsigned p910_uart1_pin5[] = {GPIO43, GPIO44, GPIO45, GPIO46};
517static const unsigned p910_uart2_pin1[] = {GPIO43, GPIO44};
518static const unsigned p910_uart2_pin2[] = {GPIO51, GPIO52};
519static const unsigned p910_uart2_pin3[] = {GPIO43, GPIO44, GPIO45, GPIO46};
520static const unsigned p910_uart2_pin4[] = {GPIO51, GPIO52, GPIO53, GPIO54};
521static const unsigned p910_twsi_pin1[] = {GPIO51, GPIO52};
522static const unsigned p910_twsi_pin2[] = {GPIO53, GPIO54};
523static const unsigned p910_twsi_pin3[] = {GPIO79, GPIO80};
524static const unsigned p910_ccic_pin1[] = {GPIO67, GPIO68, GPIO69, GPIO70,
525 GPIO71, GPIO72, GPIO73, GPIO74, GPIO75, GPIO76, GPIO77, GPIO78};
526static const unsigned p910_lcd_pin1[] = {GPIO81, GPIO82, GPIO83, GPIO84,
527 GPIO85, GPIO86, GPIO87, GPIO88, GPIO89, GPIO90, GPIO91, GPIO92,
528 GPIO93, GPIO94, GPIO95, GPIO96, GPIO97, GPIO98, GPIO100, GPIO101,
529 GPIO102, GPIO103};
530static const unsigned p910_spi_pin1[] = {GPIO104, GPIO105, GPIO107, GPIO108};
531static const unsigned p910_spi_pin2[] = {GPIO43, GPIO44, GPIO45, GPIO46};
532static const unsigned p910_spi_pin3[] = {GPIO33, GPIO34, GPIO35, GPIO36,
533 GPIO37};
534static const unsigned p910_spi_pin4[] = {GPIO67, GPIO68, GPIO69, GPIO70,
535 GPIO71};
536static const unsigned p910_spi2_pin1[] = {GPIO64, GPIO65};
537static const unsigned p910_spi2_pin2[] = {GPIO102, GPIO103};
538static const unsigned p910_dssp2_pin1[] = {GPIO102, GPIO103, GPIO104, GPIO105};
539static const unsigned p910_dssp2_pin2[] = {GPIO43, GPIO44, GPIO45, GPIO46};
540static const unsigned p910_dssp2_pin3[] = {GPIO111, GPIO112, GPIO113};
541static const unsigned p910_dssp3_pin1[] = {GPIO106, GPIO107, GPIO108, GPIO109};
542static const unsigned p910_dssp3_pin2[] = {GPIO51, GPIO52, GPIO53, GPIO54};
543static const unsigned p910_dssp3_pin3[] = {GPIO114, GPIO115, GPIO116};
544static const unsigned p910_ssp0_pin1[] = {MMC1_DAT3, MMC1_DAT2, MMC1_DAT1,
545 MMC1_CLK};
546static const unsigned p910_ssp0_pin2[] = {GPIO33, GPIO34, GPIO35, GPIO36};
547static const unsigned p910_ssp0_pin3[] = {GPIO47, GPIO48, GPIO49, GPIO50};
548static const unsigned p910_ssp0_pin4[] = {GPIO51, GPIO52, GPIO53, GPIO54};
549static const unsigned p910_ssp1_pin1[] = {GPIO21, GPIO22, GPIO23, GPIO24};
550static const unsigned p910_ssp1_pin2[] = {GPIO20, GPIO21, GPIO22, GPIO23,
551 GPIO24};
552static const unsigned p910_ssp2_pin1[] = {MMC1_DAT2, MMC1_DAT1, MMC1_DAT0,
553 MMC1_CMD};
554static const unsigned p910_ssp2_pin2[] = {GPIO33, GPIO34, GPIO35, GPIO36};
555static const unsigned p910_ssp2_pin3[] = {GPIO47, GPIO48, GPIO49, GPIO50};
556static const unsigned p910_ssp2_pin4[] = {ND_IO12, ND_IO11, ND_IO10, ND_IO9};
557static const unsigned p910_gssp_pin1[] = {GPIO25, GPIO26, GPIO27, GPIO28};
558static const unsigned p910_pwm0_pin1[] = {GPIO117};
559static const unsigned p910_pwm1_pin1[] = {GPIO118};
560static const unsigned p910_pwm1_pin2[] = {GPIO51};
561static const unsigned p910_pwm2_pin1[] = {GPIO119};
562static const unsigned p910_pwm3_pin1[] = {GPIO120};
563static const unsigned p910_pwm3_pin2[] = {ND_IO8};
564static const unsigned p910_pwm3_pin3[] = {VCXO_OUT};
565static const unsigned p910_pri_jtag_pin1[] = {GPIO117, GPIO118, GPIO119,
566 GPIO120};
567static const unsigned p910_sec1_jtag_pin1[] = {MMC1_DAT7, MMC1_DAT6, MMC1_DAT5,
568 MMC1_CMD, MMC1_CD};
569static const unsigned p910_sec2_jtag_pin1[] = {MMC1_DAT3, MMC1_DAT2, MMC1_DAT1,
570 MMC1_DAT0, MMC1_CLK};
571static const unsigned p910_hsl_pin1[] = {GPIO37, GPIO38, GPIO39, GPIO40,
572 GPIO41, GPIO42};
573static const unsigned p910_hsl_pin2[] = {GPIO61, GPIO62, GPIO63, GPIO64,
574 GPIO65, GPIO66};
575static const unsigned p910_hsl_pin3[] = {MMC1_DAT3, MMC1_DAT2, MMC1_DAT1,
576 MMC1_DAT0, MMC1_CMD, MMC1_CLK};
577static const unsigned p910_w1_pin1[] = {GPIO59};
578static const unsigned p910_w1_pin2[] = {GPIO65};
579static const unsigned p910_w1_pin3[] = {GPIO106};
580static const unsigned p910_w1_pin4[] = {GPIO123};
581static const unsigned p910_kpmk_pin1[] = {GPIO0, GPIO1, GPIO2, GPIO3, GPIO4,
582 GPIO5, GPIO6, GPIO7, GPIO8, GPIO9, GPIO10, GPIO11, GPIO12, GPIO13,
583 GPIO14, GPIO15};
584static const unsigned p910_kpmk_pin2[] = {GPIO0, GPIO1, GPIO2, GPIO3, GPIO4,
585 GPIO5, GPIO6, GPIO7, GPIO8, GPIO9, GPIO12};
586static const unsigned p910_kpdk_pin1[] = {GPIO12, GPIO13, GPIO14, GPIO15,
587 GPIO16, GPIO17, GPIO18, GPIO19};
588static const unsigned p910_tds_pin1[] = {GPIO55, GPIO56, GPIO57, GPIO58,
589 GPIO59};
590static const unsigned p910_tds_pin2[] = {GPIO55, GPIO57, GPIO58, GPIO59};
591static const unsigned p910_tb_pin1[] = {GPIO14, GPIO15, GPIO16, GPIO17};
592static const unsigned p910_tb_pin2[] = {GPIO55, GPIO56, GPIO57, GPIO58};
593static const unsigned p910_tb_pin3[] = {MMC1_DAT7, MMC1_DAT6, MMC1_DAT5,
594 MMC1_DAT4};
595static const unsigned p910_ext_dma0_pin1[] = {GPIO72};
596static const unsigned p910_ext_dma0_pin2[] = {ND_IO15};
597static const unsigned p910_ext_dma0_pin3[] = {ND_NRE};
598static const unsigned p910_ext_dma1_pin1[] = {GPIO73};
599static const unsigned p910_ext_dma1_pin2[] = {GPIO123};
600static const unsigned p910_ext_dma1_pin3[] = {GPIO126};
601static const unsigned p910_ext_dma2_pin1[] = {GPIO74};
602static const unsigned p910_ext0_int_pin1[] = {GPIO44};
603static const unsigned p910_ext0_int_pin2[] = {ND_IO13};
604static const unsigned p910_ext1_int_pin1[] = {GPIO45};
605static const unsigned p910_ext1_int_pin2[] = {ND_IO12};
606static const unsigned p910_ext2_int_pin1[] = {GPIO46};
607static const unsigned p910_ext2_int_pin2[] = {GPIO125};
608static const unsigned p910_dac_st23_pin1[] = {GPIO32};
609static const unsigned p910_dac_st23_pin2[] = {GPIO43};
610static const unsigned p910_dac_st23_pin3[] = {GPIO52};
611static const unsigned p910_dac_st23_pin4[] = {GPIO124};
612static const unsigned p910_vcxo_out_pin1[] = {GPIO50};
613static const unsigned p910_vcxo_out_pin2[] = {VCXO_OUT};
614static const unsigned p910_vcxo_out_pin3[] = {GPIO20};
615static const unsigned p910_vcxo_req_pin1[] = {GPIO49};
616static const unsigned p910_vcxo_req_pin2[] = {GPIO125};
617static const unsigned p910_vcxo_out2_pin1[] = {GPIO86};
618static const unsigned p910_vcxo_out2_pin2[] = {ND_IO9};
619static const unsigned p910_vcxo_req2_pin1[] = {GPIO84};
620static const unsigned p910_ulpi_pin1[] = {GPIO67, GPIO68, GPIO69, GPIO70,
621 GPIO71, GPIO72, GPIO73, GPIO74, GPIO75, GPIO76, GPIO77, GPIO78};
622static const unsigned p910_nand_pin1[] = {ND_IO15, ND_IO14, ND_IO13, ND_IO12,
623 ND_IO11, ND_IO10, ND_IO9, ND_IO8, ND_IO7, ND_IO6, ND_IO5, ND_IO4,
624 ND_IO3, ND_IO2, ND_IO1, ND_IO0, ND_NCS0, ND_NWE, ND_NRE, ND_CLE,
625 ND_ALE, ND_RDY0};
626static const unsigned p910_gpio0_pin1[] = {GPIO0};
627static const unsigned p910_gpio0_pin2[] = {SM_ADV};
628static const unsigned p910_gpio1_pin1[] = {GPIO1};
629static const unsigned p910_gpio1_pin2[] = {ND_RDY1};
630static const unsigned p910_gpio2_pin1[] = {GPIO2};
631static const unsigned p910_gpio2_pin2[] = {SM_ADVMUX};
632static const unsigned p910_gpio3_pin1[] = {GPIO3};
633static const unsigned p910_gpio3_pin2[] = {SM_RDY};
634static const unsigned p910_gpio20_pin1[] = {GPIO20};
635static const unsigned p910_gpio20_pin2[] = {ND_IO15};
636static const unsigned p910_gpio20_pin3[] = {MMC1_DAT6};
637static const unsigned p910_gpio21_pin1[] = {GPIO21};
638static const unsigned p910_gpio21_pin2[] = {ND_IO14};
639static const unsigned p910_gpio21_pin3[] = {MMC1_DAT5};
640static const unsigned p910_gpio22_pin1[] = {GPIO22};
641static const unsigned p910_gpio22_pin2[] = {ND_IO13};
642static const unsigned p910_gpio22_pin3[] = {MMC1_DAT4};
643static const unsigned p910_gpio23_pin1[] = {GPIO23};
644static const unsigned p910_gpio23_pin2[] = {ND_IO12};
645static const unsigned p910_gpio23_pin3[] = {MMC1_CD};
646static const unsigned p910_gpio24_pin1[] = {GPIO24};
647static const unsigned p910_gpio24_pin2[] = {ND_IO11};
648static const unsigned p910_gpio24_pin3[] = {MMC1_DAT7};
649static const unsigned p910_gpio25_pin1[] = {GPIO25};
650static const unsigned p910_gpio25_pin2[] = {ND_IO10};
651static const unsigned p910_gpio26_pin1[] = {GPIO26};
652static const unsigned p910_gpio26_pin2[] = {ND_IO9};
653static const unsigned p910_gpio27_pin1[] = {GPIO27};
654static const unsigned p910_gpio27_pin2[] = {ND_IO8};
655static const unsigned p910_gpio85_pin1[] = {GPIO85};
656static const unsigned p910_gpio85_pin2[] = {ND_NCS0};
657static const unsigned p910_gpio86_pin1[] = {GPIO86};
658static const unsigned p910_gpio86_pin2[] = {ND_NCS1};
659static const unsigned p910_gpio87_pin1[] = {GPIO87};
660static const unsigned p910_gpio87_pin2[] = {SM_NCS0};
661static const unsigned p910_gpio88_pin1[] = {GPIO88};
662static const unsigned p910_gpio88_pin2[] = {SM_NCS1};
663static const unsigned p910_gpio89_pin1[] = {GPIO89};
664static const unsigned p910_gpio89_pin2[] = {ND_NWE};
665static const unsigned p910_gpio90_pin1[] = {GPIO90};
666static const unsigned p910_gpio90_pin2[] = {ND_NRE};
667static const unsigned p910_gpio91_pin1[] = {GPIO91};
668static const unsigned p910_gpio91_pin2[] = {ND_ALE};
669static const unsigned p910_gpio92_pin1[] = {GPIO92};
670static const unsigned p910_gpio92_pin2[] = {ND_RDY0};
671
672static struct pxa3xx_pin_group pxa910_grps[] = {
673 GRP_910("usim2 3p1", USIM2, p910_usim2_pin1),
674 GRP_910("usim2 3p2", USIM2, p910_usim2_pin2),
675 GRP_910("mmc1 12p", MMC1, p910_mmc1_pin1),
676 GRP_910("mmc2 10p", MMC2, p910_mmc2_pin1),
677 GRP_910("mmc3 6p", MMC3, p910_mmc3_pin1),
678 GRP_910("mmc3 10p", MMC3, p910_mmc3_pin2),
679 GRP_910("uart0 4p", UART0, p910_uart0_pin1),
680 GRP_910("uart1 2p1", UART1, p910_uart1_pin1),
681 GRP_910("uart1 2p2", UART1, p910_uart1_pin2),
682 GRP_910("uart1 2p3", UART1, p910_uart1_pin3),
683 GRP_910("uart1 4p4", UART1, p910_uart1_pin4),
684 GRP_910("uart1 4p5", UART1, p910_uart1_pin5),
685 GRP_910("uart2 2p1", UART2, p910_uart2_pin1),
686 GRP_910("uart2 2p2", UART2, p910_uart2_pin2),
687 GRP_910("uart2 4p3", UART2, p910_uart2_pin3),
688 GRP_910("uart2 4p4", UART2, p910_uart2_pin4),
689 GRP_910("twsi 2p1", TWSI, p910_twsi_pin1),
690 GRP_910("twsi 2p2", TWSI, p910_twsi_pin2),
691 GRP_910("twsi 2p3", TWSI, p910_twsi_pin3),
692 GRP_910("ccic", CCIC, p910_ccic_pin1),
693 GRP_910("lcd", LCD, p910_lcd_pin1),
694 GRP_910("spi 4p1", SPI, p910_spi_pin1),
695 GRP_910("spi 4p2", SPI, p910_spi_pin2),
696 GRP_910("spi 5p3", SPI, p910_spi_pin3),
697 GRP_910("spi 5p4", SPI, p910_spi_pin4),
698 GRP_910("dssp2 4p1", DSSP2, p910_dssp2_pin1),
699 GRP_910("dssp2 4p2", DSSP2, p910_dssp2_pin2),
700 GRP_910("dssp2 3p3", DSSP2, p910_dssp2_pin3),
701 GRP_910("dssp3 4p1", DSSP3, p910_dssp3_pin1),
702 GRP_910("dssp3 4p2", DSSP3, p910_dssp3_pin2),
703 GRP_910("dssp3 3p3", DSSP3, p910_dssp3_pin3),
704 GRP_910("ssp0 4p1", SSP0, p910_ssp0_pin1),
705 GRP_910("ssp0 4p2", SSP0, p910_ssp0_pin2),
706 GRP_910("ssp0 4p3", SSP0, p910_ssp0_pin3),
707 GRP_910("ssp0 4p4", SSP0, p910_ssp0_pin4),
708 GRP_910("ssp1 4p1", SSP1, p910_ssp1_pin1),
709 GRP_910("ssp1 5p2", SSP1, p910_ssp1_pin2),
710 GRP_910("ssp2 4p1", SSP2, p910_ssp2_pin1),
711 GRP_910("ssp2 4p2", SSP2, p910_ssp2_pin2),
712 GRP_910("ssp2 4p3", SSP2, p910_ssp2_pin3),
713 GRP_910("ssp2 4p4", SSP2, p910_ssp2_pin4),
714 GRP_910("gssp", GSSP, p910_gssp_pin1),
715 GRP_910("pwm0", PWM0, p910_pwm0_pin1),
716 GRP_910("pwm1-1", PWM1, p910_pwm1_pin1),
717 GRP_910("pwm1-2", PWM1, p910_pwm1_pin2),
718 GRP_910("pwm2", PWM2, p910_pwm2_pin1),
719 GRP_910("pwm3-1", PWM3, p910_pwm3_pin1),
720 GRP_910("pwm3-2", PWM3, p910_pwm3_pin2),
721 GRP_910("pwm3-3", PWM3, p910_pwm3_pin3),
722 GRP_910("pri jtag", PRI_JTAG, p910_pri_jtag_pin1),
723 GRP_910("sec1 jtag", SEC1_JTAG, p910_sec1_jtag_pin1),
724 GRP_910("sec2 jtag", SEC2_JTAG, p910_sec2_jtag_pin1),
725 GRP_910("hsl 6p1", HSL, p910_hsl_pin1),
726 GRP_910("hsl 6p2", HSL, p910_hsl_pin2),
727 GRP_910("hsl 6p3", HSL, p910_hsl_pin3),
728 GRP_910("w1-1", ONE_WIRE, p910_w1_pin1),
729 GRP_910("w1-2", ONE_WIRE, p910_w1_pin2),
730 GRP_910("w1-3", ONE_WIRE, p910_w1_pin3),
731 GRP_910("w1-4", ONE_WIRE, p910_w1_pin4),
732 GRP_910("kpmk 16p1", KP_MK, p910_kpmk_pin1),
733 GRP_910("kpmk 11p2", KP_MK, p910_kpmk_pin2),
734 GRP_910("kpdk 8p1", KP_DK, p910_kpdk_pin1),
735 GRP_910("tds 5p1", TDS, p910_tds_pin1),
736 GRP_910("tds 4p2", TDS, p910_tds_pin2),
737 GRP_910("tb 4p1", TB, p910_tb_pin1),
738 GRP_910("tb 4p2", TB, p910_tb_pin2),
739 GRP_910("tb 4p3", TB, p910_tb_pin3),
740 GRP_910("ext dma0-1", EXT_DMA, p910_ext_dma0_pin1),
741 GRP_910("ext dma0-2", EXT_DMA, p910_ext_dma0_pin2),
742 GRP_910("ext dma0-3", EXT_DMA, p910_ext_dma0_pin3),
743 GRP_910("ext dma1-1", EXT_DMA, p910_ext_dma1_pin1),
744 GRP_910("ext dma1-2", EXT_DMA, p910_ext_dma1_pin2),
745 GRP_910("ext dma1-3", EXT_DMA, p910_ext_dma1_pin3),
746 GRP_910("ext dma2", EXT_DMA, p910_ext_dma2_pin1),
747 GRP_910("ext0 int-1", EXT_INT, p910_ext0_int_pin1),
748 GRP_910("ext0 int-2", EXT_INT, p910_ext0_int_pin2),
749 GRP_910("ext1 int-1", EXT_INT, p910_ext1_int_pin1),
750 GRP_910("ext1 int-2", EXT_INT, p910_ext1_int_pin2),
751 GRP_910("ext2 int-1", EXT_INT, p910_ext2_int_pin1),
752 GRP_910("ext2 int-2", EXT_INT, p910_ext2_int_pin2),
753 GRP_910("dac st23-1", DAC_ST23, p910_dac_st23_pin1),
754 GRP_910("dac st23-2", DAC_ST23, p910_dac_st23_pin2),
755 GRP_910("dac st23-3", DAC_ST23, p910_dac_st23_pin3),
756 GRP_910("dac st23-4", DAC_ST23, p910_dac_st23_pin4),
757 GRP_910("vcxo out-1", VCXO_OUT, p910_vcxo_out_pin1),
758 GRP_910("vcxo out-2", VCXO_OUT, p910_vcxo_out_pin2),
759 GRP_910("vcxo out-3", VCXO_OUT, p910_vcxo_out_pin3),
760 GRP_910("vcxo req-1", VCXO_REQ, p910_vcxo_req_pin1),
761 GRP_910("vcxo req-2", VCXO_REQ, p910_vcxo_req_pin2),
762 GRP_910("vcxo out2-1", VCXO_OUT2, p910_vcxo_out2_pin1),
763 GRP_910("vcxo out2-2", VCXO_OUT2, p910_vcxo_out2_pin2),
764 GRP_910("vcxo req2", VCXO_REQ2, p910_vcxo_req2_pin1),
765 GRP_910("ulpi", ULPI, p910_ulpi_pin1),
766 GRP_910("nand", NAND, p910_nand_pin1),
767 GRP_910("gpio0-1", GPIO, p910_gpio0_pin1),
768 GRP_910("gpio0-2", GPIO, p910_gpio0_pin2),
769 GRP_910("gpio1-1", GPIO, p910_gpio1_pin1),
770 GRP_910("gpio1-2", GPIO, p910_gpio1_pin2),
771 GRP_910("gpio2-1", GPIO, p910_gpio2_pin1),
772 GRP_910("gpio2-2", GPIO, p910_gpio2_pin2),
773 GRP_910("gpio3-1", GPIO, p910_gpio3_pin1),
774 GRP_910("gpio3-2", GPIO, p910_gpio3_pin2),
775 GRP_910("gpio20-1", GPIO, p910_gpio20_pin1),
776 GRP_910("gpio20-2", GPIO, p910_gpio20_pin2),
777 GRP_910("gpio21-1", GPIO, p910_gpio21_pin1),
778 GRP_910("gpio21-2", GPIO, p910_gpio21_pin2),
779 GRP_910("gpio22-1", GPIO, p910_gpio22_pin1),
780 GRP_910("gpio22-2", GPIO, p910_gpio22_pin2),
781 GRP_910("gpio23-1", GPIO, p910_gpio23_pin1),
782 GRP_910("gpio23-2", GPIO, p910_gpio23_pin2),
783 GRP_910("gpio24-1", GPIO, p910_gpio24_pin1),
784 GRP_910("gpio24-2", GPIO, p910_gpio24_pin2),
785 GRP_910("gpio25-1", GPIO, p910_gpio25_pin1),
786 GRP_910("gpio25-2", GPIO, p910_gpio25_pin2),
787 GRP_910("gpio26-1", GPIO, p910_gpio26_pin1),
788 GRP_910("gpio26-2", GPIO, p910_gpio26_pin2),
789 GRP_910("gpio27-1", GPIO, p910_gpio27_pin1),
790 GRP_910("gpio27-2", GPIO, p910_gpio27_pin2),
791 GRP_910("gpio85-1", GPIO, p910_gpio85_pin1),
792 GRP_910("gpio85-2", GPIO, p910_gpio85_pin2),
793 GRP_910("gpio86-1", GPIO, p910_gpio86_pin1),
794 GRP_910("gpio86-2", GPIO, p910_gpio86_pin2),
795 GRP_910("gpio87-1", GPIO, p910_gpio87_pin1),
796 GRP_910("gpio87-2", GPIO, p910_gpio87_pin2),
797 GRP_910("gpio88-1", GPIO, p910_gpio88_pin1),
798 GRP_910("gpio88-2", GPIO, p910_gpio88_pin2),
799 GRP_910("gpio89-1", GPIO, p910_gpio89_pin1),
800 GRP_910("gpio89-2", GPIO, p910_gpio89_pin2),
801 GRP_910("gpio90-1", GPIO, p910_gpio90_pin1),
802 GRP_910("gpio90-2", GPIO, p910_gpio90_pin2),
803 GRP_910("gpio91-1", GPIO, p910_gpio91_pin1),
804 GRP_910("gpio91-2", GPIO, p910_gpio91_pin2),
805 GRP_910("gpio92-1", GPIO, p910_gpio92_pin1),
806 GRP_910("gpio92-2", GPIO, p910_gpio92_pin2),
807};
808
809static const char * const p910_usim2_grps[] = {"usim2 3p1", "usim2 3p2"};
810static const char * const p910_mmc1_grps[] = {"mmc1 12p"};
811static const char * const p910_mmc2_grps[] = {"mmc2 10p"};
812static const char * const p910_mmc3_grps[] = {"mmc3 6p", "mmc3 10p"};
813static const char * const p910_uart0_grps[] = {"uart0 4p"};
814static const char * const p910_uart1_grps[] = {"uart1 2p1", "uart1 2p2",
815 "uart1 2p3", "uart1 4p4", "uart1 4p5"};
816static const char * const p910_uart2_grps[] = {"uart2 2p1", "uart2 2p2",
817 "uart2 4p3", "uart2 4p4"};
818static const char * const p910_twsi_grps[] = {"twsi 2p1", "twsi 2p2",
819 "twsi 2p3"};
820static const char * const p910_ccic_grps[] = {"ccic"};
821static const char * const p910_lcd_grps[] = {"lcd"};
822static const char * const p910_spi_grps[] = {"spi 4p1", "spi 4p2", "spi 5p3",
823 "spi 5p4"};
824static const char * const p910_dssp2_grps[] = {"dssp2 4p1", "dssp2 4p2",
825 "dssp2 3p3"};
826static const char * const p910_dssp3_grps[] = {"dssp3 4p1", "dssp3 4p2",
827 "dssp3 3p3"};
828static const char * const p910_ssp0_grps[] = {"ssp0 4p1", "ssp0 4p2",
829 "ssp0 4p3", "ssp0 4p4"};
830static const char * const p910_ssp1_grps[] = {"ssp1 4p1", "ssp1 5p2"};
831static const char * const p910_ssp2_grps[] = {"ssp2 4p1", "ssp2 4p2",
832 "ssp2 4p3", "ssp2 4p4"};
833static const char * const p910_gssp_grps[] = {"gssp"};
834static const char * const p910_pwm0_grps[] = {"pwm0"};
835static const char * const p910_pwm1_grps[] = {"pwm1-1", "pwm1-2"};
836static const char * const p910_pwm2_grps[] = {"pwm2"};
837static const char * const p910_pwm3_grps[] = {"pwm3-1", "pwm3-2", "pwm3-3"};
838static const char * const p910_pri_jtag_grps[] = {"pri jtag"};
839static const char * const p910_sec1_jtag_grps[] = {"sec1 jtag"};
840static const char * const p910_sec2_jtag_grps[] = {"sec2 jtag"};
841static const char * const p910_hsl_grps[] = {"hsl 6p1", "hsl 6p2", "hsl 6p3"};
842static const char * const p910_w1_grps[] = {"w1-1", "w1-2", "w1-3", "w1-4"};
843static const char * const p910_kpmk_grps[] = {"kpmk 16p1", "kpmk 11p2"};
844static const char * const p910_kpdk_grps[] = {"kpdk 8p1"};
845static const char * const p910_tds_grps[] = {"tds 5p1", "tds 4p2"};
846static const char * const p910_tb_grps[] = {"tb 4p1", "tb 4p2", "tb 4p3"};
847static const char * const p910_dma0_grps[] = {"ext dma0-1", "ext dma0-2",
848 "ext dma0-3"};
849static const char * const p910_dma1_grps[] = {"ext dma1-1", "ext dma1-2",
850 "ext dma1-3"};
851static const char * const p910_dma2_grps[] = {"ext dma2"};
852static const char * const p910_int0_grps[] = {"ext0 int-1", "ext0 int-2"};
853static const char * const p910_int1_grps[] = {"ext1 int-1", "ext1 int-2"};
854static const char * const p910_int2_grps[] = {"ext2 int-1", "ext2 int-2"};
855static const char * const p910_dac_st23_grps[] = {"dac st23-1", "dac st23-2",
856 "dac st23-3", "dac st23-4"};
857static const char * const p910_vcxo_out_grps[] = {"vcxo out-1", "vcxo out-2",
858 "vcxo out-3"};
859static const char * const p910_vcxo_req_grps[] = {"vcxo req-1", "vcxo req-2"};
860static const char * const p910_vcxo_out2_grps[] = {"vcxo out2-1",
861 "vcxo out2-2"};
862static const char * const p910_vcxo_req2_grps[] = {"vcxo req2"};
863static const char * const p910_ulpi_grps[] = {"ulpi"};
864static const char * const p910_nand_grps[] = {"nand"};
865static const char * const p910_gpio0_grps[] = {"gpio0-1", "gpio0-2"};
866static const char * const p910_gpio1_grps[] = {"gpio1-1", "gpio1-2"};
867static const char * const p910_gpio2_grps[] = {"gpio2-1", "gpio2-2"};
868static const char * const p910_gpio3_grps[] = {"gpio3-1", "gpio3-2"};
869static const char * const p910_gpio20_grps[] = {"gpio20-1", "gpio20-2"};
870static const char * const p910_gpio21_grps[] = {"gpio21-1", "gpio21-2"};
871static const char * const p910_gpio22_grps[] = {"gpio22-1", "gpio22-2"};
872static const char * const p910_gpio23_grps[] = {"gpio23-1", "gpio23-2"};
873static const char * const p910_gpio24_grps[] = {"gpio24-1", "gpio24-2"};
874static const char * const p910_gpio25_grps[] = {"gpio25-1", "gpio25-2"};
875static const char * const p910_gpio26_grps[] = {"gpio26-1", "gpio26-2"};
876static const char * const p910_gpio27_grps[] = {"gpio27-1", "gpio27-2"};
877static const char * const p910_gpio85_grps[] = {"gpio85-1", "gpio85-2"};
878static const char * const p910_gpio86_grps[] = {"gpio86-1", "gpio86-2"};
879static const char * const p910_gpio87_grps[] = {"gpio87-1", "gpio87-2"};
880static const char * const p910_gpio88_grps[] = {"gpio88-1", "gpio88-2"};
881static const char * const p910_gpio89_grps[] = {"gpio89-1", "gpio89-2"};
882static const char * const p910_gpio90_grps[] = {"gpio90-1", "gpio90-2"};
883static const char * const p910_gpio91_grps[] = {"gpio91-1", "gpio91-2"};
884static const char * const p910_gpio92_grps[] = {"gpio92-1", "gpio92-2"};
885
886static struct pxa3xx_pmx_func pxa910_funcs[] = {
887 {"usim2", ARRAY_AND_SIZE(p910_usim2_grps)},
888 {"mmc1", ARRAY_AND_SIZE(p910_mmc1_grps)},
889 {"mmc2", ARRAY_AND_SIZE(p910_mmc2_grps)},
890 {"mmc3", ARRAY_AND_SIZE(p910_mmc3_grps)},
891 {"uart0", ARRAY_AND_SIZE(p910_uart0_grps)},
892 {"uart1", ARRAY_AND_SIZE(p910_uart1_grps)},
893 {"uart2", ARRAY_AND_SIZE(p910_uart2_grps)},
894 {"twsi", ARRAY_AND_SIZE(p910_twsi_grps)},
895 {"ccic", ARRAY_AND_SIZE(p910_ccic_grps)},
896 {"lcd", ARRAY_AND_SIZE(p910_lcd_grps)},
897 {"spi", ARRAY_AND_SIZE(p910_spi_grps)},
898 {"dssp2", ARRAY_AND_SIZE(p910_dssp2_grps)},
899 {"dssp3", ARRAY_AND_SIZE(p910_dssp3_grps)},
900 {"ssp0", ARRAY_AND_SIZE(p910_ssp0_grps)},
901 {"ssp1", ARRAY_AND_SIZE(p910_ssp1_grps)},
902 {"ssp2", ARRAY_AND_SIZE(p910_ssp2_grps)},
903 {"gssp", ARRAY_AND_SIZE(p910_gssp_grps)},
904 {"pwm0", ARRAY_AND_SIZE(p910_pwm0_grps)},
905 {"pwm1", ARRAY_AND_SIZE(p910_pwm1_grps)},
906 {"pwm2", ARRAY_AND_SIZE(p910_pwm2_grps)},
907 {"pwm3", ARRAY_AND_SIZE(p910_pwm3_grps)},
908 {"pri_jtag", ARRAY_AND_SIZE(p910_pri_jtag_grps)},
909 {"sec1_jtag", ARRAY_AND_SIZE(p910_sec1_jtag_grps)},
910 {"sec2_jtag", ARRAY_AND_SIZE(p910_sec2_jtag_grps)},
911 {"hsl", ARRAY_AND_SIZE(p910_hsl_grps)},
912 {"w1", ARRAY_AND_SIZE(p910_w1_grps)},
913 {"kpmk", ARRAY_AND_SIZE(p910_kpmk_grps)},
914 {"kpdk", ARRAY_AND_SIZE(p910_kpdk_grps)},
915 {"tds", ARRAY_AND_SIZE(p910_tds_grps)},
916 {"tb", ARRAY_AND_SIZE(p910_tb_grps)},
917 {"dma0", ARRAY_AND_SIZE(p910_dma0_grps)},
918 {"dma1", ARRAY_AND_SIZE(p910_dma1_grps)},
919 {"dma2", ARRAY_AND_SIZE(p910_dma2_grps)},
920 {"int0", ARRAY_AND_SIZE(p910_int0_grps)},
921 {"int1", ARRAY_AND_SIZE(p910_int1_grps)},
922 {"int2", ARRAY_AND_SIZE(p910_int2_grps)},
923 {"dac_st23", ARRAY_AND_SIZE(p910_dac_st23_grps)},
924 {"vcxo_out", ARRAY_AND_SIZE(p910_vcxo_out_grps)},
925 {"vcxo_req", ARRAY_AND_SIZE(p910_vcxo_req_grps)},
926 {"vcxo_out2", ARRAY_AND_SIZE(p910_vcxo_out2_grps)},
927 {"vcxo_req2", ARRAY_AND_SIZE(p910_vcxo_req2_grps)},
928 {"ulpi", ARRAY_AND_SIZE(p910_ulpi_grps)},
929 {"nand", ARRAY_AND_SIZE(p910_nand_grps)},
930 {"gpio0", ARRAY_AND_SIZE(p910_gpio0_grps)},
931 {"gpio1", ARRAY_AND_SIZE(p910_gpio1_grps)},
932 {"gpio2", ARRAY_AND_SIZE(p910_gpio2_grps)},
933 {"gpio3", ARRAY_AND_SIZE(p910_gpio3_grps)},
934 {"gpio20", ARRAY_AND_SIZE(p910_gpio20_grps)},
935 {"gpio21", ARRAY_AND_SIZE(p910_gpio21_grps)},
936 {"gpio22", ARRAY_AND_SIZE(p910_gpio22_grps)},
937 {"gpio23", ARRAY_AND_SIZE(p910_gpio23_grps)},
938 {"gpio24", ARRAY_AND_SIZE(p910_gpio24_grps)},
939 {"gpio25", ARRAY_AND_SIZE(p910_gpio25_grps)},
940 {"gpio26", ARRAY_AND_SIZE(p910_gpio26_grps)},
941 {"gpio27", ARRAY_AND_SIZE(p910_gpio27_grps)},
942 {"gpio85", ARRAY_AND_SIZE(p910_gpio85_grps)},
943 {"gpio86", ARRAY_AND_SIZE(p910_gpio86_grps)},
944 {"gpio87", ARRAY_AND_SIZE(p910_gpio87_grps)},
945 {"gpio88", ARRAY_AND_SIZE(p910_gpio88_grps)},
946 {"gpio89", ARRAY_AND_SIZE(p910_gpio89_grps)},
947 {"gpio90", ARRAY_AND_SIZE(p910_gpio90_grps)},
948 {"gpio91", ARRAY_AND_SIZE(p910_gpio91_grps)},
949 {"gpio92", ARRAY_AND_SIZE(p910_gpio92_grps)},
950};
951
952static struct pinctrl_desc pxa910_pctrl_desc = {
953 .name = "pxa910-pinctrl",
954 .owner = THIS_MODULE,
955};
956
957static struct pxa3xx_pinmux_info pxa910_info = {
958 .mfp = pxa910_mfp,
959 .num_mfp = ARRAY_SIZE(pxa910_mfp),
960 .grps = pxa910_grps,
961 .num_grps = ARRAY_SIZE(pxa910_grps),
962 .funcs = pxa910_funcs,
963 .num_funcs = ARRAY_SIZE(pxa910_funcs),
964 .num_gpio = 128,
965 .desc = &pxa910_pctrl_desc,
966 .pads = pxa910_pads,
967 .num_pads = ARRAY_SIZE(pxa910_pads),
968
969 .cputype = PINCTRL_PXA910,
970 .ds_mask = PXA910_DS_MASK,
971 .ds_shift = PXA910_DS_SHIFT,
972};
973
974static int __devinit pxa910_pinmux_probe(struct platform_device *pdev)
975{
976 return pxa3xx_pinctrl_register(pdev, &pxa910_info);
977}
978
979static int __devexit pxa910_pinmux_remove(struct platform_device *pdev)
980{
981 return pxa3xx_pinctrl_unregister(pdev);
982}
983
984static struct platform_driver pxa910_pinmux_driver = {
985 .driver = {
986 .name = "pxa910-pinmux",
987 .owner = THIS_MODULE,
988 },
989 .probe = pxa910_pinmux_probe,
990 .remove = __devexit_p(pxa910_pinmux_remove),
991};
992
993static int __init pxa910_pinmux_init(void)
994{
995 return platform_driver_register(&pxa910_pinmux_driver);
996}
997core_initcall_sync(pxa910_pinmux_init);
998
999static void __exit pxa910_pinmux_exit(void)
1000{
1001 platform_driver_unregister(&pxa910_pinmux_driver);
1002}
1003module_exit(pxa910_pinmux_exit);
1004
1005MODULE_AUTHOR("Haojian Zhuang <haojian.zhuang@marvell.com>");
1006MODULE_DESCRIPTION("PXA3xx pin control driver");
1007MODULE_LICENSE("GPL v2");
diff --git a/drivers/pinctrl/pinctrl-tegra.c b/drivers/pinctrl/pinctrl-tegra.c
new file mode 100644
index 000000000000..9b329688120c
--- /dev/null
+++ b/drivers/pinctrl/pinctrl-tegra.c
@@ -0,0 +1,559 @@
1/*
2 * Driver for the NVIDIA Tegra pinmux
3 *
4 * Copyright (c) 2011, NVIDIA CORPORATION. All rights reserved.
5 *
6 * Derived from code:
7 * Copyright (C) 2010 Google, Inc.
8 * Copyright (C) 2010 NVIDIA Corporation
9 * Copyright (C) 2009-2011 ST-Ericsson AB
10 *
11 * This program is free software; you can redistribute it and/or modify it
12 * under the terms and conditions of the GNU General Public License,
13 * version 2, as published by the Free Software Foundation.
14 *
15 * This program is distributed in the hope it will be useful, but WITHOUT
16 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
17 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 * more details.
19 */
20
21#include <linux/err.h>
22#include <linux/init.h>
23#include <linux/io.h>
24#include <linux/module.h>
25#include <linux/of_device.h>
26#include <linux/pinctrl/pinctrl.h>
27#include <linux/pinctrl/pinmux.h>
28#include <linux/pinctrl/pinconf.h>
29
30#include <mach/pinconf-tegra.h>
31
32#include "pinctrl-tegra.h"
33
34#define DRIVER_NAME "tegra-pinmux-disabled"
35
36struct tegra_pmx {
37 struct device *dev;
38 struct pinctrl_dev *pctl;
39
40 const struct tegra_pinctrl_soc_data *soc;
41
42 int nbanks;
43 void __iomem **regs;
44};
45
46static inline u32 pmx_readl(struct tegra_pmx *pmx, u32 bank, u32 reg)
47{
48 return readl(pmx->regs[bank] + reg);
49}
50
51static inline void pmx_writel(struct tegra_pmx *pmx, u32 val, u32 bank, u32 reg)
52{
53 writel(val, pmx->regs[bank] + reg);
54}
55
56static int tegra_pinctrl_list_groups(struct pinctrl_dev *pctldev,
57 unsigned group)
58{
59 struct tegra_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
60
61 if (group >= pmx->soc->ngroups)
62 return -EINVAL;
63
64 return 0;
65}
66
67static const char *tegra_pinctrl_get_group_name(struct pinctrl_dev *pctldev,
68 unsigned group)
69{
70 struct tegra_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
71
72 if (group >= pmx->soc->ngroups)
73 return NULL;
74
75 return pmx->soc->groups[group].name;
76}
77
78static int tegra_pinctrl_get_group_pins(struct pinctrl_dev *pctldev,
79 unsigned group,
80 const unsigned **pins,
81 unsigned *num_pins)
82{
83 struct tegra_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
84
85 if (group >= pmx->soc->ngroups)
86 return -EINVAL;
87
88 *pins = pmx->soc->groups[group].pins;
89 *num_pins = pmx->soc->groups[group].npins;
90
91 return 0;
92}
93
94static void tegra_pinctrl_pin_dbg_show(struct pinctrl_dev *pctldev,
95 struct seq_file *s,
96 unsigned offset)
97{
98 seq_printf(s, " " DRIVER_NAME);
99}
100
101static struct pinctrl_ops tegra_pinctrl_ops = {
102 .list_groups = tegra_pinctrl_list_groups,
103 .get_group_name = tegra_pinctrl_get_group_name,
104 .get_group_pins = tegra_pinctrl_get_group_pins,
105 .pin_dbg_show = tegra_pinctrl_pin_dbg_show,
106};
107
108static int tegra_pinctrl_list_funcs(struct pinctrl_dev *pctldev,
109 unsigned function)
110{
111 struct tegra_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
112
113 if (function >= pmx->soc->nfunctions)
114 return -EINVAL;
115
116 return 0;
117}
118
119static const char *tegra_pinctrl_get_func_name(struct pinctrl_dev *pctldev,
120 unsigned function)
121{
122 struct tegra_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
123
124 if (function >= pmx->soc->nfunctions)
125 return NULL;
126
127 return pmx->soc->functions[function].name;
128}
129
130static int tegra_pinctrl_get_func_groups(struct pinctrl_dev *pctldev,
131 unsigned function,
132 const char * const **groups,
133 unsigned * const num_groups)
134{
135 struct tegra_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
136
137 if (function >= pmx->soc->nfunctions)
138 return -EINVAL;
139
140 *groups = pmx->soc->functions[function].groups;
141 *num_groups = pmx->soc->functions[function].ngroups;
142
143 return 0;
144}
145
146static int tegra_pinctrl_enable(struct pinctrl_dev *pctldev, unsigned function,
147 unsigned group)
148{
149 struct tegra_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
150 const struct tegra_pingroup *g;
151 int i;
152 u32 val;
153
154 if (group >= pmx->soc->ngroups)
155 return -EINVAL;
156 g = &pmx->soc->groups[group];
157
158 if (g->mux_reg < 0)
159 return -EINVAL;
160
161 for (i = 0; i < ARRAY_SIZE(g->funcs); i++) {
162 if (g->funcs[i] == function)
163 break;
164 }
165 if (i == ARRAY_SIZE(g->funcs))
166 return -EINVAL;
167
168 val = pmx_readl(pmx, g->mux_bank, g->mux_reg);
169 val &= ~(0x3 << g->mux_bit);
170 val |= i << g->mux_bit;
171 pmx_writel(pmx, val, g->mux_bank, g->mux_reg);
172
173 return 0;
174}
175
176static void tegra_pinctrl_disable(struct pinctrl_dev *pctldev,
177 unsigned function, unsigned group)
178{
179 struct tegra_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
180 const struct tegra_pingroup *g;
181 u32 val;
182
183 if (group >= pmx->soc->ngroups)
184 return;
185 g = &pmx->soc->groups[group];
186
187 if (g->mux_reg < 0)
188 return;
189
190 val = pmx_readl(pmx, g->mux_bank, g->mux_reg);
191 val &= ~(0x3 << g->mux_bit);
192 val |= g->func_safe << g->mux_bit;
193 pmx_writel(pmx, val, g->mux_bank, g->mux_reg);
194}
195
196static struct pinmux_ops tegra_pinmux_ops = {
197 .list_functions = tegra_pinctrl_list_funcs,
198 .get_function_name = tegra_pinctrl_get_func_name,
199 .get_function_groups = tegra_pinctrl_get_func_groups,
200 .enable = tegra_pinctrl_enable,
201 .disable = tegra_pinctrl_disable,
202};
203
204static int tegra_pinconf_reg(struct tegra_pmx *pmx,
205 const struct tegra_pingroup *g,
206 enum tegra_pinconf_param param,
207 s8 *bank, s16 *reg, s8 *bit, s8 *width)
208{
209 switch (param) {
210 case TEGRA_PINCONF_PARAM_PULL:
211 *bank = g->pupd_bank;
212 *reg = g->pupd_reg;
213 *bit = g->pupd_bit;
214 *width = 2;
215 break;
216 case TEGRA_PINCONF_PARAM_TRISTATE:
217 *bank = g->tri_bank;
218 *reg = g->tri_reg;
219 *bit = g->tri_bit;
220 *width = 1;
221 break;
222 case TEGRA_PINCONF_PARAM_ENABLE_INPUT:
223 *bank = g->einput_bank;
224 *reg = g->einput_reg;
225 *bit = g->einput_bit;
226 *width = 1;
227 break;
228 case TEGRA_PINCONF_PARAM_OPEN_DRAIN:
229 *bank = g->odrain_bank;
230 *reg = g->odrain_reg;
231 *bit = g->odrain_bit;
232 *width = 1;
233 break;
234 case TEGRA_PINCONF_PARAM_LOCK:
235 *bank = g->lock_bank;
236 *reg = g->lock_reg;
237 *bit = g->lock_bit;
238 *width = 1;
239 break;
240 case TEGRA_PINCONF_PARAM_IORESET:
241 *bank = g->ioreset_bank;
242 *reg = g->ioreset_reg;
243 *bit = g->ioreset_bit;
244 *width = 1;
245 break;
246 case TEGRA_PINCONF_PARAM_HIGH_SPEED_MODE:
247 *bank = g->drv_bank;
248 *reg = g->drv_reg;
249 *bit = g->hsm_bit;
250 *width = 1;
251 break;
252 case TEGRA_PINCONF_PARAM_SCHMITT:
253 *bank = g->drv_bank;
254 *reg = g->drv_reg;
255 *bit = g->schmitt_bit;
256 *width = 1;
257 break;
258 case TEGRA_PINCONF_PARAM_LOW_POWER_MODE:
259 *bank = g->drv_bank;
260 *reg = g->drv_reg;
261 *bit = g->lpmd_bit;
262 *width = 1;
263 break;
264 case TEGRA_PINCONF_PARAM_DRIVE_DOWN_STRENGTH:
265 *bank = g->drv_bank;
266 *reg = g->drv_reg;
267 *bit = g->drvdn_bit;
268 *width = g->drvdn_width;
269 break;
270 case TEGRA_PINCONF_PARAM_DRIVE_UP_STRENGTH:
271 *bank = g->drv_bank;
272 *reg = g->drv_reg;
273 *bit = g->drvup_bit;
274 *width = g->drvup_width;
275 break;
276 case TEGRA_PINCONF_PARAM_SLEW_RATE_FALLING:
277 *bank = g->drv_bank;
278 *reg = g->drv_reg;
279 *bit = g->slwf_bit;
280 *width = g->slwf_width;
281 break;
282 case TEGRA_PINCONF_PARAM_SLEW_RATE_RISING:
283 *bank = g->drv_bank;
284 *reg = g->drv_reg;
285 *bit = g->slwr_bit;
286 *width = g->slwr_width;
287 break;
288 default:
289 dev_err(pmx->dev, "Invalid config param %04x\n", param);
290 return -ENOTSUPP;
291 }
292
293 if (*reg < 0) {
294 dev_err(pmx->dev,
295 "Config param %04x not supported on group %s\n",
296 param, g->name);
297 return -ENOTSUPP;
298 }
299
300 return 0;
301}
302
303static int tegra_pinconf_get(struct pinctrl_dev *pctldev,
304 unsigned pin, unsigned long *config)
305{
306 return -ENOTSUPP;
307}
308
309static int tegra_pinconf_set(struct pinctrl_dev *pctldev,
310 unsigned pin, unsigned long config)
311{
312 return -ENOTSUPP;
313}
314
315static int tegra_pinconf_group_get(struct pinctrl_dev *pctldev,
316 unsigned group, unsigned long *config)
317{
318 struct tegra_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
319 enum tegra_pinconf_param param = TEGRA_PINCONF_UNPACK_PARAM(*config);
320 u16 arg;
321 const struct tegra_pingroup *g;
322 int ret;
323 s8 bank, bit, width;
324 s16 reg;
325 u32 val, mask;
326
327 if (group >= pmx->soc->ngroups)
328 return -EINVAL;
329 g = &pmx->soc->groups[group];
330
331 ret = tegra_pinconf_reg(pmx, g, param, &bank, &reg, &bit, &width);
332 if (ret < 0)
333 return ret;
334
335 val = pmx_readl(pmx, bank, reg);
336 mask = (1 << width) - 1;
337 arg = (val >> bit) & mask;
338
339 *config = TEGRA_PINCONF_PACK(param, arg);
340
341 return 0;
342}
343
344static int tegra_pinconf_group_set(struct pinctrl_dev *pctldev,
345 unsigned group, unsigned long config)
346{
347 struct tegra_pmx *pmx = pinctrl_dev_get_drvdata(pctldev);
348 enum tegra_pinconf_param param = TEGRA_PINCONF_UNPACK_PARAM(config);
349 u16 arg = TEGRA_PINCONF_UNPACK_ARG(config);
350 const struct tegra_pingroup *g;
351 int ret;
352 s8 bank, bit, width;
353 s16 reg;
354 u32 val, mask;
355
356 if (group >= pmx->soc->ngroups)
357 return -EINVAL;
358 g = &pmx->soc->groups[group];
359
360 ret = tegra_pinconf_reg(pmx, g, param, &bank, &reg, &bit, &width);
361 if (ret < 0)
362 return ret;
363
364 val = pmx_readl(pmx, bank, reg);
365
366 /* LOCK can't be cleared */
367 if (param == TEGRA_PINCONF_PARAM_LOCK) {
368 if ((val & BIT(bit)) && !arg)
369 return -EINVAL;
370 }
371
372 /* Special-case Boolean values; allow any non-zero as true */
373 if (width == 1)
374 arg = !!arg;
375
376 /* Range-check user-supplied value */
377 mask = (1 << width) - 1;
378 if (arg & ~mask)
379 return -EINVAL;
380
381 /* Update register */
382 val &= ~(mask << bit);
383 val |= arg << bit;
384 pmx_writel(pmx, val, bank, reg);
385
386 return 0;
387}
388
389static void tegra_pinconf_dbg_show(struct pinctrl_dev *pctldev,
390 struct seq_file *s, unsigned offset)
391{
392}
393
394static void tegra_pinconf_group_dbg_show(struct pinctrl_dev *pctldev,
395 struct seq_file *s, unsigned selector)
396{
397}
398
399struct pinconf_ops tegra_pinconf_ops = {
400 .pin_config_get = tegra_pinconf_get,
401 .pin_config_set = tegra_pinconf_set,
402 .pin_config_group_get = tegra_pinconf_group_get,
403 .pin_config_group_set = tegra_pinconf_group_set,
404 .pin_config_dbg_show = tegra_pinconf_dbg_show,
405 .pin_config_group_dbg_show = tegra_pinconf_group_dbg_show,
406};
407
408static struct pinctrl_gpio_range tegra_pinctrl_gpio_range = {
409 .name = "Tegra GPIOs",
410 .id = 0,
411 .base = 0,
412};
413
414static struct pinctrl_desc tegra_pinctrl_desc = {
415 .name = DRIVER_NAME,
416 .pctlops = &tegra_pinctrl_ops,
417 .pmxops = &tegra_pinmux_ops,
418 .confops = &tegra_pinconf_ops,
419 .owner = THIS_MODULE,
420};
421
422static struct of_device_id tegra_pinctrl_of_match[] __devinitdata = {
423#ifdef CONFIG_PINCTRL_TEGRA20
424 {
425 .compatible = "nvidia,tegra20-pinmux-disabled",
426 .data = tegra20_pinctrl_init,
427 },
428#endif
429#ifdef CONFIG_PINCTRL_TEGRA30
430 {
431 .compatible = "nvidia,tegra30-pinmux-disabled",
432 .data = tegra30_pinctrl_init,
433 },
434#endif
435 {},
436};
437
438static int __devinit tegra_pinctrl_probe(struct platform_device *pdev)
439{
440 const struct of_device_id *match;
441 tegra_pinctrl_soc_initf initf = NULL;
442 struct tegra_pmx *pmx;
443 struct resource *res;
444 int i;
445
446 match = of_match_device(tegra_pinctrl_of_match, &pdev->dev);
447 if (match)
448 initf = (tegra_pinctrl_soc_initf)match->data;
449#ifdef CONFIG_PINCTRL_TEGRA20
450 if (!initf)
451 initf = tegra20_pinctrl_init;
452#endif
453 if (!initf) {
454 dev_err(&pdev->dev,
455 "Could not determine SoC-specific init func\n");
456 return -EINVAL;
457 }
458
459 pmx = devm_kzalloc(&pdev->dev, sizeof(*pmx), GFP_KERNEL);
460 if (!pmx) {
461 dev_err(&pdev->dev, "Can't alloc tegra_pmx\n");
462 return -ENOMEM;
463 }
464 pmx->dev = &pdev->dev;
465
466 (*initf)(&pmx->soc);
467
468 tegra_pinctrl_gpio_range.npins = pmx->soc->ngpios;
469 tegra_pinctrl_desc.pins = pmx->soc->pins;
470 tegra_pinctrl_desc.npins = pmx->soc->npins;
471
472 for (i = 0; ; i++) {
473 res = platform_get_resource(pdev, IORESOURCE_MEM, i);
474 if (!res)
475 break;
476 }
477 pmx->nbanks = i;
478
479 pmx->regs = devm_kzalloc(&pdev->dev, pmx->nbanks * sizeof(*pmx->regs),
480 GFP_KERNEL);
481 if (!pmx->regs) {
482 dev_err(&pdev->dev, "Can't alloc regs pointer\n");
483 return -ENODEV;
484 }
485
486 for (i = 0; i < pmx->nbanks; i++) {
487 res = platform_get_resource(pdev, IORESOURCE_MEM, i);
488 if (!res) {
489 dev_err(&pdev->dev, "Missing MEM resource\n");
490 return -ENODEV;
491 }
492
493 if (!devm_request_mem_region(&pdev->dev, res->start,
494 resource_size(res),
495 dev_name(&pdev->dev))) {
496 dev_err(&pdev->dev,
497 "Couldn't request MEM resource %d\n", i);
498 return -ENODEV;
499 }
500
501 pmx->regs[i] = devm_ioremap(&pdev->dev, res->start,
502 resource_size(res));
503 if (!pmx->regs[i]) {
504 dev_err(&pdev->dev, "Couldn't ioremap regs %d\n", i);
505 return -ENODEV;
506 }
507 }
508
509 pmx->pctl = pinctrl_register(&tegra_pinctrl_desc, &pdev->dev, pmx);
510 if (IS_ERR(pmx->pctl)) {
511 dev_err(&pdev->dev, "Couldn't register pinctrl driver\n");
512 return PTR_ERR(pmx->pctl);
513 }
514
515 pinctrl_add_gpio_range(pmx->pctl, &tegra_pinctrl_gpio_range);
516
517 platform_set_drvdata(pdev, pmx);
518
519 dev_dbg(&pdev->dev, "Probed Tegra pinctrl driver\n");
520
521 return 0;
522}
523
524static int __devexit tegra_pinctrl_remove(struct platform_device *pdev)
525{
526 struct tegra_pmx *pmx = platform_get_drvdata(pdev);
527
528 pinctrl_remove_gpio_range(pmx->pctl, &tegra_pinctrl_gpio_range);
529 pinctrl_unregister(pmx->pctl);
530
531 return 0;
532}
533
534static struct platform_driver tegra_pinctrl_driver = {
535 .driver = {
536 .name = DRIVER_NAME,
537 .owner = THIS_MODULE,
538 .of_match_table = tegra_pinctrl_of_match,
539 },
540 .probe = tegra_pinctrl_probe,
541 .remove = __devexit_p(tegra_pinctrl_remove),
542};
543
544static int __init tegra_pinctrl_init(void)
545{
546 return platform_driver_register(&tegra_pinctrl_driver);
547}
548arch_initcall(tegra_pinctrl_init);
549
550static void __exit tegra_pinctrl_exit(void)
551{
552 platform_driver_unregister(&tegra_pinctrl_driver);
553}
554module_exit(tegra_pinctrl_exit);
555
556MODULE_AUTHOR("Stephen Warren <swarren@nvidia.com>");
557MODULE_DESCRIPTION("NVIDIA Tegra pinctrl driver");
558MODULE_LICENSE("GPL v2");
559MODULE_DEVICE_TABLE(of, tegra_pinctrl_of_match);
diff --git a/drivers/pinctrl/pinctrl-tegra.h b/drivers/pinctrl/pinctrl-tegra.h
new file mode 100644
index 000000000000..782c795326ef
--- /dev/null
+++ b/drivers/pinctrl/pinctrl-tegra.h
@@ -0,0 +1,163 @@
1/*
2 * Driver for the NVIDIA Tegra pinmux
3 *
4 * Copyright (c) 2011, NVIDIA CORPORATION. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 */
15
16#ifndef __PINMUX_TEGRA_H__
17#define __PINMUX_TEGRA_H__
18
19/**
20 * struct tegra_function - Tegra pinctrl mux function
21 * @name: The name of the function, exported to pinctrl core.
22 * @groups: An array of pin groups that may select this function.
23 * @ngroups: The number of entries in @groups.
24 */
25struct tegra_function {
26 const char *name;
27 const char * const *groups;
28 unsigned ngroups;
29};
30
31/**
32 * struct tegra_pingroup - Tegra pin group
33 * @mux_reg: Mux register offset. -1 if unsupported.
34 * @mux_bank: Mux register bank. 0 if unsupported.
35 * @mux_bit: Mux register bit. 0 if unsupported.
36 * @pupd_reg: Pull-up/down register offset. -1 if unsupported.
37 * @pupd_bank: Pull-up/down register bank. 0 if unsupported.
38 * @pupd_bit: Pull-up/down register bit. 0 if unsupported.
39 * @tri_reg: Tri-state register offset. -1 if unsupported.
40 * @tri_bank: Tri-state register bank. 0 if unsupported.
41 * @tri_bit: Tri-state register bit. 0 if unsupported.
42 * @einput_reg: Enable-input register offset. -1 if unsupported.
43 * @einput_bank: Enable-input register bank. 0 if unsupported.
44 * @einput_bit: Enable-input register bit. 0 if unsupported.
45 * @odrain_reg: Open-drain register offset. -1 if unsupported.
46 * @odrain_bank: Open-drain register bank. 0 if unsupported.
47 * @odrain_bit: Open-drain register bit. 0 if unsupported.
48 * @lock_reg: Lock register offset. -1 if unsupported.
49 * @lock_bank: Lock register bank. 0 if unsupported.
50 * @lock_bit: Lock register bit. 0 if unsupported.
51 * @ioreset_reg: IO reset register offset. -1 if unsupported.
52 * @ioreset_bank: IO reset register bank. 0 if unsupported.
53 * @ioreset_bit: IO reset register bit. 0 if unsupported.
54 * @drv_reg: Drive fields register offset. -1 if unsupported.
55 * This register contains the hsm, schmitt, lpmd, drvdn,
56 * drvup, slwr, and slwf parameters.
57 * @drv_bank: Drive fields register bank. 0 if unsupported.
58 * @hsm_bit: High Speed Mode register bit. 0 if unsupported.
59 * @schmitt_bit: Scmitt register bit. 0 if unsupported.
60 * @lpmd_bit: Low Power Mode register bit. 0 if unsupported.
61 * @drvdn_bit: Drive Down register bit. 0 if unsupported.
62 * @drvdn_width: Drive Down field width. 0 if unsupported.
63 * @drvup_bit: Drive Up register bit. 0 if unsupported.
64 * @drvup_width: Drive Up field width. 0 if unsupported.
65 * @slwr_bit: Slew Rising register bit. 0 if unsupported.
66 * @slwr_width: Slew Rising field width. 0 if unsupported.
67 * @slwf_bit: Slew Falling register bit. 0 if unsupported.
68 * @slwf_width: Slew Falling field width. 0 if unsupported.
69 *
70 * A representation of a group of pins (possibly just one pin) in the Tegra
71 * pin controller. Each group allows some parameter or parameters to be
72 * configured. The most common is mux function selection. Many others exist
73 * such as pull-up/down, tri-state, etc. Tegra's pin controller is complex;
74 * certain groups may only support configuring certain parameters, hence
75 * each parameter is optional, represented by a -1 "reg" value.
76 */
77struct tegra_pingroup {
78 const char *name;
79 const unsigned *pins;
80 unsigned npins;
81 unsigned funcs[4];
82 unsigned func_safe;
83 s16 mux_reg;
84 s16 pupd_reg;
85 s16 tri_reg;
86 s16 einput_reg;
87 s16 odrain_reg;
88 s16 lock_reg;
89 s16 ioreset_reg;
90 s16 drv_reg;
91 u32 mux_bank:2;
92 u32 pupd_bank:2;
93 u32 tri_bank:2;
94 u32 einput_bank:2;
95 u32 odrain_bank:2;
96 u32 ioreset_bank:2;
97 u32 lock_bank:2;
98 u32 drv_bank:2;
99 u32 mux_bit:5;
100 u32 pupd_bit:5;
101 u32 tri_bit:5;
102 u32 einput_bit:5;
103 u32 odrain_bit:5;
104 u32 lock_bit:5;
105 u32 ioreset_bit:5;
106 u32 hsm_bit:5;
107 u32 schmitt_bit:5;
108 u32 lpmd_bit:5;
109 u32 drvdn_bit:5;
110 u32 drvup_bit:5;
111 u32 slwr_bit:5;
112 u32 slwf_bit:5;
113 u32 drvdn_width:6;
114 u32 drvup_width:6;
115 u32 slwr_width:6;
116 u32 slwf_width:6;
117};
118
119/**
120 * struct tegra_pinctrl_soc_data - Tegra pin controller driver configuration
121 * @ngpios: The number of GPIO pins the pin controller HW affects.
122 * @pins: An array describing all pins the pin controller affects.
123 * All pins which are also GPIOs must be listed first within the
124 * array, and be numbered identically to the GPIO controller's
125 * numbering.
126 * @npins: The numbmer of entries in @pins.
127 * @functions: An array describing all mux functions the SoC supports.
128 * @nfunctions: The numbmer of entries in @functions.
129 * @groups: An array describing all pin groups the pin SoC supports.
130 * @ngroups: The numbmer of entries in @groups.
131 */
132struct tegra_pinctrl_soc_data {
133 unsigned ngpios;
134 const struct pinctrl_pin_desc *pins;
135 unsigned npins;
136 const struct tegra_function *functions;
137 unsigned nfunctions;
138 const struct tegra_pingroup *groups;
139 unsigned ngroups;
140};
141
142/**
143 * tegra_pinctrl_soc_initf() - Retrieve pin controller details for a SoC.
144 * @soc_data: This pointer must be updated to point at a struct containing
145 * details of the SoC.
146 */
147typedef void (*tegra_pinctrl_soc_initf)(
148 const struct tegra_pinctrl_soc_data **soc_data);
149
150/**
151 * tegra20_pinctrl_init() - Retrieve pin controller details for Tegra20
152 * @soc_data: This pointer will be updated to point at a struct containing
153 * details of Tegra20's pin controller.
154 */
155void tegra20_pinctrl_init(const struct tegra_pinctrl_soc_data **soc_data);
156/**
157 * tegra30_pinctrl_init() - Retrieve pin controller details for Tegra20
158 * @soc_data: This pointer will be updated to point at a struct containing
159 * details of Tegra30's pin controller.
160 */
161void tegra30_pinctrl_init(const struct tegra_pinctrl_soc_data **soc_data);
162
163#endif
diff --git a/drivers/pinctrl/pinctrl-tegra20.c b/drivers/pinctrl/pinctrl-tegra20.c
new file mode 100644
index 000000000000..f69ff96aa292
--- /dev/null
+++ b/drivers/pinctrl/pinctrl-tegra20.c
@@ -0,0 +1,2860 @@
1/*
2 * Pinctrl data for the NVIDIA Tegra20 pinmux
3 *
4 * Copyright (c) 2011, NVIDIA CORPORATION. All rights reserved.
5 *
6 * Derived from code:
7 * Copyright (C) 2010 Google, Inc.
8 * Copyright (C) 2010 NVIDIA Corporation
9 *
10 * This program is free software; you can redistribute it and/or modify it
11 * under the terms and conditions of the GNU General Public License,
12 * version 2, as published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope it will be useful, but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
17 * more details.
18 */
19
20#include <linux/platform_device.h>
21#include <linux/pinctrl/pinctrl.h>
22#include <linux/pinctrl/pinmux.h>
23
24#include "pinctrl-tegra.h"
25
26/*
27 * Most pins affected by the pinmux can also be GPIOs. Define these first.
28 * These must match how the GPIO driver names/numbers its pins.
29 */
30#define _GPIO(offset) (offset)
31
32#define TEGRA_PIN_VI_GP6_PA0 _GPIO(0)
33#define TEGRA_PIN_UART3_CTS_N_PA1 _GPIO(1)
34#define TEGRA_PIN_DAP2_FS_PA2 _GPIO(2)
35#define TEGRA_PIN_DAP2_SCLK_PA3 _GPIO(3)
36#define TEGRA_PIN_DAP2_DIN_PA4 _GPIO(4)
37#define TEGRA_PIN_DAP2_DOUT_PA5 _GPIO(5)
38#define TEGRA_PIN_SDIO3_CLK_PA6 _GPIO(6)
39#define TEGRA_PIN_SDIO3_CMD_PA7 _GPIO(7)
40#define TEGRA_PIN_GMI_AD17_PB0 _GPIO(8)
41#define TEGRA_PIN_GMI_AD18_PB1 _GPIO(9)
42#define TEGRA_PIN_LCD_PWR0_PB2 _GPIO(10)
43#define TEGRA_PIN_LCD_PCLK_PB3 _GPIO(11)
44#define TEGRA_PIN_SDIO3_DAT3_PB4 _GPIO(12)
45#define TEGRA_PIN_SDIO3_DAT2_PB5 _GPIO(13)
46#define TEGRA_PIN_SDIO3_DAT1_PB6 _GPIO(14)
47#define TEGRA_PIN_SDIO3_DAT0_PB7 _GPIO(15)
48#define TEGRA_PIN_UART3_RTS_N_PC0 _GPIO(16)
49#define TEGRA_PIN_LCD_PWR1_PC1 _GPIO(17)
50#define TEGRA_PIN_UART2_TXD_PC2 _GPIO(18)
51#define TEGRA_PIN_UART2_RXD_PC3 _GPIO(19)
52#define TEGRA_PIN_GEN1_I2C_SCL_PC4 _GPIO(20)
53#define TEGRA_PIN_GEN1_I2C_SDA_PC5 _GPIO(21)
54#define TEGRA_PIN_LCD_PWR2_PC6 _GPIO(22)
55#define TEGRA_PIN_GMI_WP_N_PC7 _GPIO(23)
56#define TEGRA_PIN_SDIO3_DAT5_PD0 _GPIO(24)
57#define TEGRA_PIN_SDIO3_DAT4_PD1 _GPIO(25)
58#define TEGRA_PIN_VI_GP5_PD2 _GPIO(26)
59#define TEGRA_PIN_SDIO3_DAT6_PD3 _GPIO(27)
60#define TEGRA_PIN_SDIO3_DAT7_PD4 _GPIO(28)
61#define TEGRA_PIN_VI_D1_PD5 _GPIO(29)
62#define TEGRA_PIN_VI_VSYNC_PD6 _GPIO(30)
63#define TEGRA_PIN_VI_HSYNC_PD7 _GPIO(31)
64#define TEGRA_PIN_LCD_D0_PE0 _GPIO(32)
65#define TEGRA_PIN_LCD_D1_PE1 _GPIO(33)
66#define TEGRA_PIN_LCD_D2_PE2 _GPIO(34)
67#define TEGRA_PIN_LCD_D3_PE3 _GPIO(35)
68#define TEGRA_PIN_LCD_D4_PE4 _GPIO(36)
69#define TEGRA_PIN_LCD_D5_PE5 _GPIO(37)
70#define TEGRA_PIN_LCD_D6_PE6 _GPIO(38)
71#define TEGRA_PIN_LCD_D7_PE7 _GPIO(39)
72#define TEGRA_PIN_LCD_D8_PF0 _GPIO(40)
73#define TEGRA_PIN_LCD_D9_PF1 _GPIO(41)
74#define TEGRA_PIN_LCD_D10_PF2 _GPIO(42)
75#define TEGRA_PIN_LCD_D11_PF3 _GPIO(43)
76#define TEGRA_PIN_LCD_D12_PF4 _GPIO(44)
77#define TEGRA_PIN_LCD_D13_PF5 _GPIO(45)
78#define TEGRA_PIN_LCD_D14_PF6 _GPIO(46)
79#define TEGRA_PIN_LCD_D15_PF7 _GPIO(47)
80#define TEGRA_PIN_GMI_AD0_PG0 _GPIO(48)
81#define TEGRA_PIN_GMI_AD1_PG1 _GPIO(49)
82#define TEGRA_PIN_GMI_AD2_PG2 _GPIO(50)
83#define TEGRA_PIN_GMI_AD3_PG3 _GPIO(51)
84#define TEGRA_PIN_GMI_AD4_PG4 _GPIO(52)
85#define TEGRA_PIN_GMI_AD5_PG5 _GPIO(53)
86#define TEGRA_PIN_GMI_AD6_PG6 _GPIO(54)
87#define TEGRA_PIN_GMI_AD7_PG7 _GPIO(55)
88#define TEGRA_PIN_GMI_AD8_PH0 _GPIO(56)
89#define TEGRA_PIN_GMI_AD9_PH1 _GPIO(57)
90#define TEGRA_PIN_GMI_AD10_PH2 _GPIO(58)
91#define TEGRA_PIN_GMI_AD11_PH3 _GPIO(59)
92#define TEGRA_PIN_GMI_AD12_PH4 _GPIO(60)
93#define TEGRA_PIN_GMI_AD13_PH5 _GPIO(61)
94#define TEGRA_PIN_GMI_AD14_PH6 _GPIO(62)
95#define TEGRA_PIN_GMI_AD15_PH7 _GPIO(63)
96#define TEGRA_PIN_GMI_HIOW_N_PI0 _GPIO(64)
97#define TEGRA_PIN_GMI_HIOR_N_PI1 _GPIO(65)
98#define TEGRA_PIN_GMI_CS5_N_PI2 _GPIO(66)
99#define TEGRA_PIN_GMI_CS6_N_PI3 _GPIO(67)
100#define TEGRA_PIN_GMI_RST_N_PI4 _GPIO(68)
101#define TEGRA_PIN_GMI_IORDY_PI5 _GPIO(69)
102#define TEGRA_PIN_GMI_CS7_N_PI6 _GPIO(70)
103#define TEGRA_PIN_GMI_WAIT_PI7 _GPIO(71)
104#define TEGRA_PIN_GMI_CS0_N_PJ0 _GPIO(72)
105#define TEGRA_PIN_LCD_DE_PJ1 _GPIO(73)
106#define TEGRA_PIN_GMI_CS1_N_PJ2 _GPIO(74)
107#define TEGRA_PIN_LCD_HSYNC_PJ3 _GPIO(75)
108#define TEGRA_PIN_LCD_VSYNC_PJ4 _GPIO(76)
109#define TEGRA_PIN_UART2_CTS_N_PJ5 _GPIO(77)
110#define TEGRA_PIN_UART2_RTS_N_PJ6 _GPIO(78)
111#define TEGRA_PIN_GMI_AD16_PJ7 _GPIO(79)
112#define TEGRA_PIN_GMI_ADV_N_PK0 _GPIO(80)
113#define TEGRA_PIN_GMI_CLK_PK1 _GPIO(81)
114#define TEGRA_PIN_GMI_CS4_N_PK2 _GPIO(82)
115#define TEGRA_PIN_GMI_CS2_N_PK3 _GPIO(83)
116#define TEGRA_PIN_GMI_CS3_N_PK4 _GPIO(84)
117#define TEGRA_PIN_SPDIF_OUT_PK5 _GPIO(85)
118#define TEGRA_PIN_SPDIF_IN_PK6 _GPIO(86)
119#define TEGRA_PIN_GMI_AD19_PK7 _GPIO(87)
120#define TEGRA_PIN_VI_D2_PL0 _GPIO(88)
121#define TEGRA_PIN_VI_D3_PL1 _GPIO(89)
122#define TEGRA_PIN_VI_D4_PL2 _GPIO(90)
123#define TEGRA_PIN_VI_D5_PL3 _GPIO(91)
124#define TEGRA_PIN_VI_D6_PL4 _GPIO(92)
125#define TEGRA_PIN_VI_D7_PL5 _GPIO(93)
126#define TEGRA_PIN_VI_D8_PL6 _GPIO(94)
127#define TEGRA_PIN_VI_D9_PL7 _GPIO(95)
128#define TEGRA_PIN_LCD_D16_PM0 _GPIO(96)
129#define TEGRA_PIN_LCD_D17_PM1 _GPIO(97)
130#define TEGRA_PIN_LCD_D18_PM2 _GPIO(98)
131#define TEGRA_PIN_LCD_D19_PM3 _GPIO(99)
132#define TEGRA_PIN_LCD_D20_PM4 _GPIO(100)
133#define TEGRA_PIN_LCD_D21_PM5 _GPIO(101)
134#define TEGRA_PIN_LCD_D22_PM6 _GPIO(102)
135#define TEGRA_PIN_LCD_D23_PM7 _GPIO(103)
136#define TEGRA_PIN_DAP1_FS_PN0 _GPIO(104)
137#define TEGRA_PIN_DAP1_DIN_PN1 _GPIO(105)
138#define TEGRA_PIN_DAP1_DOUT_PN2 _GPIO(106)
139#define TEGRA_PIN_DAP1_SCLK_PN3 _GPIO(107)
140#define TEGRA_PIN_LCD_CS0_N_PN4 _GPIO(108)
141#define TEGRA_PIN_LCD_SDOUT_PN5 _GPIO(109)
142#define TEGRA_PIN_LCD_DC0_PN6 _GPIO(110)
143#define TEGRA_PIN_HDMI_INT_N_PN7 _GPIO(111)
144#define TEGRA_PIN_ULPI_DATA7_PO0 _GPIO(112)
145#define TEGRA_PIN_ULPI_DATA0_PO1 _GPIO(113)
146#define TEGRA_PIN_ULPI_DATA1_PO2 _GPIO(114)
147#define TEGRA_PIN_ULPI_DATA2_PO3 _GPIO(115)
148#define TEGRA_PIN_ULPI_DATA3_PO4 _GPIO(116)
149#define TEGRA_PIN_ULPI_DATA4_PO5 _GPIO(117)
150#define TEGRA_PIN_ULPI_DATA5_PO6 _GPIO(118)
151#define TEGRA_PIN_ULPI_DATA6_PO7 _GPIO(119)
152#define TEGRA_PIN_DAP3_FS_PP0 _GPIO(120)
153#define TEGRA_PIN_DAP3_DIN_PP1 _GPIO(121)
154#define TEGRA_PIN_DAP3_DOUT_PP2 _GPIO(122)
155#define TEGRA_PIN_DAP3_SCLK_PP3 _GPIO(123)
156#define TEGRA_PIN_DAP4_FS_PP4 _GPIO(124)
157#define TEGRA_PIN_DAP4_DIN_PP5 _GPIO(125)
158#define TEGRA_PIN_DAP4_DOUT_PP6 _GPIO(126)
159#define TEGRA_PIN_DAP4_SCLK_PP7 _GPIO(127)
160#define TEGRA_PIN_KB_COL0_PQ0 _GPIO(128)
161#define TEGRA_PIN_KB_COL1_PQ1 _GPIO(129)
162#define TEGRA_PIN_KB_COL2_PQ2 _GPIO(130)
163#define TEGRA_PIN_KB_COL3_PQ3 _GPIO(131)
164#define TEGRA_PIN_KB_COL4_PQ4 _GPIO(132)
165#define TEGRA_PIN_KB_COL5_PQ5 _GPIO(133)
166#define TEGRA_PIN_KB_COL6_PQ6 _GPIO(134)
167#define TEGRA_PIN_KB_COL7_PQ7 _GPIO(135)
168#define TEGRA_PIN_KB_ROW0_PR0 _GPIO(136)
169#define TEGRA_PIN_KB_ROW1_PR1 _GPIO(137)
170#define TEGRA_PIN_KB_ROW2_PR2 _GPIO(138)
171#define TEGRA_PIN_KB_ROW3_PR3 _GPIO(139)
172#define TEGRA_PIN_KB_ROW4_PR4 _GPIO(140)
173#define TEGRA_PIN_KB_ROW5_PR5 _GPIO(141)
174#define TEGRA_PIN_KB_ROW6_PR6 _GPIO(142)
175#define TEGRA_PIN_KB_ROW7_PR7 _GPIO(143)
176#define TEGRA_PIN_KB_ROW8_PS0 _GPIO(144)
177#define TEGRA_PIN_KB_ROW9_PS1 _GPIO(145)
178#define TEGRA_PIN_KB_ROW10_PS2 _GPIO(146)
179#define TEGRA_PIN_KB_ROW11_PS3 _GPIO(147)
180#define TEGRA_PIN_KB_ROW12_PS4 _GPIO(148)
181#define TEGRA_PIN_KB_ROW13_PS5 _GPIO(149)
182#define TEGRA_PIN_KB_ROW14_PS6 _GPIO(150)
183#define TEGRA_PIN_KB_ROW15_PS7 _GPIO(151)
184#define TEGRA_PIN_VI_PCLK_PT0 _GPIO(152)
185#define TEGRA_PIN_VI_MCLK_PT1 _GPIO(153)
186#define TEGRA_PIN_VI_D10_PT2 _GPIO(154)
187#define TEGRA_PIN_VI_D11_PT3 _GPIO(155)
188#define TEGRA_PIN_VI_D0_PT4 _GPIO(156)
189#define TEGRA_PIN_GEN2_I2C_SCL_PT5 _GPIO(157)
190#define TEGRA_PIN_GEN2_I2C_SDA_PT6 _GPIO(158)
191#define TEGRA_PIN_GMI_DPD_PT7 _GPIO(159)
192#define TEGRA_PIN_PU0 _GPIO(160)
193#define TEGRA_PIN_PU1 _GPIO(161)
194#define TEGRA_PIN_PU2 _GPIO(162)
195#define TEGRA_PIN_PU3 _GPIO(163)
196#define TEGRA_PIN_PU4 _GPIO(164)
197#define TEGRA_PIN_PU5 _GPIO(165)
198#define TEGRA_PIN_PU6 _GPIO(166)
199#define TEGRA_PIN_JTAG_RTCK_PU7 _GPIO(167)
200#define TEGRA_PIN_PV0 _GPIO(168)
201#define TEGRA_PIN_PV1 _GPIO(169)
202#define TEGRA_PIN_PV2 _GPIO(170)
203#define TEGRA_PIN_PV3 _GPIO(171)
204#define TEGRA_PIN_PV4 _GPIO(172)
205#define TEGRA_PIN_PV5 _GPIO(173)
206#define TEGRA_PIN_PV6 _GPIO(174)
207#define TEGRA_PIN_LCD_DC1_PV7 _GPIO(175)
208#define TEGRA_PIN_LCD_CS1_N_PW0 _GPIO(176)
209#define TEGRA_PIN_LCD_M1_PW1 _GPIO(177)
210#define TEGRA_PIN_SPI2_CS1_N_PW2 _GPIO(178)
211#define TEGRA_PIN_SPI2_CS2_N_PW3 _GPIO(179)
212#define TEGRA_PIN_DAP_MCLK1_PW4 _GPIO(180)
213#define TEGRA_PIN_DAP_MCLK2_PW5 _GPIO(181)
214#define TEGRA_PIN_UART3_TXD_PW6 _GPIO(182)
215#define TEGRA_PIN_UART3_RXD_PW7 _GPIO(183)
216#define TEGRA_PIN_SPI2_MOSI_PX0 _GPIO(184)
217#define TEGRA_PIN_SPI2_MISO_PX1 _GPIO(185)
218#define TEGRA_PIN_SPI2_SCK_PX2 _GPIO(186)
219#define TEGRA_PIN_SPI2_CS0_N_PX3 _GPIO(187)
220#define TEGRA_PIN_SPI1_MOSI_PX4 _GPIO(188)
221#define TEGRA_PIN_SPI1_SCK_PX5 _GPIO(189)
222#define TEGRA_PIN_SPI1_CS0_N_PX6 _GPIO(190)
223#define TEGRA_PIN_SPI1_MISO_PX7 _GPIO(191)
224#define TEGRA_PIN_ULPI_CLK_PY0 _GPIO(192)
225#define TEGRA_PIN_ULPI_DIR_PY1 _GPIO(193)
226#define TEGRA_PIN_ULPI_NXT_PY2 _GPIO(194)
227#define TEGRA_PIN_ULPI_STP_PY3 _GPIO(195)
228#define TEGRA_PIN_SDIO1_DAT3_PY4 _GPIO(196)
229#define TEGRA_PIN_SDIO1_DAT2_PY5 _GPIO(197)
230#define TEGRA_PIN_SDIO1_DAT1_PY6 _GPIO(198)
231#define TEGRA_PIN_SDIO1_DAT0_PY7 _GPIO(199)
232#define TEGRA_PIN_SDIO1_CLK_PZ0 _GPIO(200)
233#define TEGRA_PIN_SDIO1_CMD_PZ1 _GPIO(201)
234#define TEGRA_PIN_LCD_SDIN_PZ2 _GPIO(202)
235#define TEGRA_PIN_LCD_WR_N_PZ3 _GPIO(203)
236#define TEGRA_PIN_LCD_SCK_PZ4 _GPIO(204)
237#define TEGRA_PIN_SYS_CLK_REQ_PZ5 _GPIO(205)
238#define TEGRA_PIN_PWR_I2C_SCL_PZ6 _GPIO(206)
239#define TEGRA_PIN_PWR_I2C_SDA_PZ7 _GPIO(207)
240#define TEGRA_PIN_GMI_AD20_PAA0 _GPIO(208)
241#define TEGRA_PIN_GMI_AD21_PAA1 _GPIO(209)
242#define TEGRA_PIN_GMI_AD22_PAA2 _GPIO(210)
243#define TEGRA_PIN_GMI_AD23_PAA3 _GPIO(211)
244#define TEGRA_PIN_GMI_AD24_PAA4 _GPIO(212)
245#define TEGRA_PIN_GMI_AD25_PAA5 _GPIO(213)
246#define TEGRA_PIN_GMI_AD26_PAA6 _GPIO(214)
247#define TEGRA_PIN_GMI_AD27_PAA7 _GPIO(215)
248#define TEGRA_PIN_LED_BLINK_PBB0 _GPIO(216)
249#define TEGRA_PIN_VI_GP0_PBB1 _GPIO(217)
250#define TEGRA_PIN_CAM_I2C_SCL_PBB2 _GPIO(218)
251#define TEGRA_PIN_CAM_I2C_SDA_PBB3 _GPIO(219)
252#define TEGRA_PIN_VI_GP3_PBB4 _GPIO(220)
253#define TEGRA_PIN_VI_GP4_PBB5 _GPIO(221)
254#define TEGRA_PIN_PBB6 _GPIO(222)
255#define TEGRA_PIN_PBB7 _GPIO(223)
256
257/* All non-GPIO pins follow */
258#define NUM_GPIOS (TEGRA_PIN_PBB7 + 1)
259#define _PIN(offset) (NUM_GPIOS + (offset))
260
261#define TEGRA_PIN_CRT_HSYNC _PIN(30)
262#define TEGRA_PIN_CRT_VSYNC _PIN(31)
263#define TEGRA_PIN_DDC_SCL _PIN(32)
264#define TEGRA_PIN_DDC_SDA _PIN(33)
265#define TEGRA_PIN_OWC _PIN(34)
266#define TEGRA_PIN_CORE_PWR_REQ _PIN(35)
267#define TEGRA_PIN_CPU_PWR_REQ _PIN(36)
268#define TEGRA_PIN_PWR_INT_N _PIN(37)
269#define TEGRA_PIN_CLK_32_K_IN _PIN(38)
270#define TEGRA_PIN_DDR_COMP_PD _PIN(39)
271#define TEGRA_PIN_DDR_COMP_PU _PIN(40)
272#define TEGRA_PIN_DDR_A0 _PIN(41)
273#define TEGRA_PIN_DDR_A1 _PIN(42)
274#define TEGRA_PIN_DDR_A2 _PIN(43)
275#define TEGRA_PIN_DDR_A3 _PIN(44)
276#define TEGRA_PIN_DDR_A4 _PIN(45)
277#define TEGRA_PIN_DDR_A5 _PIN(46)
278#define TEGRA_PIN_DDR_A6 _PIN(47)
279#define TEGRA_PIN_DDR_A7 _PIN(48)
280#define TEGRA_PIN_DDR_A8 _PIN(49)
281#define TEGRA_PIN_DDR_A9 _PIN(50)
282#define TEGRA_PIN_DDR_A10 _PIN(51)
283#define TEGRA_PIN_DDR_A11 _PIN(52)
284#define TEGRA_PIN_DDR_A12 _PIN(53)
285#define TEGRA_PIN_DDR_A13 _PIN(54)
286#define TEGRA_PIN_DDR_A14 _PIN(55)
287#define TEGRA_PIN_DDR_CAS_N _PIN(56)
288#define TEGRA_PIN_DDR_BA0 _PIN(57)
289#define TEGRA_PIN_DDR_BA1 _PIN(58)
290#define TEGRA_PIN_DDR_BA2 _PIN(59)
291#define TEGRA_PIN_DDR_DQS0P _PIN(60)
292#define TEGRA_PIN_DDR_DQS0N _PIN(61)
293#define TEGRA_PIN_DDR_DQS1P _PIN(62)
294#define TEGRA_PIN_DDR_DQS1N _PIN(63)
295#define TEGRA_PIN_DDR_DQS2P _PIN(64)
296#define TEGRA_PIN_DDR_DQS2N _PIN(65)
297#define TEGRA_PIN_DDR_DQS3P _PIN(66)
298#define TEGRA_PIN_DDR_DQS3N _PIN(67)
299#define TEGRA_PIN_DDR_CKE0 _PIN(68)
300#define TEGRA_PIN_DDR_CKE1 _PIN(69)
301#define TEGRA_PIN_DDR_CLK _PIN(70)
302#define TEGRA_PIN_DDR_CLK_N _PIN(71)
303#define TEGRA_PIN_DDR_DM0 _PIN(72)
304#define TEGRA_PIN_DDR_DM1 _PIN(73)
305#define TEGRA_PIN_DDR_DM2 _PIN(74)
306#define TEGRA_PIN_DDR_DM3 _PIN(75)
307#define TEGRA_PIN_DDR_ODT _PIN(76)
308#define TEGRA_PIN_DDR_QUSE0 _PIN(77)
309#define TEGRA_PIN_DDR_QUSE1 _PIN(78)
310#define TEGRA_PIN_DDR_QUSE2 _PIN(79)
311#define TEGRA_PIN_DDR_QUSE3 _PIN(80)
312#define TEGRA_PIN_DDR_RAS_N _PIN(81)
313#define TEGRA_PIN_DDR_WE_N _PIN(82)
314#define TEGRA_PIN_DDR_DQ0 _PIN(83)
315#define TEGRA_PIN_DDR_DQ1 _PIN(84)
316#define TEGRA_PIN_DDR_DQ2 _PIN(85)
317#define TEGRA_PIN_DDR_DQ3 _PIN(86)
318#define TEGRA_PIN_DDR_DQ4 _PIN(87)
319#define TEGRA_PIN_DDR_DQ5 _PIN(88)
320#define TEGRA_PIN_DDR_DQ6 _PIN(89)
321#define TEGRA_PIN_DDR_DQ7 _PIN(90)
322#define TEGRA_PIN_DDR_DQ8 _PIN(91)
323#define TEGRA_PIN_DDR_DQ9 _PIN(92)
324#define TEGRA_PIN_DDR_DQ10 _PIN(93)
325#define TEGRA_PIN_DDR_DQ11 _PIN(94)
326#define TEGRA_PIN_DDR_DQ12 _PIN(95)
327#define TEGRA_PIN_DDR_DQ13 _PIN(96)
328#define TEGRA_PIN_DDR_DQ14 _PIN(97)
329#define TEGRA_PIN_DDR_DQ15 _PIN(98)
330#define TEGRA_PIN_DDR_DQ16 _PIN(99)
331#define TEGRA_PIN_DDR_DQ17 _PIN(100)
332#define TEGRA_PIN_DDR_DQ18 _PIN(101)
333#define TEGRA_PIN_DDR_DQ19 _PIN(102)
334#define TEGRA_PIN_DDR_DQ20 _PIN(103)
335#define TEGRA_PIN_DDR_DQ21 _PIN(104)
336#define TEGRA_PIN_DDR_DQ22 _PIN(105)
337#define TEGRA_PIN_DDR_DQ23 _PIN(106)
338#define TEGRA_PIN_DDR_DQ24 _PIN(107)
339#define TEGRA_PIN_DDR_DQ25 _PIN(108)
340#define TEGRA_PIN_DDR_DQ26 _PIN(109)
341#define TEGRA_PIN_DDR_DQ27 _PIN(110)
342#define TEGRA_PIN_DDR_DQ28 _PIN(111)
343#define TEGRA_PIN_DDR_DQ29 _PIN(112)
344#define TEGRA_PIN_DDR_DQ30 _PIN(113)
345#define TEGRA_PIN_DDR_DQ31 _PIN(114)
346#define TEGRA_PIN_DDR_CS0_N _PIN(115)
347#define TEGRA_PIN_DDR_CS1_N _PIN(116)
348#define TEGRA_PIN_SYS_RESET _PIN(117)
349#define TEGRA_PIN_JTAG_TRST_N _PIN(118)
350#define TEGRA_PIN_JTAG_TDO _PIN(119)
351#define TEGRA_PIN_JTAG_TMS _PIN(120)
352#define TEGRA_PIN_JTAG_TCK _PIN(121)
353#define TEGRA_PIN_JTAG_TDI _PIN(122)
354#define TEGRA_PIN_TEST_MODE_EN _PIN(123)
355
356static const struct pinctrl_pin_desc tegra20_pins[] = {
357 PINCTRL_PIN(TEGRA_PIN_VI_GP6_PA0, "VI_GP6 PA0"),
358 PINCTRL_PIN(TEGRA_PIN_UART3_CTS_N_PA1, "UART3_CTS_N PA1"),
359 PINCTRL_PIN(TEGRA_PIN_DAP2_FS_PA2, "DAP2_FS PA2"),
360 PINCTRL_PIN(TEGRA_PIN_DAP2_SCLK_PA3, "DAP2_SCLK PA3"),
361 PINCTRL_PIN(TEGRA_PIN_DAP2_DIN_PA4, "DAP2_DIN PA4"),
362 PINCTRL_PIN(TEGRA_PIN_DAP2_DOUT_PA5, "DAP2_DOUT PA5"),
363 PINCTRL_PIN(TEGRA_PIN_SDIO3_CLK_PA6, "SDIO3_CLK PA6"),
364 PINCTRL_PIN(TEGRA_PIN_SDIO3_CMD_PA7, "SDIO3_CMD PA7"),
365 PINCTRL_PIN(TEGRA_PIN_GMI_AD17_PB0, "GMI_AD17 PB0"),
366 PINCTRL_PIN(TEGRA_PIN_GMI_AD18_PB1, "GMI_AD18 PB1"),
367 PINCTRL_PIN(TEGRA_PIN_LCD_PWR0_PB2, "LCD_PWR0 PB2"),
368 PINCTRL_PIN(TEGRA_PIN_LCD_PCLK_PB3, "LCD_PCLK PB3"),
369 PINCTRL_PIN(TEGRA_PIN_SDIO3_DAT3_PB4, "SDIO3_DAT3 PB4"),
370 PINCTRL_PIN(TEGRA_PIN_SDIO3_DAT2_PB5, "SDIO3_DAT2 PB5"),
371 PINCTRL_PIN(TEGRA_PIN_SDIO3_DAT1_PB6, "SDIO3_DAT1 PB6"),
372 PINCTRL_PIN(TEGRA_PIN_SDIO3_DAT0_PB7, "SDIO3_DAT0 PB7"),
373 PINCTRL_PIN(TEGRA_PIN_UART3_RTS_N_PC0, "UART3_RTS_N PC0"),
374 PINCTRL_PIN(TEGRA_PIN_LCD_PWR1_PC1, "LCD_PWR1 PC1"),
375 PINCTRL_PIN(TEGRA_PIN_UART2_TXD_PC2, "UART2_TXD PC2"),
376 PINCTRL_PIN(TEGRA_PIN_UART2_RXD_PC3, "UART2_RXD PC3"),
377 PINCTRL_PIN(TEGRA_PIN_GEN1_I2C_SCL_PC4, "GEN1_I2C_SCL PC4"),
378 PINCTRL_PIN(TEGRA_PIN_GEN1_I2C_SDA_PC5, "GEN1_I2C_SDA PC5"),
379 PINCTRL_PIN(TEGRA_PIN_LCD_PWR2_PC6, "LCD_PWR2 PC6"),
380 PINCTRL_PIN(TEGRA_PIN_GMI_WP_N_PC7, "GMI_WP_N PC7"),
381 PINCTRL_PIN(TEGRA_PIN_SDIO3_DAT5_PD0, "SDIO3_DAT5 PD0"),
382 PINCTRL_PIN(TEGRA_PIN_SDIO3_DAT4_PD1, "SDIO3_DAT4 PD1"),
383 PINCTRL_PIN(TEGRA_PIN_VI_GP5_PD2, "VI_GP5 PD2"),
384 PINCTRL_PIN(TEGRA_PIN_SDIO3_DAT6_PD3, "SDIO3_DAT6 PD3"),
385 PINCTRL_PIN(TEGRA_PIN_SDIO3_DAT7_PD4, "SDIO3_DAT7 PD4"),
386 PINCTRL_PIN(TEGRA_PIN_VI_D1_PD5, "VI_D1 PD5"),
387 PINCTRL_PIN(TEGRA_PIN_VI_VSYNC_PD6, "VI_VSYNC PD6"),
388 PINCTRL_PIN(TEGRA_PIN_VI_HSYNC_PD7, "VI_HSYNC PD7"),
389 PINCTRL_PIN(TEGRA_PIN_LCD_D0_PE0, "LCD_D0 PE0"),
390 PINCTRL_PIN(TEGRA_PIN_LCD_D1_PE1, "LCD_D1 PE1"),
391 PINCTRL_PIN(TEGRA_PIN_LCD_D2_PE2, "LCD_D2 PE2"),
392 PINCTRL_PIN(TEGRA_PIN_LCD_D3_PE3, "LCD_D3 PE3"),
393 PINCTRL_PIN(TEGRA_PIN_LCD_D4_PE4, "LCD_D4 PE4"),
394 PINCTRL_PIN(TEGRA_PIN_LCD_D5_PE5, "LCD_D5 PE5"),
395 PINCTRL_PIN(TEGRA_PIN_LCD_D6_PE6, "LCD_D6 PE6"),
396 PINCTRL_PIN(TEGRA_PIN_LCD_D7_PE7, "LCD_D7 PE7"),
397 PINCTRL_PIN(TEGRA_PIN_LCD_D8_PF0, "LCD_D8 PF0"),
398 PINCTRL_PIN(TEGRA_PIN_LCD_D9_PF1, "LCD_D9 PF1"),
399 PINCTRL_PIN(TEGRA_PIN_LCD_D10_PF2, "LCD_D10 PF2"),
400 PINCTRL_PIN(TEGRA_PIN_LCD_D11_PF3, "LCD_D11 PF3"),
401 PINCTRL_PIN(TEGRA_PIN_LCD_D12_PF4, "LCD_D12 PF4"),
402 PINCTRL_PIN(TEGRA_PIN_LCD_D13_PF5, "LCD_D13 PF5"),
403 PINCTRL_PIN(TEGRA_PIN_LCD_D14_PF6, "LCD_D14 PF6"),
404 PINCTRL_PIN(TEGRA_PIN_LCD_D15_PF7, "LCD_D15 PF7"),
405 PINCTRL_PIN(TEGRA_PIN_GMI_AD0_PG0, "GMI_AD0 PG0"),
406 PINCTRL_PIN(TEGRA_PIN_GMI_AD1_PG1, "GMI_AD1 PG1"),
407 PINCTRL_PIN(TEGRA_PIN_GMI_AD2_PG2, "GMI_AD2 PG2"),
408 PINCTRL_PIN(TEGRA_PIN_GMI_AD3_PG3, "GMI_AD3 PG3"),
409 PINCTRL_PIN(TEGRA_PIN_GMI_AD4_PG4, "GMI_AD4 PG4"),
410 PINCTRL_PIN(TEGRA_PIN_GMI_AD5_PG5, "GMI_AD5 PG5"),
411 PINCTRL_PIN(TEGRA_PIN_GMI_AD6_PG6, "GMI_AD6 PG6"),
412 PINCTRL_PIN(TEGRA_PIN_GMI_AD7_PG7, "GMI_AD7 PG7"),
413 PINCTRL_PIN(TEGRA_PIN_GMI_AD8_PH0, "GMI_AD8 PH0"),
414 PINCTRL_PIN(TEGRA_PIN_GMI_AD9_PH1, "GMI_AD9 PH1"),
415 PINCTRL_PIN(TEGRA_PIN_GMI_AD10_PH2, "GMI_AD10 PH2"),
416 PINCTRL_PIN(TEGRA_PIN_GMI_AD11_PH3, "GMI_AD11 PH3"),
417 PINCTRL_PIN(TEGRA_PIN_GMI_AD12_PH4, "GMI_AD12 PH4"),
418 PINCTRL_PIN(TEGRA_PIN_GMI_AD13_PH5, "GMI_AD13 PH5"),
419 PINCTRL_PIN(TEGRA_PIN_GMI_AD14_PH6, "GMI_AD14 PH6"),
420 PINCTRL_PIN(TEGRA_PIN_GMI_AD15_PH7, "GMI_AD15 PH7"),
421 PINCTRL_PIN(TEGRA_PIN_GMI_HIOW_N_PI0, "GMI_HIOW_N PI0"),
422 PINCTRL_PIN(TEGRA_PIN_GMI_HIOR_N_PI1, "GMI_HIOR_N PI1"),
423 PINCTRL_PIN(TEGRA_PIN_GMI_CS5_N_PI2, "GMI_CS5_N PI2"),
424 PINCTRL_PIN(TEGRA_PIN_GMI_CS6_N_PI3, "GMI_CS6_N PI3"),
425 PINCTRL_PIN(TEGRA_PIN_GMI_RST_N_PI4, "GMI_RST_N PI4"),
426 PINCTRL_PIN(TEGRA_PIN_GMI_IORDY_PI5, "GMI_IORDY PI5"),
427 PINCTRL_PIN(TEGRA_PIN_GMI_CS7_N_PI6, "GMI_CS7_N PI6"),
428 PINCTRL_PIN(TEGRA_PIN_GMI_WAIT_PI7, "GMI_WAIT PI7"),
429 PINCTRL_PIN(TEGRA_PIN_GMI_CS0_N_PJ0, "GMI_CS0_N PJ0"),
430 PINCTRL_PIN(TEGRA_PIN_LCD_DE_PJ1, "LCD_DE PJ1"),
431 PINCTRL_PIN(TEGRA_PIN_GMI_CS1_N_PJ2, "GMI_CS1_N PJ2"),
432 PINCTRL_PIN(TEGRA_PIN_LCD_HSYNC_PJ3, "LCD_HSYNC PJ3"),
433 PINCTRL_PIN(TEGRA_PIN_LCD_VSYNC_PJ4, "LCD_VSYNC PJ4"),
434 PINCTRL_PIN(TEGRA_PIN_UART2_CTS_N_PJ5, "UART2_CTS_N PJ5"),
435 PINCTRL_PIN(TEGRA_PIN_UART2_RTS_N_PJ6, "UART2_RTS_N PJ6"),
436 PINCTRL_PIN(TEGRA_PIN_GMI_AD16_PJ7, "GMI_AD16 PJ7"),
437 PINCTRL_PIN(TEGRA_PIN_GMI_ADV_N_PK0, "GMI_ADV_N PK0"),
438 PINCTRL_PIN(TEGRA_PIN_GMI_CLK_PK1, "GMI_CLK PK1"),
439 PINCTRL_PIN(TEGRA_PIN_GMI_CS4_N_PK2, "GMI_CS4_N PK2"),
440 PINCTRL_PIN(TEGRA_PIN_GMI_CS2_N_PK3, "GMI_CS2_N PK3"),
441 PINCTRL_PIN(TEGRA_PIN_GMI_CS3_N_PK4, "GMI_CS3_N PK4"),
442 PINCTRL_PIN(TEGRA_PIN_SPDIF_OUT_PK5, "SPDIF_OUT PK5"),
443 PINCTRL_PIN(TEGRA_PIN_SPDIF_IN_PK6, "SPDIF_IN PK6"),
444 PINCTRL_PIN(TEGRA_PIN_GMI_AD19_PK7, "GMI_AD19 PK7"),
445 PINCTRL_PIN(TEGRA_PIN_VI_D2_PL0, "VI_D2 PL0"),
446 PINCTRL_PIN(TEGRA_PIN_VI_D3_PL1, "VI_D3 PL1"),
447 PINCTRL_PIN(TEGRA_PIN_VI_D4_PL2, "VI_D4 PL2"),
448 PINCTRL_PIN(TEGRA_PIN_VI_D5_PL3, "VI_D5 PL3"),
449 PINCTRL_PIN(TEGRA_PIN_VI_D6_PL4, "VI_D6 PL4"),
450 PINCTRL_PIN(TEGRA_PIN_VI_D7_PL5, "VI_D7 PL5"),
451 PINCTRL_PIN(TEGRA_PIN_VI_D8_PL6, "VI_D8 PL6"),
452 PINCTRL_PIN(TEGRA_PIN_VI_D9_PL7, "VI_D9 PL7"),
453 PINCTRL_PIN(TEGRA_PIN_LCD_D16_PM0, "LCD_D16 PM0"),
454 PINCTRL_PIN(TEGRA_PIN_LCD_D17_PM1, "LCD_D17 PM1"),
455 PINCTRL_PIN(TEGRA_PIN_LCD_D18_PM2, "LCD_D18 PM2"),
456 PINCTRL_PIN(TEGRA_PIN_LCD_D19_PM3, "LCD_D19 PM3"),
457 PINCTRL_PIN(TEGRA_PIN_LCD_D20_PM4, "LCD_D20 PM4"),
458 PINCTRL_PIN(TEGRA_PIN_LCD_D21_PM5, "LCD_D21 PM5"),
459 PINCTRL_PIN(TEGRA_PIN_LCD_D22_PM6, "LCD_D22 PM6"),
460 PINCTRL_PIN(TEGRA_PIN_LCD_D23_PM7, "LCD_D23 PM7"),
461 PINCTRL_PIN(TEGRA_PIN_DAP1_FS_PN0, "DAP1_FS PN0"),
462 PINCTRL_PIN(TEGRA_PIN_DAP1_DIN_PN1, "DAP1_DIN PN1"),
463 PINCTRL_PIN(TEGRA_PIN_DAP1_DOUT_PN2, "DAP1_DOUT PN2"),
464 PINCTRL_PIN(TEGRA_PIN_DAP1_SCLK_PN3, "DAP1_SCLK PN3"),
465 PINCTRL_PIN(TEGRA_PIN_LCD_CS0_N_PN4, "LCD_CS0_N PN4"),
466 PINCTRL_PIN(TEGRA_PIN_LCD_SDOUT_PN5, "LCD_SDOUT PN5"),
467 PINCTRL_PIN(TEGRA_PIN_LCD_DC0_PN6, "LCD_DC0 PN6"),
468 PINCTRL_PIN(TEGRA_PIN_HDMI_INT_N_PN7, "HDMI_INT_N PN7"),
469 PINCTRL_PIN(TEGRA_PIN_ULPI_DATA7_PO0, "ULPI_DATA7 PO0"),
470 PINCTRL_PIN(TEGRA_PIN_ULPI_DATA0_PO1, "ULPI_DATA0 PO1"),
471 PINCTRL_PIN(TEGRA_PIN_ULPI_DATA1_PO2, "ULPI_DATA1 PO2"),
472 PINCTRL_PIN(TEGRA_PIN_ULPI_DATA2_PO3, "ULPI_DATA2 PO3"),
473 PINCTRL_PIN(TEGRA_PIN_ULPI_DATA3_PO4, "ULPI_DATA3 PO4"),
474 PINCTRL_PIN(TEGRA_PIN_ULPI_DATA4_PO5, "ULPI_DATA4 PO5"),
475 PINCTRL_PIN(TEGRA_PIN_ULPI_DATA5_PO6, "ULPI_DATA5 PO6"),
476 PINCTRL_PIN(TEGRA_PIN_ULPI_DATA6_PO7, "ULPI_DATA6 PO7"),
477 PINCTRL_PIN(TEGRA_PIN_DAP3_FS_PP0, "DAP3_FS PP0"),
478 PINCTRL_PIN(TEGRA_PIN_DAP3_DIN_PP1, "DAP3_DIN PP1"),
479 PINCTRL_PIN(TEGRA_PIN_DAP3_DOUT_PP2, "DAP3_DOUT PP2"),
480 PINCTRL_PIN(TEGRA_PIN_DAP3_SCLK_PP3, "DAP3_SCLK PP3"),
481 PINCTRL_PIN(TEGRA_PIN_DAP4_FS_PP4, "DAP4_FS PP4"),
482 PINCTRL_PIN(TEGRA_PIN_DAP4_DIN_PP5, "DAP4_DIN PP5"),
483 PINCTRL_PIN(TEGRA_PIN_DAP4_DOUT_PP6, "DAP4_DOUT PP6"),
484 PINCTRL_PIN(TEGRA_PIN_DAP4_SCLK_PP7, "DAP4_SCLK PP7"),
485 PINCTRL_PIN(TEGRA_PIN_KB_COL0_PQ0, "KB_COL0 PQ0"),
486 PINCTRL_PIN(TEGRA_PIN_KB_COL1_PQ1, "KB_COL1 PQ1"),
487 PINCTRL_PIN(TEGRA_PIN_KB_COL2_PQ2, "KB_COL2 PQ2"),
488 PINCTRL_PIN(TEGRA_PIN_KB_COL3_PQ3, "KB_COL3 PQ3"),
489 PINCTRL_PIN(TEGRA_PIN_KB_COL4_PQ4, "KB_COL4 PQ4"),
490 PINCTRL_PIN(TEGRA_PIN_KB_COL5_PQ5, "KB_COL5 PQ5"),
491 PINCTRL_PIN(TEGRA_PIN_KB_COL6_PQ6, "KB_COL6 PQ6"),
492 PINCTRL_PIN(TEGRA_PIN_KB_COL7_PQ7, "KB_COL7 PQ7"),
493 PINCTRL_PIN(TEGRA_PIN_KB_ROW0_PR0, "KB_ROW0 PR0"),
494 PINCTRL_PIN(TEGRA_PIN_KB_ROW1_PR1, "KB_ROW1 PR1"),
495 PINCTRL_PIN(TEGRA_PIN_KB_ROW2_PR2, "KB_ROW2 PR2"),
496 PINCTRL_PIN(TEGRA_PIN_KB_ROW3_PR3, "KB_ROW3 PR3"),
497 PINCTRL_PIN(TEGRA_PIN_KB_ROW4_PR4, "KB_ROW4 PR4"),
498 PINCTRL_PIN(TEGRA_PIN_KB_ROW5_PR5, "KB_ROW5 PR5"),
499 PINCTRL_PIN(TEGRA_PIN_KB_ROW6_PR6, "KB_ROW6 PR6"),
500 PINCTRL_PIN(TEGRA_PIN_KB_ROW7_PR7, "KB_ROW7 PR7"),
501 PINCTRL_PIN(TEGRA_PIN_KB_ROW8_PS0, "KB_ROW8 PS0"),
502 PINCTRL_PIN(TEGRA_PIN_KB_ROW9_PS1, "KB_ROW9 PS1"),
503 PINCTRL_PIN(TEGRA_PIN_KB_ROW10_PS2, "KB_ROW10 PS2"),
504 PINCTRL_PIN(TEGRA_PIN_KB_ROW11_PS3, "KB_ROW11 PS3"),
505 PINCTRL_PIN(TEGRA_PIN_KB_ROW12_PS4, "KB_ROW12 PS4"),
506 PINCTRL_PIN(TEGRA_PIN_KB_ROW13_PS5, "KB_ROW13 PS5"),
507 PINCTRL_PIN(TEGRA_PIN_KB_ROW14_PS6, "KB_ROW14 PS6"),
508 PINCTRL_PIN(TEGRA_PIN_KB_ROW15_PS7, "KB_ROW15 PS7"),
509 PINCTRL_PIN(TEGRA_PIN_VI_PCLK_PT0, "VI_PCLK PT0"),
510 PINCTRL_PIN(TEGRA_PIN_VI_MCLK_PT1, "VI_MCLK PT1"),
511 PINCTRL_PIN(TEGRA_PIN_VI_D10_PT2, "VD_D10 PT2"),
512 PINCTRL_PIN(TEGRA_PIN_VI_D11_PT3, "VI_D11 PT3"),
513 PINCTRL_PIN(TEGRA_PIN_VI_D0_PT4, "VI_D0 PT4"),
514 PINCTRL_PIN(TEGRA_PIN_GEN2_I2C_SCL_PT5, "GEN2_I2C_SCL PT5"),
515 PINCTRL_PIN(TEGRA_PIN_GEN2_I2C_SDA_PT6, "GEN2_I2C_SDA PT6"),
516 PINCTRL_PIN(TEGRA_PIN_GMI_DPD_PT7, "GMI_DPD PT7"),
517 /* PU0..6: GPIO only */
518 PINCTRL_PIN(TEGRA_PIN_PU0, "PU0"),
519 PINCTRL_PIN(TEGRA_PIN_PU1, "PU1"),
520 PINCTRL_PIN(TEGRA_PIN_PU2, "PU2"),
521 PINCTRL_PIN(TEGRA_PIN_PU3, "PU3"),
522 PINCTRL_PIN(TEGRA_PIN_PU4, "PU4"),
523 PINCTRL_PIN(TEGRA_PIN_PU5, "PU5"),
524 PINCTRL_PIN(TEGRA_PIN_PU6, "PU6"),
525 PINCTRL_PIN(TEGRA_PIN_JTAG_RTCK_PU7, "JTAG_RTCK PU7"),
526 /* PV0..1: GPIO only */
527 PINCTRL_PIN(TEGRA_PIN_PV0, "PV0"),
528 PINCTRL_PIN(TEGRA_PIN_PV1, "PV1"),
529 /* PV2..3: Balls are named after GPIO not function */
530 PINCTRL_PIN(TEGRA_PIN_PV2, "PV2"),
531 PINCTRL_PIN(TEGRA_PIN_PV3, "PV3"),
532 /* PV4..6: GPIO only */
533 PINCTRL_PIN(TEGRA_PIN_PV4, "PV4"),
534 PINCTRL_PIN(TEGRA_PIN_PV5, "PV5"),
535 PINCTRL_PIN(TEGRA_PIN_PV6, "PV6"),
536 PINCTRL_PIN(TEGRA_PIN_LCD_DC1_PV7, "LCD_DC1 PV7"),
537 PINCTRL_PIN(TEGRA_PIN_LCD_CS1_N_PW0, "LCD_CS1_N PW0"),
538 PINCTRL_PIN(TEGRA_PIN_LCD_M1_PW1, "LCD_M1 PW1"),
539 PINCTRL_PIN(TEGRA_PIN_SPI2_CS1_N_PW2, "SPI2_CS1_N PW2"),
540 PINCTRL_PIN(TEGRA_PIN_SPI2_CS2_N_PW3, "SPI2_CS2_N PW3"),
541 PINCTRL_PIN(TEGRA_PIN_DAP_MCLK1_PW4, "DAP_MCLK1 PW4"),
542 PINCTRL_PIN(TEGRA_PIN_DAP_MCLK2_PW5, "DAP_MCLK2 PW5"),
543 PINCTRL_PIN(TEGRA_PIN_UART3_TXD_PW6, "UART3_TXD PW6"),
544 PINCTRL_PIN(TEGRA_PIN_UART3_RXD_PW7, "UART3_RXD PW7"),
545 PINCTRL_PIN(TEGRA_PIN_SPI2_MOSI_PX0, "SPI2_MOSI PX0"),
546 PINCTRL_PIN(TEGRA_PIN_SPI2_MISO_PX1, "SPI2_MISO PX1"),
547 PINCTRL_PIN(TEGRA_PIN_SPI2_SCK_PX2, "SPI2_SCK PX2"),
548 PINCTRL_PIN(TEGRA_PIN_SPI2_CS0_N_PX3, "SPI2_CS0_N PX3"),
549 PINCTRL_PIN(TEGRA_PIN_SPI1_MOSI_PX4, "SPI1_MOSI PX4"),
550 PINCTRL_PIN(TEGRA_PIN_SPI1_SCK_PX5, "SPI1_SCK PX5"),
551 PINCTRL_PIN(TEGRA_PIN_SPI1_CS0_N_PX6, "SPI1_CS0_N PX6"),
552 PINCTRL_PIN(TEGRA_PIN_SPI1_MISO_PX7, "SPI1_MISO PX7"),
553 PINCTRL_PIN(TEGRA_PIN_ULPI_CLK_PY0, "ULPI_CLK PY0"),
554 PINCTRL_PIN(TEGRA_PIN_ULPI_DIR_PY1, "ULPI_DIR PY1"),
555 PINCTRL_PIN(TEGRA_PIN_ULPI_NXT_PY2, "ULPI_NXT PY2"),
556 PINCTRL_PIN(TEGRA_PIN_ULPI_STP_PY3, "ULPI_STP PY3"),
557 PINCTRL_PIN(TEGRA_PIN_SDIO1_DAT3_PY4, "SDIO1_DAT3 PY4"),
558 PINCTRL_PIN(TEGRA_PIN_SDIO1_DAT2_PY5, "SDIO1_DAT2 PY5"),
559 PINCTRL_PIN(TEGRA_PIN_SDIO1_DAT1_PY6, "SDIO1_DAT1 PY6"),
560 PINCTRL_PIN(TEGRA_PIN_SDIO1_DAT0_PY7, "SDIO1_DAT0 PY7"),
561 PINCTRL_PIN(TEGRA_PIN_SDIO1_CLK_PZ0, "SDIO1_CLK PZ0"),
562 PINCTRL_PIN(TEGRA_PIN_SDIO1_CMD_PZ1, "SDIO1_CMD PZ1"),
563 PINCTRL_PIN(TEGRA_PIN_LCD_SDIN_PZ2, "LCD_SDIN PZ2"),
564 PINCTRL_PIN(TEGRA_PIN_LCD_WR_N_PZ3, "LCD_WR_N PZ3"),
565 PINCTRL_PIN(TEGRA_PIN_LCD_SCK_PZ4, "LCD_SCK PZ4"),
566 PINCTRL_PIN(TEGRA_PIN_SYS_CLK_REQ_PZ5, "SYS_CLK_REQ PZ5"),
567 PINCTRL_PIN(TEGRA_PIN_PWR_I2C_SCL_PZ6, "PWR_I2C_SCL PZ6"),
568 PINCTRL_PIN(TEGRA_PIN_PWR_I2C_SDA_PZ7, "PWR_I2C_SDA PZ7"),
569 PINCTRL_PIN(TEGRA_PIN_GMI_AD20_PAA0, "GMI_AD20 PAA0"),
570 PINCTRL_PIN(TEGRA_PIN_GMI_AD21_PAA1, "GMI_AD21 PAA1"),
571 PINCTRL_PIN(TEGRA_PIN_GMI_AD22_PAA2, "GMI_AD22 PAA2"),
572 PINCTRL_PIN(TEGRA_PIN_GMI_AD23_PAA3, "GMI_AD23 PAA3"),
573 PINCTRL_PIN(TEGRA_PIN_GMI_AD24_PAA4, "GMI_AD24 PAA4"),
574 PINCTRL_PIN(TEGRA_PIN_GMI_AD25_PAA5, "GMI_AD25 PAA5"),
575 PINCTRL_PIN(TEGRA_PIN_GMI_AD26_PAA6, "GMI_AD26 PAA6"),
576 PINCTRL_PIN(TEGRA_PIN_GMI_AD27_PAA7, "GMI_AD27 PAA7"),
577 PINCTRL_PIN(TEGRA_PIN_LED_BLINK_PBB0, "LED_BLINK PBB0"),
578 PINCTRL_PIN(TEGRA_PIN_VI_GP0_PBB1, "VI_GP0 PBB1"),
579 PINCTRL_PIN(TEGRA_PIN_CAM_I2C_SCL_PBB2, "CAM_I2C_SCL PBB2"),
580 PINCTRL_PIN(TEGRA_PIN_CAM_I2C_SDA_PBB3, "CAM_I2C_SDA PBB3"),
581 PINCTRL_PIN(TEGRA_PIN_VI_GP3_PBB4, "VI_GP3 PBB4"),
582 PINCTRL_PIN(TEGRA_PIN_VI_GP4_PBB5, "VI_GP4 PBB5"),
583 PINCTRL_PIN(TEGRA_PIN_PBB6, "PBB6"),
584 PINCTRL_PIN(TEGRA_PIN_PBB7, "PBB7"),
585 PINCTRL_PIN(TEGRA_PIN_CRT_HSYNC, "CRT_HSYNC"),
586 PINCTRL_PIN(TEGRA_PIN_CRT_VSYNC, "CRT_VSYNC"),
587 PINCTRL_PIN(TEGRA_PIN_DDC_SCL, "DDC_SCL"),
588 PINCTRL_PIN(TEGRA_PIN_DDC_SDA, "DDC_SDA"),
589 PINCTRL_PIN(TEGRA_PIN_OWC, "OWC"),
590 PINCTRL_PIN(TEGRA_PIN_CORE_PWR_REQ, "CORE_PWR_REQ"),
591 PINCTRL_PIN(TEGRA_PIN_CPU_PWR_REQ, "CPU_PWR_REQ"),
592 PINCTRL_PIN(TEGRA_PIN_PWR_INT_N, "PWR_INT_N"),
593 PINCTRL_PIN(TEGRA_PIN_CLK_32_K_IN, "CLK_32_K_IN"),
594 PINCTRL_PIN(TEGRA_PIN_DDR_COMP_PD, "DDR_COMP_PD"),
595 PINCTRL_PIN(TEGRA_PIN_DDR_COMP_PU, "DDR_COMP_PU"),
596 PINCTRL_PIN(TEGRA_PIN_DDR_A0, "DDR_A0"),
597 PINCTRL_PIN(TEGRA_PIN_DDR_A1, "DDR_A1"),
598 PINCTRL_PIN(TEGRA_PIN_DDR_A2, "DDR_A2"),
599 PINCTRL_PIN(TEGRA_PIN_DDR_A3, "DDR_A3"),
600 PINCTRL_PIN(TEGRA_PIN_DDR_A4, "DDR_A4"),
601 PINCTRL_PIN(TEGRA_PIN_DDR_A5, "DDR_A5"),
602 PINCTRL_PIN(TEGRA_PIN_DDR_A6, "DDR_A6"),
603 PINCTRL_PIN(TEGRA_PIN_DDR_A7, "DDR_A7"),
604 PINCTRL_PIN(TEGRA_PIN_DDR_A8, "DDR_A8"),
605 PINCTRL_PIN(TEGRA_PIN_DDR_A9, "DDR_A9"),
606 PINCTRL_PIN(TEGRA_PIN_DDR_A10, "DDR_A10"),
607 PINCTRL_PIN(TEGRA_PIN_DDR_A11, "DDR_A11"),
608 PINCTRL_PIN(TEGRA_PIN_DDR_A12, "DDR_A12"),
609 PINCTRL_PIN(TEGRA_PIN_DDR_A13, "DDR_A13"),
610 PINCTRL_PIN(TEGRA_PIN_DDR_A14, "DDR_A14"),
611 PINCTRL_PIN(TEGRA_PIN_DDR_CAS_N, "DDR_CAS_N"),
612 PINCTRL_PIN(TEGRA_PIN_DDR_BA0, "DDR_BA0"),
613 PINCTRL_PIN(TEGRA_PIN_DDR_BA1, "DDR_BA1"),
614 PINCTRL_PIN(TEGRA_PIN_DDR_BA2, "DDR_BA2"),
615 PINCTRL_PIN(TEGRA_PIN_DDR_DQS0P, "DDR_DQS0P"),
616 PINCTRL_PIN(TEGRA_PIN_DDR_DQS0N, "DDR_DQS0N"),
617 PINCTRL_PIN(TEGRA_PIN_DDR_DQS1P, "DDR_DQS1P"),
618 PINCTRL_PIN(TEGRA_PIN_DDR_DQS1N, "DDR_DQS1N"),
619 PINCTRL_PIN(TEGRA_PIN_DDR_DQS2P, "DDR_DQS2P"),
620 PINCTRL_PIN(TEGRA_PIN_DDR_DQS2N, "DDR_DQS2N"),
621 PINCTRL_PIN(TEGRA_PIN_DDR_DQS3P, "DDR_DQS3P"),
622 PINCTRL_PIN(TEGRA_PIN_DDR_DQS3N, "DDR_DQS3N"),
623 PINCTRL_PIN(TEGRA_PIN_DDR_CKE0, "DDR_CKE0"),
624 PINCTRL_PIN(TEGRA_PIN_DDR_CKE1, "DDR_CKE1"),
625 PINCTRL_PIN(TEGRA_PIN_DDR_CLK, "DDR_CLK"),
626 PINCTRL_PIN(TEGRA_PIN_DDR_CLK_N, "DDR_CLK_N"),
627 PINCTRL_PIN(TEGRA_PIN_DDR_DM0, "DDR_DM0"),
628 PINCTRL_PIN(TEGRA_PIN_DDR_DM1, "DDR_DM1"),
629 PINCTRL_PIN(TEGRA_PIN_DDR_DM2, "DDR_DM2"),
630 PINCTRL_PIN(TEGRA_PIN_DDR_DM3, "DDR_DM3"),
631 PINCTRL_PIN(TEGRA_PIN_DDR_ODT, "DDR_ODT"),
632 PINCTRL_PIN(TEGRA_PIN_DDR_QUSE0, "DDR_QUSE0"),
633 PINCTRL_PIN(TEGRA_PIN_DDR_QUSE1, "DDR_QUSE1"),
634 PINCTRL_PIN(TEGRA_PIN_DDR_QUSE2, "DDR_QUSE2"),
635 PINCTRL_PIN(TEGRA_PIN_DDR_QUSE3, "DDR_QUSE3"),
636 PINCTRL_PIN(TEGRA_PIN_DDR_RAS_N, "DDR_RAS_N"),
637 PINCTRL_PIN(TEGRA_PIN_DDR_WE_N, "DDR_WE_N"),
638 PINCTRL_PIN(TEGRA_PIN_DDR_DQ0, "DDR_DQ0"),
639 PINCTRL_PIN(TEGRA_PIN_DDR_DQ1, "DDR_DQ1"),
640 PINCTRL_PIN(TEGRA_PIN_DDR_DQ2, "DDR_DQ2"),
641 PINCTRL_PIN(TEGRA_PIN_DDR_DQ3, "DDR_DQ3"),
642 PINCTRL_PIN(TEGRA_PIN_DDR_DQ4, "DDR_DQ4"),
643 PINCTRL_PIN(TEGRA_PIN_DDR_DQ5, "DDR_DQ5"),
644 PINCTRL_PIN(TEGRA_PIN_DDR_DQ6, "DDR_DQ6"),
645 PINCTRL_PIN(TEGRA_PIN_DDR_DQ7, "DDR_DQ7"),
646 PINCTRL_PIN(TEGRA_PIN_DDR_DQ8, "DDR_DQ8"),
647 PINCTRL_PIN(TEGRA_PIN_DDR_DQ9, "DDR_DQ9"),
648 PINCTRL_PIN(TEGRA_PIN_DDR_DQ10, "DDR_DQ10"),
649 PINCTRL_PIN(TEGRA_PIN_DDR_DQ11, "DDR_DQ11"),
650 PINCTRL_PIN(TEGRA_PIN_DDR_DQ12, "DDR_DQ12"),
651 PINCTRL_PIN(TEGRA_PIN_DDR_DQ13, "DDR_DQ13"),
652 PINCTRL_PIN(TEGRA_PIN_DDR_DQ14, "DDR_DQ14"),
653 PINCTRL_PIN(TEGRA_PIN_DDR_DQ15, "DDR_DQ15"),
654 PINCTRL_PIN(TEGRA_PIN_DDR_DQ16, "DDR_DQ16"),
655 PINCTRL_PIN(TEGRA_PIN_DDR_DQ17, "DDR_DQ17"),
656 PINCTRL_PIN(TEGRA_PIN_DDR_DQ18, "DDR_DQ18"),
657 PINCTRL_PIN(TEGRA_PIN_DDR_DQ19, "DDR_DQ19"),
658 PINCTRL_PIN(TEGRA_PIN_DDR_DQ20, "DDR_DQ20"),
659 PINCTRL_PIN(TEGRA_PIN_DDR_DQ21, "DDR_DQ21"),
660 PINCTRL_PIN(TEGRA_PIN_DDR_DQ22, "DDR_DQ22"),
661 PINCTRL_PIN(TEGRA_PIN_DDR_DQ23, "DDR_DQ23"),
662 PINCTRL_PIN(TEGRA_PIN_DDR_DQ24, "DDR_DQ24"),
663 PINCTRL_PIN(TEGRA_PIN_DDR_DQ25, "DDR_DQ25"),
664 PINCTRL_PIN(TEGRA_PIN_DDR_DQ26, "DDR_DQ26"),
665 PINCTRL_PIN(TEGRA_PIN_DDR_DQ27, "DDR_DQ27"),
666 PINCTRL_PIN(TEGRA_PIN_DDR_DQ28, "DDR_DQ28"),
667 PINCTRL_PIN(TEGRA_PIN_DDR_DQ29, "DDR_DQ29"),
668 PINCTRL_PIN(TEGRA_PIN_DDR_DQ30, "DDR_DQ30"),
669 PINCTRL_PIN(TEGRA_PIN_DDR_DQ31, "DDR_DQ31"),
670 PINCTRL_PIN(TEGRA_PIN_DDR_CS0_N, "DDR_CS0_N"),
671 PINCTRL_PIN(TEGRA_PIN_DDR_CS1_N, "DDR_CS1_N"),
672 PINCTRL_PIN(TEGRA_PIN_SYS_RESET, "SYS_RESET"),
673 PINCTRL_PIN(TEGRA_PIN_JTAG_TRST_N, "JTAG_TRST_N"),
674 PINCTRL_PIN(TEGRA_PIN_JTAG_TDO, "JTAG_TDO"),
675 PINCTRL_PIN(TEGRA_PIN_JTAG_TMS, "JTAG_TMS"),
676 PINCTRL_PIN(TEGRA_PIN_JTAG_TCK, "JTAG_TCK"),
677 PINCTRL_PIN(TEGRA_PIN_JTAG_TDI, "JTAG_TDI"),
678 PINCTRL_PIN(TEGRA_PIN_TEST_MODE_EN, "TEST_MODE_EN"),
679};
680
681static const unsigned ata_pins[] = {
682 TEGRA_PIN_GMI_CS6_N_PI3,
683 TEGRA_PIN_GMI_CS7_N_PI6,
684 TEGRA_PIN_GMI_RST_N_PI4,
685};
686
687static const unsigned atb_pins[] = {
688 TEGRA_PIN_GMI_CS5_N_PI2,
689 TEGRA_PIN_GMI_DPD_PT7,
690};
691
692static const unsigned atc_pins[] = {
693 TEGRA_PIN_GMI_IORDY_PI5,
694 TEGRA_PIN_GMI_WAIT_PI7,
695 TEGRA_PIN_GMI_ADV_N_PK0,
696 TEGRA_PIN_GMI_CLK_PK1,
697 TEGRA_PIN_GMI_CS2_N_PK3,
698 TEGRA_PIN_GMI_CS3_N_PK4,
699 TEGRA_PIN_GMI_CS4_N_PK2,
700 TEGRA_PIN_GMI_AD0_PG0,
701 TEGRA_PIN_GMI_AD1_PG1,
702 TEGRA_PIN_GMI_AD2_PG2,
703 TEGRA_PIN_GMI_AD3_PG3,
704 TEGRA_PIN_GMI_AD4_PG4,
705 TEGRA_PIN_GMI_AD5_PG5,
706 TEGRA_PIN_GMI_AD6_PG6,
707 TEGRA_PIN_GMI_AD7_PG7,
708 TEGRA_PIN_GMI_HIOW_N_PI0,
709 TEGRA_PIN_GMI_HIOR_N_PI1,
710};
711
712static const unsigned atd_pins[] = {
713 TEGRA_PIN_GMI_AD8_PH0,
714 TEGRA_PIN_GMI_AD9_PH1,
715 TEGRA_PIN_GMI_AD10_PH2,
716 TEGRA_PIN_GMI_AD11_PH3,
717};
718
719static const unsigned ate_pins[] = {
720 TEGRA_PIN_GMI_AD12_PH4,
721 TEGRA_PIN_GMI_AD13_PH5,
722 TEGRA_PIN_GMI_AD14_PH6,
723 TEGRA_PIN_GMI_AD15_PH7,
724};
725
726static const unsigned cdev1_pins[] = {
727 TEGRA_PIN_DAP_MCLK1_PW4,
728};
729
730static const unsigned cdev2_pins[] = {
731 TEGRA_PIN_DAP_MCLK2_PW5,
732};
733
734static const unsigned crtp_pins[] = {
735 TEGRA_PIN_CRT_HSYNC,
736 TEGRA_PIN_CRT_VSYNC,
737};
738
739static const unsigned csus_pins[] = {
740 TEGRA_PIN_VI_MCLK_PT1,
741};
742
743static const unsigned dap1_pins[] = {
744 TEGRA_PIN_DAP1_FS_PN0,
745 TEGRA_PIN_DAP1_DIN_PN1,
746 TEGRA_PIN_DAP1_DOUT_PN2,
747 TEGRA_PIN_DAP1_SCLK_PN3,
748};
749
750static const unsigned dap2_pins[] = {
751 TEGRA_PIN_DAP2_FS_PA2,
752 TEGRA_PIN_DAP2_SCLK_PA3,
753 TEGRA_PIN_DAP2_DIN_PA4,
754 TEGRA_PIN_DAP2_DOUT_PA5,
755};
756
757static const unsigned dap3_pins[] = {
758 TEGRA_PIN_DAP3_FS_PP0,
759 TEGRA_PIN_DAP3_DIN_PP1,
760 TEGRA_PIN_DAP3_DOUT_PP2,
761 TEGRA_PIN_DAP3_SCLK_PP3,
762};
763
764static const unsigned dap4_pins[] = {
765 TEGRA_PIN_DAP4_FS_PP4,
766 TEGRA_PIN_DAP4_DIN_PP5,
767 TEGRA_PIN_DAP4_DOUT_PP6,
768 TEGRA_PIN_DAP4_SCLK_PP7,
769};
770
771static const unsigned ddc_pins[] = {
772 TEGRA_PIN_DDC_SCL,
773 TEGRA_PIN_DDC_SDA,
774};
775
776static const unsigned dta_pins[] = {
777 TEGRA_PIN_VI_D0_PT4,
778 TEGRA_PIN_VI_D1_PD5,
779};
780
781static const unsigned dtb_pins[] = {
782 TEGRA_PIN_VI_D10_PT2,
783 TEGRA_PIN_VI_D11_PT3,
784};
785
786static const unsigned dtc_pins[] = {
787 TEGRA_PIN_VI_HSYNC_PD7,
788 TEGRA_PIN_VI_VSYNC_PD6,
789};
790
791static const unsigned dtd_pins[] = {
792 TEGRA_PIN_VI_PCLK_PT0,
793 TEGRA_PIN_VI_D2_PL0,
794 TEGRA_PIN_VI_D3_PL1,
795 TEGRA_PIN_VI_D4_PL2,
796 TEGRA_PIN_VI_D5_PL3,
797 TEGRA_PIN_VI_D6_PL4,
798 TEGRA_PIN_VI_D7_PL5,
799 TEGRA_PIN_VI_D8_PL6,
800 TEGRA_PIN_VI_D9_PL7,
801};
802
803static const unsigned dte_pins[] = {
804 TEGRA_PIN_VI_GP0_PBB1,
805 TEGRA_PIN_VI_GP3_PBB4,
806 TEGRA_PIN_VI_GP4_PBB5,
807 TEGRA_PIN_VI_GP5_PD2,
808 TEGRA_PIN_VI_GP6_PA0,
809};
810
811static const unsigned dtf_pins[] = {
812 TEGRA_PIN_CAM_I2C_SCL_PBB2,
813 TEGRA_PIN_CAM_I2C_SDA_PBB3,
814};
815
816static const unsigned gma_pins[] = {
817 TEGRA_PIN_GMI_AD20_PAA0,
818 TEGRA_PIN_GMI_AD21_PAA1,
819 TEGRA_PIN_GMI_AD22_PAA2,
820 TEGRA_PIN_GMI_AD23_PAA3,
821};
822
823static const unsigned gmb_pins[] = {
824 TEGRA_PIN_GMI_WP_N_PC7,
825};
826
827static const unsigned gmc_pins[] = {
828 TEGRA_PIN_GMI_AD16_PJ7,
829 TEGRA_PIN_GMI_AD17_PB0,
830 TEGRA_PIN_GMI_AD18_PB1,
831 TEGRA_PIN_GMI_AD19_PK7,
832};
833
834static const unsigned gmd_pins[] = {
835 TEGRA_PIN_GMI_CS0_N_PJ0,
836 TEGRA_PIN_GMI_CS1_N_PJ2,
837};
838
839static const unsigned gme_pins[] = {
840 TEGRA_PIN_GMI_AD24_PAA4,
841 TEGRA_PIN_GMI_AD25_PAA5,
842 TEGRA_PIN_GMI_AD26_PAA6,
843 TEGRA_PIN_GMI_AD27_PAA7,
844};
845
846static const unsigned gpu_pins[] = {
847 TEGRA_PIN_PU0,
848 TEGRA_PIN_PU1,
849 TEGRA_PIN_PU2,
850 TEGRA_PIN_PU3,
851 TEGRA_PIN_PU4,
852 TEGRA_PIN_PU5,
853 TEGRA_PIN_PU6,
854};
855
856static const unsigned gpu7_pins[] = {
857 TEGRA_PIN_JTAG_RTCK_PU7,
858};
859
860static const unsigned gpv_pins[] = {
861 TEGRA_PIN_PV4,
862 TEGRA_PIN_PV5,
863 TEGRA_PIN_PV6,
864};
865
866static const unsigned hdint_pins[] = {
867 TEGRA_PIN_HDMI_INT_N_PN7,
868};
869
870static const unsigned i2cp_pins[] = {
871 TEGRA_PIN_PWR_I2C_SCL_PZ6,
872 TEGRA_PIN_PWR_I2C_SDA_PZ7,
873};
874
875static const unsigned irrx_pins[] = {
876 TEGRA_PIN_UART2_RTS_N_PJ6,
877};
878
879static const unsigned irtx_pins[] = {
880 TEGRA_PIN_UART2_CTS_N_PJ5,
881};
882
883static const unsigned kbca_pins[] = {
884 TEGRA_PIN_KB_ROW0_PR0,
885 TEGRA_PIN_KB_ROW1_PR1,
886 TEGRA_PIN_KB_ROW2_PR2,
887};
888
889static const unsigned kbcb_pins[] = {
890 TEGRA_PIN_KB_ROW7_PR7,
891 TEGRA_PIN_KB_ROW8_PS0,
892 TEGRA_PIN_KB_ROW9_PS1,
893 TEGRA_PIN_KB_ROW10_PS2,
894 TEGRA_PIN_KB_ROW11_PS3,
895 TEGRA_PIN_KB_ROW12_PS4,
896 TEGRA_PIN_KB_ROW13_PS5,
897 TEGRA_PIN_KB_ROW14_PS6,
898 TEGRA_PIN_KB_ROW15_PS7,
899};
900
901static const unsigned kbcc_pins[] = {
902 TEGRA_PIN_KB_COL0_PQ0,
903 TEGRA_PIN_KB_COL1_PQ1,
904};
905
906static const unsigned kbcd_pins[] = {
907 TEGRA_PIN_KB_ROW3_PR3,
908 TEGRA_PIN_KB_ROW4_PR4,
909 TEGRA_PIN_KB_ROW5_PR5,
910 TEGRA_PIN_KB_ROW6_PR6,
911};
912
913static const unsigned kbce_pins[] = {
914 TEGRA_PIN_KB_COL7_PQ7,
915};
916
917static const unsigned kbcf_pins[] = {
918 TEGRA_PIN_KB_COL2_PQ2,
919 TEGRA_PIN_KB_COL3_PQ3,
920 TEGRA_PIN_KB_COL4_PQ4,
921 TEGRA_PIN_KB_COL5_PQ5,
922 TEGRA_PIN_KB_COL6_PQ6,
923};
924
925static const unsigned lcsn_pins[] = {
926 TEGRA_PIN_LCD_CS0_N_PN4,
927};
928
929static const unsigned ld0_pins[] = {
930 TEGRA_PIN_LCD_D0_PE0,
931};
932
933static const unsigned ld1_pins[] = {
934 TEGRA_PIN_LCD_D1_PE1,
935};
936
937static const unsigned ld2_pins[] = {
938 TEGRA_PIN_LCD_D2_PE2,
939};
940
941static const unsigned ld3_pins[] = {
942 TEGRA_PIN_LCD_D3_PE3,
943};
944
945static const unsigned ld4_pins[] = {
946 TEGRA_PIN_LCD_D4_PE4,
947};
948
949static const unsigned ld5_pins[] = {
950 TEGRA_PIN_LCD_D5_PE5,
951};
952
953static const unsigned ld6_pins[] = {
954 TEGRA_PIN_LCD_D6_PE6,
955};
956
957static const unsigned ld7_pins[] = {
958 TEGRA_PIN_LCD_D7_PE7,
959};
960
961static const unsigned ld8_pins[] = {
962 TEGRA_PIN_LCD_D8_PF0,
963};
964
965static const unsigned ld9_pins[] = {
966 TEGRA_PIN_LCD_D9_PF1,
967};
968
969static const unsigned ld10_pins[] = {
970 TEGRA_PIN_LCD_D10_PF2,
971};
972
973static const unsigned ld11_pins[] = {
974 TEGRA_PIN_LCD_D11_PF3,
975};
976
977static const unsigned ld12_pins[] = {
978 TEGRA_PIN_LCD_D12_PF4,
979};
980
981static const unsigned ld13_pins[] = {
982 TEGRA_PIN_LCD_D13_PF5,
983};
984
985static const unsigned ld14_pins[] = {
986 TEGRA_PIN_LCD_D14_PF6,
987};
988
989static const unsigned ld15_pins[] = {
990 TEGRA_PIN_LCD_D15_PF7,
991};
992
993static const unsigned ld16_pins[] = {
994 TEGRA_PIN_LCD_D16_PM0,
995};
996
997static const unsigned ld17_pins[] = {
998 TEGRA_PIN_LCD_D17_PM1,
999};
1000
1001static const unsigned ldc_pins[] = {
1002 TEGRA_PIN_LCD_DC0_PN6,
1003};
1004
1005static const unsigned ldi_pins[] = {
1006 TEGRA_PIN_LCD_D22_PM6,
1007};
1008
1009static const unsigned lhp0_pins[] = {
1010 TEGRA_PIN_LCD_D21_PM5,
1011};
1012
1013static const unsigned lhp1_pins[] = {
1014 TEGRA_PIN_LCD_D18_PM2,
1015};
1016
1017static const unsigned lhp2_pins[] = {
1018 TEGRA_PIN_LCD_D19_PM3,
1019};
1020
1021static const unsigned lhs_pins[] = {
1022 TEGRA_PIN_LCD_HSYNC_PJ3,
1023};
1024
1025static const unsigned lm0_pins[] = {
1026 TEGRA_PIN_LCD_CS1_N_PW0,
1027};
1028
1029static const unsigned lm1_pins[] = {
1030 TEGRA_PIN_LCD_M1_PW1,
1031};
1032
1033static const unsigned lpp_pins[] = {
1034 TEGRA_PIN_LCD_D23_PM7,
1035};
1036
1037static const unsigned lpw0_pins[] = {
1038 TEGRA_PIN_LCD_PWR0_PB2,
1039};
1040
1041static const unsigned lpw1_pins[] = {
1042 TEGRA_PIN_LCD_PWR1_PC1,
1043};
1044
1045static const unsigned lpw2_pins[] = {
1046 TEGRA_PIN_LCD_PWR2_PC6,
1047};
1048
1049static const unsigned lsc0_pins[] = {
1050 TEGRA_PIN_LCD_PCLK_PB3,
1051};
1052
1053static const unsigned lsc1_pins[] = {
1054 TEGRA_PIN_LCD_WR_N_PZ3,
1055};
1056
1057static const unsigned lsck_pins[] = {
1058 TEGRA_PIN_LCD_SCK_PZ4,
1059};
1060
1061static const unsigned lsda_pins[] = {
1062 TEGRA_PIN_LCD_SDOUT_PN5,
1063};
1064
1065static const unsigned lsdi_pins[] = {
1066 TEGRA_PIN_LCD_SDIN_PZ2,
1067};
1068
1069static const unsigned lspi_pins[] = {
1070 TEGRA_PIN_LCD_DE_PJ1,
1071};
1072
1073static const unsigned lvp0_pins[] = {
1074 TEGRA_PIN_LCD_DC1_PV7,
1075};
1076
1077static const unsigned lvp1_pins[] = {
1078 TEGRA_PIN_LCD_D20_PM4,
1079};
1080
1081static const unsigned lvs_pins[] = {
1082 TEGRA_PIN_LCD_VSYNC_PJ4,
1083};
1084
1085static const unsigned ls_pins[] = {
1086 TEGRA_PIN_LCD_PWR0_PB2,
1087 TEGRA_PIN_LCD_PWR1_PC1,
1088 TEGRA_PIN_LCD_PWR2_PC6,
1089 TEGRA_PIN_LCD_SDIN_PZ2,
1090 TEGRA_PIN_LCD_SDOUT_PN5,
1091 TEGRA_PIN_LCD_WR_N_PZ3,
1092 TEGRA_PIN_LCD_CS0_N_PN4,
1093 TEGRA_PIN_LCD_DC0_PN6,
1094 TEGRA_PIN_LCD_SCK_PZ4,
1095};
1096
1097static const unsigned lc_pins[] = {
1098 TEGRA_PIN_LCD_PCLK_PB3,
1099 TEGRA_PIN_LCD_DE_PJ1,
1100 TEGRA_PIN_LCD_HSYNC_PJ3,
1101 TEGRA_PIN_LCD_VSYNC_PJ4,
1102 TEGRA_PIN_LCD_CS1_N_PW0,
1103 TEGRA_PIN_LCD_M1_PW1,
1104 TEGRA_PIN_LCD_DC1_PV7,
1105 TEGRA_PIN_HDMI_INT_N_PN7,
1106};
1107
1108static const unsigned ld17_0_pins[] = {
1109 TEGRA_PIN_LCD_D0_PE0,
1110 TEGRA_PIN_LCD_D1_PE1,
1111 TEGRA_PIN_LCD_D2_PE2,
1112 TEGRA_PIN_LCD_D3_PE3,
1113 TEGRA_PIN_LCD_D4_PE4,
1114 TEGRA_PIN_LCD_D5_PE5,
1115 TEGRA_PIN_LCD_D6_PE6,
1116 TEGRA_PIN_LCD_D7_PE7,
1117 TEGRA_PIN_LCD_D8_PF0,
1118 TEGRA_PIN_LCD_D9_PF1,
1119 TEGRA_PIN_LCD_D10_PF2,
1120 TEGRA_PIN_LCD_D11_PF3,
1121 TEGRA_PIN_LCD_D12_PF4,
1122 TEGRA_PIN_LCD_D13_PF5,
1123 TEGRA_PIN_LCD_D14_PF6,
1124 TEGRA_PIN_LCD_D15_PF7,
1125 TEGRA_PIN_LCD_D16_PM0,
1126 TEGRA_PIN_LCD_D17_PM1,
1127};
1128
1129static const unsigned ld19_18_pins[] = {
1130 TEGRA_PIN_LCD_D18_PM2,
1131 TEGRA_PIN_LCD_D19_PM3,
1132};
1133
1134static const unsigned ld21_20_pins[] = {
1135 TEGRA_PIN_LCD_D20_PM4,
1136 TEGRA_PIN_LCD_D21_PM5,
1137};
1138
1139static const unsigned ld23_22_pins[] = {
1140 TEGRA_PIN_LCD_D22_PM6,
1141 TEGRA_PIN_LCD_D23_PM7,
1142};
1143
1144static const unsigned owc_pins[] = {
1145 TEGRA_PIN_OWC,
1146};
1147
1148static const unsigned pmc_pins[] = {
1149 TEGRA_PIN_LED_BLINK_PBB0,
1150 TEGRA_PIN_SYS_CLK_REQ_PZ5,
1151 TEGRA_PIN_CORE_PWR_REQ,
1152 TEGRA_PIN_CPU_PWR_REQ,
1153 TEGRA_PIN_PWR_INT_N,
1154};
1155
1156static const unsigned pta_pins[] = {
1157 TEGRA_PIN_GEN2_I2C_SCL_PT5,
1158 TEGRA_PIN_GEN2_I2C_SDA_PT6,
1159};
1160
1161static const unsigned rm_pins[] = {
1162 TEGRA_PIN_GEN1_I2C_SCL_PC4,
1163 TEGRA_PIN_GEN1_I2C_SDA_PC5,
1164};
1165
1166static const unsigned sdb_pins[] = {
1167 TEGRA_PIN_SDIO3_CMD_PA7,
1168};
1169
1170static const unsigned sdc_pins[] = {
1171 TEGRA_PIN_SDIO3_DAT0_PB7,
1172 TEGRA_PIN_SDIO3_DAT1_PB6,
1173 TEGRA_PIN_SDIO3_DAT2_PB5,
1174 TEGRA_PIN_SDIO3_DAT3_PB4,
1175};
1176
1177static const unsigned sdd_pins[] = {
1178 TEGRA_PIN_SDIO3_CLK_PA6,
1179};
1180
1181static const unsigned sdio1_pins[] = {
1182 TEGRA_PIN_SDIO1_CLK_PZ0,
1183 TEGRA_PIN_SDIO1_CMD_PZ1,
1184 TEGRA_PIN_SDIO1_DAT0_PY7,
1185 TEGRA_PIN_SDIO1_DAT1_PY6,
1186 TEGRA_PIN_SDIO1_DAT2_PY5,
1187 TEGRA_PIN_SDIO1_DAT3_PY4,
1188};
1189
1190static const unsigned slxa_pins[] = {
1191 TEGRA_PIN_SDIO3_DAT4_PD1,
1192};
1193
1194static const unsigned slxc_pins[] = {
1195 TEGRA_PIN_SDIO3_DAT6_PD3,
1196};
1197
1198static const unsigned slxd_pins[] = {
1199 TEGRA_PIN_SDIO3_DAT7_PD4,
1200};
1201
1202static const unsigned slxk_pins[] = {
1203 TEGRA_PIN_SDIO3_DAT5_PD0,
1204};
1205
1206static const unsigned spdi_pins[] = {
1207 TEGRA_PIN_SPDIF_IN_PK6,
1208};
1209
1210static const unsigned spdo_pins[] = {
1211 TEGRA_PIN_SPDIF_OUT_PK5,
1212};
1213
1214static const unsigned spia_pins[] = {
1215 TEGRA_PIN_SPI2_MOSI_PX0,
1216};
1217
1218static const unsigned spib_pins[] = {
1219 TEGRA_PIN_SPI2_MISO_PX1,
1220};
1221
1222static const unsigned spic_pins[] = {
1223 TEGRA_PIN_SPI2_CS0_N_PX3,
1224 TEGRA_PIN_SPI2_SCK_PX2,
1225};
1226
1227static const unsigned spid_pins[] = {
1228 TEGRA_PIN_SPI1_MOSI_PX4,
1229};
1230
1231static const unsigned spie_pins[] = {
1232 TEGRA_PIN_SPI1_CS0_N_PX6,
1233 TEGRA_PIN_SPI1_SCK_PX5,
1234};
1235
1236static const unsigned spif_pins[] = {
1237 TEGRA_PIN_SPI1_MISO_PX7,
1238};
1239
1240static const unsigned spig_pins[] = {
1241 TEGRA_PIN_SPI2_CS1_N_PW2,
1242};
1243
1244static const unsigned spih_pins[] = {
1245 TEGRA_PIN_SPI2_CS2_N_PW3,
1246};
1247
1248static const unsigned uaa_pins[] = {
1249 TEGRA_PIN_ULPI_DATA0_PO1,
1250 TEGRA_PIN_ULPI_DATA1_PO2,
1251 TEGRA_PIN_ULPI_DATA2_PO3,
1252 TEGRA_PIN_ULPI_DATA3_PO4,
1253};
1254
1255static const unsigned uab_pins[] = {
1256 TEGRA_PIN_ULPI_DATA4_PO5,
1257 TEGRA_PIN_ULPI_DATA5_PO6,
1258 TEGRA_PIN_ULPI_DATA6_PO7,
1259 TEGRA_PIN_ULPI_DATA7_PO0,
1260};
1261
1262static const unsigned uac_pins[] = {
1263 TEGRA_PIN_PV0,
1264 TEGRA_PIN_PV1,
1265 TEGRA_PIN_PV2,
1266 TEGRA_PIN_PV3,
1267};
1268
1269static const unsigned ck32_pins[] = {
1270 TEGRA_PIN_CLK_32_K_IN,
1271};
1272
1273static const unsigned uad_pins[] = {
1274 TEGRA_PIN_UART2_RXD_PC3,
1275 TEGRA_PIN_UART2_TXD_PC2,
1276};
1277
1278static const unsigned uca_pins[] = {
1279 TEGRA_PIN_UART3_RXD_PW7,
1280 TEGRA_PIN_UART3_TXD_PW6,
1281};
1282
1283static const unsigned ucb_pins[] = {
1284 TEGRA_PIN_UART3_CTS_N_PA1,
1285 TEGRA_PIN_UART3_RTS_N_PC0,
1286};
1287
1288static const unsigned uda_pins[] = {
1289 TEGRA_PIN_ULPI_CLK_PY0,
1290 TEGRA_PIN_ULPI_DIR_PY1,
1291 TEGRA_PIN_ULPI_NXT_PY2,
1292 TEGRA_PIN_ULPI_STP_PY3,
1293};
1294
1295static const unsigned ddrc_pins[] = {
1296 TEGRA_PIN_DDR_COMP_PD,
1297 TEGRA_PIN_DDR_COMP_PU,
1298};
1299
1300static const unsigned pmca_pins[] = {
1301 TEGRA_PIN_LED_BLINK_PBB0,
1302};
1303
1304static const unsigned pmcb_pins[] = {
1305 TEGRA_PIN_SYS_CLK_REQ_PZ5,
1306};
1307
1308static const unsigned pmcc_pins[] = {
1309 TEGRA_PIN_CORE_PWR_REQ,
1310};
1311
1312static const unsigned pmcd_pins[] = {
1313 TEGRA_PIN_CPU_PWR_REQ,
1314};
1315
1316static const unsigned pmce_pins[] = {
1317 TEGRA_PIN_PWR_INT_N,
1318};
1319
1320static const unsigned xm2c_pins[] = {
1321 TEGRA_PIN_DDR_A0,
1322 TEGRA_PIN_DDR_A1,
1323 TEGRA_PIN_DDR_A2,
1324 TEGRA_PIN_DDR_A3,
1325 TEGRA_PIN_DDR_A4,
1326 TEGRA_PIN_DDR_A5,
1327 TEGRA_PIN_DDR_A6,
1328 TEGRA_PIN_DDR_A7,
1329 TEGRA_PIN_DDR_A8,
1330 TEGRA_PIN_DDR_A9,
1331 TEGRA_PIN_DDR_A10,
1332 TEGRA_PIN_DDR_A11,
1333 TEGRA_PIN_DDR_A12,
1334 TEGRA_PIN_DDR_A13,
1335 TEGRA_PIN_DDR_A14,
1336 TEGRA_PIN_DDR_CAS_N,
1337 TEGRA_PIN_DDR_BA0,
1338 TEGRA_PIN_DDR_BA1,
1339 TEGRA_PIN_DDR_BA2,
1340 TEGRA_PIN_DDR_DQS0P,
1341 TEGRA_PIN_DDR_DQS0N,
1342 TEGRA_PIN_DDR_DQS1P,
1343 TEGRA_PIN_DDR_DQS1N,
1344 TEGRA_PIN_DDR_DQS2P,
1345 TEGRA_PIN_DDR_DQS2N,
1346 TEGRA_PIN_DDR_DQS3P,
1347 TEGRA_PIN_DDR_DQS3N,
1348 TEGRA_PIN_DDR_CS0_N,
1349 TEGRA_PIN_DDR_CS1_N,
1350 TEGRA_PIN_DDR_CKE0,
1351 TEGRA_PIN_DDR_CKE1,
1352 TEGRA_PIN_DDR_CLK,
1353 TEGRA_PIN_DDR_CLK_N,
1354 TEGRA_PIN_DDR_DM0,
1355 TEGRA_PIN_DDR_DM1,
1356 TEGRA_PIN_DDR_DM2,
1357 TEGRA_PIN_DDR_DM3,
1358 TEGRA_PIN_DDR_ODT,
1359 TEGRA_PIN_DDR_RAS_N,
1360 TEGRA_PIN_DDR_WE_N,
1361 TEGRA_PIN_DDR_QUSE0,
1362 TEGRA_PIN_DDR_QUSE1,
1363 TEGRA_PIN_DDR_QUSE2,
1364 TEGRA_PIN_DDR_QUSE3,
1365};
1366
1367static const unsigned xm2d_pins[] = {
1368 TEGRA_PIN_DDR_DQ0,
1369 TEGRA_PIN_DDR_DQ1,
1370 TEGRA_PIN_DDR_DQ2,
1371 TEGRA_PIN_DDR_DQ3,
1372 TEGRA_PIN_DDR_DQ4,
1373 TEGRA_PIN_DDR_DQ5,
1374 TEGRA_PIN_DDR_DQ6,
1375 TEGRA_PIN_DDR_DQ7,
1376 TEGRA_PIN_DDR_DQ8,
1377 TEGRA_PIN_DDR_DQ9,
1378 TEGRA_PIN_DDR_DQ10,
1379 TEGRA_PIN_DDR_DQ11,
1380 TEGRA_PIN_DDR_DQ12,
1381 TEGRA_PIN_DDR_DQ13,
1382 TEGRA_PIN_DDR_DQ14,
1383 TEGRA_PIN_DDR_DQ15,
1384 TEGRA_PIN_DDR_DQ16,
1385 TEGRA_PIN_DDR_DQ17,
1386 TEGRA_PIN_DDR_DQ18,
1387 TEGRA_PIN_DDR_DQ19,
1388 TEGRA_PIN_DDR_DQ20,
1389 TEGRA_PIN_DDR_DQ21,
1390 TEGRA_PIN_DDR_DQ22,
1391 TEGRA_PIN_DDR_DQ23,
1392 TEGRA_PIN_DDR_DQ24,
1393 TEGRA_PIN_DDR_DQ25,
1394 TEGRA_PIN_DDR_DQ26,
1395 TEGRA_PIN_DDR_DQ27,
1396 TEGRA_PIN_DDR_DQ28,
1397 TEGRA_PIN_DDR_DQ29,
1398 TEGRA_PIN_DDR_DQ30,
1399 TEGRA_PIN_DDR_DQ31,
1400};
1401
1402static const unsigned drive_ao1_pins[] = {
1403 TEGRA_PIN_SYS_RESET,
1404 TEGRA_PIN_PWR_I2C_SCL_PZ6,
1405 TEGRA_PIN_PWR_I2C_SDA_PZ7,
1406 TEGRA_PIN_KB_ROW0_PR0,
1407 TEGRA_PIN_KB_ROW1_PR1,
1408 TEGRA_PIN_KB_ROW2_PR2,
1409 TEGRA_PIN_KB_ROW3_PR3,
1410 TEGRA_PIN_KB_ROW4_PR4,
1411 TEGRA_PIN_KB_ROW5_PR5,
1412 TEGRA_PIN_KB_ROW6_PR6,
1413 TEGRA_PIN_KB_ROW7_PR7,
1414};
1415
1416static const unsigned drive_ao2_pins[] = {
1417 TEGRA_PIN_KB_ROW8_PS0,
1418 TEGRA_PIN_KB_ROW9_PS1,
1419 TEGRA_PIN_KB_ROW10_PS2,
1420 TEGRA_PIN_KB_ROW11_PS3,
1421 TEGRA_PIN_KB_ROW12_PS4,
1422 TEGRA_PIN_KB_ROW13_PS5,
1423 TEGRA_PIN_KB_ROW14_PS6,
1424 TEGRA_PIN_KB_ROW15_PS7,
1425 TEGRA_PIN_KB_COL0_PQ0,
1426 TEGRA_PIN_KB_COL1_PQ1,
1427 TEGRA_PIN_KB_COL2_PQ2,
1428 TEGRA_PIN_KB_COL3_PQ3,
1429 TEGRA_PIN_KB_COL4_PQ4,
1430 TEGRA_PIN_KB_COL5_PQ5,
1431 TEGRA_PIN_KB_COL6_PQ6,
1432 TEGRA_PIN_KB_COL7_PQ7,
1433 TEGRA_PIN_LED_BLINK_PBB0,
1434 TEGRA_PIN_SYS_CLK_REQ_PZ5,
1435 TEGRA_PIN_CORE_PWR_REQ,
1436 TEGRA_PIN_CPU_PWR_REQ,
1437 TEGRA_PIN_PWR_INT_N,
1438 TEGRA_PIN_CLK_32_K_IN,
1439};
1440
1441static const unsigned drive_at1_pins[] = {
1442 TEGRA_PIN_GMI_IORDY_PI5,
1443 TEGRA_PIN_GMI_AD8_PH0,
1444 TEGRA_PIN_GMI_AD9_PH1,
1445 TEGRA_PIN_GMI_AD10_PH2,
1446 TEGRA_PIN_GMI_AD11_PH3,
1447 TEGRA_PIN_GMI_AD12_PH4,
1448 TEGRA_PIN_GMI_AD13_PH5,
1449 TEGRA_PIN_GMI_AD14_PH6,
1450 TEGRA_PIN_GMI_AD15_PH7,
1451 TEGRA_PIN_GMI_CS7_N_PI6,
1452 TEGRA_PIN_GMI_DPD_PT7,
1453 TEGRA_PIN_GEN2_I2C_SCL_PT5,
1454 TEGRA_PIN_GEN2_I2C_SDA_PT6,
1455};
1456
1457static const unsigned drive_at2_pins[] = {
1458 TEGRA_PIN_GMI_WAIT_PI7,
1459 TEGRA_PIN_GMI_ADV_N_PK0,
1460 TEGRA_PIN_GMI_CLK_PK1,
1461 TEGRA_PIN_GMI_CS6_N_PI3,
1462 TEGRA_PIN_GMI_CS5_N_PI2,
1463 TEGRA_PIN_GMI_CS4_N_PK2,
1464 TEGRA_PIN_GMI_CS3_N_PK4,
1465 TEGRA_PIN_GMI_CS2_N_PK3,
1466 TEGRA_PIN_GMI_AD0_PG0,
1467 TEGRA_PIN_GMI_AD1_PG1,
1468 TEGRA_PIN_GMI_AD2_PG2,
1469 TEGRA_PIN_GMI_AD3_PG3,
1470 TEGRA_PIN_GMI_AD4_PG4,
1471 TEGRA_PIN_GMI_AD5_PG5,
1472 TEGRA_PIN_GMI_AD6_PG6,
1473 TEGRA_PIN_GMI_AD7_PG7,
1474 TEGRA_PIN_GMI_HIOW_N_PI0,
1475 TEGRA_PIN_GMI_HIOR_N_PI1,
1476 TEGRA_PIN_GMI_RST_N_PI4,
1477};
1478
1479static const unsigned drive_cdev1_pins[] = {
1480 TEGRA_PIN_DAP_MCLK1_PW4,
1481};
1482
1483static const unsigned drive_cdev2_pins[] = {
1484 TEGRA_PIN_DAP_MCLK2_PW5,
1485};
1486
1487static const unsigned drive_csus_pins[] = {
1488 TEGRA_PIN_VI_MCLK_PT1,
1489};
1490
1491static const unsigned drive_dap1_pins[] = {
1492 TEGRA_PIN_DAP1_FS_PN0,
1493 TEGRA_PIN_DAP1_DIN_PN1,
1494 TEGRA_PIN_DAP1_DOUT_PN2,
1495 TEGRA_PIN_DAP1_SCLK_PN3,
1496 TEGRA_PIN_SPDIF_OUT_PK5,
1497 TEGRA_PIN_SPDIF_IN_PK6,
1498};
1499
1500static const unsigned drive_dap2_pins[] = {
1501 TEGRA_PIN_DAP2_FS_PA2,
1502 TEGRA_PIN_DAP2_SCLK_PA3,
1503 TEGRA_PIN_DAP2_DIN_PA4,
1504 TEGRA_PIN_DAP2_DOUT_PA5,
1505};
1506
1507static const unsigned drive_dap3_pins[] = {
1508 TEGRA_PIN_DAP3_FS_PP0,
1509 TEGRA_PIN_DAP3_DIN_PP1,
1510 TEGRA_PIN_DAP3_DOUT_PP2,
1511 TEGRA_PIN_DAP3_SCLK_PP3,
1512};
1513
1514static const unsigned drive_dap4_pins[] = {
1515 TEGRA_PIN_DAP4_FS_PP4,
1516 TEGRA_PIN_DAP4_DIN_PP5,
1517 TEGRA_PIN_DAP4_DOUT_PP6,
1518 TEGRA_PIN_DAP4_SCLK_PP7,
1519};
1520
1521static const unsigned drive_dbg_pins[] = {
1522 TEGRA_PIN_PU0,
1523 TEGRA_PIN_PU1,
1524 TEGRA_PIN_PU2,
1525 TEGRA_PIN_PU3,
1526 TEGRA_PIN_PU4,
1527 TEGRA_PIN_PU5,
1528 TEGRA_PIN_PU6,
1529 TEGRA_PIN_JTAG_RTCK_PU7,
1530 TEGRA_PIN_GEN1_I2C_SDA_PC5,
1531 TEGRA_PIN_GEN1_I2C_SCL_PC4,
1532 TEGRA_PIN_JTAG_TRST_N,
1533 TEGRA_PIN_JTAG_TDO,
1534 TEGRA_PIN_JTAG_TMS,
1535 TEGRA_PIN_JTAG_TCK,
1536 TEGRA_PIN_JTAG_TDI,
1537 TEGRA_PIN_TEST_MODE_EN,
1538};
1539
1540static const unsigned drive_lcd1_pins[] = {
1541 TEGRA_PIN_LCD_PWR1_PC1,
1542 TEGRA_PIN_LCD_PWR2_PC6,
1543 TEGRA_PIN_LCD_SDIN_PZ2,
1544 TEGRA_PIN_LCD_SDOUT_PN5,
1545 TEGRA_PIN_LCD_WR_N_PZ3,
1546 TEGRA_PIN_LCD_CS0_N_PN4,
1547 TEGRA_PIN_LCD_DC0_PN6,
1548 TEGRA_PIN_LCD_SCK_PZ4,
1549};
1550
1551static const unsigned drive_lcd2_pins[] = {
1552 TEGRA_PIN_LCD_PWR0_PB2,
1553 TEGRA_PIN_LCD_PCLK_PB3,
1554 TEGRA_PIN_LCD_DE_PJ1,
1555 TEGRA_PIN_LCD_HSYNC_PJ3,
1556 TEGRA_PIN_LCD_VSYNC_PJ4,
1557 TEGRA_PIN_LCD_D0_PE0,
1558 TEGRA_PIN_LCD_D1_PE1,
1559 TEGRA_PIN_LCD_D2_PE2,
1560 TEGRA_PIN_LCD_D3_PE3,
1561 TEGRA_PIN_LCD_D4_PE4,
1562 TEGRA_PIN_LCD_D5_PE5,
1563 TEGRA_PIN_LCD_D6_PE6,
1564 TEGRA_PIN_LCD_D7_PE7,
1565 TEGRA_PIN_LCD_D8_PF0,
1566 TEGRA_PIN_LCD_D9_PF1,
1567 TEGRA_PIN_LCD_D10_PF2,
1568 TEGRA_PIN_LCD_D11_PF3,
1569 TEGRA_PIN_LCD_D12_PF4,
1570 TEGRA_PIN_LCD_D13_PF5,
1571 TEGRA_PIN_LCD_D14_PF6,
1572 TEGRA_PIN_LCD_D15_PF7,
1573 TEGRA_PIN_LCD_D16_PM0,
1574 TEGRA_PIN_LCD_D17_PM1,
1575 TEGRA_PIN_LCD_D18_PM2,
1576 TEGRA_PIN_LCD_D19_PM3,
1577 TEGRA_PIN_LCD_D20_PM4,
1578 TEGRA_PIN_LCD_D21_PM5,
1579 TEGRA_PIN_LCD_D22_PM6,
1580 TEGRA_PIN_LCD_D23_PM7,
1581 TEGRA_PIN_LCD_CS1_N_PW0,
1582 TEGRA_PIN_LCD_M1_PW1,
1583 TEGRA_PIN_LCD_DC1_PV7,
1584 TEGRA_PIN_HDMI_INT_N_PN7,
1585};
1586
1587static const unsigned drive_sdmmc2_pins[] = {
1588 TEGRA_PIN_SDIO3_DAT4_PD1,
1589 TEGRA_PIN_SDIO3_DAT5_PD0,
1590 TEGRA_PIN_SDIO3_DAT6_PD3,
1591 TEGRA_PIN_SDIO3_DAT7_PD4,
1592};
1593
1594static const unsigned drive_sdmmc3_pins[] = {
1595 TEGRA_PIN_SDIO3_CLK_PA6,
1596 TEGRA_PIN_SDIO3_CMD_PA7,
1597 TEGRA_PIN_SDIO3_DAT0_PB7,
1598 TEGRA_PIN_SDIO3_DAT1_PB6,
1599 TEGRA_PIN_SDIO3_DAT2_PB5,
1600 TEGRA_PIN_SDIO3_DAT3_PB4,
1601 TEGRA_PIN_PV4,
1602 TEGRA_PIN_PV5,
1603 TEGRA_PIN_PV6,
1604};
1605
1606static const unsigned drive_spi_pins[] = {
1607 TEGRA_PIN_SPI2_MOSI_PX0,
1608 TEGRA_PIN_SPI2_MISO_PX1,
1609 TEGRA_PIN_SPI2_SCK_PX2,
1610 TEGRA_PIN_SPI2_CS0_N_PX3,
1611 TEGRA_PIN_SPI1_MOSI_PX4,
1612 TEGRA_PIN_SPI1_SCK_PX5,
1613 TEGRA_PIN_SPI1_CS0_N_PX6,
1614 TEGRA_PIN_SPI1_MISO_PX7,
1615 TEGRA_PIN_SPI2_CS1_N_PW2,
1616 TEGRA_PIN_SPI2_CS2_N_PW3,
1617};
1618
1619static const unsigned drive_uaa_pins[] = {
1620 TEGRA_PIN_ULPI_DATA0_PO1,
1621 TEGRA_PIN_ULPI_DATA1_PO2,
1622 TEGRA_PIN_ULPI_DATA2_PO3,
1623 TEGRA_PIN_ULPI_DATA3_PO4,
1624};
1625
1626static const unsigned drive_uab_pins[] = {
1627 TEGRA_PIN_ULPI_DATA4_PO5,
1628 TEGRA_PIN_ULPI_DATA5_PO6,
1629 TEGRA_PIN_ULPI_DATA6_PO7,
1630 TEGRA_PIN_ULPI_DATA7_PO0,
1631 TEGRA_PIN_PV0,
1632 TEGRA_PIN_PV1,
1633 TEGRA_PIN_PV2,
1634 TEGRA_PIN_PV3,
1635};
1636
1637static const unsigned drive_uart2_pins[] = {
1638 TEGRA_PIN_UART2_TXD_PC2,
1639 TEGRA_PIN_UART2_RXD_PC3,
1640 TEGRA_PIN_UART2_RTS_N_PJ6,
1641 TEGRA_PIN_UART2_CTS_N_PJ5,
1642};
1643
1644static const unsigned drive_uart3_pins[] = {
1645 TEGRA_PIN_UART3_TXD_PW6,
1646 TEGRA_PIN_UART3_RXD_PW7,
1647 TEGRA_PIN_UART3_RTS_N_PC0,
1648 TEGRA_PIN_UART3_CTS_N_PA1,
1649};
1650
1651static const unsigned drive_vi1_pins[] = {
1652 TEGRA_PIN_VI_D0_PT4,
1653 TEGRA_PIN_VI_D1_PD5,
1654 TEGRA_PIN_VI_D2_PL0,
1655 TEGRA_PIN_VI_D3_PL1,
1656 TEGRA_PIN_VI_D4_PL2,
1657 TEGRA_PIN_VI_D5_PL3,
1658 TEGRA_PIN_VI_D6_PL4,
1659 TEGRA_PIN_VI_D7_PL5,
1660 TEGRA_PIN_VI_D8_PL6,
1661 TEGRA_PIN_VI_D9_PL7,
1662 TEGRA_PIN_VI_D10_PT2,
1663 TEGRA_PIN_VI_D11_PT3,
1664 TEGRA_PIN_VI_PCLK_PT0,
1665 TEGRA_PIN_VI_VSYNC_PD6,
1666 TEGRA_PIN_VI_HSYNC_PD7,
1667};
1668
1669static const unsigned drive_vi2_pins[] = {
1670 TEGRA_PIN_VI_GP0_PBB1,
1671 TEGRA_PIN_CAM_I2C_SCL_PBB2,
1672 TEGRA_PIN_CAM_I2C_SDA_PBB3,
1673 TEGRA_PIN_VI_GP3_PBB4,
1674 TEGRA_PIN_VI_GP4_PBB5,
1675 TEGRA_PIN_VI_GP5_PD2,
1676 TEGRA_PIN_VI_GP6_PA0,
1677};
1678
1679static const unsigned drive_xm2a_pins[] = {
1680 TEGRA_PIN_DDR_A0,
1681 TEGRA_PIN_DDR_A1,
1682 TEGRA_PIN_DDR_A2,
1683 TEGRA_PIN_DDR_A3,
1684 TEGRA_PIN_DDR_A4,
1685 TEGRA_PIN_DDR_A5,
1686 TEGRA_PIN_DDR_A6,
1687 TEGRA_PIN_DDR_A7,
1688 TEGRA_PIN_DDR_A8,
1689 TEGRA_PIN_DDR_A9,
1690 TEGRA_PIN_DDR_A10,
1691 TEGRA_PIN_DDR_A11,
1692 TEGRA_PIN_DDR_A12,
1693 TEGRA_PIN_DDR_A13,
1694 TEGRA_PIN_DDR_A14,
1695 TEGRA_PIN_DDR_BA0,
1696 TEGRA_PIN_DDR_BA1,
1697 TEGRA_PIN_DDR_BA2,
1698 TEGRA_PIN_DDR_CS0_N,
1699 TEGRA_PIN_DDR_CS1_N,
1700 TEGRA_PIN_DDR_ODT,
1701 TEGRA_PIN_DDR_RAS_N,
1702 TEGRA_PIN_DDR_CAS_N,
1703 TEGRA_PIN_DDR_WE_N,
1704 TEGRA_PIN_DDR_CKE0,
1705 TEGRA_PIN_DDR_CKE1,
1706};
1707
1708static const unsigned drive_xm2c_pins[] = {
1709 TEGRA_PIN_DDR_DQS0P,
1710 TEGRA_PIN_DDR_DQS0N,
1711 TEGRA_PIN_DDR_DQS1P,
1712 TEGRA_PIN_DDR_DQS1N,
1713 TEGRA_PIN_DDR_DQS2P,
1714 TEGRA_PIN_DDR_DQS2N,
1715 TEGRA_PIN_DDR_DQS3P,
1716 TEGRA_PIN_DDR_DQS3N,
1717 TEGRA_PIN_DDR_QUSE0,
1718 TEGRA_PIN_DDR_QUSE1,
1719 TEGRA_PIN_DDR_QUSE2,
1720 TEGRA_PIN_DDR_QUSE3,
1721};
1722
1723static const unsigned drive_xm2d_pins[] = {
1724 TEGRA_PIN_DDR_DQ0,
1725 TEGRA_PIN_DDR_DQ1,
1726 TEGRA_PIN_DDR_DQ2,
1727 TEGRA_PIN_DDR_DQ3,
1728 TEGRA_PIN_DDR_DQ4,
1729 TEGRA_PIN_DDR_DQ5,
1730 TEGRA_PIN_DDR_DQ6,
1731 TEGRA_PIN_DDR_DQ7,
1732 TEGRA_PIN_DDR_DQ8,
1733 TEGRA_PIN_DDR_DQ9,
1734 TEGRA_PIN_DDR_DQ10,
1735 TEGRA_PIN_DDR_DQ11,
1736 TEGRA_PIN_DDR_DQ12,
1737 TEGRA_PIN_DDR_DQ13,
1738 TEGRA_PIN_DDR_DQ14,
1739 TEGRA_PIN_DDR_DQ15,
1740 TEGRA_PIN_DDR_DQ16,
1741 TEGRA_PIN_DDR_DQ17,
1742 TEGRA_PIN_DDR_DQ18,
1743 TEGRA_PIN_DDR_DQ19,
1744 TEGRA_PIN_DDR_DQ20,
1745 TEGRA_PIN_DDR_DQ21,
1746 TEGRA_PIN_DDR_DQ22,
1747 TEGRA_PIN_DDR_DQ23,
1748 TEGRA_PIN_DDR_DQ24,
1749 TEGRA_PIN_DDR_DQ25,
1750 TEGRA_PIN_DDR_DQ26,
1751 TEGRA_PIN_DDR_DQ27,
1752 TEGRA_PIN_DDR_DQ28,
1753 TEGRA_PIN_DDR_DQ29,
1754 TEGRA_PIN_DDR_DQ30,
1755 TEGRA_PIN_DDR_DQ31,
1756 TEGRA_PIN_DDR_DM0,
1757 TEGRA_PIN_DDR_DM1,
1758 TEGRA_PIN_DDR_DM2,
1759 TEGRA_PIN_DDR_DM3,
1760};
1761
1762static const unsigned drive_xm2clk_pins[] = {
1763 TEGRA_PIN_DDR_CLK,
1764 TEGRA_PIN_DDR_CLK_N,
1765};
1766
1767static const unsigned drive_sdio1_pins[] = {
1768 TEGRA_PIN_SDIO1_CLK_PZ0,
1769 TEGRA_PIN_SDIO1_CMD_PZ1,
1770 TEGRA_PIN_SDIO1_DAT0_PY7,
1771 TEGRA_PIN_SDIO1_DAT1_PY6,
1772 TEGRA_PIN_SDIO1_DAT2_PY5,
1773 TEGRA_PIN_SDIO1_DAT3_PY4,
1774};
1775
1776static const unsigned drive_crt_pins[] = {
1777 TEGRA_PIN_CRT_HSYNC,
1778 TEGRA_PIN_CRT_VSYNC,
1779};
1780
1781static const unsigned drive_ddc_pins[] = {
1782 TEGRA_PIN_DDC_SCL,
1783 TEGRA_PIN_DDC_SDA,
1784};
1785
1786static const unsigned drive_gma_pins[] = {
1787 TEGRA_PIN_GMI_AD20_PAA0,
1788 TEGRA_PIN_GMI_AD21_PAA1,
1789 TEGRA_PIN_GMI_AD22_PAA2,
1790 TEGRA_PIN_GMI_AD23_PAA3,
1791};
1792
1793static const unsigned drive_gmb_pins[] = {
1794 TEGRA_PIN_GMI_WP_N_PC7,
1795};
1796
1797static const unsigned drive_gmc_pins[] = {
1798 TEGRA_PIN_GMI_AD16_PJ7,
1799 TEGRA_PIN_GMI_AD17_PB0,
1800 TEGRA_PIN_GMI_AD18_PB1,
1801 TEGRA_PIN_GMI_AD19_PK7,
1802};
1803
1804static const unsigned drive_gmd_pins[] = {
1805 TEGRA_PIN_GMI_CS0_N_PJ0,
1806 TEGRA_PIN_GMI_CS1_N_PJ2,
1807};
1808
1809static const unsigned drive_gme_pins[] = {
1810 TEGRA_PIN_GMI_AD24_PAA4,
1811 TEGRA_PIN_GMI_AD25_PAA5,
1812 TEGRA_PIN_GMI_AD26_PAA6,
1813 TEGRA_PIN_GMI_AD27_PAA7,
1814};
1815
1816static const unsigned drive_owr_pins[] = {
1817 TEGRA_PIN_OWC,
1818};
1819
1820static const unsigned drive_uda_pins[] = {
1821 TEGRA_PIN_ULPI_CLK_PY0,
1822 TEGRA_PIN_ULPI_DIR_PY1,
1823 TEGRA_PIN_ULPI_NXT_PY2,
1824 TEGRA_PIN_ULPI_STP_PY3,
1825};
1826
1827enum tegra_mux {
1828 TEGRA_MUX_AHB_CLK,
1829 TEGRA_MUX_APB_CLK,
1830 TEGRA_MUX_AUDIO_SYNC,
1831 TEGRA_MUX_CRT,
1832 TEGRA_MUX_DAP1,
1833 TEGRA_MUX_DAP2,
1834 TEGRA_MUX_DAP3,
1835 TEGRA_MUX_DAP4,
1836 TEGRA_MUX_DAP5,
1837 TEGRA_MUX_DISPLAYA,
1838 TEGRA_MUX_DISPLAYB,
1839 TEGRA_MUX_EMC_TEST0_DLL,
1840 TEGRA_MUX_EMC_TEST1_DLL,
1841 TEGRA_MUX_GMI,
1842 TEGRA_MUX_GMI_INT,
1843 TEGRA_MUX_HDMI,
1844 TEGRA_MUX_I2CP,
1845 TEGRA_MUX_I2C1,
1846 TEGRA_MUX_I2C2,
1847 TEGRA_MUX_I2C3,
1848 TEGRA_MUX_IDE,
1849 TEGRA_MUX_IRDA,
1850 TEGRA_MUX_KBC,
1851 TEGRA_MUX_MIO,
1852 TEGRA_MUX_MIPI_HS,
1853 TEGRA_MUX_NAND,
1854 TEGRA_MUX_OSC,
1855 TEGRA_MUX_OWR,
1856 TEGRA_MUX_PCIE,
1857 TEGRA_MUX_PLLA_OUT,
1858 TEGRA_MUX_PLLC_OUT1,
1859 TEGRA_MUX_PLLM_OUT1,
1860 TEGRA_MUX_PLLP_OUT2,
1861 TEGRA_MUX_PLLP_OUT3,
1862 TEGRA_MUX_PLLP_OUT4,
1863 TEGRA_MUX_PWM,
1864 TEGRA_MUX_PWR_INTR,
1865 TEGRA_MUX_PWR_ON,
1866 TEGRA_MUX_RSVD1,
1867 TEGRA_MUX_RSVD2,
1868 TEGRA_MUX_RSVD3,
1869 TEGRA_MUX_RSVD4,
1870 TEGRA_MUX_RTCK,
1871 TEGRA_MUX_SDIO1,
1872 TEGRA_MUX_SDIO2,
1873 TEGRA_MUX_SDIO3,
1874 TEGRA_MUX_SDIO4,
1875 TEGRA_MUX_SFLASH,
1876 TEGRA_MUX_SPDIF,
1877 TEGRA_MUX_SPI1,
1878 TEGRA_MUX_SPI2,
1879 TEGRA_MUX_SPI2_ALT,
1880 TEGRA_MUX_SPI3,
1881 TEGRA_MUX_SPI4,
1882 TEGRA_MUX_TRACE,
1883 TEGRA_MUX_TWC,
1884 TEGRA_MUX_UARTA,
1885 TEGRA_MUX_UARTB,
1886 TEGRA_MUX_UARTC,
1887 TEGRA_MUX_UARTD,
1888 TEGRA_MUX_UARTE,
1889 TEGRA_MUX_ULPI,
1890 TEGRA_MUX_VI,
1891 TEGRA_MUX_VI_SENSOR_CLK,
1892 TEGRA_MUX_XIO,
1893};
1894
1895static const char * const ahb_clk_groups[] = {
1896 "cdev2",
1897};
1898
1899static const char * const apb_clk_groups[] = {
1900 "cdev2",
1901};
1902
1903static const char * const audio_sync_groups[] = {
1904 "cdev1",
1905};
1906
1907static const char * const crt_groups[] = {
1908 "crtp",
1909 "lm1",
1910};
1911
1912static const char * const dap1_groups[] = {
1913 "dap1",
1914};
1915
1916static const char * const dap2_groups[] = {
1917 "dap2",
1918};
1919
1920static const char * const dap3_groups[] = {
1921 "dap3",
1922};
1923
1924static const char * const dap4_groups[] = {
1925 "dap4",
1926};
1927
1928static const char * const dap5_groups[] = {
1929 "gme",
1930};
1931
1932static const char * const displaya_groups[] = {
1933 "lcsn",
1934 "ld0",
1935 "ld1",
1936 "ld10",
1937 "ld11",
1938 "ld12",
1939 "ld13",
1940 "ld14",
1941 "ld15",
1942 "ld16",
1943 "ld17",
1944 "ld2",
1945 "ld3",
1946 "ld4",
1947 "ld5",
1948 "ld6",
1949 "ld7",
1950 "ld8",
1951 "ld9",
1952 "ldc",
1953 "ldi",
1954 "lhp0",
1955 "lhp1",
1956 "lhp2",
1957 "lhs",
1958 "lm0",
1959 "lm1",
1960 "lpp",
1961 "lpw0",
1962 "lpw1",
1963 "lpw2",
1964 "lsc0",
1965 "lsc1",
1966 "lsck",
1967 "lsda",
1968 "lsdi",
1969 "lspi",
1970 "lvp0",
1971 "lvp1",
1972 "lvs",
1973};
1974
1975static const char * const displayb_groups[] = {
1976 "lcsn",
1977 "ld0",
1978 "ld1",
1979 "ld10",
1980 "ld11",
1981 "ld12",
1982 "ld13",
1983 "ld14",
1984 "ld15",
1985 "ld16",
1986 "ld17",
1987 "ld2",
1988 "ld3",
1989 "ld4",
1990 "ld5",
1991 "ld6",
1992 "ld7",
1993 "ld8",
1994 "ld9",
1995 "ldc",
1996 "ldi",
1997 "lhp0",
1998 "lhp1",
1999 "lhp2",
2000 "lhs",
2001 "lm0",
2002 "lm1",
2003 "lpp",
2004 "lpw0",
2005 "lpw1",
2006 "lpw2",
2007 "lsc0",
2008 "lsc1",
2009 "lsck",
2010 "lsda",
2011 "lsdi",
2012 "lspi",
2013 "lvp0",
2014 "lvp1",
2015 "lvs",
2016};
2017
2018static const char * const emc_test0_dll_groups[] = {
2019 "kbca",
2020};
2021
2022static const char * const emc_test1_dll_groups[] = {
2023 "kbcc",
2024};
2025
2026static const char * const gmi_groups[] = {
2027 "ata",
2028 "atb",
2029 "atc",
2030 "atd",
2031 "ate",
2032 "dap1",
2033 "dap2",
2034 "dap4",
2035 "gma",
2036 "gmb",
2037 "gmc",
2038 "gmd",
2039 "gme",
2040 "gpu",
2041 "irrx",
2042 "irtx",
2043 "pta",
2044 "spia",
2045 "spib",
2046 "spic",
2047 "spid",
2048 "spie",
2049 "uca",
2050 "ucb",
2051};
2052
2053static const char * const gmi_int_groups[] = {
2054 "gmb",
2055};
2056
2057static const char * const hdmi_groups[] = {
2058 "hdint",
2059 "lpw0",
2060 "lpw2",
2061 "lsc1",
2062 "lsck",
2063 "lsda",
2064 "lspi",
2065 "pta",
2066};
2067
2068static const char * const i2cp_groups[] = {
2069 "i2cp",
2070};
2071
2072static const char * const i2c1_groups[] = {
2073 "rm",
2074 "spdi",
2075 "spdo",
2076 "spig",
2077 "spih",
2078};
2079
2080static const char * const i2c2_groups[] = {
2081 "ddc",
2082 "pta",
2083};
2084
2085static const char * const i2c3_groups[] = {
2086 "dtf",
2087};
2088
2089static const char * const ide_groups[] = {
2090 "ata",
2091 "atb",
2092 "atc",
2093 "atd",
2094 "ate",
2095 "gmb",
2096};
2097
2098static const char * const irda_groups[] = {
2099 "uad",
2100};
2101
2102static const char * const kbc_groups[] = {
2103 "kbca",
2104 "kbcb",
2105 "kbcc",
2106 "kbcd",
2107 "kbce",
2108 "kbcf",
2109};
2110
2111static const char * const mio_groups[] = {
2112 "kbcb",
2113 "kbcd",
2114 "kbcf",
2115};
2116
2117static const char * const mipi_hs_groups[] = {
2118 "uaa",
2119 "uab",
2120};
2121
2122static const char * const nand_groups[] = {
2123 "ata",
2124 "atb",
2125 "atc",
2126 "atd",
2127 "ate",
2128 "gmb",
2129 "gmd",
2130 "kbca",
2131 "kbcb",
2132 "kbcc",
2133 "kbcd",
2134 "kbce",
2135 "kbcf",
2136};
2137
2138static const char * const osc_groups[] = {
2139 "cdev1",
2140 "cdev2",
2141};
2142
2143static const char * const owr_groups[] = {
2144 "kbce",
2145 "owc",
2146 "uac",
2147};
2148
2149static const char * const pcie_groups[] = {
2150 "gpv",
2151 "slxa",
2152 "slxk",
2153};
2154
2155static const char * const plla_out_groups[] = {
2156 "cdev1",
2157};
2158
2159static const char * const pllc_out1_groups[] = {
2160 "csus",
2161};
2162
2163static const char * const pllm_out1_groups[] = {
2164 "cdev1",
2165};
2166
2167static const char * const pllp_out2_groups[] = {
2168 "csus",
2169};
2170
2171static const char * const pllp_out3_groups[] = {
2172 "csus",
2173};
2174
2175static const char * const pllp_out4_groups[] = {
2176 "cdev2",
2177};
2178
2179static const char * const pwm_groups[] = {
2180 "gpu",
2181 "sdb",
2182 "sdc",
2183 "sdd",
2184 "ucb",
2185};
2186
2187static const char * const pwr_intr_groups[] = {
2188 "pmc",
2189};
2190
2191static const char * const pwr_on_groups[] = {
2192 "pmc",
2193};
2194
2195static const char * const rsvd1_groups[] = {
2196 "dta",
2197 "dtb",
2198 "dtc",
2199 "dtd",
2200 "dte",
2201 "gmd",
2202 "gme",
2203};
2204
2205static const char * const rsvd2_groups[] = {
2206 "crtp",
2207 "dap1",
2208 "dap3",
2209 "dap4",
2210 "ddc",
2211 "dtb",
2212 "dtc",
2213 "dte",
2214 "dtf",
2215 "gpu7",
2216 "gpv",
2217 "hdint",
2218 "i2cp",
2219 "owc",
2220 "rm",
2221 "sdio1",
2222 "spdi",
2223 "spdo",
2224 "uac",
2225 "uca",
2226 "uda",
2227};
2228
2229static const char * const rsvd3_groups[] = {
2230 "crtp",
2231 "dap2",
2232 "dap3",
2233 "ddc",
2234 "gpu7",
2235 "gpv",
2236 "hdint",
2237 "i2cp",
2238 "ld17",
2239 "ldc",
2240 "ldi",
2241 "lhp0",
2242 "lhp1",
2243 "lhp2",
2244 "lm1",
2245 "lpp",
2246 "lpw1",
2247 "lvp0",
2248 "lvp1",
2249 "owc",
2250 "pmc",
2251 "rm",
2252 "uac",
2253};
2254
2255static const char * const rsvd4_groups[] = {
2256 "ata",
2257 "ate",
2258 "crtp",
2259 "dap3",
2260 "dap4",
2261 "ddc",
2262 "dta",
2263 "dtc",
2264 "dtd",
2265 "dtf",
2266 "gpu",
2267 "gpu7",
2268 "gpv",
2269 "hdint",
2270 "i2cp",
2271 "kbce",
2272 "lcsn",
2273 "ld0",
2274 "ld1",
2275 "ld2",
2276 "ld3",
2277 "ld4",
2278 "ld5",
2279 "ld6",
2280 "ld7",
2281 "ld8",
2282 "ld9",
2283 "ld10",
2284 "ld11",
2285 "ld12",
2286 "ld13",
2287 "ld14",
2288 "ld15",
2289 "ld16",
2290 "ld17",
2291 "ldc",
2292 "ldi",
2293 "lhp0",
2294 "lhp1",
2295 "lhp2",
2296 "lhs",
2297 "lm0",
2298 "lpp",
2299 "lpw1",
2300 "lsc0",
2301 "lsdi",
2302 "lvp0",
2303 "lvp1",
2304 "lvs",
2305 "owc",
2306 "pmc",
2307 "pta",
2308 "rm",
2309 "spif",
2310 "uac",
2311 "uca",
2312 "ucb",
2313};
2314
2315static const char * const rtck_groups[] = {
2316 "gpu7",
2317};
2318
2319static const char * const sdio1_groups[] = {
2320 "sdio1",
2321};
2322
2323static const char * const sdio2_groups[] = {
2324 "dap1",
2325 "dta",
2326 "dtd",
2327 "kbca",
2328 "kbcb",
2329 "kbcd",
2330 "spdi",
2331 "spdo",
2332};
2333
2334static const char * const sdio3_groups[] = {
2335 "sdb",
2336 "sdc",
2337 "sdd",
2338 "slxa",
2339 "slxc",
2340 "slxd",
2341 "slxk",
2342};
2343
2344static const char * const sdio4_groups[] = {
2345 "atb",
2346 "atc",
2347 "atd",
2348 "gma",
2349 "gme",
2350};
2351
2352static const char * const sflash_groups[] = {
2353 "gmc",
2354 "gmd",
2355};
2356
2357static const char * const spdif_groups[] = {
2358 "slxc",
2359 "slxd",
2360 "spdi",
2361 "spdo",
2362 "uad",
2363};
2364
2365static const char * const spi1_groups[] = {
2366 "dtb",
2367 "dte",
2368 "spia",
2369 "spib",
2370 "spic",
2371 "spid",
2372 "spie",
2373 "spif",
2374 "uda",
2375};
2376
2377static const char * const spi2_groups[] = {
2378 "sdb",
2379 "slxa",
2380 "slxc",
2381 "slxd",
2382 "slxk",
2383 "spia",
2384 "spib",
2385 "spic",
2386 "spid",
2387 "spie",
2388 "spif",
2389 "spig",
2390 "spih",
2391 "uab",
2392};
2393
2394static const char * const spi2_alt_groups[] = {
2395 "spid",
2396 "spie",
2397 "spig",
2398 "spih",
2399};
2400
2401static const char * const spi3_groups[] = {
2402 "gma",
2403 "lcsn",
2404 "lm0",
2405 "lpw0",
2406 "lpw2",
2407 "lsc1",
2408 "lsck",
2409 "lsda",
2410 "lsdi",
2411 "sdc",
2412 "sdd",
2413 "spia",
2414 "spib",
2415 "spic",
2416 "spif",
2417 "spig",
2418 "spih",
2419 "uaa",
2420};
2421
2422static const char * const spi4_groups[] = {
2423 "gmc",
2424 "irrx",
2425 "irtx",
2426 "slxa",
2427 "slxc",
2428 "slxd",
2429 "slxk",
2430 "uad",
2431};
2432
2433static const char * const trace_groups[] = {
2434 "kbcc",
2435 "kbcf",
2436};
2437
2438static const char * const twc_groups[] = {
2439 "dap2",
2440 "sdc",
2441};
2442
2443static const char * const uarta_groups[] = {
2444 "gpu",
2445 "irrx",
2446 "irtx",
2447 "sdb",
2448 "sdd",
2449 "sdio1",
2450 "uaa",
2451 "uab",
2452 "uad",
2453};
2454
2455static const char * const uartb_groups[] = {
2456 "irrx",
2457 "irtx",
2458};
2459
2460static const char * const uartc_groups[] = {
2461 "uca",
2462 "ucb",
2463};
2464
2465static const char * const uartd_groups[] = {
2466 "gmc",
2467 "uda",
2468};
2469
2470static const char * const uarte_groups[] = {
2471 "gma",
2472 "sdio1",
2473};
2474
2475static const char * const ulpi_groups[] = {
2476 "uaa",
2477 "uab",
2478 "uda",
2479};
2480
2481static const char * const vi_groups[] = {
2482 "dta",
2483 "dtb",
2484 "dtc",
2485 "dtd",
2486 "dte",
2487 "dtf",
2488};
2489
2490static const char * const vi_sensor_clk_groups[] = {
2491 "csus",
2492};
2493
2494static const char * const xio_groups[] = {
2495 "ld0",
2496 "ld1",
2497 "ld10",
2498 "ld11",
2499 "ld12",
2500 "ld13",
2501 "ld14",
2502 "ld15",
2503 "ld16",
2504 "ld2",
2505 "ld3",
2506 "ld4",
2507 "ld5",
2508 "ld6",
2509 "ld7",
2510 "ld8",
2511 "ld9",
2512 "lhs",
2513 "lsc0",
2514 "lspi",
2515 "lvs",
2516};
2517
2518#define FUNCTION(fname) \
2519 { \
2520 .name = #fname, \
2521 .groups = fname##_groups, \
2522 .ngroups = ARRAY_SIZE(fname##_groups), \
2523 }
2524
2525static const struct tegra_function tegra20_functions[] = {
2526 FUNCTION(ahb_clk),
2527 FUNCTION(apb_clk),
2528 FUNCTION(audio_sync),
2529 FUNCTION(crt),
2530 FUNCTION(dap1),
2531 FUNCTION(dap2),
2532 FUNCTION(dap3),
2533 FUNCTION(dap4),
2534 FUNCTION(dap5),
2535 FUNCTION(displaya),
2536 FUNCTION(displayb),
2537 FUNCTION(emc_test0_dll),
2538 FUNCTION(emc_test1_dll),
2539 FUNCTION(gmi),
2540 FUNCTION(gmi_int),
2541 FUNCTION(hdmi),
2542 FUNCTION(i2cp),
2543 FUNCTION(i2c1),
2544 FUNCTION(i2c2),
2545 FUNCTION(i2c3),
2546 FUNCTION(ide),
2547 FUNCTION(irda),
2548 FUNCTION(kbc),
2549 FUNCTION(mio),
2550 FUNCTION(mipi_hs),
2551 FUNCTION(nand),
2552 FUNCTION(osc),
2553 FUNCTION(owr),
2554 FUNCTION(pcie),
2555 FUNCTION(plla_out),
2556 FUNCTION(pllc_out1),
2557 FUNCTION(pllm_out1),
2558 FUNCTION(pllp_out2),
2559 FUNCTION(pllp_out3),
2560 FUNCTION(pllp_out4),
2561 FUNCTION(pwm),
2562 FUNCTION(pwr_intr),
2563 FUNCTION(pwr_on),
2564 FUNCTION(rsvd1),
2565 FUNCTION(rsvd2),
2566 FUNCTION(rsvd3),
2567 FUNCTION(rsvd4),
2568 FUNCTION(rtck),
2569 FUNCTION(sdio1),
2570 FUNCTION(sdio2),
2571 FUNCTION(sdio3),
2572 FUNCTION(sdio4),
2573 FUNCTION(sflash),
2574 FUNCTION(spdif),
2575 FUNCTION(spi1),
2576 FUNCTION(spi2),
2577 FUNCTION(spi2_alt),
2578 FUNCTION(spi3),
2579 FUNCTION(spi4),
2580 FUNCTION(trace),
2581 FUNCTION(twc),
2582 FUNCTION(uarta),
2583 FUNCTION(uartb),
2584 FUNCTION(uartc),
2585 FUNCTION(uartd),
2586 FUNCTION(uarte),
2587 FUNCTION(ulpi),
2588 FUNCTION(vi),
2589 FUNCTION(vi_sensor_clk),
2590 FUNCTION(xio),
2591};
2592
2593#define TRISTATE_REG_A 0x14
2594#define PIN_MUX_CTL_REG_A 0x80
2595#define PULLUPDOWN_REG_A 0xa0
2596#define PINGROUP_REG_A 0x868
2597
2598/* Pin group with mux control, and typically tri-state and pull-up/down too */
2599#define MUX_PG(pg_name, f0, f1, f2, f3, f_safe, \
2600 tri_r, tri_b, mux_r, mux_b, pupd_r, pupd_b) \
2601 { \
2602 .name = #pg_name, \
2603 .pins = pg_name##_pins, \
2604 .npins = ARRAY_SIZE(pg_name##_pins), \
2605 .funcs = { \
2606 TEGRA_MUX_ ## f0, \
2607 TEGRA_MUX_ ## f1, \
2608 TEGRA_MUX_ ## f2, \
2609 TEGRA_MUX_ ## f3, \
2610 }, \
2611 .func_safe = TEGRA_MUX_ ## f_safe, \
2612 .mux_reg = ((mux_r) - PIN_MUX_CTL_REG_A), \
2613 .mux_bank = 1, \
2614 .mux_bit = mux_b, \
2615 .pupd_reg = ((pupd_r) - PULLUPDOWN_REG_A), \
2616 .pupd_bank = 2, \
2617 .pupd_bit = pupd_b, \
2618 .tri_reg = ((tri_r) - TRISTATE_REG_A), \
2619 .tri_bank = 0, \
2620 .tri_bit = tri_b, \
2621 .einput_reg = -1, \
2622 .odrain_reg = -1, \
2623 .lock_reg = -1, \
2624 .ioreset_reg = -1, \
2625 .drv_reg = -1, \
2626 }
2627
2628/* Pin groups with only pull up and pull down control */
2629#define PULL_PG(pg_name, pupd_r, pupd_b) \
2630 { \
2631 .name = #pg_name, \
2632 .pins = pg_name##_pins, \
2633 .npins = ARRAY_SIZE(pg_name##_pins), \
2634 .mux_reg = -1, \
2635 .pupd_reg = ((pupd_r) - PULLUPDOWN_REG_A), \
2636 .pupd_bank = 2, \
2637 .pupd_bit = pupd_b, \
2638 .tri_reg = -1, \
2639 .einput_reg = -1, \
2640 .odrain_reg = -1, \
2641 .lock_reg = -1, \
2642 .ioreset_reg = -1, \
2643 .drv_reg = -1, \
2644 }
2645
2646/* Pin groups for drive strength registers (configurable version) */
2647#define DRV_PG_EXT(pg_name, r, hsm_b, schmitt_b, lpmd_b, \
2648 drvdn_b, drvup_b, \
2649 slwr_b, slwr_w, slwf_b, slwf_w) \
2650 { \
2651 .name = "drive_" #pg_name, \
2652 .pins = drive_##pg_name##_pins, \
2653 .npins = ARRAY_SIZE(drive_##pg_name##_pins), \
2654 .mux_reg = -1, \
2655 .pupd_reg = -1, \
2656 .tri_reg = -1, \
2657 .einput_reg = -1, \
2658 .odrain_reg = -1, \
2659 .lock_reg = -1, \
2660 .ioreset_reg = -1, \
2661 .drv_reg = ((r) - PINGROUP_REG_A), \
2662 .drv_bank = 3, \
2663 .hsm_bit = hsm_b, \
2664 .schmitt_bit = schmitt_b, \
2665 .lpmd_bit = lpmd_b, \
2666 .drvdn_bit = drvdn_b, \
2667 .drvdn_width = 5, \
2668 .drvup_bit = drvup_b, \
2669 .drvup_width = 5, \
2670 .slwr_bit = slwr_b, \
2671 .slwr_width = slwr_w, \
2672 .slwf_bit = slwf_b, \
2673 .slwf_width = slwf_w, \
2674 }
2675
2676/* Pin groups for drive strength registers (simple version) */
2677#define DRV_PG(pg_name, r) \
2678 DRV_PG_EXT(pg_name, r, 2, 3, 4, 12, 20, 28, 2, 30, 2)
2679
2680static const struct tegra_pingroup tegra20_groups[] = {
2681 /* name, f0, f1, f2, f3, f_safe, tri r/b, mux r/b, pupd r/b */
2682 MUX_PG(ata, IDE, NAND, GMI, RSVD4, IDE, 0x14, 0, 0x80, 24, 0xa0, 0),
2683 MUX_PG(atb, IDE, NAND, GMI, SDIO4, IDE, 0x14, 1, 0x80, 16, 0xa0, 2),
2684 MUX_PG(atc, IDE, NAND, GMI, SDIO4, IDE, 0x14, 2, 0x80, 22, 0xa0, 4),
2685 MUX_PG(atd, IDE, NAND, GMI, SDIO4, IDE, 0x14, 3, 0x80, 20, 0xa0, 6),
2686 MUX_PG(ate, IDE, NAND, GMI, RSVD4, IDE, 0x18, 25, 0x80, 12, 0xa0, 8),
2687 MUX_PG(cdev1, OSC, PLLA_OUT, PLLM_OUT1, AUDIO_SYNC, OSC, 0x14, 4, 0x88, 2, 0xa8, 0),
2688 MUX_PG(cdev2, OSC, AHB_CLK, APB_CLK, PLLP_OUT4, OSC, 0x14, 5, 0x88, 4, 0xa8, 2),
2689 MUX_PG(crtp, CRT, RSVD2, RSVD3, RSVD4, RSVD2, 0x20, 14, 0x98, 20, 0xa4, 24),
2690 MUX_PG(csus, PLLC_OUT1, PLLP_OUT2, PLLP_OUT3, VI_SENSOR_CLK, PLLC_OUT1, 0x14, 6, 0x88, 6, 0xac, 24),
2691 MUX_PG(dap1, DAP1, RSVD2, GMI, SDIO2, DAP1, 0x14, 7, 0x88, 20, 0xa0, 10),
2692 MUX_PG(dap2, DAP2, TWC, RSVD3, GMI, DAP2, 0x14, 8, 0x88, 22, 0xa0, 12),
2693 MUX_PG(dap3, DAP3, RSVD2, RSVD3, RSVD4, DAP3, 0x14, 9, 0x88, 24, 0xa0, 14),
2694 MUX_PG(dap4, DAP4, RSVD2, GMI, RSVD4, DAP4, 0x14, 10, 0x88, 26, 0xa0, 16),
2695 MUX_PG(ddc, I2C2, RSVD2, RSVD3, RSVD4, RSVD4, 0x18, 31, 0x88, 0, 0xb0, 28),
2696 MUX_PG(dta, RSVD1, SDIO2, VI, RSVD4, RSVD4, 0x14, 11, 0x84, 20, 0xa0, 18),
2697 MUX_PG(dtb, RSVD1, RSVD2, VI, SPI1, RSVD1, 0x14, 12, 0x84, 22, 0xa0, 20),
2698 MUX_PG(dtc, RSVD1, RSVD2, VI, RSVD4, RSVD1, 0x14, 13, 0x84, 26, 0xa0, 22),
2699 MUX_PG(dtd, RSVD1, SDIO2, VI, RSVD4, RSVD1, 0x14, 14, 0x84, 28, 0xa0, 24),
2700 MUX_PG(dte, RSVD1, RSVD2, VI, SPI1, RSVD1, 0x14, 15, 0x84, 30, 0xa0, 26),
2701 MUX_PG(dtf, I2C3, RSVD2, VI, RSVD4, RSVD4, 0x20, 12, 0x98, 30, 0xa0, 28),
2702 MUX_PG(gma, UARTE, SPI3, GMI, SDIO4, SPI3, 0x14, 28, 0x84, 0, 0xb0, 20),
2703 MUX_PG(gmb, IDE, NAND, GMI, GMI_INT, GMI, 0x18, 29, 0x88, 28, 0xb0, 22),
2704 MUX_PG(gmc, UARTD, SPI4, GMI, SFLASH, SPI4, 0x14, 29, 0x84, 2, 0xb0, 24),
2705 MUX_PG(gmd, RSVD1, NAND, GMI, SFLASH, GMI, 0x18, 30, 0x88, 30, 0xb0, 26),
2706 MUX_PG(gme, RSVD1, DAP5, GMI, SDIO4, GMI, 0x18, 0, 0x8c, 0, 0xa8, 24),
2707 MUX_PG(gpu, PWM, UARTA, GMI, RSVD4, RSVD4, 0x14, 16, 0x8c, 4, 0xa4, 20),
2708 MUX_PG(gpu7, RTCK, RSVD2, RSVD3, RSVD4, RTCK, 0x20, 11, 0x98, 28, 0xa4, 6),
2709 MUX_PG(gpv, PCIE, RSVD2, RSVD3, RSVD4, PCIE, 0x14, 17, 0x8c, 2, 0xa0, 30),
2710 MUX_PG(hdint, HDMI, RSVD2, RSVD3, RSVD4, HDMI, 0x1c, 23, 0x84, 4, -1, -1),
2711 MUX_PG(i2cp, I2CP, RSVD2, RSVD3, RSVD4, RSVD4, 0x14, 18, 0x88, 8, 0xa4, 2),
2712 MUX_PG(irrx, UARTA, UARTB, GMI, SPI4, UARTB, 0x14, 20, 0x88, 18, 0xa8, 22),
2713 MUX_PG(irtx, UARTA, UARTB, GMI, SPI4, UARTB, 0x14, 19, 0x88, 16, 0xa8, 20),
2714 MUX_PG(kbca, KBC, NAND, SDIO2, EMC_TEST0_DLL, KBC, 0x14, 22, 0x88, 10, 0xa4, 8),
2715 MUX_PG(kbcb, KBC, NAND, SDIO2, MIO, KBC, 0x14, 21, 0x88, 12, 0xa4, 10),
2716 MUX_PG(kbcc, KBC, NAND, TRACE, EMC_TEST1_DLL, KBC, 0x18, 26, 0x88, 14, 0xa4, 12),
2717 MUX_PG(kbcd, KBC, NAND, SDIO2, MIO, KBC, 0x20, 10, 0x98, 26, 0xa4, 14),
2718 MUX_PG(kbce, KBC, NAND, OWR, RSVD4, KBC, 0x14, 26, 0x80, 28, 0xb0, 2),
2719 MUX_PG(kbcf, KBC, NAND, TRACE, MIO, KBC, 0x14, 27, 0x80, 26, 0xb0, 0),
2720 MUX_PG(lcsn, DISPLAYA, DISPLAYB, SPI3, RSVD4, RSVD4, 0x1c, 31, 0x90, 12, -1, -1),
2721 MUX_PG(ld0, DISPLAYA, DISPLAYB, XIO, RSVD4, RSVD4, 0x1c, 0, 0x94, 0, -1, -1),
2722 MUX_PG(ld1, DISPLAYA, DISPLAYB, XIO, RSVD4, RSVD4, 0x1c, 1, 0x94, 2, -1, -1),
2723 MUX_PG(ld2, DISPLAYA, DISPLAYB, XIO, RSVD4, RSVD4, 0x1c, 2, 0x94, 4, -1, -1),
2724 MUX_PG(ld3, DISPLAYA, DISPLAYB, XIO, RSVD4, RSVD4, 0x1c, 3, 0x94, 6, -1, -1),
2725 MUX_PG(ld4, DISPLAYA, DISPLAYB, XIO, RSVD4, RSVD4, 0x1c, 4, 0x94, 8, -1, -1),
2726 MUX_PG(ld5, DISPLAYA, DISPLAYB, XIO, RSVD4, RSVD4, 0x1c, 5, 0x94, 10, -1, -1),
2727 MUX_PG(ld6, DISPLAYA, DISPLAYB, XIO, RSVD4, RSVD4, 0x1c, 6, 0x94, 12, -1, -1),
2728 MUX_PG(ld7, DISPLAYA, DISPLAYB, XIO, RSVD4, RSVD4, 0x1c, 7, 0x94, 14, -1, -1),
2729 MUX_PG(ld8, DISPLAYA, DISPLAYB, XIO, RSVD4, RSVD4, 0x1c, 8, 0x94, 16, -1, -1),
2730 MUX_PG(ld9, DISPLAYA, DISPLAYB, XIO, RSVD4, RSVD4, 0x1c, 9, 0x94, 18, -1, -1),
2731 MUX_PG(ld10, DISPLAYA, DISPLAYB, XIO, RSVD4, RSVD4, 0x1c, 10, 0x94, 20, -1, -1),
2732 MUX_PG(ld11, DISPLAYA, DISPLAYB, XIO, RSVD4, RSVD4, 0x1c, 11, 0x94, 22, -1, -1),
2733 MUX_PG(ld12, DISPLAYA, DISPLAYB, XIO, RSVD4, RSVD4, 0x1c, 12, 0x94, 24, -1, -1),
2734 MUX_PG(ld13, DISPLAYA, DISPLAYB, XIO, RSVD4, RSVD4, 0x1c, 13, 0x94, 26, -1, -1),
2735 MUX_PG(ld14, DISPLAYA, DISPLAYB, XIO, RSVD4, RSVD4, 0x1c, 14, 0x94, 28, -1, -1),
2736 MUX_PG(ld15, DISPLAYA, DISPLAYB, XIO, RSVD4, RSVD4, 0x1c, 15, 0x94, 30, -1, -1),
2737 MUX_PG(ld16, DISPLAYA, DISPLAYB, XIO, RSVD4, RSVD4, 0x1c, 16, 0x98, 0, -1, -1),
2738 MUX_PG(ld17, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x1c, 17, 0x98, 2, -1, -1),
2739 MUX_PG(ldc, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x1c, 30, 0x90, 14, -1, -1),
2740 MUX_PG(ldi, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x20, 6, 0x98, 16, -1, -1),
2741 MUX_PG(lhp0, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x1c, 18, 0x98, 10, -1, -1),
2742 MUX_PG(lhp1, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x1c, 19, 0x98, 4, -1, -1),
2743 MUX_PG(lhp2, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x1c, 20, 0x98, 6, -1, -1),
2744 MUX_PG(lhs, DISPLAYA, DISPLAYB, XIO, RSVD4, RSVD4, 0x20, 7, 0x90, 22, -1, -1),
2745 MUX_PG(lm0, DISPLAYA, DISPLAYB, SPI3, RSVD4, RSVD4, 0x1c, 24, 0x90, 26, -1, -1),
2746 MUX_PG(lm1, DISPLAYA, DISPLAYB, RSVD3, CRT, RSVD3, 0x1c, 25, 0x90, 28, -1, -1),
2747 MUX_PG(lpp, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x20, 8, 0x98, 14, -1, -1),
2748 MUX_PG(lpw0, DISPLAYA, DISPLAYB, SPI3, HDMI, DISPLAYA, 0x20, 3, 0x90, 0, -1, -1),
2749 MUX_PG(lpw1, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x20, 4, 0x90, 2, -1, -1),
2750 MUX_PG(lpw2, DISPLAYA, DISPLAYB, SPI3, HDMI, DISPLAYA, 0x20, 5, 0x90, 4, -1, -1),
2751 MUX_PG(lsc0, DISPLAYA, DISPLAYB, XIO, RSVD4, RSVD4, 0x1c, 27, 0x90, 18, -1, -1),
2752 MUX_PG(lsc1, DISPLAYA, DISPLAYB, SPI3, HDMI, DISPLAYA, 0x1c, 28, 0x90, 20, -1, -1),
2753 MUX_PG(lsck, DISPLAYA, DISPLAYB, SPI3, HDMI, DISPLAYA, 0x1c, 29, 0x90, 16, -1, -1),
2754 MUX_PG(lsda, DISPLAYA, DISPLAYB, SPI3, HDMI, DISPLAYA, 0x20, 1, 0x90, 8, -1, -1),
2755 MUX_PG(lsdi, DISPLAYA, DISPLAYB, SPI3, RSVD4, DISPLAYA, 0x20, 2, 0x90, 6, -1, -1),
2756 MUX_PG(lspi, DISPLAYA, DISPLAYB, XIO, HDMI, DISPLAYA, 0x20, 0, 0x90, 10, -1, -1),
2757 MUX_PG(lvp0, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x1c, 21, 0x90, 30, -1, -1),
2758 MUX_PG(lvp1, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x1c, 22, 0x98, 8, -1, -1),
2759 MUX_PG(lvs, DISPLAYA, DISPLAYB, XIO, RSVD4, RSVD4, 0x1c, 26, 0x90, 24, -1, -1),
2760 MUX_PG(owc, OWR, RSVD2, RSVD3, RSVD4, OWR, 0x14, 31, 0x84, 8, 0xb0, 30),
2761 MUX_PG(pmc, PWR_ON, PWR_INTR, RSVD3, RSVD4, PWR_ON, 0x14, 23, 0x98, 18, -1, -1),
2762 MUX_PG(pta, I2C2, HDMI, GMI, RSVD4, RSVD4, 0x14, 24, 0x98, 22, 0xa4, 4),
2763 MUX_PG(rm, I2C1, RSVD2, RSVD3, RSVD4, RSVD4, 0x14, 25, 0x80, 14, 0xa4, 0),
2764 MUX_PG(sdb, UARTA, PWM, SDIO3, SPI2, PWM, 0x20, 15, 0x8c, 10, -1, -1),
2765 MUX_PG(sdc, PWM, TWC, SDIO3, SPI3, TWC, 0x18, 1, 0x8c, 12, 0xac, 28),
2766 MUX_PG(sdd, UARTA, PWM, SDIO3, SPI3, PWM, 0x18, 2, 0x8c, 14, 0xac, 30),
2767 MUX_PG(sdio1, SDIO1, RSVD2, UARTE, UARTA, RSVD2, 0x14, 30, 0x80, 30, 0xb0, 18),
2768 MUX_PG(slxa, PCIE, SPI4, SDIO3, SPI2, PCIE, 0x18, 3, 0x84, 6, 0xa4, 22),
2769 MUX_PG(slxc, SPDIF, SPI4, SDIO3, SPI2, SPI4, 0x18, 5, 0x84, 10, 0xa4, 26),
2770 MUX_PG(slxd, SPDIF, SPI4, SDIO3, SPI2, SPI4, 0x18, 6, 0x84, 12, 0xa4, 28),
2771 MUX_PG(slxk, PCIE, SPI4, SDIO3, SPI2, PCIE, 0x18, 7, 0x84, 14, 0xa4, 30),
2772 MUX_PG(spdi, SPDIF, RSVD2, I2C1, SDIO2, RSVD2, 0x18, 8, 0x8c, 8, 0xa4, 16),
2773 MUX_PG(spdo, SPDIF, RSVD2, I2C1, SDIO2, RSVD2, 0x18, 9, 0x8c, 6, 0xa4, 18),
2774 MUX_PG(spia, SPI1, SPI2, SPI3, GMI, GMI, 0x18, 10, 0x8c, 30, 0xa8, 4),
2775 MUX_PG(spib, SPI1, SPI2, SPI3, GMI, GMI, 0x18, 11, 0x8c, 28, 0xa8, 6),
2776 MUX_PG(spic, SPI1, SPI2, SPI3, GMI, GMI, 0x18, 12, 0x8c, 26, 0xa8, 8),
2777 MUX_PG(spid, SPI2, SPI1, SPI2_ALT, GMI, GMI, 0x18, 13, 0x8c, 24, 0xa8, 10),
2778 MUX_PG(spie, SPI2, SPI1, SPI2_ALT, GMI, GMI, 0x18, 14, 0x8c, 22, 0xa8, 12),
2779 MUX_PG(spif, SPI3, SPI1, SPI2, RSVD4, RSVD4, 0x18, 15, 0x8c, 20, 0xa8, 14),
2780 MUX_PG(spig, SPI3, SPI2, SPI2_ALT, I2C1, SPI2_ALT, 0x18, 16, 0x8c, 18, 0xa8, 16),
2781 MUX_PG(spih, SPI3, SPI2, SPI2_ALT, I2C1, SPI2_ALT, 0x18, 17, 0x8c, 16, 0xa8, 18),
2782 MUX_PG(uaa, SPI3, MIPI_HS, UARTA, ULPI, MIPI_HS, 0x18, 18, 0x80, 0, 0xac, 0),
2783 MUX_PG(uab, SPI2, MIPI_HS, UARTA, ULPI, MIPI_HS, 0x18, 19, 0x80, 2, 0xac, 2),
2784 MUX_PG(uac, OWR, RSVD2, RSVD3, RSVD4, RSVD4, 0x18, 20, 0x80, 4, 0xac, 4),
2785 MUX_PG(uad, IRDA, SPDIF, UARTA, SPI4, SPDIF, 0x18, 21, 0x80, 6, 0xac, 6),
2786 MUX_PG(uca, UARTC, RSVD2, GMI, RSVD4, RSVD4, 0x18, 22, 0x84, 16, 0xac, 8),
2787 MUX_PG(ucb, UARTC, PWM, GMI, RSVD4, RSVD4, 0x18, 23, 0x84, 18, 0xac, 10),
2788 MUX_PG(uda, SPI1, RSVD2, UARTD, ULPI, RSVD2, 0x20, 13, 0x80, 8, 0xb0, 16),
2789 /* pg_name, pupd_r/b */
2790 PULL_PG(ck32, 0xb0, 14),
2791 PULL_PG(ddrc, 0xac, 26),
2792 PULL_PG(pmca, 0xb0, 4),
2793 PULL_PG(pmcb, 0xb0, 6),
2794 PULL_PG(pmcc, 0xb0, 8),
2795 PULL_PG(pmcd, 0xb0, 10),
2796 PULL_PG(pmce, 0xb0, 12),
2797 PULL_PG(xm2c, 0xa8, 30),
2798 PULL_PG(xm2d, 0xa8, 28),
2799 PULL_PG(ls, 0xac, 20),
2800 PULL_PG(lc, 0xac, 22),
2801 PULL_PG(ld17_0, 0xac, 12),
2802 PULL_PG(ld19_18, 0xac, 14),
2803 PULL_PG(ld21_20, 0xac, 16),
2804 PULL_PG(ld23_22, 0xac, 18),
2805 /* pg_name, r */
2806 DRV_PG(ao1, 0x868),
2807 DRV_PG(ao2, 0x86c),
2808 DRV_PG(at1, 0x870),
2809 DRV_PG(at2, 0x874),
2810 DRV_PG(cdev1, 0x878),
2811 DRV_PG(cdev2, 0x87c),
2812 DRV_PG(csus, 0x880),
2813 DRV_PG(dap1, 0x884),
2814 DRV_PG(dap2, 0x888),
2815 DRV_PG(dap3, 0x88c),
2816 DRV_PG(dap4, 0x890),
2817 DRV_PG(dbg, 0x894),
2818 DRV_PG(lcd1, 0x898),
2819 DRV_PG(lcd2, 0x89c),
2820 DRV_PG(sdmmc2, 0x8a0),
2821 DRV_PG(sdmmc3, 0x8a4),
2822 DRV_PG(spi, 0x8a8),
2823 DRV_PG(uaa, 0x8ac),
2824 DRV_PG(uab, 0x8b0),
2825 DRV_PG(uart2, 0x8b4),
2826 DRV_PG(uart3, 0x8b8),
2827 DRV_PG(vi1, 0x8bc),
2828 DRV_PG(vi2, 0x8c0),
2829 /* pg_name, r, hsm_b, schmitt_b, lpmd_b, drvdn_b, drvup_b, slwr_b, slwr_w, slwf_b, slwf_w */
2830 DRV_PG_EXT(xm2a, 0x8c4, -1, -1, 4, 14, 19, 24, 4, 28, 4),
2831 DRV_PG_EXT(xm2c, 0x8c8, -1, 3, -1, 14, 19, 24, 4, 28, 4),
2832 DRV_PG_EXT(xm2d, 0x8cc, -1, 3, -1, 14, 19, 24, 4, 28, 4),
2833 DRV_PG_EXT(xm2clk, 0x8d0, -1, -1, -1, 14, 19, 24, 4, 28, 4),
2834 /* pg_name, r */
2835 DRV_PG(sdio1, 0x8e0),
2836 DRV_PG(crt, 0x8ec),
2837 DRV_PG(ddc, 0x8f0),
2838 DRV_PG(gma, 0x8f4),
2839 DRV_PG(gmb, 0x8f8),
2840 DRV_PG(gmc, 0x8fc),
2841 DRV_PG(gmd, 0x900),
2842 DRV_PG(gme, 0x904),
2843 DRV_PG(owr, 0x908),
2844 DRV_PG(uda, 0x90c),
2845};
2846
2847static const struct tegra_pinctrl_soc_data tegra20_pinctrl = {
2848 .ngpios = NUM_GPIOS,
2849 .pins = tegra20_pins,
2850 .npins = ARRAY_SIZE(tegra20_pins),
2851 .functions = tegra20_functions,
2852 .nfunctions = ARRAY_SIZE(tegra20_functions),
2853 .groups = tegra20_groups,
2854 .ngroups = ARRAY_SIZE(tegra20_groups),
2855};
2856
2857void __devinit tegra20_pinctrl_init(const struct tegra_pinctrl_soc_data **soc)
2858{
2859 *soc = &tegra20_pinctrl;
2860}
diff --git a/drivers/pinctrl/pinctrl-tegra30.c b/drivers/pinctrl/pinctrl-tegra30.c
new file mode 100644
index 000000000000..4d7571d4a431
--- /dev/null
+++ b/drivers/pinctrl/pinctrl-tegra30.c
@@ -0,0 +1,3726 @@
1/*
2 * Pinctrl data for the NVIDIA Tegra30 pinmux
3 *
4 * Copyright (c) 2011, NVIDIA CORPORATION. All rights reserved.
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms and conditions of the GNU General Public License,
8 * version 2, as published by the Free Software Foundation.
9 *
10 * This program is distributed in the hope it will be useful, but WITHOUT
11 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
13 * more details.
14 */
15
16#include <linux/platform_device.h>
17#include <linux/pinctrl/pinctrl.h>
18#include <linux/pinctrl/pinmux.h>
19
20#include "pinctrl-tegra.h"
21
22/*
23 * Most pins affected by the pinmux can also be GPIOs. Define these first.
24 * These must match how the GPIO driver names/numbers its pins.
25 */
26#define _GPIO(offset) (offset)
27
28#define TEGRA_PIN_CLK_32K_OUT_PA0 _GPIO(0)
29#define TEGRA_PIN_UART3_CTS_N_PA1 _GPIO(1)
30#define TEGRA_PIN_DAP2_FS_PA2 _GPIO(2)
31#define TEGRA_PIN_DAP2_SCLK_PA3 _GPIO(3)
32#define TEGRA_PIN_DAP2_DIN_PA4 _GPIO(4)
33#define TEGRA_PIN_DAP2_DOUT_PA5 _GPIO(5)
34#define TEGRA_PIN_SDMMC3_CLK_PA6 _GPIO(6)
35#define TEGRA_PIN_SDMMC3_CMD_PA7 _GPIO(7)
36#define TEGRA_PIN_GMI_A17_PB0 _GPIO(8)
37#define TEGRA_PIN_GMI_A18_PB1 _GPIO(9)
38#define TEGRA_PIN_LCD_PWR0_PB2 _GPIO(10)
39#define TEGRA_PIN_LCD_PCLK_PB3 _GPIO(11)
40#define TEGRA_PIN_SDMMC3_DAT3_PB4 _GPIO(12)
41#define TEGRA_PIN_SDMMC3_DAT2_PB5 _GPIO(13)
42#define TEGRA_PIN_SDMMC3_DAT1_PB6 _GPIO(14)
43#define TEGRA_PIN_SDMMC3_DAT0_PB7 _GPIO(15)
44#define TEGRA_PIN_UART3_RTS_N_PC0 _GPIO(16)
45#define TEGRA_PIN_LCD_PWR1_PC1 _GPIO(17)
46#define TEGRA_PIN_UART2_TXD_PC2 _GPIO(18)
47#define TEGRA_PIN_UART2_RXD_PC3 _GPIO(19)
48#define TEGRA_PIN_GEN1_I2C_SCL_PC4 _GPIO(20)
49#define TEGRA_PIN_GEN1_I2C_SDA_PC5 _GPIO(21)
50#define TEGRA_PIN_LCD_PWR2_PC6 _GPIO(22)
51#define TEGRA_PIN_GMI_WP_N_PC7 _GPIO(23)
52#define TEGRA_PIN_SDMMC3_DAT5_PD0 _GPIO(24)
53#define TEGRA_PIN_SDMMC3_DAT4_PD1 _GPIO(25)
54#define TEGRA_PIN_LCD_DC1_PD2 _GPIO(26)
55#define TEGRA_PIN_SDMMC3_DAT6_PD3 _GPIO(27)
56#define TEGRA_PIN_SDMMC3_DAT7_PD4 _GPIO(28)
57#define TEGRA_PIN_VI_D1_PD5 _GPIO(29)
58#define TEGRA_PIN_VI_VSYNC_PD6 _GPIO(30)
59#define TEGRA_PIN_VI_HSYNC_PD7 _GPIO(31)
60#define TEGRA_PIN_LCD_D0_PE0 _GPIO(32)
61#define TEGRA_PIN_LCD_D1_PE1 _GPIO(33)
62#define TEGRA_PIN_LCD_D2_PE2 _GPIO(34)
63#define TEGRA_PIN_LCD_D3_PE3 _GPIO(35)
64#define TEGRA_PIN_LCD_D4_PE4 _GPIO(36)
65#define TEGRA_PIN_LCD_D5_PE5 _GPIO(37)
66#define TEGRA_PIN_LCD_D6_PE6 _GPIO(38)
67#define TEGRA_PIN_LCD_D7_PE7 _GPIO(39)
68#define TEGRA_PIN_LCD_D8_PF0 _GPIO(40)
69#define TEGRA_PIN_LCD_D9_PF1 _GPIO(41)
70#define TEGRA_PIN_LCD_D10_PF2 _GPIO(42)
71#define TEGRA_PIN_LCD_D11_PF3 _GPIO(43)
72#define TEGRA_PIN_LCD_D12_PF4 _GPIO(44)
73#define TEGRA_PIN_LCD_D13_PF5 _GPIO(45)
74#define TEGRA_PIN_LCD_D14_PF6 _GPIO(46)
75#define TEGRA_PIN_LCD_D15_PF7 _GPIO(47)
76#define TEGRA_PIN_GMI_AD0_PG0 _GPIO(48)
77#define TEGRA_PIN_GMI_AD1_PG1 _GPIO(49)
78#define TEGRA_PIN_GMI_AD2_PG2 _GPIO(50)
79#define TEGRA_PIN_GMI_AD3_PG3 _GPIO(51)
80#define TEGRA_PIN_GMI_AD4_PG4 _GPIO(52)
81#define TEGRA_PIN_GMI_AD5_PG5 _GPIO(53)
82#define TEGRA_PIN_GMI_AD6_PG6 _GPIO(54)
83#define TEGRA_PIN_GMI_AD7_PG7 _GPIO(55)
84#define TEGRA_PIN_GMI_AD8_PH0 _GPIO(56)
85#define TEGRA_PIN_GMI_AD9_PH1 _GPIO(57)
86#define TEGRA_PIN_GMI_AD10_PH2 _GPIO(58)
87#define TEGRA_PIN_GMI_AD11_PH3 _GPIO(59)
88#define TEGRA_PIN_GMI_AD12_PH4 _GPIO(60)
89#define TEGRA_PIN_GMI_AD13_PH5 _GPIO(61)
90#define TEGRA_PIN_GMI_AD14_PH6 _GPIO(62)
91#define TEGRA_PIN_GMI_AD15_PH7 _GPIO(63)
92#define TEGRA_PIN_GMI_WR_N_PI0 _GPIO(64)
93#define TEGRA_PIN_GMI_OE_N_PI1 _GPIO(65)
94#define TEGRA_PIN_GMI_DQS_PI2 _GPIO(66)
95#define TEGRA_PIN_GMI_CS6_N_PI3 _GPIO(67)
96#define TEGRA_PIN_GMI_RST_N_PI4 _GPIO(68)
97#define TEGRA_PIN_GMI_IORDY_PI5 _GPIO(69)
98#define TEGRA_PIN_GMI_CS7_N_PI6 _GPIO(70)
99#define TEGRA_PIN_GMI_WAIT_PI7 _GPIO(71)
100#define TEGRA_PIN_GMI_CS0_N_PJ0 _GPIO(72)
101#define TEGRA_PIN_LCD_DE_PJ1 _GPIO(73)
102#define TEGRA_PIN_GMI_CS1_N_PJ2 _GPIO(74)
103#define TEGRA_PIN_LCD_HSYNC_PJ3 _GPIO(75)
104#define TEGRA_PIN_LCD_VSYNC_PJ4 _GPIO(76)
105#define TEGRA_PIN_UART2_CTS_N_PJ5 _GPIO(77)
106#define TEGRA_PIN_UART2_RTS_N_PJ6 _GPIO(78)
107#define TEGRA_PIN_GMI_A16_PJ7 _GPIO(79)
108#define TEGRA_PIN_GMI_ADV_N_PK0 _GPIO(80)
109#define TEGRA_PIN_GMI_CLK_PK1 _GPIO(81)
110#define TEGRA_PIN_GMI_CS4_N_PK2 _GPIO(82)
111#define TEGRA_PIN_GMI_CS2_N_PK3 _GPIO(83)
112#define TEGRA_PIN_GMI_CS3_N_PK4 _GPIO(84)
113#define TEGRA_PIN_SPDIF_OUT_PK5 _GPIO(85)
114#define TEGRA_PIN_SPDIF_IN_PK6 _GPIO(86)
115#define TEGRA_PIN_GMI_A19_PK7 _GPIO(87)
116#define TEGRA_PIN_VI_D2_PL0 _GPIO(88)
117#define TEGRA_PIN_VI_D3_PL1 _GPIO(89)
118#define TEGRA_PIN_VI_D4_PL2 _GPIO(90)
119#define TEGRA_PIN_VI_D5_PL3 _GPIO(91)
120#define TEGRA_PIN_VI_D6_PL4 _GPIO(92)
121#define TEGRA_PIN_VI_D7_PL5 _GPIO(93)
122#define TEGRA_PIN_VI_D8_PL6 _GPIO(94)
123#define TEGRA_PIN_VI_D9_PL7 _GPIO(95)
124#define TEGRA_PIN_LCD_D16_PM0 _GPIO(96)
125#define TEGRA_PIN_LCD_D17_PM1 _GPIO(97)
126#define TEGRA_PIN_LCD_D18_PM2 _GPIO(98)
127#define TEGRA_PIN_LCD_D19_PM3 _GPIO(99)
128#define TEGRA_PIN_LCD_D20_PM4 _GPIO(100)
129#define TEGRA_PIN_LCD_D21_PM5 _GPIO(101)
130#define TEGRA_PIN_LCD_D22_PM6 _GPIO(102)
131#define TEGRA_PIN_LCD_D23_PM7 _GPIO(103)
132#define TEGRA_PIN_DAP1_FS_PN0 _GPIO(104)
133#define TEGRA_PIN_DAP1_DIN_PN1 _GPIO(105)
134#define TEGRA_PIN_DAP1_DOUT_PN2 _GPIO(106)
135#define TEGRA_PIN_DAP1_SCLK_PN3 _GPIO(107)
136#define TEGRA_PIN_LCD_CS0_N_PN4 _GPIO(108)
137#define TEGRA_PIN_LCD_SDOUT_PN5 _GPIO(109)
138#define TEGRA_PIN_LCD_DC0_PN6 _GPIO(110)
139#define TEGRA_PIN_HDMI_INT_PN7 _GPIO(111)
140#define TEGRA_PIN_ULPI_DATA7_PO0 _GPIO(112)
141#define TEGRA_PIN_ULPI_DATA0_PO1 _GPIO(113)
142#define TEGRA_PIN_ULPI_DATA1_PO2 _GPIO(114)
143#define TEGRA_PIN_ULPI_DATA2_PO3 _GPIO(115)
144#define TEGRA_PIN_ULPI_DATA3_PO4 _GPIO(116)
145#define TEGRA_PIN_ULPI_DATA4_PO5 _GPIO(117)
146#define TEGRA_PIN_ULPI_DATA5_PO6 _GPIO(118)
147#define TEGRA_PIN_ULPI_DATA6_PO7 _GPIO(119)
148#define TEGRA_PIN_DAP3_FS_PP0 _GPIO(120)
149#define TEGRA_PIN_DAP3_DIN_PP1 _GPIO(121)
150#define TEGRA_PIN_DAP3_DOUT_PP2 _GPIO(122)
151#define TEGRA_PIN_DAP3_SCLK_PP3 _GPIO(123)
152#define TEGRA_PIN_DAP4_FS_PP4 _GPIO(124)
153#define TEGRA_PIN_DAP4_DIN_PP5 _GPIO(125)
154#define TEGRA_PIN_DAP4_DOUT_PP6 _GPIO(126)
155#define TEGRA_PIN_DAP4_SCLK_PP7 _GPIO(127)
156#define TEGRA_PIN_KB_COL0_PQ0 _GPIO(128)
157#define TEGRA_PIN_KB_COL1_PQ1 _GPIO(129)
158#define TEGRA_PIN_KB_COL2_PQ2 _GPIO(130)
159#define TEGRA_PIN_KB_COL3_PQ3 _GPIO(131)
160#define TEGRA_PIN_KB_COL4_PQ4 _GPIO(132)
161#define TEGRA_PIN_KB_COL5_PQ5 _GPIO(133)
162#define TEGRA_PIN_KB_COL6_PQ6 _GPIO(134)
163#define TEGRA_PIN_KB_COL7_PQ7 _GPIO(135)
164#define TEGRA_PIN_KB_ROW0_PR0 _GPIO(136)
165#define TEGRA_PIN_KB_ROW1_PR1 _GPIO(137)
166#define TEGRA_PIN_KB_ROW2_PR2 _GPIO(138)
167#define TEGRA_PIN_KB_ROW3_PR3 _GPIO(139)
168#define TEGRA_PIN_KB_ROW4_PR4 _GPIO(140)
169#define TEGRA_PIN_KB_ROW5_PR5 _GPIO(141)
170#define TEGRA_PIN_KB_ROW6_PR6 _GPIO(142)
171#define TEGRA_PIN_KB_ROW7_PR7 _GPIO(143)
172#define TEGRA_PIN_KB_ROW8_PS0 _GPIO(144)
173#define TEGRA_PIN_KB_ROW9_PS1 _GPIO(145)
174#define TEGRA_PIN_KB_ROW10_PS2 _GPIO(146)
175#define TEGRA_PIN_KB_ROW11_PS3 _GPIO(147)
176#define TEGRA_PIN_KB_ROW12_PS4 _GPIO(148)
177#define TEGRA_PIN_KB_ROW13_PS5 _GPIO(149)
178#define TEGRA_PIN_KB_ROW14_PS6 _GPIO(150)
179#define TEGRA_PIN_KB_ROW15_PS7 _GPIO(151)
180#define TEGRA_PIN_VI_PCLK_PT0 _GPIO(152)
181#define TEGRA_PIN_VI_MCLK_PT1 _GPIO(153)
182#define TEGRA_PIN_VI_D10_PT2 _GPIO(154)
183#define TEGRA_PIN_VI_D11_PT3 _GPIO(155)
184#define TEGRA_PIN_VI_D0_PT4 _GPIO(156)
185#define TEGRA_PIN_GEN2_I2C_SCL_PT5 _GPIO(157)
186#define TEGRA_PIN_GEN2_I2C_SDA_PT6 _GPIO(158)
187#define TEGRA_PIN_SDMMC4_CMD_PT7 _GPIO(159)
188#define TEGRA_PIN_PU0 _GPIO(160)
189#define TEGRA_PIN_PU1 _GPIO(161)
190#define TEGRA_PIN_PU2 _GPIO(162)
191#define TEGRA_PIN_PU3 _GPIO(163)
192#define TEGRA_PIN_PU4 _GPIO(164)
193#define TEGRA_PIN_PU5 _GPIO(165)
194#define TEGRA_PIN_PU6 _GPIO(166)
195#define TEGRA_PIN_JTAG_RTCK_PU7 _GPIO(167)
196#define TEGRA_PIN_PV0 _GPIO(168)
197#define TEGRA_PIN_PV1 _GPIO(169)
198#define TEGRA_PIN_PV2 _GPIO(170)
199#define TEGRA_PIN_PV3 _GPIO(171)
200#define TEGRA_PIN_DDC_SCL_PV4 _GPIO(172)
201#define TEGRA_PIN_DDC_SDA_PV5 _GPIO(173)
202#define TEGRA_PIN_CRT_HSYNC_PV6 _GPIO(174)
203#define TEGRA_PIN_CRT_VSYNC_PV7 _GPIO(175)
204#define TEGRA_PIN_LCD_CS1_N_PW0 _GPIO(176)
205#define TEGRA_PIN_LCD_M1_PW1 _GPIO(177)
206#define TEGRA_PIN_SPI2_CS1_N_PW2 _GPIO(178)
207#define TEGRA_PIN_SPI2_CS2_N_PW3 _GPIO(179)
208#define TEGRA_PIN_CLK1_OUT_PW4 _GPIO(180)
209#define TEGRA_PIN_CLK2_OUT_PW5 _GPIO(181)
210#define TEGRA_PIN_UART3_TXD_PW6 _GPIO(182)
211#define TEGRA_PIN_UART3_RXD_PW7 _GPIO(183)
212#define TEGRA_PIN_SPI2_MOSI_PX0 _GPIO(184)
213#define TEGRA_PIN_SPI2_MISO_PX1 _GPIO(185)
214#define TEGRA_PIN_SPI2_SCK_PX2 _GPIO(186)
215#define TEGRA_PIN_SPI2_CS0_N_PX3 _GPIO(187)
216#define TEGRA_PIN_SPI1_MOSI_PX4 _GPIO(188)
217#define TEGRA_PIN_SPI1_SCK_PX5 _GPIO(189)
218#define TEGRA_PIN_SPI1_CS0_N_PX6 _GPIO(190)
219#define TEGRA_PIN_SPI1_MISO_PX7 _GPIO(191)
220#define TEGRA_PIN_ULPI_CLK_PY0 _GPIO(192)
221#define TEGRA_PIN_ULPI_DIR_PY1 _GPIO(193)
222#define TEGRA_PIN_ULPI_NXT_PY2 _GPIO(194)
223#define TEGRA_PIN_ULPI_STP_PY3 _GPIO(195)
224#define TEGRA_PIN_SDMMC1_DAT3_PY4 _GPIO(196)
225#define TEGRA_PIN_SDMMC1_DAT2_PY5 _GPIO(197)
226#define TEGRA_PIN_SDMMC1_DAT1_PY6 _GPIO(198)
227#define TEGRA_PIN_SDMMC1_DAT0_PY7 _GPIO(199)
228#define TEGRA_PIN_SDMMC1_CLK_PZ0 _GPIO(200)
229#define TEGRA_PIN_SDMMC1_CMD_PZ1 _GPIO(201)
230#define TEGRA_PIN_LCD_SDIN_PZ2 _GPIO(202)
231#define TEGRA_PIN_LCD_WR_N_PZ3 _GPIO(203)
232#define TEGRA_PIN_LCD_SCK_PZ4 _GPIO(204)
233#define TEGRA_PIN_SYS_CLK_REQ_PZ5 _GPIO(205)
234#define TEGRA_PIN_PWR_I2C_SCL_PZ6 _GPIO(206)
235#define TEGRA_PIN_PWR_I2C_SDA_PZ7 _GPIO(207)
236#define TEGRA_PIN_SDMMC4_DAT0_PAA0 _GPIO(208)
237#define TEGRA_PIN_SDMMC4_DAT1_PAA1 _GPIO(209)
238#define TEGRA_PIN_SDMMC4_DAT2_PAA2 _GPIO(210)
239#define TEGRA_PIN_SDMMC4_DAT3_PAA3 _GPIO(211)
240#define TEGRA_PIN_SDMMC4_DAT4_PAA4 _GPIO(212)
241#define TEGRA_PIN_SDMMC4_DAT5_PAA5 _GPIO(213)
242#define TEGRA_PIN_SDMMC4_DAT6_PAA6 _GPIO(214)
243#define TEGRA_PIN_SDMMC4_DAT7_PAA7 _GPIO(215)
244#define TEGRA_PIN_PBB0 _GPIO(216)
245#define TEGRA_PIN_CAM_I2C_SCL_PBB1 _GPIO(217)
246#define TEGRA_PIN_CAM_I2C_SDA_PBB2 _GPIO(218)
247#define TEGRA_PIN_PBB3 _GPIO(219)
248#define TEGRA_PIN_PBB4 _GPIO(220)
249#define TEGRA_PIN_PBB5 _GPIO(221)
250#define TEGRA_PIN_PBB6 _GPIO(222)
251#define TEGRA_PIN_PBB7 _GPIO(223)
252#define TEGRA_PIN_CAM_MCLK_PCC0 _GPIO(224)
253#define TEGRA_PIN_PCC1 _GPIO(225)
254#define TEGRA_PIN_PCC2 _GPIO(226)
255#define TEGRA_PIN_SDMMC4_RST_N_PCC3 _GPIO(227)
256#define TEGRA_PIN_SDMMC4_CLK_PCC4 _GPIO(228)
257#define TEGRA_PIN_CLK2_REQ_PCC5 _GPIO(229)
258#define TEGRA_PIN_PEX_L2_RST_N_PCC6 _GPIO(230)
259#define TEGRA_PIN_PEX_L2_CLKREQ_N_PCC7 _GPIO(231)
260#define TEGRA_PIN_PEX_L0_PRSNT_N_PDD0 _GPIO(232)
261#define TEGRA_PIN_PEX_L0_RST_N_PDD1 _GPIO(233)
262#define TEGRA_PIN_PEX_L0_CLKREQ_N_PDD2 _GPIO(234)
263#define TEGRA_PIN_PEX_WAKE_N_PDD3 _GPIO(235)
264#define TEGRA_PIN_PEX_L1_PRSNT_N_PDD4 _GPIO(236)
265#define TEGRA_PIN_PEX_L1_RST_N_PDD5 _GPIO(237)
266#define TEGRA_PIN_PEX_L1_CLKREQ_N_PDD6 _GPIO(238)
267#define TEGRA_PIN_PEX_L2_PRSNT_N_PDD7 _GPIO(239)
268#define TEGRA_PIN_CLK3_OUT_PEE0 _GPIO(240)
269#define TEGRA_PIN_CLK3_REQ_PEE1 _GPIO(241)
270#define TEGRA_PIN_CLK1_REQ_PEE2 _GPIO(242)
271#define TEGRA_PIN_HDMI_CEC_PEE3 _GPIO(243)
272#define TEGRA_PIN_PEE4 _GPIO(244)
273#define TEGRA_PIN_PEE5 _GPIO(245)
274#define TEGRA_PIN_PEE6 _GPIO(246)
275#define TEGRA_PIN_PEE7 _GPIO(247)
276
277/* All non-GPIO pins follow */
278#define NUM_GPIOS (TEGRA_PIN_PEE7 + 1)
279#define _PIN(offset) (NUM_GPIOS + (offset))
280
281/* Non-GPIO pins */
282#define TEGRA_PIN_CLK_32K_IN _PIN(0)
283#define TEGRA_PIN_CORE_PWR_REQ _PIN(1)
284#define TEGRA_PIN_CPU_PWR_REQ _PIN(2)
285#define TEGRA_PIN_JTAG_TCK _PIN(3)
286#define TEGRA_PIN_JTAG_TDI _PIN(4)
287#define TEGRA_PIN_JTAG_TDO _PIN(5)
288#define TEGRA_PIN_JTAG_TMS _PIN(6)
289#define TEGRA_PIN_JTAG_TRST_N _PIN(7)
290#define TEGRA_PIN_OWR _PIN(8)
291#define TEGRA_PIN_PWR_INT_N _PIN(9)
292#define TEGRA_PIN_SYS_RESET_N _PIN(10)
293#define TEGRA_PIN_TEST_MODE_EN _PIN(11)
294
295static const struct pinctrl_pin_desc tegra30_pins[] = {
296 PINCTRL_PIN(TEGRA_PIN_CLK_32K_OUT_PA0, "CLK_32K_OUT PA0"),
297 PINCTRL_PIN(TEGRA_PIN_UART3_CTS_N_PA1, "UART3_CTS_N PA1"),
298 PINCTRL_PIN(TEGRA_PIN_DAP2_FS_PA2, "DAP2_FS PA2"),
299 PINCTRL_PIN(TEGRA_PIN_DAP2_SCLK_PA3, "DAP2_SCLK PA3"),
300 PINCTRL_PIN(TEGRA_PIN_DAP2_DIN_PA4, "DAP2_DIN PA4"),
301 PINCTRL_PIN(TEGRA_PIN_DAP2_DOUT_PA5, "DAP2_DOUT PA5"),
302 PINCTRL_PIN(TEGRA_PIN_SDMMC3_CLK_PA6, "SDMMC3_CLK PA6"),
303 PINCTRL_PIN(TEGRA_PIN_SDMMC3_CMD_PA7, "SDMMC3_CMD PA7"),
304 PINCTRL_PIN(TEGRA_PIN_GMI_A17_PB0, "GMI_A17 PB0"),
305 PINCTRL_PIN(TEGRA_PIN_GMI_A18_PB1, "GMI_A18 PB1"),
306 PINCTRL_PIN(TEGRA_PIN_LCD_PWR0_PB2, "LCD_PWR0 PB2"),
307 PINCTRL_PIN(TEGRA_PIN_LCD_PCLK_PB3, "LCD_PCLK PB3"),
308 PINCTRL_PIN(TEGRA_PIN_SDMMC3_DAT3_PB4, "SDMMC3_DAT3 PB4"),
309 PINCTRL_PIN(TEGRA_PIN_SDMMC3_DAT2_PB5, "SDMMC3_DAT2 PB5"),
310 PINCTRL_PIN(TEGRA_PIN_SDMMC3_DAT1_PB6, "SDMMC3_DAT1 PB6"),
311 PINCTRL_PIN(TEGRA_PIN_SDMMC3_DAT0_PB7, "SDMMC3_DAT0 PB7"),
312 PINCTRL_PIN(TEGRA_PIN_UART3_RTS_N_PC0, "UART3_RTS_N PC0"),
313 PINCTRL_PIN(TEGRA_PIN_LCD_PWR1_PC1, "LCD_PWR1 PC1"),
314 PINCTRL_PIN(TEGRA_PIN_UART2_TXD_PC2, "UART2_TXD PC2"),
315 PINCTRL_PIN(TEGRA_PIN_UART2_RXD_PC3, "UART2_RXD PC3"),
316 PINCTRL_PIN(TEGRA_PIN_GEN1_I2C_SCL_PC4, "GEN1_I2C_SCL PC4"),
317 PINCTRL_PIN(TEGRA_PIN_GEN1_I2C_SDA_PC5, "GEN1_I2C_SDA PC5"),
318 PINCTRL_PIN(TEGRA_PIN_LCD_PWR2_PC6, "LCD_PWR2 PC6"),
319 PINCTRL_PIN(TEGRA_PIN_GMI_WP_N_PC7, "GMI_WP_N PC7"),
320 PINCTRL_PIN(TEGRA_PIN_SDMMC3_DAT5_PD0, "SDMMC3_DAT5 PD0"),
321 PINCTRL_PIN(TEGRA_PIN_SDMMC3_DAT4_PD1, "SDMMC3_DAT4 PD1"),
322 PINCTRL_PIN(TEGRA_PIN_LCD_DC1_PD2, "LCD_DC1 PD2"),
323 PINCTRL_PIN(TEGRA_PIN_SDMMC3_DAT6_PD3, "SDMMC3_DAT6 PD3"),
324 PINCTRL_PIN(TEGRA_PIN_SDMMC3_DAT7_PD4, "SDMMC3_DAT7 PD4"),
325 PINCTRL_PIN(TEGRA_PIN_VI_D1_PD5, "VI_D1 PD5"),
326 PINCTRL_PIN(TEGRA_PIN_VI_VSYNC_PD6, "VI_VSYNC PD6"),
327 PINCTRL_PIN(TEGRA_PIN_VI_HSYNC_PD7, "VI_HSYNC PD7"),
328 PINCTRL_PIN(TEGRA_PIN_LCD_D0_PE0, "LCD_D0 PE0"),
329 PINCTRL_PIN(TEGRA_PIN_LCD_D1_PE1, "LCD_D1 PE1"),
330 PINCTRL_PIN(TEGRA_PIN_LCD_D2_PE2, "LCD_D2 PE2"),
331 PINCTRL_PIN(TEGRA_PIN_LCD_D3_PE3, "LCD_D3 PE3"),
332 PINCTRL_PIN(TEGRA_PIN_LCD_D4_PE4, "LCD_D4 PE4"),
333 PINCTRL_PIN(TEGRA_PIN_LCD_D5_PE5, "LCD_D5 PE5"),
334 PINCTRL_PIN(TEGRA_PIN_LCD_D6_PE6, "LCD_D6 PE6"),
335 PINCTRL_PIN(TEGRA_PIN_LCD_D7_PE7, "LCD_D7 PE7"),
336 PINCTRL_PIN(TEGRA_PIN_LCD_D8_PF0, "LCD_D8 PF0"),
337 PINCTRL_PIN(TEGRA_PIN_LCD_D9_PF1, "LCD_D9 PF1"),
338 PINCTRL_PIN(TEGRA_PIN_LCD_D10_PF2, "LCD_D10 PF2"),
339 PINCTRL_PIN(TEGRA_PIN_LCD_D11_PF3, "LCD_D11 PF3"),
340 PINCTRL_PIN(TEGRA_PIN_LCD_D12_PF4, "LCD_D12 PF4"),
341 PINCTRL_PIN(TEGRA_PIN_LCD_D13_PF5, "LCD_D13 PF5"),
342 PINCTRL_PIN(TEGRA_PIN_LCD_D14_PF6, "LCD_D14 PF6"),
343 PINCTRL_PIN(TEGRA_PIN_LCD_D15_PF7, "LCD_D15 PF7"),
344 PINCTRL_PIN(TEGRA_PIN_GMI_AD0_PG0, "GMI_AD0 PG0"),
345 PINCTRL_PIN(TEGRA_PIN_GMI_AD1_PG1, "GMI_AD1 PG1"),
346 PINCTRL_PIN(TEGRA_PIN_GMI_AD2_PG2, "GMI_AD2 PG2"),
347 PINCTRL_PIN(TEGRA_PIN_GMI_AD3_PG3, "GMI_AD3 PG3"),
348 PINCTRL_PIN(TEGRA_PIN_GMI_AD4_PG4, "GMI_AD4 PG4"),
349 PINCTRL_PIN(TEGRA_PIN_GMI_AD5_PG5, "GMI_AD5 PG5"),
350 PINCTRL_PIN(TEGRA_PIN_GMI_AD6_PG6, "GMI_AD6 PG6"),
351 PINCTRL_PIN(TEGRA_PIN_GMI_AD7_PG7, "GMI_AD7 PG7"),
352 PINCTRL_PIN(TEGRA_PIN_GMI_AD8_PH0, "GMI_AD8 PH0"),
353 PINCTRL_PIN(TEGRA_PIN_GMI_AD9_PH1, "GMI_AD9 PH1"),
354 PINCTRL_PIN(TEGRA_PIN_GMI_AD10_PH2, "GMI_AD10 PH2"),
355 PINCTRL_PIN(TEGRA_PIN_GMI_AD11_PH3, "GMI_AD11 PH3"),
356 PINCTRL_PIN(TEGRA_PIN_GMI_AD12_PH4, "GMI_AD12 PH4"),
357 PINCTRL_PIN(TEGRA_PIN_GMI_AD13_PH5, "GMI_AD13 PH5"),
358 PINCTRL_PIN(TEGRA_PIN_GMI_AD14_PH6, "GMI_AD14 PH6"),
359 PINCTRL_PIN(TEGRA_PIN_GMI_AD15_PH7, "GMI_AD15 PH7"),
360 PINCTRL_PIN(TEGRA_PIN_GMI_WR_N_PI0, "GMI_WR_N PI0"),
361 PINCTRL_PIN(TEGRA_PIN_GMI_OE_N_PI1, "GMI_OE_N PI1"),
362 PINCTRL_PIN(TEGRA_PIN_GMI_DQS_PI2, "GMI_DQS PI2"),
363 PINCTRL_PIN(TEGRA_PIN_GMI_CS6_N_PI3, "GMI_CS6_N PI3"),
364 PINCTRL_PIN(TEGRA_PIN_GMI_RST_N_PI4, "GMI_RST_N PI4"),
365 PINCTRL_PIN(TEGRA_PIN_GMI_IORDY_PI5, "GMI_IORDY PI5"),
366 PINCTRL_PIN(TEGRA_PIN_GMI_CS7_N_PI6, "GMI_CS7_N PI6"),
367 PINCTRL_PIN(TEGRA_PIN_GMI_WAIT_PI7, "GMI_WAIT PI7"),
368 PINCTRL_PIN(TEGRA_PIN_GMI_CS0_N_PJ0, "GMI_CS0_N PJ0"),
369 PINCTRL_PIN(TEGRA_PIN_LCD_DE_PJ1, "LCD_DE PJ1"),
370 PINCTRL_PIN(TEGRA_PIN_GMI_CS1_N_PJ2, "GMI_CS1_N PJ2"),
371 PINCTRL_PIN(TEGRA_PIN_LCD_HSYNC_PJ3, "LCD_HSYNC PJ3"),
372 PINCTRL_PIN(TEGRA_PIN_LCD_VSYNC_PJ4, "LCD_VSYNC PJ4"),
373 PINCTRL_PIN(TEGRA_PIN_UART2_CTS_N_PJ5, "UART2_CTS_N PJ5"),
374 PINCTRL_PIN(TEGRA_PIN_UART2_RTS_N_PJ6, "UART2_RTS_N PJ6"),
375 PINCTRL_PIN(TEGRA_PIN_GMI_A16_PJ7, "GMI_A16 PJ7"),
376 PINCTRL_PIN(TEGRA_PIN_GMI_ADV_N_PK0, "GMI_ADV_N PK0"),
377 PINCTRL_PIN(TEGRA_PIN_GMI_CLK_PK1, "GMI_CLK PK1"),
378 PINCTRL_PIN(TEGRA_PIN_GMI_CS4_N_PK2, "GMI_CS4_N PK2"),
379 PINCTRL_PIN(TEGRA_PIN_GMI_CS2_N_PK3, "GMI_CS2_N PK3"),
380 PINCTRL_PIN(TEGRA_PIN_GMI_CS3_N_PK4, "GMI_CS3_N PK4"),
381 PINCTRL_PIN(TEGRA_PIN_SPDIF_OUT_PK5, "SPDIF_OUT PK5"),
382 PINCTRL_PIN(TEGRA_PIN_SPDIF_IN_PK6, "SPDIF_IN PK6"),
383 PINCTRL_PIN(TEGRA_PIN_GMI_A19_PK7, "GMI_A19 PK7"),
384 PINCTRL_PIN(TEGRA_PIN_VI_D2_PL0, "VI_D2 PL0"),
385 PINCTRL_PIN(TEGRA_PIN_VI_D3_PL1, "VI_D3 PL1"),
386 PINCTRL_PIN(TEGRA_PIN_VI_D4_PL2, "VI_D4 PL2"),
387 PINCTRL_PIN(TEGRA_PIN_VI_D5_PL3, "VI_D5 PL3"),
388 PINCTRL_PIN(TEGRA_PIN_VI_D6_PL4, "VI_D6 PL4"),
389 PINCTRL_PIN(TEGRA_PIN_VI_D7_PL5, "VI_D7 PL5"),
390 PINCTRL_PIN(TEGRA_PIN_VI_D8_PL6, "VI_D8 PL6"),
391 PINCTRL_PIN(TEGRA_PIN_VI_D9_PL7, "VI_D9 PL7"),
392 PINCTRL_PIN(TEGRA_PIN_LCD_D16_PM0, "LCD_D16 PM0"),
393 PINCTRL_PIN(TEGRA_PIN_LCD_D17_PM1, "LCD_D17 PM1"),
394 PINCTRL_PIN(TEGRA_PIN_LCD_D18_PM2, "LCD_D18 PM2"),
395 PINCTRL_PIN(TEGRA_PIN_LCD_D19_PM3, "LCD_D19 PM3"),
396 PINCTRL_PIN(TEGRA_PIN_LCD_D20_PM4, "LCD_D20 PM4"),
397 PINCTRL_PIN(TEGRA_PIN_LCD_D21_PM5, "LCD_D21 PM5"),
398 PINCTRL_PIN(TEGRA_PIN_LCD_D22_PM6, "LCD_D22 PM6"),
399 PINCTRL_PIN(TEGRA_PIN_LCD_D23_PM7, "LCD_D23 PM7"),
400 PINCTRL_PIN(TEGRA_PIN_DAP1_FS_PN0, "DAP1_FS PN0"),
401 PINCTRL_PIN(TEGRA_PIN_DAP1_DIN_PN1, "DAP1_DIN PN1"),
402 PINCTRL_PIN(TEGRA_PIN_DAP1_DOUT_PN2, "DAP1_DOUT PN2"),
403 PINCTRL_PIN(TEGRA_PIN_DAP1_SCLK_PN3, "DAP1_SCLK PN3"),
404 PINCTRL_PIN(TEGRA_PIN_LCD_CS0_N_PN4, "LCD_CS0_N PN4"),
405 PINCTRL_PIN(TEGRA_PIN_LCD_SDOUT_PN5, "LCD_SDOUT PN5"),
406 PINCTRL_PIN(TEGRA_PIN_LCD_DC0_PN6, "LCD_DC0 PN6"),
407 PINCTRL_PIN(TEGRA_PIN_HDMI_INT_PN7, "HDMI_INT PN7"),
408 PINCTRL_PIN(TEGRA_PIN_ULPI_DATA7_PO0, "ULPI_DATA7 PO0"),
409 PINCTRL_PIN(TEGRA_PIN_ULPI_DATA0_PO1, "ULPI_DATA0 PO1"),
410 PINCTRL_PIN(TEGRA_PIN_ULPI_DATA1_PO2, "ULPI_DATA1 PO2"),
411 PINCTRL_PIN(TEGRA_PIN_ULPI_DATA2_PO3, "ULPI_DATA2 PO3"),
412 PINCTRL_PIN(TEGRA_PIN_ULPI_DATA3_PO4, "ULPI_DATA3 PO4"),
413 PINCTRL_PIN(TEGRA_PIN_ULPI_DATA4_PO5, "ULPI_DATA4 PO5"),
414 PINCTRL_PIN(TEGRA_PIN_ULPI_DATA5_PO6, "ULPI_DATA5 PO6"),
415 PINCTRL_PIN(TEGRA_PIN_ULPI_DATA6_PO7, "ULPI_DATA6 PO7"),
416 PINCTRL_PIN(TEGRA_PIN_DAP3_FS_PP0, "DAP3_FS PP0"),
417 PINCTRL_PIN(TEGRA_PIN_DAP3_DIN_PP1, "DAP3_DIN PP1"),
418 PINCTRL_PIN(TEGRA_PIN_DAP3_DOUT_PP2, "DAP3_DOUT PP2"),
419 PINCTRL_PIN(TEGRA_PIN_DAP3_SCLK_PP3, "DAP3_SCLK PP3"),
420 PINCTRL_PIN(TEGRA_PIN_DAP4_FS_PP4, "DAP4_FS PP4"),
421 PINCTRL_PIN(TEGRA_PIN_DAP4_DIN_PP5, "DAP4_DIN PP5"),
422 PINCTRL_PIN(TEGRA_PIN_DAP4_DOUT_PP6, "DAP4_DOUT PP6"),
423 PINCTRL_PIN(TEGRA_PIN_DAP4_SCLK_PP7, "DAP4_SCLK PP7"),
424 PINCTRL_PIN(TEGRA_PIN_KB_COL0_PQ0, "KB_COL0 PQ0"),
425 PINCTRL_PIN(TEGRA_PIN_KB_COL1_PQ1, "KB_COL1 PQ1"),
426 PINCTRL_PIN(TEGRA_PIN_KB_COL2_PQ2, "KB_COL2 PQ2"),
427 PINCTRL_PIN(TEGRA_PIN_KB_COL3_PQ3, "KB_COL3 PQ3"),
428 PINCTRL_PIN(TEGRA_PIN_KB_COL4_PQ4, "KB_COL4 PQ4"),
429 PINCTRL_PIN(TEGRA_PIN_KB_COL5_PQ5, "KB_COL5 PQ5"),
430 PINCTRL_PIN(TEGRA_PIN_KB_COL6_PQ6, "KB_COL6 PQ6"),
431 PINCTRL_PIN(TEGRA_PIN_KB_COL7_PQ7, "KB_COL7 PQ7"),
432 PINCTRL_PIN(TEGRA_PIN_KB_ROW0_PR0, "KB_ROW0 PR0"),
433 PINCTRL_PIN(TEGRA_PIN_KB_ROW1_PR1, "KB_ROW1 PR1"),
434 PINCTRL_PIN(TEGRA_PIN_KB_ROW2_PR2, "KB_ROW2 PR2"),
435 PINCTRL_PIN(TEGRA_PIN_KB_ROW3_PR3, "KB_ROW3 PR3"),
436 PINCTRL_PIN(TEGRA_PIN_KB_ROW4_PR4, "KB_ROW4 PR4"),
437 PINCTRL_PIN(TEGRA_PIN_KB_ROW5_PR5, "KB_ROW5 PR5"),
438 PINCTRL_PIN(TEGRA_PIN_KB_ROW6_PR6, "KB_ROW6 PR6"),
439 PINCTRL_PIN(TEGRA_PIN_KB_ROW7_PR7, "KB_ROW7 PR7"),
440 PINCTRL_PIN(TEGRA_PIN_KB_ROW8_PS0, "KB_ROW8 PS0"),
441 PINCTRL_PIN(TEGRA_PIN_KB_ROW9_PS1, "KB_ROW9 PS1"),
442 PINCTRL_PIN(TEGRA_PIN_KB_ROW10_PS2, "KB_ROW10 PS2"),
443 PINCTRL_PIN(TEGRA_PIN_KB_ROW11_PS3, "KB_ROW11 PS3"),
444 PINCTRL_PIN(TEGRA_PIN_KB_ROW12_PS4, "KB_ROW12 PS4"),
445 PINCTRL_PIN(TEGRA_PIN_KB_ROW13_PS5, "KB_ROW13 PS5"),
446 PINCTRL_PIN(TEGRA_PIN_KB_ROW14_PS6, "KB_ROW14 PS6"),
447 PINCTRL_PIN(TEGRA_PIN_KB_ROW15_PS7, "KB_ROW15 PS7"),
448 PINCTRL_PIN(TEGRA_PIN_VI_PCLK_PT0, "VI_PCLK PT0"),
449 PINCTRL_PIN(TEGRA_PIN_VI_MCLK_PT1, "VI_MCLK PT1"),
450 PINCTRL_PIN(TEGRA_PIN_VI_D10_PT2, "VI_D10 PT2"),
451 PINCTRL_PIN(TEGRA_PIN_VI_D11_PT3, "VI_D11 PT3"),
452 PINCTRL_PIN(TEGRA_PIN_VI_D0_PT4, "VI_D0 PT4"),
453 PINCTRL_PIN(TEGRA_PIN_GEN2_I2C_SCL_PT5, "GEN2_I2C_SCL PT5"),
454 PINCTRL_PIN(TEGRA_PIN_GEN2_I2C_SDA_PT6, "GEN2_I2C_SDA PT6"),
455 PINCTRL_PIN(TEGRA_PIN_SDMMC4_CMD_PT7, "SDMMC4_CMD PT7"),
456 PINCTRL_PIN(TEGRA_PIN_PU0, "PU0"),
457 PINCTRL_PIN(TEGRA_PIN_PU1, "PU1"),
458 PINCTRL_PIN(TEGRA_PIN_PU2, "PU2"),
459 PINCTRL_PIN(TEGRA_PIN_PU3, "PU3"),
460 PINCTRL_PIN(TEGRA_PIN_PU4, "PU4"),
461 PINCTRL_PIN(TEGRA_PIN_PU5, "PU5"),
462 PINCTRL_PIN(TEGRA_PIN_PU6, "PU6"),
463 PINCTRL_PIN(TEGRA_PIN_JTAG_RTCK_PU7, "JTAG_RTCK PU7"),
464 PINCTRL_PIN(TEGRA_PIN_PV0, "PV0"),
465 PINCTRL_PIN(TEGRA_PIN_PV1, "PV1"),
466 PINCTRL_PIN(TEGRA_PIN_PV2, "PV2"),
467 PINCTRL_PIN(TEGRA_PIN_PV3, "PV3"),
468 PINCTRL_PIN(TEGRA_PIN_DDC_SCL_PV4, "DDC_SCL PV4"),
469 PINCTRL_PIN(TEGRA_PIN_DDC_SDA_PV5, "DDC_SDA PV5"),
470 PINCTRL_PIN(TEGRA_PIN_CRT_HSYNC_PV6, "CRT_HSYNC PV6"),
471 PINCTRL_PIN(TEGRA_PIN_CRT_VSYNC_PV7, "CRT_VSYNC PV7"),
472 PINCTRL_PIN(TEGRA_PIN_LCD_CS1_N_PW0, "LCD_CS1_N PW0"),
473 PINCTRL_PIN(TEGRA_PIN_LCD_M1_PW1, "LCD_M1 PW1"),
474 PINCTRL_PIN(TEGRA_PIN_SPI2_CS1_N_PW2, "SPI2_CS1_N PW2"),
475 PINCTRL_PIN(TEGRA_PIN_SPI2_CS2_N_PW3, "SPI2_CS2_N PW3"),
476 PINCTRL_PIN(TEGRA_PIN_CLK1_OUT_PW4, "CLK1_OUT PW4"),
477 PINCTRL_PIN(TEGRA_PIN_CLK2_OUT_PW5, "CLK2_OUT PW5"),
478 PINCTRL_PIN(TEGRA_PIN_UART3_TXD_PW6, "UART3_TXD PW6"),
479 PINCTRL_PIN(TEGRA_PIN_UART3_RXD_PW7, "UART3_RXD PW7"),
480 PINCTRL_PIN(TEGRA_PIN_SPI2_MOSI_PX0, "SPI2_MOSI PX0"),
481 PINCTRL_PIN(TEGRA_PIN_SPI2_MISO_PX1, "SPI2_MISO PX1"),
482 PINCTRL_PIN(TEGRA_PIN_SPI2_SCK_PX2, "SPI2_SCK PX2"),
483 PINCTRL_PIN(TEGRA_PIN_SPI2_CS0_N_PX3, "SPI2_CS0_N PX3"),
484 PINCTRL_PIN(TEGRA_PIN_SPI1_MOSI_PX4, "SPI1_MOSI PX4"),
485 PINCTRL_PIN(TEGRA_PIN_SPI1_SCK_PX5, "SPI1_SCK PX5"),
486 PINCTRL_PIN(TEGRA_PIN_SPI1_CS0_N_PX6, "SPI1_CS0_N PX6"),
487 PINCTRL_PIN(TEGRA_PIN_SPI1_MISO_PX7, "SPI1_MISO PX7"),
488 PINCTRL_PIN(TEGRA_PIN_ULPI_CLK_PY0, "ULPI_CLK PY0"),
489 PINCTRL_PIN(TEGRA_PIN_ULPI_DIR_PY1, "ULPI_DIR PY1"),
490 PINCTRL_PIN(TEGRA_PIN_ULPI_NXT_PY2, "ULPI_NXT PY2"),
491 PINCTRL_PIN(TEGRA_PIN_ULPI_STP_PY3, "ULPI_STP PY3"),
492 PINCTRL_PIN(TEGRA_PIN_SDMMC1_DAT3_PY4, "SDMMC1_DAT3 PY4"),
493 PINCTRL_PIN(TEGRA_PIN_SDMMC1_DAT2_PY5, "SDMMC1_DAT2 PY5"),
494 PINCTRL_PIN(TEGRA_PIN_SDMMC1_DAT1_PY6, "SDMMC1_DAT1 PY6"),
495 PINCTRL_PIN(TEGRA_PIN_SDMMC1_DAT0_PY7, "SDMMC1_DAT0 PY7"),
496 PINCTRL_PIN(TEGRA_PIN_SDMMC1_CLK_PZ0, "SDMMC1_CLK PZ0"),
497 PINCTRL_PIN(TEGRA_PIN_SDMMC1_CMD_PZ1, "SDMMC1_CMD PZ1"),
498 PINCTRL_PIN(TEGRA_PIN_LCD_SDIN_PZ2, "LCD_SDIN PZ2"),
499 PINCTRL_PIN(TEGRA_PIN_LCD_WR_N_PZ3, "LCD_WR_N PZ3"),
500 PINCTRL_PIN(TEGRA_PIN_LCD_SCK_PZ4, "LCD_SCK PZ4"),
501 PINCTRL_PIN(TEGRA_PIN_SYS_CLK_REQ_PZ5, "SYS_CLK_REQ PZ5"),
502 PINCTRL_PIN(TEGRA_PIN_PWR_I2C_SCL_PZ6, "PWR_I2C_SCL PZ6"),
503 PINCTRL_PIN(TEGRA_PIN_PWR_I2C_SDA_PZ7, "PWR_I2C_SDA PZ7"),
504 PINCTRL_PIN(TEGRA_PIN_SDMMC4_DAT0_PAA0, "SDMMC4_DAT0 PAA0"),
505 PINCTRL_PIN(TEGRA_PIN_SDMMC4_DAT1_PAA1, "SDMMC4_DAT1 PAA1"),
506 PINCTRL_PIN(TEGRA_PIN_SDMMC4_DAT2_PAA2, "SDMMC4_DAT2 PAA2"),
507 PINCTRL_PIN(TEGRA_PIN_SDMMC4_DAT3_PAA3, "SDMMC4_DAT3 PAA3"),
508 PINCTRL_PIN(TEGRA_PIN_SDMMC4_DAT4_PAA4, "SDMMC4_DAT4 PAA4"),
509 PINCTRL_PIN(TEGRA_PIN_SDMMC4_DAT5_PAA5, "SDMMC4_DAT5 PAA5"),
510 PINCTRL_PIN(TEGRA_PIN_SDMMC4_DAT6_PAA6, "SDMMC4_DAT6 PAA6"),
511 PINCTRL_PIN(TEGRA_PIN_SDMMC4_DAT7_PAA7, "SDMMC4_DAT7 PAA7"),
512 PINCTRL_PIN(TEGRA_PIN_PBB0, "PBB0"),
513 PINCTRL_PIN(TEGRA_PIN_CAM_I2C_SCL_PBB1, "CAM_I2C_SCL PBB1"),
514 PINCTRL_PIN(TEGRA_PIN_CAM_I2C_SDA_PBB2, "CAM_I2C_SDA PBB2"),
515 PINCTRL_PIN(TEGRA_PIN_PBB3, "PBB3"),
516 PINCTRL_PIN(TEGRA_PIN_PBB4, "PBB4"),
517 PINCTRL_PIN(TEGRA_PIN_PBB5, "PBB5"),
518 PINCTRL_PIN(TEGRA_PIN_PBB6, "PBB6"),
519 PINCTRL_PIN(TEGRA_PIN_PBB7, "PBB7"),
520 PINCTRL_PIN(TEGRA_PIN_CAM_MCLK_PCC0, "CAM_MCLK PCC0"),
521 PINCTRL_PIN(TEGRA_PIN_PCC1, "PCC1"),
522 PINCTRL_PIN(TEGRA_PIN_PCC2, "PCC2"),
523 PINCTRL_PIN(TEGRA_PIN_SDMMC4_RST_N_PCC3, "SDMMC4_RST_N PCC3"),
524 PINCTRL_PIN(TEGRA_PIN_SDMMC4_CLK_PCC4, "SDMMC4_CLK PCC4"),
525 PINCTRL_PIN(TEGRA_PIN_CLK2_REQ_PCC5, "CLK2_REQ PCC5"),
526 PINCTRL_PIN(TEGRA_PIN_PEX_L2_RST_N_PCC6, "PEX_L2_RST_N PCC6"),
527 PINCTRL_PIN(TEGRA_PIN_PEX_L2_CLKREQ_N_PCC7, "PEX_L2_CLKREQ_N PCC7"),
528 PINCTRL_PIN(TEGRA_PIN_PEX_L0_PRSNT_N_PDD0, "PEX_L0_PRSNT_N PDD0"),
529 PINCTRL_PIN(TEGRA_PIN_PEX_L0_RST_N_PDD1, "PEX_L0_RST_N PDD1"),
530 PINCTRL_PIN(TEGRA_PIN_PEX_L0_CLKREQ_N_PDD2, "PEX_L0_CLKREQ_N PDD2"),
531 PINCTRL_PIN(TEGRA_PIN_PEX_WAKE_N_PDD3, "PEX_WAKE_N PDD3"),
532 PINCTRL_PIN(TEGRA_PIN_PEX_L1_PRSNT_N_PDD4, "PEX_L1_PRSNT_N PDD4"),
533 PINCTRL_PIN(TEGRA_PIN_PEX_L1_RST_N_PDD5, "PEX_L1_RST_N PDD5"),
534 PINCTRL_PIN(TEGRA_PIN_PEX_L1_CLKREQ_N_PDD6, "PEX_L1_CLKREQ_N PDD6"),
535 PINCTRL_PIN(TEGRA_PIN_PEX_L2_PRSNT_N_PDD7, "PEX_L2_PRSNT_N PDD7"),
536 PINCTRL_PIN(TEGRA_PIN_CLK3_OUT_PEE0, "CLK3_OUT PEE0"),
537 PINCTRL_PIN(TEGRA_PIN_CLK3_REQ_PEE1, "CLK3_REQ PEE1"),
538 PINCTRL_PIN(TEGRA_PIN_CLK1_REQ_PEE2, "CLK1_REQ PEE2"),
539 PINCTRL_PIN(TEGRA_PIN_HDMI_CEC_PEE3, "HDMI_CEC PEE3"),
540 PINCTRL_PIN(TEGRA_PIN_PEE4, "PEE4"),
541 PINCTRL_PIN(TEGRA_PIN_PEE5, "PEE5"),
542 PINCTRL_PIN(TEGRA_PIN_PEE6, "PEE6"),
543 PINCTRL_PIN(TEGRA_PIN_PEE7, "PEE7"),
544 PINCTRL_PIN(TEGRA_PIN_CLK_32K_IN, "CLK_32K_IN"),
545 PINCTRL_PIN(TEGRA_PIN_CORE_PWR_REQ, "CORE_PWR_REQ"),
546 PINCTRL_PIN(TEGRA_PIN_CPU_PWR_REQ, "CPU_PWR_REQ"),
547 PINCTRL_PIN(TEGRA_PIN_JTAG_TCK, "JTAG_TCK"),
548 PINCTRL_PIN(TEGRA_PIN_JTAG_TDI, "JTAG_TDI"),
549 PINCTRL_PIN(TEGRA_PIN_JTAG_TDO, "JTAG_TDO"),
550 PINCTRL_PIN(TEGRA_PIN_JTAG_TMS, "JTAG_TMS"),
551 PINCTRL_PIN(TEGRA_PIN_JTAG_TRST_N, "JTAG_TRST_N"),
552 PINCTRL_PIN(TEGRA_PIN_OWR, "OWR"),
553 PINCTRL_PIN(TEGRA_PIN_PWR_INT_N, "PWR_INT_N"),
554 PINCTRL_PIN(TEGRA_PIN_SYS_RESET_N, "SYS_RESET_N"),
555 PINCTRL_PIN(TEGRA_PIN_TEST_MODE_EN, "TEST_MODE_EN"),
556};
557
558static const unsigned clk_32k_out_pa0_pins[] = {
559 TEGRA_PIN_CLK_32K_OUT_PA0,
560};
561
562static const unsigned uart3_cts_n_pa1_pins[] = {
563 TEGRA_PIN_UART3_CTS_N_PA1,
564};
565
566static const unsigned dap2_fs_pa2_pins[] = {
567 TEGRA_PIN_DAP2_FS_PA2,
568};
569
570static const unsigned dap2_sclk_pa3_pins[] = {
571 TEGRA_PIN_DAP2_SCLK_PA3,
572};
573
574static const unsigned dap2_din_pa4_pins[] = {
575 TEGRA_PIN_DAP2_DIN_PA4,
576};
577
578static const unsigned dap2_dout_pa5_pins[] = {
579 TEGRA_PIN_DAP2_DOUT_PA5,
580};
581
582static const unsigned sdmmc3_clk_pa6_pins[] = {
583 TEGRA_PIN_SDMMC3_CLK_PA6,
584};
585
586static const unsigned sdmmc3_cmd_pa7_pins[] = {
587 TEGRA_PIN_SDMMC3_CMD_PA7,
588};
589
590static const unsigned gmi_a17_pb0_pins[] = {
591 TEGRA_PIN_GMI_A17_PB0,
592};
593
594static const unsigned gmi_a18_pb1_pins[] = {
595 TEGRA_PIN_GMI_A18_PB1,
596};
597
598static const unsigned lcd_pwr0_pb2_pins[] = {
599 TEGRA_PIN_LCD_PWR0_PB2,
600};
601
602static const unsigned lcd_pclk_pb3_pins[] = {
603 TEGRA_PIN_LCD_PCLK_PB3,
604};
605
606static const unsigned sdmmc3_dat3_pb4_pins[] = {
607 TEGRA_PIN_SDMMC3_DAT3_PB4,
608};
609
610static const unsigned sdmmc3_dat2_pb5_pins[] = {
611 TEGRA_PIN_SDMMC3_DAT2_PB5,
612};
613
614static const unsigned sdmmc3_dat1_pb6_pins[] = {
615 TEGRA_PIN_SDMMC3_DAT1_PB6,
616};
617
618static const unsigned sdmmc3_dat0_pb7_pins[] = {
619 TEGRA_PIN_SDMMC3_DAT0_PB7,
620};
621
622static const unsigned uart3_rts_n_pc0_pins[] = {
623 TEGRA_PIN_UART3_RTS_N_PC0,
624};
625
626static const unsigned lcd_pwr1_pc1_pins[] = {
627 TEGRA_PIN_LCD_PWR1_PC1,
628};
629
630static const unsigned uart2_txd_pc2_pins[] = {
631 TEGRA_PIN_UART2_TXD_PC2,
632};
633
634static const unsigned uart2_rxd_pc3_pins[] = {
635 TEGRA_PIN_UART2_RXD_PC3,
636};
637
638static const unsigned gen1_i2c_scl_pc4_pins[] = {
639 TEGRA_PIN_GEN1_I2C_SCL_PC4,
640};
641
642static const unsigned gen1_i2c_sda_pc5_pins[] = {
643 TEGRA_PIN_GEN1_I2C_SDA_PC5,
644};
645
646static const unsigned lcd_pwr2_pc6_pins[] = {
647 TEGRA_PIN_LCD_PWR2_PC6,
648};
649
650static const unsigned gmi_wp_n_pc7_pins[] = {
651 TEGRA_PIN_GMI_WP_N_PC7,
652};
653
654static const unsigned sdmmc3_dat5_pd0_pins[] = {
655 TEGRA_PIN_SDMMC3_DAT5_PD0,
656};
657
658static const unsigned sdmmc3_dat4_pd1_pins[] = {
659 TEGRA_PIN_SDMMC3_DAT4_PD1,
660};
661
662static const unsigned lcd_dc1_pd2_pins[] = {
663 TEGRA_PIN_LCD_DC1_PD2,
664};
665
666static const unsigned sdmmc3_dat6_pd3_pins[] = {
667 TEGRA_PIN_SDMMC3_DAT6_PD3,
668};
669
670static const unsigned sdmmc3_dat7_pd4_pins[] = {
671 TEGRA_PIN_SDMMC3_DAT7_PD4,
672};
673
674static const unsigned vi_d1_pd5_pins[] = {
675 TEGRA_PIN_VI_D1_PD5,
676};
677
678static const unsigned vi_vsync_pd6_pins[] = {
679 TEGRA_PIN_VI_VSYNC_PD6,
680};
681
682static const unsigned vi_hsync_pd7_pins[] = {
683 TEGRA_PIN_VI_HSYNC_PD7,
684};
685
686static const unsigned lcd_d0_pe0_pins[] = {
687 TEGRA_PIN_LCD_D0_PE0,
688};
689
690static const unsigned lcd_d1_pe1_pins[] = {
691 TEGRA_PIN_LCD_D1_PE1,
692};
693
694static const unsigned lcd_d2_pe2_pins[] = {
695 TEGRA_PIN_LCD_D2_PE2,
696};
697
698static const unsigned lcd_d3_pe3_pins[] = {
699 TEGRA_PIN_LCD_D3_PE3,
700};
701
702static const unsigned lcd_d4_pe4_pins[] = {
703 TEGRA_PIN_LCD_D4_PE4,
704};
705
706static const unsigned lcd_d5_pe5_pins[] = {
707 TEGRA_PIN_LCD_D5_PE5,
708};
709
710static const unsigned lcd_d6_pe6_pins[] = {
711 TEGRA_PIN_LCD_D6_PE6,
712};
713
714static const unsigned lcd_d7_pe7_pins[] = {
715 TEGRA_PIN_LCD_D7_PE7,
716};
717
718static const unsigned lcd_d8_pf0_pins[] = {
719 TEGRA_PIN_LCD_D8_PF0,
720};
721
722static const unsigned lcd_d9_pf1_pins[] = {
723 TEGRA_PIN_LCD_D9_PF1,
724};
725
726static const unsigned lcd_d10_pf2_pins[] = {
727 TEGRA_PIN_LCD_D10_PF2,
728};
729
730static const unsigned lcd_d11_pf3_pins[] = {
731 TEGRA_PIN_LCD_D11_PF3,
732};
733
734static const unsigned lcd_d12_pf4_pins[] = {
735 TEGRA_PIN_LCD_D12_PF4,
736};
737
738static const unsigned lcd_d13_pf5_pins[] = {
739 TEGRA_PIN_LCD_D13_PF5,
740};
741
742static const unsigned lcd_d14_pf6_pins[] = {
743 TEGRA_PIN_LCD_D14_PF6,
744};
745
746static const unsigned lcd_d15_pf7_pins[] = {
747 TEGRA_PIN_LCD_D15_PF7,
748};
749
750static const unsigned gmi_ad0_pg0_pins[] = {
751 TEGRA_PIN_GMI_AD0_PG0,
752};
753
754static const unsigned gmi_ad1_pg1_pins[] = {
755 TEGRA_PIN_GMI_AD1_PG1,
756};
757
758static const unsigned gmi_ad2_pg2_pins[] = {
759 TEGRA_PIN_GMI_AD2_PG2,
760};
761
762static const unsigned gmi_ad3_pg3_pins[] = {
763 TEGRA_PIN_GMI_AD3_PG3,
764};
765
766static const unsigned gmi_ad4_pg4_pins[] = {
767 TEGRA_PIN_GMI_AD4_PG4,
768};
769
770static const unsigned gmi_ad5_pg5_pins[] = {
771 TEGRA_PIN_GMI_AD5_PG5,
772};
773
774static const unsigned gmi_ad6_pg6_pins[] = {
775 TEGRA_PIN_GMI_AD6_PG6,
776};
777
778static const unsigned gmi_ad7_pg7_pins[] = {
779 TEGRA_PIN_GMI_AD7_PG7,
780};
781
782static const unsigned gmi_ad8_ph0_pins[] = {
783 TEGRA_PIN_GMI_AD8_PH0,
784};
785
786static const unsigned gmi_ad9_ph1_pins[] = {
787 TEGRA_PIN_GMI_AD9_PH1,
788};
789
790static const unsigned gmi_ad10_ph2_pins[] = {
791 TEGRA_PIN_GMI_AD10_PH2,
792};
793
794static const unsigned gmi_ad11_ph3_pins[] = {
795 TEGRA_PIN_GMI_AD11_PH3,
796};
797
798static const unsigned gmi_ad12_ph4_pins[] = {
799 TEGRA_PIN_GMI_AD12_PH4,
800};
801
802static const unsigned gmi_ad13_ph5_pins[] = {
803 TEGRA_PIN_GMI_AD13_PH5,
804};
805
806static const unsigned gmi_ad14_ph6_pins[] = {
807 TEGRA_PIN_GMI_AD14_PH6,
808};
809
810static const unsigned gmi_ad15_ph7_pins[] = {
811 TEGRA_PIN_GMI_AD15_PH7,
812};
813
814static const unsigned gmi_wr_n_pi0_pins[] = {
815 TEGRA_PIN_GMI_WR_N_PI0,
816};
817
818static const unsigned gmi_oe_n_pi1_pins[] = {
819 TEGRA_PIN_GMI_OE_N_PI1,
820};
821
822static const unsigned gmi_dqs_pi2_pins[] = {
823 TEGRA_PIN_GMI_DQS_PI2,
824};
825
826static const unsigned gmi_cs6_n_pi3_pins[] = {
827 TEGRA_PIN_GMI_CS6_N_PI3,
828};
829
830static const unsigned gmi_rst_n_pi4_pins[] = {
831 TEGRA_PIN_GMI_RST_N_PI4,
832};
833
834static const unsigned gmi_iordy_pi5_pins[] = {
835 TEGRA_PIN_GMI_IORDY_PI5,
836};
837
838static const unsigned gmi_cs7_n_pi6_pins[] = {
839 TEGRA_PIN_GMI_CS7_N_PI6,
840};
841
842static const unsigned gmi_wait_pi7_pins[] = {
843 TEGRA_PIN_GMI_WAIT_PI7,
844};
845
846static const unsigned gmi_cs0_n_pj0_pins[] = {
847 TEGRA_PIN_GMI_CS0_N_PJ0,
848};
849
850static const unsigned lcd_de_pj1_pins[] = {
851 TEGRA_PIN_LCD_DE_PJ1,
852};
853
854static const unsigned gmi_cs1_n_pj2_pins[] = {
855 TEGRA_PIN_GMI_CS1_N_PJ2,
856};
857
858static const unsigned lcd_hsync_pj3_pins[] = {
859 TEGRA_PIN_LCD_HSYNC_PJ3,
860};
861
862static const unsigned lcd_vsync_pj4_pins[] = {
863 TEGRA_PIN_LCD_VSYNC_PJ4,
864};
865
866static const unsigned uart2_cts_n_pj5_pins[] = {
867 TEGRA_PIN_UART2_CTS_N_PJ5,
868};
869
870static const unsigned uart2_rts_n_pj6_pins[] = {
871 TEGRA_PIN_UART2_RTS_N_PJ6,
872};
873
874static const unsigned gmi_a16_pj7_pins[] = {
875 TEGRA_PIN_GMI_A16_PJ7,
876};
877
878static const unsigned gmi_adv_n_pk0_pins[] = {
879 TEGRA_PIN_GMI_ADV_N_PK0,
880};
881
882static const unsigned gmi_clk_pk1_pins[] = {
883 TEGRA_PIN_GMI_CLK_PK1,
884};
885
886static const unsigned gmi_cs4_n_pk2_pins[] = {
887 TEGRA_PIN_GMI_CS4_N_PK2,
888};
889
890static const unsigned gmi_cs2_n_pk3_pins[] = {
891 TEGRA_PIN_GMI_CS2_N_PK3,
892};
893
894static const unsigned gmi_cs3_n_pk4_pins[] = {
895 TEGRA_PIN_GMI_CS3_N_PK4,
896};
897
898static const unsigned spdif_out_pk5_pins[] = {
899 TEGRA_PIN_SPDIF_OUT_PK5,
900};
901
902static const unsigned spdif_in_pk6_pins[] = {
903 TEGRA_PIN_SPDIF_IN_PK6,
904};
905
906static const unsigned gmi_a19_pk7_pins[] = {
907 TEGRA_PIN_GMI_A19_PK7,
908};
909
910static const unsigned vi_d2_pl0_pins[] = {
911 TEGRA_PIN_VI_D2_PL0,
912};
913
914static const unsigned vi_d3_pl1_pins[] = {
915 TEGRA_PIN_VI_D3_PL1,
916};
917
918static const unsigned vi_d4_pl2_pins[] = {
919 TEGRA_PIN_VI_D4_PL2,
920};
921
922static const unsigned vi_d5_pl3_pins[] = {
923 TEGRA_PIN_VI_D5_PL3,
924};
925
926static const unsigned vi_d6_pl4_pins[] = {
927 TEGRA_PIN_VI_D6_PL4,
928};
929
930static const unsigned vi_d7_pl5_pins[] = {
931 TEGRA_PIN_VI_D7_PL5,
932};
933
934static const unsigned vi_d8_pl6_pins[] = {
935 TEGRA_PIN_VI_D8_PL6,
936};
937
938static const unsigned vi_d9_pl7_pins[] = {
939 TEGRA_PIN_VI_D9_PL7,
940};
941
942static const unsigned lcd_d16_pm0_pins[] = {
943 TEGRA_PIN_LCD_D16_PM0,
944};
945
946static const unsigned lcd_d17_pm1_pins[] = {
947 TEGRA_PIN_LCD_D17_PM1,
948};
949
950static const unsigned lcd_d18_pm2_pins[] = {
951 TEGRA_PIN_LCD_D18_PM2,
952};
953
954static const unsigned lcd_d19_pm3_pins[] = {
955 TEGRA_PIN_LCD_D19_PM3,
956};
957
958static const unsigned lcd_d20_pm4_pins[] = {
959 TEGRA_PIN_LCD_D20_PM4,
960};
961
962static const unsigned lcd_d21_pm5_pins[] = {
963 TEGRA_PIN_LCD_D21_PM5,
964};
965
966static const unsigned lcd_d22_pm6_pins[] = {
967 TEGRA_PIN_LCD_D22_PM6,
968};
969
970static const unsigned lcd_d23_pm7_pins[] = {
971 TEGRA_PIN_LCD_D23_PM7,
972};
973
974static const unsigned dap1_fs_pn0_pins[] = {
975 TEGRA_PIN_DAP1_FS_PN0,
976};
977
978static const unsigned dap1_din_pn1_pins[] = {
979 TEGRA_PIN_DAP1_DIN_PN1,
980};
981
982static const unsigned dap1_dout_pn2_pins[] = {
983 TEGRA_PIN_DAP1_DOUT_PN2,
984};
985
986static const unsigned dap1_sclk_pn3_pins[] = {
987 TEGRA_PIN_DAP1_SCLK_PN3,
988};
989
990static const unsigned lcd_cs0_n_pn4_pins[] = {
991 TEGRA_PIN_LCD_CS0_N_PN4,
992};
993
994static const unsigned lcd_sdout_pn5_pins[] = {
995 TEGRA_PIN_LCD_SDOUT_PN5,
996};
997
998static const unsigned lcd_dc0_pn6_pins[] = {
999 TEGRA_PIN_LCD_DC0_PN6,
1000};
1001
1002static const unsigned hdmi_int_pn7_pins[] = {
1003 TEGRA_PIN_HDMI_INT_PN7,
1004};
1005
1006static const unsigned ulpi_data7_po0_pins[] = {
1007 TEGRA_PIN_ULPI_DATA7_PO0,
1008};
1009
1010static const unsigned ulpi_data0_po1_pins[] = {
1011 TEGRA_PIN_ULPI_DATA0_PO1,
1012};
1013
1014static const unsigned ulpi_data1_po2_pins[] = {
1015 TEGRA_PIN_ULPI_DATA1_PO2,
1016};
1017
1018static const unsigned ulpi_data2_po3_pins[] = {
1019 TEGRA_PIN_ULPI_DATA2_PO3,
1020};
1021
1022static const unsigned ulpi_data3_po4_pins[] = {
1023 TEGRA_PIN_ULPI_DATA3_PO4,
1024};
1025
1026static const unsigned ulpi_data4_po5_pins[] = {
1027 TEGRA_PIN_ULPI_DATA4_PO5,
1028};
1029
1030static const unsigned ulpi_data5_po6_pins[] = {
1031 TEGRA_PIN_ULPI_DATA5_PO6,
1032};
1033
1034static const unsigned ulpi_data6_po7_pins[] = {
1035 TEGRA_PIN_ULPI_DATA6_PO7,
1036};
1037
1038static const unsigned dap3_fs_pp0_pins[] = {
1039 TEGRA_PIN_DAP3_FS_PP0,
1040};
1041
1042static const unsigned dap3_din_pp1_pins[] = {
1043 TEGRA_PIN_DAP3_DIN_PP1,
1044};
1045
1046static const unsigned dap3_dout_pp2_pins[] = {
1047 TEGRA_PIN_DAP3_DOUT_PP2,
1048};
1049
1050static const unsigned dap3_sclk_pp3_pins[] = {
1051 TEGRA_PIN_DAP3_SCLK_PP3,
1052};
1053
1054static const unsigned dap4_fs_pp4_pins[] = {
1055 TEGRA_PIN_DAP4_FS_PP4,
1056};
1057
1058static const unsigned dap4_din_pp5_pins[] = {
1059 TEGRA_PIN_DAP4_DIN_PP5,
1060};
1061
1062static const unsigned dap4_dout_pp6_pins[] = {
1063 TEGRA_PIN_DAP4_DOUT_PP6,
1064};
1065
1066static const unsigned dap4_sclk_pp7_pins[] = {
1067 TEGRA_PIN_DAP4_SCLK_PP7,
1068};
1069
1070static const unsigned kb_col0_pq0_pins[] = {
1071 TEGRA_PIN_KB_COL0_PQ0,
1072};
1073
1074static const unsigned kb_col1_pq1_pins[] = {
1075 TEGRA_PIN_KB_COL1_PQ1,
1076};
1077
1078static const unsigned kb_col2_pq2_pins[] = {
1079 TEGRA_PIN_KB_COL2_PQ2,
1080};
1081
1082static const unsigned kb_col3_pq3_pins[] = {
1083 TEGRA_PIN_KB_COL3_PQ3,
1084};
1085
1086static const unsigned kb_col4_pq4_pins[] = {
1087 TEGRA_PIN_KB_COL4_PQ4,
1088};
1089
1090static const unsigned kb_col5_pq5_pins[] = {
1091 TEGRA_PIN_KB_COL5_PQ5,
1092};
1093
1094static const unsigned kb_col6_pq6_pins[] = {
1095 TEGRA_PIN_KB_COL6_PQ6,
1096};
1097
1098static const unsigned kb_col7_pq7_pins[] = {
1099 TEGRA_PIN_KB_COL7_PQ7,
1100};
1101
1102static const unsigned kb_row0_pr0_pins[] = {
1103 TEGRA_PIN_KB_ROW0_PR0,
1104};
1105
1106static const unsigned kb_row1_pr1_pins[] = {
1107 TEGRA_PIN_KB_ROW1_PR1,
1108};
1109
1110static const unsigned kb_row2_pr2_pins[] = {
1111 TEGRA_PIN_KB_ROW2_PR2,
1112};
1113
1114static const unsigned kb_row3_pr3_pins[] = {
1115 TEGRA_PIN_KB_ROW3_PR3,
1116};
1117
1118static const unsigned kb_row4_pr4_pins[] = {
1119 TEGRA_PIN_KB_ROW4_PR4,
1120};
1121
1122static const unsigned kb_row5_pr5_pins[] = {
1123 TEGRA_PIN_KB_ROW5_PR5,
1124};
1125
1126static const unsigned kb_row6_pr6_pins[] = {
1127 TEGRA_PIN_KB_ROW6_PR6,
1128};
1129
1130static const unsigned kb_row7_pr7_pins[] = {
1131 TEGRA_PIN_KB_ROW7_PR7,
1132};
1133
1134static const unsigned kb_row8_ps0_pins[] = {
1135 TEGRA_PIN_KB_ROW8_PS0,
1136};
1137
1138static const unsigned kb_row9_ps1_pins[] = {
1139 TEGRA_PIN_KB_ROW9_PS1,
1140};
1141
1142static const unsigned kb_row10_ps2_pins[] = {
1143 TEGRA_PIN_KB_ROW10_PS2,
1144};
1145
1146static const unsigned kb_row11_ps3_pins[] = {
1147 TEGRA_PIN_KB_ROW11_PS3,
1148};
1149
1150static const unsigned kb_row12_ps4_pins[] = {
1151 TEGRA_PIN_KB_ROW12_PS4,
1152};
1153
1154static const unsigned kb_row13_ps5_pins[] = {
1155 TEGRA_PIN_KB_ROW13_PS5,
1156};
1157
1158static const unsigned kb_row14_ps6_pins[] = {
1159 TEGRA_PIN_KB_ROW14_PS6,
1160};
1161
1162static const unsigned kb_row15_ps7_pins[] = {
1163 TEGRA_PIN_KB_ROW15_PS7,
1164};
1165
1166static const unsigned vi_pclk_pt0_pins[] = {
1167 TEGRA_PIN_VI_PCLK_PT0,
1168};
1169
1170static const unsigned vi_mclk_pt1_pins[] = {
1171 TEGRA_PIN_VI_MCLK_PT1,
1172};
1173
1174static const unsigned vi_d10_pt2_pins[] = {
1175 TEGRA_PIN_VI_D10_PT2,
1176};
1177
1178static const unsigned vi_d11_pt3_pins[] = {
1179 TEGRA_PIN_VI_D11_PT3,
1180};
1181
1182static const unsigned vi_d0_pt4_pins[] = {
1183 TEGRA_PIN_VI_D0_PT4,
1184};
1185
1186static const unsigned gen2_i2c_scl_pt5_pins[] = {
1187 TEGRA_PIN_GEN2_I2C_SCL_PT5,
1188};
1189
1190static const unsigned gen2_i2c_sda_pt6_pins[] = {
1191 TEGRA_PIN_GEN2_I2C_SDA_PT6,
1192};
1193
1194static const unsigned sdmmc4_cmd_pt7_pins[] = {
1195 TEGRA_PIN_SDMMC4_CMD_PT7,
1196};
1197
1198static const unsigned pu0_pins[] = {
1199 TEGRA_PIN_PU0,
1200};
1201
1202static const unsigned pu1_pins[] = {
1203 TEGRA_PIN_PU1,
1204};
1205
1206static const unsigned pu2_pins[] = {
1207 TEGRA_PIN_PU2,
1208};
1209
1210static const unsigned pu3_pins[] = {
1211 TEGRA_PIN_PU3,
1212};
1213
1214static const unsigned pu4_pins[] = {
1215 TEGRA_PIN_PU4,
1216};
1217
1218static const unsigned pu5_pins[] = {
1219 TEGRA_PIN_PU5,
1220};
1221
1222static const unsigned pu6_pins[] = {
1223 TEGRA_PIN_PU6,
1224};
1225
1226static const unsigned jtag_rtck_pu7_pins[] = {
1227 TEGRA_PIN_JTAG_RTCK_PU7,
1228};
1229
1230static const unsigned pv0_pins[] = {
1231 TEGRA_PIN_PV0,
1232};
1233
1234static const unsigned pv1_pins[] = {
1235 TEGRA_PIN_PV1,
1236};
1237
1238static const unsigned pv2_pins[] = {
1239 TEGRA_PIN_PV2,
1240};
1241
1242static const unsigned pv3_pins[] = {
1243 TEGRA_PIN_PV3,
1244};
1245
1246static const unsigned ddc_scl_pv4_pins[] = {
1247 TEGRA_PIN_DDC_SCL_PV4,
1248};
1249
1250static const unsigned ddc_sda_pv5_pins[] = {
1251 TEGRA_PIN_DDC_SDA_PV5,
1252};
1253
1254static const unsigned crt_hsync_pv6_pins[] = {
1255 TEGRA_PIN_CRT_HSYNC_PV6,
1256};
1257
1258static const unsigned crt_vsync_pv7_pins[] = {
1259 TEGRA_PIN_CRT_VSYNC_PV7,
1260};
1261
1262static const unsigned lcd_cs1_n_pw0_pins[] = {
1263 TEGRA_PIN_LCD_CS1_N_PW0,
1264};
1265
1266static const unsigned lcd_m1_pw1_pins[] = {
1267 TEGRA_PIN_LCD_M1_PW1,
1268};
1269
1270static const unsigned spi2_cs1_n_pw2_pins[] = {
1271 TEGRA_PIN_SPI2_CS1_N_PW2,
1272};
1273
1274static const unsigned spi2_cs2_n_pw3_pins[] = {
1275 TEGRA_PIN_SPI2_CS2_N_PW3,
1276};
1277
1278static const unsigned clk1_out_pw4_pins[] = {
1279 TEGRA_PIN_CLK1_OUT_PW4,
1280};
1281
1282static const unsigned clk2_out_pw5_pins[] = {
1283 TEGRA_PIN_CLK2_OUT_PW5,
1284};
1285
1286static const unsigned uart3_txd_pw6_pins[] = {
1287 TEGRA_PIN_UART3_TXD_PW6,
1288};
1289
1290static const unsigned uart3_rxd_pw7_pins[] = {
1291 TEGRA_PIN_UART3_RXD_PW7,
1292};
1293
1294static const unsigned spi2_mosi_px0_pins[] = {
1295 TEGRA_PIN_SPI2_MOSI_PX0,
1296};
1297
1298static const unsigned spi2_miso_px1_pins[] = {
1299 TEGRA_PIN_SPI2_MISO_PX1,
1300};
1301
1302static const unsigned spi2_sck_px2_pins[] = {
1303 TEGRA_PIN_SPI2_SCK_PX2,
1304};
1305
1306static const unsigned spi2_cs0_n_px3_pins[] = {
1307 TEGRA_PIN_SPI2_CS0_N_PX3,
1308};
1309
1310static const unsigned spi1_mosi_px4_pins[] = {
1311 TEGRA_PIN_SPI1_MOSI_PX4,
1312};
1313
1314static const unsigned spi1_sck_px5_pins[] = {
1315 TEGRA_PIN_SPI1_SCK_PX5,
1316};
1317
1318static const unsigned spi1_cs0_n_px6_pins[] = {
1319 TEGRA_PIN_SPI1_CS0_N_PX6,
1320};
1321
1322static const unsigned spi1_miso_px7_pins[] = {
1323 TEGRA_PIN_SPI1_MISO_PX7,
1324};
1325
1326static const unsigned ulpi_clk_py0_pins[] = {
1327 TEGRA_PIN_ULPI_CLK_PY0,
1328};
1329
1330static const unsigned ulpi_dir_py1_pins[] = {
1331 TEGRA_PIN_ULPI_DIR_PY1,
1332};
1333
1334static const unsigned ulpi_nxt_py2_pins[] = {
1335 TEGRA_PIN_ULPI_NXT_PY2,
1336};
1337
1338static const unsigned ulpi_stp_py3_pins[] = {
1339 TEGRA_PIN_ULPI_STP_PY3,
1340};
1341
1342static const unsigned sdmmc1_dat3_py4_pins[] = {
1343 TEGRA_PIN_SDMMC1_DAT3_PY4,
1344};
1345
1346static const unsigned sdmmc1_dat2_py5_pins[] = {
1347 TEGRA_PIN_SDMMC1_DAT2_PY5,
1348};
1349
1350static const unsigned sdmmc1_dat1_py6_pins[] = {
1351 TEGRA_PIN_SDMMC1_DAT1_PY6,
1352};
1353
1354static const unsigned sdmmc1_dat0_py7_pins[] = {
1355 TEGRA_PIN_SDMMC1_DAT0_PY7,
1356};
1357
1358static const unsigned sdmmc1_clk_pz0_pins[] = {
1359 TEGRA_PIN_SDMMC1_CLK_PZ0,
1360};
1361
1362static const unsigned sdmmc1_cmd_pz1_pins[] = {
1363 TEGRA_PIN_SDMMC1_CMD_PZ1,
1364};
1365
1366static const unsigned lcd_sdin_pz2_pins[] = {
1367 TEGRA_PIN_LCD_SDIN_PZ2,
1368};
1369
1370static const unsigned lcd_wr_n_pz3_pins[] = {
1371 TEGRA_PIN_LCD_WR_N_PZ3,
1372};
1373
1374static const unsigned lcd_sck_pz4_pins[] = {
1375 TEGRA_PIN_LCD_SCK_PZ4,
1376};
1377
1378static const unsigned sys_clk_req_pz5_pins[] = {
1379 TEGRA_PIN_SYS_CLK_REQ_PZ5,
1380};
1381
1382static const unsigned pwr_i2c_scl_pz6_pins[] = {
1383 TEGRA_PIN_PWR_I2C_SCL_PZ6,
1384};
1385
1386static const unsigned pwr_i2c_sda_pz7_pins[] = {
1387 TEGRA_PIN_PWR_I2C_SDA_PZ7,
1388};
1389
1390static const unsigned sdmmc4_dat0_paa0_pins[] = {
1391 TEGRA_PIN_SDMMC4_DAT0_PAA0,
1392};
1393
1394static const unsigned sdmmc4_dat1_paa1_pins[] = {
1395 TEGRA_PIN_SDMMC4_DAT1_PAA1,
1396};
1397
1398static const unsigned sdmmc4_dat2_paa2_pins[] = {
1399 TEGRA_PIN_SDMMC4_DAT2_PAA2,
1400};
1401
1402static const unsigned sdmmc4_dat3_paa3_pins[] = {
1403 TEGRA_PIN_SDMMC4_DAT3_PAA3,
1404};
1405
1406static const unsigned sdmmc4_dat4_paa4_pins[] = {
1407 TEGRA_PIN_SDMMC4_DAT4_PAA4,
1408};
1409
1410static const unsigned sdmmc4_dat5_paa5_pins[] = {
1411 TEGRA_PIN_SDMMC4_DAT5_PAA5,
1412};
1413
1414static const unsigned sdmmc4_dat6_paa6_pins[] = {
1415 TEGRA_PIN_SDMMC4_DAT6_PAA6,
1416};
1417
1418static const unsigned sdmmc4_dat7_paa7_pins[] = {
1419 TEGRA_PIN_SDMMC4_DAT7_PAA7,
1420};
1421
1422static const unsigned pbb0_pins[] = {
1423 TEGRA_PIN_PBB0,
1424};
1425
1426static const unsigned cam_i2c_scl_pbb1_pins[] = {
1427 TEGRA_PIN_CAM_I2C_SCL_PBB1,
1428};
1429
1430static const unsigned cam_i2c_sda_pbb2_pins[] = {
1431 TEGRA_PIN_CAM_I2C_SDA_PBB2,
1432};
1433
1434static const unsigned pbb3_pins[] = {
1435 TEGRA_PIN_PBB3,
1436};
1437
1438static const unsigned pbb4_pins[] = {
1439 TEGRA_PIN_PBB4,
1440};
1441
1442static const unsigned pbb5_pins[] = {
1443 TEGRA_PIN_PBB5,
1444};
1445
1446static const unsigned pbb6_pins[] = {
1447 TEGRA_PIN_PBB6,
1448};
1449
1450static const unsigned pbb7_pins[] = {
1451 TEGRA_PIN_PBB7,
1452};
1453
1454static const unsigned cam_mclk_pcc0_pins[] = {
1455 TEGRA_PIN_CAM_MCLK_PCC0,
1456};
1457
1458static const unsigned pcc1_pins[] = {
1459 TEGRA_PIN_PCC1,
1460};
1461
1462static const unsigned pcc2_pins[] = {
1463 TEGRA_PIN_PCC2,
1464};
1465
1466static const unsigned sdmmc4_rst_n_pcc3_pins[] = {
1467 TEGRA_PIN_SDMMC4_RST_N_PCC3,
1468};
1469
1470static const unsigned sdmmc4_clk_pcc4_pins[] = {
1471 TEGRA_PIN_SDMMC4_CLK_PCC4,
1472};
1473
1474static const unsigned clk2_req_pcc5_pins[] = {
1475 TEGRA_PIN_CLK2_REQ_PCC5,
1476};
1477
1478static const unsigned pex_l2_rst_n_pcc6_pins[] = {
1479 TEGRA_PIN_PEX_L2_RST_N_PCC6,
1480};
1481
1482static const unsigned pex_l2_clkreq_n_pcc7_pins[] = {
1483 TEGRA_PIN_PEX_L2_CLKREQ_N_PCC7,
1484};
1485
1486static const unsigned pex_l0_prsnt_n_pdd0_pins[] = {
1487 TEGRA_PIN_PEX_L0_PRSNT_N_PDD0,
1488};
1489
1490static const unsigned pex_l0_rst_n_pdd1_pins[] = {
1491 TEGRA_PIN_PEX_L0_RST_N_PDD1,
1492};
1493
1494static const unsigned pex_l0_clkreq_n_pdd2_pins[] = {
1495 TEGRA_PIN_PEX_L0_CLKREQ_N_PDD2,
1496};
1497
1498static const unsigned pex_wake_n_pdd3_pins[] = {
1499 TEGRA_PIN_PEX_WAKE_N_PDD3,
1500};
1501
1502static const unsigned pex_l1_prsnt_n_pdd4_pins[] = {
1503 TEGRA_PIN_PEX_L1_PRSNT_N_PDD4,
1504};
1505
1506static const unsigned pex_l1_rst_n_pdd5_pins[] = {
1507 TEGRA_PIN_PEX_L1_RST_N_PDD5,
1508};
1509
1510static const unsigned pex_l1_clkreq_n_pdd6_pins[] = {
1511 TEGRA_PIN_PEX_L1_CLKREQ_N_PDD6,
1512};
1513
1514static const unsigned pex_l2_prsnt_n_pdd7_pins[] = {
1515 TEGRA_PIN_PEX_L2_PRSNT_N_PDD7,
1516};
1517
1518static const unsigned clk3_out_pee0_pins[] = {
1519 TEGRA_PIN_CLK3_OUT_PEE0,
1520};
1521
1522static const unsigned clk3_req_pee1_pins[] = {
1523 TEGRA_PIN_CLK3_REQ_PEE1,
1524};
1525
1526static const unsigned clk1_req_pee2_pins[] = {
1527 TEGRA_PIN_CLK1_REQ_PEE2,
1528};
1529
1530static const unsigned hdmi_cec_pee3_pins[] = {
1531 TEGRA_PIN_HDMI_CEC_PEE3,
1532};
1533
1534static const unsigned clk_32k_in_pins[] = {
1535 TEGRA_PIN_CLK_32K_IN,
1536};
1537
1538static const unsigned core_pwr_req_pins[] = {
1539 TEGRA_PIN_CORE_PWR_REQ,
1540};
1541
1542static const unsigned cpu_pwr_req_pins[] = {
1543 TEGRA_PIN_CPU_PWR_REQ,
1544};
1545
1546static const unsigned owr_pins[] = {
1547 TEGRA_PIN_OWR,
1548};
1549
1550static const unsigned pwr_int_n_pins[] = {
1551 TEGRA_PIN_PWR_INT_N,
1552};
1553
1554static const unsigned drive_ao1_pins[] = {
1555 TEGRA_PIN_KB_ROW0_PR0,
1556 TEGRA_PIN_KB_ROW1_PR1,
1557 TEGRA_PIN_KB_ROW2_PR2,
1558 TEGRA_PIN_KB_ROW3_PR3,
1559 TEGRA_PIN_KB_ROW4_PR4,
1560 TEGRA_PIN_KB_ROW5_PR5,
1561 TEGRA_PIN_KB_ROW6_PR6,
1562 TEGRA_PIN_KB_ROW7_PR7,
1563 TEGRA_PIN_PWR_I2C_SCL_PZ6,
1564 TEGRA_PIN_PWR_I2C_SDA_PZ7,
1565 TEGRA_PIN_SYS_RESET_N,
1566};
1567
1568static const unsigned drive_ao2_pins[] = {
1569 TEGRA_PIN_CLK_32K_OUT_PA0,
1570 TEGRA_PIN_KB_COL0_PQ0,
1571 TEGRA_PIN_KB_COL1_PQ1,
1572 TEGRA_PIN_KB_COL2_PQ2,
1573 TEGRA_PIN_KB_COL3_PQ3,
1574 TEGRA_PIN_KB_COL4_PQ4,
1575 TEGRA_PIN_KB_COL5_PQ5,
1576 TEGRA_PIN_KB_COL6_PQ6,
1577 TEGRA_PIN_KB_COL7_PQ7,
1578 TEGRA_PIN_KB_ROW8_PS0,
1579 TEGRA_PIN_KB_ROW9_PS1,
1580 TEGRA_PIN_KB_ROW10_PS2,
1581 TEGRA_PIN_KB_ROW11_PS3,
1582 TEGRA_PIN_KB_ROW12_PS4,
1583 TEGRA_PIN_KB_ROW13_PS5,
1584 TEGRA_PIN_KB_ROW14_PS6,
1585 TEGRA_PIN_KB_ROW15_PS7,
1586 TEGRA_PIN_SYS_CLK_REQ_PZ5,
1587 TEGRA_PIN_CLK_32K_IN,
1588 TEGRA_PIN_CORE_PWR_REQ,
1589 TEGRA_PIN_CPU_PWR_REQ,
1590 TEGRA_PIN_PWR_INT_N,
1591};
1592
1593static const unsigned drive_at1_pins[] = {
1594 TEGRA_PIN_GMI_AD8_PH0,
1595 TEGRA_PIN_GMI_AD9_PH1,
1596 TEGRA_PIN_GMI_AD10_PH2,
1597 TEGRA_PIN_GMI_AD11_PH3,
1598 TEGRA_PIN_GMI_AD12_PH4,
1599 TEGRA_PIN_GMI_AD13_PH5,
1600 TEGRA_PIN_GMI_AD14_PH6,
1601 TEGRA_PIN_GMI_AD15_PH7,
1602 TEGRA_PIN_GMI_IORDY_PI5,
1603 TEGRA_PIN_GMI_CS7_N_PI6,
1604};
1605
1606static const unsigned drive_at2_pins[] = {
1607 TEGRA_PIN_GMI_AD0_PG0,
1608 TEGRA_PIN_GMI_AD1_PG1,
1609 TEGRA_PIN_GMI_AD2_PG2,
1610 TEGRA_PIN_GMI_AD3_PG3,
1611 TEGRA_PIN_GMI_AD4_PG4,
1612 TEGRA_PIN_GMI_AD5_PG5,
1613 TEGRA_PIN_GMI_AD6_PG6,
1614 TEGRA_PIN_GMI_AD7_PG7,
1615 TEGRA_PIN_GMI_WR_N_PI0,
1616 TEGRA_PIN_GMI_OE_N_PI1,
1617 TEGRA_PIN_GMI_DQS_PI2,
1618 TEGRA_PIN_GMI_CS6_N_PI3,
1619 TEGRA_PIN_GMI_RST_N_PI4,
1620 TEGRA_PIN_GMI_WAIT_PI7,
1621 TEGRA_PIN_GMI_ADV_N_PK0,
1622 TEGRA_PIN_GMI_CLK_PK1,
1623 TEGRA_PIN_GMI_CS4_N_PK2,
1624 TEGRA_PIN_GMI_CS2_N_PK3,
1625 TEGRA_PIN_GMI_CS3_N_PK4,
1626};
1627
1628static const unsigned drive_at3_pins[] = {
1629 TEGRA_PIN_GMI_WP_N_PC7,
1630 TEGRA_PIN_GMI_CS0_N_PJ0,
1631};
1632
1633static const unsigned drive_at4_pins[] = {
1634 TEGRA_PIN_GMI_A17_PB0,
1635 TEGRA_PIN_GMI_A18_PB1,
1636 TEGRA_PIN_GMI_CS1_N_PJ2,
1637 TEGRA_PIN_GMI_A16_PJ7,
1638 TEGRA_PIN_GMI_A19_PK7,
1639};
1640
1641static const unsigned drive_at5_pins[] = {
1642 TEGRA_PIN_GEN2_I2C_SCL_PT5,
1643 TEGRA_PIN_GEN2_I2C_SDA_PT6,
1644};
1645
1646static const unsigned drive_cdev1_pins[] = {
1647 TEGRA_PIN_CLK1_OUT_PW4,
1648 TEGRA_PIN_CLK1_REQ_PEE2,
1649};
1650
1651static const unsigned drive_cdev2_pins[] = {
1652 TEGRA_PIN_CLK2_OUT_PW5,
1653 TEGRA_PIN_CLK2_REQ_PCC5,
1654};
1655
1656static const unsigned drive_cec_pins[] = {
1657 TEGRA_PIN_HDMI_CEC_PEE3,
1658};
1659
1660static const unsigned drive_crt_pins[] = {
1661 TEGRA_PIN_CRT_HSYNC_PV6,
1662 TEGRA_PIN_CRT_VSYNC_PV7,
1663};
1664
1665static const unsigned drive_csus_pins[] = {
1666 TEGRA_PIN_VI_MCLK_PT1,
1667};
1668
1669static const unsigned drive_dap1_pins[] = {
1670 TEGRA_PIN_SPDIF_OUT_PK5,
1671 TEGRA_PIN_SPDIF_IN_PK6,
1672 TEGRA_PIN_DAP1_FS_PN0,
1673 TEGRA_PIN_DAP1_DIN_PN1,
1674 TEGRA_PIN_DAP1_DOUT_PN2,
1675 TEGRA_PIN_DAP1_SCLK_PN3,
1676};
1677
1678static const unsigned drive_dap2_pins[] = {
1679 TEGRA_PIN_DAP2_FS_PA2,
1680 TEGRA_PIN_DAP2_SCLK_PA3,
1681 TEGRA_PIN_DAP2_DIN_PA4,
1682 TEGRA_PIN_DAP2_DOUT_PA5,
1683};
1684
1685static const unsigned drive_dap3_pins[] = {
1686 TEGRA_PIN_DAP3_FS_PP0,
1687 TEGRA_PIN_DAP3_DIN_PP1,
1688 TEGRA_PIN_DAP3_DOUT_PP2,
1689 TEGRA_PIN_DAP3_SCLK_PP3,
1690};
1691
1692static const unsigned drive_dap4_pins[] = {
1693 TEGRA_PIN_DAP4_FS_PP4,
1694 TEGRA_PIN_DAP4_DIN_PP5,
1695 TEGRA_PIN_DAP4_DOUT_PP6,
1696 TEGRA_PIN_DAP4_SCLK_PP7,
1697};
1698
1699static const unsigned drive_dbg_pins[] = {
1700 TEGRA_PIN_GEN1_I2C_SCL_PC4,
1701 TEGRA_PIN_GEN1_I2C_SDA_PC5,
1702 TEGRA_PIN_PU0,
1703 TEGRA_PIN_PU1,
1704 TEGRA_PIN_PU2,
1705 TEGRA_PIN_PU3,
1706 TEGRA_PIN_PU4,
1707 TEGRA_PIN_PU5,
1708 TEGRA_PIN_PU6,
1709 TEGRA_PIN_JTAG_RTCK_PU7,
1710 TEGRA_PIN_JTAG_TCK,
1711 TEGRA_PIN_JTAG_TDI,
1712 TEGRA_PIN_JTAG_TDO,
1713 TEGRA_PIN_JTAG_TMS,
1714 TEGRA_PIN_JTAG_TRST_N,
1715 TEGRA_PIN_TEST_MODE_EN,
1716};
1717
1718static const unsigned drive_ddc_pins[] = {
1719 TEGRA_PIN_DDC_SCL_PV4,
1720 TEGRA_PIN_DDC_SDA_PV5,
1721};
1722
1723static const unsigned drive_dev3_pins[] = {
1724 TEGRA_PIN_CLK3_OUT_PEE0,
1725 TEGRA_PIN_CLK3_REQ_PEE1,
1726};
1727
1728static const unsigned drive_gma_pins[] = {
1729 TEGRA_PIN_SDMMC4_DAT0_PAA0,
1730 TEGRA_PIN_SDMMC4_DAT1_PAA1,
1731 TEGRA_PIN_SDMMC4_DAT2_PAA2,
1732 TEGRA_PIN_SDMMC4_DAT3_PAA3,
1733 TEGRA_PIN_SDMMC4_RST_N_PCC3,
1734};
1735
1736static const unsigned drive_gmb_pins[] = {
1737 TEGRA_PIN_SDMMC4_DAT4_PAA4,
1738 TEGRA_PIN_SDMMC4_DAT5_PAA5,
1739 TEGRA_PIN_SDMMC4_DAT6_PAA6,
1740 TEGRA_PIN_SDMMC4_DAT7_PAA7,
1741};
1742
1743static const unsigned drive_gmc_pins[] = {
1744 TEGRA_PIN_SDMMC4_CLK_PCC4,
1745};
1746
1747static const unsigned drive_gmd_pins[] = {
1748 TEGRA_PIN_SDMMC4_CMD_PT7,
1749};
1750
1751static const unsigned drive_gme_pins[] = {
1752 TEGRA_PIN_PBB0,
1753 TEGRA_PIN_CAM_I2C_SCL_PBB1,
1754 TEGRA_PIN_CAM_I2C_SDA_PBB2,
1755 TEGRA_PIN_PBB3,
1756 TEGRA_PIN_PCC2,
1757};
1758
1759static const unsigned drive_gmf_pins[] = {
1760 TEGRA_PIN_PBB4,
1761 TEGRA_PIN_PBB5,
1762 TEGRA_PIN_PBB6,
1763 TEGRA_PIN_PBB7,
1764};
1765
1766static const unsigned drive_gmg_pins[] = {
1767 TEGRA_PIN_CAM_MCLK_PCC0,
1768};
1769
1770static const unsigned drive_gmh_pins[] = {
1771 TEGRA_PIN_PCC1,
1772};
1773
1774static const unsigned drive_gpv_pins[] = {
1775 TEGRA_PIN_PEX_L2_RST_N_PCC6,
1776 TEGRA_PIN_PEX_L2_CLKREQ_N_PCC7,
1777 TEGRA_PIN_PEX_L0_PRSNT_N_PDD0,
1778 TEGRA_PIN_PEX_L0_RST_N_PDD1,
1779 TEGRA_PIN_PEX_L0_CLKREQ_N_PDD2,
1780 TEGRA_PIN_PEX_WAKE_N_PDD3,
1781 TEGRA_PIN_PEX_L1_PRSNT_N_PDD4,
1782 TEGRA_PIN_PEX_L1_RST_N_PDD5,
1783 TEGRA_PIN_PEX_L1_CLKREQ_N_PDD6,
1784 TEGRA_PIN_PEX_L2_PRSNT_N_PDD7,
1785};
1786
1787static const unsigned drive_lcd1_pins[] = {
1788 TEGRA_PIN_LCD_PWR1_PC1,
1789 TEGRA_PIN_LCD_PWR2_PC6,
1790 TEGRA_PIN_LCD_CS0_N_PN4,
1791 TEGRA_PIN_LCD_SDOUT_PN5,
1792 TEGRA_PIN_LCD_DC0_PN6,
1793 TEGRA_PIN_LCD_SDIN_PZ2,
1794 TEGRA_PIN_LCD_WR_N_PZ3,
1795 TEGRA_PIN_LCD_SCK_PZ4,
1796};
1797
1798static const unsigned drive_lcd2_pins[] = {
1799 TEGRA_PIN_LCD_PWR0_PB2,
1800 TEGRA_PIN_LCD_PCLK_PB3,
1801 TEGRA_PIN_LCD_DC1_PD2,
1802 TEGRA_PIN_LCD_D0_PE0,
1803 TEGRA_PIN_LCD_D1_PE1,
1804 TEGRA_PIN_LCD_D2_PE2,
1805 TEGRA_PIN_LCD_D3_PE3,
1806 TEGRA_PIN_LCD_D4_PE4,
1807 TEGRA_PIN_LCD_D5_PE5,
1808 TEGRA_PIN_LCD_D6_PE6,
1809 TEGRA_PIN_LCD_D7_PE7,
1810 TEGRA_PIN_LCD_D8_PF0,
1811 TEGRA_PIN_LCD_D9_PF1,
1812 TEGRA_PIN_LCD_D10_PF2,
1813 TEGRA_PIN_LCD_D11_PF3,
1814 TEGRA_PIN_LCD_D12_PF4,
1815 TEGRA_PIN_LCD_D13_PF5,
1816 TEGRA_PIN_LCD_D14_PF6,
1817 TEGRA_PIN_LCD_D15_PF7,
1818 TEGRA_PIN_LCD_DE_PJ1,
1819 TEGRA_PIN_LCD_HSYNC_PJ3,
1820 TEGRA_PIN_LCD_VSYNC_PJ4,
1821 TEGRA_PIN_LCD_D16_PM0,
1822 TEGRA_PIN_LCD_D17_PM1,
1823 TEGRA_PIN_LCD_D18_PM2,
1824 TEGRA_PIN_LCD_D19_PM3,
1825 TEGRA_PIN_LCD_D20_PM4,
1826 TEGRA_PIN_LCD_D21_PM5,
1827 TEGRA_PIN_LCD_D22_PM6,
1828 TEGRA_PIN_LCD_D23_PM7,
1829 TEGRA_PIN_HDMI_INT_PN7,
1830 TEGRA_PIN_LCD_CS1_N_PW0,
1831 TEGRA_PIN_LCD_M1_PW1,
1832};
1833
1834static const unsigned drive_owr_pins[] = {
1835 TEGRA_PIN_OWR,
1836};
1837
1838static const unsigned drive_sdio1_pins[] = {
1839 TEGRA_PIN_SDMMC1_DAT3_PY4,
1840 TEGRA_PIN_SDMMC1_DAT2_PY5,
1841 TEGRA_PIN_SDMMC1_DAT1_PY6,
1842 TEGRA_PIN_SDMMC1_DAT0_PY7,
1843 TEGRA_PIN_SDMMC1_CLK_PZ0,
1844 TEGRA_PIN_SDMMC1_CMD_PZ1,
1845};
1846
1847static const unsigned drive_sdio2_pins[] = {
1848 TEGRA_PIN_SDMMC3_DAT5_PD0,
1849 TEGRA_PIN_SDMMC3_DAT4_PD1,
1850 TEGRA_PIN_SDMMC3_DAT6_PD3,
1851 TEGRA_PIN_SDMMC3_DAT7_PD4,
1852};
1853
1854static const unsigned drive_sdio3_pins[] = {
1855 TEGRA_PIN_SDMMC3_CLK_PA6,
1856 TEGRA_PIN_SDMMC3_CMD_PA7,
1857 TEGRA_PIN_SDMMC3_DAT3_PB4,
1858 TEGRA_PIN_SDMMC3_DAT2_PB5,
1859 TEGRA_PIN_SDMMC3_DAT1_PB6,
1860 TEGRA_PIN_SDMMC3_DAT0_PB7,
1861};
1862
1863static const unsigned drive_spi_pins[] = {
1864 TEGRA_PIN_SPI2_CS1_N_PW2,
1865 TEGRA_PIN_SPI2_CS2_N_PW3,
1866 TEGRA_PIN_SPI2_MOSI_PX0,
1867 TEGRA_PIN_SPI2_MISO_PX1,
1868 TEGRA_PIN_SPI2_SCK_PX2,
1869 TEGRA_PIN_SPI2_CS0_N_PX3,
1870 TEGRA_PIN_SPI1_MOSI_PX4,
1871 TEGRA_PIN_SPI1_SCK_PX5,
1872 TEGRA_PIN_SPI1_CS0_N_PX6,
1873 TEGRA_PIN_SPI1_MISO_PX7,
1874};
1875
1876static const unsigned drive_uaa_pins[] = {
1877 TEGRA_PIN_ULPI_DATA0_PO1,
1878 TEGRA_PIN_ULPI_DATA1_PO2,
1879 TEGRA_PIN_ULPI_DATA2_PO3,
1880 TEGRA_PIN_ULPI_DATA3_PO4,
1881};
1882
1883static const unsigned drive_uab_pins[] = {
1884 TEGRA_PIN_ULPI_DATA7_PO0,
1885 TEGRA_PIN_ULPI_DATA4_PO5,
1886 TEGRA_PIN_ULPI_DATA5_PO6,
1887 TEGRA_PIN_ULPI_DATA6_PO7,
1888 TEGRA_PIN_PV0,
1889 TEGRA_PIN_PV1,
1890 TEGRA_PIN_PV2,
1891 TEGRA_PIN_PV3,
1892};
1893
1894static const unsigned drive_uart2_pins[] = {
1895 TEGRA_PIN_UART2_TXD_PC2,
1896 TEGRA_PIN_UART2_RXD_PC3,
1897 TEGRA_PIN_UART2_CTS_N_PJ5,
1898 TEGRA_PIN_UART2_RTS_N_PJ6,
1899};
1900
1901static const unsigned drive_uart3_pins[] = {
1902 TEGRA_PIN_UART3_CTS_N_PA1,
1903 TEGRA_PIN_UART3_RTS_N_PC0,
1904 TEGRA_PIN_UART3_TXD_PW6,
1905 TEGRA_PIN_UART3_RXD_PW7,
1906};
1907
1908static const unsigned drive_uda_pins[] = {
1909 TEGRA_PIN_ULPI_CLK_PY0,
1910 TEGRA_PIN_ULPI_DIR_PY1,
1911 TEGRA_PIN_ULPI_NXT_PY2,
1912 TEGRA_PIN_ULPI_STP_PY3,
1913};
1914
1915static const unsigned drive_vi1_pins[] = {
1916 TEGRA_PIN_VI_D1_PD5,
1917 TEGRA_PIN_VI_VSYNC_PD6,
1918 TEGRA_PIN_VI_HSYNC_PD7,
1919 TEGRA_PIN_VI_D2_PL0,
1920 TEGRA_PIN_VI_D3_PL1,
1921 TEGRA_PIN_VI_D4_PL2,
1922 TEGRA_PIN_VI_D5_PL3,
1923 TEGRA_PIN_VI_D6_PL4,
1924 TEGRA_PIN_VI_D7_PL5,
1925 TEGRA_PIN_VI_D8_PL6,
1926 TEGRA_PIN_VI_D9_PL7,
1927 TEGRA_PIN_VI_PCLK_PT0,
1928 TEGRA_PIN_VI_D10_PT2,
1929 TEGRA_PIN_VI_D11_PT3,
1930 TEGRA_PIN_VI_D0_PT4,
1931};
1932
1933enum tegra_mux {
1934 TEGRA_MUX_BLINK,
1935 TEGRA_MUX_CEC,
1936 TEGRA_MUX_CLK_12M_OUT,
1937 TEGRA_MUX_CLK_32K_IN,
1938 TEGRA_MUX_CORE_PWR_REQ,
1939 TEGRA_MUX_CPU_PWR_REQ,
1940 TEGRA_MUX_CRT,
1941 TEGRA_MUX_DAP,
1942 TEGRA_MUX_DDR,
1943 TEGRA_MUX_DEV3,
1944 TEGRA_MUX_DISPLAYA,
1945 TEGRA_MUX_DISPLAYB,
1946 TEGRA_MUX_DTV,
1947 TEGRA_MUX_EXTPERIPH1,
1948 TEGRA_MUX_EXTPERIPH2,
1949 TEGRA_MUX_EXTPERIPH3,
1950 TEGRA_MUX_GMI,
1951 TEGRA_MUX_GMI_ALT,
1952 TEGRA_MUX_HDA,
1953 TEGRA_MUX_HDCP,
1954 TEGRA_MUX_HDMI,
1955 TEGRA_MUX_HSI,
1956 TEGRA_MUX_I2C1,
1957 TEGRA_MUX_I2C2,
1958 TEGRA_MUX_I2C3,
1959 TEGRA_MUX_I2C4,
1960 TEGRA_MUX_I2CPWR,
1961 TEGRA_MUX_I2S0,
1962 TEGRA_MUX_I2S1,
1963 TEGRA_MUX_I2S2,
1964 TEGRA_MUX_I2S3,
1965 TEGRA_MUX_I2S4,
1966 TEGRA_MUX_INVALID,
1967 TEGRA_MUX_KBC,
1968 TEGRA_MUX_MIO,
1969 TEGRA_MUX_NAND,
1970 TEGRA_MUX_NAND_ALT,
1971 TEGRA_MUX_OWR,
1972 TEGRA_MUX_PCIE,
1973 TEGRA_MUX_PWM0,
1974 TEGRA_MUX_PWM1,
1975 TEGRA_MUX_PWM2,
1976 TEGRA_MUX_PWM3,
1977 TEGRA_MUX_PWR_INT_N,
1978 TEGRA_MUX_RSVD1,
1979 TEGRA_MUX_RSVD2,
1980 TEGRA_MUX_RSVD3,
1981 TEGRA_MUX_RSVD4,
1982 TEGRA_MUX_RTCK,
1983 TEGRA_MUX_SATA,
1984 TEGRA_MUX_SDMMC1,
1985 TEGRA_MUX_SDMMC2,
1986 TEGRA_MUX_SDMMC3,
1987 TEGRA_MUX_SDMMC4,
1988 TEGRA_MUX_SPDIF,
1989 TEGRA_MUX_SPI1,
1990 TEGRA_MUX_SPI2,
1991 TEGRA_MUX_SPI2_ALT,
1992 TEGRA_MUX_SPI3,
1993 TEGRA_MUX_SPI4,
1994 TEGRA_MUX_SPI5,
1995 TEGRA_MUX_SPI6,
1996 TEGRA_MUX_SYSCLK,
1997 TEGRA_MUX_TEST,
1998 TEGRA_MUX_TRACE,
1999 TEGRA_MUX_UARTA,
2000 TEGRA_MUX_UARTB,
2001 TEGRA_MUX_UARTC,
2002 TEGRA_MUX_UARTD,
2003 TEGRA_MUX_UARTE,
2004 TEGRA_MUX_ULPI,
2005 TEGRA_MUX_VGP1,
2006 TEGRA_MUX_VGP2,
2007 TEGRA_MUX_VGP3,
2008 TEGRA_MUX_VGP4,
2009 TEGRA_MUX_VGP5,
2010 TEGRA_MUX_VGP6,
2011 TEGRA_MUX_VI,
2012 TEGRA_MUX_VI_ALT1,
2013 TEGRA_MUX_VI_ALT2,
2014 TEGRA_MUX_VI_ALT3,
2015};
2016static const char * const blink_groups[] = {
2017 "clk_32k_out_pa0",
2018};
2019
2020static const char * const cec_groups[] = {
2021 "hdmi_cec_pee3",
2022 "owr",
2023};
2024
2025static const char * const clk_12m_out_groups[] = {
2026 "pv3",
2027};
2028
2029static const char * const clk_32k_in_groups[] = {
2030 "clk_32k_in",
2031};
2032
2033static const char * const core_pwr_req_groups[] = {
2034 "core_pwr_req",
2035};
2036
2037static const char * const cpu_pwr_req_groups[] = {
2038 "cpu_pwr_req",
2039};
2040
2041static const char * const crt_groups[] = {
2042 "crt_hsync_pv6",
2043 "crt_vsync_pv7",
2044};
2045
2046static const char * const dap_groups[] = {
2047 "clk1_req_pee2",
2048 "clk2_req_pcc5",
2049};
2050
2051static const char * const ddr_groups[] = {
2052 "vi_d0_pt4",
2053 "vi_d1_pd5",
2054 "vi_d10_pt2",
2055 "vi_d11_pt3",
2056 "vi_d2_pl0",
2057 "vi_d3_pl1",
2058 "vi_d4_pl2",
2059 "vi_d5_pl3",
2060 "vi_d6_pl4",
2061 "vi_d7_pl5",
2062 "vi_d8_pl6",
2063 "vi_d9_pl7",
2064 "vi_hsync_pd7",
2065 "vi_vsync_pd6",
2066};
2067
2068static const char * const dev3_groups[] = {
2069 "clk3_req_pee1",
2070};
2071
2072static const char * const displaya_groups[] = {
2073 "dap3_din_pp1",
2074 "dap3_dout_pp2",
2075 "dap3_fs_pp0",
2076 "dap3_sclk_pp3",
2077 "pbb3",
2078 "pbb4",
2079 "pbb5",
2080 "pbb6",
2081 "lcd_cs0_n_pn4",
2082 "lcd_cs1_n_pw0",
2083 "lcd_d0_pe0",
2084 "lcd_d1_pe1",
2085 "lcd_d10_pf2",
2086 "lcd_d11_pf3",
2087 "lcd_d12_pf4",
2088 "lcd_d13_pf5",
2089 "lcd_d14_pf6",
2090 "lcd_d15_pf7",
2091 "lcd_d16_pm0",
2092 "lcd_d17_pm1",
2093 "lcd_d18_pm2",
2094 "lcd_d19_pm3",
2095 "lcd_d2_pe2",
2096 "lcd_d20_pm4",
2097 "lcd_d21_pm5",
2098 "lcd_d22_pm6",
2099 "lcd_d23_pm7",
2100 "lcd_d3_pe3",
2101 "lcd_d4_pe4",
2102 "lcd_d5_pe5",
2103 "lcd_d6_pe6",
2104 "lcd_d7_pe7",
2105 "lcd_d8_pf0",
2106 "lcd_d9_pf1",
2107 "lcd_dc0_pn6",
2108 "lcd_dc1_pd2",
2109 "lcd_de_pj1",
2110 "lcd_hsync_pj3",
2111 "lcd_m1_pw1",
2112 "lcd_pclk_pb3",
2113 "lcd_pwr0_pb2",
2114 "lcd_pwr1_pc1",
2115 "lcd_pwr2_pc6",
2116 "lcd_sck_pz4",
2117 "lcd_sdin_pz2",
2118 "lcd_sdout_pn5",
2119 "lcd_vsync_pj4",
2120 "lcd_wr_n_pz3",
2121};
2122
2123static const char * const displayb_groups[] = {
2124 "dap3_din_pp1",
2125 "dap3_dout_pp2",
2126 "dap3_fs_pp0",
2127 "dap3_sclk_pp3",
2128 "pbb3",
2129 "pbb4",
2130 "pbb5",
2131 "pbb6",
2132 "lcd_cs0_n_pn4",
2133 "lcd_cs1_n_pw0",
2134 "lcd_d0_pe0",
2135 "lcd_d1_pe1",
2136 "lcd_d10_pf2",
2137 "lcd_d11_pf3",
2138 "lcd_d12_pf4",
2139 "lcd_d13_pf5",
2140 "lcd_d14_pf6",
2141 "lcd_d15_pf7",
2142 "lcd_d16_pm0",
2143 "lcd_d17_pm1",
2144 "lcd_d18_pm2",
2145 "lcd_d19_pm3",
2146 "lcd_d2_pe2",
2147 "lcd_d20_pm4",
2148 "lcd_d21_pm5",
2149 "lcd_d22_pm6",
2150 "lcd_d23_pm7",
2151 "lcd_d3_pe3",
2152 "lcd_d4_pe4",
2153 "lcd_d5_pe5",
2154 "lcd_d6_pe6",
2155 "lcd_d7_pe7",
2156 "lcd_d8_pf0",
2157 "lcd_d9_pf1",
2158 "lcd_dc0_pn6",
2159 "lcd_dc1_pd2",
2160 "lcd_de_pj1",
2161 "lcd_hsync_pj3",
2162 "lcd_m1_pw1",
2163 "lcd_pclk_pb3",
2164 "lcd_pwr0_pb2",
2165 "lcd_pwr1_pc1",
2166 "lcd_pwr2_pc6",
2167 "lcd_sck_pz4",
2168 "lcd_sdin_pz2",
2169 "lcd_sdout_pn5",
2170 "lcd_vsync_pj4",
2171 "lcd_wr_n_pz3",
2172};
2173
2174static const char * const dtv_groups[] = {
2175 "gmi_a17_pb0",
2176 "gmi_a18_pb1",
2177 "gmi_cs0_n_pj0",
2178 "gmi_cs1_n_pj2",
2179};
2180
2181static const char * const extperiph1_groups[] = {
2182 "clk1_out_pw4",
2183};
2184
2185static const char * const extperiph2_groups[] = {
2186 "clk2_out_pw5",
2187};
2188
2189static const char * const extperiph3_groups[] = {
2190 "clk3_out_pee0",
2191};
2192
2193static const char * const gmi_groups[] = {
2194 "dap1_din_pn1",
2195 "dap1_dout_pn2",
2196 "dap1_fs_pn0",
2197 "dap1_sclk_pn3",
2198 "dap2_din_pa4",
2199 "dap2_dout_pa5",
2200 "dap2_fs_pa2",
2201 "dap2_sclk_pa3",
2202 "dap4_din_pp5",
2203 "dap4_dout_pp6",
2204 "dap4_fs_pp4",
2205 "dap4_sclk_pp7",
2206 "gen2_i2c_scl_pt5",
2207 "gen2_i2c_sda_pt6",
2208 "gmi_a16_pj7",
2209 "gmi_a17_pb0",
2210 "gmi_a18_pb1",
2211 "gmi_a19_pk7",
2212 "gmi_ad0_pg0",
2213 "gmi_ad1_pg1",
2214 "gmi_ad10_ph2",
2215 "gmi_ad11_ph3",
2216 "gmi_ad12_ph4",
2217 "gmi_ad13_ph5",
2218 "gmi_ad14_ph6",
2219 "gmi_ad15_ph7",
2220 "gmi_ad2_pg2",
2221 "gmi_ad3_pg3",
2222 "gmi_ad4_pg4",
2223 "gmi_ad5_pg5",
2224 "gmi_ad6_pg6",
2225 "gmi_ad7_pg7",
2226 "gmi_ad8_ph0",
2227 "gmi_ad9_ph1",
2228 "gmi_adv_n_pk0",
2229 "gmi_clk_pk1",
2230 "gmi_cs0_n_pj0",
2231 "gmi_cs1_n_pj2",
2232 "gmi_cs2_n_pk3",
2233 "gmi_cs3_n_pk4",
2234 "gmi_cs4_n_pk2",
2235 "gmi_cs6_n_pi3",
2236 "gmi_cs7_n_pi6",
2237 "gmi_dqs_pi2",
2238 "gmi_iordy_pi5",
2239 "gmi_oe_n_pi1",
2240 "gmi_rst_n_pi4",
2241 "gmi_wait_pi7",
2242 "gmi_wp_n_pc7",
2243 "gmi_wr_n_pi0",
2244 "pu0",
2245 "pu1",
2246 "pu2",
2247 "pu3",
2248 "pu4",
2249 "pu5",
2250 "pu6",
2251 "sdmmc4_clk_pcc4",
2252 "sdmmc4_cmd_pt7",
2253 "sdmmc4_dat0_paa0",
2254 "sdmmc4_dat1_paa1",
2255 "sdmmc4_dat2_paa2",
2256 "sdmmc4_dat3_paa3",
2257 "sdmmc4_dat4_paa4",
2258 "sdmmc4_dat5_paa5",
2259 "sdmmc4_dat6_paa6",
2260 "sdmmc4_dat7_paa7",
2261 "spi1_cs0_n_px6",
2262 "spi1_mosi_px4",
2263 "spi1_sck_px5",
2264 "spi2_cs0_n_px3",
2265 "spi2_miso_px1",
2266 "spi2_mosi_px0",
2267 "spi2_sck_px2",
2268 "uart2_cts_n_pj5",
2269 "uart2_rts_n_pj6",
2270 "uart3_cts_n_pa1",
2271 "uart3_rts_n_pc0",
2272 "uart3_rxd_pw7",
2273 "uart3_txd_pw6",
2274};
2275
2276static const char * const gmi_alt_groups[] = {
2277 "gmi_a16_pj7",
2278 "gmi_cs3_n_pk4",
2279 "gmi_cs7_n_pi6",
2280 "gmi_wp_n_pc7",
2281};
2282
2283static const char * const hda_groups[] = {
2284 "clk1_req_pee2",
2285 "dap1_din_pn1",
2286 "dap1_dout_pn2",
2287 "dap1_fs_pn0",
2288 "dap1_sclk_pn3",
2289 "dap2_din_pa4",
2290 "dap2_dout_pa5",
2291 "dap2_fs_pa2",
2292 "dap2_sclk_pa3",
2293 "pex_l0_clkreq_n_pdd2",
2294 "pex_l0_prsnt_n_pdd0",
2295 "pex_l0_rst_n_pdd1",
2296 "pex_l1_clkreq_n_pdd6",
2297 "pex_l1_prsnt_n_pdd4",
2298 "pex_l1_rst_n_pdd5",
2299 "pex_l2_clkreq_n_pcc7",
2300 "pex_l2_prsnt_n_pdd7",
2301 "pex_l2_rst_n_pcc6",
2302 "pex_wake_n_pdd3",
2303 "spdif_in_pk6",
2304};
2305
2306static const char * const hdcp_groups[] = {
2307 "gen2_i2c_scl_pt5",
2308 "gen2_i2c_sda_pt6",
2309 "lcd_pwr0_pb2",
2310 "lcd_pwr2_pc6",
2311 "lcd_sck_pz4",
2312 "lcd_sdout_pn5",
2313 "lcd_wr_n_pz3",
2314};
2315
2316static const char * const hdmi_groups[] = {
2317 "hdmi_int_pn7",
2318};
2319
2320static const char * const hsi_groups[] = {
2321 "ulpi_data0_po1",
2322 "ulpi_data1_po2",
2323 "ulpi_data2_po3",
2324 "ulpi_data3_po4",
2325 "ulpi_data4_po5",
2326 "ulpi_data5_po6",
2327 "ulpi_data6_po7",
2328 "ulpi_data7_po0",
2329};
2330
2331static const char * const i2c1_groups[] = {
2332 "gen1_i2c_scl_pc4",
2333 "gen1_i2c_sda_pc5",
2334 "spdif_in_pk6",
2335 "spdif_out_pk5",
2336 "spi2_cs1_n_pw2",
2337 "spi2_cs2_n_pw3",
2338};
2339
2340static const char * const i2c2_groups[] = {
2341 "gen2_i2c_scl_pt5",
2342 "gen2_i2c_sda_pt6",
2343};
2344
2345static const char * const i2c3_groups[] = {
2346 "cam_i2c_scl_pbb1",
2347 "cam_i2c_sda_pbb2",
2348 "sdmmc4_cmd_pt7",
2349 "sdmmc4_dat4_paa4",
2350};
2351
2352static const char * const i2c4_groups[] = {
2353 "ddc_scl_pv4",
2354 "ddc_sda_pv5",
2355};
2356
2357static const char * const i2cpwr_groups[] = {
2358 "pwr_i2c_scl_pz6",
2359 "pwr_i2c_sda_pz7",
2360};
2361
2362static const char * const i2s0_groups[] = {
2363 "dap1_din_pn1",
2364 "dap1_dout_pn2",
2365 "dap1_fs_pn0",
2366 "dap1_sclk_pn3",
2367};
2368
2369static const char * const i2s1_groups[] = {
2370 "dap2_din_pa4",
2371 "dap2_dout_pa5",
2372 "dap2_fs_pa2",
2373 "dap2_sclk_pa3",
2374};
2375
2376static const char * const i2s2_groups[] = {
2377 "dap3_din_pp1",
2378 "dap3_dout_pp2",
2379 "dap3_fs_pp0",
2380 "dap3_sclk_pp3",
2381};
2382
2383static const char * const i2s3_groups[] = {
2384 "dap4_din_pp5",
2385 "dap4_dout_pp6",
2386 "dap4_fs_pp4",
2387 "dap4_sclk_pp7",
2388};
2389
2390static const char * const i2s4_groups[] = {
2391 "pbb0",
2392 "pbb7",
2393 "pcc1",
2394 "pcc2",
2395 "sdmmc4_dat4_paa4",
2396 "sdmmc4_dat5_paa5",
2397 "sdmmc4_dat6_paa6",
2398 "sdmmc4_dat7_paa7",
2399};
2400
2401static const char * const invalid_groups[] = {
2402 "kb_row3_pr3",
2403 "sdmmc4_clk_pcc4",
2404};
2405
2406static const char * const kbc_groups[] = {
2407 "kb_col0_pq0",
2408 "kb_col1_pq1",
2409 "kb_col2_pq2",
2410 "kb_col3_pq3",
2411 "kb_col4_pq4",
2412 "kb_col5_pq5",
2413 "kb_col6_pq6",
2414 "kb_col7_pq7",
2415 "kb_row0_pr0",
2416 "kb_row1_pr1",
2417 "kb_row10_ps2",
2418 "kb_row11_ps3",
2419 "kb_row12_ps4",
2420 "kb_row13_ps5",
2421 "kb_row14_ps6",
2422 "kb_row15_ps7",
2423 "kb_row2_pr2",
2424 "kb_row3_pr3",
2425 "kb_row4_pr4",
2426 "kb_row5_pr5",
2427 "kb_row6_pr6",
2428 "kb_row7_pr7",
2429 "kb_row8_ps0",
2430 "kb_row9_ps1",
2431};
2432
2433static const char * const mio_groups[] = {
2434 "kb_col6_pq6",
2435 "kb_col7_pq7",
2436 "kb_row10_ps2",
2437 "kb_row11_ps3",
2438 "kb_row12_ps4",
2439 "kb_row13_ps5",
2440 "kb_row14_ps6",
2441 "kb_row15_ps7",
2442 "kb_row6_pr6",
2443 "kb_row7_pr7",
2444 "kb_row8_ps0",
2445 "kb_row9_ps1",
2446};
2447
2448static const char * const nand_groups[] = {
2449 "gmi_ad0_pg0",
2450 "gmi_ad1_pg1",
2451 "gmi_ad10_ph2",
2452 "gmi_ad11_ph3",
2453 "gmi_ad12_ph4",
2454 "gmi_ad13_ph5",
2455 "gmi_ad14_ph6",
2456 "gmi_ad15_ph7",
2457 "gmi_ad2_pg2",
2458 "gmi_ad3_pg3",
2459 "gmi_ad4_pg4",
2460 "gmi_ad5_pg5",
2461 "gmi_ad6_pg6",
2462 "gmi_ad7_pg7",
2463 "gmi_ad8_ph0",
2464 "gmi_ad9_ph1",
2465 "gmi_adv_n_pk0",
2466 "gmi_clk_pk1",
2467 "gmi_cs0_n_pj0",
2468 "gmi_cs1_n_pj2",
2469 "gmi_cs2_n_pk3",
2470 "gmi_cs3_n_pk4",
2471 "gmi_cs4_n_pk2",
2472 "gmi_cs6_n_pi3",
2473 "gmi_cs7_n_pi6",
2474 "gmi_dqs_pi2",
2475 "gmi_iordy_pi5",
2476 "gmi_oe_n_pi1",
2477 "gmi_rst_n_pi4",
2478 "gmi_wait_pi7",
2479 "gmi_wp_n_pc7",
2480 "gmi_wr_n_pi0",
2481 "kb_col0_pq0",
2482 "kb_col1_pq1",
2483 "kb_col2_pq2",
2484 "kb_col3_pq3",
2485 "kb_col4_pq4",
2486 "kb_col5_pq5",
2487 "kb_col6_pq6",
2488 "kb_col7_pq7",
2489 "kb_row0_pr0",
2490 "kb_row1_pr1",
2491 "kb_row10_ps2",
2492 "kb_row11_ps3",
2493 "kb_row12_ps4",
2494 "kb_row13_ps5",
2495 "kb_row14_ps6",
2496 "kb_row15_ps7",
2497 "kb_row2_pr2",
2498 "kb_row3_pr3",
2499 "kb_row4_pr4",
2500 "kb_row5_pr5",
2501 "kb_row6_pr6",
2502 "kb_row7_pr7",
2503 "kb_row8_ps0",
2504 "kb_row9_ps1",
2505 "sdmmc4_clk_pcc4",
2506 "sdmmc4_cmd_pt7",
2507};
2508
2509static const char * const nand_alt_groups[] = {
2510 "gmi_cs6_n_pi3",
2511 "gmi_cs7_n_pi6",
2512 "gmi_rst_n_pi4",
2513};
2514
2515static const char * const owr_groups[] = {
2516 "pu0",
2517 "pv2",
2518 "kb_row5_pr5",
2519 "owr",
2520};
2521
2522static const char * const pcie_groups[] = {
2523 "pex_l0_clkreq_n_pdd2",
2524 "pex_l0_prsnt_n_pdd0",
2525 "pex_l0_rst_n_pdd1",
2526 "pex_l1_clkreq_n_pdd6",
2527 "pex_l1_prsnt_n_pdd4",
2528 "pex_l1_rst_n_pdd5",
2529 "pex_l2_clkreq_n_pcc7",
2530 "pex_l2_prsnt_n_pdd7",
2531 "pex_l2_rst_n_pcc6",
2532 "pex_wake_n_pdd3",
2533};
2534
2535static const char * const pwm0_groups[] = {
2536 "gmi_ad8_ph0",
2537 "pu3",
2538 "sdmmc3_dat3_pb4",
2539 "sdmmc3_dat5_pd0",
2540 "uart3_rts_n_pc0",
2541};
2542
2543static const char * const pwm1_groups[] = {
2544 "gmi_ad9_ph1",
2545 "pu4",
2546 "sdmmc3_dat2_pb5",
2547 "sdmmc3_dat4_pd1",
2548};
2549
2550static const char * const pwm2_groups[] = {
2551 "gmi_ad10_ph2",
2552 "pu5",
2553 "sdmmc3_clk_pa6",
2554};
2555
2556static const char * const pwm3_groups[] = {
2557 "gmi_ad11_ph3",
2558 "pu6",
2559 "sdmmc3_cmd_pa7",
2560};
2561
2562static const char * const pwr_int_n_groups[] = {
2563 "pwr_int_n",
2564};
2565
2566static const char * const rsvd1_groups[] = {
2567 "gmi_ad0_pg0",
2568 "gmi_ad1_pg1",
2569 "gmi_ad12_ph4",
2570 "gmi_ad13_ph5",
2571 "gmi_ad14_ph6",
2572 "gmi_ad15_ph7",
2573 "gmi_ad2_pg2",
2574 "gmi_ad3_pg3",
2575 "gmi_ad4_pg4",
2576 "gmi_ad5_pg5",
2577 "gmi_ad6_pg6",
2578 "gmi_ad7_pg7",
2579 "gmi_adv_n_pk0",
2580 "gmi_clk_pk1",
2581 "gmi_cs0_n_pj0",
2582 "gmi_cs1_n_pj2",
2583 "gmi_cs2_n_pk3",
2584 "gmi_cs3_n_pk4",
2585 "gmi_cs4_n_pk2",
2586 "gmi_dqs_pi2",
2587 "gmi_iordy_pi5",
2588 "gmi_oe_n_pi1",
2589 "gmi_wait_pi7",
2590 "gmi_wp_n_pc7",
2591 "gmi_wr_n_pi0",
2592 "pu1",
2593 "pu2",
2594 "pv0",
2595 "pv1",
2596 "sdmmc3_dat0_pb7",
2597 "sdmmc3_dat1_pb6",
2598 "sdmmc3_dat2_pb5",
2599 "sdmmc3_dat3_pb4",
2600 "vi_pclk_pt0",
2601};
2602
2603static const char * const rsvd2_groups[] = {
2604 "clk1_out_pw4",
2605 "clk2_out_pw5",
2606 "clk2_req_pcc5",
2607 "clk3_out_pee0",
2608 "clk3_req_pee1",
2609 "clk_32k_in",
2610 "clk_32k_out_pa0",
2611 "core_pwr_req",
2612 "cpu_pwr_req",
2613 "crt_hsync_pv6",
2614 "crt_vsync_pv7",
2615 "dap3_din_pp1",
2616 "dap3_dout_pp2",
2617 "dap3_fs_pp0",
2618 "dap3_sclk_pp3",
2619 "dap4_din_pp5",
2620 "dap4_dout_pp6",
2621 "dap4_fs_pp4",
2622 "dap4_sclk_pp7",
2623 "ddc_scl_pv4",
2624 "ddc_sda_pv5",
2625 "gen1_i2c_scl_pc4",
2626 "gen1_i2c_sda_pc5",
2627 "pbb0",
2628 "pbb7",
2629 "pcc1",
2630 "pcc2",
2631 "pv0",
2632 "pv1",
2633 "pv2",
2634 "pv3",
2635 "hdmi_cec_pee3",
2636 "hdmi_int_pn7",
2637 "jtag_rtck_pu7",
2638 "pwr_i2c_scl_pz6",
2639 "pwr_i2c_sda_pz7",
2640 "pwr_int_n",
2641 "sdmmc1_clk_pz0",
2642 "sdmmc1_cmd_pz1",
2643 "sdmmc1_dat0_py7",
2644 "sdmmc1_dat1_py6",
2645 "sdmmc1_dat2_py5",
2646 "sdmmc1_dat3_py4",
2647 "sdmmc3_dat0_pb7",
2648 "sdmmc3_dat1_pb6",
2649 "sdmmc4_rst_n_pcc3",
2650 "spdif_out_pk5",
2651 "sys_clk_req_pz5",
2652 "uart3_cts_n_pa1",
2653 "uart3_rxd_pw7",
2654 "uart3_txd_pw6",
2655 "ulpi_clk_py0",
2656 "ulpi_dir_py1",
2657 "ulpi_nxt_py2",
2658 "ulpi_stp_py3",
2659 "vi_d0_pt4",
2660 "vi_d10_pt2",
2661 "vi_d11_pt3",
2662 "vi_hsync_pd7",
2663 "vi_vsync_pd6",
2664};
2665
2666static const char * const rsvd3_groups[] = {
2667 "cam_i2c_scl_pbb1",
2668 "cam_i2c_sda_pbb2",
2669 "clk1_out_pw4",
2670 "clk1_req_pee2",
2671 "clk2_out_pw5",
2672 "clk2_req_pcc5",
2673 "clk3_out_pee0",
2674 "clk3_req_pee1",
2675 "clk_32k_in",
2676 "clk_32k_out_pa0",
2677 "core_pwr_req",
2678 "cpu_pwr_req",
2679 "crt_hsync_pv6",
2680 "crt_vsync_pv7",
2681 "dap2_din_pa4",
2682 "dap2_dout_pa5",
2683 "dap2_fs_pa2",
2684 "dap2_sclk_pa3",
2685 "ddc_scl_pv4",
2686 "ddc_sda_pv5",
2687 "gen1_i2c_scl_pc4",
2688 "gen1_i2c_sda_pc5",
2689 "pbb0",
2690 "pbb7",
2691 "pcc1",
2692 "pcc2",
2693 "pv0",
2694 "pv1",
2695 "pv2",
2696 "pv3",
2697 "hdmi_cec_pee3",
2698 "hdmi_int_pn7",
2699 "jtag_rtck_pu7",
2700 "kb_row0_pr0",
2701 "kb_row1_pr1",
2702 "kb_row2_pr2",
2703 "kb_row3_pr3",
2704 "lcd_d0_pe0",
2705 "lcd_d1_pe1",
2706 "lcd_d10_pf2",
2707 "lcd_d11_pf3",
2708 "lcd_d12_pf4",
2709 "lcd_d13_pf5",
2710 "lcd_d14_pf6",
2711 "lcd_d15_pf7",
2712 "lcd_d16_pm0",
2713 "lcd_d17_pm1",
2714 "lcd_d18_pm2",
2715 "lcd_d19_pm3",
2716 "lcd_d2_pe2",
2717 "lcd_d20_pm4",
2718 "lcd_d21_pm5",
2719 "lcd_d22_pm6",
2720 "lcd_d23_pm7",
2721 "lcd_d3_pe3",
2722 "lcd_d4_pe4",
2723 "lcd_d5_pe5",
2724 "lcd_d6_pe6",
2725 "lcd_d7_pe7",
2726 "lcd_d8_pf0",
2727 "lcd_d9_pf1",
2728 "lcd_dc0_pn6",
2729 "lcd_dc1_pd2",
2730 "lcd_de_pj1",
2731 "lcd_hsync_pj3",
2732 "lcd_m1_pw1",
2733 "lcd_pclk_pb3",
2734 "lcd_pwr1_pc1",
2735 "lcd_vsync_pj4",
2736 "owr",
2737 "pex_l0_clkreq_n_pdd2",
2738 "pex_l0_prsnt_n_pdd0",
2739 "pex_l0_rst_n_pdd1",
2740 "pex_l1_clkreq_n_pdd6",
2741 "pex_l1_prsnt_n_pdd4",
2742 "pex_l1_rst_n_pdd5",
2743 "pex_l2_clkreq_n_pcc7",
2744 "pex_l2_prsnt_n_pdd7",
2745 "pex_l2_rst_n_pcc6",
2746 "pex_wake_n_pdd3",
2747 "pwr_i2c_scl_pz6",
2748 "pwr_i2c_sda_pz7",
2749 "pwr_int_n",
2750 "sdmmc1_clk_pz0",
2751 "sdmmc1_cmd_pz1",
2752 "sdmmc4_rst_n_pcc3",
2753 "sys_clk_req_pz5",
2754};
2755
2756static const char * const rsvd4_groups[] = {
2757 "clk1_out_pw4",
2758 "clk1_req_pee2",
2759 "clk2_out_pw5",
2760 "clk2_req_pcc5",
2761 "clk3_out_pee0",
2762 "clk3_req_pee1",
2763 "clk_32k_in",
2764 "clk_32k_out_pa0",
2765 "core_pwr_req",
2766 "cpu_pwr_req",
2767 "crt_hsync_pv6",
2768 "crt_vsync_pv7",
2769 "dap4_din_pp5",
2770 "dap4_dout_pp6",
2771 "dap4_fs_pp4",
2772 "dap4_sclk_pp7",
2773 "ddc_scl_pv4",
2774 "ddc_sda_pv5",
2775 "gen1_i2c_scl_pc4",
2776 "gen1_i2c_sda_pc5",
2777 "gen2_i2c_scl_pt5",
2778 "gen2_i2c_sda_pt6",
2779 "gmi_a19_pk7",
2780 "gmi_ad0_pg0",
2781 "gmi_ad1_pg1",
2782 "gmi_ad10_ph2",
2783 "gmi_ad11_ph3",
2784 "gmi_ad12_ph4",
2785 "gmi_ad13_ph5",
2786 "gmi_ad14_ph6",
2787 "gmi_ad15_ph7",
2788 "gmi_ad2_pg2",
2789 "gmi_ad3_pg3",
2790 "gmi_ad4_pg4",
2791 "gmi_ad5_pg5",
2792 "gmi_ad6_pg6",
2793 "gmi_ad7_pg7",
2794 "gmi_ad8_ph0",
2795 "gmi_ad9_ph1",
2796 "gmi_adv_n_pk0",
2797 "gmi_clk_pk1",
2798 "gmi_cs2_n_pk3",
2799 "gmi_cs4_n_pk2",
2800 "gmi_dqs_pi2",
2801 "gmi_iordy_pi5",
2802 "gmi_oe_n_pi1",
2803 "gmi_rst_n_pi4",
2804 "gmi_wait_pi7",
2805 "gmi_wr_n_pi0",
2806 "pcc2",
2807 "pu0",
2808 "pu1",
2809 "pu2",
2810 "pu3",
2811 "pu4",
2812 "pu5",
2813 "pu6",
2814 "pv0",
2815 "pv1",
2816 "pv2",
2817 "pv3",
2818 "hdmi_cec_pee3",
2819 "hdmi_int_pn7",
2820 "jtag_rtck_pu7",
2821 "kb_col2_pq2",
2822 "kb_col3_pq3",
2823 "kb_col4_pq4",
2824 "kb_col5_pq5",
2825 "kb_row0_pr0",
2826 "kb_row1_pr1",
2827 "kb_row2_pr2",
2828 "kb_row4_pr4",
2829 "lcd_cs0_n_pn4",
2830 "lcd_cs1_n_pw0",
2831 "lcd_d0_pe0",
2832 "lcd_d1_pe1",
2833 "lcd_d10_pf2",
2834 "lcd_d11_pf3",
2835 "lcd_d12_pf4",
2836 "lcd_d13_pf5",
2837 "lcd_d14_pf6",
2838 "lcd_d15_pf7",
2839 "lcd_d16_pm0",
2840 "lcd_d17_pm1",
2841 "lcd_d18_pm2",
2842 "lcd_d19_pm3",
2843 "lcd_d2_pe2",
2844 "lcd_d20_pm4",
2845 "lcd_d21_pm5",
2846 "lcd_d22_pm6",
2847 "lcd_d23_pm7",
2848 "lcd_d3_pe3",
2849 "lcd_d4_pe4",
2850 "lcd_d5_pe5",
2851 "lcd_d6_pe6",
2852 "lcd_d7_pe7",
2853 "lcd_d8_pf0",
2854 "lcd_d9_pf1",
2855 "lcd_dc0_pn6",
2856 "lcd_dc1_pd2",
2857 "lcd_de_pj1",
2858 "lcd_hsync_pj3",
2859 "lcd_m1_pw1",
2860 "lcd_pclk_pb3",
2861 "lcd_pwr1_pc1",
2862 "lcd_sdin_pz2",
2863 "lcd_vsync_pj4",
2864 "owr",
2865 "pex_l0_clkreq_n_pdd2",
2866 "pex_l0_prsnt_n_pdd0",
2867 "pex_l0_rst_n_pdd1",
2868 "pex_l1_clkreq_n_pdd6",
2869 "pex_l1_prsnt_n_pdd4",
2870 "pex_l1_rst_n_pdd5",
2871 "pex_l2_clkreq_n_pcc7",
2872 "pex_l2_prsnt_n_pdd7",
2873 "pex_l2_rst_n_pcc6",
2874 "pex_wake_n_pdd3",
2875 "pwr_i2c_scl_pz6",
2876 "pwr_i2c_sda_pz7",
2877 "pwr_int_n",
2878 "spi1_miso_px7",
2879 "sys_clk_req_pz5",
2880 "uart3_cts_n_pa1",
2881 "uart3_rts_n_pc0",
2882 "uart3_rxd_pw7",
2883 "uart3_txd_pw6",
2884 "vi_d0_pt4",
2885 "vi_d1_pd5",
2886 "vi_d10_pt2",
2887 "vi_d11_pt3",
2888 "vi_d2_pl0",
2889 "vi_d3_pl1",
2890 "vi_d4_pl2",
2891 "vi_d5_pl3",
2892 "vi_d6_pl4",
2893 "vi_d7_pl5",
2894 "vi_d8_pl6",
2895 "vi_d9_pl7",
2896 "vi_hsync_pd7",
2897 "vi_pclk_pt0",
2898 "vi_vsync_pd6",
2899};
2900
2901static const char * const rtck_groups[] = {
2902 "jtag_rtck_pu7",
2903};
2904
2905static const char * const sata_groups[] = {
2906 "gmi_cs6_n_pi3",
2907};
2908
2909static const char * const sdmmc1_groups[] = {
2910 "sdmmc1_clk_pz0",
2911 "sdmmc1_cmd_pz1",
2912 "sdmmc1_dat0_py7",
2913 "sdmmc1_dat1_py6",
2914 "sdmmc1_dat2_py5",
2915 "sdmmc1_dat3_py4",
2916};
2917
2918static const char * const sdmmc2_groups[] = {
2919 "dap1_din_pn1",
2920 "dap1_dout_pn2",
2921 "dap1_fs_pn0",
2922 "dap1_sclk_pn3",
2923 "kb_row10_ps2",
2924 "kb_row11_ps3",
2925 "kb_row12_ps4",
2926 "kb_row13_ps5",
2927 "kb_row14_ps6",
2928 "kb_row15_ps7",
2929 "kb_row6_pr6",
2930 "kb_row7_pr7",
2931 "kb_row8_ps0",
2932 "kb_row9_ps1",
2933 "spdif_in_pk6",
2934 "spdif_out_pk5",
2935 "vi_d1_pd5",
2936 "vi_d2_pl0",
2937 "vi_d3_pl1",
2938 "vi_d4_pl2",
2939 "vi_d5_pl3",
2940 "vi_d6_pl4",
2941 "vi_d7_pl5",
2942 "vi_d8_pl6",
2943 "vi_d9_pl7",
2944 "vi_pclk_pt0",
2945};
2946
2947static const char * const sdmmc3_groups[] = {
2948 "sdmmc3_clk_pa6",
2949 "sdmmc3_cmd_pa7",
2950 "sdmmc3_dat0_pb7",
2951 "sdmmc3_dat1_pb6",
2952 "sdmmc3_dat2_pb5",
2953 "sdmmc3_dat3_pb4",
2954 "sdmmc3_dat4_pd1",
2955 "sdmmc3_dat5_pd0",
2956 "sdmmc3_dat6_pd3",
2957 "sdmmc3_dat7_pd4",
2958};
2959
2960static const char * const sdmmc4_groups[] = {
2961 "cam_i2c_scl_pbb1",
2962 "cam_i2c_sda_pbb2",
2963 "cam_mclk_pcc0",
2964 "pbb0",
2965 "pbb3",
2966 "pbb4",
2967 "pbb5",
2968 "pbb6",
2969 "pbb7",
2970 "pcc1",
2971 "sdmmc4_clk_pcc4",
2972 "sdmmc4_cmd_pt7",
2973 "sdmmc4_dat0_paa0",
2974 "sdmmc4_dat1_paa1",
2975 "sdmmc4_dat2_paa2",
2976 "sdmmc4_dat3_paa3",
2977 "sdmmc4_dat4_paa4",
2978 "sdmmc4_dat5_paa5",
2979 "sdmmc4_dat6_paa6",
2980 "sdmmc4_dat7_paa7",
2981 "sdmmc4_rst_n_pcc3",
2982};
2983
2984static const char * const spdif_groups[] = {
2985 "sdmmc3_dat6_pd3",
2986 "sdmmc3_dat7_pd4",
2987 "spdif_in_pk6",
2988 "spdif_out_pk5",
2989 "uart2_rxd_pc3",
2990 "uart2_txd_pc2",
2991};
2992
2993static const char * const spi1_groups[] = {
2994 "spi1_cs0_n_px6",
2995 "spi1_miso_px7",
2996 "spi1_mosi_px4",
2997 "spi1_sck_px5",
2998 "ulpi_clk_py0",
2999 "ulpi_dir_py1",
3000 "ulpi_nxt_py2",
3001 "ulpi_stp_py3",
3002};
3003
3004static const char * const spi2_groups[] = {
3005 "sdmmc3_cmd_pa7",
3006 "sdmmc3_dat4_pd1",
3007 "sdmmc3_dat5_pd0",
3008 "sdmmc3_dat6_pd3",
3009 "sdmmc3_dat7_pd4",
3010 "spi1_cs0_n_px6",
3011 "spi1_mosi_px4",
3012 "spi1_sck_px5",
3013 "spi2_cs0_n_px3",
3014 "spi2_cs1_n_pw2",
3015 "spi2_cs2_n_pw3",
3016 "spi2_miso_px1",
3017 "spi2_mosi_px0",
3018 "spi2_sck_px2",
3019 "ulpi_data4_po5",
3020 "ulpi_data5_po6",
3021 "ulpi_data6_po7",
3022 "ulpi_data7_po0",
3023};
3024
3025static const char * const spi2_alt_groups[] = {
3026 "spi1_cs0_n_px6",
3027 "spi1_miso_px7",
3028 "spi1_mosi_px4",
3029 "spi1_sck_px5",
3030 "spi2_cs1_n_pw2",
3031 "spi2_cs2_n_pw3",
3032};
3033
3034static const char * const spi3_groups[] = {
3035 "sdmmc3_clk_pa6",
3036 "sdmmc3_dat0_pb7",
3037 "sdmmc3_dat1_pb6",
3038 "sdmmc3_dat2_pb5",
3039 "sdmmc3_dat3_pb4",
3040 "sdmmc4_dat0_paa0",
3041 "sdmmc4_dat1_paa1",
3042 "sdmmc4_dat2_paa2",
3043 "sdmmc4_dat3_paa3",
3044 "spi1_miso_px7",
3045 "spi2_cs0_n_px3",
3046 "spi2_cs1_n_pw2",
3047 "spi2_cs2_n_pw3",
3048 "spi2_miso_px1",
3049 "spi2_mosi_px0",
3050 "spi2_sck_px2",
3051 "ulpi_data0_po1",
3052 "ulpi_data1_po2",
3053 "ulpi_data2_po3",
3054 "ulpi_data3_po4",
3055};
3056
3057static const char * const spi4_groups[] = {
3058 "gmi_a16_pj7",
3059 "gmi_a17_pb0",
3060 "gmi_a18_pb1",
3061 "gmi_a19_pk7",
3062 "sdmmc3_dat4_pd1",
3063 "sdmmc3_dat5_pd0",
3064 "sdmmc3_dat6_pd3",
3065 "sdmmc3_dat7_pd4",
3066 "uart2_cts_n_pj5",
3067 "uart2_rts_n_pj6",
3068 "uart2_rxd_pc3",
3069 "uart2_txd_pc2",
3070};
3071
3072static const char * const spi5_groups[] = {
3073 "lcd_cs0_n_pn4",
3074 "lcd_cs1_n_pw0",
3075 "lcd_pwr0_pb2",
3076 "lcd_pwr2_pc6",
3077 "lcd_sck_pz4",
3078 "lcd_sdin_pz2",
3079 "lcd_sdout_pn5",
3080 "lcd_wr_n_pz3",
3081};
3082
3083static const char * const spi6_groups[] = {
3084 "spi2_cs0_n_px3",
3085 "spi2_miso_px1",
3086 "spi2_mosi_px0",
3087 "spi2_sck_px2",
3088};
3089
3090static const char * const sysclk_groups[] = {
3091 "sys_clk_req_pz5",
3092};
3093
3094static const char * const test_groups[] = {
3095 "kb_col0_pq0",
3096 "kb_col1_pq1",
3097};
3098
3099static const char * const trace_groups[] = {
3100 "kb_col0_pq0",
3101 "kb_col1_pq1",
3102 "kb_col2_pq2",
3103 "kb_col3_pq3",
3104 "kb_col4_pq4",
3105 "kb_col5_pq5",
3106 "kb_col6_pq6",
3107 "kb_col7_pq7",
3108 "kb_row4_pr4",
3109 "kb_row5_pr5",
3110};
3111
3112static const char * const uarta_groups[] = {
3113 "pu0",
3114 "pu1",
3115 "pu2",
3116 "pu3",
3117 "pu4",
3118 "pu5",
3119 "pu6",
3120 "sdmmc1_clk_pz0",
3121 "sdmmc1_cmd_pz1",
3122 "sdmmc1_dat0_py7",
3123 "sdmmc1_dat1_py6",
3124 "sdmmc1_dat2_py5",
3125 "sdmmc1_dat3_py4",
3126 "sdmmc3_clk_pa6",
3127 "sdmmc3_cmd_pa7",
3128 "uart2_cts_n_pj5",
3129 "uart2_rts_n_pj6",
3130 "uart2_rxd_pc3",
3131 "uart2_txd_pc2",
3132 "ulpi_data0_po1",
3133 "ulpi_data1_po2",
3134 "ulpi_data2_po3",
3135 "ulpi_data3_po4",
3136 "ulpi_data4_po5",
3137 "ulpi_data5_po6",
3138 "ulpi_data6_po7",
3139 "ulpi_data7_po0",
3140};
3141
3142static const char * const uartb_groups[] = {
3143 "uart2_cts_n_pj5",
3144 "uart2_rts_n_pj6",
3145 "uart2_rxd_pc3",
3146 "uart2_txd_pc2",
3147};
3148
3149static const char * const uartc_groups[] = {
3150 "uart3_cts_n_pa1",
3151 "uart3_rts_n_pc0",
3152 "uart3_rxd_pw7",
3153 "uart3_txd_pw6",
3154};
3155
3156static const char * const uartd_groups[] = {
3157 "gmi_a16_pj7",
3158 "gmi_a17_pb0",
3159 "gmi_a18_pb1",
3160 "gmi_a19_pk7",
3161 "ulpi_clk_py0",
3162 "ulpi_dir_py1",
3163 "ulpi_nxt_py2",
3164 "ulpi_stp_py3",
3165};
3166
3167static const char * const uarte_groups[] = {
3168 "sdmmc1_dat0_py7",
3169 "sdmmc1_dat1_py6",
3170 "sdmmc1_dat2_py5",
3171 "sdmmc1_dat3_py4",
3172 "sdmmc4_dat0_paa0",
3173 "sdmmc4_dat1_paa1",
3174 "sdmmc4_dat2_paa2",
3175 "sdmmc4_dat3_paa3",
3176};
3177
3178static const char * const ulpi_groups[] = {
3179 "ulpi_clk_py0",
3180 "ulpi_data0_po1",
3181 "ulpi_data1_po2",
3182 "ulpi_data2_po3",
3183 "ulpi_data3_po4",
3184 "ulpi_data4_po5",
3185 "ulpi_data5_po6",
3186 "ulpi_data6_po7",
3187 "ulpi_data7_po0",
3188 "ulpi_dir_py1",
3189 "ulpi_nxt_py2",
3190 "ulpi_stp_py3",
3191};
3192
3193static const char * const vgp1_groups[] = {
3194 "cam_i2c_scl_pbb1",
3195};
3196
3197static const char * const vgp2_groups[] = {
3198 "cam_i2c_sda_pbb2",
3199};
3200
3201static const char * const vgp3_groups[] = {
3202 "pbb3",
3203 "sdmmc4_dat5_paa5",
3204};
3205
3206static const char * const vgp4_groups[] = {
3207 "pbb4",
3208 "sdmmc4_dat6_paa6",
3209};
3210
3211static const char * const vgp5_groups[] = {
3212 "pbb5",
3213 "sdmmc4_dat7_paa7",
3214};
3215
3216static const char * const vgp6_groups[] = {
3217 "pbb6",
3218 "sdmmc4_rst_n_pcc3",
3219};
3220
3221static const char * const vi_groups[] = {
3222 "cam_mclk_pcc0",
3223 "vi_d0_pt4",
3224 "vi_d1_pd5",
3225 "vi_d10_pt2",
3226 "vi_d11_pt3",
3227 "vi_d2_pl0",
3228 "vi_d3_pl1",
3229 "vi_d4_pl2",
3230 "vi_d5_pl3",
3231 "vi_d6_pl4",
3232 "vi_d7_pl5",
3233 "vi_d8_pl6",
3234 "vi_d9_pl7",
3235 "vi_hsync_pd7",
3236 "vi_mclk_pt1",
3237 "vi_pclk_pt0",
3238 "vi_vsync_pd6",
3239};
3240
3241static const char * const vi_alt1_groups[] = {
3242 "cam_mclk_pcc0",
3243 "vi_mclk_pt1",
3244};
3245
3246static const char * const vi_alt2_groups[] = {
3247 "vi_mclk_pt1",
3248};
3249
3250static const char * const vi_alt3_groups[] = {
3251 "cam_mclk_pcc0",
3252 "vi_mclk_pt1",
3253};
3254
3255#define FUNCTION(fname) \
3256 { \
3257 .name = #fname, \
3258 .groups = fname##_groups, \
3259 .ngroups = ARRAY_SIZE(fname##_groups), \
3260 }
3261
3262static const struct tegra_function tegra30_functions[] = {
3263 FUNCTION(blink),
3264 FUNCTION(cec),
3265 FUNCTION(clk_12m_out),
3266 FUNCTION(clk_32k_in),
3267 FUNCTION(core_pwr_req),
3268 FUNCTION(cpu_pwr_req),
3269 FUNCTION(crt),
3270 FUNCTION(dap),
3271 FUNCTION(ddr),
3272 FUNCTION(dev3),
3273 FUNCTION(displaya),
3274 FUNCTION(displayb),
3275 FUNCTION(dtv),
3276 FUNCTION(extperiph1),
3277 FUNCTION(extperiph2),
3278 FUNCTION(extperiph3),
3279 FUNCTION(gmi),
3280 FUNCTION(gmi_alt),
3281 FUNCTION(hda),
3282 FUNCTION(hdcp),
3283 FUNCTION(hdmi),
3284 FUNCTION(hsi),
3285 FUNCTION(i2c1),
3286 FUNCTION(i2c2),
3287 FUNCTION(i2c3),
3288 FUNCTION(i2c4),
3289 FUNCTION(i2cpwr),
3290 FUNCTION(i2s0),
3291 FUNCTION(i2s1),
3292 FUNCTION(i2s2),
3293 FUNCTION(i2s3),
3294 FUNCTION(i2s4),
3295 FUNCTION(invalid),
3296 FUNCTION(kbc),
3297 FUNCTION(mio),
3298 FUNCTION(nand),
3299 FUNCTION(nand_alt),
3300 FUNCTION(owr),
3301 FUNCTION(pcie),
3302 FUNCTION(pwm0),
3303 FUNCTION(pwm1),
3304 FUNCTION(pwm2),
3305 FUNCTION(pwm3),
3306 FUNCTION(pwr_int_n),
3307 FUNCTION(rsvd1),
3308 FUNCTION(rsvd2),
3309 FUNCTION(rsvd3),
3310 FUNCTION(rsvd4),
3311 FUNCTION(rtck),
3312 FUNCTION(sata),
3313 FUNCTION(sdmmc1),
3314 FUNCTION(sdmmc2),
3315 FUNCTION(sdmmc3),
3316 FUNCTION(sdmmc4),
3317 FUNCTION(spdif),
3318 FUNCTION(spi1),
3319 FUNCTION(spi2),
3320 FUNCTION(spi2_alt),
3321 FUNCTION(spi3),
3322 FUNCTION(spi4),
3323 FUNCTION(spi5),
3324 FUNCTION(spi6),
3325 FUNCTION(sysclk),
3326 FUNCTION(test),
3327 FUNCTION(trace),
3328 FUNCTION(uarta),
3329 FUNCTION(uartb),
3330 FUNCTION(uartc),
3331 FUNCTION(uartd),
3332 FUNCTION(uarte),
3333 FUNCTION(ulpi),
3334 FUNCTION(vgp1),
3335 FUNCTION(vgp2),
3336 FUNCTION(vgp3),
3337 FUNCTION(vgp4),
3338 FUNCTION(vgp5),
3339 FUNCTION(vgp6),
3340 FUNCTION(vi),
3341 FUNCTION(vi_alt1),
3342 FUNCTION(vi_alt2),
3343 FUNCTION(vi_alt3),
3344};
3345
3346#define MUXCTL_REG_A 0x3000
3347#define PINGROUP_REG_A 0x868
3348
3349#define PINGROUP_REG_Y(r) ((r) - MUXCTL_REG_A)
3350#define PINGROUP_REG_N(r) -1
3351
3352#define PINGROUP(pg_name, f0, f1, f2, f3, f_safe, r, od, ior) \
3353 { \
3354 .name = #pg_name, \
3355 .pins = pg_name##_pins, \
3356 .npins = ARRAY_SIZE(pg_name##_pins), \
3357 .funcs = { \
3358 TEGRA_MUX_ ## f0, \
3359 TEGRA_MUX_ ## f1, \
3360 TEGRA_MUX_ ## f2, \
3361 TEGRA_MUX_ ## f3, \
3362 }, \
3363 .func_safe = TEGRA_MUX_ ## f_safe, \
3364 .mux_reg = PINGROUP_REG_Y(r), \
3365 .mux_bank = 0, \
3366 .mux_bit = 0, \
3367 .pupd_reg = PINGROUP_REG_Y(r), \
3368 .pupd_bank = 0, \
3369 .pupd_bit = 2, \
3370 .tri_reg = PINGROUP_REG_Y(r), \
3371 .tri_bank = 0, \
3372 .tri_bit = 4, \
3373 .einput_reg = PINGROUP_REG_Y(r), \
3374 .einput_bank = 0, \
3375 .einput_bit = 5, \
3376 .odrain_reg = PINGROUP_REG_##od(r), \
3377 .odrain_bank = 0, \
3378 .odrain_bit = 6, \
3379 .lock_reg = PINGROUP_REG_Y(r), \
3380 .lock_bank = 0, \
3381 .lock_bit = 7, \
3382 .ioreset_reg = PINGROUP_REG_##ior(r), \
3383 .ioreset_bank = 0, \
3384 .ioreset_bit = 8, \
3385 .drv_reg = -1, \
3386 }
3387
3388#define DRV_PINGROUP(pg_name, r, hsm_b, schmitt_b, lpmd_b, \
3389 drvdn_b, drvdn_w, drvup_b, drvup_w, \
3390 slwr_b, slwr_w, slwf_b, slwf_w) \
3391 { \
3392 .name = "drive_" #pg_name, \
3393 .pins = drive_##pg_name##_pins, \
3394 .npins = ARRAY_SIZE(drive_##pg_name##_pins), \
3395 .mux_reg = -1, \
3396 .pupd_reg = -1, \
3397 .tri_reg = -1, \
3398 .einput_reg = -1, \
3399 .odrain_reg = -1, \
3400 .lock_reg = -1, \
3401 .ioreset_reg = -1, \
3402 .drv_reg = ((r) - PINGROUP_REG_A), \
3403 .drv_bank = 1, \
3404 .hsm_bit = hsm_b, \
3405 .schmitt_bit = schmitt_b, \
3406 .lpmd_bit = lpmd_b, \
3407 .drvdn_bit = drvdn_b, \
3408 .drvdn_width = drvdn_w, \
3409 .drvup_bit = drvup_b, \
3410 .drvup_width = drvup_w, \
3411 .slwr_bit = slwr_b, \
3412 .slwr_width = slwr_w, \
3413 .slwf_bit = slwf_b, \
3414 .slwf_width = slwf_w, \
3415 }
3416
3417static const struct tegra_pingroup tegra30_groups[] = {
3418 /* pg_name, f0, f1, f2, f3, safe, r, od, ior */
3419 /* FIXME: Fill in correct data in safe column */
3420 PINGROUP(clk_32k_out_pa0, BLINK, RSVD2, RSVD3, RSVD4, RSVD4, 0x331c, N, N),
3421 PINGROUP(uart3_cts_n_pa1, UARTC, RSVD2, GMI, RSVD4, RSVD4, 0x317c, N, N),
3422 PINGROUP(dap2_fs_pa2, I2S1, HDA, RSVD3, GMI, RSVD3, 0x3358, N, N),
3423 PINGROUP(dap2_sclk_pa3, I2S1, HDA, RSVD3, GMI, RSVD3, 0x3364, N, N),
3424 PINGROUP(dap2_din_pa4, I2S1, HDA, RSVD3, GMI, RSVD3, 0x335c, N, N),
3425 PINGROUP(dap2_dout_pa5, I2S1, HDA, RSVD3, GMI, RSVD3, 0x3360, N, N),
3426 PINGROUP(sdmmc3_clk_pa6, UARTA, PWM2, SDMMC3, SPI3, SPI3, 0x3390, N, N),
3427 PINGROUP(sdmmc3_cmd_pa7, UARTA, PWM3, SDMMC3, SPI2, SPI2, 0x3394, N, N),
3428 PINGROUP(gmi_a17_pb0, UARTD, SPI4, GMI, DTV, DTV, 0x3234, N, N),
3429 PINGROUP(gmi_a18_pb1, UARTD, SPI4, GMI, DTV, DTV, 0x3238, N, N),
3430 PINGROUP(lcd_pwr0_pb2, DISPLAYA, DISPLAYB, SPI5, HDCP, HDCP, 0x3090, N, N),
3431 PINGROUP(lcd_pclk_pb3, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x3094, N, N),
3432 PINGROUP(sdmmc3_dat3_pb4, RSVD1, PWM0, SDMMC3, SPI3, RSVD1, 0x33a4, N, N),
3433 PINGROUP(sdmmc3_dat2_pb5, RSVD1, PWM1, SDMMC3, SPI3, RSVD1, 0x33a0, N, N),
3434 PINGROUP(sdmmc3_dat1_pb6, RSVD1, RSVD2, SDMMC3, SPI3, RSVD2, 0x339c, N, N),
3435 PINGROUP(sdmmc3_dat0_pb7, RSVD1, RSVD2, SDMMC3, SPI3, RSVD2, 0x3398, N, N),
3436 PINGROUP(uart3_rts_n_pc0, UARTC, PWM0, GMI, RSVD4, RSVD4, 0x3180, N, N),
3437 PINGROUP(lcd_pwr1_pc1, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x3070, N, N),
3438 PINGROUP(uart2_txd_pc2, UARTB, SPDIF, UARTA, SPI4, SPI4, 0x3168, N, N),
3439 PINGROUP(uart2_rxd_pc3, UARTB, SPDIF, UARTA, SPI4, SPI4, 0x3164, N, N),
3440 PINGROUP(gen1_i2c_scl_pc4, I2C1, RSVD2, RSVD3, RSVD4, RSVD4, 0x31a4, Y, N),
3441 PINGROUP(gen1_i2c_sda_pc5, I2C1, RSVD2, RSVD3, RSVD4, RSVD4, 0x31a0, Y, N),
3442 PINGROUP(lcd_pwr2_pc6, DISPLAYA, DISPLAYB, SPI5, HDCP, HDCP, 0x3074, N, N),
3443 PINGROUP(gmi_wp_n_pc7, RSVD1, NAND, GMI, GMI_ALT, RSVD1, 0x31c0, N, N),
3444 PINGROUP(sdmmc3_dat5_pd0, PWM0, SPI4, SDMMC3, SPI2, SPI2, 0x33ac, N, N),
3445 PINGROUP(sdmmc3_dat4_pd1, PWM1, SPI4, SDMMC3, SPI2, SPI2, 0x33a8, N, N),
3446 PINGROUP(lcd_dc1_pd2, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x310c, N, N),
3447 PINGROUP(sdmmc3_dat6_pd3, SPDIF, SPI4, SDMMC3, SPI2, SPI2, 0x33b0, N, N),
3448 PINGROUP(sdmmc3_dat7_pd4, SPDIF, SPI4, SDMMC3, SPI2, SPI2, 0x33b4, N, N),
3449 PINGROUP(vi_d1_pd5, DDR, SDMMC2, VI, RSVD4, RSVD4, 0x3128, N, Y),
3450 PINGROUP(vi_vsync_pd6, DDR, RSVD2, VI, RSVD4, RSVD4, 0x315c, N, Y),
3451 PINGROUP(vi_hsync_pd7, DDR, RSVD2, VI, RSVD4, RSVD4, 0x3160, N, Y),
3452 PINGROUP(lcd_d0_pe0, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x30a4, N, N),
3453 PINGROUP(lcd_d1_pe1, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x30a8, N, N),
3454 PINGROUP(lcd_d2_pe2, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x30ac, N, N),
3455 PINGROUP(lcd_d3_pe3, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x30b0, N, N),
3456 PINGROUP(lcd_d4_pe4, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x30b4, N, N),
3457 PINGROUP(lcd_d5_pe5, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x30b8, N, N),
3458 PINGROUP(lcd_d6_pe6, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x30bc, N, N),
3459 PINGROUP(lcd_d7_pe7, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x30c0, N, N),
3460 PINGROUP(lcd_d8_pf0, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x30c4, N, N),
3461 PINGROUP(lcd_d9_pf1, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x30c8, N, N),
3462 PINGROUP(lcd_d10_pf2, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x30cc, N, N),
3463 PINGROUP(lcd_d11_pf3, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x30d0, N, N),
3464 PINGROUP(lcd_d12_pf4, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x30d4, N, N),
3465 PINGROUP(lcd_d13_pf5, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x30d8, N, N),
3466 PINGROUP(lcd_d14_pf6, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x30dc, N, N),
3467 PINGROUP(lcd_d15_pf7, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x30e0, N, N),
3468 PINGROUP(gmi_ad0_pg0, RSVD1, NAND, GMI, RSVD4, RSVD4, 0x31f0, N, N),
3469 PINGROUP(gmi_ad1_pg1, RSVD1, NAND, GMI, RSVD4, RSVD4, 0x31f4, N, N),
3470 PINGROUP(gmi_ad2_pg2, RSVD1, NAND, GMI, RSVD4, RSVD4, 0x31f8, N, N),
3471 PINGROUP(gmi_ad3_pg3, RSVD1, NAND, GMI, RSVD4, RSVD4, 0x31fc, N, N),
3472 PINGROUP(gmi_ad4_pg4, RSVD1, NAND, GMI, RSVD4, RSVD4, 0x3200, N, N),
3473 PINGROUP(gmi_ad5_pg5, RSVD1, NAND, GMI, RSVD4, RSVD4, 0x3204, N, N),
3474 PINGROUP(gmi_ad6_pg6, RSVD1, NAND, GMI, RSVD4, RSVD4, 0x3208, N, N),
3475 PINGROUP(gmi_ad7_pg7, RSVD1, NAND, GMI, RSVD4, RSVD4, 0x320c, N, N),
3476 PINGROUP(gmi_ad8_ph0, PWM0, NAND, GMI, RSVD4, RSVD4, 0x3210, N, N),
3477 PINGROUP(gmi_ad9_ph1, PWM1, NAND, GMI, RSVD4, RSVD4, 0x3214, N, N),
3478 PINGROUP(gmi_ad10_ph2, PWM2, NAND, GMI, RSVD4, RSVD4, 0x3218, N, N),
3479 PINGROUP(gmi_ad11_ph3, PWM3, NAND, GMI, RSVD4, RSVD4, 0x321c, N, N),
3480 PINGROUP(gmi_ad12_ph4, RSVD1, NAND, GMI, RSVD4, RSVD4, 0x3220, N, N),
3481 PINGROUP(gmi_ad13_ph5, RSVD1, NAND, GMI, RSVD4, RSVD4, 0x3224, N, N),
3482 PINGROUP(gmi_ad14_ph6, RSVD1, NAND, GMI, RSVD4, RSVD4, 0x3228, N, N),
3483 PINGROUP(gmi_ad15_ph7, RSVD1, NAND, GMI, RSVD4, RSVD4, 0x322c, N, N),
3484 PINGROUP(gmi_wr_n_pi0, RSVD1, NAND, GMI, RSVD4, RSVD4, 0x3240, N, N),
3485 PINGROUP(gmi_oe_n_pi1, RSVD1, NAND, GMI, RSVD4, RSVD4, 0x3244, N, N),
3486 PINGROUP(gmi_dqs_pi2, RSVD1, NAND, GMI, RSVD4, RSVD4, 0x3248, N, N),
3487 PINGROUP(gmi_cs6_n_pi3, NAND, NAND_ALT, GMI, SATA, SATA, 0x31e8, N, N),
3488 PINGROUP(gmi_rst_n_pi4, NAND, NAND_ALT, GMI, RSVD4, RSVD4, 0x324c, N, N),
3489 PINGROUP(gmi_iordy_pi5, RSVD1, NAND, GMI, RSVD4, RSVD4, 0x31c4, N, N),
3490 PINGROUP(gmi_cs7_n_pi6, NAND, NAND_ALT, GMI, GMI_ALT, GMI_ALT, 0x31ec, N, N),
3491 PINGROUP(gmi_wait_pi7, RSVD1, NAND, GMI, RSVD4, RSVD4, 0x31c8, N, N),
3492 PINGROUP(gmi_cs0_n_pj0, RSVD1, NAND, GMI, DTV, RSVD1, 0x31d4, N, N),
3493 PINGROUP(lcd_de_pj1, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x3098, N, N),
3494 PINGROUP(gmi_cs1_n_pj2, RSVD1, NAND, GMI, DTV, RSVD1, 0x31d8, N, N),
3495 PINGROUP(lcd_hsync_pj3, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x309c, N, N),
3496 PINGROUP(lcd_vsync_pj4, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x30a0, N, N),
3497 PINGROUP(uart2_cts_n_pj5, UARTA, UARTB, GMI, SPI4, SPI4, 0x3170, N, N),
3498 PINGROUP(uart2_rts_n_pj6, UARTA, UARTB, GMI, SPI4, SPI4, 0x316c, N, N),
3499 PINGROUP(gmi_a16_pj7, UARTD, SPI4, GMI, GMI_ALT, GMI_ALT, 0x3230, N, N),
3500 PINGROUP(gmi_adv_n_pk0, RSVD1, NAND, GMI, RSVD4, RSVD4, 0x31cc, N, N),
3501 PINGROUP(gmi_clk_pk1, RSVD1, NAND, GMI, RSVD4, RSVD4, 0x31d0, N, N),
3502 PINGROUP(gmi_cs4_n_pk2, RSVD1, NAND, GMI, RSVD4, RSVD4, 0x31e4, N, N),
3503 PINGROUP(gmi_cs2_n_pk3, RSVD1, NAND, GMI, RSVD4, RSVD4, 0x31dc, N, N),
3504 PINGROUP(gmi_cs3_n_pk4, RSVD1, NAND, GMI, GMI_ALT, RSVD1, 0x31e0, N, N),
3505 PINGROUP(spdif_out_pk5, SPDIF, RSVD2, I2C1, SDMMC2, RSVD2, 0x3354, N, N),
3506 PINGROUP(spdif_in_pk6, SPDIF, HDA, I2C1, SDMMC2, SDMMC2, 0x3350, N, N),
3507 PINGROUP(gmi_a19_pk7, UARTD, SPI4, GMI, RSVD4, RSVD4, 0x323c, N, N),
3508 PINGROUP(vi_d2_pl0, DDR, SDMMC2, VI, RSVD4, RSVD4, 0x312c, N, Y),
3509 PINGROUP(vi_d3_pl1, DDR, SDMMC2, VI, RSVD4, RSVD4, 0x3130, N, Y),
3510 PINGROUP(vi_d4_pl2, DDR, SDMMC2, VI, RSVD4, RSVD4, 0x3134, N, Y),
3511 PINGROUP(vi_d5_pl3, DDR, SDMMC2, VI, RSVD4, RSVD4, 0x3138, N, Y),
3512 PINGROUP(vi_d6_pl4, DDR, SDMMC2, VI, RSVD4, RSVD4, 0x313c, N, Y),
3513 PINGROUP(vi_d7_pl5, DDR, SDMMC2, VI, RSVD4, RSVD4, 0x3140, N, Y),
3514 PINGROUP(vi_d8_pl6, DDR, SDMMC2, VI, RSVD4, RSVD4, 0x3144, N, Y),
3515 PINGROUP(vi_d9_pl7, DDR, SDMMC2, VI, RSVD4, RSVD4, 0x3148, N, Y),
3516 PINGROUP(lcd_d16_pm0, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x30e4, N, N),
3517 PINGROUP(lcd_d17_pm1, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x30e8, N, N),
3518 PINGROUP(lcd_d18_pm2, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x30ec, N, N),
3519 PINGROUP(lcd_d19_pm3, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x30f0, N, N),
3520 PINGROUP(lcd_d20_pm4, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x30f4, N, N),
3521 PINGROUP(lcd_d21_pm5, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x30f8, N, N),
3522 PINGROUP(lcd_d22_pm6, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x30fc, N, N),
3523 PINGROUP(lcd_d23_pm7, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x3100, N, N),
3524 PINGROUP(dap1_fs_pn0, I2S0, HDA, GMI, SDMMC2, SDMMC2, 0x3338, N, N),
3525 PINGROUP(dap1_din_pn1, I2S0, HDA, GMI, SDMMC2, SDMMC2, 0x333c, N, N),
3526 PINGROUP(dap1_dout_pn2, I2S0, HDA, GMI, SDMMC2, SDMMC2, 0x3340, N, N),
3527 PINGROUP(dap1_sclk_pn3, I2S0, HDA, GMI, SDMMC2, SDMMC2, 0x3344, N, N),
3528 PINGROUP(lcd_cs0_n_pn4, DISPLAYA, DISPLAYB, SPI5, RSVD4, RSVD4, 0x3084, N, N),
3529 PINGROUP(lcd_sdout_pn5, DISPLAYA, DISPLAYB, SPI5, HDCP, HDCP, 0x307c, N, N),
3530 PINGROUP(lcd_dc0_pn6, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x3088, N, N),
3531 PINGROUP(hdmi_int_pn7, HDMI, RSVD2, RSVD3, RSVD4, RSVD4, 0x3110, N, N),
3532 PINGROUP(ulpi_data7_po0, SPI2, HSI, UARTA, ULPI, ULPI, 0x301c, N, N),
3533 PINGROUP(ulpi_data0_po1, SPI3, HSI, UARTA, ULPI, ULPI, 0x3000, N, N),
3534 PINGROUP(ulpi_data1_po2, SPI3, HSI, UARTA, ULPI, ULPI, 0x3004, N, N),
3535 PINGROUP(ulpi_data2_po3, SPI3, HSI, UARTA, ULPI, ULPI, 0x3008, N, N),
3536 PINGROUP(ulpi_data3_po4, SPI3, HSI, UARTA, ULPI, ULPI, 0x300c, N, N),
3537 PINGROUP(ulpi_data4_po5, SPI2, HSI, UARTA, ULPI, ULPI, 0x3010, N, N),
3538 PINGROUP(ulpi_data5_po6, SPI2, HSI, UARTA, ULPI, ULPI, 0x3014, N, N),
3539 PINGROUP(ulpi_data6_po7, SPI2, HSI, UARTA, ULPI, ULPI, 0x3018, N, N),
3540 PINGROUP(dap3_fs_pp0, I2S2, RSVD2, DISPLAYA, DISPLAYB, RSVD2, 0x3030, N, N),
3541 PINGROUP(dap3_din_pp1, I2S2, RSVD2, DISPLAYA, DISPLAYB, RSVD2, 0x3034, N, N),
3542 PINGROUP(dap3_dout_pp2, I2S2, RSVD2, DISPLAYA, DISPLAYB, RSVD2, 0x3038, N, N),
3543 PINGROUP(dap3_sclk_pp3, I2S2, RSVD2, DISPLAYA, DISPLAYB, RSVD2, 0x303c, N, N),
3544 PINGROUP(dap4_fs_pp4, I2S3, RSVD2, GMI, RSVD4, RSVD4, 0x31a8, N, N),
3545 PINGROUP(dap4_din_pp5, I2S3, RSVD2, GMI, RSVD4, RSVD4, 0x31ac, N, N),
3546 PINGROUP(dap4_dout_pp6, I2S3, RSVD2, GMI, RSVD4, RSVD4, 0x31b0, N, N),
3547 PINGROUP(dap4_sclk_pp7, I2S3, RSVD2, GMI, RSVD4, RSVD4, 0x31b4, N, N),
3548 PINGROUP(kb_col0_pq0, KBC, NAND, TRACE, TEST, TEST, 0x32fc, N, N),
3549 PINGROUP(kb_col1_pq1, KBC, NAND, TRACE, TEST, TEST, 0x3300, N, N),
3550 PINGROUP(kb_col2_pq2, KBC, NAND, TRACE, RSVD4, RSVD4, 0x3304, N, N),
3551 PINGROUP(kb_col3_pq3, KBC, NAND, TRACE, RSVD4, RSVD4, 0x3308, N, N),
3552 PINGROUP(kb_col4_pq4, KBC, NAND, TRACE, RSVD4, RSVD4, 0x330c, N, N),
3553 PINGROUP(kb_col5_pq5, KBC, NAND, TRACE, RSVD4, RSVD4, 0x3310, N, N),
3554 PINGROUP(kb_col6_pq6, KBC, NAND, TRACE, MIO, MIO, 0x3314, N, N),
3555 PINGROUP(kb_col7_pq7, KBC, NAND, TRACE, MIO, MIO, 0x3318, N, N),
3556 PINGROUP(kb_row0_pr0, KBC, NAND, RSVD3, RSVD4, RSVD4, 0x32bc, N, N),
3557 PINGROUP(kb_row1_pr1, KBC, NAND, RSVD3, RSVD4, RSVD4, 0x32c0, N, N),
3558 PINGROUP(kb_row2_pr2, KBC, NAND, RSVD3, RSVD4, RSVD4, 0x32c4, N, N),
3559 PINGROUP(kb_row3_pr3, KBC, NAND, RSVD3, INVALID, RSVD3, 0x32c8, N, N),
3560 PINGROUP(kb_row4_pr4, KBC, NAND, TRACE, RSVD4, RSVD4, 0x32cc, N, N),
3561 PINGROUP(kb_row5_pr5, KBC, NAND, TRACE, OWR, OWR, 0x32d0, N, N),
3562 PINGROUP(kb_row6_pr6, KBC, NAND, SDMMC2, MIO, MIO, 0x32d4, N, N),
3563 PINGROUP(kb_row7_pr7, KBC, NAND, SDMMC2, MIO, MIO, 0x32d8, N, N),
3564 PINGROUP(kb_row8_ps0, KBC, NAND, SDMMC2, MIO, MIO, 0x32dc, N, N),
3565 PINGROUP(kb_row9_ps1, KBC, NAND, SDMMC2, MIO, MIO, 0x32e0, N, N),
3566 PINGROUP(kb_row10_ps2, KBC, NAND, SDMMC2, MIO, MIO, 0x32e4, N, N),
3567 PINGROUP(kb_row11_ps3, KBC, NAND, SDMMC2, MIO, MIO, 0x32e8, N, N),
3568 PINGROUP(kb_row12_ps4, KBC, NAND, SDMMC2, MIO, MIO, 0x32ec, N, N),
3569 PINGROUP(kb_row13_ps5, KBC, NAND, SDMMC2, MIO, MIO, 0x32f0, N, N),
3570 PINGROUP(kb_row14_ps6, KBC, NAND, SDMMC2, MIO, MIO, 0x32f4, N, N),
3571 PINGROUP(kb_row15_ps7, KBC, NAND, SDMMC2, MIO, MIO, 0x32f8, N, N),
3572 PINGROUP(vi_pclk_pt0, RSVD1, SDMMC2, VI, RSVD4, RSVD4, 0x3154, N, Y),
3573 PINGROUP(vi_mclk_pt1, VI, VI_ALT1, VI_ALT2, VI_ALT3, VI_ALT3, 0x3158, N, Y),
3574 PINGROUP(vi_d10_pt2, DDR, RSVD2, VI, RSVD4, RSVD4, 0x314c, N, Y),
3575 PINGROUP(vi_d11_pt3, DDR, RSVD2, VI, RSVD4, RSVD4, 0x3150, N, Y),
3576 PINGROUP(vi_d0_pt4, DDR, RSVD2, VI, RSVD4, RSVD4, 0x3124, N, Y),
3577 PINGROUP(gen2_i2c_scl_pt5, I2C2, HDCP, GMI, RSVD4, RSVD4, 0x3250, Y, N),
3578 PINGROUP(gen2_i2c_sda_pt6, I2C2, HDCP, GMI, RSVD4, RSVD4, 0x3254, Y, N),
3579 PINGROUP(sdmmc4_cmd_pt7, I2C3, NAND, GMI, SDMMC4, SDMMC4, 0x325c, N, Y),
3580 PINGROUP(pu0, OWR, UARTA, GMI, RSVD4, RSVD4, 0x3184, N, N),
3581 PINGROUP(pu1, RSVD1, UARTA, GMI, RSVD4, RSVD4, 0x3188, N, N),
3582 PINGROUP(pu2, RSVD1, UARTA, GMI, RSVD4, RSVD4, 0x318c, N, N),
3583 PINGROUP(pu3, PWM0, UARTA, GMI, RSVD4, RSVD4, 0x3190, N, N),
3584 PINGROUP(pu4, PWM1, UARTA, GMI, RSVD4, RSVD4, 0x3194, N, N),
3585 PINGROUP(pu5, PWM2, UARTA, GMI, RSVD4, RSVD4, 0x3198, N, N),
3586 PINGROUP(pu6, PWM3, UARTA, GMI, RSVD4, RSVD4, 0x319c, N, N),
3587 PINGROUP(jtag_rtck_pu7, RTCK, RSVD2, RSVD3, RSVD4, RSVD4, 0x32b0, N, N),
3588 PINGROUP(pv0, RSVD1, RSVD2, RSVD3, RSVD4, RSVD4, 0x3040, N, N),
3589 PINGROUP(pv1, RSVD1, RSVD2, RSVD3, RSVD4, RSVD4, 0x3044, N, N),
3590 PINGROUP(pv2, OWR, RSVD2, RSVD3, RSVD4, RSVD4, 0x3060, N, N),
3591 PINGROUP(pv3, CLK_12M_OUT, RSVD2, RSVD3, RSVD4, RSVD4, 0x3064, N, N),
3592 PINGROUP(ddc_scl_pv4, I2C4, RSVD2, RSVD3, RSVD4, RSVD4, 0x3114, N, N),
3593 PINGROUP(ddc_sda_pv5, I2C4, RSVD2, RSVD3, RSVD4, RSVD4, 0x3118, N, N),
3594 PINGROUP(crt_hsync_pv6, CRT, RSVD2, RSVD3, RSVD4, RSVD4, 0x311c, N, N),
3595 PINGROUP(crt_vsync_pv7, CRT, RSVD2, RSVD3, RSVD4, RSVD4, 0x3120, N, N),
3596 PINGROUP(lcd_cs1_n_pw0, DISPLAYA, DISPLAYB, SPI5, RSVD4, RSVD4, 0x3104, N, N),
3597 PINGROUP(lcd_m1_pw1, DISPLAYA, DISPLAYB, RSVD3, RSVD4, RSVD4, 0x3108, N, N),
3598 PINGROUP(spi2_cs1_n_pw2, SPI3, SPI2, SPI2_ALT, I2C1, I2C1, 0x3388, N, N),
3599 PINGROUP(spi2_cs2_n_pw3, SPI3, SPI2, SPI2_ALT, I2C1, I2C1, 0x338c, N, N),
3600 PINGROUP(clk1_out_pw4, EXTPERIPH1, RSVD2, RSVD3, RSVD4, RSVD4, 0x334c, N, N),
3601 PINGROUP(clk2_out_pw5, EXTPERIPH2, RSVD2, RSVD3, RSVD4, RSVD4, 0x3068, N, N),
3602 PINGROUP(uart3_txd_pw6, UARTC, RSVD2, GMI, RSVD4, RSVD4, 0x3174, N, N),
3603 PINGROUP(uart3_rxd_pw7, UARTC, RSVD2, GMI, RSVD4, RSVD4, 0x3178, N, N),
3604 PINGROUP(spi2_mosi_px0, SPI6, SPI2, SPI3, GMI, GMI, 0x3368, N, N),
3605 PINGROUP(spi2_miso_px1, SPI6, SPI2, SPI3, GMI, GMI, 0x336c, N, N),
3606 PINGROUP(spi2_sck_px2, SPI6, SPI2, SPI3, GMI, GMI, 0x3374, N, N),
3607 PINGROUP(spi2_cs0_n_px3, SPI6, SPI2, SPI3, GMI, GMI, 0x3370, N, N),
3608 PINGROUP(spi1_mosi_px4, SPI2, SPI1, SPI2_ALT, GMI, GMI, 0x3378, N, N),
3609 PINGROUP(spi1_sck_px5, SPI2, SPI1, SPI2_ALT, GMI, GMI, 0x337c, N, N),
3610 PINGROUP(spi1_cs0_n_px6, SPI2, SPI1, SPI2_ALT, GMI, GMI, 0x3380, N, N),
3611 PINGROUP(spi1_miso_px7, SPI3, SPI1, SPI2_ALT, RSVD4, RSVD4, 0x3384, N, N),
3612 PINGROUP(ulpi_clk_py0, SPI1, RSVD2, UARTD, ULPI, RSVD2, 0x3020, N, N),
3613 PINGROUP(ulpi_dir_py1, SPI1, RSVD2, UARTD, ULPI, RSVD2, 0x3024, N, N),
3614 PINGROUP(ulpi_nxt_py2, SPI1, RSVD2, UARTD, ULPI, RSVD2, 0x3028, N, N),
3615 PINGROUP(ulpi_stp_py3, SPI1, RSVD2, UARTD, ULPI, RSVD2, 0x302c, N, N),
3616 PINGROUP(sdmmc1_dat3_py4, SDMMC1, RSVD2, UARTE, UARTA, RSVD2, 0x3050, N, N),
3617 PINGROUP(sdmmc1_dat2_py5, SDMMC1, RSVD2, UARTE, UARTA, RSVD2, 0x3054, N, N),
3618 PINGROUP(sdmmc1_dat1_py6, SDMMC1, RSVD2, UARTE, UARTA, RSVD2, 0x3058, N, N),
3619 PINGROUP(sdmmc1_dat0_py7, SDMMC1, RSVD2, UARTE, UARTA, RSVD2, 0x305c, N, N),
3620 PINGROUP(sdmmc1_clk_pz0, SDMMC1, RSVD2, RSVD3, UARTA, RSVD3, 0x3048, N, N),
3621 PINGROUP(sdmmc1_cmd_pz1, SDMMC1, RSVD2, RSVD3, UARTA, RSVD3, 0x304c, N, N),
3622 PINGROUP(lcd_sdin_pz2, DISPLAYA, DISPLAYB, SPI5, RSVD4, RSVD4, 0x3078, N, N),
3623 PINGROUP(lcd_wr_n_pz3, DISPLAYA, DISPLAYB, SPI5, HDCP, HDCP, 0x3080, N, N),
3624 PINGROUP(lcd_sck_pz4, DISPLAYA, DISPLAYB, SPI5, HDCP, HDCP, 0x308c, N, N),
3625 PINGROUP(sys_clk_req_pz5, SYSCLK, RSVD2, RSVD3, RSVD4, RSVD4, 0x3320, N, N),
3626 PINGROUP(pwr_i2c_scl_pz6, I2CPWR, RSVD2, RSVD3, RSVD4, RSVD4, 0x32b4, Y, N),
3627 PINGROUP(pwr_i2c_sda_pz7, I2CPWR, RSVD2, RSVD3, RSVD4, RSVD4, 0x32b8, Y, N),
3628 PINGROUP(sdmmc4_dat0_paa0, UARTE, SPI3, GMI, SDMMC4, SDMMC4, 0x3260, N, Y),
3629 PINGROUP(sdmmc4_dat1_paa1, UARTE, SPI3, GMI, SDMMC4, SDMMC4, 0x3264, N, Y),
3630 PINGROUP(sdmmc4_dat2_paa2, UARTE, SPI3, GMI, SDMMC4, SDMMC4, 0x3268, N, Y),
3631 PINGROUP(sdmmc4_dat3_paa3, UARTE, SPI3, GMI, SDMMC4, SDMMC4, 0x326c, N, Y),
3632 PINGROUP(sdmmc4_dat4_paa4, I2C3, I2S4, GMI, SDMMC4, SDMMC4, 0x3270, N, Y),
3633 PINGROUP(sdmmc4_dat5_paa5, VGP3, I2S4, GMI, SDMMC4, SDMMC4, 0x3274, N, Y),
3634 PINGROUP(sdmmc4_dat6_paa6, VGP4, I2S4, GMI, SDMMC4, SDMMC4, 0x3278, N, Y),
3635 PINGROUP(sdmmc4_dat7_paa7, VGP5, I2S4, GMI, SDMMC4, SDMMC4, 0x327c, N, Y),
3636 PINGROUP(pbb0, I2S4, RSVD2, RSVD3, SDMMC4, RSVD3, 0x328c, N, N),
3637 PINGROUP(cam_i2c_scl_pbb1, VGP1, I2C3, RSVD3, SDMMC4, RSVD3, 0x3290, Y, N),
3638 PINGROUP(cam_i2c_sda_pbb2, VGP2, I2C3, RSVD3, SDMMC4, RSVD3, 0x3294, Y, N),
3639 PINGROUP(pbb3, VGP3, DISPLAYA, DISPLAYB, SDMMC4, SDMMC4, 0x3298, N, N),
3640 PINGROUP(pbb4, VGP4, DISPLAYA, DISPLAYB, SDMMC4, SDMMC4, 0x329c, N, N),
3641 PINGROUP(pbb5, VGP5, DISPLAYA, DISPLAYB, SDMMC4, SDMMC4, 0x32a0, N, N),
3642 PINGROUP(pbb6, VGP6, DISPLAYA, DISPLAYB, SDMMC4, SDMMC4, 0x32a4, N, N),
3643 PINGROUP(pbb7, I2S4, RSVD2, RSVD3, SDMMC4, RSVD3, 0x32a8, N, N),
3644 PINGROUP(cam_mclk_pcc0, VI, VI_ALT1, VI_ALT3, SDMMC4, SDMMC4, 0x3284, N, N),
3645 PINGROUP(pcc1, I2S4, RSVD2, RSVD3, SDMMC4, RSVD3, 0x3288, N, N),
3646 PINGROUP(pcc2, I2S4, RSVD2, RSVD3, RSVD4, RSVD4, 0x32ac, N, N),
3647 PINGROUP(sdmmc4_rst_n_pcc3, VGP6, RSVD2, RSVD3, SDMMC4, RSVD3, 0x3280, N, Y),
3648 PINGROUP(sdmmc4_clk_pcc4, INVALID, NAND, GMI, SDMMC4, SDMMC4, 0x3258, N, Y),
3649 PINGROUP(clk2_req_pcc5, DAP, RSVD2, RSVD3, RSVD4, RSVD4, 0x306c, N, N),
3650 PINGROUP(pex_l2_rst_n_pcc6, PCIE, HDA, RSVD3, RSVD4, RSVD4, 0x33d8, N, N),
3651 PINGROUP(pex_l2_clkreq_n_pcc7, PCIE, HDA, RSVD3, RSVD4, RSVD4, 0x33dc, N, N),
3652 PINGROUP(pex_l0_prsnt_n_pdd0, PCIE, HDA, RSVD3, RSVD4, RSVD4, 0x33b8, N, N),
3653 PINGROUP(pex_l0_rst_n_pdd1, PCIE, HDA, RSVD3, RSVD4, RSVD4, 0x33bc, N, N),
3654 PINGROUP(pex_l0_clkreq_n_pdd2, PCIE, HDA, RSVD3, RSVD4, RSVD4, 0x33c0, N, N),
3655 PINGROUP(pex_wake_n_pdd3, PCIE, HDA, RSVD3, RSVD4, RSVD4, 0x33c4, N, N),
3656 PINGROUP(pex_l1_prsnt_n_pdd4, PCIE, HDA, RSVD3, RSVD4, RSVD4, 0x33c8, N, N),
3657 PINGROUP(pex_l1_rst_n_pdd5, PCIE, HDA, RSVD3, RSVD4, RSVD4, 0x33cc, N, N),
3658 PINGROUP(pex_l1_clkreq_n_pdd6, PCIE, HDA, RSVD3, RSVD4, RSVD4, 0x33d0, N, N),
3659 PINGROUP(pex_l2_prsnt_n_pdd7, PCIE, HDA, RSVD3, RSVD4, RSVD4, 0x33d4, N, N),
3660 PINGROUP(clk3_out_pee0, EXTPERIPH3, RSVD2, RSVD3, RSVD4, RSVD4, 0x31b8, N, N),
3661 PINGROUP(clk3_req_pee1, DEV3, RSVD2, RSVD3, RSVD4, RSVD4, 0x31bc, N, N),
3662 PINGROUP(clk1_req_pee2, DAP, HDA, RSVD3, RSVD4, RSVD4, 0x3348, N, N),
3663 PINGROUP(hdmi_cec_pee3, CEC, RSVD2, RSVD3, RSVD4, RSVD4, 0x33e0, Y, N),
3664 PINGROUP(clk_32k_in, CLK_32K_IN, RSVD2, RSVD3, RSVD4, RSVD4, 0x3330, N, N),
3665 PINGROUP(core_pwr_req, CORE_PWR_REQ, RSVD2, RSVD3, RSVD4, RSVD4, 0x3324, N, N),
3666 PINGROUP(cpu_pwr_req, CPU_PWR_REQ, RSVD2, RSVD3, RSVD4, RSVD4, 0x3328, N, N),
3667 PINGROUP(owr, OWR, CEC, RSVD3, RSVD4, RSVD4, 0x3334, N, N),
3668 PINGROUP(pwr_int_n, PWR_INT_N, RSVD2, RSVD3, RSVD4, RSVD4, 0x332c, N, N),
3669 /* pg_name, r, hsm_b, schmitt_b, lpmd_b, drvdn_b, drvdn_w, drvup_b, drvup_w, slwr_b, slwr_w, slwf_b, slwf_w */
3670 DRV_PINGROUP(ao1, 0x868, 2, 3, 4, 12, 5, 20, 5, 28, 2, 30, 2),
3671 DRV_PINGROUP(ao2, 0x86c, 2, 3, 4, 12, 5, 20, 5, 28, 2, 30, 2),
3672 DRV_PINGROUP(at1, 0x870, 2, 3, 4, 14, 5, 19, 5, 24, 2, 28, 2),
3673 DRV_PINGROUP(at2, 0x874, 2, 3, 4, 14, 5, 19, 5, 24, 2, 28, 2),
3674 DRV_PINGROUP(at3, 0x878, 2, 3, 4, 14, 5, 19, 5, 28, 2, 30, 2),
3675 DRV_PINGROUP(at4, 0x87c, 2, 3, 4, 14, 5, 19, 5, 28, 2, 30, 2),
3676 DRV_PINGROUP(at5, 0x880, 2, 3, 4, 14, 5, 19, 5, 28, 2, 30, 2),
3677 DRV_PINGROUP(cdev1, 0x884, 2, 3, 4, 12, 5, 20, 5, 28, 2, 30, 2),
3678 DRV_PINGROUP(cdev2, 0x888, 2, 3, 4, 12, 5, 20, 5, 28, 2, 30, 2),
3679 DRV_PINGROUP(cec, 0x938, 2, 3, 4, 12, 5, 20, 5, 28, 2, 30, 2),
3680 DRV_PINGROUP(crt, 0x8f8, 2, 3, 4, 12, 5, 20, 5, 28, 2, 30, 2),
3681 DRV_PINGROUP(csus, 0x88c, -1, -1, -1, 12, 5, 19, 5, 24, 4, 28, 4),
3682 DRV_PINGROUP(dap1, 0x890, 2, 3, 4, 12, 5, 20, 5, 28, 2, 30, 2),
3683 DRV_PINGROUP(dap2, 0x894, 2, 3, 4, 12, 5, 20, 5, 28, 2, 30, 2),
3684 DRV_PINGROUP(dap3, 0x898, 2, 3, 4, 12, 5, 20, 5, 28, 2, 30, 2),
3685 DRV_PINGROUP(dap4, 0x89c, 2, 3, 4, 12, 5, 20, 5, 28, 2, 30, 2),
3686 DRV_PINGROUP(dbg, 0x8a0, 2, 3, 4, 12, 5, 20, 5, 28, 2, 30, 2),
3687 DRV_PINGROUP(ddc, 0x8fc, 2, 3, 4, 12, 5, 20, 5, 28, 2, 30, 2),
3688 DRV_PINGROUP(dev3, 0x92c, 2, 3, 4, 12, 5, 20, 5, 28, 2, 30, 2),
3689 DRV_PINGROUP(gma, 0x900, -1, -1, -1, 14, 5, 19, 5, 24, 4, 28, 4),
3690 DRV_PINGROUP(gmb, 0x904, -1, -1, -1, 14, 5, 19, 5, 24, 4, 28, 4),
3691 DRV_PINGROUP(gmc, 0x908, -1, -1, -1, 14, 5, 19, 5, 24, 4, 28, 4),
3692 DRV_PINGROUP(gmd, 0x90c, -1, -1, -1, 14, 5, 19, 5, 24, 4, 28, 4),
3693 DRV_PINGROUP(gme, 0x910, 2, 3, 4, 14, 5, 19, 5, 28, 2, 30, 2),
3694 DRV_PINGROUP(gmf, 0x914, 2, 3, 4, 14, 5, 19, 5, 28, 2, 30, 2),
3695 DRV_PINGROUP(gmg, 0x918, 2, 3, 4, 14, 5, 19, 5, 28, 2, 30, 2),
3696 DRV_PINGROUP(gmh, 0x91c, 2, 3, 4, 14, 5, 19, 5, 28, 2, 30, 2),
3697 DRV_PINGROUP(gpv, 0x928, 2, 3, 4, 12, 5, 20, 5, 28, 2, 30, 2),
3698 DRV_PINGROUP(lcd1, 0x8a4, 2, 3, 4, 12, 5, 20, 5, 28, 2, 30, 2),
3699 DRV_PINGROUP(lcd2, 0x8a8, 2, 3, 4, 12, 5, 20, 5, 28, 2, 30, 2),
3700 DRV_PINGROUP(owr, 0x920, 2, 3, 4, 12, 5, 20, 5, 28, 2, 30, 2),
3701 DRV_PINGROUP(sdio1, 0x8ec, 2, 3, -1, 12, 7, 20, 7, 28, 2, 30, 2),
3702 DRV_PINGROUP(sdio2, 0x8ac, 2, 3, -1, 12, 7, 20, 7, 28, 2, 30, 2),
3703 DRV_PINGROUP(sdio3, 0x8b0, 2, 3, -1, 12, 7, 20, 7, 28, 2, 30, 2),
3704 DRV_PINGROUP(spi, 0x8b4, 2, 3, 4, 12, 5, 20, 5, 28, 2, 30, 2),
3705 DRV_PINGROUP(uaa, 0x8b8, 2, 3, 4, 12, 5, 20, 5, 28, 2, 30, 2),
3706 DRV_PINGROUP(uab, 0x8bc, 2, 3, 4, 12, 5, 20, 5, 28, 2, 30, 2),
3707 DRV_PINGROUP(uart2, 0x8c0, 2, 3, 4, 12, 5, 20, 5, 28, 2, 30, 2),
3708 DRV_PINGROUP(uart3, 0x8c4, 2, 3, 4, 12, 5, 20, 5, 28, 2, 30, 2),
3709 DRV_PINGROUP(uda, 0x924, 2, 3, 4, 12, 5, 20, 5, 28, 2, 30, 2),
3710 DRV_PINGROUP(vi1, 0x8c8, -1, -1, -1, 14, 5, 19, 5, 24, 4, 28, 4),
3711};
3712
3713static const struct tegra_pinctrl_soc_data tegra30_pinctrl = {
3714 .ngpios = NUM_GPIOS,
3715 .pins = tegra30_pins,
3716 .npins = ARRAY_SIZE(tegra30_pins),
3717 .functions = tegra30_functions,
3718 .nfunctions = ARRAY_SIZE(tegra30_functions),
3719 .groups = tegra30_groups,
3720 .ngroups = ARRAY_SIZE(tegra30_groups),
3721};
3722
3723void __devinit tegra30_pinctrl_init(const struct tegra_pinctrl_soc_data **soc)
3724{
3725 *soc = &tegra30_pinctrl;
3726}
diff --git a/drivers/pinctrl/pinctrl-u300.c b/drivers/pinctrl/pinctrl-u300.c
index c8d02f1c2b5e..26eb8ccd72d5 100644
--- a/drivers/pinctrl/pinctrl-u300.c
+++ b/drivers/pinctrl/pinctrl-u300.c
@@ -19,6 +19,9 @@
19#include <linux/err.h> 19#include <linux/err.h>
20#include <linux/pinctrl/pinctrl.h> 20#include <linux/pinctrl/pinctrl.h>
21#include <linux/pinctrl/pinmux.h> 21#include <linux/pinctrl/pinmux.h>
22#include <linux/pinctrl/pinconf.h>
23#include <linux/pinctrl/pinconf-generic.h>
24#include "pinctrl-coh901.h"
22 25
23/* 26/*
24 * Register definitions for the U300 Padmux control registers in the 27 * Register definitions for the U300 Padmux control registers in the
@@ -162,7 +165,7 @@
162#define U300_SYSCON_PMC4R_APP_MISC_16_APP_UART1_CTS 0x0100 165#define U300_SYSCON_PMC4R_APP_MISC_16_APP_UART1_CTS 0x0100
163#define U300_SYSCON_PMC4R_APP_MISC_16_EMIF_1_STATIC_CS5_N 0x0200 166#define U300_SYSCON_PMC4R_APP_MISC_16_EMIF_1_STATIC_CS5_N 0x0200
164 167
165#define DRIVER_NAME "pinmux-u300" 168#define DRIVER_NAME "pinctrl-u300"
166 169
167/* 170/*
168 * The DB3350 has 467 pads, I have enumerated the pads clockwise around the 171 * The DB3350 has 467 pads, I have enumerated the pads clockwise around the
@@ -1044,22 +1047,82 @@ static struct pinctrl_gpio_range u300_gpio_ranges[] = {
1044 U300_GPIO_RANGE(25, 181, 1), 1047 U300_GPIO_RANGE(25, 181, 1),
1045}; 1048};
1046 1049
1050static struct pinctrl_gpio_range *u300_match_gpio_range(unsigned pin)
1051{
1052 int i;
1053
1054 for (i = 0; i < ARRAY_SIZE(u300_gpio_ranges); i++) {
1055 struct pinctrl_gpio_range *range;
1056
1057 range = &u300_gpio_ranges[i];
1058 if (pin >= range->pin_base &&
1059 pin <= (range->pin_base + range->npins - 1))
1060 return range;
1061 }
1062 return NULL;
1063}
1064
1065int u300_pin_config_get(struct pinctrl_dev *pctldev,
1066 unsigned pin,
1067 unsigned long *config)
1068{
1069 struct pinctrl_gpio_range *range = u300_match_gpio_range(pin);
1070
1071 /* We get config for those pins we CAN get it for and that's it */
1072 if (!range)
1073 return -ENOTSUPP;
1074
1075 return u300_gpio_config_get(range->gc,
1076 (pin - range->pin_base + range->base),
1077 config);
1078}
1079
1080int u300_pin_config_set(struct pinctrl_dev *pctldev,
1081 unsigned pin,
1082 unsigned long config)
1083{
1084 struct pinctrl_gpio_range *range = u300_match_gpio_range(pin);
1085 int ret;
1086
1087 if (!range)
1088 return -EINVAL;
1089
1090 /* Note: none of these configurations take any argument */
1091 ret = u300_gpio_config_set(range->gc,
1092 (pin - range->pin_base + range->base),
1093 pinconf_to_config_param(config));
1094 if (ret)
1095 return ret;
1096
1097 return 0;
1098}
1099
1100static struct pinconf_ops u300_pconf_ops = {
1101 .is_generic = true,
1102 .pin_config_get = u300_pin_config_get,
1103 .pin_config_set = u300_pin_config_set,
1104};
1105
1047static struct pinctrl_desc u300_pmx_desc = { 1106static struct pinctrl_desc u300_pmx_desc = {
1048 .name = DRIVER_NAME, 1107 .name = DRIVER_NAME,
1049 .pins = u300_pads, 1108 .pins = u300_pads,
1050 .npins = ARRAY_SIZE(u300_pads), 1109 .npins = ARRAY_SIZE(u300_pads),
1051 .pctlops = &u300_pctrl_ops, 1110 .pctlops = &u300_pctrl_ops,
1052 .pmxops = &u300_pmx_ops, 1111 .pmxops = &u300_pmx_ops,
1112 .confops = &u300_pconf_ops,
1053 .owner = THIS_MODULE, 1113 .owner = THIS_MODULE,
1054}; 1114};
1055 1115
1056static int __init u300_pmx_probe(struct platform_device *pdev) 1116static int __devinit u300_pmx_probe(struct platform_device *pdev)
1057{ 1117{
1058 struct u300_pmx *upmx; 1118 struct u300_pmx *upmx;
1059 struct resource *res; 1119 struct resource *res;
1120 struct gpio_chip *gpio_chip = dev_get_platdata(&pdev->dev);
1060 int ret; 1121 int ret;
1061 int i; 1122 int i;
1062 1123
1124 pr_err("U300 PMX PROBE\n");
1125
1063 /* Create state holders etc for this driver */ 1126 /* Create state holders etc for this driver */
1064 upmx = devm_kzalloc(&pdev->dev, sizeof(*upmx), GFP_KERNEL); 1127 upmx = devm_kzalloc(&pdev->dev, sizeof(*upmx), GFP_KERNEL);
1065 if (!upmx) 1128 if (!upmx)
@@ -1095,12 +1158,14 @@ static int __init u300_pmx_probe(struct platform_device *pdev)
1095 } 1158 }
1096 1159
1097 /* We will handle a range of GPIO pins */ 1160 /* We will handle a range of GPIO pins */
1098 for (i = 0; i < ARRAY_SIZE(u300_gpio_ranges); i++) 1161 for (i = 0; i < ARRAY_SIZE(u300_gpio_ranges); i++) {
1162 u300_gpio_ranges[i].gc = gpio_chip;
1099 pinctrl_add_gpio_range(upmx->pctl, &u300_gpio_ranges[i]); 1163 pinctrl_add_gpio_range(upmx->pctl, &u300_gpio_ranges[i]);
1164 }
1100 1165
1101 platform_set_drvdata(pdev, upmx); 1166 platform_set_drvdata(pdev, upmx);
1102 1167
1103 dev_info(&pdev->dev, "initialized U300 pinmux driver\n"); 1168 dev_info(&pdev->dev, "initialized U300 pin control driver\n");
1104 1169
1105 return 0; 1170 return 0;
1106 1171
@@ -1115,7 +1180,7 @@ out_no_resource:
1115 return ret; 1180 return ret;
1116} 1181}
1117 1182
1118static int __exit u300_pmx_remove(struct platform_device *pdev) 1183static int __devexit u300_pmx_remove(struct platform_device *pdev)
1119{ 1184{
1120 struct u300_pmx *upmx = platform_get_drvdata(pdev); 1185 struct u300_pmx *upmx = platform_get_drvdata(pdev);
1121 int i; 1186 int i;
@@ -1136,12 +1201,13 @@ static struct platform_driver u300_pmx_driver = {
1136 .name = DRIVER_NAME, 1201 .name = DRIVER_NAME,
1137 .owner = THIS_MODULE, 1202 .owner = THIS_MODULE,
1138 }, 1203 },
1139 .remove = __exit_p(u300_pmx_remove), 1204 .probe = u300_pmx_probe,
1205 .remove = __devexit_p(u300_pmx_remove),
1140}; 1206};
1141 1207
1142static int __init u300_pmx_init(void) 1208static int __init u300_pmx_init(void)
1143{ 1209{
1144 return platform_driver_probe(&u300_pmx_driver, u300_pmx_probe); 1210 return platform_driver_register(&u300_pmx_driver);
1145} 1211}
1146arch_initcall(u300_pmx_init); 1212arch_initcall(u300_pmx_init);
1147 1213
diff --git a/drivers/pinctrl/pinmux.c b/drivers/pinctrl/pinmux.c
index 7c3193f7a044..4e62783a573a 100644
--- a/drivers/pinctrl/pinmux.c
+++ b/drivers/pinctrl/pinmux.c
@@ -1,12 +1,14 @@
1/* 1/*
2 * Core driver for the pin muxing portions of the pin control subsystem 2 * Core driver for the pin muxing portions of the pin control subsystem
3 * 3 *
4 * Copyright (C) 2011 ST-Ericsson SA 4 * Copyright (C) 2011-2012 ST-Ericsson SA
5 * Written on behalf of Linaro for ST-Ericsson 5 * Written on behalf of Linaro for ST-Ericsson
6 * Based on bits of regulator core, gpio core and clk core 6 * Based on bits of regulator core, gpio core and clk core
7 * 7 *
8 * Author: Linus Walleij <linus.walleij@linaro.org> 8 * Author: Linus Walleij <linus.walleij@linaro.org>
9 * 9 *
10 * Copyright (C) 2012 NVIDIA CORPORATION. All rights reserved.
11 *
10 * License terms: GNU General Public License (GPL) version 2 12 * License terms: GNU General Public License (GPL) version 2
11 */ 13 */
12#define pr_fmt(fmt) "pinmux core: " fmt 14#define pr_fmt(fmt) "pinmux core: " fmt
@@ -19,8 +21,6 @@
19#include <linux/radix-tree.h> 21#include <linux/radix-tree.h>
20#include <linux/err.h> 22#include <linux/err.h>
21#include <linux/list.h> 23#include <linux/list.h>
22#include <linux/mutex.h>
23#include <linux/spinlock.h>
24#include <linux/string.h> 24#include <linux/string.h>
25#include <linux/sysfs.h> 25#include <linux/sysfs.h>
26#include <linux/debugfs.h> 26#include <linux/debugfs.h>
@@ -28,80 +28,64 @@
28#include <linux/pinctrl/machine.h> 28#include <linux/pinctrl/machine.h>
29#include <linux/pinctrl/pinmux.h> 29#include <linux/pinctrl/pinmux.h>
30#include "core.h" 30#include "core.h"
31#include "pinmux.h"
31 32
32/* List of pinmuxes */ 33int pinmux_check_ops(struct pinctrl_dev *pctldev)
33static DEFINE_MUTEX(pinmux_list_mutex); 34{
34static LIST_HEAD(pinmux_list); 35 const struct pinmux_ops *ops = pctldev->desc->pmxops;
36 unsigned selector = 0;
35 37
36/* Global pinmux maps */ 38 /* Check that we implement required operations */
37static struct pinmux_map *pinmux_maps; 39 if (!ops->list_functions ||
38static unsigned pinmux_maps_num; 40 !ops->get_function_name ||
41 !ops->get_function_groups ||
42 !ops->enable ||
43 !ops->disable)
44 return -EINVAL;
39 45
40/** 46 /* Check that all functions registered have names */
41 * struct pinmux_group - group list item for pinmux groups 47 while (ops->list_functions(pctldev, selector) >= 0) {
42 * @node: pinmux group list node 48 const char *fname = ops->get_function_name(pctldev,
43 * @group_selector: the group selector for this group 49 selector);
44 */ 50 if (!fname) {
45struct pinmux_group { 51 pr_err("pinmux ops has no name for function%u\n",
46 struct list_head node; 52 selector);
47 unsigned group_selector; 53 return -EINVAL;
48}; 54 }
55 selector++;
56 }
49 57
50/** 58 return 0;
51 * struct pinmux - per-device pinmux state holder 59}
52 * @node: global list node
53 * @dev: the device using this pinmux
54 * @usecount: the number of active users of this mux setting, used to keep
55 * track of nested use cases
56 * @pctldev: pin control device handling this pinmux
57 * @func_selector: the function selector for the pinmux device handling
58 * this pinmux
59 * @groups: the group selectors for the pinmux device and
60 * selector combination handling this pinmux, this is a list that
61 * will be traversed on all pinmux operations such as
62 * get/put/enable/disable
63 * @mutex: a lock for the pinmux state holder
64 */
65struct pinmux {
66 struct list_head node;
67 struct device *dev;
68 unsigned usecount;
69 struct pinctrl_dev *pctldev;
70 unsigned func_selector;
71 struct list_head groups;
72 struct mutex mutex;
73};
74 60
75/** 61int pinmux_validate_map(struct pinctrl_map const *map, int i)
76 * struct pinmux_hog - a list item to stash mux hogs 62{
77 * @node: pinmux hog list node 63 if (!map->data.mux.function) {
78 * @map: map entry responsible for this hogging 64 pr_err("failed to register map %s (%d): no function given\n",
79 * @pmx: the pinmux hogged by this item 65 map->name, i);
80 */ 66 return -EINVAL;
81struct pinmux_hog { 67 }
82 struct list_head node; 68
83 struct pinmux_map const *map; 69 return 0;
84 struct pinmux *pmx; 70}
85};
86 71
87/** 72/**
88 * pin_request() - request a single pin to be muxed in, typically for GPIO 73 * pin_request() - request a single pin to be muxed in, typically for GPIO
89 * @pin: the pin number in the global pin space 74 * @pin: the pin number in the global pin space
90 * @function: a functional name to give to this pin, passed to the driver 75 * @owner: a representation of the owner of this pin; typically the device
91 * so it knows what function to mux in, e.g. the string "gpioNN" 76 * name that controls its mux function, or the requested GPIO name
92 * means that you want to mux in the pin for use as GPIO number NN
93 * @gpio_range: the range matching the GPIO pin if this is a request for a 77 * @gpio_range: the range matching the GPIO pin if this is a request for a
94 * single GPIO pin 78 * single GPIO pin
95 */ 79 */
96static int pin_request(struct pinctrl_dev *pctldev, 80static int pin_request(struct pinctrl_dev *pctldev,
97 int pin, const char *function, 81 int pin, const char *owner,
98 struct pinctrl_gpio_range *gpio_range) 82 struct pinctrl_gpio_range *gpio_range)
99{ 83{
100 struct pin_desc *desc; 84 struct pin_desc *desc;
101 const struct pinmux_ops *ops = pctldev->desc->pmxops; 85 const struct pinmux_ops *ops = pctldev->desc->pmxops;
102 int status = -EINVAL; 86 int status = -EINVAL;
103 87
104 dev_dbg(pctldev->dev, "request pin %d for %s\n", pin, function); 88 dev_dbg(pctldev->dev, "request pin %d for %s\n", pin, owner);
105 89
106 desc = pin_desc_get(pctldev, pin); 90 desc = pin_desc_get(pctldev, pin);
107 if (desc == NULL) { 91 if (desc == NULL) {
@@ -110,20 +94,28 @@ static int pin_request(struct pinctrl_dev *pctldev,
110 goto out; 94 goto out;
111 } 95 }
112 96
113 if (!function) { 97 if (gpio_range) {
114 dev_err(pctldev->dev, "no function name given\n"); 98 /* There's no need to support multiple GPIO requests */
115 return -EINVAL; 99 if (desc->gpio_owner) {
116 } 100 dev_err(pctldev->dev,
101 "pin already requested\n");
102 goto out;
103 }
117 104
118 spin_lock(&desc->lock); 105 desc->gpio_owner = owner;
119 if (desc->mux_function) { 106 } else {
120 spin_unlock(&desc->lock); 107 if (desc->mux_usecount && strcmp(desc->mux_owner, owner)) {
121 dev_err(pctldev->dev, 108 dev_err(pctldev->dev,
122 "pin already requested\n"); 109 "pin already requested\n");
123 goto out; 110 goto out;
111 }
112
113 desc->mux_usecount++;
114 if (desc->mux_usecount > 1)
115 return 0;
116
117 desc->mux_owner = owner;
124 } 118 }
125 desc->mux_function = function;
126 spin_unlock(&desc->lock);
127 119
128 /* Let each pin increase references to this module */ 120 /* Let each pin increase references to this module */
129 if (!try_module_get(pctldev->owner)) { 121 if (!try_module_get(pctldev->owner)) {
@@ -146,19 +138,26 @@ static int pin_request(struct pinctrl_dev *pctldev,
146 else 138 else
147 status = 0; 139 status = 0;
148 140
149 if (status) 141 if (status) {
150 dev_err(pctldev->dev, "->request on device %s failed for pin %d\n", 142 dev_err(pctldev->dev, "->request on device %s failed for pin %d\n",
151 pctldev->desc->name, pin); 143 pctldev->desc->name, pin);
144 module_put(pctldev->owner);
145 }
146
152out_free_pin: 147out_free_pin:
153 if (status) { 148 if (status) {
154 spin_lock(&desc->lock); 149 if (gpio_range) {
155 desc->mux_function = NULL; 150 desc->gpio_owner = NULL;
156 spin_unlock(&desc->lock); 151 } else {
152 desc->mux_usecount--;
153 if (!desc->mux_usecount)
154 desc->mux_owner = NULL;
155 }
157 } 156 }
158out: 157out:
159 if (status) 158 if (status)
160 dev_err(pctldev->dev, "pin-%d (%s) status %d\n", 159 dev_err(pctldev->dev, "pin-%d (%s) status %d\n",
161 pin, function ? : "?", status); 160 pin, owner, status);
162 161
163 return status; 162 return status;
164} 163}
@@ -170,8 +169,8 @@ out:
170 * @gpio_range: the range matching the GPIO pin if this is a request for a 169 * @gpio_range: the range matching the GPIO pin if this is a request for a
171 * single GPIO pin 170 * single GPIO pin
172 * 171 *
173 * This function returns a pointer to the function name in use. This is used 172 * This function returns a pointer to the previous owner. This is used
174 * for callers that dynamically allocate a function name so it can be freed 173 * for callers that dynamically allocate an owner name so it can be freed
175 * once the pin is free. This is done for GPIO request functions. 174 * once the pin is free. This is done for GPIO request functions.
176 */ 175 */
177static const char *pin_free(struct pinctrl_dev *pctldev, int pin, 176static const char *pin_free(struct pinctrl_dev *pctldev, int pin,
@@ -179,7 +178,7 @@ static const char *pin_free(struct pinctrl_dev *pctldev, int pin,
179{ 178{
180 const struct pinmux_ops *ops = pctldev->desc->pmxops; 179 const struct pinmux_ops *ops = pctldev->desc->pmxops;
181 struct pin_desc *desc; 180 struct pin_desc *desc;
182 const char *func; 181 const char *owner;
183 182
184 desc = pin_desc_get(pctldev, pin); 183 desc = pin_desc_get(pctldev, pin);
185 if (desc == NULL) { 184 if (desc == NULL) {
@@ -188,6 +187,12 @@ static const char *pin_free(struct pinctrl_dev *pctldev, int pin,
188 return NULL; 187 return NULL;
189 } 188 }
190 189
190 if (!gpio_range) {
191 desc->mux_usecount--;
192 if (desc->mux_usecount)
193 return NULL;
194 }
195
191 /* 196 /*
192 * If there is no kind of request function for the pin we just assume 197 * If there is no kind of request function for the pin we just assume
193 * we got it by default and proceed. 198 * we got it by default and proceed.
@@ -197,99 +202,79 @@ static const char *pin_free(struct pinctrl_dev *pctldev, int pin,
197 else if (ops->free) 202 else if (ops->free)
198 ops->free(pctldev, pin); 203 ops->free(pctldev, pin);
199 204
200 spin_lock(&desc->lock); 205 if (gpio_range) {
201 func = desc->mux_function; 206 owner = desc->gpio_owner;
202 desc->mux_function = NULL; 207 desc->gpio_owner = NULL;
203 spin_unlock(&desc->lock); 208 } else {
209 owner = desc->mux_owner;
210 desc->mux_owner = NULL;
211 desc->mux_setting = NULL;
212 }
213
204 module_put(pctldev->owner); 214 module_put(pctldev->owner);
205 215
206 return func; 216 return owner;
207} 217}
208 218
209/** 219/**
210 * pinmux_request_gpio() - request a single pin to be muxed in as GPIO 220 * pinmux_request_gpio() - request pinmuxing for a GPIO pin
211 * @gpio: the GPIO pin number from the GPIO subsystem number space 221 * @pctldev: pin controller device affected
212 * 222 * @pin: the pin to mux in for GPIO
213 * This function should *ONLY* be used from gpiolib-based GPIO drivers, 223 * @range: the applicable GPIO range
214 * as part of their gpio_request() semantics, platforms and individual drivers
215 * shall *NOT* request GPIO pins to be muxed in.
216 */ 224 */
217int pinmux_request_gpio(unsigned gpio) 225int pinmux_request_gpio(struct pinctrl_dev *pctldev,
226 struct pinctrl_gpio_range *range,
227 unsigned pin, unsigned gpio)
218{ 228{
219 char gpiostr[16]; 229 char gpiostr[16];
220 const char *function; 230 const char *owner;
221 struct pinctrl_dev *pctldev;
222 struct pinctrl_gpio_range *range;
223 int ret; 231 int ret;
224 int pin;
225
226 ret = pinctrl_get_device_gpio_range(gpio, &pctldev, &range);
227 if (ret)
228 return -EINVAL;
229
230 /* Convert to the pin controllers number space */
231 pin = gpio - range->base + range->pin_base;
232 232
233 /* Conjure some name stating what chip and pin this is taken by */ 233 /* Conjure some name stating what chip and pin this is taken by */
234 snprintf(gpiostr, 15, "%s:%d", range->name, gpio); 234 snprintf(gpiostr, 15, "%s:%d", range->name, gpio);
235 235
236 function = kstrdup(gpiostr, GFP_KERNEL); 236 owner = kstrdup(gpiostr, GFP_KERNEL);
237 if (!function) 237 if (!owner)
238 return -EINVAL; 238 return -EINVAL;
239 239
240 ret = pin_request(pctldev, pin, function, range); 240 ret = pin_request(pctldev, pin, owner, range);
241 if (ret < 0) 241 if (ret < 0)
242 kfree(function); 242 kfree(owner);
243 243
244 return ret; 244 return ret;
245} 245}
246EXPORT_SYMBOL_GPL(pinmux_request_gpio);
247 246
248/** 247/**
249 * pinmux_free_gpio() - free a single pin, currently used as GPIO 248 * pinmux_free_gpio() - release a pin from GPIO muxing
250 * @gpio: the GPIO pin number from the GPIO subsystem number space 249 * @pctldev: the pin controller device for the pin
251 * 250 * @pin: the affected currently GPIO-muxed in pin
252 * This function should *ONLY* be used from gpiolib-based GPIO drivers, 251 * @range: applicable GPIO range
253 * as part of their gpio_free() semantics, platforms and individual drivers
254 * shall *NOT* request GPIO pins to be muxed out.
255 */ 252 */
256void pinmux_free_gpio(unsigned gpio) 253void pinmux_free_gpio(struct pinctrl_dev *pctldev, unsigned pin,
254 struct pinctrl_gpio_range *range)
257{ 255{
258 struct pinctrl_dev *pctldev; 256 const char *owner;
259 struct pinctrl_gpio_range *range;
260 int ret;
261 int pin;
262 const char *func;
263 257
264 ret = pinctrl_get_device_gpio_range(gpio, &pctldev, &range); 258 owner = pin_free(pctldev, pin, range);
265 if (ret) 259 kfree(owner);
266 return;
267
268 /* Convert to the pin controllers number space */
269 pin = gpio - range->base + range->pin_base;
270
271 func = pin_free(pctldev, pin, range);
272 kfree(func);
273} 260}
274EXPORT_SYMBOL_GPL(pinmux_free_gpio);
275 261
276static int pinmux_gpio_direction(unsigned gpio, bool input) 262/**
263 * pinmux_gpio_direction() - set the direction of a single muxed-in GPIO pin
264 * @pctldev: the pin controller handling this pin
265 * @range: applicable GPIO range
266 * @pin: the affected GPIO pin in this controller
267 * @input: true if we set the pin as input, false for output
268 */
269int pinmux_gpio_direction(struct pinctrl_dev *pctldev,
270 struct pinctrl_gpio_range *range,
271 unsigned pin, bool input)
277{ 272{
278 struct pinctrl_dev *pctldev;
279 struct pinctrl_gpio_range *range;
280 const struct pinmux_ops *ops; 273 const struct pinmux_ops *ops;
281 int ret; 274 int ret;
282 int pin;
283
284 ret = pinctrl_get_device_gpio_range(gpio, &pctldev, &range);
285 if (ret)
286 return ret;
287 275
288 ops = pctldev->desc->pmxops; 276 ops = pctldev->desc->pmxops;
289 277
290 /* Convert to the pin controllers number space */
291 pin = gpio - range->base + range->pin_base;
292
293 if (ops->gpio_set_direction) 278 if (ops->gpio_set_direction)
294 ret = ops->gpio_set_direction(pctldev, range, pin, input); 279 ret = ops->gpio_set_direction(pctldev, range, pin, input);
295 else 280 else
@@ -298,146 +283,89 @@ static int pinmux_gpio_direction(unsigned gpio, bool input)
298 return ret; 283 return ret;
299} 284}
300 285
301/** 286static int pinmux_func_name_to_selector(struct pinctrl_dev *pctldev,
302 * pinmux_gpio_direction_input() - request a GPIO pin to go into input mode 287 const char *function)
303 * @gpio: the GPIO pin number from the GPIO subsystem number space
304 *
305 * This function should *ONLY* be used from gpiolib-based GPIO drivers,
306 * as part of their gpio_direction_input() semantics, platforms and individual
307 * drivers shall *NOT* touch pinmux GPIO calls.
308 */
309int pinmux_gpio_direction_input(unsigned gpio)
310{
311 return pinmux_gpio_direction(gpio, true);
312}
313EXPORT_SYMBOL_GPL(pinmux_gpio_direction_input);
314
315/**
316 * pinmux_gpio_direction_output() - request a GPIO pin to go into output mode
317 * @gpio: the GPIO pin number from the GPIO subsystem number space
318 *
319 * This function should *ONLY* be used from gpiolib-based GPIO drivers,
320 * as part of their gpio_direction_output() semantics, platforms and individual
321 * drivers shall *NOT* touch pinmux GPIO calls.
322 */
323int pinmux_gpio_direction_output(unsigned gpio)
324{
325 return pinmux_gpio_direction(gpio, false);
326}
327EXPORT_SYMBOL_GPL(pinmux_gpio_direction_output);
328
329/**
330 * pinmux_register_mappings() - register a set of pinmux mappings
331 * @maps: the pinmux mappings table to register, this should be marked with
332 * __initdata so it can be discarded after boot, this function will
333 * perform a shallow copy for the mapping entries.
334 * @num_maps: the number of maps in the mapping table
335 *
336 * Only call this once during initialization of your machine, the function is
337 * tagged as __init and won't be callable after init has completed. The map
338 * passed into this function will be owned by the pinmux core and cannot be
339 * freed.
340 */
341int __init pinmux_register_mappings(struct pinmux_map const *maps,
342 unsigned num_maps)
343{ 288{
344 void *tmp_maps; 289 const struct pinmux_ops *ops = pctldev->desc->pmxops;
345 int i; 290 unsigned selector = 0;
346
347 pr_debug("add %d pinmux maps\n", num_maps);
348
349 /* First sanity check the new mapping */
350 for (i = 0; i < num_maps; i++) {
351 if (!maps[i].name) {
352 pr_err("failed to register map %d: no map name given\n",
353 i);
354 return -EINVAL;
355 }
356
357 if (!maps[i].ctrl_dev && !maps[i].ctrl_dev_name) {
358 pr_err("failed to register map %s (%d): no pin control device given\n",
359 maps[i].name, i);
360 return -EINVAL;
361 }
362 291
363 if (!maps[i].function) { 292 /* See if this pctldev has this function */
364 pr_err("failed to register map %s (%d): no function ID given\n", 293 while (ops->list_functions(pctldev, selector) >= 0) {
365 maps[i].name, i); 294 const char *fname = ops->get_function_name(pctldev,
366 return -EINVAL; 295 selector);
367 }
368 296
369 if (!maps[i].dev && !maps[i].dev_name) 297 if (!strcmp(function, fname))
370 pr_debug("add system map %s function %s with no device\n", 298 return selector;
371 maps[i].name,
372 maps[i].function);
373 else
374 pr_debug("register map %s, function %s\n",
375 maps[i].name,
376 maps[i].function);
377 }
378 299
379 /* 300 selector++;
380 * Make a copy of the map array - string pointers will end up in the
381 * kernel const section anyway so these do not need to be deep copied.
382 */
383 if (!pinmux_maps_num) {
384 /* On first call, just copy them */
385 tmp_maps = kmemdup(maps,
386 sizeof(struct pinmux_map) * num_maps,
387 GFP_KERNEL);
388 if (!tmp_maps)
389 return -ENOMEM;
390 } else {
391 /* Subsequent calls, reallocate array to new size */
392 size_t oldsize = sizeof(struct pinmux_map) * pinmux_maps_num;
393 size_t newsize = sizeof(struct pinmux_map) * num_maps;
394
395 tmp_maps = krealloc(pinmux_maps, oldsize + newsize, GFP_KERNEL);
396 if (!tmp_maps)
397 return -ENOMEM;
398 memcpy((tmp_maps + oldsize), maps, newsize);
399 } 301 }
400 302
401 pinmux_maps = tmp_maps; 303 pr_err("%s does not support function %s\n",
402 pinmux_maps_num += num_maps; 304 pinctrl_dev_get_name(pctldev), function);
403 return 0; 305 return -EINVAL;
404} 306}
405 307
406/** 308int pinmux_map_to_setting(struct pinctrl_map const *map,
407 * acquire_pins() - acquire all the pins for a certain function on a pinmux 309 struct pinctrl_setting *setting)
408 * @pctldev: the device to take the pins on
409 * @func_selector: the function selector to acquire the pins for
410 * @group_selector: the group selector containing the pins to acquire
411 */
412static int acquire_pins(struct pinctrl_dev *pctldev,
413 unsigned func_selector,
414 unsigned group_selector)
415{ 310{
416 const struct pinctrl_ops *pctlops = pctldev->desc->pctlops; 311 struct pinctrl_dev *pctldev = setting->pctldev;
417 const struct pinmux_ops *pmxops = pctldev->desc->pmxops; 312 const struct pinmux_ops *pmxops = pctldev->desc->pmxops;
418 const char *func = pmxops->get_function_name(pctldev, 313 const struct pinctrl_ops *pctlops = pctldev->desc->pctlops;
419 func_selector); 314 char const * const *groups;
420 const unsigned *pins; 315 unsigned num_groups;
421 unsigned num_pins;
422 int ret; 316 int ret;
317 const char *group;
423 int i; 318 int i;
319 const unsigned *pins;
320 unsigned num_pins;
424 321
425 ret = pctlops->get_group_pins(pctldev, group_selector, 322 setting->data.mux.func =
426 &pins, &num_pins); 323 pinmux_func_name_to_selector(pctldev, map->data.mux.function);
427 if (ret) 324 if (setting->data.mux.func < 0)
325 return setting->data.mux.func;
326
327 ret = pmxops->get_function_groups(pctldev, setting->data.mux.func,
328 &groups, &num_groups);
329 if (ret < 0)
428 return ret; 330 return ret;
331 if (!num_groups)
332 return -EINVAL;
429 333
430 dev_dbg(pctldev->dev, "requesting the %u pins from group %u\n", 334 if (map->data.mux.group) {
431 num_pins, group_selector); 335 bool found = false;
336 group = map->data.mux.group;
337 for (i = 0; i < num_groups; i++) {
338 if (!strcmp(group, groups[i])) {
339 found = true;
340 break;
341 }
342 }
343 if (!found)
344 return -EINVAL;
345 } else {
346 group = groups[0];
347 }
348
349 setting->data.mux.group = pinctrl_get_group_selector(pctldev, group);
350 if (setting->data.mux.group < 0)
351 return setting->data.mux.group;
352
353 ret = pctlops->get_group_pins(pctldev, setting->data.mux.group, &pins,
354 &num_pins);
355 if (ret) {
356 dev_err(pctldev->dev,
357 "could not get pins for device %s group selector %d\n",
358 pinctrl_dev_get_name(pctldev), setting->data.mux.group);
359 return -ENODEV;
360 }
432 361
433 /* Try to allocate all pins in this group, one by one */ 362 /* Try to allocate all pins in this group, one by one */
434 for (i = 0; i < num_pins; i++) { 363 for (i = 0; i < num_pins; i++) {
435 ret = pin_request(pctldev, pins[i], func, NULL); 364 ret = pin_request(pctldev, pins[i], map->dev_name, NULL);
436 if (ret) { 365 if (ret) {
437 dev_err(pctldev->dev, 366 dev_err(pctldev->dev,
438 "could not get pin %d for function %s on device %s - conflicting mux mappings?\n", 367 "could not get request pin %d on device %s\n",
439 pins[i], func ? : "(undefined)", 368 pins[i], pinctrl_dev_get_name(pctldev));
440 pinctrl_dev_get_name(pctldev));
441 /* On error release all taken pins */ 369 /* On error release all taken pins */
442 i--; /* this pin just failed */ 370 i--; /* this pin just failed */
443 for (; i >= 0; i--) 371 for (; i >= 0; i--)
@@ -445,587 +373,101 @@ static int acquire_pins(struct pinctrl_dev *pctldev,
445 return -ENODEV; 373 return -ENODEV;
446 } 374 }
447 } 375 }
376
448 return 0; 377 return 0;
449} 378}
450 379
451/** 380void pinmux_free_setting(struct pinctrl_setting const *setting)
452 * release_pins() - release pins taken by earlier acquirement
453 * @pctldev: the device to free the pins on
454 * @group_selector: the group selector containing the pins to free
455 */
456static void release_pins(struct pinctrl_dev *pctldev,
457 unsigned group_selector)
458{ 381{
382 struct pinctrl_dev *pctldev = setting->pctldev;
459 const struct pinctrl_ops *pctlops = pctldev->desc->pctlops; 383 const struct pinctrl_ops *pctlops = pctldev->desc->pctlops;
460 const unsigned *pins; 384 const unsigned *pins;
461 unsigned num_pins; 385 unsigned num_pins;
462 int ret; 386 int ret;
463 int i; 387 int i;
464 388
465 ret = pctlops->get_group_pins(pctldev, group_selector, 389 ret = pctlops->get_group_pins(pctldev, setting->data.mux.group,
466 &pins, &num_pins); 390 &pins, &num_pins);
467 if (ret) { 391 if (ret) {
468 dev_err(pctldev->dev, "could not get pins to release for group selector %d\n", 392 dev_err(pctldev->dev,
469 group_selector); 393 "could not get pins for device %s group selector %d\n",
394 pinctrl_dev_get_name(pctldev), setting->data.mux.group);
470 return; 395 return;
471 } 396 }
397
472 for (i = 0; i < num_pins; i++) 398 for (i = 0; i < num_pins; i++)
473 pin_free(pctldev, pins[i], NULL); 399 pin_free(pctldev, pins[i], NULL);
474} 400}
475 401
476/** 402int pinmux_enable_setting(struct pinctrl_setting const *setting)
477 * pinmux_check_pin_group() - check function and pin group combo
478 * @pctldev: device to check the pin group vs function for
479 * @func_selector: the function selector to check the pin group for, we have
480 * already looked this up in the calling function
481 * @pin_group: the pin group to match to the function
482 *
483 * This function will check that the pinmux driver can supply the
484 * selected pin group for a certain function, returns the group selector if
485 * the group and function selector will work fine together, else returns
486 * negative
487 */
488static int pinmux_check_pin_group(struct pinctrl_dev *pctldev,
489 unsigned func_selector,
490 const char *pin_group)
491{ 403{
492 const struct pinmux_ops *pmxops = pctldev->desc->pmxops; 404 struct pinctrl_dev *pctldev = setting->pctldev;
493 const struct pinctrl_ops *pctlops = pctldev->desc->pctlops; 405 const struct pinctrl_ops *pctlops = pctldev->desc->pctlops;
494 int ret;
495
496 /*
497 * If the driver does not support different pin groups for the
498 * functions, we only support group 0, and assume this exists.
499 */
500 if (!pctlops || !pctlops->list_groups)
501 return 0;
502
503 /*
504 * Passing NULL (no specific group) will select the first and
505 * hopefully only group of pins available for this function.
506 */
507 if (!pin_group) {
508 char const * const *groups;
509 unsigned num_groups;
510
511 ret = pmxops->get_function_groups(pctldev, func_selector,
512 &groups, &num_groups);
513 if (ret)
514 return ret;
515 if (num_groups < 1)
516 return -EINVAL;
517 ret = pinctrl_get_group_selector(pctldev, groups[0]);
518 if (ret < 0) {
519 dev_err(pctldev->dev,
520 "function %s wants group %s but the pin controller does not seem to have that group\n",
521 pmxops->get_function_name(pctldev, func_selector),
522 groups[0]);
523 return ret;
524 }
525
526 if (num_groups > 1)
527 dev_dbg(pctldev->dev,
528 "function %s support more than one group, default-selecting first group %s (%d)\n",
529 pmxops->get_function_name(pctldev, func_selector),
530 groups[0],
531 ret);
532
533 return ret;
534 }
535
536 dev_dbg(pctldev->dev,
537 "check if we have pin group %s on controller %s\n",
538 pin_group, pinctrl_dev_get_name(pctldev));
539
540 ret = pinctrl_get_group_selector(pctldev, pin_group);
541 if (ret < 0) {
542 dev_dbg(pctldev->dev,
543 "%s does not support pin group %s with function %s\n",
544 pinctrl_dev_get_name(pctldev),
545 pin_group,
546 pmxops->get_function_name(pctldev, func_selector));
547 }
548 return ret;
549}
550
551/**
552 * pinmux_search_function() - check pin control driver for a certain function
553 * @pctldev: device to check for function and position
554 * @map: function map containing the function and position to look for
555 * @func_selector: returns the applicable function selector if found
556 * @group_selector: returns the applicable group selector if found
557 *
558 * This will search the pinmux driver for an applicable
559 * function with a specific pin group, returns 0 if these can be mapped
560 * negative otherwise
561 */
562static int pinmux_search_function(struct pinctrl_dev *pctldev,
563 struct pinmux_map const *map,
564 unsigned *func_selector,
565 unsigned *group_selector)
566{
567 const struct pinmux_ops *ops = pctldev->desc->pmxops; 406 const struct pinmux_ops *ops = pctldev->desc->pmxops;
568 unsigned selector = 0;
569
570 /* See if this pctldev has this function */
571 while (ops->list_functions(pctldev, selector) >= 0) {
572 const char *fname = ops->get_function_name(pctldev,
573 selector);
574 int ret;
575
576 if (!strcmp(map->function, fname)) {
577 /* Found the function, check pin group */
578 ret = pinmux_check_pin_group(pctldev, selector,
579 map->group);
580 if (ret < 0)
581 return ret;
582
583 /* This function and group selector can be used */
584 *func_selector = selector;
585 *group_selector = ret;
586 return 0;
587
588 }
589 selector++;
590 }
591
592 pr_err("%s does not support function %s\n",
593 pinctrl_dev_get_name(pctldev), map->function);
594 return -EINVAL;
595}
596
597/**
598 * pinmux_enable_muxmap() - enable a map entry for a certain pinmux
599 */
600static int pinmux_enable_muxmap(struct pinctrl_dev *pctldev,
601 struct pinmux *pmx,
602 struct device *dev,
603 const char *devname,
604 struct pinmux_map const *map)
605{
606 unsigned func_selector;
607 unsigned group_selector;
608 struct pinmux_group *grp;
609 int ret; 407 int ret;
408 const unsigned *pins;
409 unsigned num_pins;
410 int i;
411 struct pin_desc *desc;
610 412
611 /* 413 ret = pctlops->get_group_pins(pctldev, setting->data.mux.group,
612 * Note that we're not locking the pinmux mutex here, because 414 &pins, &num_pins);
613 * this is only called at pinmux initialization time when it
614 * has not been added to any list and thus is not reachable
615 * by anyone else.
616 */
617
618 if (pmx->pctldev && pmx->pctldev != pctldev) {
619 dev_err(pctldev->dev,
620 "different pin control devices given for device %s, function %s\n",
621 devname, map->function);
622 return -EINVAL;
623 }
624 pmx->dev = dev;
625 pmx->pctldev = pctldev;
626
627 /* Now go into the driver and try to match a function and group */
628 ret = pinmux_search_function(pctldev, map, &func_selector,
629 &group_selector);
630 if (ret < 0)
631 return ret;
632
633 /*
634 * If the function selector is already set, it needs to be identical,
635 * we support several groups with one function but not several
636 * functions with one or several groups in the same pinmux.
637 */
638 if (pmx->func_selector != UINT_MAX &&
639 pmx->func_selector != func_selector) {
640 dev_err(pctldev->dev,
641 "dual function defines in the map for device %s\n",
642 devname);
643 return -EINVAL;
644 }
645 pmx->func_selector = func_selector;
646
647 /* Now add this group selector, we may have many of them */
648 grp = kmalloc(sizeof(struct pinmux_group), GFP_KERNEL);
649 if (!grp)
650 return -ENOMEM;
651 grp->group_selector = group_selector;
652 ret = acquire_pins(pctldev, func_selector, group_selector);
653 if (ret) { 415 if (ret) {
654 kfree(grp); 416 /* errors only affect debug data, so just warn */
655 return ret; 417 dev_warn(pctldev->dev,
418 "could not get pins for group selector %d\n",
419 setting->data.mux.group);
420 num_pins = 0;
656 } 421 }
657 list_add(&grp->node, &pmx->groups);
658
659 return 0;
660}
661
662static void pinmux_free_groups(struct pinmux *pmx)
663{
664 struct list_head *node, *tmp;
665
666 list_for_each_safe(node, tmp, &pmx->groups) {
667 struct pinmux_group *grp =
668 list_entry(node, struct pinmux_group, node);
669 /* Release all pins taken by this group */
670 release_pins(pmx->pctldev, grp->group_selector);
671 list_del(node);
672 kfree(grp);
673 }
674}
675
676/**
677 * pinmux_get() - retrieves the pinmux for a certain device
678 * @dev: the device to get the pinmux for
679 * @name: an optional specific mux mapping name or NULL, the name is only
680 * needed if you want to have more than one mapping per device, or if you
681 * need an anonymous pinmux (not tied to any specific device)
682 */
683struct pinmux *pinmux_get(struct device *dev, const char *name)
684{
685 struct pinmux_map const *map = NULL;
686 struct pinctrl_dev *pctldev = NULL;
687 const char *devname = NULL;
688 struct pinmux *pmx;
689 bool found_map;
690 unsigned num_maps = 0;
691 int ret = -ENODEV;
692 int i;
693
694 /* We must have dev or ID or both */
695 if (!dev && !name)
696 return ERR_PTR(-EINVAL);
697
698 if (dev)
699 devname = dev_name(dev);
700
701 pr_debug("get mux %s for device %s\n", name,
702 devname ? devname : "(none)");
703 422
704 /* 423 for (i = 0; i < num_pins; i++) {
705 * create the state cookie holder struct pinmux for each 424 desc = pin_desc_get(pctldev, pins[i]);
706 * mapping, this is what consumers will get when requesting 425 if (desc == NULL) {
707 * a pinmux handle with pinmux_get() 426 dev_warn(pctldev->dev,
708 */ 427 "could not get pin desc for pin %d\n",
709 pmx = kzalloc(sizeof(struct pinmux), GFP_KERNEL); 428 pins[i]);
710 if (pmx == NULL)
711 return ERR_PTR(-ENOMEM);
712 mutex_init(&pmx->mutex);
713 pmx->func_selector = UINT_MAX;
714 INIT_LIST_HEAD(&pmx->groups);
715
716 /* Iterate over the pinmux maps to locate the right ones */
717 for (i = 0; i < pinmux_maps_num; i++) {
718 map = &pinmux_maps[i];
719 found_map = false;
720
721 /*
722 * First, try to find the pctldev given in the map
723 */
724 pctldev = get_pinctrl_dev_from_dev(map->ctrl_dev,
725 map->ctrl_dev_name);
726 if (!pctldev) {
727 const char *devname = NULL;
728
729 if (map->ctrl_dev)
730 devname = dev_name(map->ctrl_dev);
731 else if (map->ctrl_dev_name)
732 devname = map->ctrl_dev_name;
733
734 pr_warning("could not find a pinctrl device for pinmux function %s, fishy, they shall all have one\n",
735 map->function);
736 pr_warning("given pinctrl device name: %s",
737 devname ? devname : "UNDEFINED");
738
739 /* Continue to check the other mappings anyway... */
740 continue; 429 continue;
741 } 430 }
742 431 desc->mux_setting = &(setting->data.mux);
743 pr_debug("in map, found pctldev %s to handle function %s",
744 dev_name(pctldev->dev), map->function);
745
746
747 /*
748 * If we're looking for a specific named map, this must match,
749 * else we loop and look for the next.
750 */
751 if (name != NULL) {
752 if (map->name == NULL)
753 continue;
754 if (strcmp(map->name, name))
755 continue;
756 }
757
758 /*
759 * This is for the case where no device name is given, we
760 * already know that the function name matches from above
761 * code.
762 */
763 if (!map->dev_name && (name != NULL))
764 found_map = true;
765
766 /* If the mapping has a device set up it must match */
767 if (map->dev_name &&
768 (!devname || !strcmp(map->dev_name, devname)))
769 /* MATCH! */
770 found_map = true;
771
772 /* If this map is applicable, then apply it */
773 if (found_map) {
774 ret = pinmux_enable_muxmap(pctldev, pmx, dev,
775 devname, map);
776 if (ret) {
777 pinmux_free_groups(pmx);
778 kfree(pmx);
779 return ERR_PTR(ret);
780 }
781 num_maps++;
782 }
783 }
784
785
786 /* We should have atleast one map, right */
787 if (!num_maps) {
788 pr_err("could not find any mux maps for device %s, ID %s\n",
789 devname ? devname : "(anonymous)",
790 name ? name : "(undefined)");
791 kfree(pmx);
792 return ERR_PTR(-EINVAL);
793 } 432 }
794 433
795 pr_debug("found %u mux maps for device %s, UD %s\n", 434 return ops->enable(pctldev, setting->data.mux.func,
796 num_maps, 435 setting->data.mux.group);
797 devname ? devname : "(anonymous)",
798 name ? name : "(undefined)");
799
800 /* Add the pinmux to the global list */
801 mutex_lock(&pinmux_list_mutex);
802 list_add(&pmx->node, &pinmux_list);
803 mutex_unlock(&pinmux_list_mutex);
804
805 return pmx;
806} 436}
807EXPORT_SYMBOL_GPL(pinmux_get);
808 437
809/** 438void pinmux_disable_setting(struct pinctrl_setting const *setting)
810 * pinmux_put() - release a previously claimed pinmux
811 * @pmx: a pinmux previously claimed by pinmux_get()
812 */
813void pinmux_put(struct pinmux *pmx)
814{
815 if (pmx == NULL)
816 return;
817
818 mutex_lock(&pmx->mutex);
819 if (pmx->usecount)
820 pr_warn("releasing pinmux with active users!\n");
821 /* Free the groups and all acquired pins */
822 pinmux_free_groups(pmx);
823 mutex_unlock(&pmx->mutex);
824
825 /* Remove from list */
826 mutex_lock(&pinmux_list_mutex);
827 list_del(&pmx->node);
828 mutex_unlock(&pinmux_list_mutex);
829
830 kfree(pmx);
831}
832EXPORT_SYMBOL_GPL(pinmux_put);
833
834/**
835 * pinmux_enable() - enable a certain pinmux setting
836 * @pmx: the pinmux to enable, previously claimed by pinmux_get()
837 */
838int pinmux_enable(struct pinmux *pmx)
839{
840 int ret = 0;
841
842 if (pmx == NULL)
843 return -EINVAL;
844 mutex_lock(&pmx->mutex);
845 if (pmx->usecount++ == 0) {
846 struct pinctrl_dev *pctldev = pmx->pctldev;
847 const struct pinmux_ops *ops = pctldev->desc->pmxops;
848 struct pinmux_group *grp;
849
850 list_for_each_entry(grp, &pmx->groups, node) {
851 ret = ops->enable(pctldev, pmx->func_selector,
852 grp->group_selector);
853 if (ret) {
854 /*
855 * TODO: call disable() on all groups we called
856 * enable() on to this point?
857 */
858 pmx->usecount--;
859 break;
860 }
861 }
862 }
863 mutex_unlock(&pmx->mutex);
864 return ret;
865}
866EXPORT_SYMBOL_GPL(pinmux_enable);
867
868/**
869 * pinmux_disable() - disable a certain pinmux setting
870 * @pmx: the pinmux to disable, previously claimed by pinmux_get()
871 */
872void pinmux_disable(struct pinmux *pmx)
873{
874 if (pmx == NULL)
875 return;
876
877 mutex_lock(&pmx->mutex);
878 if (--pmx->usecount == 0) {
879 struct pinctrl_dev *pctldev = pmx->pctldev;
880 const struct pinmux_ops *ops = pctldev->desc->pmxops;
881 struct pinmux_group *grp;
882
883 list_for_each_entry(grp, &pmx->groups, node) {
884 ops->disable(pctldev, pmx->func_selector,
885 grp->group_selector);
886 }
887 }
888 mutex_unlock(&pmx->mutex);
889}
890EXPORT_SYMBOL_GPL(pinmux_disable);
891
892int pinmux_check_ops(struct pinctrl_dev *pctldev)
893{ 439{
440 struct pinctrl_dev *pctldev = setting->pctldev;
441 const struct pinctrl_ops *pctlops = pctldev->desc->pctlops;
894 const struct pinmux_ops *ops = pctldev->desc->pmxops; 442 const struct pinmux_ops *ops = pctldev->desc->pmxops;
895 unsigned selector = 0;
896
897 /* Check that we implement required operations */
898 if (!ops->list_functions ||
899 !ops->get_function_name ||
900 !ops->get_function_groups ||
901 !ops->enable ||
902 !ops->disable)
903 return -EINVAL;
904
905 /* Check that all functions registered have names */
906 while (ops->list_functions(pctldev, selector) >= 0) {
907 const char *fname = ops->get_function_name(pctldev,
908 selector);
909 if (!fname) {
910 pr_err("pinmux ops has no name for function%u\n",
911 selector);
912 return -EINVAL;
913 }
914 selector++;
915 }
916
917 return 0;
918}
919
920/* Hog a single map entry and add to the hoglist */
921static int pinmux_hog_map(struct pinctrl_dev *pctldev,
922 struct pinmux_map const *map)
923{
924 struct pinmux_hog *hog;
925 struct pinmux *pmx;
926 int ret; 443 int ret;
444 const unsigned *pins;
445 unsigned num_pins;
446 int i;
447 struct pin_desc *desc;
927 448
928 if (map->dev || map->dev_name) { 449 ret = pctlops->get_group_pins(pctldev, setting->data.mux.group,
929 /* 450 &pins, &num_pins);
930 * TODO: the day we have device tree support, we can
931 * traverse the device tree and hog to specific device nodes
932 * without any problems, so then we can hog pinmuxes for
933 * all devices that just want a static pin mux at this point.
934 */
935 dev_err(pctldev->dev, "map %s wants to hog a non-system pinmux, this is not going to work\n",
936 map->name);
937 return -EINVAL;
938 }
939
940 hog = kzalloc(sizeof(struct pinmux_hog), GFP_KERNEL);
941 if (!hog)
942 return -ENOMEM;
943
944 pmx = pinmux_get(NULL, map->name);
945 if (IS_ERR(pmx)) {
946 kfree(hog);
947 dev_err(pctldev->dev,
948 "could not get the %s pinmux mapping for hogging\n",
949 map->name);
950 return PTR_ERR(pmx);
951 }
952
953 ret = pinmux_enable(pmx);
954 if (ret) { 451 if (ret) {
955 pinmux_put(pmx); 452 /* errors only affect debug data, so just warn */
956 kfree(hog); 453 dev_warn(pctldev->dev,
957 dev_err(pctldev->dev, 454 "could not get pins for group selector %d\n",
958 "could not enable the %s pinmux mapping for hogging\n", 455 setting->data.mux.group);
959 map->name); 456 num_pins = 0;
960 return ret;
961 } 457 }
962 458
963 hog->map = map; 459 for (i = 0; i < num_pins; i++) {
964 hog->pmx = pmx; 460 desc = pin_desc_get(pctldev, pins[i]);
965 461 if (desc == NULL) {
966 dev_info(pctldev->dev, "hogged map %s, function %s\n", map->name, 462 dev_warn(pctldev->dev,
967 map->function); 463 "could not get pin desc for pin %d\n",
968 mutex_lock(&pctldev->pinmux_hogs_lock); 464 pins[i]);
969 list_add(&hog->node, &pctldev->pinmux_hogs);
970 mutex_unlock(&pctldev->pinmux_hogs_lock);
971
972 return 0;
973}
974
975/**
976 * pinmux_hog_maps() - hog specific map entries on controller device
977 * @pctldev: the pin control device to hog entries on
978 *
979 * When the pin controllers are registered, there may be some specific pinmux
980 * map entries that need to be hogged, i.e. get+enabled until the system shuts
981 * down.
982 */
983int pinmux_hog_maps(struct pinctrl_dev *pctldev)
984{
985 struct device *dev = pctldev->dev;
986 const char *devname = dev_name(dev);
987 int ret;
988 int i;
989
990 INIT_LIST_HEAD(&pctldev->pinmux_hogs);
991 mutex_init(&pctldev->pinmux_hogs_lock);
992
993 for (i = 0; i < pinmux_maps_num; i++) {
994 struct pinmux_map const *map = &pinmux_maps[i];
995
996 if (!map->hog_on_boot)
997 continue; 465 continue;
998
999 if ((map->ctrl_dev == dev) ||
1000 (map->ctrl_dev_name &&
1001 !strcmp(map->ctrl_dev_name, devname))) {
1002 /* OK time to hog! */
1003 ret = pinmux_hog_map(pctldev, map);
1004 if (ret)
1005 return ret;
1006 } 466 }
467 desc->mux_setting = NULL;
1007 } 468 }
1008 return 0;
1009}
1010 469
1011/** 470 ops->disable(pctldev, setting->data.mux.func, setting->data.mux.group);
1012 * pinmux_unhog_maps() - unhog specific map entries on controller device
1013 * @pctldev: the pin control device to unhog entries on
1014 */
1015void pinmux_unhog_maps(struct pinctrl_dev *pctldev)
1016{
1017 struct list_head *node, *tmp;
1018
1019 mutex_lock(&pctldev->pinmux_hogs_lock);
1020 list_for_each_safe(node, tmp, &pctldev->pinmux_hogs) {
1021 struct pinmux_hog *hog =
1022 list_entry(node, struct pinmux_hog, node);
1023 pinmux_disable(hog->pmx);
1024 pinmux_put(hog->pmx);
1025 list_del(node);
1026 kfree(hog);
1027 }
1028 mutex_unlock(&pctldev->pinmux_hogs_lock);
1029} 471}
1030 472
1031#ifdef CONFIG_DEBUG_FS 473#ifdef CONFIG_DEBUG_FS
@@ -1037,6 +479,8 @@ static int pinmux_functions_show(struct seq_file *s, void *what)
1037 const struct pinmux_ops *pmxops = pctldev->desc->pmxops; 479 const struct pinmux_ops *pmxops = pctldev->desc->pmxops;
1038 unsigned func_selector = 0; 480 unsigned func_selector = 0;
1039 481
482 mutex_lock(&pinctrl_mutex);
483
1040 while (pmxops->list_functions(pctldev, func_selector) >= 0) { 484 while (pmxops->list_functions(pctldev, func_selector) >= 0) {
1041 const char *func = pmxops->get_function_name(pctldev, 485 const char *func = pmxops->get_function_name(pctldev,
1042 func_selector); 486 func_selector);
@@ -1057,24 +501,29 @@ static int pinmux_functions_show(struct seq_file *s, void *what)
1057 seq_puts(s, "]\n"); 501 seq_puts(s, "]\n");
1058 502
1059 func_selector++; 503 func_selector++;
1060
1061 } 504 }
1062 505
506 mutex_unlock(&pinctrl_mutex);
507
1063 return 0; 508 return 0;
1064} 509}
1065 510
1066static int pinmux_pins_show(struct seq_file *s, void *what) 511static int pinmux_pins_show(struct seq_file *s, void *what)
1067{ 512{
1068 struct pinctrl_dev *pctldev = s->private; 513 struct pinctrl_dev *pctldev = s->private;
514 const struct pinctrl_ops *pctlops = pctldev->desc->pctlops;
515 const struct pinmux_ops *pmxops = pctldev->desc->pmxops;
1069 unsigned i, pin; 516 unsigned i, pin;
1070 517
1071 seq_puts(s, "Pinmux settings per pin\n"); 518 seq_puts(s, "Pinmux settings per pin\n");
1072 seq_puts(s, "Format: pin (name): pinmuxfunction\n"); 519 seq_puts(s, "Format: pin (name): mux_owner gpio_owner hog?\n");
520
521 mutex_lock(&pinctrl_mutex);
1073 522
1074 /* The pin number can be retrived from the pin controller descriptor */ 523 /* The pin number can be retrived from the pin controller descriptor */
1075 for (i = 0; i < pctldev->desc->npins; i++) { 524 for (i = 0; i < pctldev->desc->npins; i++) {
1076
1077 struct pin_desc *desc; 525 struct pin_desc *desc;
526 bool is_hog = false;
1078 527
1079 pin = pctldev->desc->pins[i].number; 528 pin = pctldev->desc->pins[i].number;
1080 desc = pin_desc_get(pctldev, pin); 529 desc = pin_desc_get(pctldev, pin);
@@ -1082,94 +531,52 @@ static int pinmux_pins_show(struct seq_file *s, void *what)
1082 if (desc == NULL) 531 if (desc == NULL)
1083 continue; 532 continue;
1084 533
1085 seq_printf(s, "pin %d (%s): %s\n", pin, 534 if (desc->mux_owner &&
535 !strcmp(desc->mux_owner, pinctrl_dev_get_name(pctldev)))
536 is_hog = true;
537
538 seq_printf(s, "pin %d (%s): %s %s%s", pin,
1086 desc->name ? desc->name : "unnamed", 539 desc->name ? desc->name : "unnamed",
1087 desc->mux_function ? desc->mux_function 540 desc->mux_owner ? desc->mux_owner
1088 : "UNCLAIMED"); 541 : "(MUX UNCLAIMED)",
542 desc->gpio_owner ? desc->gpio_owner
543 : "(GPIO UNCLAIMED)",
544 is_hog ? " (HOG)" : "");
545
546 if (desc->mux_setting)
547 seq_printf(s, " function %s group %s\n",
548 pmxops->get_function_name(pctldev,
549 desc->mux_setting->func),
550 pctlops->get_group_name(pctldev,
551 desc->mux_setting->group));
552 else
553 seq_printf(s, "\n");
1089 } 554 }
1090 555
1091 return 0; 556 mutex_unlock(&pinctrl_mutex);
1092}
1093
1094static int pinmux_hogs_show(struct seq_file *s, void *what)
1095{
1096 struct pinctrl_dev *pctldev = s->private;
1097 struct pinmux_hog *hog;
1098
1099 seq_puts(s, "Pinmux map hogs held by device\n");
1100
1101 list_for_each_entry(hog, &pctldev->pinmux_hogs, node)
1102 seq_printf(s, "%s\n", hog->map->name);
1103 557
1104 return 0; 558 return 0;
1105} 559}
1106 560
1107static int pinmux_show(struct seq_file *s, void *what) 561void pinmux_show_map(struct seq_file *s, struct pinctrl_map const *map)
1108{ 562{
1109 struct pinmux *pmx; 563 seq_printf(s, "group %s\nfunction %s\n",
1110 564 map->data.mux.group ? map->data.mux.group : "(default)",
1111 seq_puts(s, "Requested pinmuxes and their maps:\n"); 565 map->data.mux.function);
1112 list_for_each_entry(pmx, &pinmux_list, node) {
1113 struct pinctrl_dev *pctldev = pmx->pctldev;
1114 const struct pinmux_ops *pmxops;
1115 const struct pinctrl_ops *pctlops;
1116 struct pinmux_group *grp;
1117
1118 if (!pctldev) {
1119 seq_puts(s, "NO PIN CONTROLLER DEVICE\n");
1120 continue;
1121 }
1122
1123 pmxops = pctldev->desc->pmxops;
1124 pctlops = pctldev->desc->pctlops;
1125
1126 seq_printf(s, "device: %s function: %s (%u),",
1127 pinctrl_dev_get_name(pmx->pctldev),
1128 pmxops->get_function_name(pctldev,
1129 pmx->func_selector),
1130 pmx->func_selector);
1131
1132 seq_printf(s, " groups: [");
1133 list_for_each_entry(grp, &pmx->groups, node) {
1134 seq_printf(s, " %s (%u)",
1135 pctlops->get_group_name(pctldev,
1136 grp->group_selector),
1137 grp->group_selector);
1138 }
1139 seq_printf(s, " ]");
1140
1141 seq_printf(s, " users: %u map-> %s\n",
1142 pmx->usecount,
1143 pmx->dev ? dev_name(pmx->dev) : "(system)");
1144 }
1145
1146 return 0;
1147} 566}
1148 567
1149static int pinmux_maps_show(struct seq_file *s, void *what) 568void pinmux_show_setting(struct seq_file *s,
569 struct pinctrl_setting const *setting)
1150{ 570{
1151 int i; 571 struct pinctrl_dev *pctldev = setting->pctldev;
1152 572 const struct pinmux_ops *pmxops = pctldev->desc->pmxops;
1153 seq_puts(s, "Pinmux maps:\n"); 573 const struct pinctrl_ops *pctlops = pctldev->desc->pctlops;
1154
1155 for (i = 0; i < pinmux_maps_num; i++) {
1156 struct pinmux_map const *map = &pinmux_maps[i];
1157 574
1158 seq_printf(s, "%s:\n", map->name); 575 seq_printf(s, "group: %s (%u) function: %s (%u)\n",
1159 if (map->dev || map->dev_name) 576 pctlops->get_group_name(pctldev, setting->data.mux.group),
1160 seq_printf(s, " device: %s\n", 577 setting->data.mux.group,
1161 map->dev ? dev_name(map->dev) : 578 pmxops->get_function_name(pctldev, setting->data.mux.func),
1162 map->dev_name); 579 setting->data.mux.func);
1163 else
1164 seq_printf(s, " SYSTEM MUX\n");
1165 seq_printf(s, " controlling device %s\n",
1166 map->ctrl_dev ? dev_name(map->ctrl_dev) :
1167 map->ctrl_dev_name);
1168 seq_printf(s, " function: %s\n", map->function);
1169 seq_printf(s, " group: %s\n", map->group ? map->group :
1170 "(default)");
1171 }
1172 return 0;
1173} 580}
1174 581
1175static int pinmux_functions_open(struct inode *inode, struct file *file) 582static int pinmux_functions_open(struct inode *inode, struct file *file)
@@ -1182,21 +589,6 @@ static int pinmux_pins_open(struct inode *inode, struct file *file)
1182 return single_open(file, pinmux_pins_show, inode->i_private); 589 return single_open(file, pinmux_pins_show, inode->i_private);
1183} 590}
1184 591
1185static int pinmux_hogs_open(struct inode *inode, struct file *file)
1186{
1187 return single_open(file, pinmux_hogs_show, inode->i_private);
1188}
1189
1190static int pinmux_open(struct inode *inode, struct file *file)
1191{
1192 return single_open(file, pinmux_show, NULL);
1193}
1194
1195static int pinmux_maps_open(struct inode *inode, struct file *file)
1196{
1197 return single_open(file, pinmux_maps_show, NULL);
1198}
1199
1200static const struct file_operations pinmux_functions_ops = { 592static const struct file_operations pinmux_functions_ops = {
1201 .open = pinmux_functions_open, 593 .open = pinmux_functions_open,
1202 .read = seq_read, 594 .read = seq_read,
@@ -1211,27 +603,6 @@ static const struct file_operations pinmux_pins_ops = {
1211 .release = single_release, 603 .release = single_release,
1212}; 604};
1213 605
1214static const struct file_operations pinmux_hogs_ops = {
1215 .open = pinmux_hogs_open,
1216 .read = seq_read,
1217 .llseek = seq_lseek,
1218 .release = single_release,
1219};
1220
1221static const struct file_operations pinmux_ops = {
1222 .open = pinmux_open,
1223 .read = seq_read,
1224 .llseek = seq_lseek,
1225 .release = single_release,
1226};
1227
1228static const struct file_operations pinmux_maps_ops = {
1229 .open = pinmux_maps_open,
1230 .read = seq_read,
1231 .llseek = seq_lseek,
1232 .release = single_release,
1233};
1234
1235void pinmux_init_device_debugfs(struct dentry *devroot, 606void pinmux_init_device_debugfs(struct dentry *devroot,
1236 struct pinctrl_dev *pctldev) 607 struct pinctrl_dev *pctldev)
1237{ 608{
@@ -1239,16 +610,6 @@ void pinmux_init_device_debugfs(struct dentry *devroot,
1239 devroot, pctldev, &pinmux_functions_ops); 610 devroot, pctldev, &pinmux_functions_ops);
1240 debugfs_create_file("pinmux-pins", S_IFREG | S_IRUGO, 611 debugfs_create_file("pinmux-pins", S_IFREG | S_IRUGO,
1241 devroot, pctldev, &pinmux_pins_ops); 612 devroot, pctldev, &pinmux_pins_ops);
1242 debugfs_create_file("pinmux-hogs", S_IFREG | S_IRUGO,
1243 devroot, pctldev, &pinmux_hogs_ops);
1244}
1245
1246void pinmux_init_debugfs(struct dentry *subsys_root)
1247{
1248 debugfs_create_file("pinmuxes", S_IFREG | S_IRUGO,
1249 subsys_root, NULL, &pinmux_ops);
1250 debugfs_create_file("pinmux-maps", S_IFREG | S_IRUGO,
1251 subsys_root, NULL, &pinmux_maps_ops);
1252} 613}
1253 614
1254#endif /* CONFIG_DEBUG_FS */ 615#endif /* CONFIG_DEBUG_FS */
diff --git a/drivers/pinctrl/pinmux.h b/drivers/pinctrl/pinmux.h
index 97f52223fbc2..6fc47003e95d 100644
--- a/drivers/pinctrl/pinmux.h
+++ b/drivers/pinctrl/pinmux.h
@@ -13,11 +13,29 @@
13#ifdef CONFIG_PINMUX 13#ifdef CONFIG_PINMUX
14 14
15int pinmux_check_ops(struct pinctrl_dev *pctldev); 15int pinmux_check_ops(struct pinctrl_dev *pctldev);
16
17int pinmux_validate_map(struct pinctrl_map const *map, int i);
18
19int pinmux_request_gpio(struct pinctrl_dev *pctldev,
20 struct pinctrl_gpio_range *range,
21 unsigned pin, unsigned gpio);
22void pinmux_free_gpio(struct pinctrl_dev *pctldev, unsigned pin,
23 struct pinctrl_gpio_range *range);
24int pinmux_gpio_direction(struct pinctrl_dev *pctldev,
25 struct pinctrl_gpio_range *range,
26 unsigned pin, bool input);
27
28int pinmux_map_to_setting(struct pinctrl_map const *map,
29 struct pinctrl_setting *setting);
30void pinmux_free_setting(struct pinctrl_setting const *setting);
31int pinmux_enable_setting(struct pinctrl_setting const *setting);
32void pinmux_disable_setting(struct pinctrl_setting const *setting);
33
34void pinmux_show_map(struct seq_file *s, struct pinctrl_map const *map);
35void pinmux_show_setting(struct seq_file *s,
36 struct pinctrl_setting const *setting);
16void pinmux_init_device_debugfs(struct dentry *devroot, 37void pinmux_init_device_debugfs(struct dentry *devroot,
17 struct pinctrl_dev *pctldev); 38 struct pinctrl_dev *pctldev);
18void pinmux_init_debugfs(struct dentry *subsys_root);
19int pinmux_hog_maps(struct pinctrl_dev *pctldev);
20void pinmux_unhog_maps(struct pinctrl_dev *pctldev);
21 39
22#else 40#else
23 41
@@ -26,21 +44,63 @@ static inline int pinmux_check_ops(struct pinctrl_dev *pctldev)
26 return 0; 44 return 0;
27} 45}
28 46
29static inline void pinmux_init_device_debugfs(struct dentry *devroot, 47static inline int pinmux_validate_map(struct pinctrl_map const *map, int i)
30 struct pinctrl_dev *pctldev)
31{ 48{
49 return 0;
32} 50}
33 51
34static inline void pinmux_init_debugfs(struct dentry *subsys_root) 52static inline int pinmux_request_gpio(struct pinctrl_dev *pctldev,
53 struct pinctrl_gpio_range *range,
54 unsigned pin, unsigned gpio)
35{ 55{
56 return 0;
36} 57}
37 58
38static inline int pinmux_hog_maps(struct pinctrl_dev *pctldev) 59static inline void pinmux_free_gpio(struct pinctrl_dev *pctldev,
60 unsigned pin,
61 struct pinctrl_gpio_range *range)
62{
63}
64
65static inline int pinmux_gpio_direction(struct pinctrl_dev *pctldev,
66 struct pinctrl_gpio_range *range,
67 unsigned pin, bool input)
68{
69 return 0;
70}
71
72static inline int pinmux_map_to_setting(struct pinctrl_map const *map,
73 struct pinctrl_setting *setting)
39{ 74{
40 return 0; 75 return 0;
41} 76}
42 77
43static inline void pinmux_unhog_maps(struct pinctrl_dev *pctldev) 78static inline void pinmux_free_setting(struct pinctrl_setting const *setting)
79{
80}
81
82static inline int pinmux_enable_setting(struct pinctrl_setting const *setting)
83{
84 return 0;
85}
86
87static inline void pinmux_disable_setting(
88 struct pinctrl_setting const *setting)
89{
90}
91
92static inline void pinmux_show_map(struct seq_file *s,
93 struct pinctrl_map const *map)
94{
95}
96
97static inline void pinmux_show_setting(struct seq_file *s,
98 struct pinctrl_setting const *setting)
99{
100}
101
102static inline void pinmux_init_device_debugfs(struct dentry *devroot,
103 struct pinctrl_dev *pctldev)
44{ 104{
45} 105}
46 106
diff --git a/drivers/tty/serial/sirfsoc_uart.c b/drivers/tty/serial/sirfsoc_uart.c
index a60523fee11b..5b3eda2024fe 100644
--- a/drivers/tty/serial/sirfsoc_uart.c
+++ b/drivers/tty/serial/sirfsoc_uart.c
@@ -22,7 +22,7 @@
22#include <linux/io.h> 22#include <linux/io.h>
23#include <asm/irq.h> 23#include <asm/irq.h>
24#include <asm/mach/irq.h> 24#include <asm/mach/irq.h>
25#include <linux/pinctrl/pinmux.h> 25#include <linux/pinctrl/consumer.h>
26 26
27#include "sirfsoc_uart.h" 27#include "sirfsoc_uart.h"
28 28
@@ -673,12 +673,10 @@ int sirfsoc_uart_probe(struct platform_device *pdev)
673 port->irq = res->start; 673 port->irq = res->start;
674 674
675 if (sirfport->hw_flow_ctrl) { 675 if (sirfport->hw_flow_ctrl) {
676 sirfport->pmx = pinmux_get(&pdev->dev, NULL); 676 sirfport->p = pinctrl_get_select_default(&pdev->dev);
677 ret = IS_ERR(sirfport->pmx); 677 ret = IS_ERR(sirfport->p);
678 if (ret) 678 if (ret)
679 goto pmx_err; 679 goto pin_err;
680
681 pinmux_enable(sirfport->pmx);
682 } 680 }
683 681
684 port->ops = &sirfsoc_uart_ops; 682 port->ops = &sirfsoc_uart_ops;
@@ -695,11 +693,9 @@ int sirfsoc_uart_probe(struct platform_device *pdev)
695 693
696port_err: 694port_err:
697 platform_set_drvdata(pdev, NULL); 695 platform_set_drvdata(pdev, NULL);
698 if (sirfport->hw_flow_ctrl) { 696 if (sirfport->hw_flow_ctrl)
699 pinmux_disable(sirfport->pmx); 697 pinctrl_put(sirfport->p);
700 pinmux_put(sirfport->pmx); 698pin_err:
701 }
702pmx_err:
703irq_err: 699irq_err:
704 devm_iounmap(&pdev->dev, port->membase); 700 devm_iounmap(&pdev->dev, port->membase);
705err: 701err:
@@ -711,10 +707,8 @@ static int sirfsoc_uart_remove(struct platform_device *pdev)
711 struct sirfsoc_uart_port *sirfport = platform_get_drvdata(pdev); 707 struct sirfsoc_uart_port *sirfport = platform_get_drvdata(pdev);
712 struct uart_port *port = &sirfport->port; 708 struct uart_port *port = &sirfport->port;
713 platform_set_drvdata(pdev, NULL); 709 platform_set_drvdata(pdev, NULL);
714 if (sirfport->hw_flow_ctrl) { 710 if (sirfport->hw_flow_ctrl)
715 pinmux_disable(sirfport->pmx); 711 pinctrl_put(sirfport->p);
716 pinmux_put(sirfport->pmx);
717 }
718 devm_iounmap(&pdev->dev, port->membase); 712 devm_iounmap(&pdev->dev, port->membase);
719 uart_remove_one_port(&sirfsoc_uart_drv, port); 713 uart_remove_one_port(&sirfsoc_uart_drv, port);
720 return 0; 714 return 0;
diff --git a/drivers/tty/serial/sirfsoc_uart.h b/drivers/tty/serial/sirfsoc_uart.h
index fc64260fa93c..6e207fdc2fed 100644
--- a/drivers/tty/serial/sirfsoc_uart.h
+++ b/drivers/tty/serial/sirfsoc_uart.h
@@ -162,7 +162,7 @@ struct sirfsoc_uart_port {
162 unsigned char ms_enabled; 162 unsigned char ms_enabled;
163 163
164 struct uart_port port; 164 struct uart_port port;
165 struct pinmux *pmx; 165 struct pinctrl *p;
166}; 166};
167 167
168/* Hardware Flow Control */ 168/* Hardware Flow Control */
diff --git a/include/linux/pinctrl/consumer.h b/include/linux/pinctrl/consumer.h
new file mode 100644
index 000000000000..191e72688481
--- /dev/null
+++ b/include/linux/pinctrl/consumer.h
@@ -0,0 +1,159 @@
1/*
2 * Consumer interface the pin control subsystem
3 *
4 * Copyright (C) 2012 ST-Ericsson SA
5 * Written on behalf of Linaro for ST-Ericsson
6 * Based on bits of regulator core, gpio core and clk core
7 *
8 * Author: Linus Walleij <linus.walleij@linaro.org>
9 *
10 * License terms: GNU General Public License (GPL) version 2
11 */
12#ifndef __LINUX_PINCTRL_CONSUMER_H
13#define __LINUX_PINCTRL_CONSUMER_H
14
15#include <linux/err.h>
16#include <linux/list.h>
17#include <linux/seq_file.h>
18#include "pinctrl-state.h"
19
20/* This struct is private to the core and should be regarded as a cookie */
21struct pinctrl;
22struct pinctrl_state;
23
24#ifdef CONFIG_PINCTRL
25
26/* External interface to pin control */
27extern int pinctrl_request_gpio(unsigned gpio);
28extern void pinctrl_free_gpio(unsigned gpio);
29extern int pinctrl_gpio_direction_input(unsigned gpio);
30extern int pinctrl_gpio_direction_output(unsigned gpio);
31
32extern struct pinctrl * __must_check pinctrl_get(struct device *dev);
33extern void pinctrl_put(struct pinctrl *p);
34extern struct pinctrl_state * __must_check pinctrl_lookup_state(
35 struct pinctrl *p,
36 const char *name);
37extern int pinctrl_select_state(struct pinctrl *p, struct pinctrl_state *s);
38
39#else /* !CONFIG_PINCTRL */
40
41static inline int pinctrl_request_gpio(unsigned gpio)
42{
43 return 0;
44}
45
46static inline void pinctrl_free_gpio(unsigned gpio)
47{
48}
49
50static inline int pinctrl_gpio_direction_input(unsigned gpio)
51{
52 return 0;
53}
54
55static inline int pinctrl_gpio_direction_output(unsigned gpio)
56{
57 return 0;
58}
59
60static inline struct pinctrl * __must_check pinctrl_get(struct device *dev)
61{
62 return NULL;
63}
64
65static inline void pinctrl_put(struct pinctrl *p)
66{
67}
68
69static inline struct pinctrl_state * __must_check pinctrl_lookup_state(
70 struct pinctrl *p,
71 const char *name)
72{
73 return NULL;
74}
75
76static inline int pinctrl_select_state(struct pinctrl *p,
77 struct pinctrl_state *s)
78{
79 return 0;
80}
81
82#endif /* CONFIG_PINCTRL */
83
84static inline struct pinctrl * __must_check pinctrl_get_select(
85 struct device *dev, const char *name)
86{
87 struct pinctrl *p;
88 struct pinctrl_state *s;
89 int ret;
90
91 p = pinctrl_get(dev);
92 if (IS_ERR(p))
93 return p;
94
95 s = pinctrl_lookup_state(p, name);
96 if (IS_ERR(s)) {
97 pinctrl_put(p);
98 return ERR_PTR(PTR_ERR(s));
99 }
100
101 ret = pinctrl_select_state(p, s);
102 if (ret < 0) {
103 pinctrl_put(p);
104 return ERR_PTR(ret);
105 }
106
107 return p;
108}
109
110static inline struct pinctrl * __must_check pinctrl_get_select_default(
111 struct device *dev)
112{
113 return pinctrl_get_select(dev, PINCTRL_STATE_DEFAULT);
114}
115
116#ifdef CONFIG_PINCONF
117
118extern int pin_config_get(const char *dev_name, const char *name,
119 unsigned long *config);
120extern int pin_config_set(const char *dev_name, const char *name,
121 unsigned long config);
122extern int pin_config_group_get(const char *dev_name,
123 const char *pin_group,
124 unsigned long *config);
125extern int pin_config_group_set(const char *dev_name,
126 const char *pin_group,
127 unsigned long config);
128
129#else
130
131static inline int pin_config_get(const char *dev_name, const char *name,
132 unsigned long *config)
133{
134 return 0;
135}
136
137static inline int pin_config_set(const char *dev_name, const char *name,
138 unsigned long config)
139{
140 return 0;
141}
142
143static inline int pin_config_group_get(const char *dev_name,
144 const char *pin_group,
145 unsigned long *config)
146{
147 return 0;
148}
149
150static inline int pin_config_group_set(const char *dev_name,
151 const char *pin_group,
152 unsigned long config)
153{
154 return 0;
155}
156
157#endif
158
159#endif /* __LINUX_PINCTRL_CONSUMER_H */
diff --git a/include/linux/pinctrl/machine.h b/include/linux/pinctrl/machine.h
index d0aecb7f6fb9..fee4349364f7 100644
--- a/include/linux/pinctrl/machine.h
+++ b/include/linux/pinctrl/machine.h
@@ -9,87 +9,153 @@
9 * 9 *
10 * License terms: GNU General Public License (GPL) version 2 10 * License terms: GNU General Public License (GPL) version 2
11 */ 11 */
12#ifndef __LINUX_PINMUX_MACHINE_H 12#ifndef __LINUX_PINCTRL_MACHINE_H
13#define __LINUX_PINMUX_MACHINE_H 13#define __LINUX_PINCTRL_MACHINE_H
14
15#include "pinctrl-state.h"
16
17enum pinctrl_map_type {
18 PIN_MAP_TYPE_INVALID,
19 PIN_MAP_TYPE_DUMMY_STATE,
20 PIN_MAP_TYPE_MUX_GROUP,
21 PIN_MAP_TYPE_CONFIGS_PIN,
22 PIN_MAP_TYPE_CONFIGS_GROUP,
23};
24
25/**
26 * struct pinctrl_map_mux - mapping table content for MAP_TYPE_MUX_GROUP
27 * @group: the name of the group whose mux function is to be configured. This
28 * field may be left NULL, and the first applicable group for the function
29 * will be used.
30 * @function: the mux function to select for the group
31 */
32struct pinctrl_map_mux {
33 const char *group;
34 const char *function;
35};
14 36
15/** 37/**
16 * struct pinmux_map - boards/machines shall provide this map for devices 38 * struct pinctrl_map_configs - mapping table content for MAP_TYPE_CONFIGS_*
39 * @group_or_pin: the name of the pin or group whose configuration parameters
40 * are to be configured.
41 * @configs: a pointer to an array of config parameters/values to program into
42 * hardware. Each individual pin controller defines the format and meaning
43 * of config parameters.
44 * @num_configs: the number of entries in array @configs
45 */
46struct pinctrl_map_configs {
47 const char *group_or_pin;
48 unsigned long *configs;
49 unsigned num_configs;
50};
51
52/**
53 * struct pinctrl_map - boards/machines shall provide this map for devices
54 * @dev_name: the name of the device using this specific mapping, the name
55 * must be the same as in your struct device*. If this name is set to the
56 * same name as the pin controllers own dev_name(), the map entry will be
57 * hogged by the driver itself upon registration
17 * @name: the name of this specific map entry for the particular machine. 58 * @name: the name of this specific map entry for the particular machine.
18 * This is the second parameter passed to pinmux_get() when you want 59 * This is the parameter passed to pinmux_lookup_state()
19 * to have several mappings to the same device 60 * @type: the type of mapping table entry
20 * @ctrl_dev: the pin control device to be used by this mapping, may be NULL
21 * if you provide .ctrl_dev_name instead (this is more common)
22 * @ctrl_dev_name: the name of the device controlling this specific mapping, 61 * @ctrl_dev_name: the name of the device controlling this specific mapping,
23 * the name must be the same as in your struct device*, may be NULL if 62 * the name must be the same as in your struct device*. This field is not
24 * you provide .ctrl_dev instead 63 * used for PIN_MAP_TYPE_DUMMY_STATE
25 * @function: a function in the driver to use for this mapping, the driver 64 * @data: Data specific to the mapping type
26 * will lookup the function referenced by this ID on the specified
27 * pin control device
28 * @group: sometimes a function can map to different pin groups, so this
29 * selects a certain specific pin group to activate for the function, if
30 * left as NULL, the first applicable group will be used
31 * @dev: the device using this specific mapping, may be NULL if you provide
32 * .dev_name instead (this is more common)
33 * @dev_name: the name of the device using this specific mapping, the name
34 * must be the same as in your struct device*, may be NULL if you
35 * provide .dev instead
36 * @hog_on_boot: if this is set to true, the pin control subsystem will itself
37 * hog the mappings as the pinmux device drivers are attached, so this is
38 * typically used with system maps (mux mappings without an assigned
39 * device) that you want to get hogged and enabled by default as soon as
40 * a pinmux device supporting it is registered. These maps will not be
41 * disabled and put until the system shuts down.
42 */ 65 */
43struct pinmux_map { 66struct pinctrl_map {
67 const char *dev_name;
44 const char *name; 68 const char *name;
45 struct device *ctrl_dev; 69 enum pinctrl_map_type type;
46 const char *ctrl_dev_name; 70 const char *ctrl_dev_name;
47 const char *function; 71 union {
48 const char *group; 72 struct pinctrl_map_mux mux;
49 struct device *dev; 73 struct pinctrl_map_configs configs;
50 const char *dev_name; 74 } data;
51 bool hog_on_boot;
52}; 75};
53 76
54/* 77/* Convenience macros to create mapping table entries */
55 * Convenience macro to set a simple map from a certain pin controller and a
56 * certain function to a named device
57 */
58#define PINMUX_MAP(a, b, c, d) \
59 { .name = a, .ctrl_dev_name = b, .function = c, .dev_name = d }
60 78
61/* 79#define PIN_MAP_DUMMY_STATE(dev, state) \
62 * Convenience macro to map a system function onto a certain pinctrl device. 80 { \
63 * System functions are not assigned to a particular device. 81 .dev_name = dev, \
64 */ 82 .name = state, \
65#define PINMUX_MAP_SYS(a, b, c) \ 83 .type = PIN_MAP_TYPE_DUMMY_STATE, \
66 { .name = a, .ctrl_dev_name = b, .function = c } 84 }
67 85
68/* 86#define PIN_MAP_MUX_GROUP(dev, state, pinctrl, grp, func) \
69 * Convenience macro to map a system function onto a certain pinctrl device, 87 { \
70 * to be hogged by the pinmux core until the system shuts down. 88 .dev_name = dev, \
71 */ 89 .name = state, \
72#define PINMUX_MAP_SYS_HOG(a, b, c) \ 90 .type = PIN_MAP_TYPE_MUX_GROUP, \
73 { .name = a, .ctrl_dev_name = b, .function = c, \ 91 .ctrl_dev_name = pinctrl, \
74 .hog_on_boot = true } 92 .data.mux = { \
93 .group = grp, \
94 .function = func, \
95 }, \
96 }
75 97
76/* 98#define PIN_MAP_MUX_GROUP_DEFAULT(dev, pinctrl, grp, func) \
77 * Convenience macro to map a system function onto a certain pinctrl device 99 PIN_MAP_MUX_GROUP(dev, PINCTRL_STATE_DEFAULT, pinctrl, grp, func)
78 * using a specified group, to be hogged by the pinmux core until the system 100
79 * shuts down. 101#define PIN_MAP_MUX_GROUP_HOG(dev, state, grp, func) \
80 */ 102 PIN_MAP_MUX_GROUP(dev, state, dev, grp, func)
81#define PINMUX_MAP_SYS_HOG_GROUP(a, b, c, d) \ 103
82 { .name = a, .ctrl_dev_name = b, .function = c, .group = d, \ 104#define PIN_MAP_MUX_GROUP_HOG_DEFAULT(dev, grp, func) \
83 .hog_on_boot = true } 105 PIN_MAP_MUX_GROUP(dev, PINCTRL_STATE_DEFAULT, dev, grp, func)
106
107#define PIN_MAP_CONFIGS_PIN(dev, state, pinctrl, pin, cfgs) \
108 { \
109 .dev_name = dev, \
110 .name = state, \
111 .type = PIN_MAP_TYPE_CONFIGS_PIN, \
112 .ctrl_dev_name = pinctrl, \
113 .data.configs = { \
114 .group_or_pin = pin, \
115 .configs = cfgs, \
116 .num_configs = ARRAY_SIZE(cfgs), \
117 }, \
118 }
119
120#define PIN_MAP_CONFIGS_PIN_DEFAULT(dev, pinctrl, pin, cfgs) \
121 PIN_MAP_CONFIGS_PIN(dev, PINCTRL_STATE_DEFAULT, pinctrl, pin, cfgs)
122
123#define PIN_MAP_CONFIGS_PIN_HOG(dev, state, pin, cfgs) \
124 PIN_MAP_CONFIGS_PIN(dev, state, dev, pin, cfgs)
125
126#define PIN_MAP_CONFIGS_PIN_HOG_DEFAULT(dev, pin, cfgs) \
127 PIN_MAP_CONFIGS_PIN(dev, PINCTRL_STATE_DEFAULT, dev, pin, cfgs)
128
129#define PIN_MAP_CONFIGS_GROUP(dev, state, pinctrl, grp, cfgs) \
130 { \
131 .dev_name = dev, \
132 .name = state, \
133 .type = PIN_MAP_TYPE_CONFIGS_GROUP, \
134 .ctrl_dev_name = pinctrl, \
135 .data.configs = { \
136 .group_or_pin = grp, \
137 .configs = cfgs, \
138 .num_configs = ARRAY_SIZE(cfgs), \
139 }, \
140 }
141
142#define PIN_MAP_CONFIGS_GROUP_DEFAULT(dev, pinctrl, grp, cfgs) \
143 PIN_MAP_CONFIGS_GROUP(dev, PINCTRL_STATE_DEFAULT, pinctrl, grp, cfgs)
144
145#define PIN_MAP_CONFIGS_GROUP_HOG(dev, state, grp, cfgs) \
146 PIN_MAP_CONFIGS_GROUP(dev, state, dev, grp, cfgs)
147
148#define PIN_MAP_CONFIGS_GROUP_HOG_DEFAULT(dev, grp, cfgs) \
149 PIN_MAP_CONFIGS_GROUP(dev, PINCTRL_STATE_DEFAULT, dev, grp, cfgs)
84 150
85#ifdef CONFIG_PINMUX 151#ifdef CONFIG_PINMUX
86 152
87extern int pinmux_register_mappings(struct pinmux_map const *map, 153extern int pinctrl_register_mappings(struct pinctrl_map const *map,
88 unsigned num_maps); 154 unsigned num_maps);
89 155
90#else 156#else
91 157
92static inline int pinmux_register_mappings(struct pinmux_map const *map, 158static inline int pinctrl_register_mappings(struct pinctrl_map const *map,
93 unsigned num_maps) 159 unsigned num_maps)
94{ 160{
95 return 0; 161 return 0;
diff --git a/include/linux/pinctrl/pinconf-generic.h b/include/linux/pinctrl/pinconf-generic.h
new file mode 100644
index 000000000000..4f0abb9f1c09
--- /dev/null
+++ b/include/linux/pinctrl/pinconf-generic.h
@@ -0,0 +1,114 @@
1/*
2 * Interface the generic pinconfig portions of the pinctrl subsystem
3 *
4 * Copyright (C) 2011 ST-Ericsson SA
5 * Written on behalf of Linaro for ST-Ericsson
6 * This interface is used in the core to keep track of pins.
7 *
8 * Author: Linus Walleij <linus.walleij@linaro.org>
9 *
10 * License terms: GNU General Public License (GPL) version 2
11 */
12#ifndef __LINUX_PINCTRL_PINCONF_GENERIC_H
13#define __LINUX_PINCTRL_PINCONF_GENERIC_H
14
15/*
16 * You shouldn't even be able to compile with these enums etc unless you're
17 * using generic pin config. That is why this is defined out.
18 */
19#ifdef CONFIG_GENERIC_PINCONF
20
21/**
22 * enum pin_config_param - possible pin configuration parameters
23 * @PIN_CONFIG_BIAS_DISABLE: disable any pin bias on the pin, a
24 * transition from say pull-up to pull-down implies that you disable
25 * pull-up in the process, this setting disables all biasing.
26 * @PIN_CONFIG_BIAS_HIGH_IMPEDANCE: the pin will be set to a high impedance
27 * mode, also know as "third-state" (tristate) or "high-Z" or "floating".
28 * On output pins this effectively disconnects the pin, which is useful
29 * if for example some other pin is going to drive the signal connected
30 * to it for a while. Pins used for input are usually always high
31 * impedance.
32 * @PIN_CONFIG_BIAS_PULL_UP: the pin will be pulled up (usually with high
33 * impedance to VDD). If the argument is != 0 pull-up is enabled,
34 * if it is 0, pull-up is disabled.
35 * @PIN_CONFIG_BIAS_PULL_DOWN: the pin will be pulled down (usually with high
36 * impedance to GROUND). If the argument is != 0 pull-down is enabled,
37 * if it is 0, pull-down is disabled.
38 * @PIN_CONFIG_DRIVE_PUSH_PULL: the pin will be driven actively high and
39 * low, this is the most typical case and is typically achieved with two
40 * active transistors on the output. Sending this config will enabale
41 * push-pull mode, the argument is ignored.
42 * @PIN_CONFIG_DRIVE_OPEN_DRAIN: the pin will be driven with open drain (open
43 * collector) which means it is usually wired with other output ports
44 * which are then pulled up with an external resistor. Sending this
45 * config will enabale open drain mode, the argument is ignored.
46 * @PIN_CONFIG_DRIVE_OPEN_SOURCE: the pin will be driven with open source
47 * (open emitter). Sending this config will enabale open drain mode, the
48 * argument is ignored.
49 * @PIN_CONFIG_INPUT_SCHMITT: this will configure an input pin to run in
50 * schmitt-trigger mode. If the schmitt-trigger has adjustable hysteresis,
51 * the threshold value is given on a custom format as argument when
52 * setting pins to this mode. The argument zero turns the schmitt trigger
53 * off.
54 * @PIN_CONFIG_INPUT_DEBOUNCE: this will configure the pin to debounce mode,
55 * which means it will wait for signals to settle when reading inputs. The
56 * argument gives the debounce time on a custom format. Setting the
57 * argument to zero turns debouncing off.
58 * @PIN_CONFIG_POWER_SOURCE: if the pin can select between different power
59 * supplies, the argument to this parameter (on a custom format) tells
60 * the driver which alternative power source to use.
61 * @PIN_CONFIG_LOW_POWER_MODE: this will configure the pin for low power
62 * operation, if several modes of operation are supported these can be
63 * passed in the argument on a custom form, else just use argument 1
64 * to indicate low power mode, argument 0 turns low power mode off.
65 * @PIN_CONFIG_END: this is the last enumerator for pin configurations, if
66 * you need to pass in custom configurations to the pin controller, use
67 * PIN_CONFIG_END+1 as the base offset.
68 */
69enum pin_config_param {
70 PIN_CONFIG_BIAS_DISABLE,
71 PIN_CONFIG_BIAS_HIGH_IMPEDANCE,
72 PIN_CONFIG_BIAS_PULL_UP,
73 PIN_CONFIG_BIAS_PULL_DOWN,
74 PIN_CONFIG_DRIVE_PUSH_PULL,
75 PIN_CONFIG_DRIVE_OPEN_DRAIN,
76 PIN_CONFIG_DRIVE_OPEN_SOURCE,
77 PIN_CONFIG_INPUT_SCHMITT,
78 PIN_CONFIG_INPUT_DEBOUNCE,
79 PIN_CONFIG_POWER_SOURCE,
80 PIN_CONFIG_LOW_POWER_MODE,
81 PIN_CONFIG_END = 0x7FFF,
82};
83
84/*
85 * Helpful configuration macro to be used in tables etc.
86 */
87#define PIN_CONF_PACKED(p, a) ((a << 16) | ((unsigned long) p & 0xffffUL))
88
89/*
90 * The following inlines stuffs a configuration parameter and data value
91 * into and out of an unsigned long argument, as used by the generic pin config
92 * system. We put the parameter in the lower 16 bits and the argument in the
93 * upper 16 bits.
94 */
95
96static inline enum pin_config_param pinconf_to_config_param(unsigned long config)
97{
98 return (enum pin_config_param) (config & 0xffffUL);
99}
100
101static inline u16 pinconf_to_config_argument(unsigned long config)
102{
103 return (enum pin_config_param) ((config >> 16) & 0xffffUL);
104}
105
106static inline unsigned long pinconf_to_config_packed(enum pin_config_param param,
107 u16 argument)
108{
109 return PIN_CONF_PACKED(param, argument);
110}
111
112#endif /* CONFIG_GENERIC_PINCONF */
113
114#endif /* __LINUX_PINCTRL_PINCONF_GENERIC_H */
diff --git a/include/linux/pinctrl/pinconf.h b/include/linux/pinctrl/pinconf.h
index 477922cf043a..ec431f03362d 100644
--- a/include/linux/pinctrl/pinconf.h
+++ b/include/linux/pinctrl/pinconf.h
@@ -20,6 +20,8 @@ struct seq_file;
20/** 20/**
21 * struct pinconf_ops - pin config operations, to be implemented by 21 * struct pinconf_ops - pin config operations, to be implemented by
22 * pin configuration capable drivers. 22 * pin configuration capable drivers.
23 * @is_generic: for pin controllers that want to use the generic interface,
24 * this flag tells the framework that it's generic.
23 * @pin_config_get: get the config of a certain pin, if the requested config 25 * @pin_config_get: get the config of a certain pin, if the requested config
24 * is not available on this controller this should return -ENOTSUPP 26 * is not available on this controller this should return -ENOTSUPP
25 * and if it is available but disabled it should return -EINVAL 27 * and if it is available but disabled it should return -EINVAL
@@ -33,6 +35,9 @@ struct seq_file;
33 * per-device info for a certain group in debugfs 35 * per-device info for a certain group in debugfs
34 */ 36 */
35struct pinconf_ops { 37struct pinconf_ops {
38#ifdef CONFIG_GENERIC_PINCONF
39 bool is_generic;
40#endif
36 int (*pin_config_get) (struct pinctrl_dev *pctldev, 41 int (*pin_config_get) (struct pinctrl_dev *pctldev,
37 unsigned pin, 42 unsigned pin,
38 unsigned long *config); 43 unsigned long *config);
@@ -53,45 +58,6 @@ struct pinconf_ops {
53 unsigned selector); 58 unsigned selector);
54}; 59};
55 60
56extern int pin_config_get(const char *dev_name, const char *name,
57 unsigned long *config);
58extern int pin_config_set(const char *dev_name, const char *name,
59 unsigned long config);
60extern int pin_config_group_get(const char *dev_name,
61 const char *pin_group,
62 unsigned long *config);
63extern int pin_config_group_set(const char *dev_name,
64 const char *pin_group,
65 unsigned long config);
66
67#else
68
69static inline int pin_config_get(const char *dev_name, const char *name,
70 unsigned long *config)
71{
72 return 0;
73}
74
75static inline int pin_config_set(const char *dev_name, const char *name,
76 unsigned long config)
77{
78 return 0;
79}
80
81static inline int pin_config_group_get(const char *dev_name,
82 const char *pin_group,
83 unsigned long *config)
84{
85 return 0;
86}
87
88static inline int pin_config_group_set(const char *dev_name,
89 const char *pin_group,
90 unsigned long config)
91{
92 return 0;
93}
94
95#endif 61#endif
96 62
97#endif /* __LINUX_PINCTRL_PINCONF_H */ 63#endif /* __LINUX_PINCTRL_PINCONF_H */
diff --git a/include/linux/pinctrl/pinctrl-state.h b/include/linux/pinctrl/pinctrl-state.h
new file mode 100644
index 000000000000..3920e28b4da7
--- /dev/null
+++ b/include/linux/pinctrl/pinctrl-state.h
@@ -0,0 +1,6 @@
1/*
2 * Standard pin control state definitions
3 */
4
5#define PINCTRL_STATE_DEFAULT "default"
6#define PINCTRL_STATE_IDLE "idle"
diff --git a/include/linux/pinctrl/pinctrl.h b/include/linux/pinctrl/pinctrl.h
index 8bd22ee7aa09..4e9f0788c221 100644
--- a/include/linux/pinctrl/pinctrl.h
+++ b/include/linux/pinctrl/pinctrl.h
@@ -15,10 +15,11 @@
15#ifdef CONFIG_PINCTRL 15#ifdef CONFIG_PINCTRL
16 16
17#include <linux/radix-tree.h> 17#include <linux/radix-tree.h>
18#include <linux/spinlock.h>
19#include <linux/list.h> 18#include <linux/list.h>
20#include <linux/seq_file.h> 19#include <linux/seq_file.h>
20#include "pinctrl-state.h"
21 21
22struct device;
22struct pinctrl_dev; 23struct pinctrl_dev;
23struct pinmux_ops; 24struct pinmux_ops;
24struct pinconf_ops; 25struct pinconf_ops;
diff --git a/include/linux/pinctrl/pinmux.h b/include/linux/pinctrl/pinmux.h
index 937b3e2fa36f..47e9237edd47 100644
--- a/include/linux/pinctrl/pinmux.h
+++ b/include/linux/pinctrl/pinmux.h
@@ -16,9 +16,6 @@
16#include <linux/seq_file.h> 16#include <linux/seq_file.h>
17#include "pinctrl.h" 17#include "pinctrl.h"
18 18
19/* This struct is private to the core and should be regarded as a cookie */
20struct pinmux;
21
22#ifdef CONFIG_PINMUX 19#ifdef CONFIG_PINMUX
23 20
24struct pinctrl_dev; 21struct pinctrl_dev;
@@ -88,55 +85,6 @@ struct pinmux_ops {
88 bool input); 85 bool input);
89}; 86};
90 87
91/* External interface to pinmux */
92extern int pinmux_request_gpio(unsigned gpio);
93extern void pinmux_free_gpio(unsigned gpio);
94extern int pinmux_gpio_direction_input(unsigned gpio);
95extern int pinmux_gpio_direction_output(unsigned gpio);
96extern struct pinmux * __must_check pinmux_get(struct device *dev, const char *name);
97extern void pinmux_put(struct pinmux *pmx);
98extern int pinmux_enable(struct pinmux *pmx);
99extern void pinmux_disable(struct pinmux *pmx);
100
101#else /* !CONFIG_PINMUX */
102
103static inline int pinmux_request_gpio(unsigned gpio)
104{
105 return 0;
106}
107
108static inline void pinmux_free_gpio(unsigned gpio)
109{
110}
111
112static inline int pinmux_gpio_direction_input(unsigned gpio)
113{
114 return 0;
115}
116
117static inline int pinmux_gpio_direction_output(unsigned gpio)
118{
119 return 0;
120}
121
122static inline struct pinmux * __must_check pinmux_get(struct device *dev, const char *name)
123{
124 return NULL;
125}
126
127static inline void pinmux_put(struct pinmux *pmx)
128{
129}
130
131static inline int pinmux_enable(struct pinmux *pmx)
132{
133 return 0;
134}
135
136static inline void pinmux_disable(struct pinmux *pmx)
137{
138}
139
140#endif /* CONFIG_PINMUX */ 88#endif /* CONFIG_PINMUX */
141 89
142#endif /* __LINUX_PINCTRL_PINMUX_H */ 90#endif /* __LINUX_PINCTRL_PINMUX_H */