Re: [U-Boot] [PATCH v2 2/4] board: evb-rk3399: add api to support dwc3 gadget

2016-08-28 Thread Kever Yang

Hi Marek,

On 08/26/2016 05:11 PM, Marek Vasut wrote:

On 08/25/2016 03:07 AM, Kever Yang wrote:

+ Marek

On 08/24/2016 11:46 AM, Kever Yang wrote:

This patch add board_usb_init() and interrupt callback
for dwc3 gadget.

Signed-off-by: Kever Yang 
Reviewed-by: Simon Glass 
---

Changes in v2:
- parse dt for utmi width

   board/rockchip/evb_rk3399/evb-rk3399.c | 33
+
   1 file changed, 33 insertions(+)

diff --git a/board/rockchip/evb_rk3399/evb-rk3399.c
b/board/rockchip/evb_rk3399/evb-rk3399.c
index d394276..5d3a09a 100644
--- a/board/rockchip/evb_rk3399/evb-rk3399.c
+++ b/board/rockchip/evb_rk3399/evb-rk3399.c
@@ -7,6 +7,8 @@
   #include 
   #include 
   #include 
+#include 
+#include 
 DECLARE_GLOBAL_DATA_PTR;
   @@ -54,3 +56,34 @@ void dram_init_banksize(void)
   gd->bd->bi_dram[0].start = 0x20;
   gd->bd->bi_dram[0].size = 0x8000;
   }
+
+#ifdef CONFIG_USB_DWC3
+static struct dwc3_device dwc3_device_data = {
+.maximum_speed = USB_SPEED_HIGH,
+.base = 0xfe80,
+.dr_mode = USB_DR_MODE_PERIPHERAL,

Why don't you parse all of this from DT ? You already parse DT below.


I add these code by reference to exynos5 and zynqmp platform, I can parse
all information from DT which including in DT, but maximum_speed still 
defined

here, because it's not in DT node, is that OK?

Thanks,
- Kever



+.index = 0,
+};
+
+int usb_gadget_handle_interrupts(void)
+{
+dwc3_uboot_handle_interrupt(0);
+return 0;
+}
+
+int board_usb_init(int index, enum usb_init_type init)
+{
+const void *blob = gd->fdt_blob;
+int node;
+
+node = fdt_node_offset_by_compatible(blob, -1,
+"rockchip,rk3399-xhci");
+if (node < 0)
+debug("%s node not found\n", __func__);
+else
+dwc3_device_data.usb2_phyif_utmi_width =
+fdtdec_get_int(blob, node, "snps,phyif-utmi-bits", -1);
+
+return dwc3_uboot_init(&dwc3_device_data);
+}
+#endif







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


Re: [U-Boot] [PATCH v2 2/4] board: evb-rk3399: add api to support dwc3 gadget

2016-08-28 Thread Marek Vasut
On 08/29/2016 02:49 AM, Kever Yang wrote:
> Hi Marek,
> 
> On 08/26/2016 05:11 PM, Marek Vasut wrote:
>> On 08/25/2016 03:07 AM, Kever Yang wrote:
>>> + Marek
>>>
>>> On 08/24/2016 11:46 AM, Kever Yang wrote:
 This patch add board_usb_init() and interrupt callback
 for dwc3 gadget.

 Signed-off-by: Kever Yang 
 Reviewed-by: Simon Glass 
 ---

 Changes in v2:
 - parse dt for utmi width

board/rockchip/evb_rk3399/evb-rk3399.c | 33
 +
1 file changed, 33 insertions(+)

 diff --git a/board/rockchip/evb_rk3399/evb-rk3399.c
 b/board/rockchip/evb_rk3399/evb-rk3399.c
 index d394276..5d3a09a 100644
 --- a/board/rockchip/evb_rk3399/evb-rk3399.c
 +++ b/board/rockchip/evb_rk3399/evb-rk3399.c
 @@ -7,6 +7,8 @@
#include 
#include 
#include 
 +#include 
 +#include 
  DECLARE_GLOBAL_DATA_PTR;
@@ -54,3 +56,34 @@ void dram_init_banksize(void)
gd->bd->bi_dram[0].start = 0x20;
gd->bd->bi_dram[0].size = 0x8000;
}
 +
 +#ifdef CONFIG_USB_DWC3
 +static struct dwc3_device dwc3_device_data = {
 +.maximum_speed = USB_SPEED_HIGH,
 +.base = 0xfe80,
 +.dr_mode = USB_DR_MODE_PERIPHERAL,
>> Why don't you parse all of this from DT ? You already parse DT below.
> 
> I add these code by reference to exynos5 and zynqmp platform, I can parse
> all information from DT which including in DT, but maximum_speed still
> defined
> here, because it's not in DT node, is that OK?

Sorry, can you please rephrase ?

Linux already has maximum-speed binding, see
Documentation/devicetree/bindings/usb/generic.txt

-- 
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 v2 2/4] board: evb-rk3399: add api to support dwc3 gadget

2016-08-26 Thread Marek Vasut
On 08/25/2016 03:07 AM, Kever Yang wrote:
> + Marek
> 
> On 08/24/2016 11:46 AM, Kever Yang wrote:
>> This patch add board_usb_init() and interrupt callback
>> for dwc3 gadget.
>>
>> Signed-off-by: Kever Yang 
>> Reviewed-by: Simon Glass 
>> ---
>>
>> Changes in v2:
>> - parse dt for utmi width
>>
>>   board/rockchip/evb_rk3399/evb-rk3399.c | 33
>> +
>>   1 file changed, 33 insertions(+)
>>
>> diff --git a/board/rockchip/evb_rk3399/evb-rk3399.c
>> b/board/rockchip/evb_rk3399/evb-rk3399.c
>> index d394276..5d3a09a 100644
>> --- a/board/rockchip/evb_rk3399/evb-rk3399.c
>> +++ b/board/rockchip/evb_rk3399/evb-rk3399.c
>> @@ -7,6 +7,8 @@
>>   #include 
>>   #include 
>>   #include 
>> +#include 
>> +#include 
>> DECLARE_GLOBAL_DATA_PTR;
>>   @@ -54,3 +56,34 @@ void dram_init_banksize(void)
>>   gd->bd->bi_dram[0].start = 0x20;
>>   gd->bd->bi_dram[0].size = 0x8000;
>>   }
>> +
>> +#ifdef CONFIG_USB_DWC3
>> +static struct dwc3_device dwc3_device_data = {
>> +.maximum_speed = USB_SPEED_HIGH,
>> +.base = 0xfe80,
>> +.dr_mode = USB_DR_MODE_PERIPHERAL,

Why don't you parse all of this from DT ? You already parse DT below.

>> +.index = 0,
>> +};
>> +
>> +int usb_gadget_handle_interrupts(void)
>> +{
>> +dwc3_uboot_handle_interrupt(0);
>> +return 0;
>> +}
>> +
>> +int board_usb_init(int index, enum usb_init_type init)
>> +{
>> +const void *blob = gd->fdt_blob;
>> +int node;
>> +
>> +node = fdt_node_offset_by_compatible(blob, -1,
>> +"rockchip,rk3399-xhci");
>> +if (node < 0)
>> +debug("%s node not found\n", __func__);
>> +else
>> +dwc3_device_data.usb2_phyif_utmi_width =
>> +fdtdec_get_int(blob, node, "snps,phyif-utmi-bits", -1);
>> +
>> +return dwc3_uboot_init(&dwc3_device_data);
>> +}
>> +#endif
> 
> 


-- 
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 v2 2/4] board: evb-rk3399: add api to support dwc3 gadget

2016-08-24 Thread Kever Yang

+ Marek

On 08/24/2016 11:46 AM, Kever Yang wrote:

This patch add board_usb_init() and interrupt callback
for dwc3 gadget.

Signed-off-by: Kever Yang 
Reviewed-by: Simon Glass 
---

Changes in v2:
- parse dt for utmi width

  board/rockchip/evb_rk3399/evb-rk3399.c | 33 +
  1 file changed, 33 insertions(+)

diff --git a/board/rockchip/evb_rk3399/evb-rk3399.c 
b/board/rockchip/evb_rk3399/evb-rk3399.c
index d394276..5d3a09a 100644
--- a/board/rockchip/evb_rk3399/evb-rk3399.c
+++ b/board/rockchip/evb_rk3399/evb-rk3399.c
@@ -7,6 +7,8 @@
  #include 
  #include 
  #include 
+#include 
+#include 
  
  DECLARE_GLOBAL_DATA_PTR;
  
@@ -54,3 +56,34 @@ void dram_init_banksize(void)

gd->bd->bi_dram[0].start = 0x20;
gd->bd->bi_dram[0].size = 0x8000;
  }
+
+#ifdef CONFIG_USB_DWC3
+static struct dwc3_device dwc3_device_data = {
+   .maximum_speed = USB_SPEED_HIGH,
+   .base = 0xfe80,
+   .dr_mode = USB_DR_MODE_PERIPHERAL,
+   .index = 0,
+};
+
+int usb_gadget_handle_interrupts(void)
+{
+   dwc3_uboot_handle_interrupt(0);
+   return 0;
+}
+
+int board_usb_init(int index, enum usb_init_type init)
+{
+   const void *blob = gd->fdt_blob;
+   int node;
+
+   node = fdt_node_offset_by_compatible(blob, -1,
+   "rockchip,rk3399-xhci");
+   if (node < 0)
+   debug("%s node not found\n", __func__);
+   else
+   dwc3_device_data.usb2_phyif_utmi_width =
+   fdtdec_get_int(blob, node, "snps,phyif-utmi-bits", -1);
+
+   return dwc3_uboot_init(&dwc3_device_data);
+}
+#endif



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


[U-Boot] [PATCH v2 2/4] board: evb-rk3399: add api to support dwc3 gadget

2016-08-23 Thread Kever Yang
This patch add board_usb_init() and interrupt callback
for dwc3 gadget.

Signed-off-by: Kever Yang 
Reviewed-by: Simon Glass 
---

Changes in v2:
- parse dt for utmi width

 board/rockchip/evb_rk3399/evb-rk3399.c | 33 +
 1 file changed, 33 insertions(+)

diff --git a/board/rockchip/evb_rk3399/evb-rk3399.c 
b/board/rockchip/evb_rk3399/evb-rk3399.c
index d394276..5d3a09a 100644
--- a/board/rockchip/evb_rk3399/evb-rk3399.c
+++ b/board/rockchip/evb_rk3399/evb-rk3399.c
@@ -7,6 +7,8 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -54,3 +56,34 @@ void dram_init_banksize(void)
gd->bd->bi_dram[0].start = 0x20;
gd->bd->bi_dram[0].size = 0x8000;
 }
+
+#ifdef CONFIG_USB_DWC3
+static struct dwc3_device dwc3_device_data = {
+   .maximum_speed = USB_SPEED_HIGH,
+   .base = 0xfe80,
+   .dr_mode = USB_DR_MODE_PERIPHERAL,
+   .index = 0,
+};
+
+int usb_gadget_handle_interrupts(void)
+{
+   dwc3_uboot_handle_interrupt(0);
+   return 0;
+}
+
+int board_usb_init(int index, enum usb_init_type init)
+{
+   const void *blob = gd->fdt_blob;
+   int node;
+
+   node = fdt_node_offset_by_compatible(blob, -1,
+   "rockchip,rk3399-xhci");
+   if (node < 0)
+   debug("%s node not found\n", __func__);
+   else
+   dwc3_device_data.usb2_phyif_utmi_width =
+   fdtdec_get_int(blob, node, "snps,phyif-utmi-bits", -1);
+
+   return dwc3_uboot_init(&dwc3_device_data);
+}
+#endif
-- 
1.9.1

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