From: Kishon Vijay Abraham I <kishon@ti.com>
To: balbi@ti.com
Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-usb@vger.kernel.org, linux-omap@vger.kernel.org,
nsekhar@ti.com, gregkh@linuxfoundation.org
Subject: Re: [PATCH] usb: musb: omap2430: use *syscon* framework API to write to mailbox register
Date: Wed, 5 Aug 2015 19:20:03 +0530 [thread overview]
Message-ID: <55C2148B.4020707@ti.com> (raw)
In-Reply-To: <20150804155803.GF23659@saruman.tx.rr.com>
Hi,
On Tuesday 04 August 2015 09:28 PM, Felipe Balbi wrote:
> Hi,
>
> On Tue, Aug 04, 2015 at 07:36:09PM +0530, Kishon Vijay Abraham I wrote:
>> Deprecate using phy-omap-control driver to write to the mailbox register
>> and start using *syscon* framework to do the same.
>>
>> Signed-off-by: Kishon Vijay Abraham I <kishon@ti.com>
>> ---
>> Documentation/devicetree/bindings/usb/omap-usb.txt | 7 +-
>> drivers/usb/musb/omap2430.c | 115 ++++++++++++++++----
>> 2 files changed, 99 insertions(+), 23 deletions(-)
>>
>> diff --git a/Documentation/devicetree/bindings/usb/omap-usb.txt b/Documentation/devicetree/bindings/usb/omap-usb.txt
>> index 38d9bb8..c001306 100644
>> --- a/Documentation/devicetree/bindings/usb/omap-usb.txt
>> +++ b/Documentation/devicetree/bindings/usb/omap-usb.txt
>> @@ -20,10 +20,15 @@ OMAP MUSB GLUE
>> - phy-names : the names of the PHY corresponding to the PHYs present in the
>> *phy* phandle.
>>
>> -Optional properties:
>> +Optional Properties:
>> +Deprecated properties:
>> - ctrl-module : phandle of the control module this glue uses to write to
>> mailbox
>>
>> +Recommended properies:
>> + - syscon-otghs : phandle/offset pair. Phandle to the system control module and the
>> + register offset of the mailbox.
>> +
>> SOC specific device node entry
>> usb_otg_hs: usb_otg_hs@4a0ab000 {
>> compatible = "ti,omap4-musb";
>> diff --git a/drivers/usb/musb/omap2430.c b/drivers/usb/musb/omap2430.c
>> index 70f2b8a..a03cf1e 100644
>> --- a/drivers/usb/musb/omap2430.c
>> +++ b/drivers/usb/musb/omap2430.c
>> @@ -39,16 +39,27 @@
>> #include <linux/usb/musb-omap.h>
>> #include <linux/phy/omap_control_phy.h>
>> #include <linux/of_platform.h>
>> +#include <linux/regmap.h>
>> +#include <linux/mfd/syscon.h>
>>
>> #include "musb_core.h"
>> #include "omap2430.h"
>>
>> +#define OMAP2430_MUSB_MODE_MASK 0x1f
>> +#define OMAP2430_MUSB_AVALID BIT(0)
>> +#define OMAP2430_MUSB_BVALID BIT(1)
>> +#define OMAP2430_MUSB_VBUSVALID BIT(2)
>> +#define OMAP2430_MUSB_SESSEND BIT(3)
>> +#define OMAP2430_MUSB_IDDIG BIT(4)
>> +
>> struct omap2430_glue {
>> struct device *dev;
>> struct platform_device *musb;
>> enum omap_musb_vbus_id_status status;
>> struct work_struct omap_musb_mailbox_work;
>> struct device *control_otghs;
>> + struct regmap *syscon_otghs; /* ctrl. reg. acces */
>> + unsigned int otghs_reg; /* otghs reg. index within syscon */
>> };
>> #define glue_to_musb(g) platform_get_drvdata(g->musb)
>>
>> @@ -253,6 +264,44 @@ void omap_musb_mailbox(enum omap_musb_vbus_id_status status)
>> }
>> EXPORT_SYMBOL_GPL(omap_musb_mailbox);
>>
>> +static void omap2430_musb_set_usbmode(struct omap2430_glue *glue,
>> + enum omap_control_usb_mode mode)
>> +{
>> + u32 val;
>> + int ret;
>> +
>
> if (!glue->syscon_otghs) {
> omap_control_usb_set_mode(glue->control_otghs, mode);
> return;
> }
>
> switch (mode) {
> case USB_MODE_HOST:
> val = OMAP2430_MUSB_AVALID | OMAP2430_MUSB_VBUSVALID;
> break;
> case USB_MODE_DEVICE:
> val = OMAP2430_MUSB_IDDIG | OMAP2430_MUSB_AVALID |
> OMAP2430_MUSB_VBUSVALID;
> break;
> case USB_MODE_DISCONNECT:
> val = OMAP2430_MUSB_IDDIG | OMAP2430_MUSB_SESSEND;
> break;
> default:
> dev_dbg(glue->dev, "Invalid mode\n");
> dev_err(glue->dev, "Failed to set mode to %d\n", mode);
Don't we have to return here? Maybe we should set IDDIG and SESSEND (the same
value as USB_MODE_DISCONNECT). That seems to be the reset value as well.
> }
>
> ret = regmap_update_bits(glue->syscon_otghs,
> glue->otghs_reg,
> OMAP2430_MUSB_MODE_MASK, val);
> if (ret < 0)
> dev_err(glue->dev, "Failed to update regmap\n");
Thanks
Kishon
next prev parent reply other threads:[~2015-08-05 13:50 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-04 14:06 [PATCH] usb: musb: omap2430: use *syscon* framework API to write to mailbox register Kishon Vijay Abraham I
2015-08-04 15:58 ` Felipe Balbi
2015-08-05 13:50 ` Kishon Vijay Abraham I [this message]
2015-08-05 8:01 ` Tony Lindgren
[not found] ` <20150805080113.GV16878-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2015-08-05 14:07 ` Kishon Vijay Abraham I
[not found] ` <55C21885.6000902-l0cyMroinI0@public.gmane.org>
2015-08-06 8:47 ` Tony Lindgren
2015-08-20 6:35 ` Kishon Vijay Abraham I
2015-08-21 7:00 ` Tony Lindgren
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=55C2148B.4020707@ti.com \
--to=kishon@ti.com \
--cc=balbi@ti.com \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-usb@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 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).