From: Marek Szyprowski <m.szyprowski@samsung.com>
To: Paul Zimmerman <Paul.Zimmerman@synopsys.com>,
Robert Baldyga <r.baldyga@samsung.com>,
"balbi@ti.com" <balbi@ti.com>
Cc: "gregkh@linuxfoundation.org" <gregkh@linuxfoundation.org>,
"linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
"andrzej.p@samsung.com" <andrzej.p@samsung.com>
Subject: Re: [PATCH 06/11] usb: dwc2/gadget: ensure that all fifos have correct memory buffers
Date: Tue, 24 Jun 2014 07:50:02 +0200 [thread overview]
Message-ID: <53A9118A.7070100@samsung.com> (raw)
In-Reply-To: <A2CA0424C0A6F04399FB9E1CD98E0304844B9CC5@US01WEMBX2.internal.synopsys.com>
Hello,
On 2014-06-23 20:40, Paul Zimmerman wrote:
>> From: Robert Baldyga [mailto:r.baldyga@samsung.com]
>> Sent: Monday, June 23, 2014 12:51 AM
>>
>> From: Marek Szyprowski <m.szyprowski@samsung.com>
>>
>> Print warning if FIFOs are configured in such a way that they don't fit
>> into the SPRAM available on the s3c hsotg module.
>>
>> Signed-off-by: Marek Szyprowski <m.szyprowski@samsung.com>
>> Signed-off-by: Robert Baldyga <r.baldyga@samsung.com>
>> ---
>> drivers/usb/dwc2/core.h | 1 +
>> drivers/usb/dwc2/gadget.c | 15 ++++++++++-----
>> 2 files changed, 11 insertions(+), 5 deletions(-)
>>
>> diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
>> index 1efd10c..067390e 100644
>> --- a/drivers/usb/dwc2/core.h
>> +++ b/drivers/usb/dwc2/core.h
>> @@ -194,6 +194,7 @@ struct s3c_hsotg {
>> struct regulator_bulk_data supplies[ARRAY_SIZE(s3c_hsotg_supply_names)];
>>
>> u32 phyif;
>> + int fifo_mem;
>> unsigned int dedicated_fifos:1;
>> unsigned char num_of_eps;
>>
>> diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
>> index 95b6dcb..21d21de 100644
>> --- a/drivers/usb/dwc2/gadget.c
>> +++ b/drivers/usb/dwc2/gadget.c
>> @@ -194,6 +194,8 @@ static void s3c_hsotg_init_fifo(struct s3c_hsotg *hsotg)
>> for (ep = 1; ep <= 15; ep++) {
>> val = addr;
>> val |= size << FIFOSIZE_DEPTH_SHIFT;
>> + WARN_ONCE(addr + size > hsotg->fifo_mem,
>> + "insufficient fifo memory");
>> addr += size;
>>
>> writel(val, hsotg->regs + DPTXFSIZN(ep));
>> @@ -3030,19 +3032,22 @@ static void s3c_hsotg_initep(struct s3c_hsotg *hsotg,
>> */
>> static void s3c_hsotg_hw_cfg(struct s3c_hsotg *hsotg)
>> {
>> - u32 cfg2, cfg4;
>> + u32 cfg2, cfg3, cfg4;
>> /* check hardware configuration */
>>
>> cfg2 = readl(hsotg->regs + 0x48);
>> hsotg->num_of_eps = (cfg2 >> 10) & 0xF;
>>
>> - dev_info(hsotg->dev, "EPs:%d\n", hsotg->num_of_eps);
>> + cfg3 = readl(hsotg->regs + 0x4C);
>> + hsotg->fifo_mem = (cfg3 >> 16);
>>
>> cfg4 = readl(hsotg->regs + 0x50);
>> hsotg->dedicated_fifos = (cfg4 >> 25) & 1;
>>
>> - dev_info(hsotg->dev, "%s fifos\n",
>> - hsotg->dedicated_fifos ? "dedicated" : "shared");
>> + dev_info(hsotg->dev, "EPs: %d, %s fifos, %d entries in SPRAM\n",
>> + hsotg->num_of_eps,
>> + hsotg->dedicated_fifos ? "dedicated" : "shared",
>> + hsotg->fifo_mem);
>> }
>>
>> /**
>> @@ -3495,8 +3500,8 @@ static int s3c_hsotg_probe(struct platform_device *pdev)
>> s3c_hsotg_phy_enable(hsotg);
>>
>> s3c_hsotg_corereset(hsotg);
>> - s3c_hsotg_init(hsotg);
>> s3c_hsotg_hw_cfg(hsotg);
>> + s3c_hsotg_init(hsotg);
> This last hunk looks like it is not related to the rest of the patch? If
> so, I think it should be a separate patch.
s3c_hsotg_hw_cfg() only reads hw configuration and some values read there (fifo_mem)
are used in s3c_hsotg_init_fifo(), which is called from s3c_hsotg_init(). This chunk
really belongs to this patch, although it might not be easy to notice it at the first
glance.
Best regards
--
Marek Szyprowski, PhD
Samsung R&D Institute Poland
next prev parent reply other threads:[~2014-06-24 5:50 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-06-23 7:51 [PATCH 00/11] usb: dwc2/gadget: fix series Robert Baldyga
2014-06-23 7:51 ` [PATCH 01/11] usb: dwc2/gadget: fix phy disable sequence Robert Baldyga
2014-06-23 7:51 ` [PATCH 02/11] usb: dwc2/gadget: fix phy initialization sequence Robert Baldyga
2014-06-23 7:51 ` [PATCH 03/11] usb: dwc2/gadget: move phy bus legth initialization Robert Baldyga
2014-06-23 7:51 ` [PATCH 04/11] usb: dwc2/gadget: Fix comment text Robert Baldyga
2014-06-23 7:51 ` [PATCH 05/11] usb: dwc2/gadget: hide some not really needed debug messages Robert Baldyga
2014-06-23 7:51 ` [PATCH 06/11] usb: dwc2/gadget: ensure that all fifos have correct memory buffers Robert Baldyga
2014-06-23 18:40 ` Paul Zimmerman
2014-06-24 5:50 ` Marek Szyprowski [this message]
2014-06-23 7:51 ` [PATCH 07/11] usb: dwc2/gadget: break infinite loop in endpoint disable code Robert Baldyga
2014-06-23 7:51 ` [PATCH 08/11] usb: dwc2/gadget: do not call disconnect method in pullup Robert Baldyga
2014-06-23 7:51 ` [PATCH 09/11] usb: dwc2/gadget: delay enabling irq once hardware is configured properly Robert Baldyga
2014-06-23 7:51 ` [PATCH 10/11] usb: dwc2/gadget: assign TX FIFO dynamically Robert Baldyga
2014-06-23 18:43 ` Paul Zimmerman
2014-06-23 7:51 ` [PATCH 11/11] usb: dwc2/gadget: disable clock when it's not needed Robert Baldyga
2014-06-23 18:45 ` [PATCH 00/11] usb: dwc2/gadget: fix series Paul Zimmerman
2014-06-24 1:39 ` Roy
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=53A9118A.7070100@samsung.com \
--to=m.szyprowski@samsung.com \
--cc=Paul.Zimmerman@synopsys.com \
--cc=andrzej.p@samsung.com \
--cc=balbi@ti.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-usb@vger.kernel.org \
--cc=r.baldyga@samsung.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