All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sergei Shtylyov <sshtylyov@mvista.com>
To: Sekhar Nori <nsekhar@ti.com>
Cc: davinci-linux-open-source@linux.davincidsp.com,
	Kevin Hilman <khilman@ti.com>,
	linux-arm-kernel@lists.infradead.org, linux-ide@vger.kernel.org
Subject: Re: [PATCH 3/4] davinci: da850: add support for SATA interface
Date: Wed, 23 Mar 2011 15:09:44 +0300	[thread overview]
Message-ID: <4D89E308.8060404@mvista.com> (raw)
In-Reply-To: <1300879949-16379-3-git-send-email-nsekhar@ti.com>

Hello.

On 23-03-2011 14:32, Sekhar Nori wrote:

> Add support for SATA controller on the
> DA850/OMAP-L138/AM18x devices.

> The patch adds the necessary clocks, platform
> resources and a routine to initialize the SATA
> controller.

> The PHY configuration in this patch is
> courtesy the work done by Zegeye Alemu,
> Swaminathan and Mansoor Ahamed from TI.

> While testing this patch, enable port multiplier
> support iff you are actually using one. The
> reasons of this behaviour are discussed
> here: http://patchwork.ozlabs.org/patch/78163/

> Signed-off-by: Sekhar Nori<nsekhar@ti.com>
> Cc: linux-ide@vger.kernel.org
[...]

> diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
> index 68fe4c2..276199d 100644
> --- a/arch/arm/mach-davinci/da850.c
> +++ b/arch/arm/mach-davinci/da850.c
> @@ -373,6 +373,14 @@ static struct clk spi1_clk = {
>   	.flags		= DA850_CLK_ASYNC3,
>   };
>
> +static struct clk sata_clk = {
> +	.name		= "sata",
> +	.parent		=&pll0_sysclk2,
> +	.lpsc		= DA850_LPSC1_SATA,
> +	.gpsc		= 1,
> +	.flags		= PSC_FORCE,
> +};
> +
>   static struct clk_lookup da850_clks[] = {
>   	CLK(NULL,		"ref",		&ref_clk),
>   	CLK(NULL,		"pll0",		&pll0_clk),
> @@ -419,6 +427,7 @@ static struct clk_lookup da850_clks[] = {
>   	CLK(NULL,		"usb20",	&usb20_clk),
>   	CLK("spi_davinci.0",	NULL,		&spi0_clk),
>   	CLK("spi_davinci.1",	NULL,		&spi1_clk),
> +	CLK("ahci",		NULL,		&sata_clk),
>   	CLK(NULL,		NULL,		NULL),
>   };

    I'd put the above into a separate patch...

> diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
> index 625d4b6..e061396 100644
> --- a/arch/arm/mach-davinci/devices-da8xx.c
> +++ b/arch/arm/mach-davinci/devices-da8xx.c
[...]
> @@ -834,3 +836,139 @@ int __init da8xx_register_spi(int instance, struct spi_board_info *info,
[...]
> +/* Supported DA850 SATA crystal frequencies */
> +#define KHZ_TO_HZ(freq) ((freq) * 1000)
> +static unsigned long da850_sata_xtal[] = {
> +	KHZ_TO_HZ(300000),
> +	KHZ_TO_HZ(250000),
> +	0,			/* Reserved */

    Why reserve a place for it at all?

> +	KHZ_TO_HZ(187500),
> +	KHZ_TO_HZ(150000),
> +	KHZ_TO_HZ(125000),
> +	KHZ_TO_HZ(120000),
> +	KHZ_TO_HZ(100000),
> +	KHZ_TO_HZ(75000),
> +	KHZ_TO_HZ(60000),
> +};
> +
> +static int da850_sata_init(struct device *dev, void __iomem *addr)
> +{
> +	int i, ret;
> +	unsigned int val;
> +
> +	da850_sata_clk = clk_get(dev, NULL);
> +	if (IS_ERR(da850_sata_clk))
> +		return PTR_ERR(da850_sata_clk);
> +
> +	ret = clk_enable(da850_sata_clk);
> +	if (ret)
> +		goto err0;
> +
> +	/* Enable SATA clock receiver */
> +	val = __raw_readl(DA8XX_SYSCFG1_VIRT(DA8XX_PWRDN_REG));
> +	val&= ~BIT(0);
> +	__raw_writel(val, DA8XX_SYSCFG1_VIRT(DA8XX_PWRDN_REG));
> +
> +	/* Get the multiplier needed for 1.5GHz PLL output */
> +	for (i = 0; i<  ARRAY_SIZE(da850_sata_xtal); i++) {
> +		if (da850_sata_xtal[i] == da850_sata_refclkpn)
> +			break;
> +	}

    {} not needed.

> +
> +	if (i == ARRAY_SIZE(da850_sata_xtal)) {
> +		ret = -EINVAL;
> +		goto err1;
> +	} else {

    *else* not needed here, after *goto*.

> +		val = SATA_PHY_MPY(i + 1);
> +	}
> +
[...]

> diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
> index e4fc1af..aa6f08e 100644
> --- a/arch/arm/mach-davinci/include/mach/da8xx.h
> +++ b/arch/arm/mach-davinci/include/mach/da8xx.h
[...]
> @@ -65,6 +66,7 @@ extern unsigned int da850_max_speed;
>   #define DA8XX_GPIO_BASE		0x01e26000
>   #define DA8XX_PSC1_BASE		0x01e27000
>   #define DA8XX_LCD_CNTRL_BASE	0x01e13000
> +#define DA850_SATA_BASE		0x01e18000

    It's used only in devices-da8xx.c -- shouldn't it be declared there?

WBR, Sergei

WARNING: multiple messages have this Message-ID (diff)
From: sshtylyov@mvista.com (Sergei Shtylyov)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/4] davinci: da850: add support for SATA interface
Date: Wed, 23 Mar 2011 15:09:44 +0300	[thread overview]
Message-ID: <4D89E308.8060404@mvista.com> (raw)
In-Reply-To: <1300879949-16379-3-git-send-email-nsekhar@ti.com>

Hello.

On 23-03-2011 14:32, Sekhar Nori wrote:

> Add support for SATA controller on the
> DA850/OMAP-L138/AM18x devices.

> The patch adds the necessary clocks, platform
> resources and a routine to initialize the SATA
> controller.

> The PHY configuration in this patch is
> courtesy the work done by Zegeye Alemu,
> Swaminathan and Mansoor Ahamed from TI.

> While testing this patch, enable port multiplier
> support iff you are actually using one. The
> reasons of this behaviour are discussed
> here: http://patchwork.ozlabs.org/patch/78163/

> Signed-off-by: Sekhar Nori<nsekhar@ti.com>
> Cc: linux-ide at vger.kernel.org
[...]

> diff --git a/arch/arm/mach-davinci/da850.c b/arch/arm/mach-davinci/da850.c
> index 68fe4c2..276199d 100644
> --- a/arch/arm/mach-davinci/da850.c
> +++ b/arch/arm/mach-davinci/da850.c
> @@ -373,6 +373,14 @@ static struct clk spi1_clk = {
>   	.flags		= DA850_CLK_ASYNC3,
>   };
>
> +static struct clk sata_clk = {
> +	.name		= "sata",
> +	.parent		=&pll0_sysclk2,
> +	.lpsc		= DA850_LPSC1_SATA,
> +	.gpsc		= 1,
> +	.flags		= PSC_FORCE,
> +};
> +
>   static struct clk_lookup da850_clks[] = {
>   	CLK(NULL,		"ref",		&ref_clk),
>   	CLK(NULL,		"pll0",		&pll0_clk),
> @@ -419,6 +427,7 @@ static struct clk_lookup da850_clks[] = {
>   	CLK(NULL,		"usb20",	&usb20_clk),
>   	CLK("spi_davinci.0",	NULL,		&spi0_clk),
>   	CLK("spi_davinci.1",	NULL,		&spi1_clk),
> +	CLK("ahci",		NULL,		&sata_clk),
>   	CLK(NULL,		NULL,		NULL),
>   };

    I'd put the above into a separate patch...

> diff --git a/arch/arm/mach-davinci/devices-da8xx.c b/arch/arm/mach-davinci/devices-da8xx.c
> index 625d4b6..e061396 100644
> --- a/arch/arm/mach-davinci/devices-da8xx.c
> +++ b/arch/arm/mach-davinci/devices-da8xx.c
[...]
> @@ -834,3 +836,139 @@ int __init da8xx_register_spi(int instance, struct spi_board_info *info,
[...]
> +/* Supported DA850 SATA crystal frequencies */
> +#define KHZ_TO_HZ(freq) ((freq) * 1000)
> +static unsigned long da850_sata_xtal[] = {
> +	KHZ_TO_HZ(300000),
> +	KHZ_TO_HZ(250000),
> +	0,			/* Reserved */

    Why reserve a place for it at all?

> +	KHZ_TO_HZ(187500),
> +	KHZ_TO_HZ(150000),
> +	KHZ_TO_HZ(125000),
> +	KHZ_TO_HZ(120000),
> +	KHZ_TO_HZ(100000),
> +	KHZ_TO_HZ(75000),
> +	KHZ_TO_HZ(60000),
> +};
> +
> +static int da850_sata_init(struct device *dev, void __iomem *addr)
> +{
> +	int i, ret;
> +	unsigned int val;
> +
> +	da850_sata_clk = clk_get(dev, NULL);
> +	if (IS_ERR(da850_sata_clk))
> +		return PTR_ERR(da850_sata_clk);
> +
> +	ret = clk_enable(da850_sata_clk);
> +	if (ret)
> +		goto err0;
> +
> +	/* Enable SATA clock receiver */
> +	val = __raw_readl(DA8XX_SYSCFG1_VIRT(DA8XX_PWRDN_REG));
> +	val&= ~BIT(0);
> +	__raw_writel(val, DA8XX_SYSCFG1_VIRT(DA8XX_PWRDN_REG));
> +
> +	/* Get the multiplier needed for 1.5GHz PLL output */
> +	for (i = 0; i<  ARRAY_SIZE(da850_sata_xtal); i++) {
> +		if (da850_sata_xtal[i] == da850_sata_refclkpn)
> +			break;
> +	}

    {} not needed.

> +
> +	if (i == ARRAY_SIZE(da850_sata_xtal)) {
> +		ret = -EINVAL;
> +		goto err1;
> +	} else {

    *else* not needed here, after *goto*.

> +		val = SATA_PHY_MPY(i + 1);
> +	}
> +
[...]

> diff --git a/arch/arm/mach-davinci/include/mach/da8xx.h b/arch/arm/mach-davinci/include/mach/da8xx.h
> index e4fc1af..aa6f08e 100644
> --- a/arch/arm/mach-davinci/include/mach/da8xx.h
> +++ b/arch/arm/mach-davinci/include/mach/da8xx.h
[...]
> @@ -65,6 +66,7 @@ extern unsigned int da850_max_speed;
>   #define DA8XX_GPIO_BASE		0x01e26000
>   #define DA8XX_PSC1_BASE		0x01e27000
>   #define DA8XX_LCD_CNTRL_BASE	0x01e13000
> +#define DA850_SATA_BASE		0x01e18000

    It's used only in devices-da8xx.c -- shouldn't it be declared there?

WBR, Sergei

  parent reply	other threads:[~2011-03-23 12:11 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-03-23 11:32 [PATCH 1/4] davinci: psc.h: clean up indentation done using spaces Sekhar Nori
2011-03-23 11:32 ` [PATCH 2/4] davinci: enable forced transitions on PSC Sekhar Nori
2011-03-23 11:32   ` [PATCH 3/4] davinci: da850: add support for SATA interface Sekhar Nori
2011-03-23 11:32     ` Sekhar Nori
2011-03-23 11:32     ` [PATCH 4/4] davinci: da850 evm: register SATA device Sekhar Nori
2011-03-23 11:32       ` Sekhar Nori
2011-03-23 12:09     ` Sergei Shtylyov [this message]
2011-03-23 12:09       ` [PATCH 3/4] davinci: da850: add support for SATA interface Sergei Shtylyov
2011-03-24  9:08       ` Nori, Sekhar
2011-03-24  9:08         ` Nori, Sekhar
2011-03-24 13:04         ` Sergei Shtylyov
2011-03-24 13:04           ` Sergei Shtylyov
2011-03-24 14:33           ` Nori, Sekhar
2011-03-24 14:33             ` Nori, Sekhar
2011-03-24 18:01             ` Sergei Shtylyov
2011-03-24 18:01               ` Sergei Shtylyov
2011-03-25  9:19               ` Nori, Sekhar
2011-03-25  9:19                 ` Nori, Sekhar

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=4D89E308.8060404@mvista.com \
    --to=sshtylyov@mvista.com \
    --cc=davinci-linux-open-source@linux.davincidsp.com \
    --cc=khilman@ti.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-ide@vger.kernel.org \
    --cc=nsekhar@ti.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.