From: Gabor Juhos <juhosg@openwrt.org>
To: Svetoslav Neykov <svetoslav@neykov.name>
Cc: Ralf Baechle <ralf@linux-mips.org>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
John Crispin <blogic@openwrt.org>,
Alan Stern <stern@rowland.harvard.edu>,
"Luis R. Rodriguez" <mcgrof@qca.qualcomm.com>,
linux-mips@linux-mips.org, linux-usb@vger.kernel.org
Subject: Re: [PATCH 4/5] usb: chipidea: AR933x platform support for the chipidea driver
Date: Thu, 14 Feb 2013 15:19:43 +0100 [thread overview]
Message-ID: <511CF27F.3080604@openwrt.org> (raw)
In-Reply-To: <1360791538-6332-5-git-send-email-svetoslav@neykov.name>
Hi Svetoslav,
> Support host and device usb modes for the chipidea controller in AR933x.
> The controller doesn't support OTG functionality so the platform code
> forces one of the modes based on the state of GPIO13 pin at startup.
>
> Signed-off-by: Svetoslav Neykov <svetoslav@neykov.name>
> ---
<...>
> diff --git a/drivers/usb/chipidea/ci13xxx_ar933x.c b/drivers/usb/chipidea/ci13xxx_ar933x.c
> new file mode 100644
> index 0000000..046a4b6
> --- /dev/null
> +++ b/drivers/usb/chipidea/ci13xxx_ar933x.c
> @@ -0,0 +1,73 @@
> +/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
> + *
> + * This program is free software; you can redistribute it and/or modify
> + * it under the terms of the GNU General Public License version 2 and
> + * only version 2 as published by the Free Software Foundation.
> + */
> +
> +#include <linux/module.h>
> +#include <linux/platform_device.h>
> +#include <linux/pm_runtime.h>
> +#include <linux/usb/ulpi.h>
> +#include <linux/usb/gadget.h>
> +#include <linux/usb/chipidea.h>
> +#include <asm/mach-ath79/ath79.h>
> +#include <asm/mach-ath79/ar71xx_regs.h>
> +
> +#include "ci.h"
> +
> +static struct ci13xxx_platform_data ci13xxx_ar933x_platdata = {
> + .name = "ci13xxx_ar933x",
> + .flags = 0,
> + .capoffset = DEF_CAPOFFSET
> +};
Static data only works if there are only one USB IP in the SoCs. It is true for
the AR9330 SoC, but newer SoCs may have more. Please use a dynamically allocated
structure and fill that in the probe routine.
> +
> +static int __devinit ci13xxx_ar933x_probe(struct platform_device *pdev)
> +{
> + u32 bootstrap;
> + struct platform_device *plat_ci;
> +
> + dev_dbg(&pdev->dev, "ci13xxx_ar933x_probe\n");
> +
> + bootstrap = ath79_reset_rr(AR933X_RESET_REG_BOOTSTRAP);
> + if (bootstrap & AR933X_BOOTSTRAP_USB_MODE_HOST)
> + ci13xxx_ar933x_platdata.flags = CI13XXX_FORCE_HOST_MODE;
> + else
> + ci13xxx_ar933x_platdata.flags = CI13XXX_FORCE_DEVICE_MODE;
This bootstrap setting is only valid for the AR933x SoCs. It would be better to
move this code into the SoC specific USB device registration code, and use
platform data to pass that information to this driver.
> +
> + plat_ci = ci13xxx_add_device(&pdev->dev,
> + pdev->resource, pdev->num_resources,
> + &ci13xxx_ar933x_platdata);
> + if (IS_ERR(plat_ci)) {
> + dev_err(&pdev->dev, "ci13xxx_add_device failed!\n");
> + return PTR_ERR(plat_ci);
> + }
> +
> + platform_set_drvdata(pdev, plat_ci);
> +
> + pm_runtime_no_callbacks(&pdev->dev);
> + pm_runtime_enable(&pdev->dev);
> +
> + return 0;
> +}
> +
> +static int __devexit ci13xxx_ar933x_remove(struct platform_device *pdev)
> +{
> + struct platform_device *plat_ci = platform_get_drvdata(pdev);
> +
> + pm_runtime_disable(&pdev->dev);
> + ci13xxx_remove_device(plat_ci);
> +
> + return 0;
> +}
> +
> +static struct platform_driver ci13xxx_ar933x_driver = {
> + .probe = ci13xxx_ar933x_probe,
> + .remove = __devexit_p(ci13xxx_ar933x_remove),
> + .driver = { .name = "ehci-platform", },
This name is used by the ehci-platform driver. You should pick a different one
for this driver. Additionally, the device registration code in
'arch/mips/ath79/dev-usb.c' must be adjusted as well.
> +};
> +
> +module_platform_driver(ci13xxx_ar933x_driver);
> +
> +MODULE_ALIAS("platform:ar933x_hsusb");
The driver part of the MODULE_ALIAS string should match with the driver name.
You should use this instead ci13xxx_ar933x_driver
> +MODULE_LICENSE("GPL v2");
Regards,
Gabor
next prev parent reply other threads:[~2013-02-14 14:19 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-02-13 21:38 [PATCH 0/5] Chipidea driver support for the AR933x platform Svetoslav Neykov
2013-02-13 21:38 ` [PATCH 1/5] usb: chipidea: big-endian support Svetoslav Neykov
2013-02-13 21:38 ` [PATCH 2/5] usb: chipidea: flags to force usb mode (host/device) Svetoslav Neykov
2013-02-14 9:01 ` Michael Grzeschik
2013-02-13 21:38 ` [PATCH 3/5] usb: chipidea: Don't access OTG related registers Svetoslav Neykov
2013-02-14 11:45 ` Alexander Shishkin
2013-02-14 11:45 ` Alexander Shishkin
2013-02-13 21:38 ` [PATCH 4/5] usb: chipidea: AR933x platform support for the chipidea driver Svetoslav Neykov
2013-02-14 11:23 ` Alexander Shishkin
2013-02-14 11:23 ` Alexander Shishkin
2013-02-14 14:19 ` Gabor Juhos [this message]
2013-02-13 21:38 ` [PATCH 5/5] usb: chipidea: Fix incorrect check of function return value Svetoslav Neykov
2013-02-14 11:08 ` Alexander Shishkin
2013-02-14 11:08 ` Alexander Shishkin
2013-02-26 13:35 ` [PATCH 0/5] Chipidea driver support for the AR933x platform Alexander Shishkin
2013-02-26 13:35 ` Alexander Shishkin
2013-02-26 14:38 ` Svetoslav Neykov
2013-02-26 14:38 ` Svetoslav Neykov
2013-02-26 14:47 ` Alexander Shishkin
2013-02-26 14:54 ` Svetoslav Neykov
2013-02-26 14:54 ` Svetoslav Neykov
2013-02-26 15:45 ` Marc Kleine-Budde
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=511CF27F.3080604@openwrt.org \
--to=juhosg@openwrt.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=blogic@openwrt.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-mips@linux-mips.org \
--cc=linux-usb@vger.kernel.org \
--cc=mcgrof@qca.qualcomm.com \
--cc=ralf@linux-mips.org \
--cc=stern@rowland.harvard.edu \
--cc=svetoslav@neykov.name \
/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