From mboxrd@z Thu Jan 1 00:00:00 1970 From: George Cherian Subject: Re: [PATCH 1/5] usb: dwc3: dwc3-omap: Add dwc3_omap_map_offset function Date: Wed, 14 May 2014 11:11:18 +0530 Message-ID: <537301FE.7080207@ti.com> References: <1399541587-14067-1-git-send-email-george.cherian@ti.com> <1399541587-14067-2-git-send-email-george.cherian@ti.com> <20140513160227.GQ1151@saruman.home> Mime-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1"; format=flowed Content-Transfer-Encoding: 7bit Return-path: Received: from comal.ext.ti.com ([198.47.26.152]:54128 "EHLO comal.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751460AbaENFlX (ORCPT ); Wed, 14 May 2014 01:41:23 -0400 In-Reply-To: <20140513160227.GQ1151@saruman.home> Sender: linux-omap-owner@vger.kernel.org List-Id: linux-omap@vger.kernel.org To: balbi@ti.com Cc: linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-usb@vger.kernel.org, gregkh@linuxfoundation.org, rogerq@ti.com, kishon@ti.com On 5/13/2014 9:32 PM, Felipe Balbi wrote: > Hi, > > On Thu, May 08, 2014 at 03:03:03PM +0530, George Cherian wrote: >> Calculate the wrapper register offsets in a seperate function. >> Improve code readability, decrease the dwc3_probe() size. >> >> Signed-off-by: George Cherian >> --- >> drivers/usb/dwc3/dwc3-omap.c | 80 ++++++++++++++++++++++++-------------------- >> 1 file changed, 44 insertions(+), 36 deletions(-) >> >> diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c >> index 1160ff4..872f065 100644 >> --- a/drivers/usb/dwc3/dwc3-omap.c >> +++ b/drivers/usb/dwc3/dwc3-omap.c >> @@ -383,6 +383,49 @@ static int dwc3_omap_vbus_notifier(struct notifier_block *nb, >> return NOTIFY_DONE; >> } >> >> +static void dwc3_omap_map_offset(struct dwc3_omap *omap) >> +{ >> + u32 reg; >> + struct device_node *node = omap->dev->of_node; >> + int x_major; >> + >> + reg = dwc3_omap_readl(omap->base, USBOTGSS_REVISION); >> + omap->revision = reg; >> + x_major = USBOTGSS_REVISION_XMAJOR(reg); >> + >> + /* Differentiate between OMAP5 and AM437x */ >> + switch (x_major) { >> + case USBOTGSS_REVISION_XMAJOR1: >> + case USBOTGSS_REVISION_XMAJOR2: >> + omap->irq_eoi_offset = 0; >> + omap->irq0_offset = 0; >> + omap->irqmisc_offset = 0; >> + omap->utmi_otg_offset = 0; >> + omap->debug_offset = 0; >> + break; >> + default: >> + /* Default to the latest revision */ >> + omap->irq_eoi_offset = USBOTGSS_EOI_OFFSET; >> + omap->irq0_offset = USBOTGSS_IRQ0_OFFSET; >> + omap->irqmisc_offset = USBOTGSS_IRQMISC_OFFSET; >> + omap->utmi_otg_offset = USBOTGSS_UTMI_OTG_OFFSET; >> + omap->debug_offset = USBOTGSS_DEBUG_OFFSET; >> + break; >> + } >> + >> + /* For OMAP5(ES2.0) and AM437x x_major is 2 even though there are >> + * changes in wrapper registers, Using dt compatible for aegis >> + */ >> + >> + if (of_device_is_compatible(node, "ti,am437x-dwc3")) { >> + omap->irq_eoi_offset = USBOTGSS_EOI_OFFSET; >> + omap->irq0_offset = USBOTGSS_IRQ0_OFFSET; >> + omap->irqmisc_offset = USBOTGSS_IRQMISC_OFFSET; >> + omap->utmi_otg_offset = USBOTGSS_UTMI_OTG_OFFSET; >> + omap->debug_offset = USBOTGSS_DEBUG_OFFSET; >> + } > can you add a patch before $subject which gets rid of the switch > statement above since it's pretty much useless now that we use > compatible strings to differentiate omap5 and am437x ?' okay will do in v2. > -- -George