public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Igor Grinberg <grinberg@compulab.co.il>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v3 6/7] usb: ulpi: Extend the existing ulpi framework.
Date: Mon, 06 Feb 2012 12:03:35 +0200	[thread overview]
Message-ID: <4F2FA577.3080303@compulab.co.il> (raw)
In-Reply-To: <CAAL8m4yeoH1Rb=iCWMig3jmb5p1_B3LLYVwfQxCzCFvNu8OJkQ@mail.gmail.com>

On 02/06/12 11:38, Govindraj wrote:
> Hi Igor,
> 
> On Mon, Feb 6, 2012 at 2:25 PM, Igor Grinberg <grinberg@compulab.co.il> wrote:
>> Hi Govindraj,
>>
>> I was about to ask Tom to reorder the patches while applying, but
>> there are still several things to fix.
>> I'm also fine with fixing these by a follow up patch (after merging this).
>>
> 
> [...]
> 
>>
>> [...]
>>
>>> diff --git a/drivers/usb/ulpi/ulpi-viewport.c b/drivers/usb/ulpi/ulpi-viewport.c
>>> index 490fb0e..6f03f08 100644
>>> --- a/drivers/usb/ulpi/ulpi-viewport.c
>>> +++ b/drivers/usb/ulpi/ulpi-viewport.c
>>
>> [...]
>>
>>> -int ulpi_write(u32 ulpi_viewport, u8 *reg, u32 value)
>>> +int ulpi_write(struct ulpi_viewport *ulpi_vp, u8 *reg, u32 value)
>>>  {
>>>       u32 val = ULPI_RWRUN | ULPI_RWCTRL | ((u32)reg << 16) | (value & 0xff);
>>
>> You should utilize the port_num variable here, right?
>> something like:
>> val |= (ulpi_vp->port_num & 0x7) << 24;
>>
> 
> Yes correct, Shouldn't we add something like this
> 
> [...]
> 
> #ifndef CONFIG_ULPI_PORT_SHIFT && CONFIG_ULPI_PORT_MASK
> #define CONFIG_ULPI_PORT_SHIFT 24
> #define CONFIG_ULPI_PORT_MASK 0x7
> #endif
> 
> [...]
> 
> val |= (ulpi_vp->port_num & CONFIG_ULPI_PORT_MASK) <<
>                     CONFIG_ULPI_PORT_SHIFT;

We have already discussed this in the previous session [1]
And the conclusion was to use plain values instead,
because otherwise, you should replace all other masks and shifts...
and that will be a mess...
IMO,
(ulpi_vp->port_num & 0x7) << 24;
is really self explanatory and intuitive, so replacing it with defines
just make the code look bad and split into multiple lines.
Also the values are viewport specific and will not change, so
there is no reason to make them a config option.

[1] http://permalink.gmane.org/gmane.comp.boot-loaders.u-boot/124222

> 
> 
>>>
>>> -     return ulpi_request(ulpi_viewport, val);
>>> +     return ulpi_request(ulpi_vp, val);
>>>  }
>>>
>>> -u32 ulpi_read(u32 ulpi_viewport, u8 *reg)
>>> +u32 ulpi_read(struct ulpi_viewport *ulpi_vp, u8 *reg)
>>>  {
>>>       int err;
>>>       u32 val = ULPI_RWRUN | ((u32)reg << 16);
>>
>> same here
>>
>>>
>>> -     err = ulpi_request(ulpi_viewport, val);
>>> +     err = ulpi_request(ulpi_vp, val);
>>>       if (err)
>>>               return err;
>>>
>>> -     return (readl(ulpi_viewport) >> 8) & 0xff;
>>> +     return (readl(ulpi_vp->viewport_addr) >> 8) & 0xff;
>>>  }

[...]


-- 
Regards,
Igor.

  reply	other threads:[~2012-02-06 10:03 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-02-03 13:38 [U-Boot] [PATCH v3 0/7] Clean up ehci-omap and extend support for omap3/4 socs Govindraj.R
2012-02-03 13:38 ` [U-Boot] [PATCH v3 1/7] ehci-omap: driver for EHCI host on OMAP3 Govindraj.R
2012-02-03 13:38 ` [U-Boot] [PATCH v3 2/7] ehci-omap: Clean up added ehci-omap.c Govindraj.R
2012-02-06 11:26   ` Igor Grinberg
2012-02-03 13:38 ` [U-Boot] [PATCH v3 3/7] OMAP3+: Clock: Adding ehci clock enabling Govindraj.R
2012-02-06 11:42   ` Igor Grinberg
2012-02-06 11:57     ` Govindraj
2012-02-06 12:17       ` Igor Grinberg
2012-02-03 13:38 ` [U-Boot] [PATCH v3 4/7] OMAP4: clock-common: Move the usb dppl configuration to new func Govindraj.R
2012-02-03 13:38 ` [U-Boot] [PATCH v3 5/7] OMAP3+: ehci-omap: enable usb host ports for beagle/panda Govindraj.R
2012-02-06 12:03   ` Igor Grinberg
2012-02-03 13:38 ` [U-Boot] [PATCH v3 6/7] usb: ulpi: Extend the existing ulpi framework Govindraj.R
2012-02-06  8:55   ` Igor Grinberg
2012-02-06  9:38     ` Govindraj
2012-02-06 10:03       ` Igor Grinberg [this message]
2012-02-08 17:42   ` SUBHASHINI MANNE
2012-02-09  6:32     ` Govindraj
2012-02-03 13:38 ` [U-Boot] [PATCH v3 7/7] usb: ulpi: Add omap-ulpi-view port support Govindraj.R
2012-02-06  9:10   ` Igor Grinberg
2012-02-03 15:25 ` [U-Boot] [PATCH v3 0/7] Clean up ehci-omap and extend support for omap3/4 socs Tom Rini

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=4F2FA577.3080303@compulab.co.il \
    --to=grinberg@compulab.co.il \
    --cc=u-boot@lists.denx.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