Lines Matching +full:pmic +full:- +full:mpp
1 // SPDX-License-Identifier: GPL-2.0-or-later
20 #include "pinctrl-mvebu.h"
23 #define INT_REGS_MASK ~(SZ_1M - 1)
28 /* MPP Base registers */
32 /* MPP Control 4 register */
68 unsigned long pmu = readl(data->base + PMU_MPP_GENERAL_CTRL); in dove_pmu_mpp_ctrl_get()
86 unsigned long pmu = readl(data->base + PMU_MPP_GENERAL_CTRL); in dove_pmu_mpp_ctrl_set()
90 writel(pmu & ~BIT(pid), data->base + PMU_MPP_GENERAL_CTRL); in dove_pmu_mpp_ctrl_set()
94 writel(pmu | BIT(pid), data->base + PMU_MPP_GENERAL_CTRL); in dove_pmu_mpp_ctrl_set()
126 return -EINVAL; in dove_mpp4_ctrl_get()
157 return -EINVAL; in dove_mpp4_ctrl_set()
192 unsigned long pmu = readl(data->base + PMU_MPP_GENERAL_CTRL); in dove_audio0_ctrl_get()
202 unsigned long pmu = readl(data->base + PMU_MPP_GENERAL_CTRL); in dove_audio0_ctrl_set()
207 writel(pmu, data->base + PMU_MPP_GENERAL_CTRL); in dove_audio0_ctrl_set()
266 /* mpp[52:57] gpio pins depend heavily on current config;
283 return -ENOTSUPP; in dove_audio1_ctrl_gpio_req()
288 return -ENOTSUPP; in dove_audio1_ctrl_gpio_req()
295 return -ENOTSUPP; in dove_audio1_ctrl_gpio_req()
298 /* mpp[52:57] has gpio pins capable of in and out */
303 return -ENOTSUPP; in dove_audio1_ctrl_gpio_dir()
375 MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL),
376 MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL),
377 MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL),
378 MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"),
379 MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL),
380 MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL),
381 MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL),
382 MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL),
383 MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL),
384 MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL),
385 MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL),
386 MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)),
392 MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL),
393 MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL),
394 MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL),
395 MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"),
396 MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL),
397 MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL),
398 MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL),
399 MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL),
400 MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL),
401 MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL),
402 MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL),
403 MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)),
410 MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL),
411 MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL),
412 MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL),
413 MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"),
414 MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL),
415 MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL),
416 MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL),
417 MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL),
418 MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL),
419 MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL),
420 MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL),
421 MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)),
428 MPP_FUNCTION(0x0f, "lcd-spi", "cs1"),
429 MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL),
430 MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL),
431 MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL),
432 MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"),
433 MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL),
434 MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL),
435 MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL),
436 MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL),
437 MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL),
438 MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL),
439 MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL),
440 MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)),
446 MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL),
447 MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL),
448 MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL),
449 MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"),
450 MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL),
451 MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL),
452 MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL),
453 MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL),
454 MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL),
455 MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL),
456 MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL),
457 MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)),
463 MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL),
464 MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL),
465 MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL),
466 MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"),
467 MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL),
468 MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL),
469 MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL),
470 MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL),
471 MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL),
472 MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL),
473 MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL),
474 MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)),
480 MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL),
481 MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL),
482 MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL),
483 MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"),
484 MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL),
485 MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL),
486 MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL),
487 MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL),
488 MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL),
489 MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL),
490 MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL),
491 MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)),
497 MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL),
498 MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL),
499 MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL),
500 MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"),
501 MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL),
502 MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL),
503 MPP_FUNCTION(CONFIG_PMU | 0x8, "core-pwr-good", NULL),
504 MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL),
505 MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL),
506 MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL),
507 MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL),
508 MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)),
512 MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL),
513 MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL),
514 MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL),
515 MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"),
516 MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL),
517 MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL),
518 MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL),
519 MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL),
520 MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL),
521 MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL),
522 MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL),
523 MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)),
527 MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL),
528 MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL),
529 MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL),
530 MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"),
531 MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL),
532 MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL),
533 MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL),
534 MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL),
535 MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL),
536 MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL),
537 MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL),
538 MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)),
542 MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL),
543 MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL),
544 MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL),
545 MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"),
546 MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL),
547 MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL),
548 MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL),
549 MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL),
550 MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL),
551 MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL),
552 MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL),
553 MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)),
557 MPP_FUNCTION(0x02, "sata-1", "act"),
561 MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL),
562 MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL),
563 MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL),
564 MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"),
565 MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL),
566 MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL),
567 MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL),
568 MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL),
569 MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL),
570 MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL),
571 MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL),
572 MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)),
579 MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL),
580 MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL),
581 MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL),
582 MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"),
583 MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL),
584 MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL),
585 MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL),
586 MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL),
587 MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL),
588 MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL),
589 MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL),
590 MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)),
597 MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL),
598 MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL),
599 MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL),
600 MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"),
601 MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL),
602 MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL),
603 MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL),
604 MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL),
605 MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL),
606 MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL),
607 MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL),
608 MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)),
614 MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL),
615 MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL),
616 MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL),
617 MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"),
618 MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL),
619 MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL),
620 MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL),
621 MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL),
622 MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL),
623 MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL),
624 MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL),
625 MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)),
631 MPP_FUNCTION(CONFIG_PMU | 0x0, "pmu-nc", NULL),
632 MPP_FUNCTION(CONFIG_PMU | 0x1, "pmu-low", NULL),
633 MPP_FUNCTION(CONFIG_PMU | 0x2, "pmu-high", NULL),
634 MPP_FUNCTION(CONFIG_PMU | 0x3, "pmic", "sdi"),
635 MPP_FUNCTION(CONFIG_PMU | 0x4, "cpu-pwr-down", NULL),
636 MPP_FUNCTION(CONFIG_PMU | 0x5, "standby-pwr-down", NULL),
637 MPP_FUNCTION(CONFIG_PMU | 0x8, "cpu-pwr-good", NULL),
638 MPP_FUNCTION(CONFIG_PMU | 0xa, "bat-fault", NULL),
639 MPP_FUNCTION(CONFIG_PMU | 0xb, "ext0-wakeup", NULL),
640 MPP_FUNCTION(CONFIG_PMU | 0xc, "ext1-wakeup", NULL),
641 MPP_FUNCTION(CONFIG_PMU | 0xd, "ext2-wakeup", NULL),
642 MPP_FUNCTION(CONFIG_PMU | 0xe, "pmu-blink", NULL)),
647 MPP_FUNCTION(0x04, "lcd-spi", "cs1"),
651 MPP_FUNCTION(0x01, "ac97-1", "sysclko"),
670 MPP_FUNCTION(0x02, "lcd-spi", "miso"),
677 MPP_FUNCTION(0x02, "lcd-spi", "cs0"),
685 MPP_FUNCTION(0x02, "lcd-spi", "mosi"),
692 MPP_FUNCTION(0x02, "lcd-spi", "sck"),
728 MPP_FUNCTION(0x00, "twsi-none", NULL),
729 MPP_FUNCTION(0x01, "twsi-opt1", NULL),
730 MPP_FUNCTION(0x02, "twsi-opt2", NULL),
731 MPP_FUNCTION(0x03, "twsi-opt3", NULL)),
753 { .compatible = "marvell,dove-pinctrl", .data = &dove_pinctrl_info },
772 pdev->dev.platform_data = (void *)device_get_match_data(&pdev->dev); in dove_pinctrl_probe()
775 * General MPP Configuration Register is part of pdma registers. in dove_pinctrl_probe()
778 clk = devm_clk_get(&pdev->dev, NULL); in dove_pinctrl_probe()
780 dev_err(&pdev->dev, "Unable to get pdma clock"); in dove_pinctrl_probe()
791 mpp_data = devm_kcalloc(&pdev->dev, dove_pinctrl_info.ncontrols, in dove_pinctrl_probe()
794 ret = -ENOMEM; in dove_pinctrl_probe()
808 dev_warn(&pdev->dev, "falling back to hardcoded MPP4 resource\n"); in dove_pinctrl_probe()
810 (mpp_res->start & INT_REGS_MASK) + MPP4_REGS_OFFS, 0x4); in dove_pinctrl_probe()
814 mpp4_base = devm_ioremap_resource(&pdev->dev, res); in dove_pinctrl_probe()
822 dev_warn(&pdev->dev, "falling back to hardcoded PMU resource\n"); in dove_pinctrl_probe()
824 (mpp_res->start & INT_REGS_MASK) + PMU_REGS_OFFS, 0x8); in dove_pinctrl_probe()
828 pmu_base = devm_ioremap_resource(&pdev->dev, res); in dove_pinctrl_probe()
834 gconfmap = syscon_regmap_lookup_by_compatible("marvell,dove-global-config"); in dove_pinctrl_probe()
838 dev_warn(&pdev->dev, "falling back to hardcoded global registers\n"); in dove_pinctrl_probe()
840 (mpp_res->start & INT_REGS_MASK) + GC_REGS_OFFS, 0x14); in dove_pinctrl_probe()
841 gc_base = devm_ioremap_resource(&pdev->dev, &fb_res); in dove_pinctrl_probe()
847 gconfmap = devm_regmap_init_mmio(&pdev->dev, in dove_pinctrl_probe()
857 dev_warn(&pdev->dev, FW_BUG "Missing pinctrl regs in DTB. Please update your firmware.\n"); in dove_pinctrl_probe()
867 .name = "dove-pinctrl",