lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAD=FV=Vxo8D+W_=m1+ODEarMXgCgcT0cSs3KekTkGyvVVANyMA@mail.gmail.com>
Date:	Mon, 14 Jan 2013 15:45:30 -0800
From:	Doug Anderson <dianders@...omium.org>
To:	Vivek Gautam <gautamvivek1987@...il.com>
Cc:	Vivek Gautam <gautam.vivek@...sung.com>, linux-usb@...r.kernel.org,
	yulgon.kim@...sung.com, linux-samsung-soc@...r.kernel.org,
	Praveen Paneri <p.paneri@...sung.com>,
	gregkh@...uxfoundation.org, devicetree-discuss@...ts.ozlabs.org,
	jg1.han@...sung.com,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	balbi@...com, kishon@...com, Kukjin Kim <kgene.kim@...sung.com>,
	Alan Stern <stern@...land.harvard.edu>,
	Rob Herring <rob.herring@...xeda.com>,
	Sylwester Nawrocki <sylvester.nawrocki@...il.com>
Subject: Re: [PATCH v5 2/4] usb: phy: samsung: Add host phy support to
 samsung-phy driver

Vivek,


On Mon, Jan 14, 2013 at 12:06 AM, Vivek Gautam
<gautamvivek1987@...il.com> 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-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ