2 * ti-sysc.c - Texas Instruments sysc interconnect target driver
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License version 2 as
6 * published by the Free Software Foundation.
8 * This program is distributed "as is" WITHOUT ANY WARRANTY of any
9 * kind, whether express or implied; without even the implied warranty
10 * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
15 #include <linux/clk.h>
16 #include <linux/module.h>
17 #include <linux/platform_device.h>
18 #include <linux/pm_runtime.h>
19 #include <linux/of_address.h>
20 #include <linux/of_platform.h>
21 #include <linux/platform_data/ti-sysc.h>
23 #include <dt-bindings/bus/ti-sysc.h>
32 static const char * const reg_names
[] = { "rev", "sysc", "syss", };
40 static const char * const clock_names
[] = { "fck", "ick", };
42 #define SYSC_IDLEMODE_MASK 3
43 #define SYSC_CLOCKACTIVITY_MASK 3
46 * struct sysc - TI sysc interconnect target module registers and capabilities
47 * @dev: struct device pointer
48 * @module_pa: physical address of the interconnect target module
49 * @module_size: size of the interconnect target module
50 * @module_va: virtual address of the interconnect target module
51 * @offsets: register offsets from module base
52 * @clocks: clocks used by the interconnect target module
53 * @legacy_mode: configured for legacy mode if set
54 * @cap: interconnect target module capabilities
55 * @cfg: interconnect target module configuration
56 * @name: name if available
57 * @revision: interconnect target module revision
63 void __iomem
*module_va
;
64 int offsets
[SYSC_MAX_REGS
];
65 struct clk
*clocks
[SYSC_MAX_CLOCKS
];
66 const char *legacy_mode
;
67 const struct sysc_capabilities
*cap
;
68 struct sysc_config cfg
;
73 static u32
sysc_read(struct sysc
*ddata
, int offset
)
75 if (ddata
->cfg
.quirks
& SYSC_QUIRK_16BIT
) {
78 val
= readw_relaxed(ddata
->module_va
+ offset
);
79 val
|= (readw_relaxed(ddata
->module_va
+ offset
+ 4) << 16);
84 return readl_relaxed(ddata
->module_va
+ offset
);
87 static u32
sysc_read_revision(struct sysc
*ddata
)
89 int offset
= ddata
->offsets
[SYSC_REVISION
];
94 return sysc_read(ddata
, offset
);
97 static int sysc_get_one_clock(struct sysc
*ddata
,
98 enum sysc_clocks index
)
111 name
= clock_names
[index
];
113 ddata
->clocks
[index
] = devm_clk_get(ddata
->dev
, name
);
114 if (IS_ERR(ddata
->clocks
[index
])) {
115 if (PTR_ERR(ddata
->clocks
[index
]) == -ENOENT
)
118 dev_err(ddata
->dev
, "clock get error for %s: %li\n",
119 name
, PTR_ERR(ddata
->clocks
[index
]));
121 return PTR_ERR(ddata
->clocks
[index
]);
124 error
= clk_prepare(ddata
->clocks
[index
]);
126 dev_err(ddata
->dev
, "clock prepare error for %s: %i\n",
135 static int sysc_get_clocks(struct sysc
*ddata
)
139 if (ddata
->legacy_mode
)
142 for (i
= 0; i
< SYSC_MAX_CLOCKS
; i
++) {
143 error
= sysc_get_one_clock(ddata
, i
);
144 if (error
&& error
!= -ENOENT
)
152 * sysc_parse_and_check_child_range - parses module IO region from ranges
153 * @ddata: device driver data
155 * In general we only need rev, syss, and sysc registers and not the whole
156 * module range. But we do want the offsets for these registers from the
157 * module base. This allows us to check them against the legacy hwmod
158 * platform data. Let's also check the ranges are configured properly.
160 static int sysc_parse_and_check_child_range(struct sysc
*ddata
)
162 struct device_node
*np
= ddata
->dev
->of_node
;
163 const __be32
*ranges
;
164 u32 nr_addr
, nr_size
;
167 ranges
= of_get_property(np
, "ranges", &len
);
169 dev_err(ddata
->dev
, "missing ranges for %pOF\n", np
);
174 len
/= sizeof(*ranges
);
177 dev_err(ddata
->dev
, "incomplete ranges for %pOF\n", np
);
182 error
= of_property_read_u32(np
, "#address-cells", &nr_addr
);
186 error
= of_property_read_u32(np
, "#size-cells", &nr_size
);
190 if (nr_addr
!= 1 || nr_size
!= 1) {
191 dev_err(ddata
->dev
, "invalid ranges for %pOF\n", np
);
197 ddata
->module_pa
= of_translate_address(np
, ranges
++);
198 ddata
->module_size
= be32_to_cpup(ranges
);
200 dev_dbg(ddata
->dev
, "interconnect target 0x%llx size 0x%x for %pOF\n",
201 ddata
->module_pa
, ddata
->module_size
, np
);
207 * sysc_check_one_child - check child configuration
208 * @ddata: device driver data
209 * @np: child device node
211 * Let's avoid messy situations where we have new interconnect target
212 * node but children have "ti,hwmods". These belong to the interconnect
213 * target node and are managed by this driver.
215 static int sysc_check_one_child(struct sysc
*ddata
,
216 struct device_node
*np
)
220 name
= of_get_property(np
, "ti,hwmods", NULL
);
222 dev_warn(ddata
->dev
, "really a child ti,hwmods property?");
227 static int sysc_check_children(struct sysc
*ddata
)
229 struct device_node
*child
;
232 for_each_child_of_node(ddata
->dev
->of_node
, child
) {
233 error
= sysc_check_one_child(ddata
, child
);
242 * So far only I2C uses 16-bit read access with clockactivity with revision
243 * in two registers with stride of 4. We can detect this based on the rev
244 * register size to configure things far enough to be able to properly read
245 * the revision register.
247 static void sysc_check_quirk_16bit(struct sysc
*ddata
, struct resource
*res
)
249 if (resource_size(res
) == 8) {
251 "enabling 16-bit and clockactivity quirks\n");
252 ddata
->cfg
.quirks
|= SYSC_QUIRK_16BIT
| SYSC_QUIRK_USE_CLOCKACT
;
257 * sysc_parse_one - parses the interconnect target module registers
258 * @ddata: device driver data
259 * @reg: register to parse
261 static int sysc_parse_one(struct sysc
*ddata
, enum sysc_registers reg
)
263 struct resource
*res
;
270 name
= reg_names
[reg
];
276 res
= platform_get_resource_byname(to_platform_device(ddata
->dev
),
277 IORESOURCE_MEM
, name
);
279 dev_dbg(ddata
->dev
, "has no %s register\n", name
);
280 ddata
->offsets
[reg
] = -ENODEV
;
285 ddata
->offsets
[reg
] = res
->start
- ddata
->module_pa
;
286 if (reg
== SYSC_REVISION
)
287 sysc_check_quirk_16bit(ddata
, res
);
292 static int sysc_parse_registers(struct sysc
*ddata
)
296 for (i
= 0; i
< SYSC_MAX_REGS
; i
++) {
297 error
= sysc_parse_one(ddata
, i
);
306 * sysc_check_registers - check for misconfigured register overlaps
307 * @ddata: device driver data
309 static int sysc_check_registers(struct sysc
*ddata
)
311 int i
, j
, nr_regs
= 0, nr_matches
= 0;
313 for (i
= 0; i
< SYSC_MAX_REGS
; i
++) {
314 if (ddata
->offsets
[i
] < 0)
317 if (ddata
->offsets
[i
] > (ddata
->module_size
- 4)) {
318 dev_err(ddata
->dev
, "register outside module range");
323 for (j
= 0; j
< SYSC_MAX_REGS
; j
++) {
324 if (ddata
->offsets
[j
] < 0)
327 if (ddata
->offsets
[i
] == ddata
->offsets
[j
])
334 dev_err(ddata
->dev
, "missing registers\n");
339 if (nr_matches
> nr_regs
) {
340 dev_err(ddata
->dev
, "overlapping registers: (%i/%i)",
341 nr_regs
, nr_matches
);
350 * syc_ioremap - ioremap register space for the interconnect target module
351 * @ddata: deviec driver data
353 * Note that the interconnect target module registers can be anywhere
354 * within the first child device address space. For example, SGX has
355 * them at offset 0x1fc00 in the 32MB module address space. We just
356 * what we need around the interconnect target module registers.
358 static int sysc_ioremap(struct sysc
*ddata
)
362 if (ddata
->offsets
[SYSC_SYSSTATUS
] >= 0)
363 size
= ddata
->offsets
[SYSC_SYSSTATUS
];
364 else if (ddata
->offsets
[SYSC_SYSCONFIG
] >= 0)
365 size
= ddata
->offsets
[SYSC_SYSCONFIG
];
366 else if (ddata
->offsets
[SYSC_REVISION
] >= 0)
367 size
= ddata
->offsets
[SYSC_REVISION
];
374 ddata
->module_va
= devm_ioremap(ddata
->dev
,
377 if (!ddata
->module_va
)
384 * sysc_map_and_check_registers - ioremap and check device registers
385 * @ddata: device driver data
387 static int sysc_map_and_check_registers(struct sysc
*ddata
)
391 error
= sysc_parse_and_check_child_range(ddata
);
395 error
= sysc_check_children(ddata
);
399 error
= sysc_parse_registers(ddata
);
403 error
= sysc_ioremap(ddata
);
407 error
= sysc_check_registers(ddata
);
415 * sysc_show_rev - read and show interconnect target module revision
416 * @bufp: buffer to print the information to
417 * @ddata: device driver data
419 static int sysc_show_rev(char *bufp
, struct sysc
*ddata
)
423 if (ddata
->offsets
[SYSC_REVISION
] < 0)
424 return sprintf(bufp
, ":NA");
426 len
= sprintf(bufp
, ":%08x", ddata
->revision
);
431 static int sysc_show_reg(struct sysc
*ddata
,
432 char *bufp
, enum sysc_registers reg
)
434 if (ddata
->offsets
[reg
] < 0)
435 return sprintf(bufp
, ":NA");
437 return sprintf(bufp
, ":%x", ddata
->offsets
[reg
]);
441 * sysc_show_registers - show information about interconnect target module
442 * @ddata: device driver data
444 static void sysc_show_registers(struct sysc
*ddata
)
450 for (i
= 0; i
< SYSC_MAX_REGS
; i
++)
451 bufp
+= sysc_show_reg(ddata
, bufp
, i
);
453 bufp
+= sysc_show_rev(bufp
, ddata
);
455 dev_dbg(ddata
->dev
, "%llx:%x%s\n",
456 ddata
->module_pa
, ddata
->module_size
,
460 static int __maybe_unused
sysc_runtime_suspend(struct device
*dev
)
465 ddata
= dev_get_drvdata(dev
);
467 if (ddata
->legacy_mode
)
470 for (i
= 0; i
< SYSC_MAX_CLOCKS
; i
++) {
471 if (IS_ERR_OR_NULL(ddata
->clocks
[i
]))
473 clk_disable(ddata
->clocks
[i
]);
479 static int __maybe_unused
sysc_runtime_resume(struct device
*dev
)
484 ddata
= dev_get_drvdata(dev
);
486 if (ddata
->legacy_mode
)
489 for (i
= 0; i
< SYSC_MAX_CLOCKS
; i
++) {
490 if (IS_ERR_OR_NULL(ddata
->clocks
[i
]))
492 error
= clk_enable(ddata
->clocks
[i
]);
500 static const struct dev_pm_ops sysc_pm_ops
= {
501 SET_RUNTIME_PM_OPS(sysc_runtime_suspend
,
506 /* At this point the module is configured enough to read the revision */
507 static int sysc_init_module(struct sysc
*ddata
)
511 error
= pm_runtime_get_sync(ddata
->dev
);
513 pm_runtime_put_noidle(ddata
->dev
);
517 ddata
->revision
= sysc_read_revision(ddata
);
518 pm_runtime_put_sync(ddata
->dev
);
523 static int sysc_init_sysc_mask(struct sysc
*ddata
)
525 struct device_node
*np
= ddata
->dev
->of_node
;
529 error
= of_property_read_u32(np
, "ti,sysc-mask", &val
);
534 ddata
->cfg
.sysc_val
= val
& ddata
->cap
->sysc_mask
;
536 ddata
->cfg
.sysc_val
= ddata
->cap
->sysc_mask
;
541 static int sysc_init_idlemode(struct sysc
*ddata
, u8
*idlemodes
,
544 struct device_node
*np
= ddata
->dev
->of_node
;
545 struct property
*prop
;
549 of_property_for_each_u32(np
, name
, prop
, p
, val
) {
550 if (val
>= SYSC_NR_IDLEMODES
) {
551 dev_err(ddata
->dev
, "invalid idlemode: %i\n", val
);
554 *idlemodes
|= (1 << val
);
560 static int sysc_init_idlemodes(struct sysc
*ddata
)
564 error
= sysc_init_idlemode(ddata
, &ddata
->cfg
.midlemodes
,
569 error
= sysc_init_idlemode(ddata
, &ddata
->cfg
.sidlemodes
,
578 * Only some devices on omap4 and later have SYSCONFIG reset done
579 * bit. We can detect this if there is no SYSSTATUS at all, or the
580 * SYSTATUS bit 0 is not used. Note that some SYSSTATUS registers
581 * have multiple bits for the child devices like OHCI and EHCI.
582 * Depends on SYSC being parsed first.
584 static int sysc_init_syss_mask(struct sysc
*ddata
)
586 struct device_node
*np
= ddata
->dev
->of_node
;
590 error
= of_property_read_u32(np
, "ti,syss-mask", &val
);
592 if ((ddata
->cap
->type
== TI_SYSC_OMAP4
||
593 ddata
->cap
->type
== TI_SYSC_OMAP4_TIMER
) &&
594 (ddata
->cfg
.sysc_val
& SYSC_OMAP4_SOFTRESET
))
595 ddata
->cfg
.quirks
|= SYSC_QUIRK_RESET_STATUS
;
600 if (!(val
& 1) && (ddata
->cfg
.sysc_val
& SYSC_OMAP4_SOFTRESET
))
601 ddata
->cfg
.quirks
|= SYSC_QUIRK_RESET_STATUS
;
603 ddata
->cfg
.syss_mask
= val
;
608 /* Device tree configured quirks */
609 struct sysc_dts_quirk
{
614 static const struct sysc_dts_quirk sysc_dts_quirks
[] = {
615 { .name
= "ti,no-idle-on-init",
616 .mask
= SYSC_QUIRK_NO_IDLE_ON_INIT
, },
617 { .name
= "ti,no-reset-on-init",
618 .mask
= SYSC_QUIRK_NO_RESET_ON_INIT
, },
621 static int sysc_init_dts_quirks(struct sysc
*ddata
)
623 struct device_node
*np
= ddata
->dev
->of_node
;
624 const struct property
*prop
;
628 ddata
->legacy_mode
= of_get_property(np
, "ti,hwmods", NULL
);
630 for (i
= 0; i
< ARRAY_SIZE(sysc_dts_quirks
); i
++) {
631 prop
= of_get_property(np
, sysc_dts_quirks
[i
].name
, &len
);
635 ddata
->cfg
.quirks
|= sysc_dts_quirks
[i
].mask
;
638 error
= of_property_read_u32(np
, "ti,sysc-delay-us", &val
);
641 dev_warn(ddata
->dev
, "bad ti,sysc-delay-us: %i\n",
645 ddata
->cfg
.srst_udelay
= (u8
)val
;
651 static void sysc_unprepare(struct sysc
*ddata
)
655 for (i
= 0; i
< SYSC_MAX_CLOCKS
; i
++) {
656 if (!IS_ERR_OR_NULL(ddata
->clocks
[i
]))
657 clk_unprepare(ddata
->clocks
[i
]);
662 * Common sysc register bits found on omap2, also known as type1
664 static const struct sysc_regbits sysc_regbits_omap2
= {
665 .dmadisable_shift
= -ENODEV
,
675 static const struct sysc_capabilities sysc_omap2
= {
676 .type
= TI_SYSC_OMAP2
,
677 .sysc_mask
= SYSC_OMAP2_CLOCKACTIVITY
| SYSC_OMAP2_EMUFREE
|
678 SYSC_OMAP2_ENAWAKEUP
| SYSC_OMAP2_SOFTRESET
|
680 .regbits
= &sysc_regbits_omap2
,
683 /* All omap2 and 3 timers, and timers 1, 2 & 10 on omap 4 and 5 */
684 static const struct sysc_capabilities sysc_omap2_timer
= {
685 .type
= TI_SYSC_OMAP2_TIMER
,
686 .sysc_mask
= SYSC_OMAP2_CLOCKACTIVITY
| SYSC_OMAP2_EMUFREE
|
687 SYSC_OMAP2_ENAWAKEUP
| SYSC_OMAP2_SOFTRESET
|
689 .regbits
= &sysc_regbits_omap2
,
690 .mod_quirks
= SYSC_QUIRK_USE_CLOCKACT
,
694 * SHAM2 (SHA1/MD5) sysc found on omap3, a variant of sysc_regbits_omap2
695 * with different sidle position
697 static const struct sysc_regbits sysc_regbits_omap3_sham
= {
698 .dmadisable_shift
= -ENODEV
,
699 .midle_shift
= -ENODEV
,
701 .clkact_shift
= -ENODEV
,
702 .enwkup_shift
= -ENODEV
,
705 .emufree_shift
= -ENODEV
,
708 static const struct sysc_capabilities sysc_omap3_sham
= {
709 .type
= TI_SYSC_OMAP3_SHAM
,
710 .sysc_mask
= SYSC_OMAP2_SOFTRESET
| SYSC_OMAP2_AUTOIDLE
,
711 .regbits
= &sysc_regbits_omap3_sham
,
715 * AES register bits found on omap3 and later, a variant of
716 * sysc_regbits_omap2 with different sidle position
718 static const struct sysc_regbits sysc_regbits_omap3_aes
= {
719 .dmadisable_shift
= -ENODEV
,
720 .midle_shift
= -ENODEV
,
722 .clkact_shift
= -ENODEV
,
723 .enwkup_shift
= -ENODEV
,
726 .emufree_shift
= -ENODEV
,
729 static const struct sysc_capabilities sysc_omap3_aes
= {
730 .type
= TI_SYSC_OMAP3_AES
,
731 .sysc_mask
= SYSC_OMAP2_SOFTRESET
| SYSC_OMAP2_AUTOIDLE
,
732 .regbits
= &sysc_regbits_omap3_aes
,
736 * Common sysc register bits found on omap4, also known as type2
738 static const struct sysc_regbits sysc_regbits_omap4
= {
739 .dmadisable_shift
= 16,
742 .clkact_shift
= -ENODEV
,
743 .enwkup_shift
= -ENODEV
,
746 .autoidle_shift
= -ENODEV
,
749 static const struct sysc_capabilities sysc_omap4
= {
750 .type
= TI_SYSC_OMAP4
,
751 .sysc_mask
= SYSC_OMAP4_DMADISABLE
| SYSC_OMAP4_FREEEMU
|
752 SYSC_OMAP4_SOFTRESET
,
753 .regbits
= &sysc_regbits_omap4
,
756 static const struct sysc_capabilities sysc_omap4_timer
= {
757 .type
= TI_SYSC_OMAP4_TIMER
,
758 .sysc_mask
= SYSC_OMAP4_DMADISABLE
| SYSC_OMAP4_FREEEMU
|
759 SYSC_OMAP4_SOFTRESET
,
760 .regbits
= &sysc_regbits_omap4
,
764 * Common sysc register bits found on omap4, also known as type3
766 static const struct sysc_regbits sysc_regbits_omap4_simple
= {
767 .dmadisable_shift
= -ENODEV
,
770 .clkact_shift
= -ENODEV
,
771 .enwkup_shift
= -ENODEV
,
772 .srst_shift
= -ENODEV
,
773 .emufree_shift
= -ENODEV
,
774 .autoidle_shift
= -ENODEV
,
777 static const struct sysc_capabilities sysc_omap4_simple
= {
778 .type
= TI_SYSC_OMAP4_SIMPLE
,
779 .regbits
= &sysc_regbits_omap4_simple
,
783 * SmartReflex sysc found on omap34xx
785 static const struct sysc_regbits sysc_regbits_omap34xx_sr
= {
786 .dmadisable_shift
= -ENODEV
,
787 .midle_shift
= -ENODEV
,
788 .sidle_shift
= -ENODEV
,
790 .enwkup_shift
= -ENODEV
,
791 .srst_shift
= -ENODEV
,
792 .emufree_shift
= -ENODEV
,
793 .autoidle_shift
= -ENODEV
,
796 static const struct sysc_capabilities sysc_34xx_sr
= {
797 .type
= TI_SYSC_OMAP34XX_SR
,
798 .sysc_mask
= SYSC_OMAP2_CLOCKACTIVITY
,
799 .regbits
= &sysc_regbits_omap34xx_sr
,
800 .mod_quirks
= SYSC_QUIRK_USE_CLOCKACT
| SYSC_QUIRK_UNCACHED
,
804 * SmartReflex sysc found on omap36xx and later
806 static const struct sysc_regbits sysc_regbits_omap36xx_sr
= {
807 .dmadisable_shift
= -ENODEV
,
808 .midle_shift
= -ENODEV
,
810 .clkact_shift
= -ENODEV
,
812 .srst_shift
= -ENODEV
,
813 .emufree_shift
= -ENODEV
,
814 .autoidle_shift
= -ENODEV
,
817 static const struct sysc_capabilities sysc_36xx_sr
= {
818 .type
= TI_SYSC_OMAP36XX_SR
,
819 .sysc_mask
= SYSC_OMAP3_SR_ENAWAKEUP
,
820 .regbits
= &sysc_regbits_omap36xx_sr
,
821 .mod_quirks
= SYSC_QUIRK_UNCACHED
,
824 static const struct sysc_capabilities sysc_omap4_sr
= {
825 .type
= TI_SYSC_OMAP4_SR
,
826 .regbits
= &sysc_regbits_omap36xx_sr
,
830 * McASP register bits found on omap4 and later
832 static const struct sysc_regbits sysc_regbits_omap4_mcasp
= {
833 .dmadisable_shift
= -ENODEV
,
834 .midle_shift
= -ENODEV
,
836 .clkact_shift
= -ENODEV
,
837 .enwkup_shift
= -ENODEV
,
838 .srst_shift
= -ENODEV
,
839 .emufree_shift
= -ENODEV
,
840 .autoidle_shift
= -ENODEV
,
843 static const struct sysc_capabilities sysc_omap4_mcasp
= {
844 .type
= TI_SYSC_OMAP4_MCASP
,
845 .regbits
= &sysc_regbits_omap4_mcasp
,
849 * FS USB host found on omap4 and later
851 static const struct sysc_regbits sysc_regbits_omap4_usb_host_fs
= {
852 .dmadisable_shift
= -ENODEV
,
853 .midle_shift
= -ENODEV
,
855 .clkact_shift
= -ENODEV
,
857 .srst_shift
= -ENODEV
,
858 .emufree_shift
= -ENODEV
,
859 .autoidle_shift
= -ENODEV
,
862 static const struct sysc_capabilities sysc_omap4_usb_host_fs
= {
863 .type
= TI_SYSC_OMAP4_USB_HOST_FS
,
864 .sysc_mask
= SYSC_OMAP2_ENAWAKEUP
,
865 .regbits
= &sysc_regbits_omap4_usb_host_fs
,
868 static int sysc_init_match(struct sysc
*ddata
)
870 const struct sysc_capabilities
*cap
;
872 cap
= of_device_get_match_data(ddata
->dev
);
878 ddata
->cfg
.quirks
|= ddata
->cap
->mod_quirks
;
883 static int sysc_probe(struct platform_device
*pdev
)
888 ddata
= devm_kzalloc(&pdev
->dev
, sizeof(*ddata
), GFP_KERNEL
);
892 ddata
->dev
= &pdev
->dev
;
893 platform_set_drvdata(pdev
, ddata
);
895 error
= sysc_init_match(ddata
);
899 error
= sysc_init_dts_quirks(ddata
);
903 error
= sysc_get_clocks(ddata
);
907 error
= sysc_map_and_check_registers(ddata
);
911 error
= sysc_init_sysc_mask(ddata
);
915 error
= sysc_init_idlemodes(ddata
);
919 error
= sysc_init_syss_mask(ddata
);
923 pm_runtime_enable(ddata
->dev
);
925 error
= sysc_init_module(ddata
);
929 error
= pm_runtime_get_sync(ddata
->dev
);
931 pm_runtime_put_noidle(ddata
->dev
);
932 pm_runtime_disable(ddata
->dev
);
936 pm_runtime_use_autosuspend(ddata
->dev
);
938 sysc_show_registers(ddata
);
940 error
= of_platform_populate(ddata
->dev
->of_node
,
941 NULL
, NULL
, ddata
->dev
);
945 pm_runtime_mark_last_busy(ddata
->dev
);
946 pm_runtime_put_autosuspend(ddata
->dev
);
951 pm_runtime_dont_use_autosuspend(&pdev
->dev
);
952 pm_runtime_put_sync(&pdev
->dev
);
953 pm_runtime_disable(&pdev
->dev
);
955 sysc_unprepare(ddata
);
960 static int sysc_remove(struct platform_device
*pdev
)
962 struct sysc
*ddata
= platform_get_drvdata(pdev
);
965 error
= pm_runtime_get_sync(ddata
->dev
);
967 pm_runtime_put_noidle(ddata
->dev
);
968 pm_runtime_disable(ddata
->dev
);
972 of_platform_depopulate(&pdev
->dev
);
974 pm_runtime_dont_use_autosuspend(&pdev
->dev
);
975 pm_runtime_put_sync(&pdev
->dev
);
976 pm_runtime_disable(&pdev
->dev
);
979 sysc_unprepare(ddata
);
984 static const struct of_device_id sysc_match
[] = {
985 { .compatible
= "ti,sysc-omap2", .data
= &sysc_omap2
, },
986 { .compatible
= "ti,sysc-omap2-timer", .data
= &sysc_omap2_timer
, },
987 { .compatible
= "ti,sysc-omap4", .data
= &sysc_omap4
, },
988 { .compatible
= "ti,sysc-omap4-timer", .data
= &sysc_omap4_timer
, },
989 { .compatible
= "ti,sysc-omap4-simple", .data
= &sysc_omap4_simple
, },
990 { .compatible
= "ti,sysc-omap3430-sr", .data
= &sysc_34xx_sr
, },
991 { .compatible
= "ti,sysc-omap3630-sr", .data
= &sysc_36xx_sr
, },
992 { .compatible
= "ti,sysc-omap4-sr", .data
= &sysc_omap4_sr
, },
993 { .compatible
= "ti,sysc-omap3-sham", .data
= &sysc_omap3_sham
, },
994 { .compatible
= "ti,sysc-omap-aes", .data
= &sysc_omap3_aes
, },
995 { .compatible
= "ti,sysc-mcasp", .data
= &sysc_omap4_mcasp
, },
996 { .compatible
= "ti,sysc-usb-host-fs",
997 .data
= &sysc_omap4_usb_host_fs
, },
1000 MODULE_DEVICE_TABLE(of
, sysc_match
);
1002 static struct platform_driver sysc_driver
= {
1003 .probe
= sysc_probe
,
1004 .remove
= sysc_remove
,
1007 .of_match_table
= sysc_match
,
1011 module_platform_driver(sysc_driver
);
1013 MODULE_DESCRIPTION("TI sysc interconnect target driver");
1014 MODULE_LICENSE("GPL v2");