From: Felipe Balbi <balbi@ti.com>
To: Kishon Vijay Abraham I <kishon@ti.com>
Cc: balbi@ti.com, 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: Tue, 4 Aug 2015 10:58:03 -0500 [thread overview]
Message-ID: <20150804155803.GF23659@saruman.tx.rr.com> (raw)
In-Reply-To: <1438697169-32359-1-git-send-email-kishon@ti.com>
[-- Attachment #1: Type: text/plain, Size: 3515 bytes --]
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);
}
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");
other than that, looks fine.
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
WARNING: multiple messages have this Message-ID (diff)
From: Felipe Balbi <balbi@ti.com>
To: Kishon Vijay Abraham I <kishon@ti.com>
Cc: <balbi@ti.com>, <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: Tue, 4 Aug 2015 10:58:03 -0500 [thread overview]
Message-ID: <20150804155803.GF23659@saruman.tx.rr.com> (raw)
In-Reply-To: <1438697169-32359-1-git-send-email-kishon@ti.com>
[-- Attachment #1: Type: text/plain, Size: 3515 bytes --]
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);
}
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");
other than that, looks fine.
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 819 bytes --]
next prev parent reply other threads:[~2015-08-04 15:58 UTC|newest]
Thread overview: 14+ 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 14:06 ` Kishon Vijay Abraham I
2015-08-04 15:58 ` Felipe Balbi [this message]
2015-08-04 15:58 ` Felipe Balbi
2015-08-05 13:50 ` Kishon Vijay Abraham I
2015-08-05 13:50 ` Kishon Vijay Abraham I
2015-08-05 8:01 ` Tony Lindgren
[not found] ` <20150805080113.GV16878-4v6yS6AI5VpBDgjK7y7TUQ@public.gmane.org>
2015-08-05 14:07 ` Kishon Vijay Abraham I
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-06 8:47 ` Tony Lindgren
2015-08-20 6:35 ` Kishon Vijay Abraham I
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=20150804155803.GF23659@saruman.tx.rr.com \
--to=balbi@ti.com \
--cc=devicetree@vger.kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=kishon@ti.com \
--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 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.