From: Michael Grzeschik <m.grzeschik-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> To: linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org Cc: alexander.shishkin-VuQAYsv1563Yd54FQh9/CA@public.gmane.org, mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org, gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org, fabio.estevam-KZfg59tc24xl57MIdRCFDg@public.gmane.org, kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org, devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org Subject: [PATCH v2 4/7] usb: chipidea: usbmisc: prepare driver to handle more than one soc Date: Thu, 15 Nov 2012 13:03:45 +0100 [thread overview] Message-ID: <1352981028-14312-5-git-send-email-m.grzeschik@pengutronix.de> (raw) In-Reply-To: <1352981028-14312-1-git-send-email-m.grzeschik-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> From: Marc Kleine-Budde <mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> This attaches the usbmisc_ops to the of_device_id data and makes it possible to define special functions per soc. Signed-off-by: Marc Kleine-Budde <mkl-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> Signed-off-by: Michael Grzeschik <m.grzeschik-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> --- drivers/usb/chipidea/usbmisc_imx.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c index 9145e04..4b1ed7c 100644 --- a/drivers/usb/chipidea/usbmisc_imx.c +++ b/drivers/usb/chipidea/usbmisc_imx.c @@ -26,6 +26,7 @@ struct imx_usbmisc { spinlock_t lock; struct clk *clk; struct usbmisc_usb_device usbdev[USB_DEV_MAX]; + const struct usbmisc_ops *ops; }; static struct imx_usbmisc *usbmisc; @@ -78,7 +79,7 @@ static const struct usbmisc_ops imx6q_usbmisc_ops = { }; static const struct of_device_id usbmisc_imx_dt_ids[] = { - { .compatible = "fsl,imx6q-usbmisc"}, + { .compatible = "fsl,imx6q-usbmisc", .data = (void *)&imx6q_usbmisc_ops }, { /* sentinel */ } }; @@ -87,6 +88,7 @@ static int __devinit usbmisc_imx_probe(struct platform_device *pdev) struct resource *res; struct imx_usbmisc *data; int ret; + struct of_device_id *tmp_dev; if (usbmisc) return -EBUSY; @@ -116,8 +118,11 @@ static int __devinit usbmisc_imx_probe(struct platform_device *pdev) return ret; } + tmp_dev = (struct of_device_id *) + of_match_device(usbmisc_imx_dt_ids, &pdev->dev); + data->ops = (const struct usbmisc_ops *)tmp_dev->data; usbmisc = data; - ret = usbmisc_set_ops(&imx6q_usbmisc_ops); + ret = usbmisc_set_ops(data->ops); if (ret) { usbmisc = NULL; clk_disable_unprepare(data->clk); @@ -129,7 +134,7 @@ static int __devinit usbmisc_imx_probe(struct platform_device *pdev) static int __devexit usbmisc_imx_remove(struct platform_device *pdev) { - usbmisc_unset_ops(&imx6q_usbmisc_ops); + usbmisc_unset_ops(usbmisc->ops); clk_disable_unprepare(usbmisc->clk); usbmisc = NULL; return 0; -- 1.7.10.4 -- 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
WARNING: multiple messages have this Message-ID (diff)
From: m.grzeschik@pengutronix.de (Michael Grzeschik) To: linux-arm-kernel@lists.infradead.org Subject: [PATCH v2 4/7] usb: chipidea: usbmisc: prepare driver to handle more than one soc Date: Thu, 15 Nov 2012 13:03:45 +0100 [thread overview] Message-ID: <1352981028-14312-5-git-send-email-m.grzeschik@pengutronix.de> (raw) In-Reply-To: <1352981028-14312-1-git-send-email-m.grzeschik@pengutronix.de> From: Marc Kleine-Budde <mkl@pengutronix.de> This attaches the usbmisc_ops to the of_device_id data and makes it possible to define special functions per soc. Signed-off-by: Marc Kleine-Budde <mkl@pengutronix.de> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de> --- drivers/usb/chipidea/usbmisc_imx.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/usb/chipidea/usbmisc_imx.c b/drivers/usb/chipidea/usbmisc_imx.c index 9145e04..4b1ed7c 100644 --- a/drivers/usb/chipidea/usbmisc_imx.c +++ b/drivers/usb/chipidea/usbmisc_imx.c @@ -26,6 +26,7 @@ struct imx_usbmisc { spinlock_t lock; struct clk *clk; struct usbmisc_usb_device usbdev[USB_DEV_MAX]; + const struct usbmisc_ops *ops; }; static struct imx_usbmisc *usbmisc; @@ -78,7 +79,7 @@ static const struct usbmisc_ops imx6q_usbmisc_ops = { }; static const struct of_device_id usbmisc_imx_dt_ids[] = { - { .compatible = "fsl,imx6q-usbmisc"}, + { .compatible = "fsl,imx6q-usbmisc", .data = (void *)&imx6q_usbmisc_ops }, { /* sentinel */ } }; @@ -87,6 +88,7 @@ static int __devinit usbmisc_imx_probe(struct platform_device *pdev) struct resource *res; struct imx_usbmisc *data; int ret; + struct of_device_id *tmp_dev; if (usbmisc) return -EBUSY; @@ -116,8 +118,11 @@ static int __devinit usbmisc_imx_probe(struct platform_device *pdev) return ret; } + tmp_dev = (struct of_device_id *) + of_match_device(usbmisc_imx_dt_ids, &pdev->dev); + data->ops = (const struct usbmisc_ops *)tmp_dev->data; usbmisc = data; - ret = usbmisc_set_ops(&imx6q_usbmisc_ops); + ret = usbmisc_set_ops(data->ops); if (ret) { usbmisc = NULL; clk_disable_unprepare(data->clk); @@ -129,7 +134,7 @@ static int __devinit usbmisc_imx_probe(struct platform_device *pdev) static int __devexit usbmisc_imx_remove(struct platform_device *pdev) { - usbmisc_unset_ops(&imx6q_usbmisc_ops); + usbmisc_unset_ops(usbmisc->ops); clk_disable_unprepare(usbmisc->clk); usbmisc = NULL; return 0; -- 1.7.10.4
next prev parent reply other threads:[~2012-11-15 12:03 UTC|newest] Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top 2012-11-15 12:03 [PATCH v2 0/7] support other fsl SoCs with usbmisc + small fixes Michael Grzeschik 2012-11-15 12:03 ` Michael Grzeschik [not found] ` <1352981028-14312-1-git-send-email-m.grzeschik-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> 2012-11-15 12:03 ` [PATCH v2 1/7] usb: chipidea: usbmisc: rename file, struct and functions to usbmisc_imx Michael Grzeschik 2012-11-15 12:03 ` Michael Grzeschik 2012-11-15 12:03 ` [PATCH v2 2/7] usb: chipidea: usbmisc: unset global varibale usbmisc on driver remove Michael Grzeschik 2012-11-15 12:03 ` Michael Grzeschik 2012-11-15 12:03 ` [PATCH v2 3/7] usb: chipidea: usbmisc: fix a potential race condition Michael Grzeschik 2012-11-15 12:03 ` Michael Grzeschik 2012-11-15 12:03 ` Michael Grzeschik [this message] 2012-11-15 12:03 ` [PATCH v2 4/7] usb: chipidea: usbmisc: prepare driver to handle more than one soc Michael Grzeschik 2012-11-15 12:03 ` [PATCH v2 5/7] usb: chipidea: usbmisc: add support for ahb, ipg and per clock Michael Grzeschik 2012-11-15 12:03 ` Michael Grzeschik [not found] ` <1352981028-14312-6-git-send-email-m.grzeschik-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> 2012-11-16 13:17 ` Alexander Shishkin 2012-11-16 13:17 ` Alexander Shishkin [not found] ` <87r4nt6610.fsf-qxRn5AmX6ZD9BXuAQUXR0fooFf0ArEBIu+b9c/7xato@public.gmane.org> 2012-11-20 15:09 ` Sascha Hauer 2012-11-20 15:09 ` Sascha Hauer 2012-11-15 12:03 ` [PATCH v2 6/7] usb: chipidea: usbmisc: add mx53 support Michael Grzeschik 2012-11-15 12:03 ` Michael Grzeschik [not found] ` <1352981028-14312-7-git-send-email-m.grzeschik-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org> 2012-11-16 13:22 ` Alexander Shishkin 2012-11-16 13:22 ` Alexander Shishkin [not found] ` <87obix65t1.fsf-qxRn5AmX6ZD9BXuAQUXR0fooFf0ArEBIu+b9c/7xato@public.gmane.org> 2012-11-20 14:44 ` Michael Grzeschik 2012-11-20 14:44 ` Michael Grzeschik 2012-11-15 12:03 ` [PATCH v2 7/7] usb: chipidea: usbmisc: add post handling and errata fix for mx25 Michael Grzeschik 2012-11-15 12:03 ` Michael Grzeschik
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=1352981028-14312-5-git-send-email-m.grzeschik@pengutronix.de \ --to=m.grzeschik-bicnvbalz9megne8c9+irq@public.gmane.org \ --cc=alexander.shishkin-VuQAYsv1563Yd54FQh9/CA@public.gmane.org \ --cc=devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org \ --cc=fabio.estevam-KZfg59tc24xl57MIdRCFDg@public.gmane.org \ --cc=gregkh-hQyY1W1yCW8ekmWlsbkhG0B+6BGkLq7r@public.gmane.org \ --cc=kernel-bIcnvbaLZ9MEGnE8C9+IrQ@public.gmane.org \ --cc=linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org \ --cc=linux-usb-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \ --cc=mkl-bIcnvbaLZ9MEGnE8C9+IrQ@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: linkBe 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.