diff options
Diffstat (limited to 'drivers/mfd/ab8500-debugfs.c')
-rw-r--r-- | drivers/mfd/ab8500-debugfs.c | 383 |
1 files changed, 372 insertions, 11 deletions
diff --git a/drivers/mfd/ab8500-debugfs.c b/drivers/mfd/ab8500-debugfs.c index 969e43db8485..074eea9e4bfd 100644 --- a/drivers/mfd/ab8500-debugfs.c +++ b/drivers/mfd/ab8500-debugfs.c | |||
@@ -156,7 +156,9 @@ static struct hwreg_cfg hwreg_cfg = { | |||
156 | 156 | ||
157 | #define AB8500_REV_REG 0x80 | 157 | #define AB8500_REV_REG 0x80 |
158 | 158 | ||
159 | static struct ab8500_prcmu_ranges debug_ranges[AB8500_NUM_BANKS] = { | 159 | static struct ab8500_prcmu_ranges *debug_ranges; |
160 | |||
161 | struct ab8500_prcmu_ranges ab8500_debug_ranges[AB8500_NUM_BANKS] = { | ||
160 | [0x0] = { | 162 | [0x0] = { |
161 | .num_ranges = 0, | 163 | .num_ranges = 0, |
162 | .range = NULL, | 164 | .range = NULL, |
@@ -360,7 +362,7 @@ static struct ab8500_prcmu_ranges debug_ranges[AB8500_NUM_BANKS] = { | |||
360 | }, | 362 | }, |
361 | { | 363 | { |
362 | .first = 0xf5, | 364 | .first = 0xf5, |
363 | .last = 0xf6, | 365 | .last = 0xf6, |
364 | }, | 366 | }, |
365 | }, | 367 | }, |
366 | }, | 368 | }, |
@@ -485,6 +487,365 @@ static struct ab8500_prcmu_ranges debug_ranges[AB8500_NUM_BANKS] = { | |||
485 | }, | 487 | }, |
486 | }; | 488 | }; |
487 | 489 | ||
490 | struct ab8500_prcmu_ranges ab8505_debug_ranges[AB8500_NUM_BANKS] = { | ||
491 | [0x0] = { | ||
492 | .num_ranges = 0, | ||
493 | .range = NULL, | ||
494 | }, | ||
495 | [AB8500_SYS_CTRL1_BLOCK] = { | ||
496 | .num_ranges = 5, | ||
497 | .range = (struct ab8500_reg_range[]) { | ||
498 | { | ||
499 | .first = 0x00, | ||
500 | .last = 0x04, | ||
501 | }, | ||
502 | { | ||
503 | .first = 0x42, | ||
504 | .last = 0x42, | ||
505 | }, | ||
506 | { | ||
507 | .first = 0x52, | ||
508 | .last = 0x52, | ||
509 | }, | ||
510 | { | ||
511 | .first = 0x54, | ||
512 | .last = 0x57, | ||
513 | }, | ||
514 | { | ||
515 | .first = 0x80, | ||
516 | .last = 0x83, | ||
517 | }, | ||
518 | }, | ||
519 | }, | ||
520 | [AB8500_SYS_CTRL2_BLOCK] = { | ||
521 | .num_ranges = 5, | ||
522 | .range = (struct ab8500_reg_range[]) { | ||
523 | { | ||
524 | .first = 0x00, | ||
525 | .last = 0x0D, | ||
526 | }, | ||
527 | { | ||
528 | .first = 0x0F, | ||
529 | .last = 0x17, | ||
530 | }, | ||
531 | { | ||
532 | .first = 0x20, | ||
533 | .last = 0x20, | ||
534 | }, | ||
535 | { | ||
536 | .first = 0x30, | ||
537 | .last = 0x30, | ||
538 | }, | ||
539 | { | ||
540 | .first = 0x32, | ||
541 | .last = 0x3A, | ||
542 | }, | ||
543 | }, | ||
544 | }, | ||
545 | [AB8500_REGU_CTRL1] = { | ||
546 | .num_ranges = 3, | ||
547 | .range = (struct ab8500_reg_range[]) { | ||
548 | { | ||
549 | .first = 0x00, | ||
550 | .last = 0x00, | ||
551 | }, | ||
552 | { | ||
553 | .first = 0x03, | ||
554 | .last = 0x11, | ||
555 | }, | ||
556 | { | ||
557 | .first = 0x80, | ||
558 | .last = 0x86, | ||
559 | }, | ||
560 | }, | ||
561 | }, | ||
562 | [AB8500_REGU_CTRL2] = { | ||
563 | .num_ranges = 6, | ||
564 | .range = (struct ab8500_reg_range[]) { | ||
565 | { | ||
566 | .first = 0x00, | ||
567 | .last = 0x06, | ||
568 | }, | ||
569 | { | ||
570 | .first = 0x08, | ||
571 | .last = 0x15, | ||
572 | }, | ||
573 | { | ||
574 | .first = 0x17, | ||
575 | .last = 0x19, | ||
576 | }, | ||
577 | { | ||
578 | .first = 0x1B, | ||
579 | .last = 0x1D, | ||
580 | }, | ||
581 | { | ||
582 | .first = 0x1F, | ||
583 | .last = 0x30, | ||
584 | }, | ||
585 | { | ||
586 | .first = 0x40, | ||
587 | .last = 0x48, | ||
588 | }, | ||
589 | /* 0x80-0x8B is SIM registers and should | ||
590 | * not be accessed from here */ | ||
591 | }, | ||
592 | }, | ||
593 | [AB8500_USB] = { | ||
594 | .num_ranges = 3, | ||
595 | .range = (struct ab8500_reg_range[]) { | ||
596 | { | ||
597 | .first = 0x80, | ||
598 | .last = 0x83, | ||
599 | }, | ||
600 | { | ||
601 | .first = 0x87, | ||
602 | .last = 0x8A, | ||
603 | }, | ||
604 | { | ||
605 | .first = 0x91, | ||
606 | .last = 0x94, | ||
607 | }, | ||
608 | }, | ||
609 | }, | ||
610 | [AB8500_TVOUT] = { | ||
611 | .num_ranges = 0, | ||
612 | .range = NULL, | ||
613 | }, | ||
614 | [AB8500_DBI] = { | ||
615 | .num_ranges = 0, | ||
616 | .range = NULL, | ||
617 | }, | ||
618 | [AB8500_ECI_AV_ACC] = { | ||
619 | .num_ranges = 1, | ||
620 | .range = (struct ab8500_reg_range[]) { | ||
621 | { | ||
622 | .first = 0x80, | ||
623 | .last = 0x82, | ||
624 | }, | ||
625 | }, | ||
626 | }, | ||
627 | [AB8500_RESERVED] = { | ||
628 | .num_ranges = 0, | ||
629 | .range = NULL, | ||
630 | }, | ||
631 | [AB8500_GPADC] = { | ||
632 | .num_ranges = 1, | ||
633 | .range = (struct ab8500_reg_range[]) { | ||
634 | { | ||
635 | .first = 0x00, | ||
636 | .last = 0x08, | ||
637 | }, | ||
638 | }, | ||
639 | }, | ||
640 | [AB8500_CHARGER] = { | ||
641 | .num_ranges = 9, | ||
642 | .range = (struct ab8500_reg_range[]) { | ||
643 | { | ||
644 | .first = 0x02, | ||
645 | .last = 0x03, | ||
646 | }, | ||
647 | { | ||
648 | .first = 0x05, | ||
649 | .last = 0x05, | ||
650 | }, | ||
651 | { | ||
652 | .first = 0x40, | ||
653 | .last = 0x44, | ||
654 | }, | ||
655 | { | ||
656 | .first = 0x50, | ||
657 | .last = 0x57, | ||
658 | }, | ||
659 | { | ||
660 | .first = 0x60, | ||
661 | .last = 0x60, | ||
662 | }, | ||
663 | { | ||
664 | .first = 0xA0, | ||
665 | .last = 0xA7, | ||
666 | }, | ||
667 | { | ||
668 | .first = 0xAF, | ||
669 | .last = 0xB2, | ||
670 | }, | ||
671 | { | ||
672 | .first = 0xC0, | ||
673 | .last = 0xC2, | ||
674 | }, | ||
675 | { | ||
676 | .first = 0xF5, | ||
677 | .last = 0xF5, | ||
678 | }, | ||
679 | }, | ||
680 | }, | ||
681 | [AB8500_GAS_GAUGE] = { | ||
682 | .num_ranges = 3, | ||
683 | .range = (struct ab8500_reg_range[]) { | ||
684 | { | ||
685 | .first = 0x00, | ||
686 | .last = 0x00, | ||
687 | }, | ||
688 | { | ||
689 | .first = 0x07, | ||
690 | .last = 0x0A, | ||
691 | }, | ||
692 | { | ||
693 | .first = 0x10, | ||
694 | .last = 0x14, | ||
695 | }, | ||
696 | }, | ||
697 | }, | ||
698 | [AB8500_AUDIO] = { | ||
699 | .num_ranges = 1, | ||
700 | .range = (struct ab8500_reg_range[]) { | ||
701 | { | ||
702 | .first = 0x00, | ||
703 | .last = 0x83, | ||
704 | }, | ||
705 | }, | ||
706 | }, | ||
707 | [AB8500_INTERRUPT] = { | ||
708 | .num_ranges = 11, | ||
709 | .range = (struct ab8500_reg_range[]) { | ||
710 | { | ||
711 | .first = 0x00, | ||
712 | .last = 0x04, | ||
713 | }, | ||
714 | { | ||
715 | .first = 0x06, | ||
716 | .last = 0x07, | ||
717 | }, | ||
718 | { | ||
719 | .first = 0x09, | ||
720 | .last = 0x09, | ||
721 | }, | ||
722 | { | ||
723 | .first = 0x0B, | ||
724 | .last = 0x0C, | ||
725 | }, | ||
726 | { | ||
727 | .first = 0x12, | ||
728 | .last = 0x15, | ||
729 | }, | ||
730 | { | ||
731 | .first = 0x18, | ||
732 | .last = 0x18, | ||
733 | }, | ||
734 | /* Latch registers should not be read here */ | ||
735 | { | ||
736 | .first = 0x40, | ||
737 | .last = 0x44, | ||
738 | }, | ||
739 | { | ||
740 | .first = 0x46, | ||
741 | .last = 0x49, | ||
742 | }, | ||
743 | { | ||
744 | .first = 0x4B, | ||
745 | .last = 0x4D, | ||
746 | }, | ||
747 | { | ||
748 | .first = 0x52, | ||
749 | .last = 0x55, | ||
750 | }, | ||
751 | { | ||
752 | .first = 0x58, | ||
753 | .last = 0x58, | ||
754 | }, | ||
755 | /* LatchHier registers should not be read here */ | ||
756 | }, | ||
757 | }, | ||
758 | [AB8500_RTC] = { | ||
759 | .num_ranges = 2, | ||
760 | .range = (struct ab8500_reg_range[]) { | ||
761 | { | ||
762 | .first = 0x00, | ||
763 | .last = 0x14, | ||
764 | }, | ||
765 | { | ||
766 | .first = 0x16, | ||
767 | .last = 0x17, | ||
768 | }, | ||
769 | }, | ||
770 | }, | ||
771 | [AB8500_MISC] = { | ||
772 | .num_ranges = 8, | ||
773 | .range = (struct ab8500_reg_range[]) { | ||
774 | { | ||
775 | .first = 0x00, | ||
776 | .last = 0x06, | ||
777 | }, | ||
778 | { | ||
779 | .first = 0x10, | ||
780 | .last = 0x16, | ||
781 | }, | ||
782 | { | ||
783 | .first = 0x20, | ||
784 | .last = 0x26, | ||
785 | }, | ||
786 | { | ||
787 | .first = 0x30, | ||
788 | .last = 0x36, | ||
789 | }, | ||
790 | { | ||
791 | .first = 0x40, | ||
792 | .last = 0x46, | ||
793 | }, | ||
794 | { | ||
795 | .first = 0x50, | ||
796 | .last = 0x50, | ||
797 | }, | ||
798 | { | ||
799 | .first = 0x60, | ||
800 | .last = 0x6B, | ||
801 | }, | ||
802 | { | ||
803 | .first = 0x80, | ||
804 | .last = 0x82, | ||
805 | }, | ||
806 | }, | ||
807 | }, | ||
808 | [AB8500_DEVELOPMENT] = { | ||
809 | .num_ranges = 2, | ||
810 | .range = (struct ab8500_reg_range[]) { | ||
811 | { | ||
812 | .first = 0x00, | ||
813 | .last = 0x00, | ||
814 | }, | ||
815 | { | ||
816 | .first = 0x05, | ||
817 | .last = 0x05, | ||
818 | }, | ||
819 | }, | ||
820 | }, | ||
821 | [AB8500_DEBUG] = { | ||
822 | .num_ranges = 1, | ||
823 | .range = (struct ab8500_reg_range[]) { | ||
824 | { | ||
825 | .first = 0x05, | ||
826 | .last = 0x07, | ||
827 | }, | ||
828 | }, | ||
829 | }, | ||
830 | [AB8500_PROD_TEST] = { | ||
831 | .num_ranges = 0, | ||
832 | .range = NULL, | ||
833 | }, | ||
834 | [AB8500_STE_TEST] = { | ||
835 | .num_ranges = 0, | ||
836 | .range = NULL, | ||
837 | }, | ||
838 | [AB8500_OTP_EMUL] = { | ||
839 | .num_ranges = 1, | ||
840 | .range = (struct ab8500_reg_range[]) { | ||
841 | { | ||
842 | .first = 0x01, | ||
843 | .last = 0x15, | ||
844 | }, | ||
845 | }, | ||
846 | }, | ||
847 | }; | ||
848 | |||
488 | static irqreturn_t ab8500_debug_handler(int irq, void *data) | 849 | static irqreturn_t ab8500_debug_handler(int irq, void *data) |
489 | { | 850 | { |
490 | char buf[16]; | 851 | char buf[16]; |
@@ -529,9 +890,6 @@ static int ab8500_registers_print(struct device *dev, u32 bank, | |||
529 | err = seq_printf(s, " [0x%02X/0x%02X]: 0x%02X\n", | 890 | err = seq_printf(s, " [0x%02X/0x%02X]: 0x%02X\n", |
530 | bank, reg, value); | 891 | bank, reg, value); |
531 | if (err < 0) { | 892 | if (err < 0) { |
532 | dev_err(dev, | ||
533 | "seq_printf overflow bank=0x%02X reg=0x%02X\n", | ||
534 | bank, reg); | ||
535 | /* Error is not returned here since | 893 | /* Error is not returned here since |
536 | * the output is wanted in any case */ | 894 | * the output is wanted in any case */ |
537 | return 0; | 895 | return 0; |
@@ -581,8 +939,6 @@ static int ab8500_print_all_banks(struct seq_file *s, void *p) | |||
581 | 939 | ||
582 | for (i = 1; i < AB8500_NUM_BANKS; i++) { | 940 | for (i = 1; i < AB8500_NUM_BANKS; i++) { |
583 | err = seq_printf(s, " bank 0x%02X:\n", i); | 941 | err = seq_printf(s, " bank 0x%02X:\n", i); |
584 | if (err < 0) | ||
585 | dev_err(dev, "seq_printf overflow, bank=0x%02X\n", i); | ||
586 | 942 | ||
587 | ab8500_registers_print(dev, i, s); | 943 | ab8500_registers_print(dev, i, s); |
588 | } | 944 | } |
@@ -1937,14 +2293,19 @@ static int ab8500_debug_probe(struct platform_device *plf) | |||
1937 | if (!file) | 2293 | if (!file) |
1938 | goto err; | 2294 | goto err; |
1939 | 2295 | ||
1940 | if (is_ab8500(ab8500)) | 2296 | if (is_ab8500(ab8500)) { |
2297 | debug_ranges = ab8500_debug_ranges; | ||
1941 | num_interrupt_lines = AB8500_NR_IRQS; | 2298 | num_interrupt_lines = AB8500_NR_IRQS; |
1942 | else if (is_ab8505(ab8500)) | 2299 | } else if (is_ab8505(ab8500)) { |
2300 | debug_ranges = ab8505_debug_ranges; | ||
1943 | num_interrupt_lines = AB8505_NR_IRQS; | 2301 | num_interrupt_lines = AB8505_NR_IRQS; |
1944 | else if (is_ab9540(ab8500)) | 2302 | } else if (is_ab9540(ab8500)) { |
2303 | debug_ranges = ab8505_debug_ranges; | ||
1945 | num_interrupt_lines = AB9540_NR_IRQS; | 2304 | num_interrupt_lines = AB9540_NR_IRQS; |
1946 | else if (is_ab8540(ab8500)) | 2305 | } else if (is_ab8540(ab8500)) { |
2306 | debug_ranges = ab8505_debug_ranges; | ||
1947 | num_interrupt_lines = AB8540_NR_IRQS; | 2307 | num_interrupt_lines = AB8540_NR_IRQS; |
2308 | } | ||
1948 | 2309 | ||
1949 | file = debugfs_create_file("interrupts", (S_IRUGO), | 2310 | file = debugfs_create_file("interrupts", (S_IRUGO), |
1950 | ab8500_dir, &plf->dev, &ab8500_interrupts_fops); | 2311 | ab8500_dir, &plf->dev, &ab8500_interrupts_fops); |