linux-omap.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Felipe Balbi <felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
To: ext Tony Lindgren <tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
Cc: "Gupta, Ajay Kumar" <ajay.gupta-l0cyMroinI0@public.gmane.org>,
	Sergei Shtylyov
	<sshtylyov-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org>,
	"linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org"
	<linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org>,
	"Balbi Felipe (Nokia-MS/Helsinki)"
	<felipe.balbi-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
Subject: Re: [PATCH resend 1/3] AM35x: Add musb support
Date: Tue, 6 Jul 2010 11:46:03 +0300	[thread overview]
Message-ID: <20100706084603.GA3035@nokia.com> (raw)
In-Reply-To: <20100706075707.GC3192-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>

Hi,

On Tue, Jul 06, 2010 at 09:57:09AM +0200, ext Tony Lindgren wrote:
>Sounds like we should first fix thing before adding new code
>that will make fixing the basic issues harder.

my idea to deal with this is to have a set of "platform glue drivers".  
So omap2430.c, blackfin.c, tusb6010 and davinci.c would become a 
platform driver themselves that would instantiate musb-hdrc 
platform_driver and the correct dma driver (inventra, omap, cppi, etc).

It would look something like:

#include <plat/usb.h>

static struct musb_hdrc_ops omap2430_musb_ops = {
	.readb	= generic_readb,
	.readw	= generic_readw,
	.readl	= generic_readl,
	.writeb	= generic_writeb,
	.writew	= generic_writew,
	.writel	= generic_writel,
};

static struct musb_platform_data omap2430_musb_data = {
	.ops	= &omap2430_musb_ops,
	.mode	= -EINVAL,	/* change it later */
};

static int __init omap2430_musb_probe(struct platform_device *pdev)
{
	struct omap24030_musb_platform_data pdata = pdev->dev.platform_data;

	musb = platform_device_alloc("musb-hdrc", -1);

	/* check error */

	musb->dev.parent = &pdev->dev;
	omap2430_musb_data.mode = pdata->mode;
	/* initialize every other necessary field */

	platform_device_add_data(musb, &omap2430_musb_data);

	dma = platform_device_alloc("dma-inventra", -1);

	/* check error */

	dma->dev.parent = &pdev->dev;

	/* add both devices */

	return 0;
}

static int omap2430_musb_suspend(struct platform_device *pdev,
			pm_message_t state)
{
	return omap2430_musb_save_context(pdev);
}

static int omap2430_musb_resume(stuct platform_device *pdev)
{
	omap2430_musb_restore_context(pdev);
}

this would allow us to factor-out save/restore context, get rid of all 
exported functions (by just adding every necessary function to 
musb_hdrc_ops) and compile in every single musb file in one driver and 
still have it working. Boards would, then, just instantiate 
musb-omap2430/musb-blackfin/musb-tusb6010/musb-davinci 
platform_driver(s) and the rest would be done on runtime, since only the 
driver that matches would actually probe.

How does that sound ??

-- 
balbi

DefectiveByDesign.org
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  parent reply	other threads:[~2010-07-06  8:46 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-07-02  6:57 [PATCH resend 1/3] AM35x: Add musb support Ajay Kumar Gupta
2010-07-02  6:57 ` [PATCH resend 2/3] musb: add musb support for AM35x Ajay Kumar Gupta
2010-07-02  6:57   ` [PATCH resend 3/3] musb: AM35x: Workaround for fifo read issue Ajay Kumar Gupta
2010-07-02 12:21   ` [PATCH resend 2/3] musb: add musb support for AM35x Sergei Shtylyov
2010-07-03  3:24     ` Gupta, Ajay Kumar
     [not found]       ` <19F8576C6E063C45BE387C64729E7394044EAAD82A-/tLxBxkBPtCIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2010-07-03 13:04         ` Sergei Shtylyov
2010-07-05 11:46           ` Gupta, Ajay Kumar
2010-07-05  9:50 ` [PATCH resend 1/3] AM35x: Add musb support Tony Lindgren
2010-07-05 10:02   ` Sergei Shtylyov
     [not found]     ` <4C31ADCA.40607-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
2010-07-05 10:23       ` Tony Lindgren
     [not found]         ` <20100705102322.GR15951-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2010-07-05 10:34           ` Sergei Shtylyov
     [not found]             ` <4C31B54F.6040109-hkdhdckH98+B+jHODAdFcQ@public.gmane.org>
2010-07-05 10:48               ` Tony Lindgren
2010-07-05 11:54                 ` Gupta, Ajay Kumar
     [not found]                   ` <19F8576C6E063C45BE387C64729E7394044EAAD8F6-/tLxBxkBPtCIQmiDNMet8wC/G2K4zDHf@public.gmane.org>
2010-07-05 13:45                     ` Tony Lindgren
     [not found]                       ` <20100705134552.GD15951-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2010-07-05 14:50                         ` Sergei Shtylyov
2010-07-06  7:23                           ` Gupta, Ajay Kumar
2010-07-06  7:57                             ` Tony Lindgren
     [not found]                               ` <20100706075707.GC3192-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2010-07-06  8:46                                 ` Felipe Balbi [this message]
     [not found]                                   ` <20100706084603.GA3035-xNZwKgViW5gAvxtiuMwx3w@public.gmane.org>
2010-07-06  9:51                                     ` Tony Lindgren
2010-07-06 22:46                                   ` Gadiyar, Anand
2010-07-07  7:53                                     ` Felipe Balbi

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=20100706084603.GA3035@nokia.com \
    --to=felipe.balbi-xnzwkgviw5gavxtiumwx3w@public.gmane.org \
    --cc=ajay.gupta-l0cyMroinI0@public.gmane.org \
    --cc=linux-omap-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=sshtylyov-Igf4POYTYCDQT0dZR+AlfA@public.gmane.org \
    --cc=tony-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.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;
as well as URLs for NNTP newsgroup(s).