mtk-scpsys.c 27 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070
  1. // SPDX-License-Identifier: GPL-2.0-only
  2. /*
  3. * Copyright (c) 2015 Pengutronix, Sascha Hauer <kernel@pengutronix.de>
  4. */
  5. #include <linux/clk.h>
  6. #include <linux/init.h>
  7. #include <linux/io.h>
  8. #include <linux/iopoll.h>
  9. #include <linux/mfd/syscon.h>
  10. #include <linux/of_device.h>
  11. #include <linux/platform_device.h>
  12. #include <linux/pm_domain.h>
  13. #include <linux/regulator/consumer.h>
  14. #include <linux/soc/mediatek/infracfg.h>
  15. #include <dt-bindings/power/mt2701-power.h>
  16. #include <dt-bindings/power/mt2712-power.h>
  17. #include <dt-bindings/power/mt6797-power.h>
  18. #include <dt-bindings/power/mt7622-power.h>
  19. #include <dt-bindings/power/mt7623a-power.h>
  20. #include <dt-bindings/power/mt8173-power.h>
  21. #define MTK_POLL_DELAY_US 10
  22. #define MTK_POLL_TIMEOUT (jiffies_to_usecs(HZ))
  23. #define MTK_SCPD_ACTIVE_WAKEUP BIT(0)
  24. #define MTK_SCPD_FWAIT_SRAM BIT(1)
  25. #define MTK_SCPD_CAPS(_scpd, _x) ((_scpd)->data->caps & (_x))
  26. #define SPM_VDE_PWR_CON 0x0210
  27. #define SPM_MFG_PWR_CON 0x0214
  28. #define SPM_VEN_PWR_CON 0x0230
  29. #define SPM_ISP_PWR_CON 0x0238
  30. #define SPM_DIS_PWR_CON 0x023c
  31. #define SPM_CONN_PWR_CON 0x0280
  32. #define SPM_VEN2_PWR_CON 0x0298
  33. #define SPM_AUDIO_PWR_CON 0x029c /* MT8173, MT2712 */
  34. #define SPM_BDP_PWR_CON 0x029c /* MT2701 */
  35. #define SPM_ETH_PWR_CON 0x02a0
  36. #define SPM_HIF_PWR_CON 0x02a4
  37. #define SPM_IFR_MSC_PWR_CON 0x02a8
  38. #define SPM_MFG_2D_PWR_CON 0x02c0
  39. #define SPM_MFG_ASYNC_PWR_CON 0x02c4
  40. #define SPM_USB_PWR_CON 0x02cc
  41. #define SPM_USB2_PWR_CON 0x02d4 /* MT2712 */
  42. #define SPM_ETHSYS_PWR_CON 0x02e0 /* MT7622 */
  43. #define SPM_HIF0_PWR_CON 0x02e4 /* MT7622 */
  44. #define SPM_HIF1_PWR_CON 0x02e8 /* MT7622 */
  45. #define SPM_WB_PWR_CON 0x02ec /* MT7622 */
  46. #define SPM_PWR_STATUS 0x060c
  47. #define SPM_PWR_STATUS_2ND 0x0610
  48. #define PWR_RST_B_BIT BIT(0)
  49. #define PWR_ISO_BIT BIT(1)
  50. #define PWR_ON_BIT BIT(2)
  51. #define PWR_ON_2ND_BIT BIT(3)
  52. #define PWR_CLK_DIS_BIT BIT(4)
  53. #define PWR_STATUS_CONN BIT(1)
  54. #define PWR_STATUS_DISP BIT(3)
  55. #define PWR_STATUS_MFG BIT(4)
  56. #define PWR_STATUS_ISP BIT(5)
  57. #define PWR_STATUS_VDEC BIT(7)
  58. #define PWR_STATUS_BDP BIT(14)
  59. #define PWR_STATUS_ETH BIT(15)
  60. #define PWR_STATUS_HIF BIT(16)
  61. #define PWR_STATUS_IFR_MSC BIT(17)
  62. #define PWR_STATUS_USB2 BIT(19) /* MT2712 */
  63. #define PWR_STATUS_VENC_LT BIT(20)
  64. #define PWR_STATUS_VENC BIT(21)
  65. #define PWR_STATUS_MFG_2D BIT(22) /* MT8173 */
  66. #define PWR_STATUS_MFG_ASYNC BIT(23) /* MT8173 */
  67. #define PWR_STATUS_AUDIO BIT(24) /* MT8173, MT2712 */
  68. #define PWR_STATUS_USB BIT(25) /* MT8173, MT2712 */
  69. #define PWR_STATUS_ETHSYS BIT(24) /* MT7622 */
  70. #define PWR_STATUS_HIF0 BIT(25) /* MT7622 */
  71. #define PWR_STATUS_HIF1 BIT(26) /* MT7622 */
  72. #define PWR_STATUS_WB BIT(27) /* MT7622 */
  73. enum clk_id {
  74. CLK_NONE,
  75. CLK_MM,
  76. CLK_MFG,
  77. CLK_VENC,
  78. CLK_VENC_LT,
  79. CLK_ETHIF,
  80. CLK_VDEC,
  81. CLK_HIFSEL,
  82. CLK_JPGDEC,
  83. CLK_AUDIO,
  84. CLK_MAX,
  85. };
  86. static const char * const clk_names[] = {
  87. NULL,
  88. "mm",
  89. "mfg",
  90. "venc",
  91. "venc_lt",
  92. "ethif",
  93. "vdec",
  94. "hif_sel",
  95. "jpgdec",
  96. "audio",
  97. NULL,
  98. };
  99. #define MAX_CLKS 3
  100. struct scp_domain_data {
  101. const char *name;
  102. u32 sta_mask;
  103. int ctl_offs;
  104. u32 sram_pdn_bits;
  105. u32 sram_pdn_ack_bits;
  106. u32 bus_prot_mask;
  107. enum clk_id clk_id[MAX_CLKS];
  108. u8 caps;
  109. };
  110. struct scp;
  111. struct scp_domain {
  112. struct generic_pm_domain genpd;
  113. struct scp *scp;
  114. struct clk *clk[MAX_CLKS];
  115. const struct scp_domain_data *data;
  116. struct regulator *supply;
  117. };
  118. struct scp_ctrl_reg {
  119. int pwr_sta_offs;
  120. int pwr_sta2nd_offs;
  121. };
  122. struct scp {
  123. struct scp_domain *domains;
  124. struct genpd_onecell_data pd_data;
  125. struct device *dev;
  126. void __iomem *base;
  127. struct regmap *infracfg;
  128. struct scp_ctrl_reg ctrl_reg;
  129. bool bus_prot_reg_update;
  130. };
  131. struct scp_subdomain {
  132. int origin;
  133. int subdomain;
  134. };
  135. struct scp_soc_data {
  136. const struct scp_domain_data *domains;
  137. int num_domains;
  138. const struct scp_subdomain *subdomains;
  139. int num_subdomains;
  140. const struct scp_ctrl_reg regs;
  141. bool bus_prot_reg_update;
  142. };
  143. static int scpsys_domain_is_on(struct scp_domain *scpd)
  144. {
  145. struct scp *scp = scpd->scp;
  146. u32 status = readl(scp->base + scp->ctrl_reg.pwr_sta_offs) &
  147. scpd->data->sta_mask;
  148. u32 status2 = readl(scp->base + scp->ctrl_reg.pwr_sta2nd_offs) &
  149. scpd->data->sta_mask;
  150. /*
  151. * A domain is on when both status bits are set. If only one is set
  152. * return an error. This happens while powering up a domain
  153. */
  154. if (status && status2)
  155. return true;
  156. if (!status && !status2)
  157. return false;
  158. return -EINVAL;
  159. }
  160. static int scpsys_power_on(struct generic_pm_domain *genpd)
  161. {
  162. struct scp_domain *scpd = container_of(genpd, struct scp_domain, genpd);
  163. struct scp *scp = scpd->scp;
  164. void __iomem *ctl_addr = scp->base + scpd->data->ctl_offs;
  165. u32 pdn_ack = scpd->data->sram_pdn_ack_bits;
  166. u32 val;
  167. int ret, tmp;
  168. int i;
  169. if (scpd->supply) {
  170. ret = regulator_enable(scpd->supply);
  171. if (ret)
  172. return ret;
  173. }
  174. for (i = 0; i < MAX_CLKS && scpd->clk[i]; i++) {
  175. ret = clk_prepare_enable(scpd->clk[i]);
  176. if (ret) {
  177. for (--i; i >= 0; i--)
  178. clk_disable_unprepare(scpd->clk[i]);
  179. goto err_clk;
  180. }
  181. }
  182. val = readl(ctl_addr);
  183. val |= PWR_ON_BIT;
  184. writel(val, ctl_addr);
  185. val |= PWR_ON_2ND_BIT;
  186. writel(val, ctl_addr);
  187. /* wait until PWR_ACK = 1 */
  188. ret = readx_poll_timeout(scpsys_domain_is_on, scpd, tmp, tmp > 0,
  189. MTK_POLL_DELAY_US, MTK_POLL_TIMEOUT);
  190. if (ret < 0)
  191. goto err_pwr_ack;
  192. val &= ~PWR_CLK_DIS_BIT;
  193. writel(val, ctl_addr);
  194. val &= ~PWR_ISO_BIT;
  195. writel(val, ctl_addr);
  196. val |= PWR_RST_B_BIT;
  197. writel(val, ctl_addr);
  198. val &= ~scpd->data->sram_pdn_bits;
  199. writel(val, ctl_addr);
  200. /* Either wait until SRAM_PDN_ACK all 0 or have a force wait */
  201. if (MTK_SCPD_CAPS(scpd, MTK_SCPD_FWAIT_SRAM)) {
  202. /*
  203. * Currently, MTK_SCPD_FWAIT_SRAM is necessary only for
  204. * MT7622_POWER_DOMAIN_WB and thus just a trivial setup is
  205. * applied here.
  206. */
  207. usleep_range(12000, 12100);
  208. } else {
  209. ret = readl_poll_timeout(ctl_addr, tmp, (tmp & pdn_ack) == 0,
  210. MTK_POLL_DELAY_US, MTK_POLL_TIMEOUT);
  211. if (ret < 0)
  212. goto err_pwr_ack;
  213. }
  214. if (scpd->data->bus_prot_mask) {
  215. ret = mtk_infracfg_clear_bus_protection(scp->infracfg,
  216. scpd->data->bus_prot_mask,
  217. scp->bus_prot_reg_update);
  218. if (ret)
  219. goto err_pwr_ack;
  220. }
  221. return 0;
  222. err_pwr_ack:
  223. for (i = MAX_CLKS - 1; i >= 0; i--) {
  224. if (scpd->clk[i])
  225. clk_disable_unprepare(scpd->clk[i]);
  226. }
  227. err_clk:
  228. if (scpd->supply)
  229. regulator_disable(scpd->supply);
  230. dev_err(scp->dev, "Failed to power on domain %s\n", genpd->name);
  231. return ret;
  232. }
  233. static int scpsys_power_off(struct generic_pm_domain *genpd)
  234. {
  235. struct scp_domain *scpd = container_of(genpd, struct scp_domain, genpd);
  236. struct scp *scp = scpd->scp;
  237. void __iomem *ctl_addr = scp->base + scpd->data->ctl_offs;
  238. u32 pdn_ack = scpd->data->sram_pdn_ack_bits;
  239. u32 val;
  240. int ret, tmp;
  241. int i;
  242. if (scpd->data->bus_prot_mask) {
  243. ret = mtk_infracfg_set_bus_protection(scp->infracfg,
  244. scpd->data->bus_prot_mask,
  245. scp->bus_prot_reg_update);
  246. if (ret)
  247. goto out;
  248. }
  249. val = readl(ctl_addr);
  250. val |= scpd->data->sram_pdn_bits;
  251. writel(val, ctl_addr);
  252. /* wait until SRAM_PDN_ACK all 1 */
  253. ret = readl_poll_timeout(ctl_addr, tmp, (tmp & pdn_ack) == pdn_ack,
  254. MTK_POLL_DELAY_US, MTK_POLL_TIMEOUT);
  255. if (ret < 0)
  256. goto out;
  257. val |= PWR_ISO_BIT;
  258. writel(val, ctl_addr);
  259. val &= ~PWR_RST_B_BIT;
  260. writel(val, ctl_addr);
  261. val |= PWR_CLK_DIS_BIT;
  262. writel(val, ctl_addr);
  263. val &= ~PWR_ON_BIT;
  264. writel(val, ctl_addr);
  265. val &= ~PWR_ON_2ND_BIT;
  266. writel(val, ctl_addr);
  267. /* wait until PWR_ACK = 0 */
  268. ret = readx_poll_timeout(scpsys_domain_is_on, scpd, tmp, tmp == 0,
  269. MTK_POLL_DELAY_US, MTK_POLL_TIMEOUT);
  270. if (ret < 0)
  271. goto out;
  272. for (i = 0; i < MAX_CLKS && scpd->clk[i]; i++)
  273. clk_disable_unprepare(scpd->clk[i]);
  274. if (scpd->supply)
  275. regulator_disable(scpd->supply);
  276. return 0;
  277. out:
  278. dev_err(scp->dev, "Failed to power off domain %s\n", genpd->name);
  279. return ret;
  280. }
  281. static void init_clks(struct platform_device *pdev, struct clk **clk)
  282. {
  283. int i;
  284. for (i = CLK_NONE + 1; i < CLK_MAX; i++)
  285. clk[i] = devm_clk_get(&pdev->dev, clk_names[i]);
  286. }
  287. static struct scp *init_scp(struct platform_device *pdev,
  288. const struct scp_domain_data *scp_domain_data, int num,
  289. const struct scp_ctrl_reg *scp_ctrl_reg,
  290. bool bus_prot_reg_update)
  291. {
  292. struct genpd_onecell_data *pd_data;
  293. struct resource *res;
  294. int i, j;
  295. struct scp *scp;
  296. struct clk *clk[CLK_MAX];
  297. scp = devm_kzalloc(&pdev->dev, sizeof(*scp), GFP_KERNEL);
  298. if (!scp)
  299. return ERR_PTR(-ENOMEM);
  300. scp->ctrl_reg.pwr_sta_offs = scp_ctrl_reg->pwr_sta_offs;
  301. scp->ctrl_reg.pwr_sta2nd_offs = scp_ctrl_reg->pwr_sta2nd_offs;
  302. scp->bus_prot_reg_update = bus_prot_reg_update;
  303. scp->dev = &pdev->dev;
  304. res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
  305. scp->base = devm_ioremap_resource(&pdev->dev, res);
  306. if (IS_ERR(scp->base))
  307. return ERR_CAST(scp->base);
  308. scp->domains = devm_kcalloc(&pdev->dev,
  309. num, sizeof(*scp->domains), GFP_KERNEL);
  310. if (!scp->domains)
  311. return ERR_PTR(-ENOMEM);
  312. pd_data = &scp->pd_data;
  313. pd_data->domains = devm_kcalloc(&pdev->dev,
  314. num, sizeof(*pd_data->domains), GFP_KERNEL);
  315. if (!pd_data->domains)
  316. return ERR_PTR(-ENOMEM);
  317. scp->infracfg = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
  318. "infracfg");
  319. if (IS_ERR(scp->infracfg)) {
  320. dev_err(&pdev->dev, "Cannot find infracfg controller: %ld\n",
  321. PTR_ERR(scp->infracfg));
  322. return ERR_CAST(scp->infracfg);
  323. }
  324. for (i = 0; i < num; i++) {
  325. struct scp_domain *scpd = &scp->domains[i];
  326. const struct scp_domain_data *data = &scp_domain_data[i];
  327. scpd->supply = devm_regulator_get_optional(&pdev->dev, data->name);
  328. if (IS_ERR(scpd->supply)) {
  329. if (PTR_ERR(scpd->supply) == -ENODEV)
  330. scpd->supply = NULL;
  331. else
  332. return ERR_CAST(scpd->supply);
  333. }
  334. }
  335. pd_data->num_domains = num;
  336. init_clks(pdev, clk);
  337. for (i = 0; i < num; i++) {
  338. struct scp_domain *scpd = &scp->domains[i];
  339. struct generic_pm_domain *genpd = &scpd->genpd;
  340. const struct scp_domain_data *data = &scp_domain_data[i];
  341. pd_data->domains[i] = genpd;
  342. scpd->scp = scp;
  343. scpd->data = data;
  344. for (j = 0; j < MAX_CLKS && data->clk_id[j]; j++) {
  345. struct clk *c = clk[data->clk_id[j]];
  346. if (IS_ERR(c)) {
  347. dev_err(&pdev->dev, "%s: clk unavailable\n",
  348. data->name);
  349. return ERR_CAST(c);
  350. }
  351. scpd->clk[j] = c;
  352. }
  353. genpd->name = data->name;
  354. genpd->power_off = scpsys_power_off;
  355. genpd->power_on = scpsys_power_on;
  356. if (MTK_SCPD_CAPS(scpd, MTK_SCPD_ACTIVE_WAKEUP))
  357. genpd->flags |= GENPD_FLAG_ACTIVE_WAKEUP;
  358. }
  359. return scp;
  360. }
  361. static void mtk_register_power_domains(struct platform_device *pdev,
  362. struct scp *scp, int num)
  363. {
  364. struct genpd_onecell_data *pd_data;
  365. int i, ret;
  366. for (i = 0; i < num; i++) {
  367. struct scp_domain *scpd = &scp->domains[i];
  368. struct generic_pm_domain *genpd = &scpd->genpd;
  369. bool on;
  370. /*
  371. * Initially turn on all domains to make the domains usable
  372. * with !CONFIG_PM and to get the hardware in sync with the
  373. * software. The unused domains will be switched off during
  374. * late_init time.
  375. */
  376. on = !WARN_ON(genpd->power_on(genpd) < 0);
  377. pm_genpd_init(genpd, NULL, !on);
  378. }
  379. /*
  380. * We are not allowed to fail here since there is no way to unregister
  381. * a power domain. Once registered above we have to keep the domains
  382. * valid.
  383. */
  384. pd_data = &scp->pd_data;
  385. ret = of_genpd_add_provider_onecell(pdev->dev.of_node, pd_data);
  386. if (ret)
  387. dev_err(&pdev->dev, "Failed to add OF provider: %d\n", ret);
  388. }
  389. /*
  390. * MT2701 power domain support
  391. */
  392. static const struct scp_domain_data scp_domain_data_mt2701[] = {
  393. [MT2701_POWER_DOMAIN_CONN] = {
  394. .name = "conn",
  395. .sta_mask = PWR_STATUS_CONN,
  396. .ctl_offs = SPM_CONN_PWR_CON,
  397. .bus_prot_mask = MT2701_TOP_AXI_PROT_EN_CONN_M |
  398. MT2701_TOP_AXI_PROT_EN_CONN_S,
  399. .clk_id = {CLK_NONE},
  400. .caps = MTK_SCPD_ACTIVE_WAKEUP,
  401. },
  402. [MT2701_POWER_DOMAIN_DISP] = {
  403. .name = "disp",
  404. .sta_mask = PWR_STATUS_DISP,
  405. .ctl_offs = SPM_DIS_PWR_CON,
  406. .sram_pdn_bits = GENMASK(11, 8),
  407. .clk_id = {CLK_MM},
  408. .bus_prot_mask = MT2701_TOP_AXI_PROT_EN_MM_M0,
  409. .caps = MTK_SCPD_ACTIVE_WAKEUP,
  410. },
  411. [MT2701_POWER_DOMAIN_MFG] = {
  412. .name = "mfg",
  413. .sta_mask = PWR_STATUS_MFG,
  414. .ctl_offs = SPM_MFG_PWR_CON,
  415. .sram_pdn_bits = GENMASK(11, 8),
  416. .sram_pdn_ack_bits = GENMASK(12, 12),
  417. .clk_id = {CLK_MFG},
  418. .caps = MTK_SCPD_ACTIVE_WAKEUP,
  419. },
  420. [MT2701_POWER_DOMAIN_VDEC] = {
  421. .name = "vdec",
  422. .sta_mask = PWR_STATUS_VDEC,
  423. .ctl_offs = SPM_VDE_PWR_CON,
  424. .sram_pdn_bits = GENMASK(11, 8),
  425. .sram_pdn_ack_bits = GENMASK(12, 12),
  426. .clk_id = {CLK_MM},
  427. .caps = MTK_SCPD_ACTIVE_WAKEUP,
  428. },
  429. [MT2701_POWER_DOMAIN_ISP] = {
  430. .name = "isp",
  431. .sta_mask = PWR_STATUS_ISP,
  432. .ctl_offs = SPM_ISP_PWR_CON,
  433. .sram_pdn_bits = GENMASK(11, 8),
  434. .sram_pdn_ack_bits = GENMASK(13, 12),
  435. .clk_id = {CLK_MM},
  436. .caps = MTK_SCPD_ACTIVE_WAKEUP,
  437. },
  438. [MT2701_POWER_DOMAIN_BDP] = {
  439. .name = "bdp",
  440. .sta_mask = PWR_STATUS_BDP,
  441. .ctl_offs = SPM_BDP_PWR_CON,
  442. .sram_pdn_bits = GENMASK(11, 8),
  443. .clk_id = {CLK_NONE},
  444. .caps = MTK_SCPD_ACTIVE_WAKEUP,
  445. },
  446. [MT2701_POWER_DOMAIN_ETH] = {
  447. .name = "eth",
  448. .sta_mask = PWR_STATUS_ETH,
  449. .ctl_offs = SPM_ETH_PWR_CON,
  450. .sram_pdn_bits = GENMASK(11, 8),
  451. .sram_pdn_ack_bits = GENMASK(15, 12),
  452. .clk_id = {CLK_ETHIF},
  453. .caps = MTK_SCPD_ACTIVE_WAKEUP,
  454. },
  455. [MT2701_POWER_DOMAIN_HIF] = {
  456. .name = "hif",
  457. .sta_mask = PWR_STATUS_HIF,
  458. .ctl_offs = SPM_HIF_PWR_CON,
  459. .sram_pdn_bits = GENMASK(11, 8),
  460. .sram_pdn_ack_bits = GENMASK(15, 12),
  461. .clk_id = {CLK_ETHIF},
  462. .caps = MTK_SCPD_ACTIVE_WAKEUP,
  463. },
  464. [MT2701_POWER_DOMAIN_IFR_MSC] = {
  465. .name = "ifr_msc",
  466. .sta_mask = PWR_STATUS_IFR_MSC,
  467. .ctl_offs = SPM_IFR_MSC_PWR_CON,
  468. .clk_id = {CLK_NONE},
  469. .caps = MTK_SCPD_ACTIVE_WAKEUP,
  470. },
  471. };
  472. /*
  473. * MT2712 power domain support
  474. */
  475. static const struct scp_domain_data scp_domain_data_mt2712[] = {
  476. [MT2712_POWER_DOMAIN_MM] = {
  477. .name = "mm",
  478. .sta_mask = PWR_STATUS_DISP,
  479. .ctl_offs = SPM_DIS_PWR_CON,
  480. .sram_pdn_bits = GENMASK(8, 8),
  481. .sram_pdn_ack_bits = GENMASK(12, 12),
  482. .clk_id = {CLK_MM},
  483. .caps = MTK_SCPD_ACTIVE_WAKEUP,
  484. },
  485. [MT2712_POWER_DOMAIN_VDEC] = {
  486. .name = "vdec",
  487. .sta_mask = PWR_STATUS_VDEC,
  488. .ctl_offs = SPM_VDE_PWR_CON,
  489. .sram_pdn_bits = GENMASK(8, 8),
  490. .sram_pdn_ack_bits = GENMASK(12, 12),
  491. .clk_id = {CLK_MM, CLK_VDEC},
  492. .caps = MTK_SCPD_ACTIVE_WAKEUP,
  493. },
  494. [MT2712_POWER_DOMAIN_VENC] = {
  495. .name = "venc",
  496. .sta_mask = PWR_STATUS_VENC,
  497. .ctl_offs = SPM_VEN_PWR_CON,
  498. .sram_pdn_bits = GENMASK(11, 8),
  499. .sram_pdn_ack_bits = GENMASK(15, 12),
  500. .clk_id = {CLK_MM, CLK_VENC, CLK_JPGDEC},
  501. .caps = MTK_SCPD_ACTIVE_WAKEUP,
  502. },
  503. [MT2712_POWER_DOMAIN_ISP] = {
  504. .name = "isp",
  505. .sta_mask = PWR_STATUS_ISP,
  506. .ctl_offs = SPM_ISP_PWR_CON,
  507. .sram_pdn_bits = GENMASK(11, 8),
  508. .sram_pdn_ack_bits = GENMASK(13, 12),
  509. .clk_id = {CLK_MM},
  510. .caps = MTK_SCPD_ACTIVE_WAKEUP,
  511. },
  512. [MT2712_POWER_DOMAIN_AUDIO] = {
  513. .name = "audio",
  514. .sta_mask = PWR_STATUS_AUDIO,
  515. .ctl_offs = SPM_AUDIO_PWR_CON,
  516. .sram_pdn_bits = GENMASK(11, 8),
  517. .sram_pdn_ack_bits = GENMASK(15, 12),
  518. .clk_id = {CLK_AUDIO},
  519. .caps = MTK_SCPD_ACTIVE_WAKEUP,
  520. },
  521. [MT2712_POWER_DOMAIN_USB] = {
  522. .name = "usb",
  523. .sta_mask = PWR_STATUS_USB,
  524. .ctl_offs = SPM_USB_PWR_CON,
  525. .sram_pdn_bits = GENMASK(10, 8),
  526. .sram_pdn_ack_bits = GENMASK(14, 12),
  527. .clk_id = {CLK_NONE},
  528. .caps = MTK_SCPD_ACTIVE_WAKEUP,
  529. },
  530. [MT2712_POWER_DOMAIN_USB2] = {
  531. .name = "usb2",
  532. .sta_mask = PWR_STATUS_USB2,
  533. .ctl_offs = SPM_USB2_PWR_CON,
  534. .sram_pdn_bits = GENMASK(10, 8),
  535. .sram_pdn_ack_bits = GENMASK(14, 12),
  536. .clk_id = {CLK_NONE},
  537. .caps = MTK_SCPD_ACTIVE_WAKEUP,
  538. },
  539. [MT2712_POWER_DOMAIN_MFG] = {
  540. .name = "mfg",
  541. .sta_mask = PWR_STATUS_MFG,
  542. .ctl_offs = SPM_MFG_PWR_CON,
  543. .sram_pdn_bits = GENMASK(8, 8),
  544. .sram_pdn_ack_bits = GENMASK(16, 16),
  545. .clk_id = {CLK_MFG},
  546. .bus_prot_mask = BIT(14) | BIT(21) | BIT(23),
  547. .caps = MTK_SCPD_ACTIVE_WAKEUP,
  548. },
  549. [MT2712_POWER_DOMAIN_MFG_SC1] = {
  550. .name = "mfg_sc1",
  551. .sta_mask = BIT(22),
  552. .ctl_offs = 0x02c0,
  553. .sram_pdn_bits = GENMASK(8, 8),
  554. .sram_pdn_ack_bits = GENMASK(16, 16),
  555. .clk_id = {CLK_NONE},
  556. .caps = MTK_SCPD_ACTIVE_WAKEUP,
  557. },
  558. [MT2712_POWER_DOMAIN_MFG_SC2] = {
  559. .name = "mfg_sc2",
  560. .sta_mask = BIT(23),
  561. .ctl_offs = 0x02c4,
  562. .sram_pdn_bits = GENMASK(8, 8),
  563. .sram_pdn_ack_bits = GENMASK(16, 16),
  564. .clk_id = {CLK_NONE},
  565. .caps = MTK_SCPD_ACTIVE_WAKEUP,
  566. },
  567. [MT2712_POWER_DOMAIN_MFG_SC3] = {
  568. .name = "mfg_sc3",
  569. .sta_mask = BIT(30),
  570. .ctl_offs = 0x01f8,
  571. .sram_pdn_bits = GENMASK(8, 8),
  572. .sram_pdn_ack_bits = GENMASK(16, 16),
  573. .clk_id = {CLK_NONE},
  574. .caps = MTK_SCPD_ACTIVE_WAKEUP,
  575. },
  576. };
  577. static const struct scp_subdomain scp_subdomain_mt2712[] = {
  578. {MT2712_POWER_DOMAIN_MM, MT2712_POWER_DOMAIN_VDEC},
  579. {MT2712_POWER_DOMAIN_MM, MT2712_POWER_DOMAIN_VENC},
  580. {MT2712_POWER_DOMAIN_MM, MT2712_POWER_DOMAIN_ISP},
  581. {MT2712_POWER_DOMAIN_MFG, MT2712_POWER_DOMAIN_MFG_SC1},
  582. {MT2712_POWER_DOMAIN_MFG_SC1, MT2712_POWER_DOMAIN_MFG_SC2},
  583. {MT2712_POWER_DOMAIN_MFG_SC2, MT2712_POWER_DOMAIN_MFG_SC3},
  584. };
  585. /*
  586. * MT6797 power domain support
  587. */
  588. static const struct scp_domain_data scp_domain_data_mt6797[] = {
  589. [MT6797_POWER_DOMAIN_VDEC] = {
  590. .name = "vdec",
  591. .sta_mask = BIT(7),
  592. .ctl_offs = 0x300,
  593. .sram_pdn_bits = GENMASK(8, 8),
  594. .sram_pdn_ack_bits = GENMASK(12, 12),
  595. .clk_id = {CLK_VDEC},
  596. },
  597. [MT6797_POWER_DOMAIN_VENC] = {
  598. .name = "venc",
  599. .sta_mask = BIT(21),
  600. .ctl_offs = 0x304,
  601. .sram_pdn_bits = GENMASK(11, 8),
  602. .sram_pdn_ack_bits = GENMASK(15, 12),
  603. .clk_id = {CLK_NONE},
  604. },
  605. [MT6797_POWER_DOMAIN_ISP] = {
  606. .name = "isp",
  607. .sta_mask = BIT(5),
  608. .ctl_offs = 0x308,
  609. .sram_pdn_bits = GENMASK(9, 8),
  610. .sram_pdn_ack_bits = GENMASK(13, 12),
  611. .clk_id = {CLK_NONE},
  612. },
  613. [MT6797_POWER_DOMAIN_MM] = {
  614. .name = "mm",
  615. .sta_mask = BIT(3),
  616. .ctl_offs = 0x30C,
  617. .sram_pdn_bits = GENMASK(8, 8),
  618. .sram_pdn_ack_bits = GENMASK(12, 12),
  619. .clk_id = {CLK_MM},
  620. .bus_prot_mask = (BIT(1) | BIT(2)),
  621. },
  622. [MT6797_POWER_DOMAIN_AUDIO] = {
  623. .name = "audio",
  624. .sta_mask = BIT(24),
  625. .ctl_offs = 0x314,
  626. .sram_pdn_bits = GENMASK(11, 8),
  627. .sram_pdn_ack_bits = GENMASK(15, 12),
  628. .clk_id = {CLK_NONE},
  629. },
  630. [MT6797_POWER_DOMAIN_MFG_ASYNC] = {
  631. .name = "mfg_async",
  632. .sta_mask = BIT(13),
  633. .ctl_offs = 0x334,
  634. .sram_pdn_bits = 0,
  635. .sram_pdn_ack_bits = 0,
  636. .clk_id = {CLK_MFG},
  637. },
  638. [MT6797_POWER_DOMAIN_MJC] = {
  639. .name = "mjc",
  640. .sta_mask = BIT(20),
  641. .ctl_offs = 0x310,
  642. .sram_pdn_bits = GENMASK(8, 8),
  643. .sram_pdn_ack_bits = GENMASK(12, 12),
  644. .clk_id = {CLK_NONE},
  645. },
  646. };
  647. #define SPM_PWR_STATUS_MT6797 0x0180
  648. #define SPM_PWR_STATUS_2ND_MT6797 0x0184
  649. static const struct scp_subdomain scp_subdomain_mt6797[] = {
  650. {MT6797_POWER_DOMAIN_MM, MT6797_POWER_DOMAIN_VDEC},
  651. {MT6797_POWER_DOMAIN_MM, MT6797_POWER_DOMAIN_ISP},
  652. {MT6797_POWER_DOMAIN_MM, MT6797_POWER_DOMAIN_VENC},
  653. {MT6797_POWER_DOMAIN_MM, MT6797_POWER_DOMAIN_MJC},
  654. };
  655. /*
  656. * MT7622 power domain support
  657. */
  658. static const struct scp_domain_data scp_domain_data_mt7622[] = {
  659. [MT7622_POWER_DOMAIN_ETHSYS] = {
  660. .name = "ethsys",
  661. .sta_mask = PWR_STATUS_ETHSYS,
  662. .ctl_offs = SPM_ETHSYS_PWR_CON,
  663. .sram_pdn_bits = GENMASK(11, 8),
  664. .sram_pdn_ack_bits = GENMASK(15, 12),
  665. .clk_id = {CLK_NONE},
  666. .bus_prot_mask = MT7622_TOP_AXI_PROT_EN_ETHSYS,
  667. .caps = MTK_SCPD_ACTIVE_WAKEUP,
  668. },
  669. [MT7622_POWER_DOMAIN_HIF0] = {
  670. .name = "hif0",
  671. .sta_mask = PWR_STATUS_HIF0,
  672. .ctl_offs = SPM_HIF0_PWR_CON,
  673. .sram_pdn_bits = GENMASK(11, 8),
  674. .sram_pdn_ack_bits = GENMASK(15, 12),
  675. .clk_id = {CLK_HIFSEL},
  676. .bus_prot_mask = MT7622_TOP_AXI_PROT_EN_HIF0,
  677. .caps = MTK_SCPD_ACTIVE_WAKEUP,
  678. },
  679. [MT7622_POWER_DOMAIN_HIF1] = {
  680. .name = "hif1",
  681. .sta_mask = PWR_STATUS_HIF1,
  682. .ctl_offs = SPM_HIF1_PWR_CON,
  683. .sram_pdn_bits = GENMASK(11, 8),
  684. .sram_pdn_ack_bits = GENMASK(15, 12),
  685. .clk_id = {CLK_HIFSEL},
  686. .bus_prot_mask = MT7622_TOP_AXI_PROT_EN_HIF1,
  687. .caps = MTK_SCPD_ACTIVE_WAKEUP,
  688. },
  689. [MT7622_POWER_DOMAIN_WB] = {
  690. .name = "wb",
  691. .sta_mask = PWR_STATUS_WB,
  692. .ctl_offs = SPM_WB_PWR_CON,
  693. .sram_pdn_bits = 0,
  694. .sram_pdn_ack_bits = 0,
  695. .clk_id = {CLK_NONE},
  696. .bus_prot_mask = MT7622_TOP_AXI_PROT_EN_WB,
  697. .caps = MTK_SCPD_ACTIVE_WAKEUP | MTK_SCPD_FWAIT_SRAM,
  698. },
  699. };
  700. /*
  701. * MT7623A power domain support
  702. */
  703. static const struct scp_domain_data scp_domain_data_mt7623a[] = {
  704. [MT7623A_POWER_DOMAIN_CONN] = {
  705. .name = "conn",
  706. .sta_mask = PWR_STATUS_CONN,
  707. .ctl_offs = SPM_CONN_PWR_CON,
  708. .bus_prot_mask = MT2701_TOP_AXI_PROT_EN_CONN_M |
  709. MT2701_TOP_AXI_PROT_EN_CONN_S,
  710. .clk_id = {CLK_NONE},
  711. .caps = MTK_SCPD_ACTIVE_WAKEUP,
  712. },
  713. [MT7623A_POWER_DOMAIN_ETH] = {
  714. .name = "eth",
  715. .sta_mask = PWR_STATUS_ETH,
  716. .ctl_offs = SPM_ETH_PWR_CON,
  717. .sram_pdn_bits = GENMASK(11, 8),
  718. .sram_pdn_ack_bits = GENMASK(15, 12),
  719. .clk_id = {CLK_ETHIF},
  720. .caps = MTK_SCPD_ACTIVE_WAKEUP,
  721. },
  722. [MT7623A_POWER_DOMAIN_HIF] = {
  723. .name = "hif",
  724. .sta_mask = PWR_STATUS_HIF,
  725. .ctl_offs = SPM_HIF_PWR_CON,
  726. .sram_pdn_bits = GENMASK(11, 8),
  727. .sram_pdn_ack_bits = GENMASK(15, 12),
  728. .clk_id = {CLK_ETHIF},
  729. .caps = MTK_SCPD_ACTIVE_WAKEUP,
  730. },
  731. [MT7623A_POWER_DOMAIN_IFR_MSC] = {
  732. .name = "ifr_msc",
  733. .sta_mask = PWR_STATUS_IFR_MSC,
  734. .ctl_offs = SPM_IFR_MSC_PWR_CON,
  735. .clk_id = {CLK_NONE},
  736. .caps = MTK_SCPD_ACTIVE_WAKEUP,
  737. },
  738. };
  739. /*
  740. * MT8173 power domain support
  741. */
  742. static const struct scp_domain_data scp_domain_data_mt8173[] = {
  743. [MT8173_POWER_DOMAIN_VDEC] = {
  744. .name = "vdec",
  745. .sta_mask = PWR_STATUS_VDEC,
  746. .ctl_offs = SPM_VDE_PWR_CON,
  747. .sram_pdn_bits = GENMASK(11, 8),
  748. .sram_pdn_ack_bits = GENMASK(12, 12),
  749. .clk_id = {CLK_MM},
  750. },
  751. [MT8173_POWER_DOMAIN_VENC] = {
  752. .name = "venc",
  753. .sta_mask = PWR_STATUS_VENC,
  754. .ctl_offs = SPM_VEN_PWR_CON,
  755. .sram_pdn_bits = GENMASK(11, 8),
  756. .sram_pdn_ack_bits = GENMASK(15, 12),
  757. .clk_id = {CLK_MM, CLK_VENC},
  758. },
  759. [MT8173_POWER_DOMAIN_ISP] = {
  760. .name = "isp",
  761. .sta_mask = PWR_STATUS_ISP,
  762. .ctl_offs = SPM_ISP_PWR_CON,
  763. .sram_pdn_bits = GENMASK(11, 8),
  764. .sram_pdn_ack_bits = GENMASK(13, 12),
  765. .clk_id = {CLK_MM},
  766. },
  767. [MT8173_POWER_DOMAIN_MM] = {
  768. .name = "mm",
  769. .sta_mask = PWR_STATUS_DISP,
  770. .ctl_offs = SPM_DIS_PWR_CON,
  771. .sram_pdn_bits = GENMASK(11, 8),
  772. .sram_pdn_ack_bits = GENMASK(12, 12),
  773. .clk_id = {CLK_MM},
  774. .bus_prot_mask = MT8173_TOP_AXI_PROT_EN_MM_M0 |
  775. MT8173_TOP_AXI_PROT_EN_MM_M1,
  776. },
  777. [MT8173_POWER_DOMAIN_VENC_LT] = {
  778. .name = "venc_lt",
  779. .sta_mask = PWR_STATUS_VENC_LT,
  780. .ctl_offs = SPM_VEN2_PWR_CON,
  781. .sram_pdn_bits = GENMASK(11, 8),
  782. .sram_pdn_ack_bits = GENMASK(15, 12),
  783. .clk_id = {CLK_MM, CLK_VENC_LT},
  784. },
  785. [MT8173_POWER_DOMAIN_AUDIO] = {
  786. .name = "audio",
  787. .sta_mask = PWR_STATUS_AUDIO,
  788. .ctl_offs = SPM_AUDIO_PWR_CON,
  789. .sram_pdn_bits = GENMASK(11, 8),
  790. .sram_pdn_ack_bits = GENMASK(15, 12),
  791. .clk_id = {CLK_NONE},
  792. },
  793. [MT8173_POWER_DOMAIN_USB] = {
  794. .name = "usb",
  795. .sta_mask = PWR_STATUS_USB,
  796. .ctl_offs = SPM_USB_PWR_CON,
  797. .sram_pdn_bits = GENMASK(11, 8),
  798. .sram_pdn_ack_bits = GENMASK(15, 12),
  799. .clk_id = {CLK_NONE},
  800. .caps = MTK_SCPD_ACTIVE_WAKEUP,
  801. },
  802. [MT8173_POWER_DOMAIN_MFG_ASYNC] = {
  803. .name = "mfg_async",
  804. .sta_mask = PWR_STATUS_MFG_ASYNC,
  805. .ctl_offs = SPM_MFG_ASYNC_PWR_CON,
  806. .sram_pdn_bits = GENMASK(11, 8),
  807. .sram_pdn_ack_bits = 0,
  808. .clk_id = {CLK_MFG},
  809. },
  810. [MT8173_POWER_DOMAIN_MFG_2D] = {
  811. .name = "mfg_2d",
  812. .sta_mask = PWR_STATUS_MFG_2D,
  813. .ctl_offs = SPM_MFG_2D_PWR_CON,
  814. .sram_pdn_bits = GENMASK(11, 8),
  815. .sram_pdn_ack_bits = GENMASK(13, 12),
  816. .clk_id = {CLK_NONE},
  817. },
  818. [MT8173_POWER_DOMAIN_MFG] = {
  819. .name = "mfg",
  820. .sta_mask = PWR_STATUS_MFG,
  821. .ctl_offs = SPM_MFG_PWR_CON,
  822. .sram_pdn_bits = GENMASK(13, 8),
  823. .sram_pdn_ack_bits = GENMASK(21, 16),
  824. .clk_id = {CLK_NONE},
  825. .bus_prot_mask = MT8173_TOP_AXI_PROT_EN_MFG_S |
  826. MT8173_TOP_AXI_PROT_EN_MFG_M0 |
  827. MT8173_TOP_AXI_PROT_EN_MFG_M1 |
  828. MT8173_TOP_AXI_PROT_EN_MFG_SNOOP_OUT,
  829. },
  830. };
  831. static const struct scp_subdomain scp_subdomain_mt8173[] = {
  832. {MT8173_POWER_DOMAIN_MFG_ASYNC, MT8173_POWER_DOMAIN_MFG_2D},
  833. {MT8173_POWER_DOMAIN_MFG_2D, MT8173_POWER_DOMAIN_MFG},
  834. };
  835. static const struct scp_soc_data mt2701_data = {
  836. .domains = scp_domain_data_mt2701,
  837. .num_domains = ARRAY_SIZE(scp_domain_data_mt2701),
  838. .regs = {
  839. .pwr_sta_offs = SPM_PWR_STATUS,
  840. .pwr_sta2nd_offs = SPM_PWR_STATUS_2ND
  841. },
  842. .bus_prot_reg_update = true,
  843. };
  844. static const struct scp_soc_data mt2712_data = {
  845. .domains = scp_domain_data_mt2712,
  846. .num_domains = ARRAY_SIZE(scp_domain_data_mt2712),
  847. .subdomains = scp_subdomain_mt2712,
  848. .num_subdomains = ARRAY_SIZE(scp_subdomain_mt2712),
  849. .regs = {
  850. .pwr_sta_offs = SPM_PWR_STATUS,
  851. .pwr_sta2nd_offs = SPM_PWR_STATUS_2ND
  852. },
  853. .bus_prot_reg_update = false,
  854. };
  855. static const struct scp_soc_data mt6797_data = {
  856. .domains = scp_domain_data_mt6797,
  857. .num_domains = ARRAY_SIZE(scp_domain_data_mt6797),
  858. .subdomains = scp_subdomain_mt6797,
  859. .num_subdomains = ARRAY_SIZE(scp_subdomain_mt6797),
  860. .regs = {
  861. .pwr_sta_offs = SPM_PWR_STATUS_MT6797,
  862. .pwr_sta2nd_offs = SPM_PWR_STATUS_2ND_MT6797
  863. },
  864. .bus_prot_reg_update = true,
  865. };
  866. static const struct scp_soc_data mt7622_data = {
  867. .domains = scp_domain_data_mt7622,
  868. .num_domains = ARRAY_SIZE(scp_domain_data_mt7622),
  869. .regs = {
  870. .pwr_sta_offs = SPM_PWR_STATUS,
  871. .pwr_sta2nd_offs = SPM_PWR_STATUS_2ND
  872. },
  873. .bus_prot_reg_update = true,
  874. };
  875. static const struct scp_soc_data mt7623a_data = {
  876. .domains = scp_domain_data_mt7623a,
  877. .num_domains = ARRAY_SIZE(scp_domain_data_mt7623a),
  878. .regs = {
  879. .pwr_sta_offs = SPM_PWR_STATUS,
  880. .pwr_sta2nd_offs = SPM_PWR_STATUS_2ND
  881. },
  882. .bus_prot_reg_update = true,
  883. };
  884. static const struct scp_soc_data mt8173_data = {
  885. .domains = scp_domain_data_mt8173,
  886. .num_domains = ARRAY_SIZE(scp_domain_data_mt8173),
  887. .subdomains = scp_subdomain_mt8173,
  888. .num_subdomains = ARRAY_SIZE(scp_subdomain_mt8173),
  889. .regs = {
  890. .pwr_sta_offs = SPM_PWR_STATUS,
  891. .pwr_sta2nd_offs = SPM_PWR_STATUS_2ND
  892. },
  893. .bus_prot_reg_update = true,
  894. };
  895. /*
  896. * scpsys driver init
  897. */
  898. static const struct of_device_id of_scpsys_match_tbl[] = {
  899. {
  900. .compatible = "mediatek,mt2701-scpsys",
  901. .data = &mt2701_data,
  902. }, {
  903. .compatible = "mediatek,mt2712-scpsys",
  904. .data = &mt2712_data,
  905. }, {
  906. .compatible = "mediatek,mt6797-scpsys",
  907. .data = &mt6797_data,
  908. }, {
  909. .compatible = "mediatek,mt7622-scpsys",
  910. .data = &mt7622_data,
  911. }, {
  912. .compatible = "mediatek,mt7623a-scpsys",
  913. .data = &mt7623a_data,
  914. }, {
  915. .compatible = "mediatek,mt8173-scpsys",
  916. .data = &mt8173_data,
  917. }, {
  918. /* sentinel */
  919. }
  920. };
  921. static int scpsys_probe(struct platform_device *pdev)
  922. {
  923. const struct scp_subdomain *sd;
  924. const struct scp_soc_data *soc;
  925. struct scp *scp;
  926. struct genpd_onecell_data *pd_data;
  927. int i, ret;
  928. soc = of_device_get_match_data(&pdev->dev);
  929. scp = init_scp(pdev, soc->domains, soc->num_domains, &soc->regs,
  930. soc->bus_prot_reg_update);
  931. if (IS_ERR(scp))
  932. return PTR_ERR(scp);
  933. mtk_register_power_domains(pdev, scp, soc->num_domains);
  934. pd_data = &scp->pd_data;
  935. for (i = 0, sd = soc->subdomains; i < soc->num_subdomains; i++, sd++) {
  936. ret = pm_genpd_add_subdomain(pd_data->domains[sd->origin],
  937. pd_data->domains[sd->subdomain]);
  938. if (ret && IS_ENABLED(CONFIG_PM))
  939. dev_err(&pdev->dev, "Failed to add subdomain: %d\n",
  940. ret);
  941. }
  942. return 0;
  943. }
  944. static struct platform_driver scpsys_drv = {
  945. .probe = scpsys_probe,
  946. .driver = {
  947. .name = "mtk-scpsys",
  948. .suppress_bind_attrs = true,
  949. .owner = THIS_MODULE,
  950. .of_match_table = of_match_ptr(of_scpsys_match_tbl),
  951. },
  952. };
  953. builtin_platform_driver(scpsys_drv);