public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Marek Vasut <marex@denx.de>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/5] usb: xhci: fsl: code cleanup for device tree fixup for fsl usb controllers
Date: Fri, 27 May 2016 14:47:13 +0200	[thread overview]
Message-ID: <574841D1.4010708@denx.de> (raw)
In-Reply-To: <DB5PR0401MB2024AD52BAFC4167AD348B5EF5420@DB5PR0401MB2024.eurprd04.prod.outlook.com>

On 05/27/2016 07:14 AM, Sriram Dash wrote:
>> -----Original Message-----
>> From: Marek Vasut [mailto:marex at denx.de]
>> Sent: Thursday, May 26, 2016 5:49 PM
>> To: Sriram Dash <sriram.dash@nxp.com>; u-boot at lists.denx.de
>> Cc: york sun <york.sun@nxp.com>; albert.u.boot at aribaud.net; Rajesh Bhagat
>> <rajesh.bhagat@nxp.com>
>> Subject: Re: [PATCH 2/5] usb: xhci: fsl: code cleanup for device tree fixup for fsl usb
>> controllers
>>
>> On 05/26/2016 07:59 AM, Sriram Dash wrote:
>>
>> Commit message, please.
>>
> 
> Will take care in v2.
> 
>>> Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
>>> Signed-off-by: Sriram Dash <sriram.dash@nxp.com>
>>> ---
>>>  drivers/usb/common/fsl-dt-fixup.c | 51
>>> +++++++++++++--------------------------
>>>  1 file changed, 17 insertions(+), 34 deletions(-)
>>>
>>> diff --git a/drivers/usb/common/fsl-dt-fixup.c
>>> b/drivers/usb/common/fsl-dt-fixup.c
>>> index 6f31932..520130e 100644
>>> --- a/drivers/usb/common/fsl-dt-fixup.c
>>> +++ b/drivers/usb/common/fsl-dt-fixup.c
>>> @@ -99,6 +99,19 @@ static int fdt_fixup_usb_erratum(void *blob, const char
>> *prop_erratum,
>>>  	return node_offset;
>>>  }
>>>
>>> +#define FDT_FIXUP_ERRATUM(id)						\
>>> +do {									\
>>> +	if (has_erratum_##id()) {					\
>>> +		usb_erratum_##id##_off =  fdt_fixup_usb_erratum		\
>>> +					   (blob,			\
>>> +					    "fsl,usb-erratum-"#id,	\
>>> +					    usb_erratum_##id##_off);	\
>>> +		if (usb_erratum_##id##_off < 0)				\
>>> +			return;						\
>>> +		debug("Adding USB erratum "#id"\n");			\
>>> +	}								\
>>> +} while (0)
>>
>> Would it be difficult to turn this into a function ?
>>
>> You can likely implement some function like int fsl_has_erratum(const unsigned int
>> erratum) and then do the string concatenation with snprintf().
>>
> 
> Do you suspect any possible issue with macro implementation, or your comment is for reducing the size of U boot by making it a function?

I'm not a fan of huge macros, since they often introduce various subtle
issues and in this case it would most likely reduce size of the u-boot.

>>>  void fdt_fixup_dr_usb(void *blob, bd_t *bd)  {
>>>  	static const char * const modes[] = { "host", "peripheral", "otg" };
>>> @@ -164,39 +177,9 @@ void fdt_fixup_dr_usb(void *blob, bd_t *bd)
>>>  		if (usb_phy_off < 0)
>>>  			return;
>>>
>>> -		if (has_erratum_a006261()) {
>>> -			usb_erratum_a006261_off =  fdt_fixup_usb_erratum
>>> -						   (blob,
>>> -						    "fsl,usb-erratum-a006261",
>>> -						    usb_erratum_a006261_off);
>>> -			if (usb_erratum_a006261_off < 0)
>>> -				return;
>>> -		}
>>> -
>>> -		if (has_erratum_a007075()) {
>>> -			usb_erratum_a007075_off =  fdt_fixup_usb_erratum
>>> -						   (blob,
>>> -						    "fsl,usb-erratum-a007075",
>>> -						    usb_erratum_a007075_off);
>>> -			if (usb_erratum_a007075_off < 0)
>>> -				return;
>>> -		}
>>> -
>>> -		if (has_erratum_a007792()) {
>>> -			usb_erratum_a007792_off =  fdt_fixup_usb_erratum
>>> -						   (blob,
>>> -						    "fsl,usb-erratum-a007792",
>>> -						    usb_erratum_a007792_off);
>>> -			if (usb_erratum_a007792_off < 0)
>>> -				return;
>>> -		}
>>> -		if (has_erratum_a005697()) {
>>> -			usb_erratum_a005697_off =  fdt_fixup_usb_erratum
>>> -						   (blob,
>>> -						    "fsl,usb-erratum-a005697",
>>> -						    usb_erratum_a005697_off);
>>> -			if (usb_erratum_a005697_off < 0)
>>> -				return;
>>> -		}
>>> +		FDT_FIXUP_ERRATUM(a006261);
>>> +		FDT_FIXUP_ERRATUM(a007075);
>>> +		FDT_FIXUP_ERRATUM(a007792);
>>> +		FDT_FIXUP_ERRATUM(a005697);
>>>  	}
>>>  }
>>>
>>
>>
>> --
>> Best regards,
>> Marek Vasut


-- 
Best regards,
Marek Vasut

  reply	other threads:[~2016-05-27 12:47 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-05-26  5:59 [U-Boot] [PATCH 0/5] Supporting ARM v8 USB errata for FSL Sriram Dash
2016-05-26  5:59 ` [U-Boot] [PATCH 1/5] arm64: fsl-layerscape: add get_svr and IS_SVR_REV helper Sriram Dash
2016-05-26  5:59 ` [U-Boot] [PATCH 2/5] usb: xhci: fsl: code cleanup for device tree fixup for fsl usb controllers Sriram Dash
2016-05-26 12:19   ` Marek Vasut
2016-05-27  5:14     ` Sriram Dash
2016-05-27 12:47       ` Marek Vasut [this message]
2016-05-26  5:59 ` [U-Boot] [PATCH 3/5] fsl: usb: make errata function common for PPC and ARM Sriram Dash
2016-05-26 12:21   ` Marek Vasut
2016-05-27  5:14     ` Sriram Dash
2016-05-27 12:48       ` Marek Vasut
2016-05-26  5:59 ` [U-Boot] [PATCH 4/5] armv8/ls2080: Remove workaround for erratum A008751 Sriram Dash
2016-05-26  5:59 ` [U-Boot] [PATCH 5/5] usb: xhci: fsl: Add workaround for USB erratum A-008751 Sriram Dash

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=574841D1.4010708@denx.de \
    --to=marex@denx.de \
    --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