|
14 | 14 | #include <linux/clk.h> |
15 | 15 |
|
16 | 16 | #include <dt-bindings/power/imx8mm-power.h> |
| 17 | +#include <dt-bindings/power/imx8mn-power.h> |
17 | 18 |
|
18 | 19 | #define BLK_SFT_RSTN 0x0 |
19 | 20 | #define BLK_CLK_EN 0x4 |
@@ -498,14 +499,88 @@ static const struct imx8m_blk_ctrl_data imx8mm_disp_blk_ctl_dev_data = { |
498 | 499 | .num_domains = ARRAY_SIZE(imx8mm_disp_blk_ctl_domain_data), |
499 | 500 | }; |
500 | 501 |
|
| 502 | + |
| 503 | +static int imx8mn_disp_power_notifier(struct notifier_block *nb, |
| 504 | + unsigned long action, void *data) |
| 505 | +{ |
| 506 | + struct imx8m_blk_ctrl *bc = container_of(nb, struct imx8m_blk_ctrl, |
| 507 | + power_nb); |
| 508 | + |
| 509 | + if (action != GENPD_NOTIFY_ON && action != GENPD_NOTIFY_PRE_OFF) |
| 510 | + return NOTIFY_OK; |
| 511 | + |
| 512 | + /* Enable bus clock and deassert bus reset */ |
| 513 | + regmap_set_bits(bc->regmap, BLK_CLK_EN, BIT(8)); |
| 514 | + regmap_set_bits(bc->regmap, BLK_SFT_RSTN, BIT(8)); |
| 515 | + |
| 516 | + /* |
| 517 | + * On power up we have no software backchannel to the GPC to |
| 518 | + * wait for the ADB handshake to happen, so we just delay for a |
| 519 | + * bit. On power down the GPC driver waits for the handshake. |
| 520 | + */ |
| 521 | + if (action == GENPD_NOTIFY_ON) |
| 522 | + udelay(5); |
| 523 | + |
| 524 | + |
| 525 | + return NOTIFY_OK; |
| 526 | +} |
| 527 | + |
| 528 | +static const struct imx8m_blk_ctrl_domain_data imx8mn_disp_blk_ctl_domain_data[] = { |
| 529 | + [IMX8MN_DISPBLK_PD_MIPI_DSI] = { |
| 530 | + .name = "dispblk-mipi-dsi", |
| 531 | + .clk_names = (const char *[]){ "dsi-pclk", "dsi-ref", }, |
| 532 | + .num_clks = 2, |
| 533 | + .gpc_name = "mipi-dsi", |
| 534 | + .rst_mask = BIT(0) | BIT(1), |
| 535 | + .clk_mask = BIT(0) | BIT(1), |
| 536 | + .mipi_phy_rst_mask = BIT(17), |
| 537 | + }, |
| 538 | + [IMX8MN_DISPBLK_PD_MIPI_CSI] = { |
| 539 | + .name = "dispblk-mipi-csi", |
| 540 | + .clk_names = (const char *[]){ "csi-aclk", "csi-pclk" }, |
| 541 | + .num_clks = 2, |
| 542 | + .gpc_name = "mipi-csi", |
| 543 | + .rst_mask = BIT(2) | BIT(3), |
| 544 | + .clk_mask = BIT(2) | BIT(3), |
| 545 | + .mipi_phy_rst_mask = BIT(16), |
| 546 | + }, |
| 547 | + [IMX8MN_DISPBLK_PD_LCDIF] = { |
| 548 | + .name = "dispblk-lcdif", |
| 549 | + .clk_names = (const char *[]){ "lcdif-axi", "lcdif-apb", "lcdif-pix", }, |
| 550 | + .num_clks = 3, |
| 551 | + .gpc_name = "lcdif", |
| 552 | + .rst_mask = BIT(4) | BIT(5), |
| 553 | + .clk_mask = BIT(4) | BIT(5), |
| 554 | + }, |
| 555 | + [IMX8MN_DISPBLK_PD_ISI] = { |
| 556 | + .name = "dispblk-isi", |
| 557 | + .clk_names = (const char *[]){ "disp_axi", "disp_apb", "disp_axi_root", |
| 558 | + "disp_apb_root"}, |
| 559 | + .num_clks = 4, |
| 560 | + .gpc_name = "isi", |
| 561 | + .rst_mask = BIT(6) | BIT(7), |
| 562 | + .clk_mask = BIT(6) | BIT(7), |
| 563 | + }, |
| 564 | +}; |
| 565 | + |
| 566 | +static const struct imx8m_blk_ctrl_data imx8mn_disp_blk_ctl_dev_data = { |
| 567 | + .max_reg = 0x84, |
| 568 | + .power_notifier_fn = imx8mn_disp_power_notifier, |
| 569 | + .domains = imx8mn_disp_blk_ctl_domain_data, |
| 570 | + .num_domains = ARRAY_SIZE(imx8mn_disp_blk_ctl_domain_data), |
| 571 | +}; |
| 572 | + |
501 | 573 | static const struct of_device_id imx8m_blk_ctrl_of_match[] = { |
502 | 574 | { |
503 | 575 | .compatible = "fsl,imx8mm-vpu-blk-ctrl", |
504 | 576 | .data = &imx8mm_vpu_blk_ctl_dev_data |
505 | 577 | }, { |
506 | 578 | .compatible = "fsl,imx8mm-disp-blk-ctrl", |
507 | 579 | .data = &imx8mm_disp_blk_ctl_dev_data |
508 | | - } ,{ |
| 580 | + }, { |
| 581 | + .compatible = "fsl,imx8mn-disp-blk-ctrl", |
| 582 | + .data = &imx8mn_disp_blk_ctl_dev_data |
| 583 | + }, { |
509 | 584 | /* Sentinel */ |
510 | 585 | } |
511 | 586 | }; |
|
0 commit comments