Hi, Shubhrajyoti Datta <shubhrajyoti.datta@xxxxxxxxxx> 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@xxxxxxxxxx> > --- > 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)) { > + if (PTR_ERR(udc->clk) != -ENOENT) { > + ret = PTR_ERR(udc->clk); > + goto fail; > + } > + > + /* > + * Clock framework support is optional, continue on, > + * anyways if we don't find a matching clock > + */ > + udc->clk = NULL; should it be, though? Might be a good idea to add fixed-clock instances to the boards still depending on clock framework. Maybe that can be done over time, but worth considering anyhow. -- balbi