[U-Boot] [PATCH V3 01/20] Add functions for use with i.mx6 otg udc

Troy Kisky troy.kisky at boundarydevices.com
Sat Aug 3 04:24:07 CEST 2013


On 8/2/2013 6:45 PM, Marek Vasut wrote:
> Dear Troy Kisky,
>
>> On 8/2/2013 3:10 PM, Marek Vasut wrote:
>>> Dear Troy Kisky,
>>>
>>>> On 8/2/2013 3:48 AM, Marek Vasut wrote:
>>>>> Dear Troy Kisky,
>>>>>
>>>>>> Add  functions for use with mx6 soc
>>>>>> void otg_enable(void);
>>>>>> void reset_usb_phy1(void);
>>>>>>
>>>>>> Signed-off-by: Troy Kisky <troy.kisky at boundarydevices.com>
>>>>>> ---
>>>>>>
>>>>>>     arch/arm/cpu/armv7/mx6/soc.c              | 47
>>>>>>
>>>>>> +++++++++++++++++++++++++++++++
>>>>>> arch/arm/include/asm/arch-mx6/crm_regs.h
>>>>>>
>>>>>> |  3 ++
>>>>>> |
>>>>>>     arch/arm/include/asm/arch-mx6/imx-regs.h  | 17 +++++++++++
>>>>>>     arch/arm/include/asm/arch-mx6/sys_proto.h |  4 +++
>>>>>>     4 files changed, 71 insertions(+)
>>>>> [...]
>>>>>
>>>>>> diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h
>>>>>> b/arch/arm/include/asm/arch-mx6/imx-regs.h index 5d6bccb..3eed4d8
>>>>>> 100644 --- a/arch/arm/include/asm/arch-mx6/imx-regs.h
>>>>>> +++ b/arch/arm/include/asm/arch-mx6/imx-regs.h
>>>>>> @@ -419,6 +419,23 @@ struct cspi_regs {
>>>>>>
>>>>>>     	ECSPI5_BASE_ADDR
>>>>>>     
>>>>>>     #endif
>>>>>>
>>>>>> +struct set_clr_tog {
>>>>>> +	u32 val;
>>>>>> +	u32 set;
>>>>>> +	u32 clr;
>>>>>> +	u32 tog;
>>>>>> +};
>>>>>> +
>>>>>> +struct usbphy {
>>>>>> +	struct set_clr_tog	pwd;
>>>>>> +	struct set_clr_tog	tx;
>>>>>> +	struct set_clr_tog	rx;
>>>>>> +	struct set_clr_tog	ctrl;
>>>>>> +};
>>>>> Maybe you want to keep the naming here consistent with MX28 and MX6?
>>>>>
>>>>> See arch/arm/include/asm/imx-common/regs-common.h
>>>>>
>>>>> [...]
>>>>>
>>>>> Best regards,
>>>>> Marek Vasut
>>>> Wow,  arch/arm/include/asm/imx-common/regs-common.h
>>>> is damn ugly. I personally hate unions even when there is a very good
>>>> reason.
>>>>
>>>> Would you like to see me attempt to clean it up or do you like it the
>>>> way it is
>>>> since your commit started the unions ?
>>> I think it works perfectly well and does exactly what it's supposed to
>>> do. What's your problem with the file?
>>>
>>> Best regards,
>>> Marek Vasut
>> Why is there a union ? It looks to me like you just want to access the
>> same variable
>> with 2 naming strategies.
> That is correct. I can either pass it further into functions as the struct
> mxs_register_32 name_reg or I can directly access it as name_set/_clr/_tog .
> Works just fine.

I never said it didn't work, obviously it does.

>
> Best regards,
> Marek Vasut
>
There may be code that you can point at that would make this useful, but 
I have
a hard time envisioning it. The code I added, I know doesn't need a 
union, and I bet most
of the other variable accesses don't need a union. That's why I asked if 
you'd like
me to attempt to clean it up (always access thru struct, ie replace 
name_set with name.set).

I don't want to change the code I added to use this.
I can see a small advantage in consistency with the mx28.


Troy



More information about the U-Boot mailing list