Surprise! We've been running on hardware provided by BuyVM for a few months and wanted to show them a little appreciation.
Running a paste site comes with unique challenges, ones that aren't always obvious and hard to control. As such, BuyVM offered us a home where we could worry less about the hosting side of things and focus on maintaining a clean and useful service! Go check them out and show them some love!
Description: Revert "clk: imx8mm: Switch to platform driver" for v5.6-rc6
Submitted on March 17, 2020 at 10:44 AM

New Paste 1 (Text)

commit 9287ac9d12e932df17f4f091fbfc81a9e44621e6
Author: Frieder Schrempf <[email protected]>
Date:   Wed Dec 18 15:50:55 2019 +0100

    Revert "clk: imx8mm: Switch to platform driver"
    
    This reverts commit af7e7ee0e4280c29c41b6ec64b892bb53987a997 which
    for some unknown reasons breaks SPI support for i.MX8MM.

diff --git a/drivers/clk/imx/clk-imx8mm.c b/drivers/clk/imx/clk-imx8mm.c
index 2ed93fc25087..28d7f9da8a28 100644
--- a/drivers/clk/imx/clk-imx8mm.c
+++ b/drivers/clk/imx/clk-imx8mm.c
@@ -297,10 +297,9 @@ static const int uart_clk_ids[] = {
 };
 static struct clk **uart_hws[ARRAY_SIZE(uart_clk_ids) + 1];
 
-static int imx8mm_clocks_probe(struct platform_device *pdev)
+static int imx8mm_clocks_init(struct device_node *ccm_node)
 {
-	struct device *dev = &pdev->dev;
-	struct device_node *np = dev->of_node;
+	struct device_node *np;
 	void __iomem *base;
 	int ret, i;
 
@@ -313,12 +312,12 @@ static int imx8mm_clocks_probe(struct platform_device *pdev)
 	hws = clk_hw_data->hws;
 
 	hws[IMX8MM_CLK_DUMMY] = imx_clk_hw_fixed("dummy", 0);
-	hws[IMX8MM_CLK_24M] = imx_obtain_fixed_clk_hw(np, "osc_24m");
-	hws[IMX8MM_CLK_32K] = imx_obtain_fixed_clk_hw(np, "osc_32k");
-	hws[IMX8MM_CLK_EXT1] = imx_obtain_fixed_clk_hw(np, "clk_ext1");
-	hws[IMX8MM_CLK_EXT2] = imx_obtain_fixed_clk_hw(np, "clk_ext2");
-	hws[IMX8MM_CLK_EXT3] = imx_obtain_fixed_clk_hw(np, "clk_ext3");
-	hws[IMX8MM_CLK_EXT4] = imx_obtain_fixed_clk_hw(np, "clk_ext4");
+	hws[IMX8MM_CLK_24M] = imx_obtain_fixed_clk_hw(ccm_node, "osc_24m");
+	hws[IMX8MM_CLK_32K] = imx_obtain_fixed_clk_hw(ccm_node, "osc_32k");
+	hws[IMX8MM_CLK_EXT1] = imx_obtain_fixed_clk_hw(ccm_node, "clk_ext1");
+	hws[IMX8MM_CLK_EXT2] = imx_obtain_fixed_clk_hw(ccm_node, "clk_ext2");
+	hws[IMX8MM_CLK_EXT3] = imx_obtain_fixed_clk_hw(ccm_node, "clk_ext3");
+	hws[IMX8MM_CLK_EXT4] = imx_obtain_fixed_clk_hw(ccm_node, "clk_ext4");
 
 	np = of_find_compatible_node(NULL, NULL, "fsl,imx8mm-anatop");
 	base = of_iomap(np, 0);
@@ -407,10 +406,10 @@ static int imx8mm_clocks_probe(struct platform_device *pdev)
 	hws[IMX8MM_SYS_PLL2_500M] = imx_clk_hw_fixed_factor("sys_pll2_500m", "sys_pll2_500m_cg", 1, 2);
 	hws[IMX8MM_SYS_PLL2_1000M] = imx_clk_hw_fixed_factor("sys_pll2_1000m", "sys_pll2_out", 1, 1);
 
-	np = dev->of_node;
-	base = devm_platform_ioremap_resource(pdev, 0);
-	if (WARN_ON(IS_ERR(base)))
-		return PTR_ERR(base);
+	np = ccm_node;
+	base = of_iomap(np, 0);
+	if (WARN_ON(!base))
+		return -ENOMEM;
 
 	/* Core Slice */
 	hws[IMX8MM_CLK_A53_SRC] = imx_clk_hw_mux2("arm_a53_src", base + 0x8000, 24, 3, imx8mm_a53_sels, ARRAY_SIZE(imx8mm_a53_sels));
@@ -604,7 +603,7 @@ static int imx8mm_clocks_probe(struct platform_device *pdev)
 
 	ret = of_clk_add_hw_provider(np, of_clk_hw_onecell_get, clk_hw_data);
 	if (ret < 0) {
-		dev_err(dev, "failed to register clks for i.MX8MM\n");
+		pr_err("failed to register clks for i.MX8MM\n");
 		goto unregister_hws;
 	}
 
@@ -624,22 +623,4 @@ static int imx8mm_clocks_probe(struct platform_device *pdev)
 	return ret;
 }
 
-static const struct of_device_id imx8mm_clk_of_match[] = {
-	{ .compatible = "fsl,imx8mm-ccm" },
-	{ /* Sentinel */ },
-};
-MODULE_DEVICE_TABLE(of, imx8mm_clk_of_match);
-
-static struct platform_driver imx8mm_clk_driver = {
-	.probe = imx8mm_clocks_probe,
-	.driver = {
-		.name = "imx8mm-ccm",
-		/*
-		 * Disable bind attributes: clocks are not removed and
-		 * reloading the driver will crash or break devices.
-		 */
-		.suppress_bind_attrs = true,
-		.of_match_table = of_match_ptr(imx8mm_clk_of_match),
-	},
-};
-module_platform_driver(imx8mm_clk_driver);
+CLK_OF_DECLARE_DRIVER(imx8mm, "fsl,imx8mm-ccm", imx8mm_clocks_init);