Re: [PATCH] usb: phy: bcm-ns-usb3: new driver for USB 3.0 PHY on Northstar

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 29 March 2016 at 03:46, Florian Fainelli <f.fainelli@xxxxxxxxx> wrote:
> CC: bcm-kernel-feedback-list, Jon
>
> Le 28/03/2016 14:59, Rafał Miłecki a écrit :
>> +static inline struct bcm_ns_usb3 *phy_to_usb3(struct usb_phy *phy)
>> +{
>> +     return container_of(phy, struct bcm_ns_usb3, phy);
>> +}
>> +
>> +static bool bcm_ns_usb3_wait_reg(struct bcm_ns_usb3 *usb3, void __iomem *addr,
>> +                              u32 mask, u32 value, int timeout)
>> +{
>> +     unsigned long deadline = jiffies + timeout;
>
> We are mixing timeout in micro seconds with jiffies here, should that be
> msecs_to_jiffies(timeout) instead?

It should! Thanks.


>> +     u32 val;
>> +
>> +     do {
>> +             val = readl(addr);
>> +             if ((val & mask) == value)
>> +                     return true;
>> +             cpu_relax();
>> +             udelay(10);
>
> Delay + relax, why not a msleep() instead?

I dropped cpu_relax and added counting how many iterations were
needed. In the worst case it took 3 loop iterations to have hw idle.
It gives ~30 us as the max needed waiting time. msleep would add too
much delay.


>> +static void bcm_ns_usb3_phy_init_ns_bx(struct bcm_ns_usb3 *usb3)
>> +{
>> +     struct bcma_drv_cc_b *ccb = &usb3->bus->drv_cc_b;
>> +
>> +     /* Enable MDIO. Setting MDCDIV as 26  */
>> +     iowrite32(0x0000009a, ccb->mii + BCMA_CCB_MII_MNG_CTL);
>> +     udelay(2);
>> +
>> +     /* USB3 PLL Block */
>> +     bcm_ns_usb3_mii_mng_write32(usb3, 0x587e8000);
>
> We might want to make the first write check whether the MII bus was idle
> or not, just in case?

Sure, good idea.

-- 
Rafał
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux