ti-sysc.c (2491b544ff3aa9717d427033206fa793be53429d) ti-sysc.c (2b2f7def058a5386838ef4dba70a860285f79e66)
1/*
2 * ti-sysc.c - Texas Instruments sysc interconnect target driver
3 *
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.
7 *
8 * This program is distributed "as is" WITHOUT ANY WARRANTY of any

--- 408 unchanged lines hidden (view full) ---

417 /* Assume no holes for opt clocks */
418 if (IS_ERR_OR_NULL(clock))
419 return;
420
421 clk_disable(clock);
422 }
423}
424
1/*
2 * ti-sysc.c - Texas Instruments sysc interconnect target driver
3 *
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.
7 *
8 * This program is distributed "as is" WITHOUT ANY WARRANTY of any

--- 408 unchanged lines hidden (view full) ---

417 /* Assume no holes for opt clocks */
418 if (IS_ERR_OR_NULL(clock))
419 return;
420
421 clk_disable(clock);
422 }
423}
424
425static void sysc_clkdm_deny_idle(struct sysc *ddata)
426{
427 struct ti_sysc_platform_data *pdata;
428
429 if (ddata->legacy_mode)
430 return;
431
432 pdata = dev_get_platdata(ddata->dev);
433 if (pdata && pdata->clkdm_deny_idle)
434 pdata->clkdm_deny_idle(ddata->dev, &ddata->cookie);
435}
436
437static void sysc_clkdm_allow_idle(struct sysc *ddata)
438{
439 struct ti_sysc_platform_data *pdata;
440
441 if (ddata->legacy_mode)
442 return;
443
444 pdata = dev_get_platdata(ddata->dev);
445 if (pdata && pdata->clkdm_allow_idle)
446 pdata->clkdm_allow_idle(ddata->dev, &ddata->cookie);
447}
448
425/**
426 * sysc_init_resets - init rstctrl reset line if configured
427 * @ddata: device driver data
428 *
429 * See sysc_rstctrl_reset_deassert().
430 */
431static int sysc_init_resets(struct sysc *ddata)
432{

--- 222 unchanged lines hidden (view full) ---

655 continue;
656
657 if (ddata->offsets[i] == ddata->offsets[j])
658 nr_matches++;
659 }
660 nr_regs++;
661 }
662
449/**
450 * sysc_init_resets - init rstctrl reset line if configured
451 * @ddata: device driver data
452 *
453 * See sysc_rstctrl_reset_deassert().
454 */
455static int sysc_init_resets(struct sysc *ddata)
456{

--- 222 unchanged lines hidden (view full) ---

679 continue;
680
681 if (ddata->offsets[i] == ddata->offsets[j])
682 nr_matches++;
683 }
684 nr_regs++;
685 }
686
663 if (nr_regs < 1) {
664 dev_err(ddata->dev, "missing registers\n");
665
666 return -EINVAL;
667 }
668
669 if (nr_matches > nr_regs) {
670 dev_err(ddata->dev, "overlapping registers: (%i/%i)",
671 nr_regs, nr_matches);
672
673 return -EINVAL;
674 }
675
676 return 0;

--- 9 unchanged lines hidden (view full) ---

686 * has them at offset 0x1200 in the CPSW_WR child. Usually the
687 * the interconnect target module registers are at the beginning of
688 * the module range though.
689 */
690static int sysc_ioremap(struct sysc *ddata)
691{
692 int size;
693
687 if (nr_matches > nr_regs) {
688 dev_err(ddata->dev, "overlapping registers: (%i/%i)",
689 nr_regs, nr_matches);
690
691 return -EINVAL;
692 }
693
694 return 0;

--- 9 unchanged lines hidden (view full) ---

704 * has them at offset 0x1200 in the CPSW_WR child. Usually the
705 * the interconnect target module registers are at the beginning of
706 * the module range though.
707 */
708static int sysc_ioremap(struct sysc *ddata)
709{
710 int size;
711
694 size = max3(ddata->offsets[SYSC_REVISION],
695 ddata->offsets[SYSC_SYSCONFIG],
696 ddata->offsets[SYSC_SYSSTATUS]);
712 if (ddata->offsets[SYSC_REVISION] < 0 &&
713 ddata->offsets[SYSC_SYSCONFIG] < 0 &&
714 ddata->offsets[SYSC_SYSSTATUS] < 0) {
715 size = ddata->module_size;
716 } else {
717 size = max3(ddata->offsets[SYSC_REVISION],
718 ddata->offsets[SYSC_SYSCONFIG],
719 ddata->offsets[SYSC_SYSSTATUS]);
697
720
698 if (size < 0 || (size + sizeof(u32)) > ddata->module_size)
699 return -EINVAL;
721 if ((size + sizeof(u32)) > ddata->module_size)
722 return -EINVAL;
723 }
700
701 ddata->module_va = devm_ioremap(ddata->dev,
702 ddata->module_pa,
703 size + sizeof(u32));
704 if (!ddata->module_va)
705 return -EIO;
706
707 return 0;

--- 82 unchanged lines hidden (view full) ---

790
791 dev_dbg(ddata->dev, "%llx:%x%s\n",
792 ddata->module_pa, ddata->module_size,
793 buf);
794}
795
796#define SYSC_IDLE_MASK (SYSC_NR_IDLEMODES - 1)
797
724
725 ddata->module_va = devm_ioremap(ddata->dev,
726 ddata->module_pa,
727 size + sizeof(u32));
728 if (!ddata->module_va)
729 return -EIO;
730
731 return 0;

--- 82 unchanged lines hidden (view full) ---

814
815 dev_dbg(ddata->dev, "%llx:%x%s\n",
816 ddata->module_pa, ddata->module_size,
817 buf);
818}
819
820#define SYSC_IDLE_MASK (SYSC_NR_IDLEMODES - 1)
821
822/* Caller needs to manage sysc_clkdm_deny_idle() and sysc_clkdm_allow_idle() */
798static int sysc_enable_module(struct device *dev)
799{
800 struct sysc *ddata;
801 const struct sysc_regbits *regbits;
802 u32 reg, idlemodes, best_mode;
803
804 ddata = dev_get_drvdata(dev);
805 if (ddata->offsets[SYSC_SYSCONFIG] == -ENODEV)
806 return 0;
807
823static int sysc_enable_module(struct device *dev)
824{
825 struct sysc *ddata;
826 const struct sysc_regbits *regbits;
827 u32 reg, idlemodes, best_mode;
828
829 ddata = dev_get_drvdata(dev);
830 if (ddata->offsets[SYSC_SYSCONFIG] == -ENODEV)
831 return 0;
832
808 /*
809 * TODO: Need to prevent clockdomain autoidle?
810 * See clkdm_deny_idle() in arch/mach-omap2/omap_hwmod.c
811 */
812
813 regbits = ddata->cap->regbits;
814 reg = sysc_read(ddata, ddata->offsets[SYSC_SYSCONFIG]);
815
816 /* Set SIDLE mode */
817 idlemodes = ddata->cfg.sidlemodes;
818 if (!idlemodes || regbits->sidle_shift < 0)
819 goto set_midle;
820

--- 35 unchanged lines hidden (view full) ---

856 else if (idlemodes & SYSC_IDLE_FORCE)
857 *best_mode = SYSC_IDLE_FORCE;
858 else
859 return -EINVAL;
860
861 return 0;
862}
863
833 regbits = ddata->cap->regbits;
834 reg = sysc_read(ddata, ddata->offsets[SYSC_SYSCONFIG]);
835
836 /* Set SIDLE mode */
837 idlemodes = ddata->cfg.sidlemodes;
838 if (!idlemodes || regbits->sidle_shift < 0)
839 goto set_midle;
840

--- 35 unchanged lines hidden (view full) ---

876 else if (idlemodes & SYSC_IDLE_FORCE)
877 *best_mode = SYSC_IDLE_FORCE;
878 else
879 return -EINVAL;
880
881 return 0;
882}
883
884/* Caller needs to manage sysc_clkdm_deny_idle() and sysc_clkdm_allow_idle() */
864static int sysc_disable_module(struct device *dev)
865{
866 struct sysc *ddata;
867 const struct sysc_regbits *regbits;
868 u32 reg, idlemodes, best_mode;
869 int ret;
870
871 ddata = dev_get_drvdata(dev);
872 if (ddata->offsets[SYSC_SYSCONFIG] == -ENODEV)
873 return 0;
874
885static int sysc_disable_module(struct device *dev)
886{
887 struct sysc *ddata;
888 const struct sysc_regbits *regbits;
889 u32 reg, idlemodes, best_mode;
890 int ret;
891
892 ddata = dev_get_drvdata(dev);
893 if (ddata->offsets[SYSC_SYSCONFIG] == -ENODEV)
894 return 0;
895
875 /*
876 * TODO: Need to prevent clockdomain autoidle?
877 * See clkdm_deny_idle() in arch/mach-omap2/omap_hwmod.c
878 */
879
880 regbits = ddata->cap->regbits;
881 reg = sysc_read(ddata, ddata->offsets[SYSC_SYSCONFIG]);
882
883 /* Set MIDLE mode */
884 idlemodes = ddata->cfg.midlemodes;
885 if (!idlemodes || regbits->midle_shift < 0)
886 goto set_sidle;
887

--- 73 unchanged lines hidden (view full) ---

961 struct sysc *ddata;
962 int error = 0;
963
964 ddata = dev_get_drvdata(dev);
965
966 if (!ddata->enabled)
967 return 0;
968
896 regbits = ddata->cap->regbits;
897 reg = sysc_read(ddata, ddata->offsets[SYSC_SYSCONFIG]);
898
899 /* Set MIDLE mode */
900 idlemodes = ddata->cfg.midlemodes;
901 if (!idlemodes || regbits->midle_shift < 0)
902 goto set_sidle;
903

--- 73 unchanged lines hidden (view full) ---

977 struct sysc *ddata;
978 int error = 0;
979
980 ddata = dev_get_drvdata(dev);
981
982 if (!ddata->enabled)
983 return 0;
984
985 sysc_clkdm_deny_idle(ddata);
986
969 if (ddata->legacy_mode) {
970 error = sysc_runtime_suspend_legacy(dev, ddata);
971 if (error)
987 if (ddata->legacy_mode) {
988 error = sysc_runtime_suspend_legacy(dev, ddata);
989 if (error)
972 return error;
990 goto err_allow_idle;
973 } else {
974 error = sysc_disable_module(dev);
975 if (error)
991 } else {
992 error = sysc_disable_module(dev);
993 if (error)
976 return error;
994 goto err_allow_idle;
977 }
978
979 sysc_disable_main_clocks(ddata);
980
981 if (sysc_opt_clks_needed(ddata))
982 sysc_disable_opt_clocks(ddata);
983
984 ddata->enabled = false;
985
995 }
996
997 sysc_disable_main_clocks(ddata);
998
999 if (sysc_opt_clks_needed(ddata))
1000 sysc_disable_opt_clocks(ddata);
1001
1002 ddata->enabled = false;
1003
1004err_allow_idle:
1005 sysc_clkdm_allow_idle(ddata);
1006
986 return error;
987}
988
989static int __maybe_unused sysc_runtime_resume(struct device *dev)
990{
991 struct sysc *ddata;
992 int error = 0;
993
994 ddata = dev_get_drvdata(dev);
995
996 if (ddata->enabled)
997 return 0;
998
1007 return error;
1008}
1009
1010static int __maybe_unused sysc_runtime_resume(struct device *dev)
1011{
1012 struct sysc *ddata;
1013 int error = 0;
1014
1015 ddata = dev_get_drvdata(dev);
1016
1017 if (ddata->enabled)
1018 return 0;
1019
1020 sysc_clkdm_deny_idle(ddata);
1021
999 if (sysc_opt_clks_needed(ddata)) {
1000 error = sysc_enable_opt_clocks(ddata);
1001 if (error)
1022 if (sysc_opt_clks_needed(ddata)) {
1023 error = sysc_enable_opt_clocks(ddata);
1024 if (error)
1002 return error;
1025 goto err_allow_idle;
1003 }
1004
1005 error = sysc_enable_main_clocks(ddata);
1006 if (error)
1007 goto err_opt_clocks;
1008
1009 if (ddata->legacy_mode) {
1010 error = sysc_runtime_resume_legacy(dev, ddata);
1011 if (error)
1012 goto err_main_clocks;
1013 } else {
1014 error = sysc_enable_module(dev);
1015 if (error)
1016 goto err_main_clocks;
1017 }
1018
1019 ddata->enabled = true;
1020
1026 }
1027
1028 error = sysc_enable_main_clocks(ddata);
1029 if (error)
1030 goto err_opt_clocks;
1031
1032 if (ddata->legacy_mode) {
1033 error = sysc_runtime_resume_legacy(dev, ddata);
1034 if (error)
1035 goto err_main_clocks;
1036 } else {
1037 error = sysc_enable_module(dev);
1038 if (error)
1039 goto err_main_clocks;
1040 }
1041
1042 ddata->enabled = true;
1043
1044 sysc_clkdm_allow_idle(ddata);
1045
1021 return 0;
1022
1023err_main_clocks:
1024 sysc_disable_main_clocks(ddata);
1025err_opt_clocks:
1026 if (sysc_opt_clks_needed(ddata))
1027 sysc_disable_opt_clocks(ddata);
1046 return 0;
1047
1048err_main_clocks:
1049 sysc_disable_main_clocks(ddata);
1050err_opt_clocks:
1051 if (sysc_opt_clks_needed(ddata))
1052 sysc_disable_opt_clocks(ddata);
1053err_allow_idle:
1054 sysc_clkdm_allow_idle(ddata);
1028
1029 return error;
1030}
1031
1032static int __maybe_unused sysc_noirq_suspend(struct device *dev)
1033{
1034 struct sysc *ddata;
1035

--- 87 unchanged lines hidden (view full) ---

1123 SYSC_QUIRK("adc", 0, 0, 0x10, -1, 0x47300001, 0xffffffff, 0),
1124 SYSC_QUIRK("atl", 0, 0, -1, -1, 0x0a070100, 0xffffffff, 0),
1125 SYSC_QUIRK("aess", 0, 0, 0x10, -1, 0x40000000, 0xffffffff, 0),
1126 SYSC_QUIRK("cm", 0, 0, -1, -1, 0x40000301, 0xffffffff, 0),
1127 SYSC_QUIRK("control", 0, 0, 0x10, -1, 0x40000900, 0xffffffff, 0),
1128 SYSC_QUIRK("cpgmac", 0, 0x1200, 0x1208, 0x1204, 0x4edb1902,
1129 0xffff00f0, 0),
1130 SYSC_QUIRK("dcan", 0, 0, -1, -1, 0xffffffff, 0xffffffff, 0),
1055
1056 return error;
1057}
1058
1059static int __maybe_unused sysc_noirq_suspend(struct device *dev)
1060{
1061 struct sysc *ddata;
1062

--- 87 unchanged lines hidden (view full) ---

1150 SYSC_QUIRK("adc", 0, 0, 0x10, -1, 0x47300001, 0xffffffff, 0),
1151 SYSC_QUIRK("atl", 0, 0, -1, -1, 0x0a070100, 0xffffffff, 0),
1152 SYSC_QUIRK("aess", 0, 0, 0x10, -1, 0x40000000, 0xffffffff, 0),
1153 SYSC_QUIRK("cm", 0, 0, -1, -1, 0x40000301, 0xffffffff, 0),
1154 SYSC_QUIRK("control", 0, 0, 0x10, -1, 0x40000900, 0xffffffff, 0),
1155 SYSC_QUIRK("cpgmac", 0, 0x1200, 0x1208, 0x1204, 0x4edb1902,
1156 0xffff00f0, 0),
1157 SYSC_QUIRK("dcan", 0, 0, -1, -1, 0xffffffff, 0xffffffff, 0),
1131 SYSC_QUIRK("dcan", 0, 0, -1, -1, 0x00001401, 0xffffffff, 0),
1132 SYSC_QUIRK("dmic", 0, 0, 0x10, -1, 0x50010000, 0xffffffff, 0),
1133 SYSC_QUIRK("dwc3", 0, 0, 0x10, -1, 0x500a0200, 0xffffffff, 0),
1134 SYSC_QUIRK("epwmss", 0, 0, 0x4, -1, 0x47400001, 0xffffffff, 0),
1135 SYSC_QUIRK("gpu", 0, 0x1fc00, 0x1fc10, -1, 0, 0, 0),
1136 SYSC_QUIRK("hdq1w", 0, 0, 0x14, 0x18, 0x00000006, 0xffffffff, 0),
1137 SYSC_QUIRK("hdq1w", 0, 0, 0x14, 0x18, 0x0000000a, 0xffffffff, 0),
1138 SYSC_QUIRK("hsi", 0, 0, 0x10, 0x14, 0x50043101, 0xffffffff, 0),
1139 SYSC_QUIRK("iss", 0, 0, 0x10, -1, 0x40000101, 0xffffffff, 0),

--- 101 unchanged lines hidden (view full) ---

1241 (q->revision & q->revision_mask) ==
1242 (ddata->revision & q->revision_mask)) {
1243 ddata->name = q->name;
1244 ddata->cfg.quirks |= q->quirks;
1245 }
1246 }
1247}
1248
1158 SYSC_QUIRK("dmic", 0, 0, 0x10, -1, 0x50010000, 0xffffffff, 0),
1159 SYSC_QUIRK("dwc3", 0, 0, 0x10, -1, 0x500a0200, 0xffffffff, 0),
1160 SYSC_QUIRK("epwmss", 0, 0, 0x4, -1, 0x47400001, 0xffffffff, 0),
1161 SYSC_QUIRK("gpu", 0, 0x1fc00, 0x1fc10, -1, 0, 0, 0),
1162 SYSC_QUIRK("hdq1w", 0, 0, 0x14, 0x18, 0x00000006, 0xffffffff, 0),
1163 SYSC_QUIRK("hdq1w", 0, 0, 0x14, 0x18, 0x0000000a, 0xffffffff, 0),
1164 SYSC_QUIRK("hsi", 0, 0, 0x10, 0x14, 0x50043101, 0xffffffff, 0),
1165 SYSC_QUIRK("iss", 0, 0, 0x10, -1, 0x40000101, 0xffffffff, 0),

--- 101 unchanged lines hidden (view full) ---

1267 (q->revision & q->revision_mask) ==
1268 (ddata->revision & q->revision_mask)) {
1269 ddata->name = q->name;
1270 ddata->cfg.quirks |= q->quirks;
1271 }
1272 }
1273}
1274
1275static int sysc_clockdomain_init(struct sysc *ddata)
1276{
1277 struct ti_sysc_platform_data *pdata = dev_get_platdata(ddata->dev);
1278 struct clk *fck = NULL, *ick = NULL;
1279 int error;
1280
1281 if (!pdata || !pdata->init_clockdomain)
1282 return 0;
1283
1284 switch (ddata->nr_clocks) {
1285 case 2:
1286 ick = ddata->clocks[SYSC_ICK];
1287 /* fallthrough */
1288 case 1:
1289 fck = ddata->clocks[SYSC_FCK];
1290 break;
1291 case 0:
1292 return 0;
1293 }
1294
1295 error = pdata->init_clockdomain(ddata->dev, fck, ick, &ddata->cookie);
1296 if (!error || error == -ENODEV)
1297 return 0;
1298
1299 return error;
1300}
1301
1249/*
1250 * Note that pdata->init_module() typically does a reset first. After
1251 * pdata->init_module() is done, PM runtime can be used for the interconnect
1252 * target module.
1253 */
1254static int sysc_legacy_init(struct sysc *ddata)
1255{
1256 struct ti_sysc_platform_data *pdata = dev_get_platdata(ddata->dev);
1257 int error;
1258
1302/*
1303 * Note that pdata->init_module() typically does a reset first. After
1304 * pdata->init_module() is done, PM runtime can be used for the interconnect
1305 * target module.
1306 */
1307static int sysc_legacy_init(struct sysc *ddata)
1308{
1309 struct ti_sysc_platform_data *pdata = dev_get_platdata(ddata->dev);
1310 int error;
1311
1259 if (!ddata->legacy_mode || !pdata || !pdata->init_module)
1312 if (!pdata || !pdata->init_module)
1260 return 0;
1261
1262 error = pdata->init_module(ddata->dev, ddata->mdata, &ddata->cookie);
1263 if (error == -EEXIST)
1264 error = 0;
1265
1266 return error;
1267}

--- 75 unchanged lines hidden (view full) ---

1343 error = sysc_rstctrl_reset_deassert(ddata, reset);
1344 if (error)
1345 return error;
1346
1347 if (ddata->cfg.quirks &
1348 (SYSC_QUIRK_NO_IDLE | SYSC_QUIRK_NO_IDLE_ON_INIT))
1349 manage_clocks = false;
1350
1313 return 0;
1314
1315 error = pdata->init_module(ddata->dev, ddata->mdata, &ddata->cookie);
1316 if (error == -EEXIST)
1317 error = 0;
1318
1319 return error;
1320}

--- 75 unchanged lines hidden (view full) ---

1396 error = sysc_rstctrl_reset_deassert(ddata, reset);
1397 if (error)
1398 return error;
1399
1400 if (ddata->cfg.quirks &
1401 (SYSC_QUIRK_NO_IDLE | SYSC_QUIRK_NO_IDLE_ON_INIT))
1402 manage_clocks = false;
1403
1404 error = sysc_clockdomain_init(ddata);
1405 if (error)
1406 return error;
1407
1351 if (manage_clocks) {
1408 if (manage_clocks) {
1409 sysc_clkdm_deny_idle(ddata);
1410
1352 error = sysc_enable_opt_clocks(ddata);
1353 if (error)
1354 return error;
1355
1356 error = sysc_enable_main_clocks(ddata);
1357 if (error)
1358 goto err_opt_clocks;
1359 }
1360
1361 ddata->revision = sysc_read_revision(ddata);
1362 sysc_init_revision_quirks(ddata);
1363
1411 error = sysc_enable_opt_clocks(ddata);
1412 if (error)
1413 return error;
1414
1415 error = sysc_enable_main_clocks(ddata);
1416 if (error)
1417 goto err_opt_clocks;
1418 }
1419
1420 ddata->revision = sysc_read_revision(ddata);
1421 sysc_init_revision_quirks(ddata);
1422
1364 error = sysc_legacy_init(ddata);
1365 if (error)
1366 goto err_main_clocks;
1423 if (ddata->legacy_mode) {
1424 error = sysc_legacy_init(ddata);
1425 if (error)
1426 goto err_main_clocks;
1427 }
1367
1428
1429 if (!ddata->legacy_mode && manage_clocks) {
1430 error = sysc_enable_module(ddata->dev);
1431 if (error)
1432 goto err_main_clocks;
1433 }
1434
1368 error = sysc_reset(ddata);
1369 if (error)
1370 dev_err(ddata->dev, "Reset failed with %d\n", error);
1371
1435 error = sysc_reset(ddata);
1436 if (error)
1437 dev_err(ddata->dev, "Reset failed with %d\n", error);
1438
1439 if (!ddata->legacy_mode && manage_clocks)
1440 sysc_disable_module(ddata->dev);
1441
1372err_main_clocks:
1373 if (manage_clocks)
1374 sysc_disable_main_clocks(ddata);
1375err_opt_clocks:
1442err_main_clocks:
1443 if (manage_clocks)
1444 sysc_disable_main_clocks(ddata);
1445err_opt_clocks:
1376 if (manage_clocks)
1446 if (manage_clocks) {
1377 sysc_disable_opt_clocks(ddata);
1447 sysc_disable_opt_clocks(ddata);
1448 sysc_clkdm_allow_idle(ddata);
1449 }
1378
1379 return error;
1380}
1381
1382static int sysc_init_sysc_mask(struct sysc *ddata)
1383{
1384 struct device_node *np = ddata->dev->of_node;
1385 int error;

--- 622 unchanged lines hidden (view full) ---

2008 .regbits = &sysc_regbits_dra7_mcan,
2009};
2010
2011static int sysc_init_pdata(struct sysc *ddata)
2012{
2013 struct ti_sysc_platform_data *pdata = dev_get_platdata(ddata->dev);
2014 struct ti_sysc_module_data *mdata;
2015
1450
1451 return error;
1452}
1453
1454static int sysc_init_sysc_mask(struct sysc *ddata)
1455{
1456 struct device_node *np = ddata->dev->of_node;
1457 int error;

--- 622 unchanged lines hidden (view full) ---

2080 .regbits = &sysc_regbits_dra7_mcan,
2081};
2082
2083static int sysc_init_pdata(struct sysc *ddata)
2084{
2085 struct ti_sysc_platform_data *pdata = dev_get_platdata(ddata->dev);
2086 struct ti_sysc_module_data *mdata;
2087
2016 if (!pdata || !ddata->legacy_mode)
2088 if (!pdata)
2017 return 0;
2018
2019 mdata = devm_kzalloc(ddata->dev, sizeof(*mdata), GFP_KERNEL);
2020 if (!mdata)
2021 return -ENOMEM;
2022
2089 return 0;
2090
2091 mdata = devm_kzalloc(ddata->dev, sizeof(*mdata), GFP_KERNEL);
2092 if (!mdata)
2093 return -ENOMEM;
2094
2023 mdata->name = ddata->legacy_mode;
2024 mdata->module_pa = ddata->module_pa;
2025 mdata->module_size = ddata->module_size;
2026 mdata->offsets = ddata->offsets;
2027 mdata->nr_offsets = SYSC_MAX_REGS;
2028 mdata->cap = ddata->cap;
2029 mdata->cfg = &ddata->cfg;
2095 if (ddata->legacy_mode) {
2096 mdata->name = ddata->legacy_mode;
2097 mdata->module_pa = ddata->module_pa;
2098 mdata->module_size = ddata->module_size;
2099 mdata->offsets = ddata->offsets;
2100 mdata->nr_offsets = SYSC_MAX_REGS;
2101 mdata->cap = ddata->cap;
2102 mdata->cfg = &ddata->cfg;
2103 }
2030
2031 ddata->mdata = mdata;
2032
2033 return 0;
2034}
2035
2036static int sysc_init_match(struct sysc *ddata)
2037{

--- 197 unchanged lines hidden ---
2104
2105 ddata->mdata = mdata;
2106
2107 return 0;
2108}
2109
2110static int sysc_init_match(struct sysc *ddata)
2111{

--- 197 unchanged lines hidden ---