Lines Matching +full:pruss +full:- +full:cfg

1 // SPDX-License-Identifier: GPL-2.0
3 * ti-sysc.c - Texas Instruments sysc interconnect target driver
22 #include <linux/platform_data/ti-sysc.h>
24 #include <dt-bindings/bus/ti-sysc.h>
86 * struct sysc - TI sysc interconnect target module registers and capabilities
92 * @mdata: ti-sysc to hwmod translation data for a module
99 * @cfg: interconnect target module configuration
108 * @pre_reset_quirk: module specific pre-reset quirk
109 * @post_reset_quirk: module specific post-reset quirk
129 struct sysc_config cfg; member
151 if (ddata->cfg.quirks & SYSC_QUIRK_16BIT) { in sysc_write()
152 writew_relaxed(value & 0xffff, ddata->module_va + offset); in sysc_write()
155 if (ddata->offsets[SYSC_REVISION] >= 0 && in sysc_write()
156 offset == ddata->offsets[SYSC_REVISION]) { in sysc_write()
159 writew_relaxed(hi, ddata->module_va + offset + 4); in sysc_write()
165 writel_relaxed(value, ddata->module_va + offset); in sysc_write()
170 if (ddata->cfg.quirks & SYSC_QUIRK_16BIT) { in sysc_read()
173 val = readw_relaxed(ddata->module_va + offset); in sysc_read()
176 if (ddata->offsets[SYSC_REVISION] >= 0 && in sysc_read()
177 offset == ddata->offsets[SYSC_REVISION]) { in sysc_read()
178 u16 tmp = readw_relaxed(ddata->module_va + offset + 4); in sysc_read()
186 return readl_relaxed(ddata->module_va + offset); in sysc_read()
191 return !!(ddata->cfg.quirks & SYSC_QUIRK_OPT_CLKS_NEEDED); in sysc_opt_clks_needed()
196 int offset = ddata->offsets[SYSC_REVISION]; in sysc_read_revision()
206 int offset = ddata->offsets[SYSC_SYSCONFIG]; in sysc_read_sysconfig()
216 int offset = ddata->offsets[SYSC_SYSSTATUS]; in sysc_read_sysstatus()
230 if (ddata->cap->regbits->srst_shift < 0) in sysc_wait_softreset()
233 syss_offset = ddata->offsets[SYSC_SYSSTATUS]; in sysc_wait_softreset()
234 sysc_mask = BIT(ddata->cap->regbits->srst_shift); in sysc_wait_softreset()
236 if (ddata->cfg.quirks & SYSS_QUIRK_RESETDONE_INVERTED) in sysc_wait_softreset()
239 syss_done = ddata->cfg.syss_mask; in sysc_wait_softreset()
243 rstval, (rstval & ddata->cfg.syss_mask) == in sysc_wait_softreset()
246 } else if (ddata->cfg.quirks & SYSC_QUIRK_RESET_STATUS) { in sysc_wait_softreset()
259 struct device_node *np = ddata->dev->of_node; in sysc_add_named_clock_from_child()
280 return -ENODEV; in sysc_add_named_clock_from_child()
282 clock = devm_get_clk_from_child(ddata->dev, child, name); in sysc_add_named_clock_from_child()
293 return -ENOMEM; in sysc_add_named_clock_from_child()
295 cl->con_id = n; in sysc_add_named_clock_from_child()
296 cl->dev_id = dev_name(ddata->dev); in sysc_add_named_clock_from_child()
297 cl->clk = clock; in sysc_add_named_clock_from_child()
310 if (ddata->nr_clocks < SYSC_OPTFCK0) in sysc_init_ext_opt_clock()
313 index = ddata->nr_clocks; in sysc_init_ext_opt_clock()
324 ddata->clock_roles[index] = optfck_name; in sysc_init_ext_opt_clock()
325 ddata->nr_clocks++; in sysc_init_ext_opt_clock()
332 int error, i, index = -ENODEV; in sysc_get_one_clock()
341 if (!ddata->clocks[i]) { in sysc_get_one_clock()
349 dev_err(ddata->dev, "clock %s not added\n", name); in sysc_get_one_clock()
353 ddata->clocks[index] = devm_clk_get(ddata->dev, name); in sysc_get_one_clock()
354 if (IS_ERR(ddata->clocks[index])) { in sysc_get_one_clock()
355 dev_err(ddata->dev, "clock get error for %s: %li\n", in sysc_get_one_clock()
356 name, PTR_ERR(ddata->clocks[index])); in sysc_get_one_clock()
358 return PTR_ERR(ddata->clocks[index]); in sysc_get_one_clock()
361 error = clk_prepare(ddata->clocks[index]); in sysc_get_one_clock()
363 dev_err(ddata->dev, "clock prepare error for %s: %i\n", in sysc_get_one_clock()
374 struct device_node *np = ddata->dev->of_node; in sysc_get_clocks()
379 ddata->clock_roles = devm_kcalloc(ddata->dev, in sysc_get_clocks()
381 sizeof(*ddata->clock_roles), in sysc_get_clocks()
383 if (!ddata->clock_roles) in sysc_get_clocks()
384 return -ENOMEM; in sysc_get_clocks()
386 of_property_for_each_string(np, "clock-names", prop, name) { in sysc_get_clocks()
391 ddata->clock_roles[ddata->nr_clocks] = name; in sysc_get_clocks()
392 ddata->nr_clocks++; in sysc_get_clocks()
395 if (ddata->nr_clocks < 1) in sysc_get_clocks()
398 if ((ddata->cfg.quirks & SYSC_QUIRK_EXT_OPT_CLOCK)) { in sysc_get_clocks()
404 if (ddata->nr_clocks > SYSC_MAX_CLOCKS) { in sysc_get_clocks()
405 dev_err(ddata->dev, "too many clocks for %pOF\n", np); in sysc_get_clocks()
407 return -EINVAL; in sysc_get_clocks()
411 dev_err(ddata->dev, "max one fck and ick for %pOF\n", np); in sysc_get_clocks()
413 return -EINVAL; in sysc_get_clocks()
418 ddata->nr_clocks++; in sysc_get_clocks()
420 ddata->nr_clocks++; in sysc_get_clocks()
422 ddata->clocks = devm_kcalloc(ddata->dev, in sysc_get_clocks()
423 ddata->nr_clocks, sizeof(*ddata->clocks), in sysc_get_clocks()
425 if (!ddata->clocks) in sysc_get_clocks()
426 return -ENOMEM; in sysc_get_clocks()
429 const char *name = ddata->clock_roles[i]; in sysc_get_clocks()
447 if (!ddata->clocks) in sysc_enable_main_clocks()
451 clock = ddata->clocks[i]; in sysc_enable_main_clocks()
465 for (i--; i >= 0; i--) { in sysc_enable_main_clocks()
466 clock = ddata->clocks[i]; in sysc_enable_main_clocks()
483 if (!ddata->clocks) in sysc_disable_main_clocks()
487 clock = ddata->clocks[i]; in sysc_disable_main_clocks()
500 if (!ddata->clocks || ddata->nr_clocks < SYSC_OPTFCK0 + 1) in sysc_enable_opt_clocks()
504 clock = ddata->clocks[i]; in sysc_enable_opt_clocks()
518 for (i--; i >= 0; i--) { in sysc_enable_opt_clocks()
519 clock = ddata->clocks[i]; in sysc_enable_opt_clocks()
534 if (!ddata->clocks || ddata->nr_clocks < SYSC_OPTFCK0 + 1) in sysc_disable_opt_clocks()
538 clock = ddata->clocks[i]; in sysc_disable_opt_clocks()
552 if (ddata->legacy_mode || (ddata->cfg.quirks & SYSC_QUIRK_CLKDM_NOAUTO)) in sysc_clkdm_deny_idle()
555 pdata = dev_get_platdata(ddata->dev); in sysc_clkdm_deny_idle()
556 if (pdata && pdata->clkdm_deny_idle) in sysc_clkdm_deny_idle()
557 pdata->clkdm_deny_idle(ddata->dev, &ddata->cookie); in sysc_clkdm_deny_idle()
564 if (ddata->legacy_mode || (ddata->cfg.quirks & SYSC_QUIRK_CLKDM_NOAUTO)) in sysc_clkdm_allow_idle()
567 pdata = dev_get_platdata(ddata->dev); in sysc_clkdm_allow_idle()
568 if (pdata && pdata->clkdm_allow_idle) in sysc_clkdm_allow_idle()
569 pdata->clkdm_allow_idle(ddata->dev, &ddata->cookie); in sysc_clkdm_allow_idle()
573 * sysc_init_resets - init rstctrl reset line if configured
580 ddata->rsts = in sysc_init_resets()
581 devm_reset_control_get_optional_shared(ddata->dev, "rstctrl"); in sysc_init_resets()
583 return PTR_ERR_OR_ZERO(ddata->rsts); in sysc_init_resets()
587 * sysc_parse_and_check_child_range - parses module IO region from ranges
597 struct device_node *np = ddata->dev->of_node; in sysc_parse_and_check_child_range()
604 dev_err(ddata->dev, "missing ranges for %pOF\n", np); in sysc_parse_and_check_child_range()
606 return -ENOENT; in sysc_parse_and_check_child_range()
612 dev_err(ddata->dev, "incomplete ranges for %pOF\n", np); in sysc_parse_and_check_child_range()
614 return -EINVAL; in sysc_parse_and_check_child_range()
617 error = of_property_read_u32(np, "#address-cells", &nr_addr); in sysc_parse_and_check_child_range()
619 return -ENOENT; in sysc_parse_and_check_child_range()
621 error = of_property_read_u32(np, "#size-cells", &nr_size); in sysc_parse_and_check_child_range()
623 return -ENOENT; in sysc_parse_and_check_child_range()
626 dev_err(ddata->dev, "invalid ranges for %pOF\n", np); in sysc_parse_and_check_child_range()
628 return -EINVAL; in sysc_parse_and_check_child_range()
632 ddata->module_pa = of_translate_address(np, ranges++); in sysc_parse_and_check_child_range()
633 ddata->module_size = be32_to_cpup(ranges); in sysc_parse_and_check_child_range()
655 uart = of_get_property(np, "stdout-path", NULL); in sysc_init_stdout_path()
668 stdout_path = ERR_PTR(-ENODEV); in sysc_init_stdout_path()
678 ddata->cfg.quirks |= SYSC_QUIRK_NO_IDLE_ON_INIT | in sysc_check_quirk_stdout()
683 * sysc_check_one_child - check child configuration
698 dev_warn(ddata->dev, "really a child ti,hwmods property?"); in sysc_check_one_child()
708 for_each_child_of_node(ddata->dev->of_node, child) in sysc_check_children()
713 * So far only I2C uses 16-bit read access with clockactivity with revision
721 ddata->cfg.quirks |= SYSC_QUIRK_16BIT | SYSC_QUIRK_USE_CLOCKACT; in sysc_check_quirk_16bit()
725 * sysc_parse_one - parses the interconnect target module registers
741 return -EINVAL; in sysc_parse_one()
744 res = platform_get_resource_byname(to_platform_device(ddata->dev), in sysc_parse_one()
747 ddata->offsets[reg] = -ENODEV; in sysc_parse_one()
752 ddata->offsets[reg] = res->start - ddata->module_pa; in sysc_parse_one()
773 * sysc_check_registers - check for misconfigured register overlaps
781 if (ddata->offsets[i] < 0) in sysc_check_registers()
784 if (ddata->offsets[i] > (ddata->module_size - 4)) { in sysc_check_registers()
785 dev_err(ddata->dev, "register outside module range"); in sysc_check_registers()
787 return -EINVAL; in sysc_check_registers()
791 if (ddata->offsets[j] < 0) in sysc_check_registers()
794 if (ddata->offsets[i] == ddata->offsets[j]) in sysc_check_registers()
801 dev_err(ddata->dev, "overlapping registers: (%i/%i)", in sysc_check_registers()
804 return -EINVAL; in sysc_check_registers()
811 * syc_ioremap - ioremap register space for the interconnect target module
825 if (ddata->offsets[SYSC_REVISION] < 0 && in sysc_ioremap()
826 ddata->offsets[SYSC_SYSCONFIG] < 0 && in sysc_ioremap()
827 ddata->offsets[SYSC_SYSSTATUS] < 0) { in sysc_ioremap()
828 size = ddata->module_size; in sysc_ioremap()
830 size = max3(ddata->offsets[SYSC_REVISION], in sysc_ioremap()
831 ddata->offsets[SYSC_SYSCONFIG], in sysc_ioremap()
832 ddata->offsets[SYSC_SYSSTATUS]); in sysc_ioremap()
837 if ((size + sizeof(u32)) > ddata->module_size) in sysc_ioremap()
838 size = ddata->module_size; in sysc_ioremap()
841 ddata->module_va = devm_ioremap(ddata->dev, in sysc_ioremap()
842 ddata->module_pa, in sysc_ioremap()
844 if (!ddata->module_va) in sysc_ioremap()
845 return -EIO; in sysc_ioremap()
851 * sysc_map_and_check_registers - ioremap and check device registers
880 * sysc_show_rev - read and show interconnect target module revision
888 if (ddata->offsets[SYSC_REVISION] < 0) in sysc_show_rev()
891 len = sprintf(bufp, ":%08x", ddata->revision); in sysc_show_rev()
899 if (ddata->offsets[reg] < 0) in sysc_show_reg()
902 return sprintf(bufp, ":%x", ddata->offsets[reg]); in sysc_show_reg()
907 if (!ddata->name) in sysc_show_name()
910 return sprintf(bufp, ":%s", ddata->name); in sysc_show_name()
914 * sysc_show_registers - show information about interconnect target module
929 dev_dbg(ddata->dev, "%llx:%x%s\n", in sysc_show_registers()
930 ddata->module_pa, ddata->module_size, in sysc_show_registers()
935 * sysc_write_sysconfig - handle sysconfig quirks for register write
941 if (ddata->module_unlock_quirk) in sysc_write_sysconfig()
942 ddata->module_unlock_quirk(ddata); in sysc_write_sysconfig()
944 sysc_write(ddata, ddata->offsets[SYSC_SYSCONFIG], value); in sysc_write_sysconfig()
946 if (ddata->module_lock_quirk) in sysc_write_sysconfig()
947 ddata->module_lock_quirk(ddata); in sysc_write_sysconfig()
950 #define SYSC_IDLE_MASK (SYSC_NR_IDLEMODES - 1)
967 if (ddata->cfg.quirks & SYSC_QUIRK_OPT_CLKS_IN_RESET) { in sysc_enable_module()
970 dev_err(ddata->dev, in sysc_enable_module()
980 if (!(ddata->cfg.quirks & SYSC_MODULE_QUIRK_ENA_RESETDONE)) { in sysc_enable_module()
983 dev_warn(ddata->dev, "OCP softreset timed out\n"); in sysc_enable_module()
985 if (ddata->cfg.quirks & SYSC_QUIRK_OPT_CLKS_IN_RESET) in sysc_enable_module()
993 if (ddata->offsets[SYSC_SYSCONFIG] == -ENODEV) in sysc_enable_module()
996 regbits = ddata->cap->regbits; in sysc_enable_module()
997 reg = sysc_read(ddata, ddata->offsets[SYSC_SYSCONFIG]); in sysc_enable_module()
1004 if (regbits->clkact_shift >= 0 && in sysc_enable_module()
1005 (ddata->cfg.quirks & SYSC_QUIRK_USE_CLOCKACT)) in sysc_enable_module()
1006 reg |= SYSC_CLOCACT_ICK << regbits->clkact_shift; in sysc_enable_module()
1009 idlemodes = ddata->cfg.sidlemodes; in sysc_enable_module()
1010 if (!idlemodes || regbits->sidle_shift < 0) in sysc_enable_module()
1013 if (ddata->cfg.quirks & (SYSC_QUIRK_SWSUP_SIDLE | in sysc_enable_module()
1017 best_mode = fls(ddata->cfg.sidlemodes) - 1; in sysc_enable_module()
1020 return -EINVAL; in sysc_enable_module()
1024 if (regbits->enwkup_shift >= 0 && in sysc_enable_module()
1025 ddata->cfg.sysc_val & BIT(regbits->enwkup_shift)) in sysc_enable_module()
1026 reg |= BIT(regbits->enwkup_shift); in sysc_enable_module()
1029 reg &= ~(SYSC_IDLE_MASK << regbits->sidle_shift); in sysc_enable_module()
1030 reg |= best_mode << regbits->sidle_shift; in sysc_enable_module()
1035 idlemodes = ddata->cfg.midlemodes; in sysc_enable_module()
1036 if (!idlemodes || regbits->midle_shift < 0) in sysc_enable_module()
1039 best_mode = fls(ddata->cfg.midlemodes) - 1; in sysc_enable_module()
1042 return -EINVAL; in sysc_enable_module()
1045 if (ddata->cfg.quirks & SYSC_QUIRK_SWSUP_MSTANDBY) in sysc_enable_module()
1048 reg &= ~(SYSC_IDLE_MASK << regbits->midle_shift); in sysc_enable_module()
1049 reg |= best_mode << regbits->midle_shift; in sysc_enable_module()
1054 if (regbits->autoidle_shift >= 0 && in sysc_enable_module()
1055 ddata->cfg.sysc_val & BIT(regbits->autoidle_shift)) { in sysc_enable_module()
1056 reg |= 1 << regbits->autoidle_shift; in sysc_enable_module()
1061 sysc_read(ddata, ddata->offsets[SYSC_SYSCONFIG]); in sysc_enable_module()
1063 if (ddata->module_enable_quirk) in sysc_enable_module()
1064 ddata->module_enable_quirk(ddata); in sysc_enable_module()
1078 return -EINVAL; in sysc_best_idle_mode()
1092 if (ddata->offsets[SYSC_SYSCONFIG] == -ENODEV) in sysc_disable_module()
1095 if (ddata->module_disable_quirk) in sysc_disable_module()
1096 ddata->module_disable_quirk(ddata); in sysc_disable_module()
1098 regbits = ddata->cap->regbits; in sysc_disable_module()
1099 reg = sysc_read(ddata, ddata->offsets[SYSC_SYSCONFIG]); in sysc_disable_module()
1102 idlemodes = ddata->cfg.midlemodes; in sysc_disable_module()
1103 if (!idlemodes || regbits->midle_shift < 0) in sysc_disable_module()
1112 if (ddata->cfg.quirks & (SYSC_QUIRK_SWSUP_MSTANDBY) || in sysc_disable_module()
1113 ddata->cfg.quirks & (SYSC_QUIRK_FORCE_MSTANDBY)) in sysc_disable_module()
1116 reg &= ~(SYSC_IDLE_MASK << regbits->midle_shift); in sysc_disable_module()
1117 reg |= best_mode << regbits->midle_shift; in sysc_disable_module()
1122 idlemodes = ddata->cfg.sidlemodes; in sysc_disable_module()
1123 if (!idlemodes || regbits->sidle_shift < 0) in sysc_disable_module()
1126 if (ddata->cfg.quirks & SYSC_QUIRK_SWSUP_SIDLE) { in sysc_disable_module()
1136 reg &= ~(SYSC_IDLE_MASK << regbits->sidle_shift); in sysc_disable_module()
1137 reg |= best_mode << regbits->sidle_shift; in sysc_disable_module()
1138 if (regbits->autoidle_shift >= 0 && in sysc_disable_module()
1139 ddata->cfg.sysc_val & BIT(regbits->autoidle_shift)) in sysc_disable_module()
1140 reg |= 1 << regbits->autoidle_shift; in sysc_disable_module()
1144 sysc_read(ddata, ddata->offsets[SYSC_SYSCONFIG]); in sysc_disable_module()
1155 pdata = dev_get_platdata(ddata->dev); in sysc_runtime_suspend_legacy()
1159 if (!pdata->idle_module) in sysc_runtime_suspend_legacy()
1160 return -ENODEV; in sysc_runtime_suspend_legacy()
1162 error = pdata->idle_module(dev, &ddata->cookie); in sysc_runtime_suspend_legacy()
1167 reset_control_assert(ddata->rsts); in sysc_runtime_suspend_legacy()
1178 pdata = dev_get_platdata(ddata->dev); in sysc_runtime_resume_legacy()
1182 if (!pdata->enable_module) in sysc_runtime_resume_legacy()
1183 return -ENODEV; in sysc_runtime_resume_legacy()
1185 error = pdata->enable_module(dev, &ddata->cookie); in sysc_runtime_resume_legacy()
1190 reset_control_deassert(ddata->rsts); in sysc_runtime_resume_legacy()
1202 if (!ddata->enabled) in sysc_runtime_suspend()
1207 if (ddata->legacy_mode) { in sysc_runtime_suspend()
1222 ddata->enabled = false; in sysc_runtime_suspend()
1225 reset_control_assert(ddata->rsts); in sysc_runtime_suspend()
1239 if (ddata->enabled) in sysc_runtime_resume()
1255 reset_control_deassert(ddata->rsts); in sysc_runtime_resume()
1257 if (ddata->legacy_mode) { in sysc_runtime_resume()
1267 ddata->enabled = true; in sysc_runtime_resume()
1290 if (ddata->cfg.quirks & in sysc_noirq_suspend()
1303 if (ddata->cfg.quirks & in sysc_noirq_resume()
1348 SYSC_QUIRK("smartreflex", 0, -ENODEV, 0x24, -ENODEV, 0x00000000, 0xffffffff,
1350 SYSC_QUIRK("smartreflex", 0, -ENODEV, 0x38, -ENODEV, 0x00000000, 0xffffffff,
1363 SYSC_QUIRK("mcpdm", 0x40132000, 0, 0x10, -ENODEV, 0x50000800, 0xffffffff,
1368 SYSC_QUIRK("aess", 0, 0, 0x10, -ENODEV, 0x40000000, 0xffffffff,
1370 SYSC_QUIRK("dcan", 0x48480000, 0x20, -ENODEV, -ENODEV, 0xa3170504, 0xffffffff,
1374 SYSC_QUIRK("dss", 0x58000000, 0, -ENODEV, 0x14, 0x00000040, 0xffffffff,
1376 SYSC_QUIRK("dss", 0x58000000, 0, -ENODEV, 0x14, 0x00000061, 0xffffffff,
1378 SYSC_QUIRK("dwc3", 0x48880000, 0, 0x10, -ENODEV, 0x500a0200, 0xffffffff,
1380 SYSC_QUIRK("dwc3", 0x488c0000, 0, 0x10, -ENODEV, 0x500a0200, 0xffffffff,
1382 SYSC_QUIRK("hdmi", 0, 0, 0x10, -ENODEV, 0x50030200, 0xffffffff,
1396 SYSC_QUIRK("gpu", 0x50000000, 0x14, -ENODEV, -ENODEV, 0x00010201, 0xffffffff, 0),
1397 SYSC_QUIRK("gpu", 0x50000000, 0xfe00, 0xfe10, -ENODEV, 0x40000000 , 0xffffffff,
1399 SYSC_QUIRK("lcdc", 0, 0, 0x54, -ENODEV, 0x4f201000, 0xffffffff,
1401 SYSC_QUIRK("rtc", 0, 0x74, 0x78, -ENODEV, 0x4eb01908, 0xffff00f0,
1403 SYSC_QUIRK("tptc", 0, 0, 0x10, -ENODEV, 0x40006c00, 0xffffefff,
1405 SYSC_QUIRK("tptc", 0, 0, -ENODEV, -ENODEV, 0x40007c00, 0xffffffff,
1409 SYSC_QUIRK("usb_host_hs", 0, 0, 0x10, -ENODEV, 0x50700101, 0xffffffff,
1413 SYSC_QUIRK("usb_otg_hs", 0, 0, 0x10, -ENODEV, 0x4ea2080d, 0xffffffff,
1417 /* PRUSS on am3, am4 and am5 */
1418 SYSC_QUIRK("pruss", 0, 0x26000, 0x26004, -ENODEV, 0x47000000, 0xff000000,
1425 SYSC_QUIRK("adc", 0, 0, 0x10, -ENODEV, 0x47300001, 0xffffffff, 0),
1426 SYSC_QUIRK("atl", 0, 0, -ENODEV, -ENODEV, 0x0a070100, 0xffffffff, 0),
1427 SYSC_QUIRK("cm", 0, 0, -ENODEV, -ENODEV, 0x40000301, 0xffffffff, 0),
1428 SYSC_QUIRK("control", 0, 0, 0x10, -ENODEV, 0x40000900, 0xffffffff, 0),
1431 SYSC_QUIRK("dcan", 0, 0x20, -ENODEV, -ENODEV, 0xa3170504, 0xffffffff, 0),
1432 SYSC_QUIRK("dcan", 0, 0x20, -ENODEV, -ENODEV, 0x4edb1902, 0xffffffff, 0),
1436 SYSC_QUIRK("dmic", 0, 0, 0x10, -ENODEV, 0x50010000, 0xffffffff, 0),
1441 SYSC_QUIRK("dwc3", 0, 0, 0x10, -ENODEV, 0x500a0200, 0xffffffff, 0),
1444 SYSC_QUIRK("epwmss", 0, 0, 0x4, -ENODEV, 0x47400001, 0xffffffff, 0),
1445 SYSC_QUIRK("gpu", 0, 0x1fc00, 0x1fc10, -ENODEV, 0, 0, 0),
1446 SYSC_QUIRK("gpu", 0, 0xfe00, 0xfe10, -ENODEV, 0x40000000 , 0xffffffff, 0),
1447 SYSC_QUIRK("hdmi", 0, 0, 0x10, -ENODEV, 0x50031d00, 0xffffffff, 0),
1449 SYSC_QUIRK("iss", 0, 0, 0x10, -ENODEV, 0x40000101, 0xffffffff, 0),
1450 SYSC_QUIRK("mcasp", 0, 0, 0x4, -ENODEV, 0x44306302, 0xffffffff, 0),
1451 SYSC_QUIRK("mcasp", 0, 0, 0x4, -ENODEV, 0x44307b02, 0xffffffff, 0),
1452 SYSC_QUIRK("mcbsp", 0, -ENODEV, 0x8c, -ENODEV, 0, 0, 0),
1453 SYSC_QUIRK("mcspi", 0, 0, 0x10, -ENODEV, 0x40300a0b, 0xffff00ff, 0),
1455 SYSC_QUIRK("mailbox", 0, 0, 0x10, -ENODEV, 0x00000400, 0xffffffff, 0),
1456 SYSC_QUIRK("m3", 0, 0, -ENODEV, -ENODEV, 0x5f580105, 0x0fff0f00, 0),
1458 SYSC_QUIRK("ocp2scp", 0, 0, -ENODEV, -ENODEV, 0x50060007, 0xffffffff, 0),
1459 SYSC_QUIRK("padconf", 0, 0, 0x10, -ENODEV, 0x4fff0800, 0xffffffff, 0),
1460 SYSC_QUIRK("padconf", 0, 0, -ENODEV, -ENODEV, 0x40001100, 0xffffffff, 0),
1461 SYSC_QUIRK("prcm", 0, 0, -ENODEV, -ENODEV, 0x40000100, 0xffffffff, 0),
1462 SYSC_QUIRK("prcm", 0, 0, -ENODEV, -ENODEV, 0x00004102, 0xffffffff, 0),
1463 SYSC_QUIRK("prcm", 0, 0, -ENODEV, -ENODEV, 0x40000400, 0xffffffff, 0),
1466 SYSC_QUIRK("scm", 0, 0, 0x10, -ENODEV, 0x40000900, 0xffffffff, 0),
1467 SYSC_QUIRK("scm", 0, 0, -ENODEV, -ENODEV, 0x4e8b0100, 0xffffffff, 0),
1468 SYSC_QUIRK("scm", 0, 0, -ENODEV, -ENODEV, 0x4f000100, 0xffffffff, 0),
1469 SYSC_QUIRK("scm", 0, 0, -ENODEV, -ENODEV, 0x40000900, 0xffffffff, 0),
1470 SYSC_QUIRK("scrm", 0, 0, -ENODEV, -ENODEV, 0x00000010, 0xffffffff, 0),
1471 SYSC_QUIRK("sdio", 0, 0, 0x10, -ENODEV, 0x40202301, 0xffff0ff0, 0),
1474 SYSC_QUIRK("slimbus", 0, 0, 0x10, -ENODEV, 0x40000902, 0xffffffff, 0),
1475 SYSC_QUIRK("slimbus", 0, 0, 0x10, -ENODEV, 0x40002903, 0xffffffff, 0),
1476 SYSC_QUIRK("spinlock", 0, 0, 0x10, -ENODEV, 0x50020000, 0xffffffff, 0),
1477 SYSC_QUIRK("rng", 0, 0x1fe0, 0x1fe4, -ENODEV, 0x00000020, 0xffffffff, 0),
1481 SYSC_QUIRK("timer", 0, 0, 0x10, -ENODEV, 0x50002100, 0xffffffff, 0),
1482 SYSC_QUIRK("timer", 0, 0, 0x10, -ENODEV, 0x4fff1301, 0xffff00ff, 0),
1483 SYSC_QUIRK("timer32k", 0, 0, 0x4, -ENODEV, 0x00000040, 0xffffffff, 0),
1484 SYSC_QUIRK("timer32k", 0, 0, 0x4, -ENODEV, 0x00000011, 0xffffffff, 0),
1485 SYSC_QUIRK("timer32k", 0, 0, 0x4, -ENODEV, 0x00000060, 0xffffffff, 0),
1486 SYSC_QUIRK("tpcc", 0, 0, -ENODEV, -ENODEV, 0x40014c00, 0xffffffff, 0),
1489 SYSC_QUIRK("venc", 0x58003000, 0, -ENODEV, -ENODEV, 0x00000002, 0xffffffff, 0),
1490 SYSC_QUIRK("vfpe", 0, 0, 0x104, -ENODEV, 0x4d001200, 0xffffffff, 0),
1506 if (!q->base) in sysc_init_early_quirks()
1509 if (q->base != ddata->module_pa) in sysc_init_early_quirks()
1512 if (q->rev_offset != ddata->offsets[SYSC_REVISION]) in sysc_init_early_quirks()
1515 if (q->sysc_offset != ddata->offsets[SYSC_SYSCONFIG]) in sysc_init_early_quirks()
1518 if (q->syss_offset != ddata->offsets[SYSC_SYSSTATUS]) in sysc_init_early_quirks()
1521 ddata->name = q->name; in sysc_init_early_quirks()
1522 ddata->cfg.quirks |= q->quirks; in sysc_init_early_quirks()
1535 if (q->base && q->base != ddata->module_pa) in sysc_init_revision_quirks()
1538 if (q->rev_offset != ddata->offsets[SYSC_REVISION]) in sysc_init_revision_quirks()
1541 if (q->sysc_offset != ddata->offsets[SYSC_SYSCONFIG]) in sysc_init_revision_quirks()
1544 if (q->syss_offset != ddata->offsets[SYSC_SYSSTATUS]) in sysc_init_revision_quirks()
1547 if (q->revision == ddata->revision || in sysc_init_revision_quirks()
1548 (q->revision & q->revision_mask) == in sysc_init_revision_quirks()
1549 (ddata->revision & q->revision_mask)) { in sysc_init_revision_quirks()
1550 ddata->name = q->name; in sysc_init_revision_quirks()
1551 ddata->cfg.quirks |= q->quirks; in sysc_init_revision_quirks()
1559 * dispc init rather than top-level DSS init.
1570 switch (sysc_soc->soc) { in sysc_quirk_dispc()
1592 devm_iounmap(ddata->dev, ddata->module_va); in sysc_quirk_dispc()
1593 ddata->module_va = devm_ioremap(ddata->dev, in sysc_quirk_dispc()
1594 ddata->module_pa, in sysc_quirk_dispc()
1595 ddata->module_size); in sysc_quirk_dispc()
1596 if (!ddata->module_va) in sysc_quirk_dispc()
1597 return -EIO; in sysc_quirk_dispc()
1661 error = readl_poll_timeout(ddata->module_va + dispc_offset + 0x18, in sysc_pre_reset_quirk_dss()
1664 dev_warn(ddata->dev, "%s: timed out %08x !+ %08x\n", in sysc_pre_reset_quirk_dss()
1667 if (sysc_soc->soc == SOC_3430) { in sysc_pre_reset_quirk_dss()
1679 /* 1-wire needs module's internal clocks enabled for reset */
1705 if ((ddata->revision & 0xffffff00) == 0x001f0000) in sysc_clk_quirk_i2c()
1743 error = readl_poll_timeout_atomic(ddata->module_va + 0x44, val, in sysc_quirk_rtc()
1746 dev_warn(ddata->dev, "rtc busy timeout\n"); in sysc_quirk_rtc()
1782 error = readl_poll_timeout(ddata->module_va + wps, val, in sysc_reset_done_quirk_wdt()
1786 dev_warn(ddata->dev, "wdt disable step1 failed\n"); in sysc_reset_done_quirk_wdt()
1789 error = readl_poll_timeout(ddata->module_va + wps, val, in sysc_reset_done_quirk_wdt()
1793 dev_warn(ddata->dev, "wdt disable step2 failed\n"); in sysc_reset_done_quirk_wdt()
1796 /* PRUSS needs to set MSTANDBY_INIT inorder to idle properly */
1801 reg = sysc_read(ddata, ddata->offsets[SYSC_SYSCONFIG]); in sysc_module_disable_quirk_pruss()
1803 sysc_write(ddata, ddata->offsets[SYSC_SYSCONFIG], reg); in sysc_module_disable_quirk_pruss()
1808 if (ddata->legacy_mode || !ddata->name) in sysc_init_module_quirks()
1811 if (ddata->cfg.quirks & SYSC_MODULE_QUIRK_HDQ1W) { in sysc_init_module_quirks()
1812 ddata->pre_reset_quirk = sysc_pre_reset_quirk_hdq1w; in sysc_init_module_quirks()
1817 if (ddata->cfg.quirks & SYSC_MODULE_QUIRK_I2C) { in sysc_init_module_quirks()
1818 ddata->pre_reset_quirk = sysc_pre_reset_quirk_i2c; in sysc_init_module_quirks()
1819 ddata->post_reset_quirk = sysc_post_reset_quirk_i2c; in sysc_init_module_quirks()
1824 if (ddata->cfg.quirks & SYSC_MODULE_QUIRK_AESS) in sysc_init_module_quirks()
1825 ddata->module_enable_quirk = sysc_module_enable_quirk_aess; in sysc_init_module_quirks()
1827 if (ddata->cfg.quirks & SYSC_MODULE_QUIRK_DSS_RESET) in sysc_init_module_quirks()
1828 ddata->pre_reset_quirk = sysc_pre_reset_quirk_dss; in sysc_init_module_quirks()
1830 if (ddata->cfg.quirks & SYSC_MODULE_QUIRK_RTC_UNLOCK) { in sysc_init_module_quirks()
1831 ddata->module_unlock_quirk = sysc_module_unlock_quirk_rtc; in sysc_init_module_quirks()
1832 ddata->module_lock_quirk = sysc_module_lock_quirk_rtc; in sysc_init_module_quirks()
1837 if (ddata->cfg.quirks & SYSC_MODULE_QUIRK_SGX) in sysc_init_module_quirks()
1838 ddata->module_enable_quirk = sysc_module_enable_quirk_sgx; in sysc_init_module_quirks()
1840 if (ddata->cfg.quirks & SYSC_MODULE_QUIRK_WDT) { in sysc_init_module_quirks()
1841 ddata->reset_done_quirk = sysc_reset_done_quirk_wdt; in sysc_init_module_quirks()
1842 ddata->module_disable_quirk = sysc_reset_done_quirk_wdt; in sysc_init_module_quirks()
1845 if (ddata->cfg.quirks & SYSC_MODULE_QUIRK_PRUSS) in sysc_init_module_quirks()
1846 ddata->module_disable_quirk = sysc_module_disable_quirk_pruss; in sysc_init_module_quirks()
1851 struct ti_sysc_platform_data *pdata = dev_get_platdata(ddata->dev); in sysc_clockdomain_init()
1855 if (!pdata || !pdata->init_clockdomain) in sysc_clockdomain_init()
1858 switch (ddata->nr_clocks) { in sysc_clockdomain_init()
1860 ick = ddata->clocks[SYSC_ICK]; in sysc_clockdomain_init()
1863 fck = ddata->clocks[SYSC_FCK]; in sysc_clockdomain_init()
1869 error = pdata->init_clockdomain(ddata->dev, fck, ick, &ddata->cookie); in sysc_clockdomain_init()
1870 if (!error || error == -ENODEV) in sysc_clockdomain_init()
1877 * Note that pdata->init_module() typically does a reset first. After
1878 * pdata->init_module() is done, PM runtime can be used for the interconnect
1883 struct ti_sysc_platform_data *pdata = dev_get_platdata(ddata->dev); in sysc_legacy_init()
1886 if (!pdata || !pdata->init_module) in sysc_legacy_init()
1889 error = pdata->init_module(ddata->dev, ddata->mdata, &ddata->cookie); in sysc_legacy_init()
1890 if (error == -EEXIST) in sysc_legacy_init()
1905 sysc_offset = ddata->offsets[SYSC_SYSCONFIG]; in sysc_reset()
1907 if (ddata->legacy_mode || in sysc_reset()
1908 ddata->cap->regbits->srst_shift < 0 || in sysc_reset()
1909 ddata->cfg.quirks & SYSC_QUIRK_NO_RESET_ON_INIT) in sysc_reset()
1912 sysc_mask = BIT(ddata->cap->regbits->srst_shift); in sysc_reset()
1914 if (ddata->pre_reset_quirk) in sysc_reset()
1915 ddata->pre_reset_quirk(ddata); in sysc_reset()
1923 if (ddata->cfg.srst_udelay) in sysc_reset()
1924 usleep_range(ddata->cfg.srst_udelay, in sysc_reset()
1925 ddata->cfg.srst_udelay * 2); in sysc_reset()
1927 if (ddata->post_reset_quirk) in sysc_reset()
1928 ddata->post_reset_quirk(ddata); in sysc_reset()
1932 dev_warn(ddata->dev, "OCP softreset timed out\n"); in sysc_reset()
1934 if (ddata->reset_done_quirk) in sysc_reset()
1935 ddata->reset_done_quirk(ddata); in sysc_reset()
1968 if (!(ddata->cfg.quirks & SYSC_QUIRK_NO_RESET_ON_INIT)) { in sysc_init_module()
1969 error = reset_control_deassert(ddata->rsts); in sysc_init_module()
1974 ddata->revision = sysc_read_revision(ddata); in sysc_init_module()
1978 if (ddata->legacy_mode) { in sysc_init_module()
1984 if (!ddata->legacy_mode) { in sysc_init_module()
1985 error = sysc_enable_module(ddata->dev); in sysc_init_module()
1992 dev_err(ddata->dev, "Reset failed with %d\n", error); in sysc_init_module()
1994 if (error && !ddata->legacy_mode) in sysc_init_module()
1995 sysc_disable_module(ddata->dev); in sysc_init_module()
1998 if (error && !(ddata->cfg.quirks & SYSC_QUIRK_NO_RESET_ON_INIT)) in sysc_init_module()
1999 reset_control_assert(ddata->rsts); in sysc_init_module()
2005 /* No re-enable of clockdomain autoidle to prevent module autoidle */ in sysc_init_module()
2016 struct device_node *np = ddata->dev->of_node; in sysc_init_sysc_mask()
2020 error = of_property_read_u32(np, "ti,sysc-mask", &val); in sysc_init_sysc_mask()
2024 ddata->cfg.sysc_val = val & ddata->cap->sysc_mask; in sysc_init_sysc_mask()
2032 struct device_node *np = ddata->dev->of_node; in sysc_init_idlemode()
2039 dev_err(ddata->dev, "invalid idlemode: %i\n", val); in sysc_init_idlemode()
2040 return -EINVAL; in sysc_init_idlemode()
2052 error = sysc_init_idlemode(ddata, &ddata->cfg.midlemodes, in sysc_init_idlemodes()
2053 "ti,sysc-midle"); in sysc_init_idlemodes()
2057 error = sysc_init_idlemode(ddata, &ddata->cfg.sidlemodes, in sysc_init_idlemodes()
2058 "ti,sysc-sidle"); in sysc_init_idlemodes()
2074 struct device_node *np = ddata->dev->of_node; in sysc_init_syss_mask()
2078 error = of_property_read_u32(np, "ti,syss-mask", &val); in sysc_init_syss_mask()
2080 if ((ddata->cap->type == TI_SYSC_OMAP4 || in sysc_init_syss_mask()
2081 ddata->cap->type == TI_SYSC_OMAP4_TIMER) && in sysc_init_syss_mask()
2082 (ddata->cfg.sysc_val & SYSC_OMAP4_SOFTRESET)) in sysc_init_syss_mask()
2083 ddata->cfg.quirks |= SYSC_QUIRK_RESET_STATUS; in sysc_init_syss_mask()
2088 if (!(val & 1) && (ddata->cfg.sysc_val & SYSC_OMAP4_SOFTRESET)) in sysc_init_syss_mask()
2089 ddata->cfg.quirks |= SYSC_QUIRK_RESET_STATUS; in sysc_init_syss_mask()
2091 ddata->cfg.syss_mask = val; in sysc_init_syss_mask()
2113 error = -EEXIST; in sysc_child_add_named_clock()
2117 clk = clk_get(ddata->dev, name); in sysc_child_add_named_clock()
2119 return -ENODEV; in sysc_child_add_named_clock()
2123 error = -ENOMEM; in sysc_child_add_named_clock()
2135 for (i = 0; i < ddata->nr_clocks; i++) { in sysc_child_add_clocks()
2138 ddata->clock_roles[i]); in sysc_child_add_clocks()
2139 if (error && error != -EEXIST) { in sysc_child_add_clocks()
2140 dev_err(ddata->dev, "could not add child clock %s: %i\n", in sysc_child_add_clocks()
2141 ddata->clock_roles[i], error); in sysc_child_add_clocks()
2155 struct device *parent = dev->parent; in sysc_child_to_parent()
2157 if (!parent || parent->type != &sysc_device_type) in sysc_child_to_parent()
2174 if (!ddata->enabled) in sysc_child_runtime_suspend()
2177 return sysc_runtime_suspend(ddata->dev); in sysc_child_runtime_suspend()
2187 if (!ddata->enabled) { in sysc_child_runtime_resume()
2188 error = sysc_runtime_resume(ddata->dev); in sysc_child_runtime_resume()
2190 dev_err(ddata->dev, in sysc_child_runtime_resume()
2205 dev_dbg(ddata->dev, "%s %s\n", __func__, in sysc_child_suspend_noirq()
2206 ddata->name ? ddata->name : ""); in sysc_child_suspend_noirq()
2225 error = sysc_runtime_suspend(ddata->dev); in sysc_child_suspend_noirq()
2233 ddata->child_needs_resume = true; in sysc_child_suspend_noirq()
2246 dev_dbg(ddata->dev, "%s %s\n", __func__, in sysc_child_resume_noirq()
2247 ddata->name ? ddata->name : ""); in sysc_child_resume_noirq()
2249 if (ddata->child_needs_resume) { in sysc_child_resume_noirq()
2250 ddata->child_needs_resume = false; in sysc_child_resume_noirq()
2252 error = sysc_runtime_resume(ddata->dev); in sysc_child_resume_noirq()
2254 dev_err(ddata->dev, in sysc_child_resume_noirq()
2260 dev_err(ddata->dev, in sysc_child_resume_noirq()
2281 * sysc_legacy_idle_quirk - handle children in omap_device compatible way
2295 if (ddata->cfg.quirks & SYSC_QUIRK_LEGACY_IDLE) in sysc_legacy_idle_quirk()
2335 { .name = "ti,no-idle-on-init",
2337 { .name = "ti,no-reset-on-init",
2339 { .name = "ti,no-idle",
2356 ddata->cfg.quirks |= sysc_dts_quirks[i].mask; in sysc_parse_dts_quirks()
2358 dev_warn(ddata->dev, in sysc_parse_dts_quirks()
2367 struct device_node *np = ddata->dev->of_node; in sysc_init_dts_quirks()
2371 ddata->legacy_mode = of_get_property(np, "ti,hwmods", NULL); in sysc_init_dts_quirks()
2374 error = of_property_read_u32(np, "ti,sysc-delay-us", &val); in sysc_init_dts_quirks()
2377 dev_warn(ddata->dev, "bad ti,sysc-delay-us: %i\n", in sysc_init_dts_quirks()
2381 ddata->cfg.srst_udelay = (u8)val; in sysc_init_dts_quirks()
2391 if (!ddata->clocks) in sysc_unprepare()
2395 if (!IS_ERR_OR_NULL(ddata->clocks[i])) in sysc_unprepare()
2396 clk_unprepare(ddata->clocks[i]); in sysc_unprepare()
2404 .dmadisable_shift = -ENODEV,
2437 .dmadisable_shift = -ENODEV,
2438 .midle_shift = -ENODEV,
2440 .clkact_shift = -ENODEV,
2441 .enwkup_shift = -ENODEV,
2444 .emufree_shift = -ENODEV,
2458 .dmadisable_shift = -ENODEV,
2459 .midle_shift = -ENODEV,
2461 .clkact_shift = -ENODEV,
2462 .enwkup_shift = -ENODEV,
2465 .emufree_shift = -ENODEV,
2481 .clkact_shift = -ENODEV,
2482 .enwkup_shift = -ENODEV,
2485 .autoidle_shift = -ENODEV,
2506 .dmadisable_shift = -ENODEV,
2509 .clkact_shift = -ENODEV,
2510 .enwkup_shift = -ENODEV,
2511 .srst_shift = -ENODEV,
2512 .emufree_shift = -ENODEV,
2513 .autoidle_shift = -ENODEV,
2525 .dmadisable_shift = -ENODEV,
2526 .midle_shift = -ENODEV,
2527 .sidle_shift = -ENODEV,
2529 .enwkup_shift = -ENODEV,
2530 .srst_shift = -ENODEV,
2531 .emufree_shift = -ENODEV,
2532 .autoidle_shift = -ENODEV,
2547 .dmadisable_shift = -ENODEV,
2548 .midle_shift = -ENODEV,
2550 .clkact_shift = -ENODEV,
2552 .srst_shift = -ENODEV,
2553 .emufree_shift = -ENODEV,
2554 .autoidle_shift = -ENODEV,
2574 .dmadisable_shift = -ENODEV,
2575 .midle_shift = -ENODEV,
2577 .clkact_shift = -ENODEV,
2578 .enwkup_shift = -ENODEV,
2579 .srst_shift = -ENODEV,
2580 .emufree_shift = -ENODEV,
2581 .autoidle_shift = -ENODEV,
2603 .dmadisable_shift = -ENODEV,
2604 .midle_shift = -ENODEV,
2606 .clkact_shift = -ENODEV,
2608 .srst_shift = -ENODEV,
2609 .emufree_shift = -ENODEV,
2610 .autoidle_shift = -ENODEV,
2620 .dmadisable_shift = -ENODEV,
2621 .midle_shift = -ENODEV,
2622 .sidle_shift = -ENODEV,
2623 .clkact_shift = -ENODEV,
2626 .emufree_shift = -ENODEV,
2627 .autoidle_shift = -ENODEV,
2638 * PRUSS found on some AM33xx, AM437x and AM57xx SoCs
2649 struct ti_sysc_platform_data *pdata = dev_get_platdata(ddata->dev); in sysc_init_pdata()
2655 mdata = devm_kzalloc(ddata->dev, sizeof(*mdata), GFP_KERNEL); in sysc_init_pdata()
2657 return -ENOMEM; in sysc_init_pdata()
2659 if (ddata->legacy_mode) { in sysc_init_pdata()
2660 mdata->name = ddata->legacy_mode; in sysc_init_pdata()
2661 mdata->module_pa = ddata->module_pa; in sysc_init_pdata()
2662 mdata->module_size = ddata->module_size; in sysc_init_pdata()
2663 mdata->offsets = ddata->offsets; in sysc_init_pdata()
2664 mdata->nr_offsets = SYSC_MAX_REGS; in sysc_init_pdata()
2665 mdata->cap = ddata->cap; in sysc_init_pdata()
2666 mdata->cfg = &ddata->cfg; in sysc_init_pdata()
2669 ddata->mdata = mdata; in sysc_init_pdata()
2678 cap = of_device_get_match_data(ddata->dev); in sysc_init_match()
2680 return -EINVAL; in sysc_init_match()
2682 ddata->cap = cap; in sysc_init_match()
2683 if (ddata->cap) in sysc_init_match()
2684 ddata->cfg.quirks |= ddata->cap->mod_quirks; in sysc_init_match()
2701 if (ddata->cfg.quirks & (SYSC_QUIRK_NO_IDLE | in ti_sysc_idle()
2709 if (ddata->cfg.quirks & SYSC_QUIRK_NO_IDLE) in ti_sysc_idle()
2716 if (pm_runtime_active(ddata->dev)) in ti_sysc_idle()
2717 pm_runtime_put_sync(ddata->dev); in ti_sysc_idle()
2767 return -ENOMEM; in sysc_add_disabled()
2769 disabled_module->base = base; in sysc_add_disabled()
2771 mutex_lock(&sysc_soc->list_lock); in sysc_add_disabled()
2772 list_add(&disabled_module->node, &sysc_soc->disabled_modules); in sysc_add_disabled()
2773 mutex_unlock(&sysc_soc->list_lock); in sysc_add_disabled()
2780 * Note that we initialize static data shared across all ti-sysc instances
2795 return -ENOMEM; in sysc_init_soc()
2797 mutex_init(&sysc_soc->list_lock); in sysc_init_soc()
2798 INIT_LIST_HEAD(&sysc_soc->disabled_modules); in sysc_init_soc()
2799 sysc_soc->general_purpose = true; in sysc_init_soc()
2801 pdata = dev_get_platdata(ddata->dev); in sysc_init_soc()
2802 if (pdata && pdata->soc_type_gp) in sysc_init_soc()
2803 sysc_soc->general_purpose = pdata->soc_type_gp(); in sysc_init_soc()
2806 if (match && match->data) in sysc_init_soc()
2807 sysc_soc->soc = (int)match->data; in sysc_init_soc()
2810 if (!sysc_soc->general_purpose) { in sysc_init_soc()
2811 switch (sysc_soc->soc) { in sysc_init_soc()
2824 if (match->data) in sysc_init_soc()
2825 features = (unsigned long)match->data; in sysc_init_soc()
2850 mutex_lock(&sysc_soc->list_lock); in sysc_cleanup_soc()
2851 list_for_each_safe(pos, tmp, &sysc_soc->disabled_modules) { in sysc_cleanup_soc()
2856 mutex_unlock(&sysc_soc->list_lock); in sysc_cleanup_soc()
2865 mutex_lock(&sysc_soc->list_lock); in sysc_check_disabled_devices()
2866 list_for_each(pos, &sysc_soc->disabled_modules) { in sysc_check_disabled_devices()
2868 if (ddata->module_pa == disabled_module->base) { in sysc_check_disabled_devices()
2869 dev_dbg(ddata->dev, "module disabled for this SoC\n"); in sysc_check_disabled_devices()
2870 error = -ENODEV; in sysc_check_disabled_devices()
2874 mutex_unlock(&sysc_soc->list_lock); in sysc_check_disabled_devices()
2880 * Ignore timers tagged with no-reset and no-idle. These are likely in use,
2881 * for example by drivers/clocksource/timer-ti-dm-systimer.c. If more checks
2886 if (ddata->cap->type != TI_SYSC_OMAP2_TIMER && in sysc_check_active_timer()
2887 ddata->cap->type != TI_SYSC_OMAP4_TIMER) in sysc_check_active_timer()
2890 if ((ddata->cfg.quirks & SYSC_QUIRK_NO_RESET_ON_INIT) && in sysc_check_active_timer()
2891 (ddata->cfg.quirks & SYSC_QUIRK_NO_IDLE)) in sysc_check_active_timer()
2892 return -ENXIO; in sysc_check_active_timer()
2898 { .compatible = "simple-bus", },
2904 struct ti_sysc_platform_data *pdata = dev_get_platdata(&pdev->dev); in sysc_probe()
2908 ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); in sysc_probe()
2910 return -ENOMEM; in sysc_probe()
2912 ddata->dev = &pdev->dev; in sysc_probe()
2969 pm_runtime_enable(ddata->dev); in sysc_probe()
2970 error = pm_runtime_get_sync(ddata->dev); in sysc_probe()
2972 pm_runtime_put_noidle(ddata->dev); in sysc_probe()
2973 pm_runtime_disable(ddata->dev); in sysc_probe()
2978 if (!(ddata->cfg.quirks & SYSC_QUIRK_NO_RESET_ON_INIT)) in sysc_probe()
2979 reset_control_assert(ddata->rsts); in sysc_probe()
2981 if (!(ddata->cfg.quirks & in sysc_probe()
2990 ddata->dev->type = &sysc_device_type; in sysc_probe()
2991 error = of_platform_populate(ddata->dev->of_node, sysc_match_table, in sysc_probe()
2992 pdata ? pdata->auxdata : NULL, in sysc_probe()
2993 ddata->dev); in sysc_probe()
2997 INIT_DELAYED_WORK(&ddata->idle_work, ti_sysc_idle); in sysc_probe()
3000 if (ddata->cfg.quirks & (SYSC_QUIRK_NO_IDLE | in sysc_probe()
3003 schedule_delayed_work(&ddata->idle_work, 3000); in sysc_probe()
3005 pm_runtime_put(&pdev->dev); in sysc_probe()
3011 pm_runtime_put_sync(&pdev->dev); in sysc_probe()
3012 pm_runtime_disable(&pdev->dev); in sysc_probe()
3024 cancel_delayed_work_sync(&ddata->idle_work); in sysc_remove()
3026 error = pm_runtime_get_sync(ddata->dev); in sysc_remove()
3028 pm_runtime_put_noidle(ddata->dev); in sysc_remove()
3029 pm_runtime_disable(ddata->dev); in sysc_remove()
3033 of_platform_depopulate(&pdev->dev); in sysc_remove()
3035 pm_runtime_put_sync(&pdev->dev); in sysc_remove()
3036 pm_runtime_disable(&pdev->dev); in sysc_remove()
3037 reset_control_assert(ddata->rsts); in sysc_remove()
3046 { .compatible = "ti,sysc-omap2", .data = &sysc_omap2, },
3047 { .compatible = "ti,sysc-omap2-timer", .data = &sysc_omap2_timer, },
3048 { .compatible = "ti,sysc-omap4", .data = &sysc_omap4, },
3049 { .compatible = "ti,sysc-omap4-timer", .data = &sysc_omap4_timer, },
3050 { .compatible = "ti,sysc-omap4-simple", .data = &sysc_omap4_simple, },
3051 { .compatible = "ti,sysc-omap3430-sr", .data = &sysc_34xx_sr, },
3052 { .compatible = "ti,sysc-omap3630-sr", .data = &sysc_36xx_sr, },
3053 { .compatible = "ti,sysc-omap4-sr", .data = &sysc_omap4_sr, },
3054 { .compatible = "ti,sysc-omap3-sham", .data = &sysc_omap3_sham, },
3055 { .compatible = "ti,sysc-omap-aes", .data = &sysc_omap3_aes, },
3056 { .compatible = "ti,sysc-mcasp", .data = &sysc_omap4_mcasp, },
3057 { .compatible = "ti,sysc-dra7-mcasp", .data = &sysc_dra7_mcasp, },
3058 { .compatible = "ti,sysc-usb-host-fs",
3060 { .compatible = "ti,sysc-dra7-mcan", .data = &sysc_dra7_mcan, },
3061 { .compatible = "ti,sysc-pruss", .data = &sysc_pruss, },
3070 .name = "ti-sysc",