mirror of
https://github.com/torvalds/linux.git
synced 2026-05-26 08:02:27 +02:00
i.MX clocks changes for 6.19
- Add delay to the PCC enable/disable in i.MX7ULP composite, needed by some specific peripherals. - Simplify the i.MX8MP auxiomix by using devm_auxiliary_device_create() - Add the i.MX8ULP SIM LPAV platform specific clock provider. -----BEGIN PGP SIGNATURE----- iQIzBAABCgAdFiEETvPuEU56jyrKp9G4G19EyQCVFVYFAmkXNI4ACgkQG19EyQCV FVY9RBAAqp0+M5m1VT/kfk3zTUs3bP0NNNxEC4amUVXIf4aK9KTIW1KJkuvt3138 KaQDElujDAqhhABBAi90cWDpOn0tEUmfSWilnMbDYfEJM+//YDXCYhUJ2t30SFO5 v8l1RZQqGJRQ05FwCac5TM0+dc6cMawQeN9NdSXqZsgj3/3/YulZSIL49rJquFIM vkKfFNyqupwolajM+Nk5p6tKzNrPliX2s1BLSqAlCXS5rzOfIJwKHp1Zr9l26zD1 zVfESBkxvSxxmHrFCV65ZeOqfm6t01JCu16kRabtFMM7iCKnY/EaUNNUiJ10qyz3 Zb3WfYMPZncA4nyqBWpQ49DslNJe2hqbHY5mOC/6BYdV0Oyri+eo7EH9n7AUI/8u N+jeASrRndCZqApb/GV/QZTkByVjGm09XSoznqcBNTL2BGtndhCPqlLfe4+7cFUM zDrZ4J0JsTNf05+Aizp7DWWToC80Vf/zuxeVvXnbkM4svH+qacJ69wZtOHyb35b0 Wyvy/0+5gHHVWo9OrdnvwJ/fM6opskqw6AsyPO6qs262TZRKwGV5wU6hmycnzVS4 aAHE/aBwxe6+lNzAXt3bL+TZ5oc54T7OK89s7F17D8ik6rCNK3Hrqc9qqDfd3ygt lNmQtQ9vQmKnax5kcdMzEry+YhP441L3QSeqG7Yb66ZchU+7B+w= =TWjk -----END PGP SIGNATURE----- gpgsig -----BEGIN PGP SIGNATURE----- iQJIBAABCAAyFiEE9L57QeeUxqYDyoaDrQKIl8bklSUFAmkf3zEUHHN3Ym95ZEBj aHJvbWl1bS5vcmcACgkQrQKIl8bklSVZzxAAqtB0M0hkknm0EC5N/sRT5FcKKq5p B6CIaOxgzizVaaWIVmxJwXzjQi1oRuTHBIdwAVTVyCs0zmTbWFdl07W5tO2lW9WH /VYw9gTm6JMWHe3MZ7nOVwBAKRxOqrafJRgWwldmTQW4lvbWx7o/NrpBU05nyBMp 9QTWRibgBfL+FGJ59RKtDf0RzrQ5oc402pdfV6MUsJYupB9H5FsaYaSu3bZy7w9k l4qQPVr2aWKMzT0zlNum369Wdn93VMcv9RzQUciA7ViP6B971VWuLxklBNp+JeRa P0tklNEiNGNcVMfoFlE+J2whm7cR13xO1fX6tMEqBoF+TOmt2trLPcZ+v/3jSP24 hpWgF5xGHLtXa8+E2cWlKxAaKruC+gqatL8FQQSZ4gS+9aCYbyZo8jwDPokvgoxo 5y0OQV3wIrUR/Ctn2qT3qxrgGMpC9wnz9JZLCUaz+YasvKuw4t5wlZ6xnIXLCM/0 lKakQGjYCNH5H7tXrg+yRvaP0zJ8V8/6laKSC07bD4+qLT0qbhkXq3LMwf3xDaKC CR3qD1W3DxjLi7OgvxAwRDlh3BNMsfeaygjmR3yZIj4ooWWrP6jtjcYr/Vp0/dUe nR61cNQLCz8wq+2IkYbPOOgaip2UMQBdkO2k2zenvFVTD6dfhfAlUPpJiiyoZBir jeKFNKhul7AivJE= =DDlX -----END PGP SIGNATURE----- Merge tag 'clk-imx-6.19' of git://git.kernel.org/pub/scm/linux/kernel/git/abelvesa/linux into clk-imx Pull i.MX clk driver updates from Abel Vesa: - Add delay to the PCC enable/disable in i.MX7ULP composite, needed by some specific peripherals - Simplify the i.MX8MP auxiomix by using devm_auxiliary_device_create() - Add the i.MX8ULP SIM LPAV platform specific clock provider * tag 'clk-imx-6.19' of git://git.kernel.org/pub/scm/linux/kernel/git/abelvesa/linux: clk: imx: add driver for imx8ulp's sim lpav dt-bindings: clock: document 8ULP's SIM LPAV clk: imx: imx8mp-audiomix: use devm_auxiliary_device_create() to simple code clk: imx: Add some delay before deassert the reset
This commit is contained in:
commit
d409f53d20
|
|
@ -0,0 +1,72 @@
|
|||
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
|
||||
%YAML 1.2
|
||||
---
|
||||
$id: http://devicetree.org/schemas/clock/fsl,imx8ulp-sim-lpav.yaml#
|
||||
$schema: http://devicetree.org/meta-schemas/core.yaml#
|
||||
|
||||
title: NXP i.MX8ULP LPAV System Integration Module (SIM)
|
||||
|
||||
maintainers:
|
||||
- Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>
|
||||
|
||||
description:
|
||||
The i.MX8ULP LPAV subsystem contains a block control module known as
|
||||
SIM LPAV, which offers functionalities such as clock gating or reset
|
||||
line assertion/de-assertion.
|
||||
|
||||
properties:
|
||||
compatible:
|
||||
const: fsl,imx8ulp-sim-lpav
|
||||
|
||||
reg:
|
||||
maxItems: 1
|
||||
|
||||
clocks:
|
||||
maxItems: 3
|
||||
|
||||
clock-names:
|
||||
items:
|
||||
- const: bus
|
||||
- const: core
|
||||
- const: plat
|
||||
|
||||
'#clock-cells':
|
||||
const: 1
|
||||
|
||||
'#reset-cells':
|
||||
const: 1
|
||||
|
||||
mux-controller:
|
||||
$ref: /schemas/mux/reg-mux.yaml#
|
||||
|
||||
required:
|
||||
- compatible
|
||||
- reg
|
||||
- clocks
|
||||
- clock-names
|
||||
- '#clock-cells'
|
||||
- '#reset-cells'
|
||||
- mux-controller
|
||||
|
||||
additionalProperties: false
|
||||
|
||||
examples:
|
||||
- |
|
||||
#include <dt-bindings/clock/imx8ulp-clock.h>
|
||||
|
||||
clock-controller@2da50000 {
|
||||
compatible = "fsl,imx8ulp-sim-lpav";
|
||||
reg = <0x2da50000 0x10000>;
|
||||
clocks = <&cgc2 IMX8ULP_CLK_LPAV_BUS_DIV>,
|
||||
<&cgc2 IMX8ULP_CLK_HIFI_DIVCORE>,
|
||||
<&cgc2 IMX8ULP_CLK_HIFI_DIVPLAT>;
|
||||
clock-names = "bus", "core", "plat";
|
||||
#clock-cells = <1>;
|
||||
#reset-cells = <1>;
|
||||
|
||||
mux-controller {
|
||||
compatible = "reg-mux";
|
||||
#mux-control-cells = <1>;
|
||||
mux-reg-masks = <0x8 0x00000200>;
|
||||
};
|
||||
};
|
||||
|
|
@ -105,6 +105,7 @@ config CLK_IMX8ULP
|
|||
tristate "IMX8ULP CCM Clock Driver"
|
||||
depends on ARCH_MXC || COMPILE_TEST
|
||||
select MXC_CLK
|
||||
select AUXILIARY_BUS
|
||||
help
|
||||
Build the driver for i.MX8ULP CCM Clock Driver
|
||||
|
||||
|
|
|
|||
|
|
@ -41,6 +41,7 @@ clk-imx-lpcg-scu-$(CONFIG_CLK_IMX8QXP) += clk-lpcg-scu.o clk-imx8qxp-lpcg.o
|
|||
clk-imx-acm-$(CONFIG_CLK_IMX8QXP) = clk-imx8-acm.o
|
||||
|
||||
obj-$(CONFIG_CLK_IMX8ULP) += clk-imx8ulp.o
|
||||
obj-$(CONFIG_CLK_IMX8ULP) += clk-imx8ulp-sim-lpav.o
|
||||
|
||||
obj-$(CONFIG_CLK_IMX1) += clk-imx1.o
|
||||
obj-$(CONFIG_CLK_IMX25) += clk-imx25.o
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@
|
|||
|
||||
#include <linux/bits.h>
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/delay.h>
|
||||
#include <linux/err.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/slab.h>
|
||||
|
|
@ -36,6 +37,9 @@ static int pcc_gate_enable(struct clk_hw *hw)
|
|||
if (ret)
|
||||
return ret;
|
||||
|
||||
/* Make sure the IP's clock is ready before release reset */
|
||||
udelay(1);
|
||||
|
||||
spin_lock_irqsave(gate->lock, flags);
|
||||
/*
|
||||
* release the sw reset for peripherals associated with
|
||||
|
|
@ -47,6 +51,15 @@ static int pcc_gate_enable(struct clk_hw *hw)
|
|||
|
||||
spin_unlock_irqrestore(gate->lock, flags);
|
||||
|
||||
/*
|
||||
* Read back the register to make sure the previous write has been
|
||||
* done in the target HW register. For IP like GPU, after deassert
|
||||
* the reset, need to wait for a while to make sure the sync reset
|
||||
* is done
|
||||
*/
|
||||
readl(gate->reg);
|
||||
udelay(1);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -230,50 +230,19 @@ struct clk_imx8mp_audiomix_priv {
|
|||
|
||||
#if IS_ENABLED(CONFIG_RESET_CONTROLLER)
|
||||
|
||||
static void clk_imx8mp_audiomix_reset_unregister_adev(void *_adev)
|
||||
{
|
||||
struct auxiliary_device *adev = _adev;
|
||||
|
||||
auxiliary_device_delete(adev);
|
||||
auxiliary_device_uninit(adev);
|
||||
}
|
||||
|
||||
static void clk_imx8mp_audiomix_reset_adev_release(struct device *dev)
|
||||
{
|
||||
struct auxiliary_device *adev = to_auxiliary_dev(dev);
|
||||
|
||||
kfree(adev);
|
||||
}
|
||||
|
||||
static int clk_imx8mp_audiomix_reset_controller_register(struct device *dev,
|
||||
struct clk_imx8mp_audiomix_priv *priv)
|
||||
{
|
||||
struct auxiliary_device *adev __free(kfree) = NULL;
|
||||
int ret;
|
||||
struct auxiliary_device *adev;
|
||||
|
||||
if (!of_property_present(dev->of_node, "#reset-cells"))
|
||||
return 0;
|
||||
|
||||
adev = kzalloc(sizeof(*adev), GFP_KERNEL);
|
||||
adev = devm_auxiliary_device_create(dev, "reset", NULL);
|
||||
if (!adev)
|
||||
return -ENOMEM;
|
||||
return -ENODEV;
|
||||
|
||||
adev->name = "reset";
|
||||
adev->dev.parent = dev;
|
||||
adev->dev.release = clk_imx8mp_audiomix_reset_adev_release;
|
||||
|
||||
ret = auxiliary_device_init(adev);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
ret = auxiliary_device_add(adev);
|
||||
if (ret) {
|
||||
auxiliary_device_uninit(adev);
|
||||
return ret;
|
||||
}
|
||||
|
||||
return devm_add_action_or_reset(dev, clk_imx8mp_audiomix_reset_unregister_adev,
|
||||
no_free_ptr(adev));
|
||||
return 0;
|
||||
}
|
||||
|
||||
#else /* !CONFIG_RESET_CONTROLLER */
|
||||
|
|
|
|||
156
drivers/clk/imx/clk-imx8ulp-sim-lpav.c
Normal file
156
drivers/clk/imx/clk-imx8ulp-sim-lpav.c
Normal file
|
|
@ -0,0 +1,156 @@
|
|||
// SPDX-License-Identifier: GPL-2.0
|
||||
/*
|
||||
* Copyright 2025 NXP
|
||||
*/
|
||||
|
||||
#include <dt-bindings/clock/imx8ulp-clock.h>
|
||||
|
||||
#include <linux/auxiliary_bus.h>
|
||||
#include <linux/clk-provider.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/of.h>
|
||||
#include <linux/of_platform.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/regmap.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#define SYSCTRL0 0x8
|
||||
|
||||
#define IMX8ULP_HIFI_CLK_GATE(gname, cname, pname, bidx) \
|
||||
{ \
|
||||
.name = gname "_cg", \
|
||||
.id = IMX8ULP_CLK_SIM_LPAV_HIFI_##cname, \
|
||||
.parent = { .fw_name = pname }, \
|
||||
.bit = bidx, \
|
||||
}
|
||||
|
||||
struct clk_imx8ulp_sim_lpav_data {
|
||||
spinlock_t lock; /* shared by MUX, clock gate and reset */
|
||||
unsigned long flags; /* for spinlock usage */
|
||||
struct clk_hw_onecell_data clk_data; /* keep last */
|
||||
};
|
||||
|
||||
struct clk_imx8ulp_sim_lpav_gate {
|
||||
const char *name;
|
||||
int id;
|
||||
const struct clk_parent_data parent;
|
||||
u8 bit;
|
||||
};
|
||||
|
||||
static struct clk_imx8ulp_sim_lpav_gate gates[] = {
|
||||
IMX8ULP_HIFI_CLK_GATE("hifi_core", CORE, "core", 17),
|
||||
IMX8ULP_HIFI_CLK_GATE("hifi_pbclk", PBCLK, "bus", 18),
|
||||
IMX8ULP_HIFI_CLK_GATE("hifi_plat", PLAT, "plat", 19)
|
||||
};
|
||||
|
||||
static void clk_imx8ulp_sim_lpav_lock(void *arg) __acquires(&data->lock)
|
||||
{
|
||||
struct clk_imx8ulp_sim_lpav_data *data = dev_get_drvdata(arg);
|
||||
|
||||
spin_lock_irqsave(&data->lock, data->flags);
|
||||
}
|
||||
|
||||
static void clk_imx8ulp_sim_lpav_unlock(void *arg) __releases(&data->lock)
|
||||
{
|
||||
struct clk_imx8ulp_sim_lpav_data *data = dev_get_drvdata(arg);
|
||||
|
||||
spin_unlock_irqrestore(&data->lock, data->flags);
|
||||
}
|
||||
|
||||
static int clk_imx8ulp_sim_lpav_probe(struct platform_device *pdev)
|
||||
{
|
||||
const struct regmap_config regmap_config = {
|
||||
.reg_bits = 32,
|
||||
.val_bits = 32,
|
||||
.reg_stride = 4,
|
||||
.lock = clk_imx8ulp_sim_lpav_lock,
|
||||
.unlock = clk_imx8ulp_sim_lpav_unlock,
|
||||
.lock_arg = &pdev->dev,
|
||||
};
|
||||
struct clk_imx8ulp_sim_lpav_data *data;
|
||||
struct auxiliary_device *adev;
|
||||
struct regmap *regmap;
|
||||
void __iomem *base;
|
||||
struct clk_hw *hw;
|
||||
int i, ret;
|
||||
|
||||
data = devm_kzalloc(&pdev->dev,
|
||||
struct_size(data, clk_data.hws, ARRAY_SIZE(gates)),
|
||||
GFP_KERNEL);
|
||||
if (!data)
|
||||
return -ENOMEM;
|
||||
|
||||
dev_set_drvdata(&pdev->dev, data);
|
||||
|
||||
/*
|
||||
* this lock is used directly by the clock gate and indirectly
|
||||
* by the reset and mux controller via the regmap API
|
||||
*/
|
||||
spin_lock_init(&data->lock);
|
||||
|
||||
base = devm_platform_ioremap_resource(pdev, 0);
|
||||
if (IS_ERR(base))
|
||||
return dev_err_probe(&pdev->dev, PTR_ERR(base),
|
||||
"failed to ioremap base\n");
|
||||
/*
|
||||
* although the clock gate doesn't use the regmap API to modify the
|
||||
* registers, we still need the regmap because of the reset auxiliary
|
||||
* driver and the MUX drivers, which use the parent device's regmap
|
||||
*/
|
||||
regmap = devm_regmap_init_mmio(&pdev->dev, base, ®map_config);
|
||||
if (IS_ERR(regmap))
|
||||
return dev_err_probe(&pdev->dev, PTR_ERR(regmap),
|
||||
"failed to initialize regmap\n");
|
||||
|
||||
data->clk_data.num = ARRAY_SIZE(gates);
|
||||
|
||||
for (i = 0; i < ARRAY_SIZE(gates); i++) {
|
||||
hw = devm_clk_hw_register_gate_parent_data(&pdev->dev,
|
||||
gates[i].name,
|
||||
&gates[i].parent,
|
||||
CLK_SET_RATE_PARENT,
|
||||
base + SYSCTRL0,
|
||||
gates[i].bit,
|
||||
0x0, &data->lock);
|
||||
if (IS_ERR(hw))
|
||||
return dev_err_probe(&pdev->dev, PTR_ERR(hw),
|
||||
"failed to register %s gate\n",
|
||||
gates[i].name);
|
||||
|
||||
data->clk_data.hws[i] = hw;
|
||||
}
|
||||
|
||||
adev = devm_auxiliary_device_create(&pdev->dev, "reset", NULL);
|
||||
if (!adev)
|
||||
return dev_err_probe(&pdev->dev, -ENODEV,
|
||||
"failed to register aux reset\n");
|
||||
|
||||
ret = devm_of_clk_add_hw_provider(&pdev->dev,
|
||||
of_clk_hw_onecell_get,
|
||||
&data->clk_data);
|
||||
if (ret)
|
||||
return dev_err_probe(&pdev->dev, ret,
|
||||
"failed to register clk hw provider\n");
|
||||
|
||||
/* used to probe MUX child device */
|
||||
return devm_of_platform_populate(&pdev->dev);
|
||||
}
|
||||
|
||||
static const struct of_device_id clk_imx8ulp_sim_lpav_of_match[] = {
|
||||
{ .compatible = "fsl,imx8ulp-sim-lpav" },
|
||||
{ }
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, clk_imx8ulp_sim_lpav_of_match);
|
||||
|
||||
static struct platform_driver clk_imx8ulp_sim_lpav_driver = {
|
||||
.probe = clk_imx8ulp_sim_lpav_probe,
|
||||
.driver = {
|
||||
.name = "clk-imx8ulp-sim-lpav",
|
||||
.of_match_table = clk_imx8ulp_sim_lpav_of_match,
|
||||
},
|
||||
};
|
||||
module_platform_driver(clk_imx8ulp_sim_lpav_driver);
|
||||
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_DESCRIPTION("i.MX8ULP LPAV System Integration Module (SIM) clock driver");
|
||||
MODULE_AUTHOR("Laurentiu Mihalcea <laurentiu.mihalcea@nxp.com>");
|
||||
|
|
@ -255,4 +255,9 @@
|
|||
|
||||
#define IMX8ULP_CLK_PCC5_END 56
|
||||
|
||||
/* LPAV SIM */
|
||||
#define IMX8ULP_CLK_SIM_LPAV_HIFI_CORE 0
|
||||
#define IMX8ULP_CLK_SIM_LPAV_HIFI_PBCLK 1
|
||||
#define IMX8ULP_CLK_SIM_LPAV_HIFI_PLAT 2
|
||||
|
||||
#endif
|
||||
|
|
|
|||
16
include/dt-bindings/reset/fsl,imx8ulp-sim-lpav.h
Normal file
16
include/dt-bindings/reset/fsl,imx8ulp-sim-lpav.h
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */
|
||||
/*
|
||||
* Copyright 2025 NXP
|
||||
*/
|
||||
|
||||
#ifndef DT_BINDING_RESET_IMX8ULP_SIM_LPAV_H
|
||||
#define DT_BINDING_RESET_IMX8ULP_SIM_LPAV_H
|
||||
|
||||
#define IMX8ULP_SIM_LPAV_HIFI4_DSP_DBG_RST 0
|
||||
#define IMX8ULP_SIM_LPAV_HIFI4_DSP_RST 1
|
||||
#define IMX8ULP_SIM_LPAV_HIFI4_DSP_STALL 2
|
||||
#define IMX8ULP_SIM_LPAV_DSI_RST_BYTE_N 3
|
||||
#define IMX8ULP_SIM_LPAV_DSI_RST_ESC_N 4
|
||||
#define IMX8ULP_SIM_LPAV_DSI_RST_DPI_N 5
|
||||
|
||||
#endif /* DT_BINDING_RESET_IMX8ULP_SIM_LPAV_H */
|
||||
Loading…
Reference in New Issue
Block a user