pinctrl-single.c (059a6e630bb9ee21ff6955d699471bcf2b4b96ab) | pinctrl-single.c (caeb774ea3b1bc25dc2f24681c27543aba6ca7ae) |
---|---|
1/* 2 * Generic device tree based pinctrl driver for one register per pin 3 * type pinmux controllers 4 * 5 * Copyright (C) 2012 Texas Instruments, Inc. 6 * 7 * This file is licensed under the terms of the GNU General Public 8 * License version 2. This program is licensed "as is" without any --- 24 unchanged lines hidden (view full) --- 33#include "core.h" 34#include "devicetree.h" 35#include "pinconf.h" 36 37#define DRIVER_NAME "pinctrl-single" 38#define PCS_OFF_DISABLED ~0U 39 40/** | 1/* 2 * Generic device tree based pinctrl driver for one register per pin 3 * type pinmux controllers 4 * 5 * Copyright (C) 2012 Texas Instruments, Inc. 6 * 7 * This file is licensed under the terms of the GNU General Public 8 * License version 2. This program is licensed "as is" without any --- 24 unchanged lines hidden (view full) --- 33#include "core.h" 34#include "devicetree.h" 35#include "pinconf.h" 36 37#define DRIVER_NAME "pinctrl-single" 38#define PCS_OFF_DISABLED ~0U 39 40/** |
41 * struct pcs_pingroup - pingroups for a function 42 * @np: pingroup device node pointer 43 * @name: pingroup name 44 * @gpins: array of the pins in the group 45 * @ngpins: number of pins in the group 46 * @node: list node 47 */ 48struct pcs_pingroup { 49 struct device_node *np; 50 const char *name; 51 int *gpins; 52 int ngpins; 53 struct list_head node; 54}; 55 56/** | |
57 * struct pcs_func_vals - mux function register offset and value pair 58 * @reg: register virtual address 59 * @val: register value 60 */ 61struct pcs_func_vals { 62 void __iomem *reg; 63 unsigned val; 64 unsigned mask; --- 106 unchanged lines hidden (view full) --- 171 * @width: bits per mux register 172 * @fmask: function register mask 173 * @fshift: function register shift 174 * @foff: value to turn mux off 175 * @fmax: max number of functions in fmask 176 * @bits_per_mux: number of bits per mux 177 * @bits_per_pin: number of bits per pin 178 * @pins: physical pins on the SoC | 41 * struct pcs_func_vals - mux function register offset and value pair 42 * @reg: register virtual address 43 * @val: register value 44 */ 45struct pcs_func_vals { 46 void __iomem *reg; 47 unsigned val; 48 unsigned mask; --- 106 unchanged lines hidden (view full) --- 155 * @width: bits per mux register 156 * @fmask: function register mask 157 * @fshift: function register shift 158 * @foff: value to turn mux off 159 * @fmax: max number of functions in fmask 160 * @bits_per_mux: number of bits per mux 161 * @bits_per_pin: number of bits per pin 162 * @pins: physical pins on the SoC |
179 * @pgtree: pingroup index radix tree | |
180 * @ftree: function index radix tree | 163 * @ftree: function index radix tree |
181 * @pingroups: list of pingroups | |
182 * @functions: list of functions 183 * @gpiofuncs: list of gpio functions 184 * @irqs: list of interrupt registers 185 * @chip: chip container for this instance 186 * @domain: IRQ domain for this instance | 164 * @functions: list of functions 165 * @gpiofuncs: list of gpio functions 166 * @irqs: list of interrupt registers 167 * @chip: chip container for this instance 168 * @domain: IRQ domain for this instance |
187 * @ngroups: number of pingroups | |
188 * @nfuncs: number of functions 189 * @desc: pin controller descriptor 190 * @read: register read function to use 191 * @write: register write function to use 192 */ 193struct pcs_device { 194 struct resource *res; 195 void __iomem *base; --- 12 unchanged lines hidden (view full) --- 208 unsigned width; 209 unsigned fmask; 210 unsigned fshift; 211 unsigned foff; 212 unsigned fmax; 213 bool bits_per_mux; 214 unsigned bits_per_pin; 215 struct pcs_data pins; | 169 * @nfuncs: number of functions 170 * @desc: pin controller descriptor 171 * @read: register read function to use 172 * @write: register write function to use 173 */ 174struct pcs_device { 175 struct resource *res; 176 void __iomem *base; --- 12 unchanged lines hidden (view full) --- 189 unsigned width; 190 unsigned fmask; 191 unsigned fshift; 192 unsigned foff; 193 unsigned fmax; 194 bool bits_per_mux; 195 unsigned bits_per_pin; 196 struct pcs_data pins; |
216 struct radix_tree_root pgtree; | |
217 struct radix_tree_root ftree; | 197 struct radix_tree_root ftree; |
218 struct list_head pingroups; | |
219 struct list_head functions; 220 struct list_head gpiofuncs; 221 struct list_head irqs; 222 struct irq_chip chip; 223 struct irq_domain *domain; | 198 struct list_head functions; 199 struct list_head gpiofuncs; 200 struct list_head irqs; 201 struct irq_chip chip; 202 struct irq_domain *domain; |
224 unsigned ngroups; | |
225 unsigned nfuncs; 226 struct pinctrl_desc desc; 227 unsigned (*read)(void __iomem *reg); 228 void (*write)(unsigned val, void __iomem *reg); 229}; 230 231#define PCS_QUIRK_HAS_SHARED_IRQ (pcs->flags & PCS_QUIRK_SHARED_IRQ) 232#define PCS_HAS_IRQ (pcs->flags & PCS_FEAT_IRQ) --- 50 unchanged lines hidden (view full) --- 283 writew(val, reg); 284} 285 286static void __maybe_unused pcs_writel(unsigned val, void __iomem *reg) 287{ 288 writel(val, reg); 289} 290 | 203 unsigned nfuncs; 204 struct pinctrl_desc desc; 205 unsigned (*read)(void __iomem *reg); 206 void (*write)(unsigned val, void __iomem *reg); 207}; 208 209#define PCS_QUIRK_HAS_SHARED_IRQ (pcs->flags & PCS_QUIRK_SHARED_IRQ) 210#define PCS_HAS_IRQ (pcs->flags & PCS_FEAT_IRQ) --- 50 unchanged lines hidden (view full) --- 261 writew(val, reg); 262} 263 264static void __maybe_unused pcs_writel(unsigned val, void __iomem *reg) 265{ 266 writel(val, reg); 267} 268 |
291static int pcs_get_groups_count(struct pinctrl_dev *pctldev) 292{ 293 struct pcs_device *pcs; 294 295 pcs = pinctrl_dev_get_drvdata(pctldev); 296 297 return pcs->ngroups; 298} 299 300static const char *pcs_get_group_name(struct pinctrl_dev *pctldev, 301 unsigned gselector) 302{ 303 struct pcs_device *pcs; 304 struct pcs_pingroup *group; 305 306 pcs = pinctrl_dev_get_drvdata(pctldev); 307 group = radix_tree_lookup(&pcs->pgtree, gselector); 308 if (!group) { 309 dev_err(pcs->dev, "%s could not find pingroup%i\n", 310 __func__, gselector); 311 return NULL; 312 } 313 314 return group->name; 315} 316 317static int pcs_get_group_pins(struct pinctrl_dev *pctldev, 318 unsigned gselector, 319 const unsigned **pins, 320 unsigned *npins) 321{ 322 struct pcs_device *pcs; 323 struct pcs_pingroup *group; 324 325 pcs = pinctrl_dev_get_drvdata(pctldev); 326 group = radix_tree_lookup(&pcs->pgtree, gselector); 327 if (!group) { 328 dev_err(pcs->dev, "%s could not find pingroup%i\n", 329 __func__, gselector); 330 return -EINVAL; 331 } 332 333 *pins = group->gpins; 334 *npins = group->ngpins; 335 336 return 0; 337} 338 | |
339static void pcs_pin_dbg_show(struct pinctrl_dev *pctldev, 340 struct seq_file *s, 341 unsigned pin) 342{ 343 struct pcs_device *pcs; 344 unsigned val, mux_bytes; 345 unsigned long offset; 346 size_t pa; --- 17 unchanged lines hidden (view full) --- 364 devm_kfree(pcs->dev, map); 365} 366 367static int pcs_dt_node_to_map(struct pinctrl_dev *pctldev, 368 struct device_node *np_config, 369 struct pinctrl_map **map, unsigned *num_maps); 370 371static const struct pinctrl_ops pcs_pinctrl_ops = { | 269static void pcs_pin_dbg_show(struct pinctrl_dev *pctldev, 270 struct seq_file *s, 271 unsigned pin) 272{ 273 struct pcs_device *pcs; 274 unsigned val, mux_bytes; 275 unsigned long offset; 276 size_t pa; --- 17 unchanged lines hidden (view full) --- 294 devm_kfree(pcs->dev, map); 295} 296 297static int pcs_dt_node_to_map(struct pinctrl_dev *pctldev, 298 struct device_node *np_config, 299 struct pinctrl_map **map, unsigned *num_maps); 300 301static const struct pinctrl_ops pcs_pinctrl_ops = { |
372 .get_groups_count = pcs_get_groups_count, 373 .get_group_name = pcs_get_group_name, 374 .get_group_pins = pcs_get_group_pins, | 302 .get_groups_count = pinctrl_generic_get_group_count, 303 .get_group_name = pinctrl_generic_get_group_name, 304 .get_group_pins = pinctrl_generic_get_group_pins, |
375 .pin_dbg_show = pcs_pin_dbg_show, 376 .dt_node_to_map = pcs_dt_node_to_map, 377 .dt_free_map = pcs_dt_free_map, 378}; 379 380static int pcs_get_functions_count(struct pinctrl_dev *pctldev) 381{ 382 struct pcs_device *pcs; --- 297 unchanged lines hidden (view full) --- 680 681static int pcs_pinconf_group_get(struct pinctrl_dev *pctldev, 682 unsigned group, unsigned long *config) 683{ 684 const unsigned *pins; 685 unsigned npins, old = 0; 686 int i, ret; 687 | 305 .pin_dbg_show = pcs_pin_dbg_show, 306 .dt_node_to_map = pcs_dt_node_to_map, 307 .dt_free_map = pcs_dt_free_map, 308}; 309 310static int pcs_get_functions_count(struct pinctrl_dev *pctldev) 311{ 312 struct pcs_device *pcs; --- 297 unchanged lines hidden (view full) --- 610 611static int pcs_pinconf_group_get(struct pinctrl_dev *pctldev, 612 unsigned group, unsigned long *config) 613{ 614 const unsigned *pins; 615 unsigned npins, old = 0; 616 int i, ret; 617 |
688 ret = pcs_get_group_pins(pctldev, group, &pins, &npins); | 618 ret = pinctrl_generic_get_group_pins(pctldev, group, &pins, &npins); |
689 if (ret) 690 return ret; 691 for (i = 0; i < npins; i++) { 692 if (pcs_pinconf_get(pctldev, pins[i], config)) 693 return -ENOTSUPP; 694 /* configs do not match between two pins */ 695 if (i && (old != *config)) 696 return -ENOTSUPP; --- 5 unchanged lines hidden (view full) --- 702static int pcs_pinconf_group_set(struct pinctrl_dev *pctldev, 703 unsigned group, unsigned long *configs, 704 unsigned num_configs) 705{ 706 const unsigned *pins; 707 unsigned npins; 708 int i, ret; 709 | 619 if (ret) 620 return ret; 621 for (i = 0; i < npins; i++) { 622 if (pcs_pinconf_get(pctldev, pins[i], config)) 623 return -ENOTSUPP; 624 /* configs do not match between two pins */ 625 if (i && (old != *config)) 626 return -ENOTSUPP; --- 5 unchanged lines hidden (view full) --- 632static int pcs_pinconf_group_set(struct pinctrl_dev *pctldev, 633 unsigned group, unsigned long *configs, 634 unsigned num_configs) 635{ 636 const unsigned *pins; 637 unsigned npins; 638 int i, ret; 639 |
710 ret = pcs_get_group_pins(pctldev, group, &pins, &npins); | 640 ret = pinctrl_generic_get_group_pins(pctldev, group, &pins, &npins); |
711 if (ret) 712 return ret; 713 for (i = 0; i < npins; i++) { 714 if (pcs_pinconf_set(pctldev, pins[i], configs, num_configs)) 715 return -ENOTSUPP; 716 } 717 return 0; 718} --- 173 unchanged lines hidden (view full) --- 892 if (found == function) 893 radix_tree_delete(&pcs->ftree, i); 894 } 895 list_del(&function->node); 896 mutex_unlock(&pcs->mutex); 897} 898 899/** | 641 if (ret) 642 return ret; 643 for (i = 0; i < npins; i++) { 644 if (pcs_pinconf_set(pctldev, pins[i], configs, num_configs)) 645 return -ENOTSUPP; 646 } 647 return 0; 648} --- 173 unchanged lines hidden (view full) --- 822 if (found == function) 823 radix_tree_delete(&pcs->ftree, i); 824 } 825 list_del(&function->node); 826 mutex_unlock(&pcs->mutex); 827} 828 829/** |
900 * pcs_add_pingroup() - add a pingroup to the pingroup list 901 * @pcs: pcs driver instance 902 * @np: device node of the mux entry 903 * @name: name of the pingroup 904 * @gpins: array of the pins that belong to the group 905 * @ngpins: number of pins in the group 906 */ 907static int pcs_add_pingroup(struct pcs_device *pcs, 908 struct device_node *np, 909 const char *name, 910 int *gpins, 911 int ngpins) 912{ 913 struct pcs_pingroup *pingroup; 914 915 pingroup = devm_kzalloc(pcs->dev, sizeof(*pingroup), GFP_KERNEL); 916 if (!pingroup) 917 return -ENOMEM; 918 919 pingroup->name = name; 920 pingroup->np = np; 921 pingroup->gpins = gpins; 922 pingroup->ngpins = ngpins; 923 924 mutex_lock(&pcs->mutex); 925 list_add_tail(&pingroup->node, &pcs->pingroups); 926 radix_tree_insert(&pcs->pgtree, pcs->ngroups, pingroup); 927 pcs->ngroups++; 928 mutex_unlock(&pcs->mutex); 929 930 return 0; 931} 932 933/** | |
934 * pcs_get_pin_by_offset() - get a pin index based on the register offset 935 * @pcs: pcs driver instance 936 * @offset: register offset from the base 937 * 938 * Note that this is OK as long as the pins are in a static array. 939 */ 940static int pcs_get_pin_by_offset(struct pcs_device *pcs, unsigned offset) 941{ --- 153 unchanged lines hidden (view full) --- 1095 &conf, &s); 1096 m->type = PIN_MAP_TYPE_CONFIGS_GROUP; 1097 m->data.configs.group_or_pin = np->name; 1098 m->data.configs.configs = settings; 1099 m->data.configs.num_configs = nconfs; 1100 return 0; 1101} 1102 | 830 * pcs_get_pin_by_offset() - get a pin index based on the register offset 831 * @pcs: pcs driver instance 832 * @offset: register offset from the base 833 * 834 * Note that this is OK as long as the pins are in a static array. 835 */ 836static int pcs_get_pin_by_offset(struct pcs_device *pcs, unsigned offset) 837{ --- 153 unchanged lines hidden (view full) --- 991 &conf, &s); 992 m->type = PIN_MAP_TYPE_CONFIGS_GROUP; 993 m->data.configs.group_or_pin = np->name; 994 m->data.configs.configs = settings; 995 m->data.configs.num_configs = nconfs; 996 return 0; 997} 998 |
1103static void pcs_free_pingroups(struct pcs_device *pcs); 1104 | |
1105/** 1106 * smux_parse_one_pinctrl_entry() - parses a device tree mux entry | 999/** 1000 * smux_parse_one_pinctrl_entry() - parses a device tree mux entry |
1001 * @pctldev: pin controller device |
|
1107 * @pcs: pinctrl driver instance 1108 * @np: device node of the mux entry 1109 * @map: map entry 1110 * @num_maps: number of map 1111 * @pgnames: pingroup names 1112 * 1113 * Note that this binding currently supports only sets of one register + value. 1114 * --- 66 unchanged lines hidden (view full) --- 1181 1182 pgnames[0] = np->name; 1183 function = pcs_add_function(pcs, np, np->name, vals, found, pgnames, 1); 1184 if (!function) { 1185 res = -ENOMEM; 1186 goto free_pins; 1187 } 1188 | 1002 * @pcs: pinctrl driver instance 1003 * @np: device node of the mux entry 1004 * @map: map entry 1005 * @num_maps: number of map 1006 * @pgnames: pingroup names 1007 * 1008 * Note that this binding currently supports only sets of one register + value. 1009 * --- 66 unchanged lines hidden (view full) --- 1076 1077 pgnames[0] = np->name; 1078 function = pcs_add_function(pcs, np, np->name, vals, found, pgnames, 1); 1079 if (!function) { 1080 res = -ENOMEM; 1081 goto free_pins; 1082 } 1083 |
1189 res = pcs_add_pingroup(pcs, np, np->name, pins, found); | 1084 res = pinctrl_generic_add_group(pcs->pctl, np->name, pins, found, pcs); |
1190 if (res < 0) 1191 goto free_function; 1192 1193 (*map)->type = PIN_MAP_TYPE_MUX_GROUP; 1194 (*map)->data.mux.group = np->name; 1195 (*map)->data.mux.function = np->name; 1196 1197 if (PCS_HAS_PINCONF) { 1198 res = pcs_parse_pinconf(pcs, np, function, map); 1199 if (res) 1200 goto free_pingroups; 1201 *num_maps = 2; 1202 } else { 1203 *num_maps = 1; 1204 } 1205 return 0; 1206 1207free_pingroups: | 1085 if (res < 0) 1086 goto free_function; 1087 1088 (*map)->type = PIN_MAP_TYPE_MUX_GROUP; 1089 (*map)->data.mux.group = np->name; 1090 (*map)->data.mux.function = np->name; 1091 1092 if (PCS_HAS_PINCONF) { 1093 res = pcs_parse_pinconf(pcs, np, function, map); 1094 if (res) 1095 goto free_pingroups; 1096 *num_maps = 2; 1097 } else { 1098 *num_maps = 1; 1099 } 1100 return 0; 1101 1102free_pingroups: |
1208 pcs_free_pingroups(pcs); | 1103 pinctrl_generic_remove_last_group(pcs->pctl); |
1209 *num_maps = 1; 1210free_function: 1211 pcs_remove_function(pcs, function); 1212 1213free_pins: 1214 devm_kfree(pcs->dev, pins); 1215 1216free_vals: --- 98 unchanged lines hidden (view full) --- 1315 1316 pgnames[0] = np->name; 1317 function = pcs_add_function(pcs, np, np->name, vals, found, pgnames, 1); 1318 if (!function) { 1319 res = -ENOMEM; 1320 goto free_pins; 1321 } 1322 | 1104 *num_maps = 1; 1105free_function: 1106 pcs_remove_function(pcs, function); 1107 1108free_pins: 1109 devm_kfree(pcs->dev, pins); 1110 1111free_vals: --- 98 unchanged lines hidden (view full) --- 1210 1211 pgnames[0] = np->name; 1212 function = pcs_add_function(pcs, np, np->name, vals, found, pgnames, 1); 1213 if (!function) { 1214 res = -ENOMEM; 1215 goto free_pins; 1216 } 1217 |
1323 res = pcs_add_pingroup(pcs, np, np->name, pins, found); | 1218 res = pinctrl_generic_add_group(pcs->pctl, np->name, pins, found, pcs); |
1324 if (res < 0) 1325 goto free_function; 1326 1327 (*map)->type = PIN_MAP_TYPE_MUX_GROUP; 1328 (*map)->data.mux.group = np->name; 1329 (*map)->data.mux.function = np->name; 1330 1331 if (PCS_HAS_PINCONF) { 1332 dev_err(pcs->dev, "pinconf not supported\n"); 1333 goto free_pingroups; 1334 } 1335 1336 *num_maps = 1; 1337 return 0; 1338 1339free_pingroups: | 1219 if (res < 0) 1220 goto free_function; 1221 1222 (*map)->type = PIN_MAP_TYPE_MUX_GROUP; 1223 (*map)->data.mux.group = np->name; 1224 (*map)->data.mux.function = np->name; 1225 1226 if (PCS_HAS_PINCONF) { 1227 dev_err(pcs->dev, "pinconf not supported\n"); 1228 goto free_pingroups; 1229 } 1230 1231 *num_maps = 1; 1232 return 0; 1233 1234free_pingroups: |
1340 pcs_free_pingroups(pcs); | 1235 pinctrl_generic_remove_last_group(pcs->pctl); |
1341 *num_maps = 1; 1342free_function: 1343 pcs_remove_function(pcs, function); 1344 1345free_pins: 1346 devm_kfree(pcs->dev, pins); 1347 1348free_vals: --- 82 unchanged lines hidden (view full) --- 1431 1432 function = list_entry(pos, struct pcs_function, node); 1433 list_del(&function->node); 1434 } 1435 mutex_unlock(&pcs->mutex); 1436} 1437 1438/** | 1236 *num_maps = 1; 1237free_function: 1238 pcs_remove_function(pcs, function); 1239 1240free_pins: 1241 devm_kfree(pcs->dev, pins); 1242 1243free_vals: --- 82 unchanged lines hidden (view full) --- 1326 1327 function = list_entry(pos, struct pcs_function, node); 1328 list_del(&function->node); 1329 } 1330 mutex_unlock(&pcs->mutex); 1331} 1332 1333/** |
1439 * pcs_free_pingroups() - free memory used by pingroups 1440 * @pcs: pcs driver instance 1441 */ 1442static void pcs_free_pingroups(struct pcs_device *pcs) 1443{ 1444 struct list_head *pos, *tmp; 1445 int i; 1446 1447 mutex_lock(&pcs->mutex); 1448 for (i = 0; i < pcs->ngroups; i++) { 1449 struct pcs_pingroup *pingroup; 1450 1451 pingroup = radix_tree_lookup(&pcs->pgtree, i); 1452 if (!pingroup) 1453 continue; 1454 radix_tree_delete(&pcs->pgtree, i); 1455 } 1456 list_for_each_safe(pos, tmp, &pcs->pingroups) { 1457 struct pcs_pingroup *pingroup; 1458 1459 pingroup = list_entry(pos, struct pcs_pingroup, node); 1460 list_del(&pingroup->node); 1461 } 1462 mutex_unlock(&pcs->mutex); 1463} 1464 1465/** | |
1466 * pcs_irq_free() - free interrupt 1467 * @pcs: pcs driver instance 1468 */ 1469static void pcs_irq_free(struct pcs_device *pcs) 1470{ 1471 struct pcs_soc_data *pcs_soc = &pcs->socdata; 1472 1473 if (pcs_soc->irq < 0) --- 12 unchanged lines hidden (view full) --- 1486 * pcs_free_resources() - free memory used by this driver 1487 * @pcs: pcs driver instance 1488 */ 1489static void pcs_free_resources(struct pcs_device *pcs) 1490{ 1491 pcs_irq_free(pcs); 1492 pinctrl_unregister(pcs->pctl); 1493 pcs_free_funcs(pcs); | 1334 * pcs_irq_free() - free interrupt 1335 * @pcs: pcs driver instance 1336 */ 1337static void pcs_irq_free(struct pcs_device *pcs) 1338{ 1339 struct pcs_soc_data *pcs_soc = &pcs->socdata; 1340 1341 if (pcs_soc->irq < 0) --- 12 unchanged lines hidden (view full) --- 1354 * pcs_free_resources() - free memory used by this driver 1355 * @pcs: pcs driver instance 1356 */ 1357static void pcs_free_resources(struct pcs_device *pcs) 1358{ 1359 pcs_irq_free(pcs); 1360 pinctrl_unregister(pcs->pctl); 1361 pcs_free_funcs(pcs); |
1494 pcs_free_pingroups(pcs); | 1362 |
1495#if IS_BUILTIN(CONFIG_PINCTRL_SINGLE) 1496 if (pcs->missing_nr_pinctrl_cells) 1497 of_remove_property(pcs->np, pcs->missing_nr_pinctrl_cells); 1498#endif 1499} 1500 1501static const struct of_device_id pcs_of_match[]; 1502 --- 377 unchanged lines hidden (view full) --- 1880 if (!pcs) { 1881 dev_err(&pdev->dev, "could not allocate\n"); 1882 return -ENOMEM; 1883 } 1884 pcs->dev = &pdev->dev; 1885 pcs->np = np; 1886 raw_spin_lock_init(&pcs->lock); 1887 mutex_init(&pcs->mutex); | 1363#if IS_BUILTIN(CONFIG_PINCTRL_SINGLE) 1364 if (pcs->missing_nr_pinctrl_cells) 1365 of_remove_property(pcs->np, pcs->missing_nr_pinctrl_cells); 1366#endif 1367} 1368 1369static const struct of_device_id pcs_of_match[]; 1370 --- 377 unchanged lines hidden (view full) --- 1748 if (!pcs) { 1749 dev_err(&pdev->dev, "could not allocate\n"); 1750 return -ENOMEM; 1751 } 1752 pcs->dev = &pdev->dev; 1753 pcs->np = np; 1754 raw_spin_lock_init(&pcs->lock); 1755 mutex_init(&pcs->mutex); |
1888 INIT_LIST_HEAD(&pcs->pingroups); | |
1889 INIT_LIST_HEAD(&pcs->functions); 1890 INIT_LIST_HEAD(&pcs->gpiofuncs); 1891 soc = match->data; 1892 pcs->flags = soc->flags; 1893 memcpy(&pcs->socdata, soc, sizeof(*soc)); 1894 1895 ret = of_property_read_u32(np, "pinctrl-single,register-width", 1896 &pcs->width); --- 45 unchanged lines hidden (view full) --- 1942 1943 pcs->size = resource_size(pcs->res); 1944 pcs->base = devm_ioremap(pcs->dev, pcs->res->start, pcs->size); 1945 if (!pcs->base) { 1946 dev_err(pcs->dev, "could not ioremap\n"); 1947 return -ENODEV; 1948 } 1949 | 1756 INIT_LIST_HEAD(&pcs->functions); 1757 INIT_LIST_HEAD(&pcs->gpiofuncs); 1758 soc = match->data; 1759 pcs->flags = soc->flags; 1760 memcpy(&pcs->socdata, soc, sizeof(*soc)); 1761 1762 ret = of_property_read_u32(np, "pinctrl-single,register-width", 1763 &pcs->width); --- 45 unchanged lines hidden (view full) --- 1809 1810 pcs->size = resource_size(pcs->res); 1811 pcs->base = devm_ioremap(pcs->dev, pcs->res->start, pcs->size); 1812 if (!pcs->base) { 1813 dev_err(pcs->dev, "could not ioremap\n"); 1814 return -ENODEV; 1815 } 1816 |
1950 INIT_RADIX_TREE(&pcs->pgtree, GFP_KERNEL); | |
1951 INIT_RADIX_TREE(&pcs->ftree, GFP_KERNEL); 1952 platform_set_drvdata(pdev, pcs); 1953 1954 switch (pcs->width) { 1955 case 8: 1956 pcs->read = pcs_readb; 1957 pcs->write = pcs_writeb; 1958 break; --- 132 unchanged lines hidden --- | 1817 INIT_RADIX_TREE(&pcs->ftree, GFP_KERNEL); 1818 platform_set_drvdata(pdev, pcs); 1819 1820 switch (pcs->width) { 1821 case 8: 1822 pcs->read = pcs_readb; 1823 pcs->write = pcs_writeb; 1824 break; --- 132 unchanged lines hidden --- |