Hi,
On 2023/6/1 02:07, Lucas Stach wrote:
+static int etnaviv_gpu_clk_get(struct etnaviv_gpu *gpu)
+{
+ struct device *dev = gpu->dev;
+
+ if (gpu->no_clk)
+ return 0;
+
+ gpu->clk_reg = devm_clk_get_optional(dev, "reg");
+ DBG("clk_reg: %p", gpu->clk_reg);
+ if (IS_ERR(gpu->clk_reg))
+ return PTR_ERR(gpu->clk_reg);
+
+ gpu->clk_bus = devm_clk_get_optional(dev, "bus");
+ DBG("clk_bus: %p", gpu->clk_bus);
+ if (IS_ERR(gpu->clk_bus))
+ return PTR_ERR(gpu->clk_bus);
+
+ gpu->clk_core = devm_clk_get(dev, "core");
+ DBG("clk_core: %p", gpu->clk_core);
+ if (IS_ERR(gpu->clk_core))
+ return PTR_ERR(gpu->clk_core);
+ gpu->base_rate_core = clk_get_rate(gpu->clk_core);
+
+ gpu->clk_shader = devm_clk_get_optional(dev, "shader");
+ DBG("clk_shader: %p", gpu->clk_shader);
+ if (IS_ERR(gpu->clk_shader))
+ return PTR_ERR(gpu->clk_shader);
+ gpu->base_rate_shader = clk_get_rate(gpu->clk_shader);
+
+ return 0;
+}
+
static int etnaviv_gpu_clk_enable(struct etnaviv_gpu *gpu)
{
int ret;
+ if (gpu->no_clk)
+ return 0;
+
I don't see why this would be needed?
I have just tested, this do not needed.
If your platform doesn't provide
CONFIG_HAVE_CLK all those functions should be successful no-ops, so
there is no need to special case this in the driver.
My platform do enable CONFIG_HAVE_CLK,
for ls3a5000 + ls7a1000, my system do not provide device tree support,
that's is to say, there is no DT support.
For ls3a4000 + ls7a1000 platform, the system has DT support, but don't
has CLK drivers implement toward the clock tree.
typically, our platform's firmware will do such thing(setting a default
working frequency).
When I first saw etnaviv, I'm also astonishing.
I don't know why there so much clock controllable.
As far as I can understand, my system/hardware have only one clock,
It shall corresponding to the core clk.
Or does your platform in fact provide a clk subsystem, just the GPU
clocks are managed by it?
Also all those functions are fine with being called on a NULL clk, so
shouldn't it be enough to simply avoid calling etnaviv_gpu_clk_get() in
the PCI device case?
Regards,
Lucas
--
Jingfeng