On Tue, Feb 6, 2018 at 8:07 PM, Marek Vasut <ma...@denx.de> wrote:
> On 02/06/2018 03:25 PM, Jagan Teki wrote:
>> Move struct sunxi_ccm_reg pointer to private structure
>> so-that accessing ccm reg base become more proper way
>> and avoid local initialization in each function.
>>
>> Signed-off-by: Jagan Teki <ja...@amarulasolutions.com>
>> ---
>>  drivers/usb/host/ehci-sunxi.c | 15 +++++++++------
>>  drivers/usb/host/ohci-sunxi.c | 19 +++++++++++--------
>>  drivers/usb/musb-new/sunxi.c  | 34 +++++++++++++++++++++++-----------
>>  3 files changed, 43 insertions(+), 25 deletions(-)
>>
>> diff --git a/drivers/usb/host/ehci-sunxi.c b/drivers/usb/host/ehci-sunxi.c
>> index 6ecb7c4..ed9763c 100644
>> --- a/drivers/usb/host/ehci-sunxi.c
>> +++ b/drivers/usb/host/ehci-sunxi.c
>> @@ -27,19 +27,23 @@
>>
>>  struct ehci_sunxi_priv {
>>       struct ehci_ctrl ehci;
>> +     struct sunxi_ccm_reg *ccm;
>>       int ahb_gate_mask; /* Mask of ahb_gate0 clk gate bits for this hcd */
>>       int phy_index;     /* Index of the usb-phy attached to this hcd */
>>  };
>>
>>  static int ehci_usb_probe(struct udevice *dev)
>>  {
>> -     struct sunxi_ccm_reg *ccm = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
>
> Keep this, so you don't have to modify every setbits()/... down below.

I'm keeping ccm base in priv, so-that resigning base in remove can
avoid and use the priv->ccm where ever possible.

>
>>       struct usb_platdata *plat = dev_get_platdata(dev);
>>       struct ehci_sunxi_priv *priv = dev_get_priv(dev);
>>       struct ehci_hccr *hccr = (struct ehci_hccr *)devfdt_get_addr(dev);
>>       struct ehci_hcor *hcor;
>>       int extra_ahb_gate_mask = 0;
>>
>> +     priv->ccm = (struct sunxi_ccm_reg *)SUNXI_CCM_BASE;
>
> Do priv->ccm = ccm , done .

Will update.
_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
https://lists.denx.de/listinfo/u-boot

Reply via email to