1*4d3d0e42SAndrew Jeffery /* 2*4d3d0e42SAndrew Jeffery * Copyright (C) 2016 IBM Corp. 3*4d3d0e42SAndrew Jeffery * 4*4d3d0e42SAndrew Jeffery * This program is free software; you can redistribute it and/or modify 5*4d3d0e42SAndrew Jeffery * it under the terms of the GNU General Public License as published by 6*4d3d0e42SAndrew Jeffery * the Free Software Foundation; either version 2 of the License, or 7*4d3d0e42SAndrew Jeffery * (at your option) any later version. 8*4d3d0e42SAndrew Jeffery */ 9*4d3d0e42SAndrew Jeffery 10*4d3d0e42SAndrew Jeffery #ifndef PINCTRL_ASPEED 11*4d3d0e42SAndrew Jeffery #define PINCTRL_ASPEED 12*4d3d0e42SAndrew Jeffery 13*4d3d0e42SAndrew Jeffery #include <linux/pinctrl/pinctrl.h> 14*4d3d0e42SAndrew Jeffery #include <linux/pinctrl/pinmux.h> 15*4d3d0e42SAndrew Jeffery #include <linux/pinctrl/pinconf.h> 16*4d3d0e42SAndrew Jeffery #include <linux/pinctrl/pinconf-generic.h> 17*4d3d0e42SAndrew Jeffery #include <linux/regmap.h> 18*4d3d0e42SAndrew Jeffery 19*4d3d0e42SAndrew Jeffery /* 20*4d3d0e42SAndrew Jeffery * The ASPEED SoCs provide typically more than 200 pins for GPIO and other 21*4d3d0e42SAndrew Jeffery * functions. The SoC function enabled on a pin is determined on a priority 22*4d3d0e42SAndrew Jeffery * basis where a given pin can provide a number of different signal types. 23*4d3d0e42SAndrew Jeffery * 24*4d3d0e42SAndrew Jeffery * The signal active on a pin is described by both a priority level and 25*4d3d0e42SAndrew Jeffery * compound logical expressions involving multiple operators, registers and 26*4d3d0e42SAndrew Jeffery * bits. Some difficulty arises as the pin's function bit masks for each 27*4d3d0e42SAndrew Jeffery * priority level are frequently not the same (i.e. cannot just flip a bit to 28*4d3d0e42SAndrew Jeffery * change from a high to low priority signal), or even in the same register. 29*4d3d0e42SAndrew Jeffery * Further, not all signals can be unmuxed, as some expressions depend on 30*4d3d0e42SAndrew Jeffery * values in the hardware strapping register (which is treated as read-only). 31*4d3d0e42SAndrew Jeffery * 32*4d3d0e42SAndrew Jeffery * SoC Multi-function Pin Expression Examples 33*4d3d0e42SAndrew Jeffery * ------------------------------------------ 34*4d3d0e42SAndrew Jeffery * 35*4d3d0e42SAndrew Jeffery * Here are some sample mux configurations from the AST2400 and AST2500 36*4d3d0e42SAndrew Jeffery * datasheets to illustrate the corner cases, roughly in order of least to most 37*4d3d0e42SAndrew Jeffery * corner. The signal priorities are in decending order from P0 (highest). 38*4d3d0e42SAndrew Jeffery * 39*4d3d0e42SAndrew Jeffery * D6 is a pin with a single function (beside GPIO); a high priority signal 40*4d3d0e42SAndrew Jeffery * that participates in one function: 41*4d3d0e42SAndrew Jeffery * 42*4d3d0e42SAndrew Jeffery * Ball | Default | P0 Signal | P0 Expression | P1 Signal | P1 Expression | Other 43*4d3d0e42SAndrew Jeffery * -----+---------+-----------+-----------------------------+-----------+---------------+---------- 44*4d3d0e42SAndrew Jeffery * D6 GPIOA0 MAC1LINK SCU80[0]=1 GPIOA0 45*4d3d0e42SAndrew Jeffery * -----+---------+-----------+-----------------------------+-----------+---------------+---------- 46*4d3d0e42SAndrew Jeffery * 47*4d3d0e42SAndrew Jeffery * C5 is a multi-signal pin (high and low priority signals). Here we touch 48*4d3d0e42SAndrew Jeffery * different registers for the different functions that enable each signal: 49*4d3d0e42SAndrew Jeffery * 50*4d3d0e42SAndrew Jeffery * -----+---------+-----------+-----------------------------+-----------+---------------+---------- 51*4d3d0e42SAndrew Jeffery * C5 GPIOA4 SCL9 SCU90[22]=1 TIMER5 SCU80[4]=1 GPIOA4 52*4d3d0e42SAndrew Jeffery * -----+---------+-----------+-----------------------------+-----------+---------------+---------- 53*4d3d0e42SAndrew Jeffery * 54*4d3d0e42SAndrew Jeffery * E19 is a single-signal pin with two functions that influence the active 55*4d3d0e42SAndrew Jeffery * signal. In this case both bits have the same meaning - enable a dedicated 56*4d3d0e42SAndrew Jeffery * LPC reset pin. However it's not always the case that the bits in the 57*4d3d0e42SAndrew Jeffery * OR-relationship have the same meaning. 58*4d3d0e42SAndrew Jeffery * 59*4d3d0e42SAndrew Jeffery * -----+---------+-----------+-----------------------------+-----------+---------------+---------- 60*4d3d0e42SAndrew Jeffery * E19 GPIOB4 LPCRST# SCU80[12]=1 | Strap[14]=1 GPIOB4 61*4d3d0e42SAndrew Jeffery * -----+---------+-----------+-----------------------------+-----------+---------------+---------- 62*4d3d0e42SAndrew Jeffery * 63*4d3d0e42SAndrew Jeffery * For example, pin B19 has a low-priority signal that's enabled by two 64*4d3d0e42SAndrew Jeffery * distinct SoC functions: A specific SIOPBI bit in register SCUA4, and an ACPI 65*4d3d0e42SAndrew Jeffery * bit in the STRAP register. The ACPI bit configures signals on pins in 66*4d3d0e42SAndrew Jeffery * addition to B19. Both of the low priority functions as well as the high 67*4d3d0e42SAndrew Jeffery * priority function must be disabled for GPIOF1 to be used. 68*4d3d0e42SAndrew Jeffery * 69*4d3d0e42SAndrew Jeffery * Ball | Default | P0 Signal | P0 Expression | P1 Signal | P1 Expression | Other 70*4d3d0e42SAndrew Jeffery * -----+---------+-----------+-----------------------------------------+-----------+----------------------------------------+---------- 71*4d3d0e42SAndrew Jeffery * B19 GPIOF1 NDCD4 SCU80[25]=1 SIOPBI# SCUA4[12]=1 | Strap[19]=0 GPIOF1 72*4d3d0e42SAndrew Jeffery * -----+---------+-----------+-----------------------------------------+-----------+----------------------------------------+---------- 73*4d3d0e42SAndrew Jeffery * 74*4d3d0e42SAndrew Jeffery * For pin E18, the SoC ANDs the expected state of three bits to determine the 75*4d3d0e42SAndrew Jeffery * pin's active signal: 76*4d3d0e42SAndrew Jeffery * 77*4d3d0e42SAndrew Jeffery * * SCU3C[3]: Enable external SOC reset function 78*4d3d0e42SAndrew Jeffery * * SCU80[15]: Enable SPICS1# or EXTRST# function pin 79*4d3d0e42SAndrew Jeffery * * SCU90[31]: Select SPI interface CS# output 80*4d3d0e42SAndrew Jeffery * 81*4d3d0e42SAndrew Jeffery * -----+---------+-----------+-----------------------------------------+-----------+----------------------------------------+---------- 82*4d3d0e42SAndrew Jeffery * E18 GPIOB7 EXTRST# SCU3C[3]=1 & SCU80[15]=1 & SCU90[31]=0 SPICS1# SCU3C[3]=1 & SCU80[15]=1 & SCU90[31]=1 GPIOB7 83*4d3d0e42SAndrew Jeffery * -----+---------+-----------+-----------------------------------------+-----------+----------------------------------------+---------- 84*4d3d0e42SAndrew Jeffery * 85*4d3d0e42SAndrew Jeffery * (Bits SCU3C[3] and SCU80[15] appear to only be used in the expressions for 86*4d3d0e42SAndrew Jeffery * selecting the signals on pin E18) 87*4d3d0e42SAndrew Jeffery * 88*4d3d0e42SAndrew Jeffery * Pin T5 is a multi-signal pin with a more complex configuration: 89*4d3d0e42SAndrew Jeffery * 90*4d3d0e42SAndrew Jeffery * Ball | Default | P0 Signal | P0 Expression | P1 Signal | P1 Expression | Other 91*4d3d0e42SAndrew Jeffery * -----+---------+-----------+------------------------------+-----------+---------------+---------- 92*4d3d0e42SAndrew Jeffery * T5 GPIOL1 VPIDE SCU90[5:4]!=0 & SCU84[17]=1 NDCD1 SCU84[17]=1 GPIOL1 93*4d3d0e42SAndrew Jeffery * -----+---------+-----------+------------------------------+-----------+---------------+---------- 94*4d3d0e42SAndrew Jeffery * 95*4d3d0e42SAndrew Jeffery * The high priority signal configuration is best thought of in terms of its 96*4d3d0e42SAndrew Jeffery * exploded form, with reference to the SCU90[5:4] bits: 97*4d3d0e42SAndrew Jeffery * 98*4d3d0e42SAndrew Jeffery * * SCU90[5:4]=00: disable 99*4d3d0e42SAndrew Jeffery * * SCU90[5:4]=01: 18 bits (R6/G6/B6) video mode. 100*4d3d0e42SAndrew Jeffery * * SCU90[5:4]=10: 24 bits (R8/G8/B8) video mode. 101*4d3d0e42SAndrew Jeffery * * SCU90[5:4]=11: 30 bits (R10/G10/B10) video mode. 102*4d3d0e42SAndrew Jeffery * 103*4d3d0e42SAndrew Jeffery * Re-writing: 104*4d3d0e42SAndrew Jeffery * 105*4d3d0e42SAndrew Jeffery * -----+---------+-----------+------------------------------+-----------+---------------+---------- 106*4d3d0e42SAndrew Jeffery * T5 GPIOL1 VPIDE (SCU90[5:4]=1 & SCU84[17]=1) NDCD1 SCU84[17]=1 GPIOL1 107*4d3d0e42SAndrew Jeffery * | (SCU90[5:4]=2 & SCU84[17]=1) 108*4d3d0e42SAndrew Jeffery * | (SCU90[5:4]=3 & SCU84[17]=1) 109*4d3d0e42SAndrew Jeffery * -----+---------+-----------+------------------------------+-----------+---------------+---------- 110*4d3d0e42SAndrew Jeffery * 111*4d3d0e42SAndrew Jeffery * For reference the SCU84[17] bit configure the "UART1 NDCD1 or Video VPIDE 112*4d3d0e42SAndrew Jeffery * function pin", where the signal itself is determined by whether SCU94[5:4] 113*4d3d0e42SAndrew Jeffery * is disabled or in one of the 18, 24 or 30bit video modes. 114*4d3d0e42SAndrew Jeffery * 115*4d3d0e42SAndrew Jeffery * Other video-input-related pins require an explicit state in SCU90[5:4], e.g. 116*4d3d0e42SAndrew Jeffery * W1 and U5: 117*4d3d0e42SAndrew Jeffery * 118*4d3d0e42SAndrew Jeffery * -----+---------+-----------+------------------------------+-----------+---------------+---------- 119*4d3d0e42SAndrew Jeffery * W1 GPIOL6 VPIB0 SCU90[5:4]=3 & SCU84[22]=1 TXD1 SCU84[22]=1 GPIOL6 120*4d3d0e42SAndrew Jeffery * U5 GPIOL7 VPIB1 SCU90[5:4]=3 & SCU84[23]=1 RXD1 SCU84[23]=1 GPIOL7 121*4d3d0e42SAndrew Jeffery * -----+---------+-----------+------------------------------+-----------+---------------+---------- 122*4d3d0e42SAndrew Jeffery * 123*4d3d0e42SAndrew Jeffery * The examples of T5 and W1 are particularly fertile, as they also demonstrate 124*4d3d0e42SAndrew Jeffery * that despite operating as part of the video input bus each signal needs to 125*4d3d0e42SAndrew Jeffery * be enabled individually via it's own SCU84 (in the cases of T5 and W1) 126*4d3d0e42SAndrew Jeffery * register bit. This is a little crazy if the bus doesn't have optional 127*4d3d0e42SAndrew Jeffery * signals, but is used to decent effect with some of the UARTs where not all 128*4d3d0e42SAndrew Jeffery * signals are required. However, this isn't done consistently - UART1 is 129*4d3d0e42SAndrew Jeffery * enabled on a per-pin basis, and by contrast, all signals for UART6 are 130*4d3d0e42SAndrew Jeffery * enabled by a single bit. 131*4d3d0e42SAndrew Jeffery * 132*4d3d0e42SAndrew Jeffery * Further, the high and low priority signals listed in the table above share 133*4d3d0e42SAndrew Jeffery * a configuration bit. The VPI signals should operate in concert in a single 134*4d3d0e42SAndrew Jeffery * function, but the UART signals should retain the ability to be configured 135*4d3d0e42SAndrew Jeffery * independently. This pushes the implementation down the path of tagging a 136*4d3d0e42SAndrew Jeffery * signal's expressions with the function they participate in, rather than 137*4d3d0e42SAndrew Jeffery * defining masks affecting multiple signals per function. The latter approach 138*4d3d0e42SAndrew Jeffery * fails in this instance where applying the configuration for the UART pin of 139*4d3d0e42SAndrew Jeffery * interest will stomp on the state of other UART signals when disabling the 140*4d3d0e42SAndrew Jeffery * VPI functions on the current pin. 141*4d3d0e42SAndrew Jeffery * 142*4d3d0e42SAndrew Jeffery * Ball | Default | P0 Signal | P0 Expression | P1 Signal | P1 Expression | Other 143*4d3d0e42SAndrew Jeffery * -----+------------+-----------+---------------------------+-----------+---------------+------------ 144*4d3d0e42SAndrew Jeffery * A12 RGMII1TXCK GPIOT0 SCUA0[0]=1 RMII1TXEN Strap[6]=0 RGMII1TXCK 145*4d3d0e42SAndrew Jeffery * B12 RGMII1TXCTL GPIOT1 SCUA0[1]=1 – Strap[6]=0 RGMII1TXCTL 146*4d3d0e42SAndrew Jeffery * -----+------------+-----------+---------------------------+-----------+---------------+------------ 147*4d3d0e42SAndrew Jeffery * 148*4d3d0e42SAndrew Jeffery * A12 demonstrates that the "Other" signal isn't always GPIO - in this case 149*4d3d0e42SAndrew Jeffery * GPIOT0 is a high-priority signal and RGMII1TXCK is Other. Thus, GPIO 150*4d3d0e42SAndrew Jeffery * should be treated like any other signal type with full function expression 151*4d3d0e42SAndrew Jeffery * requirements, and not assumed to be the default case. Separately, GPIOT0 and 152*4d3d0e42SAndrew Jeffery * GPIOT1's signal descriptor bits are distinct, therefore we must iterate all 153*4d3d0e42SAndrew Jeffery * pins in the function's group to disable the higher-priority signals such 154*4d3d0e42SAndrew Jeffery * that the signal for the function of interest is correctly enabled. 155*4d3d0e42SAndrew Jeffery * 156*4d3d0e42SAndrew Jeffery * Finally, three priority levels aren't always enough; the AST2500 brings with 157*4d3d0e42SAndrew Jeffery * it 18 pins of five priority levels, however the 18 pins only use three of 158*4d3d0e42SAndrew Jeffery * the five priority levels. 159*4d3d0e42SAndrew Jeffery * 160*4d3d0e42SAndrew Jeffery * Ultimately the requirement to control pins in the examples above drive the 161*4d3d0e42SAndrew Jeffery * design: 162*4d3d0e42SAndrew Jeffery * 163*4d3d0e42SAndrew Jeffery * * Pins provide signals according to functions activated in the mux 164*4d3d0e42SAndrew Jeffery * configuration 165*4d3d0e42SAndrew Jeffery * 166*4d3d0e42SAndrew Jeffery * * Pins provide up to five signal types in a priority order 167*4d3d0e42SAndrew Jeffery * 168*4d3d0e42SAndrew Jeffery * * For priorities levels defined on a pin, each priority provides one signal 169*4d3d0e42SAndrew Jeffery * 170*4d3d0e42SAndrew Jeffery * * Enabling lower priority signals requires higher priority signals be 171*4d3d0e42SAndrew Jeffery * disabled 172*4d3d0e42SAndrew Jeffery * 173*4d3d0e42SAndrew Jeffery * * A function represents a set of signals; functions are distinct if their 174*4d3d0e42SAndrew Jeffery * sets of signals are not equal 175*4d3d0e42SAndrew Jeffery * 176*4d3d0e42SAndrew Jeffery * * Signals participate in one or more functions 177*4d3d0e42SAndrew Jeffery * 178*4d3d0e42SAndrew Jeffery * * A function is described by an expression of one or more signal 179*4d3d0e42SAndrew Jeffery * descriptors, which compare bit values in a register 180*4d3d0e42SAndrew Jeffery * 181*4d3d0e42SAndrew Jeffery * * A signal expression is the smallest set of signal descriptors whose 182*4d3d0e42SAndrew Jeffery * comparisons must evaluate 'true' for a signal to be enabled on a pin. 183*4d3d0e42SAndrew Jeffery * 184*4d3d0e42SAndrew Jeffery * * A function's signal is active on a pin if evaluating all signal 185*4d3d0e42SAndrew Jeffery * descriptors in the pin's signal expression for the function yields a 'true' 186*4d3d0e42SAndrew Jeffery * result 187*4d3d0e42SAndrew Jeffery * 188*4d3d0e42SAndrew Jeffery * * A signal at a given priority on a given pin is active if any of the 189*4d3d0e42SAndrew Jeffery * functions in which the signal participates are active, and no higher 190*4d3d0e42SAndrew Jeffery * priority signal on the pin is active 191*4d3d0e42SAndrew Jeffery * 192*4d3d0e42SAndrew Jeffery * * GPIO is configured per-pin 193*4d3d0e42SAndrew Jeffery * 194*4d3d0e42SAndrew Jeffery * And so: 195*4d3d0e42SAndrew Jeffery * 196*4d3d0e42SAndrew Jeffery * * To disable a signal, any function(s) activating the signal must be 197*4d3d0e42SAndrew Jeffery * disabled 198*4d3d0e42SAndrew Jeffery * 199*4d3d0e42SAndrew Jeffery * * Each pin must know the signal expressions of functions in which it 200*4d3d0e42SAndrew Jeffery * participates, for the purpose of enabling the Other function. This is done 201*4d3d0e42SAndrew Jeffery * by deactivating all functions that activate higher priority signals on the 202*4d3d0e42SAndrew Jeffery * pin. 203*4d3d0e42SAndrew Jeffery * 204*4d3d0e42SAndrew Jeffery * As a concrete example: 205*4d3d0e42SAndrew Jeffery * 206*4d3d0e42SAndrew Jeffery * * T5 provides three signals types: VPIDE, NDCD1 and GPIO 207*4d3d0e42SAndrew Jeffery * 208*4d3d0e42SAndrew Jeffery * * The VPIDE signal participates in 3 functions: VPI18, VPI24 and VPI30 209*4d3d0e42SAndrew Jeffery * 210*4d3d0e42SAndrew Jeffery * * The NDCD1 signal participates in just its own NDCD1 function 211*4d3d0e42SAndrew Jeffery * 212*4d3d0e42SAndrew Jeffery * * VPIDE is high priority, NDCD1 is low priority, and GPIOL1 is the least 213*4d3d0e42SAndrew Jeffery * prioritised 214*4d3d0e42SAndrew Jeffery * 215*4d3d0e42SAndrew Jeffery * * The prerequisit for activating the NDCD1 signal is that the VPI18, VPI24 216*4d3d0e42SAndrew Jeffery * and VPI30 functions all be disabled 217*4d3d0e42SAndrew Jeffery * 218*4d3d0e42SAndrew Jeffery * * Similarly, all of VPI18, VPI24, VPI30 and NDCD1 functions must be disabled 219*4d3d0e42SAndrew Jeffery * to provide GPIOL6 220*4d3d0e42SAndrew Jeffery * 221*4d3d0e42SAndrew Jeffery * Considerations 222*4d3d0e42SAndrew Jeffery * -------------- 223*4d3d0e42SAndrew Jeffery * 224*4d3d0e42SAndrew Jeffery * If pinctrl allows us to allocate a pin we can configure a function without 225*4d3d0e42SAndrew Jeffery * concern for the function of already allocated pins, if pin groups are 226*4d3d0e42SAndrew Jeffery * created with respect to the SoC functions in which they participate. This is 227*4d3d0e42SAndrew Jeffery * intuitive, but it did not feel obvious from the bit/pin relationships. 228*4d3d0e42SAndrew Jeffery * 229*4d3d0e42SAndrew Jeffery * Conversely, failing to allocate all pins in a group indicates some bits (as 230*4d3d0e42SAndrew Jeffery * well as pins) required for the group's configuration will already be in use, 231*4d3d0e42SAndrew Jeffery * likely in a way that's inconsistent with the requirements of the failed 232*4d3d0e42SAndrew Jeffery * group. 233*4d3d0e42SAndrew Jeffery */ 234*4d3d0e42SAndrew Jeffery 235*4d3d0e42SAndrew Jeffery /* 236*4d3d0e42SAndrew Jeffery * The "Multi-function Pins Mapping and Control" table in the SoC datasheet 237*4d3d0e42SAndrew Jeffery * references registers by the device/offset mnemonic. The register macros 238*4d3d0e42SAndrew Jeffery * below are named the same way to ease transcription and verification (as 239*4d3d0e42SAndrew Jeffery * opposed to naming them e.g. PINMUX_CTRL_[0-9]). Further, signal expressions 240*4d3d0e42SAndrew Jeffery * reference registers beyond those dedicated to pinmux, such as the system 241*4d3d0e42SAndrew Jeffery * reset control and MAC clock configuration registers. The AST2500 goes a step 242*4d3d0e42SAndrew Jeffery * further and references registers in the graphics IP block, but that isn't 243*4d3d0e42SAndrew Jeffery * handled yet. 244*4d3d0e42SAndrew Jeffery */ 245*4d3d0e42SAndrew Jeffery #define SCU2C 0x2C /* Misc. Control Register */ 246*4d3d0e42SAndrew Jeffery #define SCU3C 0x3C /* System Reset Control/Status Register */ 247*4d3d0e42SAndrew Jeffery #define SCU48 0x48 /* MAC Interface Clock Delay Setting */ 248*4d3d0e42SAndrew Jeffery #define HW_STRAP1 0x70 /* AST2400 strapping is 33 bits, is split */ 249*4d3d0e42SAndrew Jeffery #define SCU80 0x80 /* Multi-function Pin Control #1 */ 250*4d3d0e42SAndrew Jeffery #define SCU84 0x84 /* Multi-function Pin Control #2 */ 251*4d3d0e42SAndrew Jeffery #define SCU88 0x88 /* Multi-function Pin Control #3 */ 252*4d3d0e42SAndrew Jeffery #define SCU8C 0x8C /* Multi-function Pin Control #4 */ 253*4d3d0e42SAndrew Jeffery #define SCU90 0x90 /* Multi-function Pin Control #5 */ 254*4d3d0e42SAndrew Jeffery #define SCU94 0x94 /* Multi-function Pin Control #6 */ 255*4d3d0e42SAndrew Jeffery #define SCUA0 0xA0 /* Multi-function Pin Control #7 */ 256*4d3d0e42SAndrew Jeffery #define SCUA4 0xA4 /* Multi-function Pin Control #8 */ 257*4d3d0e42SAndrew Jeffery #define SCUA8 0xA8 /* Multi-function Pin Control #9 */ 258*4d3d0e42SAndrew Jeffery #define HW_STRAP2 0xD0 /* Strapping */ 259*4d3d0e42SAndrew Jeffery 260*4d3d0e42SAndrew Jeffery /** 261*4d3d0e42SAndrew Jeffery * A signal descriptor, which describes the register, bits and the 262*4d3d0e42SAndrew Jeffery * enable/disable values that should be compared or written. 263*4d3d0e42SAndrew Jeffery * 264*4d3d0e42SAndrew Jeffery * @reg: The register offset from base in bytes 265*4d3d0e42SAndrew Jeffery * @mask: The mask to apply to the register. The lowest set bit of the mask is 266*4d3d0e42SAndrew Jeffery * used to derive the shift value. 267*4d3d0e42SAndrew Jeffery * @enable: The value that enables the function. Value should be in the LSBs, 268*4d3d0e42SAndrew Jeffery * not at the position of the mask. 269*4d3d0e42SAndrew Jeffery * @disable: The value that disables the function. Value should be in the 270*4d3d0e42SAndrew Jeffery * LSBs, not at the position of the mask. 271*4d3d0e42SAndrew Jeffery */ 272*4d3d0e42SAndrew Jeffery struct aspeed_sig_desc { 273*4d3d0e42SAndrew Jeffery unsigned int reg; 274*4d3d0e42SAndrew Jeffery u32 mask; 275*4d3d0e42SAndrew Jeffery u32 enable; 276*4d3d0e42SAndrew Jeffery u32 disable; 277*4d3d0e42SAndrew Jeffery }; 278*4d3d0e42SAndrew Jeffery 279*4d3d0e42SAndrew Jeffery /** 280*4d3d0e42SAndrew Jeffery * Describes a signal expression. The expression is evaluated by ANDing the 281*4d3d0e42SAndrew Jeffery * evaluation of the descriptors. 282*4d3d0e42SAndrew Jeffery * 283*4d3d0e42SAndrew Jeffery * @signal: The signal name for the priority level on the pin. If the signal 284*4d3d0e42SAndrew Jeffery * type is GPIO, then the signal name must begin with the string 285*4d3d0e42SAndrew Jeffery * "GPIO", e.g. GPIOA0, GPIOT4 etc. 286*4d3d0e42SAndrew Jeffery * @function: The name of the function the signal participates in for the 287*4d3d0e42SAndrew Jeffery * associated expression 288*4d3d0e42SAndrew Jeffery * @ndescs: The number of signal descriptors in the expression 289*4d3d0e42SAndrew Jeffery * @descs: Pointer to an array of signal descriptors that comprise the 290*4d3d0e42SAndrew Jeffery * function expression 291*4d3d0e42SAndrew Jeffery */ 292*4d3d0e42SAndrew Jeffery struct aspeed_sig_expr { 293*4d3d0e42SAndrew Jeffery const char *signal; 294*4d3d0e42SAndrew Jeffery const char *function; 295*4d3d0e42SAndrew Jeffery int ndescs; 296*4d3d0e42SAndrew Jeffery const struct aspeed_sig_desc *descs; 297*4d3d0e42SAndrew Jeffery }; 298*4d3d0e42SAndrew Jeffery 299*4d3d0e42SAndrew Jeffery /** 300*4d3d0e42SAndrew Jeffery * A struct capturing the list of expressions enabling signals at each priority 301*4d3d0e42SAndrew Jeffery * for a given pin. The signal configuration for a priority level is evaluated 302*4d3d0e42SAndrew Jeffery * by ORing the evaluation of the signal expressions in the respective 303*4d3d0e42SAndrew Jeffery * priority's list. 304*4d3d0e42SAndrew Jeffery * 305*4d3d0e42SAndrew Jeffery * @name: A name for the pin 306*4d3d0e42SAndrew Jeffery * @prios: A pointer to an array of expression list pointers 307*4d3d0e42SAndrew Jeffery * 308*4d3d0e42SAndrew Jeffery */ 309*4d3d0e42SAndrew Jeffery struct aspeed_pin_desc { 310*4d3d0e42SAndrew Jeffery const char *name; 311*4d3d0e42SAndrew Jeffery const struct aspeed_sig_expr ***prios; 312*4d3d0e42SAndrew Jeffery }; 313*4d3d0e42SAndrew Jeffery 314*4d3d0e42SAndrew Jeffery /* Macro hell */ 315*4d3d0e42SAndrew Jeffery 316*4d3d0e42SAndrew Jeffery /** 317*4d3d0e42SAndrew Jeffery * Short-hand macro for describing a configuration enabled by the state of one 318*4d3d0e42SAndrew Jeffery * bit. The disable value is derived. 319*4d3d0e42SAndrew Jeffery * 320*4d3d0e42SAndrew Jeffery * @reg: The signal's associated register, offset from base 321*4d3d0e42SAndrew Jeffery * @idx: The signal's bit index in the register 322*4d3d0e42SAndrew Jeffery * @val: The value (0 or 1) that enables the function 323*4d3d0e42SAndrew Jeffery */ 324*4d3d0e42SAndrew Jeffery #define SIG_DESC_BIT(reg, idx, val) \ 325*4d3d0e42SAndrew Jeffery { reg, BIT_MASK(idx), val, (((val) + 1) & 1) } 326*4d3d0e42SAndrew Jeffery 327*4d3d0e42SAndrew Jeffery /** 328*4d3d0e42SAndrew Jeffery * A further short-hand macro describing a configuration enabled with a set bit. 329*4d3d0e42SAndrew Jeffery * 330*4d3d0e42SAndrew Jeffery * @reg: The configuration's associated register, offset from base 331*4d3d0e42SAndrew Jeffery * @idx: The configuration's bit index in the register 332*4d3d0e42SAndrew Jeffery */ 333*4d3d0e42SAndrew Jeffery #define SIG_DESC_SET(reg, idx) SIG_DESC_BIT(reg, idx, 1) 334*4d3d0e42SAndrew Jeffery 335*4d3d0e42SAndrew Jeffery #define SIG_DESC_LIST_SYM(sig, func) sig_descs_ ## sig ## _ ## func 336*4d3d0e42SAndrew Jeffery #define SIG_DESC_LIST_DECL(sig, func, ...) \ 337*4d3d0e42SAndrew Jeffery static const struct aspeed_sig_desc SIG_DESC_LIST_SYM(sig, func)[] = \ 338*4d3d0e42SAndrew Jeffery { __VA_ARGS__ } 339*4d3d0e42SAndrew Jeffery 340*4d3d0e42SAndrew Jeffery #define SIG_EXPR_SYM(sig, func) sig_expr_ ## sig ## _ ## func 341*4d3d0e42SAndrew Jeffery #define SIG_EXPR_DECL_(sig, func) \ 342*4d3d0e42SAndrew Jeffery static const struct aspeed_sig_expr SIG_EXPR_SYM(sig, func) = \ 343*4d3d0e42SAndrew Jeffery { \ 344*4d3d0e42SAndrew Jeffery .signal = #sig, \ 345*4d3d0e42SAndrew Jeffery .function = #func, \ 346*4d3d0e42SAndrew Jeffery .ndescs = ARRAY_SIZE(SIG_DESC_LIST_SYM(sig, func)), \ 347*4d3d0e42SAndrew Jeffery .descs = &(SIG_DESC_LIST_SYM(sig, func))[0], \ 348*4d3d0e42SAndrew Jeffery } 349*4d3d0e42SAndrew Jeffery 350*4d3d0e42SAndrew Jeffery /** 351*4d3d0e42SAndrew Jeffery * Declare a signal expression. 352*4d3d0e42SAndrew Jeffery * 353*4d3d0e42SAndrew Jeffery * @sig: A macro symbol name for the signal (is subjected to stringification 354*4d3d0e42SAndrew Jeffery * and token pasting) 355*4d3d0e42SAndrew Jeffery * @func: The function in which the signal is participating 356*4d3d0e42SAndrew Jeffery * @...: Signal descriptors that define the signal expression 357*4d3d0e42SAndrew Jeffery * 358*4d3d0e42SAndrew Jeffery * For example, the following declares the ROMD8 signal for the ROM16 function: 359*4d3d0e42SAndrew Jeffery * 360*4d3d0e42SAndrew Jeffery * SIG_EXPR_DECL(ROMD8, ROM16, SIG_DESC_SET(SCU90, 6)); 361*4d3d0e42SAndrew Jeffery * 362*4d3d0e42SAndrew Jeffery * And with multiple signal descriptors: 363*4d3d0e42SAndrew Jeffery * 364*4d3d0e42SAndrew Jeffery * SIG_EXPR_DECL(ROMD8, ROM16S, SIG_DESC_SET(HW_STRAP1, 4), 365*4d3d0e42SAndrew Jeffery * { HW_STRAP1, GENMASK(1, 0), 0, 0 }); 366*4d3d0e42SAndrew Jeffery */ 367*4d3d0e42SAndrew Jeffery #define SIG_EXPR_DECL(sig, func, ...) \ 368*4d3d0e42SAndrew Jeffery SIG_DESC_LIST_DECL(sig, func, __VA_ARGS__); \ 369*4d3d0e42SAndrew Jeffery SIG_EXPR_DECL_(sig, func) 370*4d3d0e42SAndrew Jeffery 371*4d3d0e42SAndrew Jeffery /** 372*4d3d0e42SAndrew Jeffery * Declare a pointer to a signal expression 373*4d3d0e42SAndrew Jeffery * 374*4d3d0e42SAndrew Jeffery * @sig: The macro symbol name for the signal (subjected to token pasting) 375*4d3d0e42SAndrew Jeffery * @func: The macro symbol name for the function (subjected to token pasting) 376*4d3d0e42SAndrew Jeffery */ 377*4d3d0e42SAndrew Jeffery #define SIG_EXPR_PTR(sig, func) (&SIG_EXPR_SYM(sig, func)) 378*4d3d0e42SAndrew Jeffery 379*4d3d0e42SAndrew Jeffery #define SIG_EXPR_LIST_SYM(sig) sig_exprs_ ## sig 380*4d3d0e42SAndrew Jeffery 381*4d3d0e42SAndrew Jeffery /** 382*4d3d0e42SAndrew Jeffery * Declare a signal expression list for reference in a struct aspeed_pin_prio. 383*4d3d0e42SAndrew Jeffery * 384*4d3d0e42SAndrew Jeffery * @sig: A macro symbol name for the signal (is subjected to token pasting) 385*4d3d0e42SAndrew Jeffery * @...: Signal expression structure pointers (use SIG_EXPR_PTR()) 386*4d3d0e42SAndrew Jeffery * 387*4d3d0e42SAndrew Jeffery * For example, the 16-bit ROM bus can be enabled by one of two possible signal 388*4d3d0e42SAndrew Jeffery * expressions: 389*4d3d0e42SAndrew Jeffery * 390*4d3d0e42SAndrew Jeffery * SIG_EXPR_DECL(ROMD8, ROM16, SIG_DESC_SET(SCU90, 6)); 391*4d3d0e42SAndrew Jeffery * SIG_EXPR_DECL(ROMD8, ROM16S, SIG_DESC_SET(HW_STRAP1, 4), 392*4d3d0e42SAndrew Jeffery * { HW_STRAP1, GENMASK(1, 0), 0, 0 }); 393*4d3d0e42SAndrew Jeffery * SIG_EXPR_LIST_DECL(ROMD8, SIG_EXPR_PTR(ROMD8, ROM16), 394*4d3d0e42SAndrew Jeffery * SIG_EXPR_PTR(ROMD8, ROM16S)); 395*4d3d0e42SAndrew Jeffery */ 396*4d3d0e42SAndrew Jeffery #define SIG_EXPR_LIST_DECL(sig, ...) \ 397*4d3d0e42SAndrew Jeffery static const struct aspeed_sig_expr *SIG_EXPR_LIST_SYM(sig)[] = \ 398*4d3d0e42SAndrew Jeffery { __VA_ARGS__, NULL } 399*4d3d0e42SAndrew Jeffery 400*4d3d0e42SAndrew Jeffery /** 401*4d3d0e42SAndrew Jeffery * A short-hand macro for declaring a function expression and an expression 402*4d3d0e42SAndrew Jeffery * list with a single function. 403*4d3d0e42SAndrew Jeffery * 404*4d3d0e42SAndrew Jeffery * @func: A macro symbol name for the function (is subjected to token pasting) 405*4d3d0e42SAndrew Jeffery * @...: Function descriptors that define the function expression 406*4d3d0e42SAndrew Jeffery * 407*4d3d0e42SAndrew Jeffery * For example, signal NCTS6 participates in its own function with one group: 408*4d3d0e42SAndrew Jeffery * 409*4d3d0e42SAndrew Jeffery * SIG_EXPR_LIST_DECL_SINGLE(NCTS6, NCTS6, SIG_DESC_SET(SCU90, 7)); 410*4d3d0e42SAndrew Jeffery */ 411*4d3d0e42SAndrew Jeffery #define SIG_EXPR_LIST_DECL_SINGLE(sig, func, ...) \ 412*4d3d0e42SAndrew Jeffery SIG_DESC_LIST_DECL(sig, func, __VA_ARGS__); \ 413*4d3d0e42SAndrew Jeffery SIG_EXPR_DECL_(sig, func); \ 414*4d3d0e42SAndrew Jeffery SIG_EXPR_LIST_DECL(sig, SIG_EXPR_PTR(sig, func)) 415*4d3d0e42SAndrew Jeffery 416*4d3d0e42SAndrew Jeffery #define SIG_EXPR_LIST_DECL_DUAL(sig, f0, f1) \ 417*4d3d0e42SAndrew Jeffery SIG_EXPR_LIST_DECL(sig, SIG_EXPR_PTR(sig, f0), SIG_EXPR_PTR(sig, f1)) 418*4d3d0e42SAndrew Jeffery 419*4d3d0e42SAndrew Jeffery #define SIG_EXPR_LIST_PTR(sig) (&SIG_EXPR_LIST_SYM(sig)[0]) 420*4d3d0e42SAndrew Jeffery 421*4d3d0e42SAndrew Jeffery #define PIN_EXPRS_SYM(pin) pin_exprs_ ## pin 422*4d3d0e42SAndrew Jeffery #define PIN_EXPRS_PTR(pin) (&PIN_EXPRS_SYM(pin)[0]) 423*4d3d0e42SAndrew Jeffery #define PIN_SYM(pin) pin_ ## pin 424*4d3d0e42SAndrew Jeffery 425*4d3d0e42SAndrew Jeffery #define MS_PIN_DECL_(pin, ...) \ 426*4d3d0e42SAndrew Jeffery static const struct aspeed_sig_expr **PIN_EXPRS_SYM(pin)[] = \ 427*4d3d0e42SAndrew Jeffery { __VA_ARGS__, NULL }; \ 428*4d3d0e42SAndrew Jeffery static const struct aspeed_pin_desc PIN_SYM(pin) = \ 429*4d3d0e42SAndrew Jeffery { #pin, PIN_EXPRS_PTR(pin) } 430*4d3d0e42SAndrew Jeffery 431*4d3d0e42SAndrew Jeffery /** 432*4d3d0e42SAndrew Jeffery * Declare a multi-signal pin 433*4d3d0e42SAndrew Jeffery * 434*4d3d0e42SAndrew Jeffery * @pin: The pin number 435*4d3d0e42SAndrew Jeffery * @other: Macro name for "other" functionality (subjected to stringification) 436*4d3d0e42SAndrew Jeffery * @high: Macro name for the highest priority signal functions 437*4d3d0e42SAndrew Jeffery * @low: Macro name for the low signal functions 438*4d3d0e42SAndrew Jeffery * 439*4d3d0e42SAndrew Jeffery * For example: 440*4d3d0e42SAndrew Jeffery * 441*4d3d0e42SAndrew Jeffery * #define A8 56 442*4d3d0e42SAndrew Jeffery * SIG_EXPR_DECL(ROMD8, ROM16, SIG_DESC_SET(SCU90, 6)); 443*4d3d0e42SAndrew Jeffery * SIG_EXPR_DECL(ROMD8, ROM16S, SIG_DESC_SET(HW_STRAP1, 4), 444*4d3d0e42SAndrew Jeffery * { HW_STRAP1, GENMASK(1, 0), 0, 0 }); 445*4d3d0e42SAndrew Jeffery * SIG_EXPR_LIST_DECL(ROMD8, SIG_EXPR_PTR(ROMD8, ROM16), 446*4d3d0e42SAndrew Jeffery * SIG_EXPR_PTR(ROMD8, ROM16S)); 447*4d3d0e42SAndrew Jeffery * SIG_EXPR_LIST_DECL_SINGLE(NCTS6, NCTS6, SIG_DESC_SET(SCU90, 7)); 448*4d3d0e42SAndrew Jeffery * MS_PIN_DECL(A8, GPIOH0, ROMD8, NCTS6); 449*4d3d0e42SAndrew Jeffery */ 450*4d3d0e42SAndrew Jeffery #define MS_PIN_DECL(pin, other, high, low) \ 451*4d3d0e42SAndrew Jeffery SIG_EXPR_LIST_DECL_SINGLE(other, other); \ 452*4d3d0e42SAndrew Jeffery MS_PIN_DECL_(pin, \ 453*4d3d0e42SAndrew Jeffery SIG_EXPR_LIST_PTR(high), \ 454*4d3d0e42SAndrew Jeffery SIG_EXPR_LIST_PTR(low), \ 455*4d3d0e42SAndrew Jeffery SIG_EXPR_LIST_PTR(other)) 456*4d3d0e42SAndrew Jeffery 457*4d3d0e42SAndrew Jeffery #define PIN_GROUP_SYM(func) pins_ ## func 458*4d3d0e42SAndrew Jeffery #define FUNC_GROUP_SYM(func) groups_ ## func 459*4d3d0e42SAndrew Jeffery #define FUNC_GROUP_DECL(func, ...) \ 460*4d3d0e42SAndrew Jeffery static const int PIN_GROUP_SYM(func)[] = { __VA_ARGS__ }; \ 461*4d3d0e42SAndrew Jeffery static const char *FUNC_GROUP_SYM(func)[] = { #func } 462*4d3d0e42SAndrew Jeffery 463*4d3d0e42SAndrew Jeffery /** 464*4d3d0e42SAndrew Jeffery * Declare a single signal pin 465*4d3d0e42SAndrew Jeffery * 466*4d3d0e42SAndrew Jeffery * @pin: The pin number 467*4d3d0e42SAndrew Jeffery * @other: Macro name for "other" functionality (subjected to stringification) 468*4d3d0e42SAndrew Jeffery * @sig: Macro name for the signal (subjected to stringification) 469*4d3d0e42SAndrew Jeffery * 470*4d3d0e42SAndrew Jeffery * For example: 471*4d3d0e42SAndrew Jeffery * 472*4d3d0e42SAndrew Jeffery * #define E3 80 473*4d3d0e42SAndrew Jeffery * SIG_EXPR_LIST_DECL_SINGLE(SCL5, I2C5, I2C5_DESC); 474*4d3d0e42SAndrew Jeffery * SS_PIN_DECL(E3, GPIOK0, SCL5); 475*4d3d0e42SAndrew Jeffery */ 476*4d3d0e42SAndrew Jeffery #define SS_PIN_DECL(pin, other, sig) \ 477*4d3d0e42SAndrew Jeffery SIG_EXPR_LIST_DECL_SINGLE(other, other); \ 478*4d3d0e42SAndrew Jeffery MS_PIN_DECL_(pin, SIG_EXPR_LIST_PTR(sig), SIG_EXPR_LIST_PTR(other)) 479*4d3d0e42SAndrew Jeffery 480*4d3d0e42SAndrew Jeffery /** 481*4d3d0e42SAndrew Jeffery * Single signal, single function pin declaration 482*4d3d0e42SAndrew Jeffery * 483*4d3d0e42SAndrew Jeffery * @pin: The pin number 484*4d3d0e42SAndrew Jeffery * @other: Macro name for "other" functionality (subjected to stringification) 485*4d3d0e42SAndrew Jeffery * @sig: Macro name for the signal (subjected to stringification) 486*4d3d0e42SAndrew Jeffery * @...: Signal descriptors that define the function expression 487*4d3d0e42SAndrew Jeffery * 488*4d3d0e42SAndrew Jeffery * For example: 489*4d3d0e42SAndrew Jeffery * 490*4d3d0e42SAndrew Jeffery * SSSF_PIN_DECL(A4, GPIOA2, TIMER3, SIG_DESC_SET(SCU80, 2)); 491*4d3d0e42SAndrew Jeffery */ 492*4d3d0e42SAndrew Jeffery #define SSSF_PIN_DECL(pin, other, sig, ...) \ 493*4d3d0e42SAndrew Jeffery SIG_EXPR_LIST_DECL_SINGLE(sig, sig, __VA_ARGS__); \ 494*4d3d0e42SAndrew Jeffery SIG_EXPR_LIST_DECL_SINGLE(other, other); \ 495*4d3d0e42SAndrew Jeffery MS_PIN_DECL_(pin, SIG_EXPR_LIST_PTR(sig), SIG_EXPR_LIST_PTR(other)); \ 496*4d3d0e42SAndrew Jeffery FUNC_GROUP_DECL(sig, pin) 497*4d3d0e42SAndrew Jeffery 498*4d3d0e42SAndrew Jeffery #define GPIO_PIN_DECL(pin, gpio) \ 499*4d3d0e42SAndrew Jeffery SIG_EXPR_LIST_DECL_SINGLE(gpio, gpio); \ 500*4d3d0e42SAndrew Jeffery MS_PIN_DECL_(pin, SIG_EXPR_LIST_PTR(gpio)) 501*4d3d0e42SAndrew Jeffery 502*4d3d0e42SAndrew Jeffery struct aspeed_pinctrl_data { 503*4d3d0e42SAndrew Jeffery struct regmap *map; 504*4d3d0e42SAndrew Jeffery 505*4d3d0e42SAndrew Jeffery const struct pinctrl_pin_desc *pins; 506*4d3d0e42SAndrew Jeffery const unsigned int npins; 507*4d3d0e42SAndrew Jeffery 508*4d3d0e42SAndrew Jeffery const struct aspeed_pin_group *groups; 509*4d3d0e42SAndrew Jeffery const unsigned int ngroups; 510*4d3d0e42SAndrew Jeffery 511*4d3d0e42SAndrew Jeffery const struct aspeed_pin_function *functions; 512*4d3d0e42SAndrew Jeffery const unsigned int nfunctions; 513*4d3d0e42SAndrew Jeffery }; 514*4d3d0e42SAndrew Jeffery 515*4d3d0e42SAndrew Jeffery #define ASPEED_PINCTRL_PIN(name_) \ 516*4d3d0e42SAndrew Jeffery [name_] = { \ 517*4d3d0e42SAndrew Jeffery .number = name_, \ 518*4d3d0e42SAndrew Jeffery .name = #name_, \ 519*4d3d0e42SAndrew Jeffery .drv_data = (void *) &(PIN_SYM(name_)) \ 520*4d3d0e42SAndrew Jeffery } 521*4d3d0e42SAndrew Jeffery 522*4d3d0e42SAndrew Jeffery struct aspeed_pin_group { 523*4d3d0e42SAndrew Jeffery const char *name; 524*4d3d0e42SAndrew Jeffery const unsigned int *pins; 525*4d3d0e42SAndrew Jeffery const unsigned int npins; 526*4d3d0e42SAndrew Jeffery }; 527*4d3d0e42SAndrew Jeffery 528*4d3d0e42SAndrew Jeffery #define ASPEED_PINCTRL_GROUP(name_) { \ 529*4d3d0e42SAndrew Jeffery .name = #name_, \ 530*4d3d0e42SAndrew Jeffery .pins = &(PIN_GROUP_SYM(name_))[0], \ 531*4d3d0e42SAndrew Jeffery .npins = ARRAY_SIZE(PIN_GROUP_SYM(name_)), \ 532*4d3d0e42SAndrew Jeffery } 533*4d3d0e42SAndrew Jeffery 534*4d3d0e42SAndrew Jeffery struct aspeed_pin_function { 535*4d3d0e42SAndrew Jeffery const char *name; 536*4d3d0e42SAndrew Jeffery const char *const *groups; 537*4d3d0e42SAndrew Jeffery unsigned int ngroups; 538*4d3d0e42SAndrew Jeffery }; 539*4d3d0e42SAndrew Jeffery 540*4d3d0e42SAndrew Jeffery #define ASPEED_PINCTRL_FUNC(name_, ...) { \ 541*4d3d0e42SAndrew Jeffery .name = #name_, \ 542*4d3d0e42SAndrew Jeffery .groups = &FUNC_GROUP_SYM(name_)[0], \ 543*4d3d0e42SAndrew Jeffery .ngroups = ARRAY_SIZE(FUNC_GROUP_SYM(name_)), \ 544*4d3d0e42SAndrew Jeffery } 545*4d3d0e42SAndrew Jeffery 546*4d3d0e42SAndrew Jeffery int aspeed_pinctrl_get_groups_count(struct pinctrl_dev *pctldev); 547*4d3d0e42SAndrew Jeffery const char *aspeed_pinctrl_get_group_name(struct pinctrl_dev *pctldev, 548*4d3d0e42SAndrew Jeffery unsigned int group); 549*4d3d0e42SAndrew Jeffery int aspeed_pinctrl_get_group_pins(struct pinctrl_dev *pctldev, 550*4d3d0e42SAndrew Jeffery unsigned int group, const unsigned int **pins, 551*4d3d0e42SAndrew Jeffery unsigned int *npins); 552*4d3d0e42SAndrew Jeffery void aspeed_pinctrl_pin_dbg_show(struct pinctrl_dev *pctldev, 553*4d3d0e42SAndrew Jeffery struct seq_file *s, unsigned int offset); 554*4d3d0e42SAndrew Jeffery int aspeed_pinmux_get_fn_count(struct pinctrl_dev *pctldev); 555*4d3d0e42SAndrew Jeffery const char *aspeed_pinmux_get_fn_name(struct pinctrl_dev *pctldev, 556*4d3d0e42SAndrew Jeffery unsigned int function); 557*4d3d0e42SAndrew Jeffery int aspeed_pinmux_get_fn_groups(struct pinctrl_dev *pctldev, 558*4d3d0e42SAndrew Jeffery unsigned int function, const char * const **groups, 559*4d3d0e42SAndrew Jeffery unsigned int * const num_groups); 560*4d3d0e42SAndrew Jeffery int aspeed_pinmux_set_mux(struct pinctrl_dev *pctldev, unsigned int function, 561*4d3d0e42SAndrew Jeffery unsigned int group); 562*4d3d0e42SAndrew Jeffery int aspeed_gpio_request_enable(struct pinctrl_dev *pctldev, 563*4d3d0e42SAndrew Jeffery struct pinctrl_gpio_range *range, 564*4d3d0e42SAndrew Jeffery unsigned int offset); 565*4d3d0e42SAndrew Jeffery int aspeed_pinctrl_probe(struct platform_device *pdev, 566*4d3d0e42SAndrew Jeffery struct pinctrl_desc *pdesc, 567*4d3d0e42SAndrew Jeffery struct aspeed_pinctrl_data *pdata); 568*4d3d0e42SAndrew Jeffery 569*4d3d0e42SAndrew Jeffery #endif /* PINCTRL_ASPEED */ 570