All of lore.kernel.org
 help / color / mirror / Atom feed
From: Felipe Balbi <balbi@kernel.org>
To: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
Cc: linux-usb@vger.kernel.org, devicetree@vger.kernel.org,
	gregkh@linuxfoundation.org, shubhrajyoti.datta@gmail.com,
	git@xilinx.com
Subject: Re: [PATCH v2 1/2] usb: gadget: udc-xilinx: Add clock support
Date: Mon, 20 Sep 2021 14:48:52 +0300	[thread overview]
Message-ID: <87wnnbqxem.fsf@kernel.org> (raw)
In-Reply-To: <7341ed525f03f4593958bb3d1232660df23f838f.1631871264.git.shubhrajyoti.datta@xilinx.com>


Hi,

Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com> writes:
> Currently the driver depends on the  bootloader to enable the clocks.
> Add support for clocking. The patch enables the clock at  probe and
> disables them at remove.
>
> Signed-off-by: Shubhrajyoti Datta <shubhrajyoti.datta@xilinx.com>
> ---
>  drivers/usb/gadget/udc/udc-xilinx.c | 24 ++++++++++++++++++++++++
>  1 file changed, 24 insertions(+)
>
> diff --git a/drivers/usb/gadget/udc/udc-xilinx.c b/drivers/usb/gadget/udc/udc-xilinx.c
> index fb4ffedd6f0d..30070a488c87 100644
> --- a/drivers/usb/gadget/udc/udc-xilinx.c
> +++ b/drivers/usb/gadget/udc/udc-xilinx.c
> @@ -11,6 +11,7 @@
>   * USB peripheral controller (at91_udc.c).
>   */
>  
> +#include <linux/clk.h>
>  #include <linux/delay.h>
>  #include <linux/device.h>
>  #include <linux/dma-mapping.h>
> @@ -171,6 +172,7 @@ struct xusb_ep {
>   * @addr: the usb device base address
>   * @lock: instance of spinlock
>   * @dma_enabled: flag indicating whether the dma is included in the system
> + * @clk: pointer to struct clk
>   * @read_fn: function pointer to read device registers
>   * @write_fn: function pointer to write to device registers
>   */
> @@ -188,6 +190,7 @@ struct xusb_udc {
>  	void __iomem *addr;
>  	spinlock_t lock;
>  	bool dma_enabled;
> +	struct clk *clk;
>  
>  	unsigned int (*read_fn)(void __iomem *);
>  	void (*write_fn)(void __iomem *, u32, u32);
> @@ -2092,6 +2095,26 @@ static int xudc_probe(struct platform_device *pdev)
>  	udc->gadget.ep0 = &udc->ep[XUSB_EP_NUMBER_ZERO].ep_usb;
>  	udc->gadget.name = driver_name;
>  
> +	udc->clk = devm_clk_get(&pdev->dev, "s_axi_aclk");
> +	if (IS_ERR(udc->clk)) {

might be a way idea to add a dev_warn() here in case you get
ENOENT. This should let people that DTS has to be updated accordingly.

-- 
balbi

  reply	other threads:[~2021-09-20 11:49 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-17  9:50 [PATCH v2 0/2] usb: gadget: Add clock support Shubhrajyoti Datta
2021-09-17  9:50 ` [PATCH v2 1/2] usb: gadget: udc-xilinx: " Shubhrajyoti Datta
2021-09-20 11:48   ` Felipe Balbi [this message]
2021-09-17  9:50 ` [PATCH v2 2/2] dt-binding: usb: xilinx: Add clocking node Shubhrajyoti Datta

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87wnnbqxem.fsf@kernel.org \
    --to=balbi@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=git@xilinx.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=shubhrajyoti.datta@gmail.com \
    --cc=shubhrajyoti.datta@xilinx.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.