Re: [PATCH v5 2/4] usb: phy: samsung: Add host phy support to samsung-phy driver

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

 



Vivek,


On Mon, Jan 14, 2013 at 12:06 AM, Vivek Gautam
<gautamvivek1987@xxxxxxxxx> wrote:
>> Is it fine if we don't use macro for SHIFT, earlier code also doesn't use it.
>> Can we just do like this ..
>> #define HOST_CTRL0_FSEL_MASK                       (0x7 << 16)
>> #define HOST_CTRL0_FSEL_CLKSEL_50M            (0x7 << 16)
>> #define HOST_CTRL0_FSEL_CLKSEL_24M            (0x5 << 16)
>> #define HOST_CTRL0_FSEL_CLKSEL_20M            (0x4 << 16)
>> #define HOST_CTRL0_FSEL_CLKSEL_19200K       (0x3 << 16)
>> #define HOST_CTRL0_FSEL_CLKSEL_12M            (0x2 << 16)
>> #define HOST_CTRL0_FSEL_CLKSEL_10M            (0x1 << 16)
>> #define HOST_CTRL0_FSEL_CLKSEL_9600K         (0x0 << 16)

I don't have a problem with just putting the << 16 there...

> Actually missed one thing here, this "HOST_CTRL0_FSEL_CLKSEL_XX" is
> being used by
> HOST/OTG blocks to prepare reference clock, that's the reason we kept
>             #define HOST_CTRL0_FSEL(_x)                  ((_x) << 16)
> and       #define OTG_SYS_FSEL(_x)                       ((_x) << 4)
> where (_x) is the reference clock returned from
> samsung_usbphy_get_refclk_freq().

I feel like samsung_usbphy_get_refclk_freq() is supposed to be
returning an already shifted value.  ...at least that's how it appears
to work with existing code.  Why does it feel like that?  ...because
with existing code we have:

#define PHYCLK_CLKSEL_MASK (0x3 << 0)
#define PHYCLK_CLKSEL_48M (0x0 << 0)
#define PHYCLK_CLKSEL_12M (0x2 << 0)
#define PHYCLK_CLKSEL_24M (0x3 << 0)

Those #defines are what are returned by
samsung_usbphy_get_refclk_freq().  The fact that the "<< 0" is there
implies (to me) that the existing function would return shifted values
if it were applicable.

For exynos you are having the same function return things like:

#define FSEL_CLKSEL_50M (0x7)
#define FSEL_CLKSEL_24M (0x5)
#define FSEL_CLKSEL_20M (0x4)

...to me that means that the exynos code is returning unshifted values.


If you say that samsung_usbphy_get_refclk_freq() is in charge of
returning shifted values then you no longer need the HOST_CTRL0_FSEL()
macro.


In any case, I will defer to whatever Felipe thinks is best here (if
he has an opinion on it).  I am only pointing out that the exynos code
and existing code seem to be specifying things differently.  That's
weird to me.


> so we can change this to something like
>
>                            case 10 * MHZ:
>                                      refclk_freq = FSEL_CLKSEL_10M;
>                                      break;
> and so on.
> will this be fine ?

Seems good to me.


-Doug
--
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