From: Kishon Vijay Abraham I <kishon@ti.com>
To: Roger Quadros <rogerq@ti.com>, tony@atomide.com, balbi@ti.com
Cc: george.cherian@ti.com, balajitk@ti.com, hdegoede@redhat.com,
linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org, devicetree@vger.kernel.org,
linux-usb@vger.kernel.org, linux-ide@vger.kernel.org
Subject: Re: [PATCH v2 05/13] phy: ti-pipe3: Add SATA DPLL support
Date: Thu, 6 Mar 2014 21:15:57 +0530 [thread overview]
Message-ID: <53189835.5070905@ti.com> (raw)
In-Reply-To: <1394116729-28811-6-git-send-email-rogerq@ti.com>
On Thursday 06 March 2014 08:08 PM, Roger Quadros wrote:
> USB and SATA DPLLs need different settings. Provide
> the SATA DPLL settings and use the proper DPLL settings
> based on device tree node's compatible_id.
>
> Update the DT binding information.
>
> Signed-off-by: Roger Quadros <rogerq@ti.com>
> ---
> Documentation/devicetree/bindings/phy/ti-phy.txt | 3 +-
> drivers/phy/phy-ti-pipe3.c | 76 +++++++++++++++++-------
same here..
-Kishon
> 2 files changed, 57 insertions(+), 22 deletions(-)
>
> diff --git a/Documentation/devicetree/bindings/phy/ti-phy.txt b/Documentation/devicetree/bindings/phy/ti-phy.txt
> index 8d13349..2c2d66a 100644
> --- a/Documentation/devicetree/bindings/phy/ti-phy.txt
> +++ b/Documentation/devicetree/bindings/phy/ti-phy.txt
> @@ -53,7 +53,8 @@ usb2phy@4a0ad080 {
> TI PIPE3 PHY
>
> Required properties:
> - - compatible: Should be "ti,phy-usb3". "ti,omap-usb3" is deprecated.
> + - compatible: Should be "ti,phy-usb3" or "ti,phy-pipe3-sata".
> + "ti,omap-usb3" is deprecated.
> - reg : Address and length of the register set for the device.
> - reg-names: The names of the register addresses corresponding to the registers
> filled in "reg".
> diff --git a/drivers/phy/phy-ti-pipe3.c b/drivers/phy/phy-ti-pipe3.c
> index 211703c..f141237 100644
> --- a/drivers/phy/phy-ti-pipe3.c
> +++ b/drivers/phy/phy-ti-pipe3.c
> @@ -66,6 +66,11 @@ struct pipe3_dpll_params {
> u32 mf;
> };
>
> +struct pipe3_dpll_map {
> + unsigned long rate;
> + struct pipe3_dpll_params params;
> +};
> +
> struct ti_pipe3 {
> void __iomem *pll_ctrl_base;
> struct device *dev;
> @@ -73,20 +78,27 @@ struct ti_pipe3 {
> struct clk *wkupclk;
> struct clk *sys_clk;
> struct clk *refclk;
> + struct pipe3_dpll_map *dpll_map;
> };
>
> -struct pipe3_dpll_map {
> - unsigned long rate;
> - struct pipe3_dpll_params params;
> -};
> -
> -static struct pipe3_dpll_map dpll_map[] = {
> +static struct pipe3_dpll_map dpll_map_usb[] = {
> {12000000, {1250, 5, 4, 20, 0} }, /* 12 MHz */
> {16800000, {3125, 20, 4, 20, 0} }, /* 16.8 MHz */
> {19200000, {1172, 8, 4, 20, 65537} }, /* 19.2 MHz */
> {20000000, {1000, 7, 4, 10, 0} }, /* 20 MHz */
> {26000000, {1250, 12, 4, 20, 0} }, /* 26 MHz */
> {38400000, {3125, 47, 4, 20, 92843} }, /* 38.4 MHz */
> + { }, /* Terminator */
> +};
> +
> +static struct pipe3_dpll_map dpll_map_sata[] = {
> + {12000000, {1000, 7, 4, 6, 0} }, /* 12 MHz */
> + {16800000, {714, 7, 4, 6, 0} }, /* 16.8 MHz */
> + {19200000, {625, 7, 4, 6, 0} }, /* 19.2 MHz */
> + {20000000, {600, 7, 4, 6, 0} }, /* 20 MHz */
> + {26000000, {461, 7, 4, 6, 0} }, /* 26 MHz */
> + {38400000, {312, 7, 4, 6, 0} }, /* 38.4 MHz */
> + { }, /* Terminator */
> };
>
> static inline u32 ti_pipe3_readl(void __iomem *addr, unsigned offset)
> @@ -100,15 +112,20 @@ static inline void ti_pipe3_writel(void __iomem *addr, unsigned offset,
> __raw_writel(data, addr + offset);
> }
>
> -static struct pipe3_dpll_params *ti_pipe3_get_dpll_params(unsigned long rate)
> +static struct pipe3_dpll_params *ti_pipe3_get_dpll_params(struct ti_pipe3 *phy)
> {
> - int i;
> + unsigned long rate;
> + struct pipe3_dpll_map *dpll_map = phy->dpll_map;
>
> - for (i = 0; i < ARRAY_SIZE(dpll_map); i++) {
> - if (rate == dpll_map[i].rate)
> - return &dpll_map[i].params;
> + rate = clk_get_rate(phy->sys_clk);
> +
> + for (; dpll_map->rate; dpll_map++) {
> + if (rate == dpll_map->rate)
> + return &dpll_map->params;
> }
>
> + dev_err(phy->dev, "No DPLL configuration for %lu Hz SYS CLK\n", rate);
> +
> return NULL;
> }
>
> @@ -182,16 +199,11 @@ static void ti_pipe3_dpll_relock(struct ti_pipe3 *phy)
> static int ti_pipe3_dpll_lock(struct ti_pipe3 *phy)
> {
> u32 val;
> - unsigned long rate;
> struct pipe3_dpll_params *dpll_params;
>
> - rate = clk_get_rate(phy->sys_clk);
> - dpll_params = ti_pipe3_get_dpll_params(rate);
> - if (!dpll_params) {
> - dev_err(phy->dev,
> - "No DPLL configuration for %lu Hz SYS CLK\n", rate);
> + dpll_params = ti_pipe3_get_dpll_params(phy);
> + if (!dpll_params)
> return -EINVAL;
> - }
>
> val = ti_pipe3_readl(phy->pll_ctrl_base, PLL_CONFIGURATION1);
> val &= ~PLL_REGN_MASK;
> @@ -244,6 +256,10 @@ static struct phy_ops ops = {
> .owner = THIS_MODULE,
> };
>
> +#ifdef CONFIG_OF
> +static const struct of_device_id ti_pipe3_id_table[];
> +#endif
> +
> static int ti_pipe3_probe(struct platform_device *pdev)
> {
> struct ti_pipe3 *phy;
> @@ -253,8 +269,10 @@ static int ti_pipe3_probe(struct platform_device *pdev)
> struct device_node *node = pdev->dev.of_node;
> struct device_node *control_node;
> struct platform_device *control_pdev;
> + const struct of_device_id *match;
>
> - if (!node)
> + match = of_match_device(of_match_ptr(ti_pipe3_id_table), &pdev->dev);
> + if (!match)
> return -EINVAL;
>
> phy = devm_kzalloc(&pdev->dev, sizeof(*phy), GFP_KERNEL);
> @@ -263,6 +281,12 @@ static int ti_pipe3_probe(struct platform_device *pdev)
> return -ENOMEM;
> }
>
> + phy->dpll_map = (struct pipe3_dpll_map *)match->data;
> + if (!phy->dpll_map) {
> + dev_err(&pdev->dev, "no DPLL data\n");
> + return -EINVAL;
> + }
> +
> res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "pll_ctrl");
> phy->pll_ctrl_base = devm_ioremap_resource(&pdev->dev, res);
> if (IS_ERR(phy->pll_ctrl_base))
> @@ -388,8 +412,18 @@ static const struct dev_pm_ops ti_pipe3_pm_ops = {
>
> #ifdef CONFIG_OF
> static const struct of_device_id ti_pipe3_id_table[] = {
> - { .compatible = "ti,phy-usb3" },
> - { .compatible = "ti,omap-usb3" },
> + {
> + .compatible = "ti,phy-usb3",
> + .data = dpll_map_usb,
> + },
> + {
> + .compatible = "ti,omap-usb3",
> + .data = dpll_map_usb,
> + },
> + {
> + .compatible = "ti,phy-pipe3-sata",
> + .data = dpll_map_sata,
> + },
> {}
> };
> MODULE_DEVICE_TABLE(of, ti_pipe3_id_table);
>
next prev parent reply other threads:[~2014-03-06 15:45 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-03-06 14:38 [PATCH v2 00/13][RESEND] ARM: OMAP: SATA support for OMAP5 & DRA7 Roger Quadros
2014-03-06 14:38 ` [PATCH v2 01/13] phy: rename struct omap_control_usb to struct omap_control_phy Roger Quadros
2014-03-06 15:37 ` Kishon Vijay Abraham I
2014-03-06 15:56 ` Felipe Balbi
2014-03-06 14:38 ` [PATCH v2 02/13] phy: omap-control: Update DT binding information Roger Quadros
2014-03-06 15:40 ` Kishon Vijay Abraham I
2014-03-06 15:58 ` Felipe Balbi
2014-03-06 14:38 ` [PATCH v2 03/13] phy: omap-control: update dra7 and am437 usb2 bindings Roger Quadros
2014-03-06 15:41 ` Kishon Vijay Abraham I
2014-03-07 8:25 ` [PATCH v4] phy: omap-control: update dra7 and am437 usb2 Documentation bindings Kishon Vijay Abraham I
[not found] ` <1394121786-28193-1-git-send-email-balbi@ti.com>
2014-03-07 8:26 ` Kishon Vijay Abraham I
2014-03-06 16:00 ` [PATCH v2 03/13] phy: omap-control: update dra7 and am437 usb2 bindings Felipe Balbi
2014-03-06 14:38 ` [PATCH v2 04/13] phy: ti-pipe3: cleanup clock handling Roger Quadros
2014-03-06 15:45 ` Kishon Vijay Abraham I
2014-03-06 14:38 ` [PATCH v2 05/13] phy: ti-pipe3: Add SATA DPLL support Roger Quadros
2014-03-06 15:45 ` Kishon Vijay Abraham I [this message]
[not found] ` <1394116729-28811-1-git-send-email-rogerq-l0cyMroinI0@public.gmane.org>
2014-03-06 14:38 ` [PATCH v2 06/13] phy: ti-pipe3: Don't get 'wkupclk' and 'refclk' for SATA PHY Roger Quadros
2014-03-06 15:31 ` [PATCH v3 " Roger Quadros
2014-03-06 14:38 ` [PATCH v2 07/13] phy: ti-pipe3: streamline PHY operations Roger Quadros
2014-03-06 14:38 ` [PATCH v2 08/13] phy: ti-pipe3: Fix suspend/resume and module reload Roger Quadros
2014-03-06 14:38 ` [PATCH v2 09/13] phy: omap: Depend on OMAP_OCP2SCP bus driver Roger Quadros
2014-03-06 14:38 ` [PATCH v2 10/13] ARM: OMAP5: hwmod: Add ocp2scp3 and sata hwmods Roger Quadros
2014-03-06 14:38 ` [PATCH v2 11/13] ARM: dts: omap5: add sata node Roger Quadros
2014-03-06 14:38 ` [PATCH v2 12/13] ARM: DRA7: hwmod: Add ocp2scp3 and sata hwmods Roger Quadros
2014-03-06 14:38 ` [PATCH v2 13/13] ARM: dts: dra7: add OCP2SCP3 and SATA nodes Roger Quadros
-- strict thread matches above, loose matches on Subject: below --
2014-03-06 14:22 [PATCH v2 00/13] ARM: OMAP: SATA support for OMAP5 & DRA7 Roger Quadros
2014-03-06 14:22 ` [PATCH v2 05/13] phy: ti-pipe3: Add SATA DPLL support Roger Quadros
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=53189835.5070905@ti.com \
--to=kishon@ti.com \
--cc=balajitk@ti.com \
--cc=balbi@ti.com \
--cc=devicetree@vger.kernel.org \
--cc=george.cherian@ti.com \
--cc=hdegoede@redhat.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-ide@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=rogerq@ti.com \
--cc=tony@atomide.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).