lkml.org 
[lkml]   [2022]   [Aug]   [24]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH net-next] driver: cadence macb driver support acpi mode
> +/* On ACPI platforms, clocks are controlled by firmware and/or
> + * ACPI, not by drivers.Need to store the clock value.
> + */
> +struct macb_acpi_config {
> + u32 hclk_rate; /* amba clock rate*/
> + u32 pclk_rate; /* amba apb clock rate*/
> + u32 txclk_rate; /* tx clock rate*/
> + u32 rxclk_rate; /* rx clock rate*/
> + u32 tsuclk_rate; /* tx clock rate*/
> + bool acpi_enable; /* is acpi or not */
> +};

> +static int macb_acpi_support(struct macb *bp)
> +{
> + struct device *dev = &bp->pdev->dev;
> + struct macb_acpi_config *config = &bp->acpicfg;
> + int ret;
> + u32 property;
> +
> + /*acpi must be report the pclk*/
> + property = 0;
> + ret = device_property_read_u32(dev, MACB_SYSPCLOCK, &property);
> + if (ret) {
> + dev_err(dev, "unable to obtain %s property\n", MACB_SYSPCLOCK);
> + return ret;
> + }
> +
> + config->pclk_rate = property;

It seems like you could make this simpler by just calling

clk_hw_register_fixed_rate(dev, "pclk", NULL, 0, property);

You then don't need to modify any other code with respect to clocks.
The clock does exist, so model it in the common clock framework.

Andrew

\
 
 \ /
  Last update: 2022-08-24 17:18    [W:0.430 / U:0.380 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site