linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Christoph Fritz <chf.fritz@googlemail.com>
To: Felipe Balbi <balbi@ti.com>
Cc: Estevam Fabio-R49496 <r49496@freescale.com>,
	Li Yang-R58472 <r58472@freescale.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Chen Peter-B29397 <B29397@freescale.com>,
	Sascha Hauer <s.hauer@pengutronix.de>,
	linux-usb@vger.kernel.org, "Hans J. Koch" <hjk@hansjkoch.de>,
	Daniel Mack <daniel@caiaq.de>, Christian Hemp <c.hemp@phytec.de>,
	linuxppc-dev@lists.ozlabs.org, Teresa Gamez <T.Gamez@phytec.de>,
	Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Subject: [PATCH 6/7] usb: gadget: fsl_udc: purge global pointer usb_sys_regs
Date: Fri, 19 Oct 2012 12:24:44 +0200	[thread overview]
Message-ID: <1350642285-8145-6-git-send-email-chf.fritz@googlemail.com> (raw)
In-Reply-To: <1350642156-8034-1-git-send-email-chf.fritz@googlemail.com>

Move global driver pointer usb_sys_regs to private struct fsl_udc.

Signed-off-by: Christoph Fritz <chf.fritz@googlemail.com>
Reviewed-by: Teresa Gamez <T.Gamez@phytec.de>
---
 drivers/usb/gadget/fsl_udc_core.c |   26 ++++++++++++--------------
 drivers/usb/gadget/fsl_usb2_udc.h |    1 +
 2 files changed, 13 insertions(+), 14 deletions(-)

diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c
index deaab62..35ebcd4 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -43,8 +43,6 @@ static const char driver_desc[] = DRIVER_DESC;
 
 static struct usb_dr_device *dr_regs;
 
-static struct usb_sys_interface *usb_sys_regs;
-
 static const struct usb_endpoint_descriptor
 fsl_ep0_desc = {
 	.bLength =		USB_DT_ENDPOINT_SIZE,
@@ -170,10 +168,10 @@ static int dr_controller_setup(struct fsl_udc *udc)
 		if (udc->pdata->have_sysif_regs) {
 			if (udc->pdata->controller_ver) {
 				/* controller version 1.6 or above */
-				ctrl = __raw_readl(&usb_sys_regs->control);
+				ctrl = readl(&udc->usb_sys_regs->control);
 				ctrl &= ~USB_CTRL_UTMI_PHY_EN;
 				ctrl |= USB_CTRL_USB_EN;
-				__raw_writel(ctrl, &usb_sys_regs->control);
+				writel(ctrl, &udc->usb_sys_regs->control);
 			}
 		}
 		portctrl |= PORTSCX_PTS_ULPI;
@@ -185,10 +183,10 @@ static int dr_controller_setup(struct fsl_udc *udc)
 		if (udc->pdata->have_sysif_regs) {
 			if (udc->pdata->controller_ver) {
 				/* controller version 1.6 or above */
-				ctrl = __raw_readl(&usb_sys_regs->control);
+				ctrl = readl(&udc->usb_sys_regs->control);
 				ctrl |= (USB_CTRL_UTMI_PHY_EN |
 					USB_CTRL_USB_EN);
-				__raw_writel(ctrl, &usb_sys_regs->control);
+				writel(ctrl, &udc->usb_sys_regs->control);
 				mdelay(FSL_UTMI_PHY_DLY); /* Delay for UTMI
 					PHY CLK to become stable - 10ms*/
 			}
@@ -254,9 +252,9 @@ static int dr_controller_setup(struct fsl_udc *udc)
 	/* Config control enable i/o output, cpu endian register */
 #ifndef CONFIG_ARCH_MXC
 	if (udc->pdata->have_sysif_regs) {
-		ctrl = __raw_readl(&usb_sys_regs->control);
+		ctrl = readl(&udc->usb_sys_regs->control);
 		ctrl |= USB_CTRL_IOENB;
-		__raw_writel(ctrl, &usb_sys_regs->control);
+		writel(ctrl, &udc->usb_sys_regs->control);
 	}
 #endif
 
@@ -267,9 +265,9 @@ static int dr_controller_setup(struct fsl_udc *udc)
 	if (udc->pdata->have_sysif_regs) {
 		/* Setup Snooping for all the 4GB space */
 		tmp = SNOOP_SIZE_2GB;	/* starts from 0x0, size 2G */
-		__raw_writel(tmp, &usb_sys_regs->snoop1);
+		writel(tmp, &udc->usb_sys_regs->snoop1);
 		tmp |= 0x80000000;	/* starts from 0x8000000, size 2G */
-		__raw_writel(tmp, &usb_sys_regs->snoop2);
+		writel(tmp, &udc->usb_sys_regs->snoop2);
 	}
 #endif
 
@@ -326,7 +324,7 @@ static void dr_controller_stop(struct fsl_udc *udc)
 	udc->stopped = 1;
 
 	/* disable IO output */
-/*	usb_sys_regs->control = 0; */
+/*	udc->usb_sys_regs->control = 0; */
 
 	/* set controller to Stop */
 	tmp = readl(&dr_regs->usbcmd);
@@ -2130,12 +2128,12 @@ static int fsl_proc_read(char *page, char **start, off_t off, int count,
 
 #ifndef CONFIG_ARCH_MXC
 	if (udc->pdata->have_sysif_regs) {
-		tmp_reg = usb_sys_regs->snoop1;
+		tmp_reg = udc->usb_sys_regs->snoop1;
 		t = scnprintf(next, size, "Snoop1 Reg : = [0x%x]\n\n", tmp_reg);
 		size -= t;
 		next += t;
 
-		tmp_reg = usb_sys_regs->control;
+		tmp_reg = udc->usb_sys_regs->control;
 		t = scnprintf(next, size, "General Control Reg : = [0x%x]\n\n",
 				tmp_reg);
 		size -= t;
@@ -2388,7 +2386,7 @@ static int __init fsl_udc_probe(struct platform_device *pdev)
 
 #ifndef CONFIG_ARCH_MXC
 	if (pdata->have_sysif_regs)
-		usb_sys_regs = (void *)dr_regs + USB_DR_SYS_OFFSET;
+		udc->usb_sys_regs = (void *)dr_regs + USB_DR_SYS_OFFSET;
 #endif
 
 	/* Initialize USB clocks */
diff --git a/drivers/usb/gadget/fsl_usb2_udc.h b/drivers/usb/gadget/fsl_usb2_udc.h
index a0123ae..0d888f4 100644
--- a/drivers/usb/gadget/fsl_usb2_udc.h
+++ b/drivers/usb/gadget/fsl_usb2_udc.h
@@ -498,6 +498,7 @@ struct fsl_udc {
 	dma_addr_t ep_qh_dma;		/* dma address of QH */
 
 	struct ep_td_struct *last_free_td;
+	struct usb_sys_interface *usb_sys_regs;
 
 	u32 max_pipes;          /* Device max pipes */
 	u32 bus_reset;		/* Device is bus resetting */
-- 
1.7.2.5

  parent reply	other threads:[~2012-10-19 10:25 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1333796272.3450.92.camel@lovely>
     [not found] ` <F281D0F91ED19E4D8E63A7504E8A64980AFFE3@039-SN2MPN1-022.039d.mgd.msft.net>
     [not found]   ` <CAOMZO5AjQsNw7_4ETkB38mmuBXj4pnCwJwAsi4zC4b_83=Enfw@mail.gmail.com>
     [not found]     ` <20120409200656.GD2640@local>
     [not found]       ` <CAOMZO5BTrA8G6wwQZ3e6bydJX7UtG7jj2c29Ln7u_3_jyUGB+w@mail.gmail.com>
     [not found]         ` <20120410001017.GF2640@local>
     [not found]           ` <CAOMZO5A=sHeyoQ0PCd=09qGGKb0NjXi-kF5qyG+3U-GhD7rhzg@mail.gmail.com>
     [not found]             ` <20120410021151.GB23044@lovely.krouter>
     [not found]               ` <20120411073918.GA9180@lovely.krouter>
     [not found]                 ` <CAOMZO5C729Ki0Bequ+s1nnrgt4NZWvwg3Wnjk4kHp=d9BtkeXw@mail.gmail.com>
2012-05-09  0:02                   ` [RFC] [PATCH] usb: gadget: fix dtd dma confusion Christoph Fritz
2012-05-09  1:50                     ` Neil Zhang
2012-05-09  2:11                       ` Chen Peter-B29397
2012-05-09  5:38                         ` Christoph Fritz
2012-05-09  5:43                           ` Chen Peter-B29397
2012-05-09  5:56                             ` Christoph Fritz
2012-05-09  5:45                           ` Neil Zhang
2012-05-09  6:04                             ` Christoph Fritz
2012-05-13 22:51                     ` Christoph Fritz
2012-05-14  1:11                       ` Chen Peter-B29397
2012-05-14  4:21                       ` Greg Kroah-Hartman
2012-05-20 23:17                         ` [PATCH] usb: fsl_udc: errata - postpone freeing current dTD Christoph Fritz
2012-05-21  1:05                           ` Chen Peter-B29397
2012-05-21  6:53                             ` Christoph Fritz
2012-05-21  6:57                               ` [PATCH v2] " Christoph Fritz
2012-05-21  7:25                                 ` Chen Peter-B29397
2012-05-21 19:04                                 ` Felipe Balbi
2012-06-04 11:30                                   ` Christoph Fritz
2012-06-04 11:37                                     ` Christoph Fritz
2012-06-10 18:41                                       ` Fabio Estevam
2012-06-12 19:40                                         ` Christoph Fritz
2012-06-13  1:17                                           ` Fabio Estevam
2012-06-04 14:59                                     ` Felipe Balbi
2012-06-04 15:24                                       ` [PATCH] usb: gadget: regression fix - useage of usb_ep Christoph Fritz
2012-10-19 10:22                                   ` [PATCH 0/7] update USB gadget driver fsl-usb2-udc Christoph Fritz
2012-10-19 10:24                                     ` [PATCH 1/7] usb: gadget: fsl_udc: simplify driver init Christoph Fritz
2012-10-19 10:24                                       ` Felipe Balbi
2012-10-19 10:24                                     ` [PATCH 2/7] usb: gadget: fsl_udc: protect fsl_pullup() with spin_lock Christoph Fritz
2012-10-19 10:25                                       ` Felipe Balbi
2012-10-19 10:24                                     ` [PATCH 3/7] usb: gadget: fsl_udc: convert to new ulc style Christoph Fritz
2012-10-19 10:27                                       ` Felipe Balbi
2012-10-19 10:24                                     ` [PATCH 4/7] usb: gadget: fsl_udc: drop ARCH dependency Christoph Fritz
2012-10-19 10:29                                       ` Felipe Balbi
2012-10-19 10:24                                     ` [PATCH 5/7] usb: gadget: fsl_udc: postpone freeing current dTD Christoph Fritz
2012-10-19 10:30                                       ` Felipe Balbi
2012-10-19 10:46                                         ` Christoph Fritz
2012-10-19 10:44                                           ` Felipe Balbi
2012-10-20 19:12                                             ` Christoph Fritz
2012-10-22  7:54                                               ` Felipe Balbi
2012-10-19 10:24                                     ` Christoph Fritz [this message]
2012-10-19 10:24                                     ` [PATCH 7/7] usb: gadget: fsl_udc: purge global pointer dr_regs Christoph Fritz
2012-10-19 15:36                                     ` [PATCH 0/7] update USB gadget driver fsl-usb2-udc Sascha Hauer

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=1350642285-8145-6-git-send-email-chf.fritz@googlemail.com \
    --to=chf.fritz@googlemail.com \
    --cc=B29397@freescale.com \
    --cc=T.Gamez@phytec.de \
    --cc=balbi@ti.com \
    --cc=bigeasy@linutronix.de \
    --cc=c.hemp@phytec.de \
    --cc=daniel@caiaq.de \
    --cc=gregkh@linuxfoundation.org \
    --cc=hjk@hansjkoch.de \
    --cc=linux-usb@vger.kernel.org \
    --cc=linuxppc-dev@lists.ozlabs.org \
    --cc=r49496@freescale.com \
    --cc=r58472@freescale.com \
    --cc=s.hauer@pengutronix.de \
    /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).