pinctrl.c 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642
  1. /*
  2. * SuperH Pin Function Controller pinmux support.
  3. *
  4. * Copyright (C) 2012 Paul Mundt
  5. *
  6. * This file is subject to the terms and conditions of the GNU General Public
  7. * License. See the file "COPYING" in the main directory of this archive
  8. * for more details.
  9. */
  10. #define DRV_NAME "sh-pfc"
  11. #include <linux/device.h>
  12. #include <linux/err.h>
  13. #include <linux/init.h>
  14. #include <linux/module.h>
  15. #include <linux/of.h>
  16. #include <linux/pinctrl/consumer.h>
  17. #include <linux/pinctrl/machine.h>
  18. #include <linux/pinctrl/pinconf.h>
  19. #include <linux/pinctrl/pinconf-generic.h>
  20. #include <linux/pinctrl/pinctrl.h>
  21. #include <linux/pinctrl/pinmux.h>
  22. #include <linux/slab.h>
  23. #include <linux/spinlock.h>
  24. #include "core.h"
  25. #include "../core.h"
  26. #include "../pinconf.h"
  27. struct sh_pfc_pin_config {
  28. u32 type;
  29. };
  30. struct sh_pfc_pinctrl {
  31. struct pinctrl_dev *pctl;
  32. struct pinctrl_desc pctl_desc;
  33. struct sh_pfc *pfc;
  34. struct pinctrl_pin_desc *pins;
  35. struct sh_pfc_pin_config *configs;
  36. };
  37. static int sh_pfc_get_groups_count(struct pinctrl_dev *pctldev)
  38. {
  39. struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
  40. return pmx->pfc->info->nr_groups;
  41. }
  42. static const char *sh_pfc_get_group_name(struct pinctrl_dev *pctldev,
  43. unsigned selector)
  44. {
  45. struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
  46. return pmx->pfc->info->groups[selector].name;
  47. }
  48. static int sh_pfc_get_group_pins(struct pinctrl_dev *pctldev, unsigned selector,
  49. const unsigned **pins, unsigned *num_pins)
  50. {
  51. struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
  52. *pins = pmx->pfc->info->groups[selector].pins;
  53. *num_pins = pmx->pfc->info->groups[selector].nr_pins;
  54. return 0;
  55. }
  56. static void sh_pfc_pin_dbg_show(struct pinctrl_dev *pctldev, struct seq_file *s,
  57. unsigned offset)
  58. {
  59. seq_printf(s, "%s", DRV_NAME);
  60. }
  61. #ifdef CONFIG_OF
  62. static int sh_pfc_map_add_config(struct pinctrl_map *map,
  63. const char *group_or_pin,
  64. enum pinctrl_map_type type,
  65. unsigned long *configs,
  66. unsigned int num_configs)
  67. {
  68. unsigned long *cfgs;
  69. cfgs = kmemdup(configs, num_configs * sizeof(*cfgs),
  70. GFP_KERNEL);
  71. if (cfgs == NULL)
  72. return -ENOMEM;
  73. map->type = type;
  74. map->data.configs.group_or_pin = group_or_pin;
  75. map->data.configs.configs = cfgs;
  76. map->data.configs.num_configs = num_configs;
  77. return 0;
  78. }
  79. static int sh_pfc_dt_subnode_to_map(struct device *dev, struct device_node *np,
  80. struct pinctrl_map **map,
  81. unsigned int *num_maps, unsigned int *index)
  82. {
  83. struct pinctrl_map *maps = *map;
  84. unsigned int nmaps = *num_maps;
  85. unsigned int idx = *index;
  86. unsigned int num_configs;
  87. const char *function = NULL;
  88. unsigned long *configs;
  89. struct property *prop;
  90. unsigned int num_groups;
  91. unsigned int num_pins;
  92. const char *group;
  93. const char *pin;
  94. int ret;
  95. /* Parse the function and configuration properties. At least a function
  96. * or one configuration must be specified.
  97. */
  98. ret = of_property_read_string(np, "renesas,function", &function);
  99. if (ret < 0 && ret != -EINVAL) {
  100. dev_err(dev, "Invalid function in DT\n");
  101. return ret;
  102. }
  103. ret = pinconf_generic_parse_dt_config(np, &configs, &num_configs);
  104. if (ret < 0)
  105. return ret;
  106. if (!function && num_configs == 0) {
  107. dev_err(dev,
  108. "DT node must contain at least a function or config\n");
  109. goto done;
  110. }
  111. /* Count the number of pins and groups and reallocate mappings. */
  112. ret = of_property_count_strings(np, "renesas,pins");
  113. if (ret == -EINVAL) {
  114. num_pins = 0;
  115. } else if (ret < 0) {
  116. dev_err(dev, "Invalid pins list in DT\n");
  117. goto done;
  118. } else {
  119. num_pins = ret;
  120. }
  121. ret = of_property_count_strings(np, "renesas,groups");
  122. if (ret == -EINVAL) {
  123. num_groups = 0;
  124. } else if (ret < 0) {
  125. dev_err(dev, "Invalid pin groups list in DT\n");
  126. goto done;
  127. } else {
  128. num_groups = ret;
  129. }
  130. if (!num_pins && !num_groups) {
  131. dev_err(dev, "No pin or group provided in DT node\n");
  132. ret = -ENODEV;
  133. goto done;
  134. }
  135. if (function)
  136. nmaps += num_groups;
  137. if (configs)
  138. nmaps += num_pins + num_groups;
  139. maps = krealloc(maps, sizeof(*maps) * nmaps, GFP_KERNEL);
  140. if (maps == NULL) {
  141. ret = -ENOMEM;
  142. goto done;
  143. }
  144. *map = maps;
  145. *num_maps = nmaps;
  146. /* Iterate over pins and groups and create the mappings. */
  147. of_property_for_each_string(np, "renesas,groups", prop, group) {
  148. if (function) {
  149. maps[idx].type = PIN_MAP_TYPE_MUX_GROUP;
  150. maps[idx].data.mux.group = group;
  151. maps[idx].data.mux.function = function;
  152. idx++;
  153. }
  154. if (configs) {
  155. ret = sh_pfc_map_add_config(&maps[idx], group,
  156. PIN_MAP_TYPE_CONFIGS_GROUP,
  157. configs, num_configs);
  158. if (ret < 0)
  159. goto done;
  160. idx++;
  161. }
  162. }
  163. if (!configs) {
  164. ret = 0;
  165. goto done;
  166. }
  167. of_property_for_each_string(np, "renesas,pins", prop, pin) {
  168. ret = sh_pfc_map_add_config(&maps[idx], pin,
  169. PIN_MAP_TYPE_CONFIGS_PIN,
  170. configs, num_configs);
  171. if (ret < 0)
  172. goto done;
  173. idx++;
  174. }
  175. done:
  176. *index = idx;
  177. kfree(configs);
  178. return ret;
  179. }
  180. static void sh_pfc_dt_free_map(struct pinctrl_dev *pctldev,
  181. struct pinctrl_map *map, unsigned num_maps)
  182. {
  183. unsigned int i;
  184. if (map == NULL)
  185. return;
  186. for (i = 0; i < num_maps; ++i) {
  187. if (map[i].type == PIN_MAP_TYPE_CONFIGS_GROUP ||
  188. map[i].type == PIN_MAP_TYPE_CONFIGS_PIN)
  189. kfree(map[i].data.configs.configs);
  190. }
  191. kfree(map);
  192. }
  193. static int sh_pfc_dt_node_to_map(struct pinctrl_dev *pctldev,
  194. struct device_node *np,
  195. struct pinctrl_map **map, unsigned *num_maps)
  196. {
  197. struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
  198. struct device *dev = pmx->pfc->dev;
  199. struct device_node *child;
  200. unsigned int index;
  201. int ret;
  202. *map = NULL;
  203. *num_maps = 0;
  204. index = 0;
  205. for_each_child_of_node(np, child) {
  206. ret = sh_pfc_dt_subnode_to_map(dev, child, map, num_maps,
  207. &index);
  208. if (ret < 0)
  209. goto done;
  210. }
  211. /* If no mapping has been found in child nodes try the config node. */
  212. if (*num_maps == 0) {
  213. ret = sh_pfc_dt_subnode_to_map(dev, np, map, num_maps, &index);
  214. if (ret < 0)
  215. goto done;
  216. }
  217. if (*num_maps)
  218. return 0;
  219. dev_err(dev, "no mapping found in node %s\n", np->full_name);
  220. ret = -EINVAL;
  221. done:
  222. if (ret < 0)
  223. sh_pfc_dt_free_map(pctldev, *map, *num_maps);
  224. return ret;
  225. }
  226. #endif /* CONFIG_OF */
  227. static const struct pinctrl_ops sh_pfc_pinctrl_ops = {
  228. .get_groups_count = sh_pfc_get_groups_count,
  229. .get_group_name = sh_pfc_get_group_name,
  230. .get_group_pins = sh_pfc_get_group_pins,
  231. .pin_dbg_show = sh_pfc_pin_dbg_show,
  232. #ifdef CONFIG_OF
  233. .dt_node_to_map = sh_pfc_dt_node_to_map,
  234. .dt_free_map = sh_pfc_dt_free_map,
  235. #endif
  236. };
  237. static int sh_pfc_get_functions_count(struct pinctrl_dev *pctldev)
  238. {
  239. struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
  240. return pmx->pfc->info->nr_functions;
  241. }
  242. static const char *sh_pfc_get_function_name(struct pinctrl_dev *pctldev,
  243. unsigned selector)
  244. {
  245. struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
  246. return pmx->pfc->info->functions[selector].name;
  247. }
  248. static int sh_pfc_get_function_groups(struct pinctrl_dev *pctldev,
  249. unsigned selector,
  250. const char * const **groups,
  251. unsigned * const num_groups)
  252. {
  253. struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
  254. *groups = pmx->pfc->info->functions[selector].groups;
  255. *num_groups = pmx->pfc->info->functions[selector].nr_groups;
  256. return 0;
  257. }
  258. static int sh_pfc_func_set_mux(struct pinctrl_dev *pctldev, unsigned selector,
  259. unsigned group)
  260. {
  261. struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
  262. struct sh_pfc *pfc = pmx->pfc;
  263. const struct sh_pfc_pin_group *grp = &pfc->info->groups[group];
  264. unsigned long flags;
  265. unsigned int i;
  266. int ret = 0;
  267. spin_lock_irqsave(&pfc->lock, flags);
  268. for (i = 0; i < grp->nr_pins; ++i) {
  269. int idx = sh_pfc_get_pin_index(pfc, grp->pins[i]);
  270. struct sh_pfc_pin_config *cfg = &pmx->configs[idx];
  271. if (cfg->type != PINMUX_TYPE_NONE) {
  272. ret = -EBUSY;
  273. goto done;
  274. }
  275. }
  276. for (i = 0; i < grp->nr_pins; ++i) {
  277. ret = sh_pfc_config_mux(pfc, grp->mux[i], PINMUX_TYPE_FUNCTION);
  278. if (ret < 0)
  279. break;
  280. }
  281. done:
  282. spin_unlock_irqrestore(&pfc->lock, flags);
  283. return ret;
  284. }
  285. static int sh_pfc_gpio_request_enable(struct pinctrl_dev *pctldev,
  286. struct pinctrl_gpio_range *range,
  287. unsigned offset)
  288. {
  289. struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
  290. struct sh_pfc *pfc = pmx->pfc;
  291. int idx = sh_pfc_get_pin_index(pfc, offset);
  292. struct sh_pfc_pin_config *cfg = &pmx->configs[idx];
  293. unsigned long flags;
  294. int ret;
  295. spin_lock_irqsave(&pfc->lock, flags);
  296. if (cfg->type != PINMUX_TYPE_NONE) {
  297. dev_err(pfc->dev,
  298. "Pin %u is busy, can't configure it as GPIO.\n",
  299. offset);
  300. ret = -EBUSY;
  301. goto done;
  302. }
  303. if (!pfc->gpio) {
  304. /* If GPIOs are handled externally the pin mux type need to be
  305. * set to GPIO here.
  306. */
  307. const struct sh_pfc_pin *pin = &pfc->info->pins[idx];
  308. ret = sh_pfc_config_mux(pfc, pin->enum_id, PINMUX_TYPE_GPIO);
  309. if (ret < 0)
  310. goto done;
  311. }
  312. cfg->type = PINMUX_TYPE_GPIO;
  313. ret = 0;
  314. done:
  315. spin_unlock_irqrestore(&pfc->lock, flags);
  316. return ret;
  317. }
  318. static void sh_pfc_gpio_disable_free(struct pinctrl_dev *pctldev,
  319. struct pinctrl_gpio_range *range,
  320. unsigned offset)
  321. {
  322. struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
  323. struct sh_pfc *pfc = pmx->pfc;
  324. int idx = sh_pfc_get_pin_index(pfc, offset);
  325. struct sh_pfc_pin_config *cfg = &pmx->configs[idx];
  326. unsigned long flags;
  327. spin_lock_irqsave(&pfc->lock, flags);
  328. cfg->type = PINMUX_TYPE_NONE;
  329. spin_unlock_irqrestore(&pfc->lock, flags);
  330. }
  331. static int sh_pfc_gpio_set_direction(struct pinctrl_dev *pctldev,
  332. struct pinctrl_gpio_range *range,
  333. unsigned offset, bool input)
  334. {
  335. struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
  336. struct sh_pfc *pfc = pmx->pfc;
  337. int new_type = input ? PINMUX_TYPE_INPUT : PINMUX_TYPE_OUTPUT;
  338. int idx = sh_pfc_get_pin_index(pfc, offset);
  339. const struct sh_pfc_pin *pin = &pfc->info->pins[idx];
  340. struct sh_pfc_pin_config *cfg = &pmx->configs[idx];
  341. unsigned long flags;
  342. unsigned int dir;
  343. int ret;
  344. /* Check if the requested direction is supported by the pin. Not all SoC
  345. * provide pin config data, so perform the check conditionally.
  346. */
  347. if (pin->configs) {
  348. dir = input ? SH_PFC_PIN_CFG_INPUT : SH_PFC_PIN_CFG_OUTPUT;
  349. if (!(pin->configs & dir))
  350. return -EINVAL;
  351. }
  352. spin_lock_irqsave(&pfc->lock, flags);
  353. ret = sh_pfc_config_mux(pfc, pin->enum_id, new_type);
  354. if (ret < 0)
  355. goto done;
  356. cfg->type = new_type;
  357. done:
  358. spin_unlock_irqrestore(&pfc->lock, flags);
  359. return ret;
  360. }
  361. static const struct pinmux_ops sh_pfc_pinmux_ops = {
  362. .get_functions_count = sh_pfc_get_functions_count,
  363. .get_function_name = sh_pfc_get_function_name,
  364. .get_function_groups = sh_pfc_get_function_groups,
  365. .set_mux = sh_pfc_func_set_mux,
  366. .gpio_request_enable = sh_pfc_gpio_request_enable,
  367. .gpio_disable_free = sh_pfc_gpio_disable_free,
  368. .gpio_set_direction = sh_pfc_gpio_set_direction,
  369. };
  370. /* Check whether the requested parameter is supported for a pin. */
  371. static bool sh_pfc_pinconf_validate(struct sh_pfc *pfc, unsigned int _pin,
  372. enum pin_config_param param)
  373. {
  374. int idx = sh_pfc_get_pin_index(pfc, _pin);
  375. const struct sh_pfc_pin *pin = &pfc->info->pins[idx];
  376. switch (param) {
  377. case PIN_CONFIG_BIAS_DISABLE:
  378. return true;
  379. case PIN_CONFIG_BIAS_PULL_UP:
  380. return pin->configs & SH_PFC_PIN_CFG_PULL_UP;
  381. case PIN_CONFIG_BIAS_PULL_DOWN:
  382. return pin->configs & SH_PFC_PIN_CFG_PULL_DOWN;
  383. default:
  384. return false;
  385. }
  386. }
  387. static int sh_pfc_pinconf_get(struct pinctrl_dev *pctldev, unsigned _pin,
  388. unsigned long *config)
  389. {
  390. struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
  391. struct sh_pfc *pfc = pmx->pfc;
  392. enum pin_config_param param = pinconf_to_config_param(*config);
  393. unsigned long flags;
  394. unsigned int bias;
  395. if (!sh_pfc_pinconf_validate(pfc, _pin, param))
  396. return -ENOTSUPP;
  397. switch (param) {
  398. case PIN_CONFIG_BIAS_DISABLE:
  399. case PIN_CONFIG_BIAS_PULL_UP:
  400. case PIN_CONFIG_BIAS_PULL_DOWN:
  401. if (!pfc->info->ops || !pfc->info->ops->get_bias)
  402. return -ENOTSUPP;
  403. spin_lock_irqsave(&pfc->lock, flags);
  404. bias = pfc->info->ops->get_bias(pfc, _pin);
  405. spin_unlock_irqrestore(&pfc->lock, flags);
  406. if (bias != param)
  407. return -EINVAL;
  408. *config = 0;
  409. break;
  410. default:
  411. return -ENOTSUPP;
  412. }
  413. return 0;
  414. }
  415. static int sh_pfc_pinconf_set(struct pinctrl_dev *pctldev, unsigned _pin,
  416. unsigned long *configs, unsigned num_configs)
  417. {
  418. struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
  419. struct sh_pfc *pfc = pmx->pfc;
  420. enum pin_config_param param;
  421. unsigned long flags;
  422. unsigned int i;
  423. for (i = 0; i < num_configs; i++) {
  424. param = pinconf_to_config_param(configs[i]);
  425. if (!sh_pfc_pinconf_validate(pfc, _pin, param))
  426. return -ENOTSUPP;
  427. switch (param) {
  428. case PIN_CONFIG_BIAS_PULL_UP:
  429. case PIN_CONFIG_BIAS_PULL_DOWN:
  430. case PIN_CONFIG_BIAS_DISABLE:
  431. if (!pfc->info->ops || !pfc->info->ops->set_bias)
  432. return -ENOTSUPP;
  433. spin_lock_irqsave(&pfc->lock, flags);
  434. pfc->info->ops->set_bias(pfc, _pin, param);
  435. spin_unlock_irqrestore(&pfc->lock, flags);
  436. break;
  437. default:
  438. return -ENOTSUPP;
  439. }
  440. } /* for each config */
  441. return 0;
  442. }
  443. static int sh_pfc_pinconf_group_set(struct pinctrl_dev *pctldev, unsigned group,
  444. unsigned long *configs,
  445. unsigned num_configs)
  446. {
  447. struct sh_pfc_pinctrl *pmx = pinctrl_dev_get_drvdata(pctldev);
  448. const unsigned int *pins;
  449. unsigned int num_pins;
  450. unsigned int i;
  451. pins = pmx->pfc->info->groups[group].pins;
  452. num_pins = pmx->pfc->info->groups[group].nr_pins;
  453. for (i = 0; i < num_pins; ++i)
  454. sh_pfc_pinconf_set(pctldev, pins[i], configs, num_configs);
  455. return 0;
  456. }
  457. static const struct pinconf_ops sh_pfc_pinconf_ops = {
  458. .is_generic = true,
  459. .pin_config_get = sh_pfc_pinconf_get,
  460. .pin_config_set = sh_pfc_pinconf_set,
  461. .pin_config_group_set = sh_pfc_pinconf_group_set,
  462. .pin_config_config_dbg_show = pinconf_generic_dump_config,
  463. };
  464. /* PFC ranges -> pinctrl pin descs */
  465. static int sh_pfc_map_pins(struct sh_pfc *pfc, struct sh_pfc_pinctrl *pmx)
  466. {
  467. unsigned int i;
  468. /* Allocate and initialize the pins and configs arrays. */
  469. pmx->pins = devm_kzalloc(pfc->dev,
  470. sizeof(*pmx->pins) * pfc->info->nr_pins,
  471. GFP_KERNEL);
  472. if (unlikely(!pmx->pins))
  473. return -ENOMEM;
  474. pmx->configs = devm_kzalloc(pfc->dev,
  475. sizeof(*pmx->configs) * pfc->info->nr_pins,
  476. GFP_KERNEL);
  477. if (unlikely(!pmx->configs))
  478. return -ENOMEM;
  479. for (i = 0; i < pfc->info->nr_pins; ++i) {
  480. const struct sh_pfc_pin *info = &pfc->info->pins[i];
  481. struct sh_pfc_pin_config *cfg = &pmx->configs[i];
  482. struct pinctrl_pin_desc *pin = &pmx->pins[i];
  483. /* If the pin number is equal to -1 all pins are considered */
  484. pin->number = info->pin != (u16)-1 ? info->pin : i;
  485. pin->name = info->name;
  486. cfg->type = PINMUX_TYPE_NONE;
  487. }
  488. return 0;
  489. }
  490. int sh_pfc_register_pinctrl(struct sh_pfc *pfc)
  491. {
  492. struct sh_pfc_pinctrl *pmx;
  493. int ret;
  494. pmx = devm_kzalloc(pfc->dev, sizeof(*pmx), GFP_KERNEL);
  495. if (unlikely(!pmx))
  496. return -ENOMEM;
  497. pmx->pfc = pfc;
  498. pfc->pinctrl = pmx;
  499. ret = sh_pfc_map_pins(pfc, pmx);
  500. if (ret < 0)
  501. return ret;
  502. pmx->pctl_desc.name = DRV_NAME;
  503. pmx->pctl_desc.owner = THIS_MODULE;
  504. pmx->pctl_desc.pctlops = &sh_pfc_pinctrl_ops;
  505. pmx->pctl_desc.pmxops = &sh_pfc_pinmux_ops;
  506. pmx->pctl_desc.confops = &sh_pfc_pinconf_ops;
  507. pmx->pctl_desc.pins = pmx->pins;
  508. pmx->pctl_desc.npins = pfc->info->nr_pins;
  509. pmx->pctl = pinctrl_register(&pmx->pctl_desc, pfc->dev, pmx);
  510. if (pmx->pctl == NULL)
  511. return -EINVAL;
  512. return 0;
  513. }
  514. int sh_pfc_unregister_pinctrl(struct sh_pfc *pfc)
  515. {
  516. struct sh_pfc_pinctrl *pmx = pfc->pinctrl;
  517. pinctrl_unregister(pmx->pctl);
  518. pfc->pinctrl = NULL;
  519. return 0;
  520. }