aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorArnd Bergmann <arnd@arndb.de>2018-10-04 11:16:47 -0400
committerArnd Bergmann <arnd@arndb.de>2018-10-04 11:21:44 -0400
commite51e8d5de999cafec922bdd11235812161e12a69 (patch)
tree009ce57a0999946c6de36e563d9523ebd553e23a
parent9620135fe10a07e0c96d9593e09215954ce81520 (diff)
parentf5e80203dadc28176f7b5ad2ec00652dd524fb9a (diff)
Merge tag 'omap-for-v4.20/ti-sysc-take2-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap into next/drivers
TI sysc driver changes for v4.20 merge window This series gets rid of the SYSC_QUIRK_RESOURCE_PROVIDER to make device detection happen mostly only if #define DEBUG is set. Few core devices still need to be detected to set legacy quirks. We also add support for booting am335x, am437x and dra7 SoCs with L4 devices defined in device tree instead of legacy platform data. And finally we simplify suspend with just SET_NOIRQ_SYSTEM_SLEEP_PM_OPS and dropping the custom functions that were attempting to work around issues that really turned out to be child device driver related issues. Apologies for a late pull request, debugging the suspend issues took a while and I did not want to send these changes until that got sorted out. * tag 'omap-for-v4.20/ti-sysc-take2-signed' of git://git.kernel.org/pub/scm/linux/kernel/git/tmlind/linux-omap: bus: ti-sysc: Just use SET_NOIRQ_SYSTEM_SLEEP_PM_OPS bus: ti-sysc: Make some warnings debug only bus: ti-sysc: Detect devices for debug on dra7 bus: ti-sysc: Detect timer and gpio on dra7 bus: ti-sysc: Detect devices on am335x when DEBUG is enabled bus: ti-sysc: Detect more devices on am473x for debugging bus: ti-sysc: Update revision masks to support am437x bus: ti-sysc: Defer suspend as needed Signed-off-by: Arnd Bergmann <arnd@arndb.de>
-rw-r--r--drivers/bus/ti-sysc.c171
-rw-r--r--include/linux/platform_data/ti-sysc.h1
2 files changed, 48 insertions, 124 deletions
diff --git a/drivers/bus/ti-sysc.c b/drivers/bus/ti-sysc.c
index e4fe954e63a9..a3a2d39280d9 100644
--- a/drivers/bus/ti-sysc.c
+++ b/drivers/bus/ti-sysc.c
@@ -701,69 +701,7 @@ awake:
701 return error; 701 return error;
702} 702}
703 703
704#ifdef CONFIG_PM_SLEEP 704static int __maybe_unused sysc_noirq_suspend(struct device *dev)
705static int sysc_suspend(struct device *dev)
706{
707 struct sysc *ddata;
708 int error;
709
710 ddata = dev_get_drvdata(dev);
711
712 if (ddata->cfg.quirks & (SYSC_QUIRK_RESOURCE_PROVIDER |
713 SYSC_QUIRK_LEGACY_IDLE))
714 return 0;
715
716 if (!ddata->enabled)
717 return 0;
718
719 dev_dbg(ddata->dev, "%s %s\n", __func__,
720 ddata->name ? ddata->name : "");
721
722 error = pm_runtime_put_sync_suspend(dev);
723 if (error < 0) {
724 dev_warn(ddata->dev, "%s not idle %i %s\n",
725 __func__, error,
726 ddata->name ? ddata->name : "");
727
728 return 0;
729 }
730
731 ddata->needs_resume = true;
732
733 return 0;
734}
735
736static int sysc_resume(struct device *dev)
737{
738 struct sysc *ddata;
739 int error;
740
741 ddata = dev_get_drvdata(dev);
742
743 if (ddata->cfg.quirks & (SYSC_QUIRK_RESOURCE_PROVIDER |
744 SYSC_QUIRK_LEGACY_IDLE))
745 return 0;
746
747 if (ddata->needs_resume) {
748 dev_dbg(ddata->dev, "%s %s\n", __func__,
749 ddata->name ? ddata->name : "");
750
751 error = pm_runtime_get_sync(dev);
752 if (error < 0) {
753 dev_err(ddata->dev, "%s error %i %s\n",
754 __func__, error,
755 ddata->name ? ddata->name : "");
756
757 return error;
758 }
759
760 ddata->needs_resume = false;
761 }
762
763 return 0;
764}
765
766static int sysc_noirq_suspend(struct device *dev)
767{ 705{
768 struct sysc *ddata; 706 struct sysc *ddata;
769 707
@@ -772,21 +710,10 @@ static int sysc_noirq_suspend(struct device *dev)
772 if (ddata->cfg.quirks & SYSC_QUIRK_LEGACY_IDLE) 710 if (ddata->cfg.quirks & SYSC_QUIRK_LEGACY_IDLE)
773 return 0; 711 return 0;
774 712
775 if (!(ddata->cfg.quirks & SYSC_QUIRK_RESOURCE_PROVIDER)) 713 return pm_runtime_force_suspend(dev);
776 return 0;
777
778 if (!ddata->enabled)
779 return 0;
780
781 dev_dbg(ddata->dev, "%s %s\n", __func__,
782 ddata->name ? ddata->name : "");
783
784 ddata->needs_resume = true;
785
786 return sysc_runtime_suspend(dev);
787} 714}
788 715
789static int sysc_noirq_resume(struct device *dev) 716static int __maybe_unused sysc_noirq_resume(struct device *dev)
790{ 717{
791 struct sysc *ddata; 718 struct sysc *ddata;
792 719
@@ -795,24 +722,10 @@ static int sysc_noirq_resume(struct device *dev)
795 if (ddata->cfg.quirks & SYSC_QUIRK_LEGACY_IDLE) 722 if (ddata->cfg.quirks & SYSC_QUIRK_LEGACY_IDLE)
796 return 0; 723 return 0;
797 724
798 if (!(ddata->cfg.quirks & SYSC_QUIRK_RESOURCE_PROVIDER)) 725 return pm_runtime_force_resume(dev);
799 return 0;
800
801 if (ddata->needs_resume) {
802 dev_dbg(ddata->dev, "%s %s\n", __func__,
803 ddata->name ? ddata->name : "");
804
805 ddata->needs_resume = false;
806
807 return sysc_runtime_resume(dev);
808 }
809
810 return 0;
811} 726}
812#endif
813 727
814static const struct dev_pm_ops sysc_pm_ops = { 728static const struct dev_pm_ops sysc_pm_ops = {
815 SET_SYSTEM_SLEEP_PM_OPS(sysc_suspend, sysc_resume)
816 SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(sysc_noirq_suspend, sysc_noirq_resume) 729 SET_NOIRQ_SYSTEM_SLEEP_PM_OPS(sysc_noirq_suspend, sysc_noirq_resume)
817 SET_RUNTIME_PM_OPS(sysc_runtime_suspend, 730 SET_RUNTIME_PM_OPS(sysc_runtime_suspend,
818 sysc_runtime_resume, 731 sysc_runtime_resume,
@@ -845,28 +758,8 @@ struct sysc_revision_quirk {
845 } 758 }
846 759
847static const struct sysc_revision_quirk sysc_revision_quirks[] = { 760static const struct sysc_revision_quirk sysc_revision_quirks[] = {
848 /* These need to use noirq_suspend */
849 SYSC_QUIRK("control", 0, 0, 0x10, -1, 0x40000900, 0xffffffff,
850 SYSC_QUIRK_RESOURCE_PROVIDER),
851 SYSC_QUIRK("i2c", 0, 0, 0x10, 0x90, 0x5040000a, 0xffffffff,
852 SYSC_QUIRK_RESOURCE_PROVIDER),
853 SYSC_QUIRK("mcspi", 0, 0, 0x10, -1, 0x40300a0b, 0xffffffff,
854 SYSC_QUIRK_RESOURCE_PROVIDER),
855 SYSC_QUIRK("prcm", 0, 0, -1, -1, 0x40000100, 0xffffffff,
856 SYSC_QUIRK_RESOURCE_PROVIDER),
857 SYSC_QUIRK("ocp2scp", 0, 0, 0x10, 0x14, 0x50060005, 0xffffffff,
858 SYSC_QUIRK_RESOURCE_PROVIDER),
859 SYSC_QUIRK("padconf", 0, 0, 0x10, -1, 0x4fff0800, 0xffffffff,
860 SYSC_QUIRK_RESOURCE_PROVIDER),
861 SYSC_QUIRK("scm", 0, 0, 0x10, -1, 0x40000900, 0xffffffff,
862 SYSC_QUIRK_RESOURCE_PROVIDER),
863 SYSC_QUIRK("scrm", 0, 0, -1, -1, 0x00000010, 0xffffffff,
864 SYSC_QUIRK_RESOURCE_PROVIDER),
865 SYSC_QUIRK("sdma", 0, 0, 0x2c, 0x28, 0x00010900, 0xffffffff,
866 SYSC_QUIRK_RESOURCE_PROVIDER),
867
868 /* These drivers need to be fixed to not use pm_runtime_irq_safe() */ 761 /* These drivers need to be fixed to not use pm_runtime_irq_safe() */
869 SYSC_QUIRK("gpio", 0, 0, 0x10, 0x114, 0x50600801, 0xffffffff, 762 SYSC_QUIRK("gpio", 0, 0, 0x10, 0x114, 0x50600801, 0xffff00ff,
870 SYSC_QUIRK_LEGACY_IDLE | SYSC_QUIRK_OPT_CLKS_IN_RESET), 763 SYSC_QUIRK_LEGACY_IDLE | SYSC_QUIRK_OPT_CLKS_IN_RESET),
871 SYSC_QUIRK("mmu", 0, 0, 0x10, 0x14, 0x00000020, 0xffffffff, 764 SYSC_QUIRK("mmu", 0, 0, 0x10, 0x14, 0x00000020, 0xffffffff,
872 SYSC_QUIRK_LEGACY_IDLE), 765 SYSC_QUIRK_LEGACY_IDLE),
@@ -881,38 +774,70 @@ static const struct sysc_revision_quirk sysc_revision_quirks[] = {
881 SYSC_QUIRK("timer", 0, 0, 0x10, 0x14, 0x00000015, 0xffffffff, 774 SYSC_QUIRK("timer", 0, 0, 0x10, 0x14, 0x00000015, 0xffffffff,
882 SYSC_QUIRK_LEGACY_IDLE), 775 SYSC_QUIRK_LEGACY_IDLE),
883 /* Some timers on omap4 and later */ 776 /* Some timers on omap4 and later */
884 SYSC_QUIRK("timer", 0, 0, 0x10, -1, 0x4fff1301, 0xffffffff, 777 SYSC_QUIRK("timer", 0, 0, 0x10, -1, 0x50002100, 0xffffffff,
778 SYSC_QUIRK_LEGACY_IDLE),
779 SYSC_QUIRK("timer", 0, 0, 0x10, -1, 0x4fff1301, 0xffff00ff,
885 SYSC_QUIRK_LEGACY_IDLE), 780 SYSC_QUIRK_LEGACY_IDLE),
886 SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x00000052, 0xffffffff, 781 SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x00000052, 0xffffffff,
887 SYSC_QUIRK_LEGACY_IDLE), 782 SYSC_QUIRK_LEGACY_IDLE),
888 /* Uarts on omap4 and later */ 783 /* Uarts on omap4 and later */
889 SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x50411e03, 0xffffffff, 784 SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x50411e03, 0xffff00ff,
890 SYSC_QUIRK_LEGACY_IDLE), 785 SYSC_QUIRK_LEGACY_IDLE),
891 786 SYSC_QUIRK("uart", 0, 0x50, 0x54, 0x58, 0x47422e03, 0xffffffff,
892 /* These devices don't yet suspend properly without legacy setting */
893 SYSC_QUIRK("sdio", 0, 0, 0x10, -1, 0x40202301, 0xffffffff,
894 SYSC_QUIRK_LEGACY_IDLE),
895 SYSC_QUIRK("wdt", 0, 0, 0x10, 0x14, 0x502a0500, 0xffffffff,
896 SYSC_QUIRK_LEGACY_IDLE),
897 SYSC_QUIRK("wdt", 0, 0, 0x10, 0x14, 0x502a0d00, 0xffffffff,
898 SYSC_QUIRK_LEGACY_IDLE), 787 SYSC_QUIRK_LEGACY_IDLE),
899 788
900#ifdef DEBUG 789#ifdef DEBUG
790 SYSC_QUIRK("adc", 0, 0, 0x10, -1, 0x47300001, 0xffffffff, 0),
791 SYSC_QUIRK("atl", 0, 0, -1, -1, 0x0a070100, 0xffffffff, 0),
901 SYSC_QUIRK("aess", 0, 0, 0x10, -1, 0x40000000, 0xffffffff, 0), 792 SYSC_QUIRK("aess", 0, 0, 0x10, -1, 0x40000000, 0xffffffff, 0),
793 SYSC_QUIRK("cm", 0, 0, -1, -1, 0x40000301, 0xffffffff, 0),
794 SYSC_QUIRK("control", 0, 0, 0x10, -1, 0x40000900, 0xffffffff, 0),
795 SYSC_QUIRK("cpgmac", 0, 0x1200, 0x1208, 0x1204, 0x4edb1902,
796 0xffff00f0, 0),
797 SYSC_QUIRK("dcan", 0, 0, -1, -1, 0xffffffff, 0xffffffff, 0),
798 SYSC_QUIRK("dcan", 0, 0, -1, -1, 0x00001401, 0xffffffff, 0),
799 SYSC_QUIRK("dwc3", 0, 0, 0x10, -1, 0x500a0200, 0xffffffff, 0),
800 SYSC_QUIRK("epwmss", 0, 0, 0x4, -1, 0x47400001, 0xffffffff, 0),
902 SYSC_QUIRK("gpu", 0, 0x1fc00, 0x1fc10, -1, 0, 0, 0), 801 SYSC_QUIRK("gpu", 0, 0x1fc00, 0x1fc10, -1, 0, 0, 0),
903 SYSC_QUIRK("hdq1w", 0, 0, 0x14, 0x18, 0x00000006, 0xffffffff, 0), 802 SYSC_QUIRK("hdq1w", 0, 0, 0x14, 0x18, 0x00000006, 0xffffffff, 0),
803 SYSC_QUIRK("hdq1w", 0, 0, 0x14, 0x18, 0x0000000a, 0xffffffff, 0),
904 SYSC_QUIRK("hsi", 0, 0, 0x10, 0x14, 0x50043101, 0xffffffff, 0), 804 SYSC_QUIRK("hsi", 0, 0, 0x10, 0x14, 0x50043101, 0xffffffff, 0),
905 SYSC_QUIRK("iss", 0, 0, 0x10, -1, 0x40000101, 0xffffffff, 0), 805 SYSC_QUIRK("iss", 0, 0, 0x10, -1, 0x40000101, 0xffffffff, 0),
806 SYSC_QUIRK("i2c", 0, 0, 0x10, 0x90, 0x5040000a, 0xfffff0f0, 0),
807 SYSC_QUIRK("lcdc", 0, 0, 0x54, -1, 0x4f201000, 0xffffffff, 0),
906 SYSC_QUIRK("mcasp", 0, 0, 0x4, -1, 0x44306302, 0xffffffff, 0), 808 SYSC_QUIRK("mcasp", 0, 0, 0x4, -1, 0x44306302, 0xffffffff, 0),
809 SYSC_QUIRK("mcasp", 0, 0, 0x4, -1, 0x44307b02, 0xffffffff, 0),
907 SYSC_QUIRK("mcbsp", 0, -1, 0x8c, -1, 0, 0, 0), 810 SYSC_QUIRK("mcbsp", 0, -1, 0x8c, -1, 0, 0, 0),
811 SYSC_QUIRK("mcspi", 0, 0, 0x10, -1, 0x40300a0b, 0xffff00ff, 0),
812 SYSC_QUIRK("mcspi", 0, 0, 0x110, 0x114, 0x40300a0b, 0xffffffff, 0),
908 SYSC_QUIRK("mailbox", 0, 0, 0x10, -1, 0x00000400, 0xffffffff, 0), 813 SYSC_QUIRK("mailbox", 0, 0, 0x10, -1, 0x00000400, 0xffffffff, 0),
814 SYSC_QUIRK("m3", 0, 0, -1, -1, 0x5f580105, 0x0fff0f00, 0),
815 SYSC_QUIRK("ocp2scp", 0, 0, 0x10, 0x14, 0x50060005, 0xfffffff0, 0),
816 SYSC_QUIRK("ocp2scp", 0, 0, -1, -1, 0x50060007, 0xffffffff, 0),
817 SYSC_QUIRK("padconf", 0, 0, 0x10, -1, 0x4fff0800, 0xffffffff, 0),
818 SYSC_QUIRK("prcm", 0, 0, -1, -1, 0x40000100, 0xffffffff, 0),
819 SYSC_QUIRK("prcm", 0, 0, -1, -1, 0x00004102, 0xffffffff, 0),
820 SYSC_QUIRK("prcm", 0, 0, -1, -1, 0x40000400, 0xffffffff, 0),
821 SYSC_QUIRK("scm", 0, 0, 0x10, -1, 0x40000900, 0xffffffff, 0),
822 SYSC_QUIRK("scm", 0, 0, -1, -1, 0x4e8b0100, 0xffffffff, 0),
823 SYSC_QUIRK("scm", 0, 0, -1, -1, 0x4f000100, 0xffffffff, 0),
824 SYSC_QUIRK("scm", 0, 0, -1, -1, 0x40000900, 0xffffffff, 0),
825 SYSC_QUIRK("scrm", 0, 0, -1, -1, 0x00000010, 0xffffffff, 0),
826 SYSC_QUIRK("sdio", 0, 0, 0x10, -1, 0x40202301, 0xffff0ff0, 0),
827 SYSC_QUIRK("sdio", 0, 0x2fc, 0x110, 0x114, 0x31010000, 0xffffffff, 0),
828 SYSC_QUIRK("sdma", 0, 0, 0x2c, 0x28, 0x00010900, 0xffffffff, 0),
909 SYSC_QUIRK("slimbus", 0, 0, 0x10, -1, 0x40000902, 0xffffffff, 0), 829 SYSC_QUIRK("slimbus", 0, 0, 0x10, -1, 0x40000902, 0xffffffff, 0),
910 SYSC_QUIRK("slimbus", 0, 0, 0x10, -1, 0x40002903, 0xffffffff, 0), 830 SYSC_QUIRK("slimbus", 0, 0, 0x10, -1, 0x40002903, 0xffffffff, 0),
911 SYSC_QUIRK("spinlock", 0, 0, 0x10, -1, 0x50020000, 0xffffffff, 0), 831 SYSC_QUIRK("spinlock", 0, 0, 0x10, -1, 0x50020000, 0xffffffff, 0),
832 SYSC_QUIRK("rng", 0, 0x1fe0, 0x1fe4, -1, 0x00000020, 0xffffffff, 0),
833 SYSC_QUIRK("rtc", 0, 0x74, 0x78, -1, 0x4eb01908, 0xffff00f0, 0),
834 SYSC_QUIRK("timer32k", 0, 0, 0x4, -1, 0x00000060, 0xffffffff, 0),
912 SYSC_QUIRK("usbhstll", 0, 0, 0x10, 0x14, 0x00000004, 0xffffffff, 0), 835 SYSC_QUIRK("usbhstll", 0, 0, 0x10, 0x14, 0x00000004, 0xffffffff, 0),
913 SYSC_QUIRK("usb_host_hs", 0, 0, 0x10, 0x14, 0x50700100, 0xffffffff, 0), 836 SYSC_QUIRK("usb_host_hs", 0, 0, 0x10, 0x14, 0x50700100, 0xffffffff, 0),
914 SYSC_QUIRK("usb_otg_hs", 0, 0x400, 0x404, 0x408, 0x00000050, 837 SYSC_QUIRK("usb_otg_hs", 0, 0x400, 0x404, 0x408, 0x00000050,
915 0xffffffff, 0), 838 0xffffffff, 0),
839 SYSC_QUIRK("wdt", 0, 0, 0x10, 0x14, 0x502a0500, 0xfffff0f0, 0),
840 SYSC_QUIRK("vfpe", 0, 0, 0x104, -1, 0x4d001200, 0xffffffff, 0),
916#endif 841#endif
917}; 842};
918 843
@@ -1221,8 +1146,8 @@ static int sysc_child_suspend_noirq(struct device *dev)
1221 if (!pm_runtime_status_suspended(dev)) { 1146 if (!pm_runtime_status_suspended(dev)) {
1222 error = pm_generic_runtime_suspend(dev); 1147 error = pm_generic_runtime_suspend(dev);
1223 if (error) { 1148 if (error) {
1224 dev_warn(dev, "%s busy at %i: %i\n", 1149 dev_dbg(dev, "%s busy at %i: %i\n",
1225 __func__, __LINE__, error); 1150 __func__, __LINE__, error);
1226 1151
1227 return 0; 1152 return 0;
1228 } 1153 }
diff --git a/include/linux/platform_data/ti-sysc.h b/include/linux/platform_data/ti-sysc.h
index 2efa3470a451..1ea3aab972b4 100644
--- a/include/linux/platform_data/ti-sysc.h
+++ b/include/linux/platform_data/ti-sysc.h
@@ -46,7 +46,6 @@ struct sysc_regbits {
46 s8 emufree_shift; 46 s8 emufree_shift;
47}; 47};
48 48
49#define SYSC_QUIRK_RESOURCE_PROVIDER BIT(9)
50#define SYSC_QUIRK_LEGACY_IDLE BIT(8) 49#define SYSC_QUIRK_LEGACY_IDLE BIT(8)
51#define SYSC_QUIRK_RESET_STATUS BIT(7) 50#define SYSC_QUIRK_RESET_STATUS BIT(7)
52#define SYSC_QUIRK_NO_IDLE_ON_INIT BIT(6) 51#define SYSC_QUIRK_NO_IDLE_ON_INIT BIT(6)