[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220411060217.xj2zbcqva3mblvt2@mobilestation>
Date: Mon, 11 Apr 2022 09:02:17 +0300
From: Serge Semin <fancer.lancer@...il.com>
To: Damien Le Moal <damien.lemoal@...nsource.wdc.com>
Cc: Serge Semin <Sergey.Semin@...kalelectronics.ru>,
Hans de Goede <hdegoede@...hat.com>,
Jens Axboe <axboe@...nel.dk>,
Alexey Malahov <Alexey.Malahov@...kalelectronics.ru>,
Pavel Parkhomenko <Pavel.Parkhomenko@...kalelectronics.ru>,
Rob Herring <robh+dt@...nel.org>, linux-ide@...r.kernel.org,
linux-kernel@...r.kernel.org, devicetree@...r.kernel.org
Subject: Re: [PATCH 06/21] ata: libahci_platform: Add function returning a
clock-handle by id
On Thu, Mar 24, 2022 at 10:36:04AM +0900, Damien Le Moal wrote:
> On 3/24/22 09:16, Serge Semin wrote:
> > Since all the clocks are retrieved by the method
> > ahci_platform_get_resources() there is no need for the glue-drivers to be
> > looking for some particular of them in the kernel clocks table again.
> > Instead we suggest to add a simple method returning a device-specific
> > clock with passed connection ID if it is managed to be found. Otherwise
> > the function will return NULL. Thus the glue-drivers won't need to either
>
> "glue-drivers" is really unclear. What do you mean ?
"Glue drivers" is a common name to address the drivers which are used to
pre-initialize the platform-specifics, then normally create a core driver
descriptor/data and finally call some core method (like
ahci_platform_init_host()) to really bind the device in the particular
bus. You can find them in almost all the kernel subsystems. For instance
in case of this patchset the glue-driver is drivers/ata/ahci_dwc.c, while
the main/core part of the driver is implemented in drivers/ata/achi.c,
drivers/ata/libahci.c, drivers/ata/libahci_platform.c, etc.
It's not like I've come up with the term by myself. I've seen it used in a
plenty of the kernel patches and subsystems and will unlikely stop using
it since it determines the particular type of the kernel drivers in a
short and direct manner.
>
> > manually touching the hpriv->clks array or calling clk_get()-friends. The
> > AHCI platform drivers will be able to use the new function right after the
> > ahci_platform_get_resources() method invocation and up to the device
> > removal.
> >
> > Signed-off-by: Serge Semin <Sergey.Semin@...kalelectronics.ru>
> > ---
> > drivers/ata/libahci_platform.c | 27 +++++++++++++++++++++++++++
> > include/linux/ahci_platform.h | 3 +++
> > 2 files changed, 30 insertions(+)
> >
> > diff --git a/drivers/ata/libahci_platform.c b/drivers/ata/libahci_platform.c
> > index d805ddc3a024..4fb9629c03ab 100644
> > --- a/drivers/ata/libahci_platform.c
> > +++ b/drivers/ata/libahci_platform.c
> > @@ -94,6 +94,33 @@ void ahci_platform_disable_phys(struct ahci_host_priv *hpriv)
> > }
> > EXPORT_SYMBOL_GPL(ahci_platform_disable_phys);
> >
> > +/**
> > + * ahci_platform_find_clk - Find platform clock
> > + * @hpriv: host private area to store config values
> > + * @con_id: clock connection ID
> > + *
> > + * This function returns point to the clock descriptor of the clock with
> > + * passed ID.
> > + *
> > + * RETURNS:
> > + * Pointer to the clock descriptor on success otherwise NULL
> > + */
> > +struct clk *ahci_platform_find_clk(struct ahci_host_priv *hpriv, const char *con_id)
> > +{
> > + struct clk *clk = NULL;
> > + int i;
> > +
> > + for (i = 0; i < hpriv->n_clks; i++) {
> > + if (!strcmp(hpriv->clks[i].id, con_id)) {
> > + clk = hpriv->clks[i].clk;
> > + break;
> > + }
> > + }
> > +
> > + return clk;
> > +}
> > +EXPORT_SYMBOL_GPL(ahci_platform_find_clk);
> > +
> > /**
> > * ahci_platform_enable_clks - Enable platform clocks
> > * @hpriv: host private area to store config values
> > diff --git a/include/linux/ahci_platform.h b/include/linux/ahci_platform.h
> > index 49e5383d4222..fd964e6a68d6 100644
> > --- a/include/linux/ahci_platform.h
> > +++ b/include/linux/ahci_platform.h
> > @@ -13,6 +13,7 @@
> >
> > #include <linux/compiler.h>
> >
> > +struct clk;
> > struct device;
> > struct ata_port_info;
> > struct ahci_host_priv;
> > @@ -21,6 +22,8 @@ struct scsi_host_template;
> >
> > int ahci_platform_enable_phys(struct ahci_host_priv *hpriv);
> > void ahci_platform_disable_phys(struct ahci_host_priv *hpriv);
> > +struct clk *
> > +ahci_platform_find_clk(struct ahci_host_priv *hpriv, const char *con_id);
>
> No users for this function ?
It will be used in the next two patches:
[PATCH 17/21] ata: ahci: Add DWC AHCI SATA controller support
[PATCH 20/21] ata: ahci-dwc: Add Baikal-T1 AHCI SATA interface support
and most likely in the new AHCI/SATA drivers which need to tune the clocks
up in the platform-specific way.
-Sergey
>
> > int ahci_platform_enable_clks(struct ahci_host_priv *hpriv);
> > void ahci_platform_disable_clks(struct ahci_host_priv *hpriv);
> > int ahci_platform_enable_regulators(struct ahci_host_priv *hpriv);
>
>
> --
> Damien Le Moal
> Western Digital Research
Powered by blists - more mailing lists