rockchip: rk3288: Fix dwc2 gadget registration
Subsystems (3)
PATCH 1/1 rockchip: rk3288: Fix dwc2 gadget registration
rk3288 needs phy registration in order to work or the board just hang
--- arch/arm/mach-rockchip/board.c | 12 ++++++++ arch/arm/mach-rockchip/rk3288/rk3288.c | 39 ++++++++++++++++++++++++++ 2 files changed, 51 insertions(+)
arch/arm/mach-rockchip/board.c +12 -0
@@ -59,6 +59,12 @@ static struct dwc2_plat_otg_data otg_data = { .tx_fifo_sz = 128, }; + +__weak int board_usb_phy_init (int node,struct dwc2_plat_otg_data *otg_data) +{ +return 0 ; +} +int board_usb_init (int index,enum usb_init_type init) {int node;
@@ -84,6 +90,12 @@ int board_usb_init(int index, enum usb_init_type init) } otg_data.regs_otg =fdtdec_get_addr (blob, node,"reg" ); + node =board_usb_phy_init (node, &otg_data); +if (node <0 ) { +debug ("Not found usb_otg phy\n" ); +return -ENODEV ; + } +return dwc2_udc_probe (&otg_data); }
arch/arm/mach-rockchip/rk3288/rk3288.c +39 -0
@@ -184,6 +184,45 @@ static void rk3288_detect_reset_reason(void)rk_clrreg (&cru->cru_glb_rst_st,GLB_RST_ST_MASK ); } +#if defined(CONFIG_USB_GADGET ) && defined(CONFIG_USB_GADGET_DWC2_OTG ) +#include <usb.h> +#include <usb/dwc2_udc.h> + +int board_usb_phy_init (int node,struct dwc2_plat_otg_data *otg_data) +{ +int phy_node; +const void *blob = gd->fdt_blob; +u32 grf_phy_offset; + + node =fdtdec_lookup_phandle (blob, node,"phys" ); +if (node <=0 ) { +debug ("Not found usb phy device\n" ); +return -ENODEV ; + } + + phy_node =fdt_parent_offset (blob, node); +if (phy_node <=0 ) { +debug ("Not found usb phy device\n" ); +return -ENODEV ; + } + + otg_data->phy_of_node = phy_node; + grf_phy_offset =fdtdec_get_addr (blob, node,"reg" ); + +/* find the grf node */ + node =fdt_node_offset_by_compatible (blob,-1 ,"rockchip,rk3288-grf" ); +if (node <=0 ) { +debug ("Not found grf device\n" ); +return -ENODEV ; + } + otg_data->regs_phy = grf_phy_offset + +fdtdec_get_addr (blob, node,"reg" ); + +return 0 ; +} + +#endif +__weak int rk3288_board_late_init (void ) {return 0 ;
Signature · 1 line
2.17.1
PATCH 1/1 rockchip: rk3288: Fix dwc2 gadget registration
Hi Michael,
I have send a similar patch to fix this issue weeks ago, and ready
to merge.
Thanks,
- Kever
Quoted 89 lines · Michael Trimarchi
rk3288 needs phy registration in order to work or the board just hang
Signed-off-by Michael Trimarchi <[email protected]>--- arch/arm/mach-rockchip/board.c | 12 ++++++++ arch/arm/mach-rockchip/rk3288/rk3288.c | 39 ++++++++++++++++++++++++++ 2 files changed, 51 insertions(+)arch/arm/mach-rockchip/board.c +12
-0@@ -59,6 +59,12 @@ static struct dwc2_plat_otg_data otg_data = { .tx_fifo_sz = 128, }; + +__weak int board_usb_phy_init (int node,struct dwc2_plat_otg_data *otg_data) +{ +return 0 ; +} +int board_usb_init (int index,enum usb_init_type init) {int node;@@ -84,6 +90,12 @@ int board_usb_init(int index, enum usb_init_type init) } otg_data.regs_otg =fdtdec_get_addr (blob, node,"reg" ); + node =board_usb_phy_init (node, &otg_data); +if (node <0 ) { +debug ("Not found usb_otg phy\n" ); +return -ENODEV ; + } +return dwc2_udc_probe (&otg_data); }arch/arm/mach-rockchip/rk3288/rk3288.c +39
-0@@ -184,6 +184,45 @@ static void rk3288_detect_reset_reason(void)rk_clrreg (&cru->cru_glb_rst_st,GLB_RST_ST_MASK ); } +#if defined(CONFIG_USB_GADGET ) && defined(CONFIG_USB_GADGET_DWC2_OTG ) +#include <usb.h> +#include <usb/dwc2_udc.h> + +int board_usb_phy_init (int node,struct dwc2_plat_otg_data *otg_data) +{ +int phy_node; +const void *blob = gd->fdt_blob; +u32 grf_phy_offset; + + node =fdtdec_lookup_phandle (blob, node,"phys" ); +if (node <=0 ) { +debug ("Not found usb phy device\n" ); +return -ENODEV ; + } + + phy_node =fdt_parent_offset (blob, node); +if (phy_node <=0 ) { +debug ("Not found usb phy device\n" ); +return -ENODEV ; + } + + otg_data->phy_of_node = phy_node; + grf_phy_offset =fdtdec_get_addr (blob, node,"reg" ); + +/* find the grf node */ + node =fdt_node_offset_by_compatible (blob,-1 ,"rockchip,rk3288-grf" ); +if (node <=0 ) { +debug ("Not found grf device\n" ); +return -ENODEV ; + } + otg_data->regs_phy = grf_phy_offset + +fdtdec_get_addr (blob, node,"reg" ); + +return 0 ; +} + +#endif +__weak int rk3288_board_late_init (void ) {return 0 ;
PATCH 1/1 rockchip: rk3288: Fix dwc2 gadget registration
Hi
Is this public?
Michael
Quoted 103 lines · Kever Yang
Hi Michael,
I have send a similar patch to fix this issue weeks ago, and ready
to merge.Thanks,
- Kever
Quoted 89 lines · Michael Trimarchi
rk3288 needs phy registration in order to work or the board just hang
Signed-off-by Michael Trimarchi <[email protected]>--- arch/arm/mach-rockchip/board.c | 12 ++++++++ arch/arm/mach-rockchip/rk3288/rk3288.c | 39 ++++++++++++++++++++++++++ 2 files changed, 51 insertions(+)arch/arm/mach-rockchip/board.c +12
-0@@ -59,6 +59,12 @@ static struct dwc2_plat_otg_data otg_data = { .tx_fifo_sz = 128, }; + +__weak int board_usb_phy_init (int node,struct dwc2_plat_otg_data *otg_data) +{ +return 0 ; +} +int board_usb_init (int index,enum usb_init_type init) {int node;@@ -84,6 +90,12 @@ int board_usb_init(int index, enum usb_init_type init) } otg_data.regs_otg =fdtdec_get_addr (blob, node,"reg" ); + node =board_usb_phy_init (node, &otg_data); +if (node <0 ) { +debug ("Not found usb_otg phy\n" ); +return -ENODEV ; + } +return dwc2_udc_probe (&otg_data); }arch/arm/mach-rockchip/rk3288/rk3288.c +39
-0@@ -184,6 +184,45 @@ static void rk3288_detect_reset_reason(void)rk_clrreg (&cru->cru_glb_rst_st,GLB_RST_ST_MASK ); } +#if defined(CONFIG_USB_GADGET ) && defined(CONFIG_USB_GADGET_DWC2_OTG ) +#include <usb.h> +#include <usb/dwc2_udc.h> + +int board_usb_phy_init (int node,struct dwc2_plat_otg_data *otg_data) +{ +int phy_node; +const void *blob = gd->fdt_blob; +u32 grf_phy_offset; + + node =fdtdec_lookup_phandle (blob, node,"phys" ); +if (node <=0 ) { +debug ("Not found usb phy device\n" ); +return -ENODEV ; + } + + phy_node =fdt_parent_offset (blob, node); +if (phy_node <=0 ) { +debug ("Not found usb phy device\n" ); +return -ENODEV ; + } + + otg_data->phy_of_node = phy_node; + grf_phy_offset =fdtdec_get_addr (blob, node,"reg" ); + +/* find the grf node */ + node =fdt_node_offset_by_compatible (blob,-1 ,"rockchip,rk3288-grf" ); +if (node <=0 ) { +debug ("Not found grf device\n" ); +return -ENODEV ; + } + otg_data->regs_phy = grf_phy_offset + +fdtdec_get_addr (blob, node,"reg" ); + +return 0 ; +} + +#endif +__weak int rk3288_board_late_init (void ) {return 0 ;
Signature · 4 lines
| Michael Nazzareno Trimarchi Amarula Solutions BV | | COO - Founder Cruquiuskade 47 | | +31(0)851119172 Amsterdam 1018 AM NL | | [`as] http://www.amarulasolutions.com |
PATCH 1/1 rockchip: rk3288: Fix dwc2 gadget registration
Hi Kever
Quoted 15 lines · Michael Nazzareno Trimarchi
Hi
Is this public?
Michael
Quoted 7 lines · Kever Yang
Hi Michael,
I have send a similar patch to fix this issue weeks ago, and ready
to merge.
Sorry but working on tinker-S I found a couple of no-working things. Even I have pending the question about passing data from spl to u-boot in no
fit image. I fully now support the tinker board and wrtoe the code for board detection. I will make it public because need couple of refactor
Micahel
Quoted 103 lines
Quoted 86 lines
Thanks,
- Kever
Quoted 81 lines · Michael Trimarchi
rk3288 needs phy registration in order to work or the board just hang
Signed-off-by Michael Trimarchi <[email protected]>--- arch/arm/mach-rockchip/board.c | 12 ++++++++ arch/arm/mach-rockchip/rk3288/rk3288.c | 39 ++++++++++++++++++++++++++ 2 files changed, 51 insertions(+)arch/arm/mach-rockchip/board.c +12
-0@@ -59,6 +59,12 @@ static struct dwc2_plat_otg_data otg_data = { .tx_fifo_sz = 128, }; + +__weak int board_usb_phy_init (int node,struct dwc2_plat_otg_data *otg_data) +{ +return 0 ; +} +int board_usb_init (int index,enum usb_init_type init) {int node;@@ -84,6 +90,12 @@ int board_usb_init(int index, enum usb_init_type init) } otg_data.regs_otg =fdtdec_get_addr (blob, node,"reg" ); + node =board_usb_phy_init (node, &otg_data); +if (node <0 ) { +debug ("Not found usb_otg phy\n" ); +return -ENODEV ; + } +return dwc2_udc_probe (&otg_data); }arch/arm/mach-rockchip/rk3288/rk3288.c +34
-0@@ -184,6 +184,45 @@ static void rk3288_detect_reset_reason(void)rk_clrreg (&cru->cru_glb_rst_st,GLB_RST_ST_MASK ); } +#if defined(CONFIG_USB_GADGET ) && defined(CONFIG_USB_GADGET_DWC2_OTG ) +#include <usb.h> +#include <usb/dwc2_udc.h> + +int board_usb_phy_init (int node,struct dwc2_plat_otg_data *otg_data) +{ +int phy_node; +const void *blob = gd->fdt_blob; +u32 grf_phy_offset; + + node =fdtdec_lookup_phandle (blob, node,"phys" ); +if (node <=0 ) { +debug ("Not found usb phy device\n" ); +return -ENODEV ; + } + + phy_node =fdt_parent_offset (blob, node); +if (phy_node <=0 ) { +debug ("Not found usb phy device\n" ); +return -ENODEV ; + } + + otg_data->phy_of_node = phy_node; + grf_phy_offset =fdtdec_get_addr (blob, node,"reg" ); + +/* find the grf node */ + node =fdt_node_offset_by_compatible (blob,-1 ,"rockchip,rk3288-grf" ); +if (node <=0 ) { +debug ("Not found grf device\n" ); +return -ENODEV ; + } + otg_data->regs_phy = grf_phy_offset + +fdtdec_get_addr (blob, node,"reg" ); +Quoted 10 lines
arch/arm/mach-rockchip/rk3288/rk3288.c static void rk3288_detect_reset_reason(void) · line 228
Quoted 8 lines
arch/arm/mach-rockchip/rk3288/rk3288.c +5
-0+ return 0; +} + +#endif +__weak int rk3288_board_late_init (void ) {return 0 ;--
| Michael Nazzareno Trimarchi Amarula Solutions BV | | COO - Founder Cruquiuskade 47 | | +31(0)851119172 Amsterdam 1018 AM NL | | [`as] http://www.amarulasolutions.com |
Signature · 4 lines
| Michael Nazzareno Trimarchi Amarula Solutions BV | | COO - Founder Cruquiuskade 47 | | +31(0)851119172 Amsterdam 1018 AM NL | | [`as] http://www.amarulasolutions.com |