public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Luke-Jr <luke@dashjr.org>
Cc: "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>,
	"Balbi Felipe (Nokia-D/Helsinki)" <felipe.balbi@nokia.com>,
	Kalle Valo <kalle.valo@iki.fi>
Subject: Re: [PATCH] OMAP2: add USB platform data and initialization for Nokia N800 and N810
Date: Tue, 29 Dec 2009 11:24:07 -0800	[thread overview]
Message-ID: <20091229192407.GA3512@atomide.com> (raw)
In-Reply-To: <200912290152.16357.luke@dashjr.org>

[-- Attachment #1: Type: text/plain, Size: 1514 bytes --]

Hi,

* Luke-Jr <luke@dashjr.org> [091228 23:51]:
> Add platform data and initialization for USB on Nokia N800 and N810 devices
> via the TUSB6010 chipset.
> 
> Tested on Nokia N810 in Linux-OMAP tree. Mainline is not bootable yet.
> 
> Signed-off-by: Luke Dashjr <luke_linuxkern@dashjr.org>
> ---
>  arch/arm/mach-omap2/Kconfig          |    5 +
>  arch/arm/mach-omap2/Makefile         |    1 +
>  arch/arm/mach-omap2/board-n8x0-usb.c |  173 ++++++++++++++++++++++++++++++++++
>  arch/arm/mach-omap2/board-n8x0.c     |    8 ++
>  4 files changed, 187 insertions(+), 0 deletions(-)
>  create mode 100644 arch/arm/mach-omap2/board-n8x0-usb.c
> 

<snip>

> diff --git a/arch/arm/mach-omap2/board-n8x0-usb.c b/arch/arm/mach-omap2/board-n8x0-usb.c
> new file mode 100644
> index 0000000..2254ebd
> --- /dev/null
> +++ b/arch/arm/mach-omap2/board-n8x0-usb.c

<snip>

> +static int		osc_ck_on;
> +
> +static int tusb_set_clock(struct clk *osc_ck, int state)
> +{
> +	if (state) {
> +		if (osc_ck_on > 0)
> +			return -ENODEV;
> +
> +		clk_enable(osc_ck);
> +		osc_ck_on = 1;
> +	} else {
> +		if (osc_ck_on == 0)
> +			return -ENODEV;
> +
> +		clk_disable(osc_ck);
> +		osc_ck_on = 0;
> +	}
> +
> +	return 0;
> +}

Great. The comment from Russell earlier was that we should be now using
clkdev to do things like this and get rid of the _set_clock functions.
In musb_core.c are already using the clk directly if set_clock is NULL.

Can you try the patch below? If it works, just merge it into your
patch.

Regards,

Tony


[-- Attachment #2: tusb-clkdev.patch --]
[-- Type: text/x-diff, Size: 2550 bytes --]

>From e84994dccb71c1e01ca0b9f256d9b7496492a4e2 Mon Sep 17 00:00:00 2001
From: Tony Lindgren <tony@atomide.com>
Date: Tue, 29 Dec 2009 11:04:58 -0800
Subject: [PATCH] tusb6010: Use clkdev to initialize the clock

Note that in this case the clock is fck, not ick
like for musb.

Signed-off-by: Tony Lindgren <tony@atomide.com>

diff --git a/arch/arm/mach-omap2/board-n8x0-usb.c b/arch/arm/mach-omap2/board-n8x0-usb.c
index 2254ebd..e67eabf 100644
--- a/arch/arm/mach-omap2/board-n8x0-usb.c
+++ b/arch/arm/mach-omap2/board-n8x0-usb.c
@@ -25,7 +25,6 @@
 #define GPIO_TUSB_ENABLE	0
 
 static int tusb_set_power(int state);
-static int tusb_set_clock(struct clk *osc_ck, int state);
 
 #if	defined(CONFIG_USB_MUSB_OTG)
 #	define BOARD_MODE	MUSB_OTG
@@ -82,10 +81,8 @@ static struct musb_hdrc_config musb_config = {
 static struct musb_hdrc_platform_data tusb_data = {
 	.mode		= BOARD_MODE,
 	.set_power	= tusb_set_power,
-	.set_clock	= tusb_set_clock,
 	.min_power	= 25,	/* x2 = 50 mA drawn from VBUS as peripheral */
 	.power		= 100,	/* Max 100 mA VBUS for host mode */
-	.clock		= "osc_ck",
 	.config		= &musb_config,
 };
 
@@ -121,27 +118,6 @@ static int tusb_set_power(int state)
 	return retval;
 }
 
-static int		osc_ck_on;
-
-static int tusb_set_clock(struct clk *osc_ck, int state)
-{
-	if (state) {
-		if (osc_ck_on > 0)
-			return -ENODEV;
-
-		clk_enable(osc_ck);
-		osc_ck_on = 1;
-	} else {
-		if (osc_ck_on == 0)
-			return -ENODEV;
-
-		clk_disable(osc_ck);
-		osc_ck_on = 0;
-	}
-
-	return 0;
-}
-
 void __init n8x0_usb_init(void)
 {
 	int ret = 0;
@@ -156,6 +132,12 @@ void __init n8x0_usb_init(void)
 	}
 	gpio_direction_output(GPIO_TUSB_ENABLE, 0);
 
+	/*
+	 * REVISIT: This line can be removed once all the platforms using
+	 * musb_core.c have been converted to use use clkdev.
+	 */
+	tusb_data.clock = "fck";
+
 	tusb_set_power(0);
 
 	ret = tusb6010_setup_interface(&tusb_data, TUSB6010_REFCLK_19, 2,
diff --git a/arch/arm/mach-omap2/clock2xxx_data.c b/arch/arm/mach-omap2/clock2xxx_data.c
index 97dc7cf..e9c8f09 100644
--- a/arch/arm/mach-omap2/clock2xxx_data.c
+++ b/arch/arm/mach-omap2/clock2xxx_data.c
@@ -2222,6 +2222,7 @@ static struct omap_clk omap24xx_clks[] = {
 	CLK(NULL,	"aes_ick",	&aes_ick,	CK_243X | CK_242X),
 	CLK(NULL,	"pka_ick",	&pka_ick,	CK_243X | CK_242X),
 	CLK(NULL,	"usb_fck",	&usb_fck,	CK_243X | CK_242X),
+	CLK("musb_hdrc",	"fck",	&osc_ck,	CK_242X),
 	CLK("musb_hdrc",	"ick",	&usbhs_ick,	CK_243X),
 	CLK("mmci-omap-hs.0", "ick",	&mmchs1_ick,	CK_243X),
 	CLK("mmci-omap-hs.0", "fck",	&mmchs1_fck,	CK_243X),

  parent reply	other threads:[~2009-12-29 19:24 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-12-29  7:52 [PATCH] OMAP2: add USB platform data and initialization for Nokia N800 and N810 Luke-Jr
2009-12-29  8:29 ` Kalle Valo
2009-12-29  8:46   ` Luke-Jr
2009-12-29  8:55     ` Kalle Valo
2009-12-29 12:51       ` Felipe Balbi
2009-12-29 21:05       ` Luke-Jr
2009-12-30  3:10         ` Luke-Jr
2009-12-30  7:17           ` Kalle Valo
2009-12-30  9:02             ` Luke-Jr
2009-12-30 12:04               ` Felipe Balbi
2009-12-30  7:14         ` Kalle Valo
2009-12-29 19:24 ` Tony Lindgren [this message]
2009-12-29 19:35   ` Felipe Balbi
2009-12-29 19:42     ` Tony Lindgren
2009-12-29 19:49       ` Felipe Balbi
2009-12-29 19:53         ` Tony Lindgren
2009-12-29 19:57           ` Felipe Balbi
2009-12-29 20:28   ` Luke-Jr
2009-12-29 20:35     ` Felipe Balbi
2010-01-05 23:24 ` problem with n810 boot up Francisco Alecrim
2010-01-05 23:46   ` Luke-Jr
2010-01-06  2:46     ` Francisco Alecrim
2010-01-06  3:07       ` Luke-Jr
2010-01-06 22:11         ` Francisco Alecrim
2010-01-06 22:45           ` Felipe Balbi
2010-01-06 23:02             ` Francisco Alecrim
2010-01-06 23:40               ` Luke-Jr
2010-01-06 23:59                 ` Francisco Alecrim
2010-01-07  0:10                   ` Luke-Jr
2010-01-07 15:25                     ` Francisco Alecrim
2010-01-07 15:40                       ` Luke-Jr
2010-01-07 16:55                         ` green
2010-01-09  2:56                           ` Luke-Jr
2010-01-09  4:59                             ` green
2010-01-07  0:33               ` Siarhei Siamashka
2010-01-07  2:04                 ` Francisco Alecrim
2010-01-09  5:03     ` green
2010-01-09 17:43       ` Luke-Jr
2010-01-09 23:53         ` green
     [not found]       ` <4B489CC5.5080700@gmail.com>
2010-01-09 23:35         ` green

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=20091229192407.GA3512@atomide.com \
    --to=tony@atomide.com \
    --cc=felipe.balbi@nokia.com \
    --cc=kalle.valo@iki.fi \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-omap@vger.kernel.org \
    --cc=luke@dashjr.org \
    /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