Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

soc: imx: imx8m-blk-ctrl: add i.MX8MQ VPU blk-ctrl

This adds the necessary bits to drive the VPU blk-ctrl on the i.MX8MQ, to
avoid putting more of this functionality into the decoder driver.

Signed-off-by: Lucas Stach <l.stach@pengutronix.de>
Signed-off-by: Adam Ford <aford173@gmail.com>
Signed-off-by: Shawn Guo <shawnguo@kernel.org>

authored by

Lucas Stach and committed by
Shawn Guo
608d7c32 a1415fbc

+66
+66
drivers/soc/imx/imx8m-blk-ctrl.c
··· 15 15 16 16 #include <dt-bindings/power/imx8mm-power.h> 17 17 #include <dt-bindings/power/imx8mn-power.h> 18 + #include <dt-bindings/power/imx8mq-power.h> 18 19 19 20 #define BLK_SFT_RSTN 0x0 20 21 #define BLK_CLK_EN 0x4 ··· 590 589 .num_domains = ARRAY_SIZE(imx8mn_disp_blk_ctl_domain_data), 591 590 }; 592 591 592 + static int imx8mq_vpu_power_notifier(struct notifier_block *nb, 593 + unsigned long action, void *data) 594 + { 595 + struct imx8m_blk_ctrl *bc = container_of(nb, struct imx8m_blk_ctrl, 596 + power_nb); 597 + 598 + if (action != GENPD_NOTIFY_ON && action != GENPD_NOTIFY_PRE_OFF) 599 + return NOTIFY_OK; 600 + 601 + /* 602 + * The ADB in the VPUMIX domain has no separate reset and clock 603 + * enable bits, but is ungated and reset together with the VPUs. The 604 + * reset and clock enable inputs to the ADB is a logical OR of the 605 + * VPU bits. In order to set the G2 fuse bits, the G2 clock must 606 + * also be enabled. 607 + */ 608 + regmap_set_bits(bc->regmap, BLK_SFT_RSTN, BIT(0) | BIT(1)); 609 + regmap_set_bits(bc->regmap, BLK_CLK_EN, BIT(0) | BIT(1)); 610 + 611 + if (action == GENPD_NOTIFY_ON) { 612 + /* 613 + * On power up we have no software backchannel to the GPC to 614 + * wait for the ADB handshake to happen, so we just delay for a 615 + * bit. On power down the GPC driver waits for the handshake. 616 + */ 617 + udelay(5); 618 + 619 + /* set "fuse" bits to enable the VPUs */ 620 + regmap_set_bits(bc->regmap, 0x8, 0xffffffff); 621 + regmap_set_bits(bc->regmap, 0xc, 0xffffffff); 622 + regmap_set_bits(bc->regmap, 0x10, 0xffffffff); 623 + } 624 + 625 + return NOTIFY_OK; 626 + } 627 + 628 + static const struct imx8m_blk_ctrl_domain_data imx8mq_vpu_blk_ctl_domain_data[] = { 629 + [IMX8MQ_VPUBLK_PD_G1] = { 630 + .name = "vpublk-g1", 631 + .clk_names = (const char *[]){ "g1", }, 632 + .num_clks = 1, 633 + .gpc_name = "g1", 634 + .rst_mask = BIT(1), 635 + .clk_mask = BIT(1), 636 + }, 637 + [IMX8MQ_VPUBLK_PD_G2] = { 638 + .name = "vpublk-g2", 639 + .clk_names = (const char *[]){ "g2", }, 640 + .num_clks = 1, 641 + .gpc_name = "g2", 642 + .rst_mask = BIT(0), 643 + .clk_mask = BIT(0), 644 + }, 645 + }; 646 + 647 + static const struct imx8m_blk_ctrl_data imx8mq_vpu_blk_ctl_dev_data = { 648 + .max_reg = 0x14, 649 + .power_notifier_fn = imx8mq_vpu_power_notifier, 650 + .domains = imx8mq_vpu_blk_ctl_domain_data, 651 + .num_domains = ARRAY_SIZE(imx8mq_vpu_blk_ctl_domain_data), 652 + }; 653 + 593 654 static const struct of_device_id imx8m_blk_ctrl_of_match[] = { 594 655 { 595 656 .compatible = "fsl,imx8mm-vpu-blk-ctrl", ··· 662 599 }, { 663 600 .compatible = "fsl,imx8mn-disp-blk-ctrl", 664 601 .data = &imx8mn_disp_blk_ctl_dev_data 602 + }, { 603 + .compatible = "fsl,imx8mq-vpu-blk-ctrl", 604 + .data = &imx8mq_vpu_blk_ctl_dev_data 665 605 }, { 666 606 /* Sentinel */ 667 607 }