diff options
Diffstat (limited to 'Documentation/pinctrl.txt')
| -rw-r--r-- | Documentation/pinctrl.txt | 275 |
1 files changed, 186 insertions, 89 deletions
diff --git a/Documentation/pinctrl.txt b/Documentation/pinctrl.txt index b04cb7d45a16..150fd3833d0b 100644 --- a/Documentation/pinctrl.txt +++ b/Documentation/pinctrl.txt | |||
| @@ -7,12 +7,9 @@ This subsystem deals with: | |||
| 7 | 7 | ||
| 8 | - Multiplexing of pins, pads, fingers (etc) see below for details | 8 | - Multiplexing of pins, pads, fingers (etc) see below for details |
| 9 | 9 | ||
| 10 | The intention is to also deal with: | 10 | - Configuration of pins, pads, fingers (etc), such as software-controlled |
| 11 | 11 | biasing and driving mode specific pins, such as pull-up/down, open drain, | |
| 12 | - Software-controlled biasing and driving mode specific pins, such as | 12 | load capacitance etc. |
| 13 | pull-up/down, open drain etc, load capacitance configuration when controlled | ||
| 14 | by software, etc. | ||
| 15 | |||
| 16 | 13 | ||
| 17 | Top-level interface | 14 | Top-level interface |
| 18 | =================== | 15 | =================== |
| @@ -32,7 +29,7 @@ Definition of PIN: | |||
| 32 | be sparse - i.e. there may be gaps in the space with numbers where no | 29 | be sparse - i.e. there may be gaps in the space with numbers where no |
| 33 | pin exists. | 30 | pin exists. |
| 34 | 31 | ||
| 35 | When a PIN CONTROLLER is instatiated, it will register a descriptor to the | 32 | When a PIN CONTROLLER is instantiated, it will register a descriptor to the |
| 36 | pin control framework, and this descriptor contains an array of pin descriptors | 33 | pin control framework, and this descriptor contains an array of pin descriptors |
| 37 | describing the pins handled by this specific pin controller. | 34 | describing the pins handled by this specific pin controller. |
| 38 | 35 | ||
| @@ -61,14 +58,14 @@ this in our driver: | |||
| 61 | 58 | ||
| 62 | #include <linux/pinctrl/pinctrl.h> | 59 | #include <linux/pinctrl/pinctrl.h> |
| 63 | 60 | ||
| 64 | const struct pinctrl_pin_desc __refdata foo_pins[] = { | 61 | const struct pinctrl_pin_desc foo_pins[] = { |
| 65 | PINCTRL_PIN(0, "A1"), | 62 | PINCTRL_PIN(0, "A8"), |
| 66 | PINCTRL_PIN(1, "A2"), | 63 | PINCTRL_PIN(1, "B8"), |
| 67 | PINCTRL_PIN(2, "A3"), | 64 | PINCTRL_PIN(2, "C8"), |
| 68 | ... | 65 | ... |
| 69 | PINCTRL_PIN(61, "H6"), | 66 | PINCTRL_PIN(61, "F1"), |
| 70 | PINCTRL_PIN(62, "H7"), | 67 | PINCTRL_PIN(62, "G1"), |
| 71 | PINCTRL_PIN(63, "H8"), | 68 | PINCTRL_PIN(63, "H1"), |
| 72 | }; | 69 | }; |
| 73 | 70 | ||
| 74 | static struct pinctrl_desc foo_desc = { | 71 | static struct pinctrl_desc foo_desc = { |
| @@ -88,11 +85,16 @@ int __init foo_probe(void) | |||
| 88 | pr_err("could not register foo pin driver\n"); | 85 | pr_err("could not register foo pin driver\n"); |
| 89 | } | 86 | } |
| 90 | 87 | ||
| 88 | To enable the pinctrl subsystem and the subgroups for PINMUX and PINCONF and | ||
| 89 | selected drivers, you need to select them from your machine's Kconfig entry, | ||
| 90 | since these are so tightly integrated with the machines they are used on. | ||
| 91 | See for example arch/arm/mach-u300/Kconfig for an example. | ||
| 92 | |||
| 91 | Pins usually have fancier names than this. You can find these in the dataheet | 93 | Pins usually have fancier names than this. You can find these in the dataheet |
| 92 | for your chip. Notice that the core pinctrl.h file provides a fancy macro | 94 | for your chip. Notice that the core pinctrl.h file provides a fancy macro |
| 93 | called PINCTRL_PIN() to create the struct entries. As you can see I enumerated | 95 | called PINCTRL_PIN() to create the struct entries. As you can see I enumerated |
| 94 | the pins from 0 in the upper left corner to 63 in the lower right corner, | 96 | the pins from 0 in the upper left corner to 63 in the lower right corner. |
| 95 | this enumeration was arbitrarily chosen, in practice you need to think | 97 | This enumeration was arbitrarily chosen, in practice you need to think |
| 96 | through your numbering system so that it matches the layout of registers | 98 | through your numbering system so that it matches the layout of registers |
| 97 | and such things in your driver, or the code may become complicated. You must | 99 | and such things in your driver, or the code may become complicated. You must |
| 98 | also consider matching of offsets to the GPIO ranges that may be handled by | 100 | also consider matching of offsets to the GPIO ranges that may be handled by |
| @@ -133,8 +135,8 @@ struct foo_group { | |||
| 133 | const unsigned num_pins; | 135 | const unsigned num_pins; |
| 134 | }; | 136 | }; |
| 135 | 137 | ||
| 136 | static unsigned int spi0_pins[] = { 0, 8, 16, 24 }; | 138 | static const unsigned int spi0_pins[] = { 0, 8, 16, 24 }; |
| 137 | static unsigned int i2c0_pins[] = { 24, 25 }; | 139 | static const unsigned int i2c0_pins[] = { 24, 25 }; |
| 138 | 140 | ||
| 139 | static const struct foo_group foo_groups[] = { | 141 | static const struct foo_group foo_groups[] = { |
| 140 | { | 142 | { |
| @@ -193,6 +195,88 @@ structure, for example specific register ranges associated with each group | |||
| 193 | and so on. | 195 | and so on. |
| 194 | 196 | ||
| 195 | 197 | ||
| 198 | Pin configuration | ||
| 199 | ================= | ||
| 200 | |||
| 201 | Pins can sometimes be software-configured in an various ways, mostly related | ||
| 202 | to their electronic properties when used as inputs or outputs. For example you | ||
| 203 | may be able to make an output pin high impedance, or "tristate" meaning it is | ||
| 204 | effectively disconnected. You may be able to connect an input pin to VDD or GND | ||
| 205 | using a certain resistor value - pull up and pull down - so that the pin has a | ||
| 206 | stable value when nothing is driving the rail it is connected to, or when it's | ||
| 207 | unconnected. | ||
| 208 | |||
| 209 | For example, a platform may do this: | ||
| 210 | |||
| 211 | ret = pin_config_set("foo-dev", "FOO_GPIO_PIN", PLATFORM_X_PULL_UP); | ||
| 212 | |||
| 213 | To pull up a pin to VDD. The pin configuration driver implements callbacks for | ||
| 214 | changing pin configuration in the pin controller ops like this: | ||
| 215 | |||
| 216 | #include <linux/pinctrl/pinctrl.h> | ||
| 217 | #include <linux/pinctrl/pinconf.h> | ||
| 218 | #include "platform_x_pindefs.h" | ||
| 219 | |||
| 220 | static int foo_pin_config_get(struct pinctrl_dev *pctldev, | ||
| 221 | unsigned offset, | ||
| 222 | unsigned long *config) | ||
| 223 | { | ||
| 224 | struct my_conftype conf; | ||
| 225 | |||
| 226 | ... Find setting for pin @ offset ... | ||
| 227 | |||
| 228 | *config = (unsigned long) conf; | ||
| 229 | } | ||
| 230 | |||
| 231 | static int foo_pin_config_set(struct pinctrl_dev *pctldev, | ||
| 232 | unsigned offset, | ||
| 233 | unsigned long config) | ||
| 234 | { | ||
| 235 | struct my_conftype *conf = (struct my_conftype *) config; | ||
| 236 | |||
| 237 | switch (conf) { | ||
| 238 | case PLATFORM_X_PULL_UP: | ||
| 239 | ... | ||
| 240 | } | ||
| 241 | } | ||
| 242 | } | ||
| 243 | |||
| 244 | static int foo_pin_config_group_get (struct pinctrl_dev *pctldev, | ||
| 245 | unsigned selector, | ||
| 246 | unsigned long *config) | ||
| 247 | { | ||
| 248 | ... | ||
| 249 | } | ||
| 250 | |||
| 251 | static int foo_pin_config_group_set (struct pinctrl_dev *pctldev, | ||
| 252 | unsigned selector, | ||
| 253 | unsigned long config) | ||
| 254 | { | ||
| 255 | ... | ||
| 256 | } | ||
| 257 | |||
| 258 | static struct pinconf_ops foo_pconf_ops = { | ||
| 259 | .pin_config_get = foo_pin_config_get, | ||
| 260 | .pin_config_set = foo_pin_config_set, | ||
| 261 | .pin_config_group_get = foo_pin_config_group_get, | ||
| 262 | .pin_config_group_set = foo_pin_config_group_set, | ||
| 263 | }; | ||
| 264 | |||
| 265 | /* Pin config operations are handled by some pin controller */ | ||
| 266 | static struct pinctrl_desc foo_desc = { | ||
| 267 | ... | ||
| 268 | .confops = &foo_pconf_ops, | ||
| 269 | }; | ||
| 270 | |||
| 271 | Since some controllers have special logic for handling entire groups of pins | ||
| 272 | they can exploit the special whole-group pin control function. The | ||
| 273 | pin_config_group_set() callback is allowed to return the error code -EAGAIN, | ||
| 274 | for groups it does not want to handle, or if it just wants to do some | ||
| 275 | group-level handling and then fall through to iterate over all pins, in which | ||
| 276 | case each individual pin will be treated by separate pin_config_set() calls as | ||
| 277 | well. | ||
| 278 | |||
| 279 | |||
| 196 | Interaction with the GPIO subsystem | 280 | Interaction with the GPIO subsystem |
| 197 | =================================== | 281 | =================================== |
| 198 | 282 | ||
| @@ -214,19 +298,20 @@ static struct pinctrl_gpio_range gpio_range_a = { | |||
| 214 | .name = "chip a", | 298 | .name = "chip a", |
| 215 | .id = 0, | 299 | .id = 0, |
| 216 | .base = 32, | 300 | .base = 32, |
| 301 | .pin_base = 32, | ||
| 217 | .npins = 16, | 302 | .npins = 16, |
| 218 | .gc = &chip_a; | 303 | .gc = &chip_a; |
| 219 | }; | 304 | }; |
| 220 | 305 | ||
| 221 | static struct pinctrl_gpio_range gpio_range_a = { | 306 | static struct pinctrl_gpio_range gpio_range_b = { |
| 222 | .name = "chip b", | 307 | .name = "chip b", |
| 223 | .id = 0, | 308 | .id = 0, |
| 224 | .base = 48, | 309 | .base = 48, |
| 310 | .pin_base = 64, | ||
| 225 | .npins = 8, | 311 | .npins = 8, |
| 226 | .gc = &chip_b; | 312 | .gc = &chip_b; |
| 227 | }; | 313 | }; |
| 228 | 314 | ||
| 229 | |||
| 230 | { | 315 | { |
| 231 | struct pinctrl_dev *pctl; | 316 | struct pinctrl_dev *pctl; |
| 232 | ... | 317 | ... |
| @@ -235,42 +320,39 @@ static struct pinctrl_gpio_range gpio_range_a = { | |||
| 235 | } | 320 | } |
| 236 | 321 | ||
| 237 | So this complex system has one pin controller handling two different | 322 | So this complex system has one pin controller handling two different |
| 238 | GPIO chips. Chip a has 16 pins and chip b has 8 pins. They are mapped in | 323 | GPIO chips. "chip a" has 16 pins and "chip b" has 8 pins. The "chip a" and |
| 239 | the global GPIO pin space at: | 324 | "chip b" have different .pin_base, which means a start pin number of the |
| 325 | GPIO range. | ||
| 240 | 326 | ||
| 241 | chip a: [32 .. 47] | 327 | The GPIO range of "chip a" starts from the GPIO base of 32 and actual |
| 242 | chip b: [48 .. 55] | 328 | pin range also starts from 32. However "chip b" has different starting |
| 329 | offset for the GPIO range and pin range. The GPIO range of "chip b" starts | ||
| 330 | from GPIO number 48, while the pin range of "chip b" starts from 64. | ||
| 331 | |||
| 332 | We can convert a gpio number to actual pin number using this "pin_base". | ||
| 333 | They are mapped in the global GPIO pin space at: | ||
| 334 | |||
| 335 | chip a: | ||
| 336 | - GPIO range : [32 .. 47] | ||
| 337 | - pin range : [32 .. 47] | ||
| 338 | chip b: | ||
| 339 | - GPIO range : [48 .. 55] | ||
| 340 | - pin range : [64 .. 71] | ||
| 243 | 341 | ||
| 244 | When GPIO-specific functions in the pin control subsystem are called, these | 342 | When GPIO-specific functions in the pin control subsystem are called, these |
| 245 | ranges will be used to look up the apropriate pin controller by inspecting | 343 | ranges will be used to look up the appropriate pin controller by inspecting |
| 246 | and matching the pin to the pin ranges across all controllers. When a | 344 | and matching the pin to the pin ranges across all controllers. When a |
| 247 | pin controller handling the matching range is found, GPIO-specific functions | 345 | pin controller handling the matching range is found, GPIO-specific functions |
| 248 | will be called on that specific pin controller. | 346 | will be called on that specific pin controller. |
| 249 | 347 | ||
| 250 | For all functionalities dealing with pin biasing, pin muxing etc, the pin | 348 | For all functionalities dealing with pin biasing, pin muxing etc, the pin |
| 251 | controller subsystem will subtract the range's .base offset from the passed | 349 | controller subsystem will subtract the range's .base offset from the passed |
| 252 | in gpio pin number, and pass that on to the pin control driver, so the driver | 350 | in gpio number, and add the ranges's .pin_base offset to retrive a pin number. |
| 253 | will get an offset into its handled number range. Further it is also passed | 351 | After that, the subsystem passes it on to the pin control driver, so the driver |
| 352 | will get an pin number into its handled number range. Further it is also passed | ||
| 254 | the range ID value, so that the pin controller knows which range it should | 353 | the range ID value, so that the pin controller knows which range it should |
| 255 | deal with. | 354 | deal with. |
| 256 | 355 | ||
| 257 | For example: if a user issues pinctrl_gpio_set_foo(50), the pin control | ||
| 258 | subsystem will find that the second range on this pin controller matches, | ||
| 259 | subtract the base 48 and call the | ||
| 260 | pinctrl_driver_gpio_set_foo(pinctrl, range, 2) where the latter function has | ||
| 261 | this signature: | ||
| 262 | |||
| 263 | int pinctrl_driver_gpio_set_foo(struct pinctrl_dev *pctldev, | ||
| 264 | struct pinctrl_gpio_range *rangeid, | ||
| 265 | unsigned offset); | ||
| 266 | |||
| 267 | Now the driver knows that we want to do some GPIO-specific operation on the | ||
| 268 | second GPIO range handled by "chip b", at offset 2 in that specific range. | ||
| 269 | |||
| 270 | (If the GPIO subsystem is ever refactored to use a local per-GPIO controller | ||
| 271 | pin space, this mapping will need to be augmented accordingly.) | ||
| 272 | |||
| 273 | |||
| 274 | PINMUX interfaces | 356 | PINMUX interfaces |
| 275 | ================= | 357 | ================= |
| 276 | 358 | ||
| @@ -438,7 +520,7 @@ you. Define enumerators only for the pins you can control if that makes sense. | |||
| 438 | 520 | ||
| 439 | Assumptions: | 521 | Assumptions: |
| 440 | 522 | ||
| 441 | We assume that the number possible function maps to pin groups is limited by | 523 | We assume that the number of possible function maps to pin groups is limited by |
| 442 | the hardware. I.e. we assume that there is no system where any function can be | 524 | the hardware. I.e. we assume that there is no system where any function can be |
| 443 | mapped to any pin, like in a phone exchange. So the available pins groups for | 525 | mapped to any pin, like in a phone exchange. So the available pins groups for |
| 444 | a certain function will be limited to a few choices (say up to eight or so), | 526 | a certain function will be limited to a few choices (say up to eight or so), |
| @@ -585,7 +667,7 @@ int foo_list_funcs(struct pinctrl_dev *pctldev, unsigned selector) | |||
| 585 | 667 | ||
| 586 | const char *foo_get_fname(struct pinctrl_dev *pctldev, unsigned selector) | 668 | const char *foo_get_fname(struct pinctrl_dev *pctldev, unsigned selector) |
| 587 | { | 669 | { |
| 588 | return myfuncs[selector].name; | 670 | return foo_functions[selector].name; |
| 589 | } | 671 | } |
| 590 | 672 | ||
| 591 | static int foo_get_groups(struct pinctrl_dev *pctldev, unsigned selector, | 673 | static int foo_get_groups(struct pinctrl_dev *pctldev, unsigned selector, |
| @@ -600,16 +682,16 @@ static int foo_get_groups(struct pinctrl_dev *pctldev, unsigned selector, | |||
| 600 | int foo_enable(struct pinctrl_dev *pctldev, unsigned selector, | 682 | int foo_enable(struct pinctrl_dev *pctldev, unsigned selector, |
| 601 | unsigned group) | 683 | unsigned group) |
| 602 | { | 684 | { |
| 603 | u8 regbit = (1 << group); | 685 | u8 regbit = (1 << selector + group); |
| 604 | 686 | ||
| 605 | writeb((readb(MUX)|regbit), MUX) | 687 | writeb((readb(MUX)|regbit), MUX) |
| 606 | return 0; | 688 | return 0; |
| 607 | } | 689 | } |
| 608 | 690 | ||
| 609 | int foo_disable(struct pinctrl_dev *pctldev, unsigned selector, | 691 | void foo_disable(struct pinctrl_dev *pctldev, unsigned selector, |
| 610 | unsigned group) | 692 | unsigned group) |
| 611 | { | 693 | { |
| 612 | u8 regbit = (1 << group); | 694 | u8 regbit = (1 << selector + group); |
| 613 | 695 | ||
| 614 | writeb((readb(MUX) & ~(regbit)), MUX) | 696 | writeb((readb(MUX) & ~(regbit)), MUX) |
| 615 | return 0; | 697 | return 0; |
| @@ -647,6 +729,17 @@ All the above functions are mandatory to implement for a pinmux driver. | |||
| 647 | Pinmux interaction with the GPIO subsystem | 729 | Pinmux interaction with the GPIO subsystem |
| 648 | ========================================== | 730 | ========================================== |
| 649 | 731 | ||
| 732 | The public pinmux API contains two functions named pinmux_request_gpio() | ||
| 733 | and pinmux_free_gpio(). These two functions shall *ONLY* be called from | ||
| 734 | gpiolib-based drivers as part of their gpio_request() and | ||
| 735 | gpio_free() semantics. Likewise the pinmux_gpio_direction_[input|output] | ||
| 736 | shall only be called from within respective gpio_direction_[input|output] | ||
| 737 | gpiolib implementation. | ||
| 738 | |||
| 739 | NOTE that platforms and individual drivers shall *NOT* request GPIO pins to be | ||
| 740 | muxed in. Instead, implement a proper gpiolib driver and have that driver | ||
| 741 | request proper muxing for its pins. | ||
| 742 | |||
| 650 | The function list could become long, especially if you can convert every | 743 | The function list could become long, especially if you can convert every |
| 651 | individual pin into a GPIO pin independent of any other pins, and then try | 744 | individual pin into a GPIO pin independent of any other pins, and then try |
| 652 | the approach to define every pin as a function. | 745 | the approach to define every pin as a function. |
| @@ -654,19 +747,24 @@ the approach to define every pin as a function. | |||
| 654 | In this case, the function array would become 64 entries for each GPIO | 747 | In this case, the function array would become 64 entries for each GPIO |
| 655 | setting and then the device functions. | 748 | setting and then the device functions. |
| 656 | 749 | ||
| 657 | For this reason there is an additional function a pinmux driver can implement | 750 | For this reason there are two functions a pinmux driver can implement |
| 658 | to enable only GPIO on an individual pin: .gpio_request_enable(). The same | 751 | to enable only GPIO on an individual pin: .gpio_request_enable() and |
| 659 | .free() function as for other functions is assumed to be usable also for | 752 | .gpio_disable_free(). |
| 660 | GPIO pins. | ||
| 661 | 753 | ||
| 662 | This function will pass in the affected GPIO range identified by the pin | 754 | This function will pass in the affected GPIO range identified by the pin |
| 663 | controller core, so you know which GPIO pins are being affected by the request | 755 | controller core, so you know which GPIO pins are being affected by the request |
| 664 | operation. | 756 | operation. |
| 665 | 757 | ||
| 666 | Alternatively it is fully allowed to use named functions for each GPIO | 758 | If your driver needs to have an indication from the framework of whether the |
| 667 | pin, the pinmux_request_gpio() will attempt to obtain the function "gpioN" | 759 | GPIO pin shall be used for input or output you can implement the |
| 668 | where "N" is the global GPIO pin number if no special GPIO-handler is | 760 | .gpio_set_direction() function. As described this shall be called from the |
| 669 | registered. | 761 | gpiolib driver and the affected GPIO range, pin offset and desired direction |
| 762 | will be passed along to this function. | ||
| 763 | |||
| 764 | Alternatively to using these special functions, it is fully allowed to use | ||
| 765 | named functions for each GPIO pin, the pinmux_request_gpio() will attempt to | ||
| 766 | obtain the function "gpioN" where "N" is the global GPIO pin number if no | ||
| 767 | special GPIO-handler is registered. | ||
| 670 | 768 | ||
| 671 | 769 | ||
| 672 | Pinmux board/machine configuration | 770 | Pinmux board/machine configuration |
| @@ -683,19 +781,19 @@ spi on the second function mapping: | |||
| 683 | 781 | ||
| 684 | #include <linux/pinctrl/machine.h> | 782 | #include <linux/pinctrl/machine.h> |
| 685 | 783 | ||
| 686 | static struct pinmux_map pmx_mapping[] = { | 784 | static const struct pinmux_map __initdata pmx_mapping[] = { |
| 687 | { | 785 | { |
| 688 | .ctrl_dev_name = "pinctrl.0", | 786 | .ctrl_dev_name = "pinctrl-foo", |
| 689 | .function = "spi0", | 787 | .function = "spi0", |
| 690 | .dev_name = "foo-spi.0", | 788 | .dev_name = "foo-spi.0", |
| 691 | }, | 789 | }, |
| 692 | { | 790 | { |
| 693 | .ctrl_dev_name = "pinctrl.0", | 791 | .ctrl_dev_name = "pinctrl-foo", |
| 694 | .function = "i2c0", | 792 | .function = "i2c0", |
| 695 | .dev_name = "foo-i2c.0", | 793 | .dev_name = "foo-i2c.0", |
| 696 | }, | 794 | }, |
| 697 | { | 795 | { |
| 698 | .ctrl_dev_name = "pinctrl.0", | 796 | .ctrl_dev_name = "pinctrl-foo", |
| 699 | .function = "mmc0", | 797 | .function = "mmc0", |
| 700 | .dev_name = "foo-mmc.0", | 798 | .dev_name = "foo-mmc.0", |
| 701 | }, | 799 | }, |
| @@ -714,14 +812,14 @@ for example if they are not yet instantiated or cumbersome to obtain. | |||
| 714 | 812 | ||
| 715 | You register this pinmux mapping to the pinmux subsystem by simply: | 813 | You register this pinmux mapping to the pinmux subsystem by simply: |
| 716 | 814 | ||
| 717 | ret = pinmux_register_mappings(&pmx_mapping, ARRAY_SIZE(pmx_mapping)); | 815 | ret = pinmux_register_mappings(pmx_mapping, ARRAY_SIZE(pmx_mapping)); |
| 718 | 816 | ||
| 719 | Since the above construct is pretty common there is a helper macro to make | 817 | Since the above construct is pretty common there is a helper macro to make |
| 720 | it even more compact which assumes you want to use pinctrl.0 and position | 818 | it even more compact which assumes you want to use pinctrl-foo and position |
| 721 | 0 for mapping, for example: | 819 | 0 for mapping, for example: |
| 722 | 820 | ||
| 723 | static struct pinmux_map pmx_mapping[] = { | 821 | static struct pinmux_map __initdata pmx_mapping[] = { |
| 724 | PINMUX_MAP_PRIMARY("I2CMAP", "i2c0", "foo-i2c.0"), | 822 | PINMUX_MAP("I2CMAP", "pinctrl-foo", "i2c0", "foo-i2c.0"), |
| 725 | }; | 823 | }; |
| 726 | 824 | ||
| 727 | 825 | ||
| @@ -734,14 +832,14 @@ As it is possible to map a function to different groups of pins an optional | |||
| 734 | ... | 832 | ... |
| 735 | { | 833 | { |
| 736 | .name = "spi0-pos-A", | 834 | .name = "spi0-pos-A", |
| 737 | .ctrl_dev_name = "pinctrl.0", | 835 | .ctrl_dev_name = "pinctrl-foo", |
| 738 | .function = "spi0", | 836 | .function = "spi0", |
| 739 | .group = "spi0_0_grp", | 837 | .group = "spi0_0_grp", |
| 740 | .dev_name = "foo-spi.0", | 838 | .dev_name = "foo-spi.0", |
| 741 | }, | 839 | }, |
| 742 | { | 840 | { |
| 743 | .name = "spi0-pos-B", | 841 | .name = "spi0-pos-B", |
| 744 | .ctrl_dev_name = "pinctrl.0", | 842 | .ctrl_dev_name = "pinctrl-foo", |
| 745 | .function = "spi0", | 843 | .function = "spi0", |
| 746 | .group = "spi0_1_grp", | 844 | .group = "spi0_1_grp", |
| 747 | .dev_name = "foo-spi.0", | 845 | .dev_name = "foo-spi.0", |
| @@ -759,45 +857,44 @@ case), we define a mapping like this: | |||
| 759 | 857 | ||
| 760 | ... | 858 | ... |
| 761 | { | 859 | { |
| 762 | .name "2bit" | 860 | .name = "2bit" |
| 763 | .ctrl_dev_name = "pinctrl.0", | 861 | .ctrl_dev_name = "pinctrl-foo", |
| 764 | .function = "mmc0", | 862 | .function = "mmc0", |
| 765 | .group = "mmc0_0_grp", | 863 | .group = "mmc0_1_grp", |
| 766 | .dev_name = "foo-mmc.0", | 864 | .dev_name = "foo-mmc.0", |
| 767 | }, | 865 | }, |
| 768 | { | 866 | { |
| 769 | .name "4bit" | 867 | .name = "4bit" |
| 770 | .ctrl_dev_name = "pinctrl.0", | 868 | .ctrl_dev_name = "pinctrl-foo", |
| 771 | .function = "mmc0", | 869 | .function = "mmc0", |
| 772 | .group = "mmc0_0_grp", | 870 | .group = "mmc0_1_grp", |
| 773 | .dev_name = "foo-mmc.0", | 871 | .dev_name = "foo-mmc.0", |
| 774 | }, | 872 | }, |
| 775 | { | 873 | { |
| 776 | .name "4bit" | 874 | .name = "4bit" |
| 777 | .ctrl_dev_name = "pinctrl.0", | 875 | .ctrl_dev_name = "pinctrl-foo", |
| 778 | .function = "mmc0", | 876 | .function = "mmc0", |
| 779 | .group = "mmc0_1_grp", | 877 | .group = "mmc0_2_grp", |
| 780 | .dev_name = "foo-mmc.0", | 878 | .dev_name = "foo-mmc.0", |
| 781 | }, | 879 | }, |
| 782 | { | 880 | { |
| 783 | .name "8bit" | 881 | .name = "8bit" |
| 784 | .ctrl_dev_name = "pinctrl.0", | 882 | .ctrl_dev_name = "pinctrl-foo", |
| 785 | .function = "mmc0", | 883 | .group = "mmc0_1_grp", |
| 786 | .group = "mmc0_0_grp", | ||
| 787 | .dev_name = "foo-mmc.0", | 884 | .dev_name = "foo-mmc.0", |
| 788 | }, | 885 | }, |
| 789 | { | 886 | { |
| 790 | .name "8bit" | 887 | .name = "8bit" |
| 791 | .ctrl_dev_name = "pinctrl.0", | 888 | .ctrl_dev_name = "pinctrl-foo", |
| 792 | .function = "mmc0", | 889 | .function = "mmc0", |
| 793 | .group = "mmc0_1_grp", | 890 | .group = "mmc0_2_grp", |
| 794 | .dev_name = "foo-mmc.0", | 891 | .dev_name = "foo-mmc.0", |
| 795 | }, | 892 | }, |
| 796 | { | 893 | { |
| 797 | .name "8bit" | 894 | .name = "8bit" |
| 798 | .ctrl_dev_name = "pinctrl.0", | 895 | .ctrl_dev_name = "pinctrl-foo", |
| 799 | .function = "mmc0", | 896 | .function = "mmc0", |
| 800 | .group = "mmc0_2_grp", | 897 | .group = "mmc0_3_grp", |
| 801 | .dev_name = "foo-mmc.0", | 898 | .dev_name = "foo-mmc.0", |
| 802 | }, | 899 | }, |
| 803 | ... | 900 | ... |
| @@ -897,8 +994,8 @@ This is enabled by simply setting the .hog_on_boot field in the map to true, | |||
| 897 | like this: | 994 | like this: |
| 898 | 995 | ||
| 899 | { | 996 | { |
| 900 | .name "POWERMAP" | 997 | .name = "POWERMAP" |
| 901 | .ctrl_dev_name = "pinctrl.0", | 998 | .ctrl_dev_name = "pinctrl-foo", |
| 902 | .function = "power_func", | 999 | .function = "power_func", |
| 903 | .hog_on_boot = true, | 1000 | .hog_on_boot = true, |
| 904 | }, | 1001 | }, |
| @@ -927,7 +1024,7 @@ it, disables and releases it, and muxes it in on the pins defined by group B: | |||
| 927 | 1024 | ||
| 928 | foo_switch() | 1025 | foo_switch() |
| 929 | { | 1026 | { |
| 930 | struct pinmux pmx; | 1027 | struct pinmux *pmx; |
| 931 | 1028 | ||
| 932 | /* Enable on position A */ | 1029 | /* Enable on position A */ |
| 933 | pmx = pinmux_get(&device, "spi0-pos-A"); | 1030 | pmx = pinmux_get(&device, "spi0-pos-A"); |
