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

2013-08-16 Thread Troy Kisky

On 8/15/2013 2:36 PM, Marek Vasut wrote:

Are there any news on this front? If not, please fix as requested so I can apply
this stuff for .10 , thanks.

Best regards,
Marek Vasut


I will update, I'm just sidetracked with Windows work for a little while.

Thanks
Troy

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2013-08-15 Thread Marek Vasut
Are there any news on this front? If not, please fix as requested so I can 
apply 
this stuff for .10 , thanks.

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2013-08-05 Thread Troy Kisky

On 8/4/2013 1:15 PM, Wolfgang Denk wrote:

Dear Troy Kisky,

In message <1375399657-25642-2-git-send-email-troy.ki...@boundarydevices.com> 
you wrote:

Add  functions for use with mx6 soc
void otg_enable(void);
void reset_usb_phy1(void);

Signed-off-by: Troy Kisky 
---
  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(+)

This appears to be V3 of this patch series, but I cannot see any kind
of change log?   Please note that this is a mandatory requirement, see
http://www.denx.de/wiki/view/U-Boot/Patches#Sending_updated_patch_versions

Note this applies to the whole patch series.

Yes, that does look wrong. V1 was not reviewed, I was asked to rebase 
because of many conflicting
changes to the same file. I screwed up the posting of V2 and it also was 
not reviewed. I finally got a

reviewable set of changes with V3. Sorry about the mess-up.

Troy

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2013-08-04 Thread Wolfgang Denk
Dear Troy Kisky,

In message <1375399657-25642-2-git-send-email-troy.ki...@boundarydevices.com> 
you wrote:
> Add  functions for use with mx6 soc
> void otg_enable(void);
> void reset_usb_phy1(void);
> 
> Signed-off-by: Troy Kisky 
> ---
>  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(+)

This appears to be V3 of this patch series, but I cannot see any kind
of change log?   Please note that this is a mandatory requirement, see 
http://www.denx.de/wiki/view/U-Boot/Patches#Sending_updated_patch_versions

Note this applies to the whole patch series.

Thanks!

Best regards,

Wolfgang Denk

-- 
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: w...@denx.de
There's no honorable way to kill, no gentle way to destroy.  There is
nothing good in war.  Except its ending.
-- Abraham Lincoln, "The Savage Curtain", stardate 5906.5
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2013-08-03 Thread Marek Vasut
Dear Troy Kisky,

> On 8/3/2013 9:47 AM, Marek Vasut wrote:
> > Dear Troy Kisky,
> > 
> > [...]
> > 
>  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).
> > 
> > No, I want to keep this as-is. Especially because the MX28 has the
> > registers named exactly by this scheme.
> 
> Exactly matching documentation is a good advantage.
> 
> >> I don't want to change the code I added to use this.
> > 
> > Please do, I do not want a duplicit implementation of these register
> > structures in the tree.
> > 
> >> I can see a small advantage in consistency with the mx28.
> > 
> > THe MX6 uses many IP blocks from MX28 -- APBH DMA, NAND, USB -- to name a
> > few. Keeping mx28 and mx6 aligned is more than helpful.
> > 
> > Best regards,
> > Marek Vasut
> 
> Marek, I really appreciate your willingness to explain your reasoning.
> Though I wouldn't do this
> without prompting, perhaps my dislike of unions is a bit irrational. But
> since there are also many
> other places where this change could be made (grep _tog in
> arch-mx6/crm_regs.h, imx-regs.h,)

This clearly means that someone didn't look around before coding this stuff.  
Brief look indicates the OCOTP is taken from MX28 too and so is ANATOP.

> I'd like Stefano to say he is OK with using mxs_reg_32 and doesn't share
> my opinion and doesn't
> want to rename it to something else. After all, you're talking about
> removing a structure with only
> 4 members, not a great amount of duplication.

I think I lost you here, sorry. To put down what I am talking about:

- Use what already is in imx-common/regs-common.h
- imx-common/regs-common.h does not need change

I did not yet hear any reasonable argument to change the imx-common/regs-
common.h file. Unions being ugly in your opinion is not a valid argument.

Note that MX28 was in the tree much earlier than MX6 and if MX6 did reinvent 
the 
wheel, it should be fixed before this duplication spreads. Especially so the 
MX6 
and MX28 do not diverge and can share much of the code.

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2013-08-03 Thread Troy Kisky

On 8/3/2013 9:47 AM, Marek Vasut wrote:

Dear Troy Kisky,

[...]


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).

No, I want to keep this as-is. Especially because the MX28 has the registers
named exactly by this scheme.


Exactly matching documentation is a good advantage.




I don't want to change the code I added to use this.

Please do, I do not want a duplicit implementation of these register structures
in the tree.


I can see a small advantage in consistency with the mx28.

THe MX6 uses many IP blocks from MX28 -- APBH DMA, NAND, USB -- to name a few.
Keeping mx28 and mx6 aligned is more than helpful.

Best regards,
Marek Vasut



Marek, I really appreciate your willingness to explain your reasoning. 
Though I wouldn't do this
without prompting, perhaps my dislike of unions is a bit irrational. But 
since there are also many
other places where this change could be made (grep _tog in 
arch-mx6/crm_regs.h, imx-regs.h,)
I'd like Stefano to say he is OK with using mxs_reg_32 and doesn't share 
my opinion and doesn't
want to rename it to something else. After all, you're talking about 
removing a structure with only

4 members, not a great amount of duplication.

Troy

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2013-08-03 Thread Marek Vasut
Dear Troy Kisky,

[...]

> >> 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).

No, I want to keep this as-is. Especially because the MX28 has the registers 
named exactly by this scheme.

> I don't want to change the code I added to use this.

Please do, I do not want a duplicit implementation of these register structures 
in the tree.

> I can see a small advantage in consistency with the mx28.

THe MX6 uses many IP blocks from MX28 -- APBH DMA, NAND, USB -- to name a few. 
Keeping mx28 and mx6 aligned is more than helpful.

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2013-08-02 Thread Troy Kisky

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 
---

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

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2013-08-02 Thread Marek Vasut
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 
>  ---
>  
> 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.

Best regards,
Marek Vasut
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2013-08-02 Thread 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 
---

   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.

Troy

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2013-08-02 Thread Marek Vasut
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 
> >> ---
> >> 
> >>   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
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2013-08-02 Thread 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 
---
  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 ?

Troy

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2013-08-02 Thread Marek Vasut
Dear Troy Kisky,

> Add  functions for use with mx6 soc
> void otg_enable(void);
> void reset_usb_phy1(void);
> 
> Signed-off-by: Troy Kisky 
> ---
>  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
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


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

2013-08-01 Thread Troy Kisky
Add  functions for use with mx6 soc
void otg_enable(void);
void reset_usb_phy1(void);

Signed-off-by: Troy Kisky 
---
 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/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
index 32572ee..37e8c7f 100644
--- a/arch/arm/cpu/armv7/mx6/soc.c
+++ b/arch/arm/cpu/armv7/mx6/soc.c
@@ -12,11 +12,58 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
 #include 
 
+#ifdef CONFIG_MV_UDC
+static void enable_usb_phy1_clk(unsigned char enable)
+{
+   struct usbphy *phy = (struct usbphy *)USB_PHY0_BASE_ADDR;
+
+   writel(BM_USBPHY_CTRL_CLKGATE,
+  enable ? &phy->ctrl.clr : &phy->ctrl.set);
+}
+
+void reset_usb_phy1(void)
+{
+   struct usbphy *phy = (struct usbphy *)USB_PHY0_BASE_ADDR;
+
+   /* Reset USBPHY module */
+   writel(BM_USBPHY_CTRL_SFTRST, &phy->ctrl.set);
+   udelay(10);
+
+   /* Remove CLKGATE and SFTRST */
+   writel(BM_USBPHY_CTRL_CLKGATE | BM_USBPHY_CTRL_SFTRST, &phy->ctrl.clr);
+   udelay(10);
+
+   /* Power up the PHY */
+   writel(0, &phy->pwd.val);
+}
+
+static void set_usb_phy1_clk(void)
+{
+   struct anatop_regs *anatop = (struct anatop_regs *)ANATOP_BASE_ADDR;
+
+   writel(BM_ANADIG_USB1_CHRG_DETECT_EN_B
+  | BM_ANADIG_USB1_CHRG_DETECT_CHK_CHRG_B,
+  &anatop->usb1_chrg_detect_set);
+
+   /* make sure pll is enable here */
+   writel(BM_ANADIG_USB1_PLL_480_CTRL_EN_USB_CLKS,
+  &anatop->usb1_pll_480_ctrl_set);
+}
+
+void otg_enable(void)
+{
+   set_usb_phy1_clk();
+   enable_usboh3_clk(1);
+   enable_usb_phy1_clk(1);
+}
+#endif
+
 struct scu_regs {
u32 ctrl;
u32 config;
diff --git a/arch/arm/include/asm/arch-mx6/crm_regs.h 
b/arch/arm/include/asm/arch-mx6/crm_regs.h
index 74aefe6..364d9a4 100644
--- a/arch/arm/include/asm/arch-mx6/crm_regs.h
+++ b/arch/arm/include/asm/arch-mx6/crm_regs.h
@@ -647,6 +647,9 @@ struct mxc_ccm_reg {
 #define BF_ANADIG_USB1_PLL_480_CTRL_DIV_SELECT(v)  \
(((v) << 0) & BM_ANADIG_USB1_PLL_480_CTRL_DIV_SELECT)
 
+#define BM_ANADIG_USB1_CHRG_DETECT_EN_B0x0010
+#define BM_ANADIG_USB1_CHRG_DETECT_CHK_CHRG_B  0x0008
+
 #define BM_ANADIG_PLL_528_LOCK 0x8000
 #define BP_ANADIG_PLL_528_RSVD1  19
 #define BM_ANADIG_PLL_528_RSVD1 0x7FF8
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;
+};
+
+#define BM_USBPHY_CTRL_CLKGATE 0x4000
+#define BM_USBPHY_CTRL_SFTRST  0x8000
+
 struct ocotp_regs {
u32 ctrl;
u32 ctrl_set;
diff --git a/arch/arm/include/asm/arch-mx6/sys_proto.h 
b/arch/arm/include/asm/arch-mx6/sys_proto.h
index bfdfd29..4413c3f 100644
--- a/arch/arm/include/asm/arch-mx6/sys_proto.h
+++ b/arch/arm/include/asm/arch-mx6/sys_proto.h
@@ -40,4 +40,8 @@ int mxs_wait_mask_set(struct mxs_register_32 *reg,
 int mxs_wait_mask_clr(struct mxs_register_32 *reg,
   uint32_t mask,
   unsigned int timeout);
+
+void otg_enable(void);
+void reset_usb_phy1(void);
+
 #endif
-- 
1.8.1.2

___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot