Re: [U-Boot] [RFC PATCH 1/7] dm: usb: Add a uclass for USB controllers

2015-03-09 Thread Vivek Gautam
-dev_index);
 +
 +   usb_started = true;
 +   }
 +
 +   debug(scan end\n);
 +   /* if we were not able to find at least one working bus, bail out */
 +   if (!count)
 +   printf(No controllers found\n);
 +   else if (controllers_initialized == 0)
 +   printf(USB error: all controllers failed lowlevel init\n);
 +
 +   return usb_started ? 0 : -1;
 +}
 +
 +#ifdef CONFIG_MUSB_HOST
 +int usb_reset_root_port(void)
 +{
 +   return -ENOSYS;
 +}
 +#endif
 +
 +int usb_alloc_new_device(struct udevice *controller,
 +struct usb_device **devp)
 +{
 +   struct dm_usb_info *usb = dev_get_uclass_priv(controller);
 +   struct usb_device *udev;
 +
 +   int i;
 +
 +   debug(New Device %d\n, usb-dev_index);
 +   if (usb-dev_index == USB_MAX_DEVICE) {
 +   printf(ERROR, too many USB Devices, max=%d\n, 
 USB_MAX_DEVICE);
 +   return -ENOSPC;
 +   }
 +   /* default Address is 0, real addresses start with 1 */
 +   udev = usb-usb_dev[usb-dev_index++];
 +   udev-devnum = usb-dev_index;
 +   udev-maxchild = 0;
 +   for (i = 0; i  USB_MAXCHILDREN; i++)
 +   udev-children[i] = NULL;
 +   udev-parent = NULL;
 +   udev-controller_dev = controller;
 +   udev-controller = usb-controller;
 +   debug(%s: udev=%p\n, __func__, udev);
 +
 +   *devp = udev;
 +   return 0;
 +}
 +
 +struct usb_device *usb_get_dev_index(struct udevice *controller, int index)
 +{
 +   struct dm_usb_info *usb = dev_get_uclass_priv(controller);
 +   struct usb_device *udev;
 +
 +   if (index  0 || index = USB_MAX_DEVICE)
 +   return NULL;
 +   udev = usb-usb_dev[index];
 +
 +   return udev-controller ? udev : NULL;
 +}
 +
 +/*
 +static int usb_child_pre_probe(struct udevice *dev)
 +{
 +   struct usb_device *udev = dev_get_parentdata(dev);
 +
 +   udev-controller = dev;
 +
 +   return 0;
 +}
 +*/
 +/*
 + * Free the newly created device node.
 + * Called in error cases where configuring a newly attached
 + * device fails for some reason.
 + */
 +void usb_free_device(struct udevice *controller)
 +{
 +   struct dm_usb_info *usb = dev_get_uclass_priv(controller);
 +
 +   usb-dev_index--;
 +   debug(Freeing device node: %d\n, usb-dev_index);
 +   memset(usb-usb_dev[usb-dev_index], '\0', sizeof(struct 
 usb_device));
 +   usb-usb_dev[usb-dev_index].devnum = -1;
 +}
 +
 +UCLASS_DRIVER(usb) = {
 +   .id = UCLASS_USB,
 +   .name   = usb,
 +   .flags  = DM_UC_FLAG_SEQ_ALIAS,
 +/*
 +   .child_pre_probe = usb_child_pre_probe,
 +   .post_probe = i2c_post_probe,
 +*/
 +   .per_device_auto_alloc_size = sizeof(struct dm_usb_info),
 +/*
 +   .per_child_auto_alloc_size = sizeof(struct usb_device),
 +   .per_child_platdata_auto_alloc_size = sizeof(struct dm_i2c_chip),
 +   .child_post_bind = i2c_child_post_bind,
 +*/
 +};
 diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h
 index 91bb90d..baab810 100644
 --- a/include/dm/uclass-id.h
 +++ b/include/dm/uclass-id.h
 @@ -34,6 +34,7 @@ enum uclass_id {
 UCLASS_I2C_GENERIC, /* Generic I2C device */
 UCLASS_I2C_EEPROM,  /* I2C EEPROM device */
 UCLASS_MOD_EXP, /* RSA Mod Exp device */
 +   UCLASS_USB, /* USB bus */

 UCLASS_COUNT,
 UCLASS_INVALID = -1,
 --
 2.2.0.rc0.207.ga3a616c

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



-- 
Best Regards
Vivek Gautam
Samsung RD Institute, Bangalore
India
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC PATCH 1/7] dm: usb: Add a uclass for USB controllers

2015-03-09 Thread Vivek Gautam
Hi,


On Mon, Mar 9, 2015 at 11:50 AM, Vivek Gautam gautamvivek1...@gmail.com wrote:

Sorry i was in the middle of adding comment and the message just got sent.
I will add other comments here.

 Hi Simon,


 On Sat, Jan 31, 2015 at 12:34 AM, Simon Glass s...@chromium.org wrote:
 Add a uclass that can represent a USB controller. For now we do not create
 devices for things attached to the controller.

 Signed-off-by: Simon Glass s...@chromium.org
 ---

 Please find my comments inline below.


  drivers/usb/host/Makefile |   2 +
  drivers/usb/host/usb-uclass.c | 227 
 ++
  include/dm/uclass-id.h|   1 +
  3 files changed, 230 insertions(+)
  create mode 100644 drivers/usb/host/usb-uclass.c

 diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
 index c11b551..d0b890a 100644
 --- a/drivers/usb/host/Makefile
 +++ b/drivers/usb/host/Makefile
 @@ -5,6 +5,8 @@
  # SPDX-License-Identifier: GPL-2.0+
  #

 +obj-$(CONFIG_DM_USB) += usb-uclass.o
 +
  # ohci
  obj-$(CONFIG_USB_OHCI_NEW) += ohci-hcd.o
  obj-$(CONFIG_USB_ATMEL) += ohci-at91.o
 diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
 new file mode 100644
 index 000..86564db
 --- /dev/null
 +++ b/drivers/usb/host/usb-uclass.c
 @@ -0,0 +1,227 @@
 +/*
 + * (C) Copyright 2015 Google, Inc
 + * Written by Simon Glass s...@chromium.org
 + *
 + * SPDX-License-Identifier:GPL-2.0+
 + */
 +
 +#include common.h
 +#include dm.h
 +#include errno.h
 +#include usb.h
 +#include dm/device-internal.h
 +
 +static bool usb_started; /* flag for the started/stopped USB status */
 +static bool asynch_allowed;
 +
 +int usb_disable_asynch(int disable)
 +{
 +   int old_value = asynch_allowed;
 +
 +   asynch_allowed = !disable;
 +   return old_value;
 +}
 +
 +int submit_int_msg(struct usb_device *udev, unsigned long pipe, void 
 *buffer,
 +  int length, int interval)
 +{
 +   struct udevice *dev = udev-controller_dev;
 +   struct dm_usb_ops *ops = usb_get_ops(dev);
 +
 +   if (!ops-control)
 +   return -ENOSYS;
 +
 +   return ops-interrupt(dev, udev, pipe, buffer, length, interval);
 +}
 +
 +int submit_control_msg(struct usb_device *udev, unsigned long pipe,
 +  void *buffer, int length, struct devrequest *setup)
 +{
 +   struct udevice *dev = udev-controller_dev;
 +   struct dm_usb_ops *ops = usb_get_ops(dev);
 +
 +   if (!ops-control)
 +   return -ENOSYS;
 +
 +   return ops-control(dev, udev, pipe, buffer, length, setup);
 +}
 +
 +int submit_bulk_msg(struct usb_device *udev, unsigned long pipe, void 
 *buffer,
 +   int length)
 +{
 +   struct udevice *dev = udev-controller_dev;
 +   struct dm_usb_ops *ops = usb_get_ops(dev);
 +
 +   if (!ops-control)
 +   return -ENOSYS;
 +
 +   return ops-bulk(dev, udev, pipe, buffer, length);
 +}
 +
 +int usb_alloc_device(struct usb_device *udev)
 +{
 +   struct udevice *dev = udev-controller_dev;
 +   struct dm_usb_ops *ops = usb_get_ops(dev);
 +
 +   if (!ops-alloc_device)
 +   return -ENOSYS;
 +
 +   return ops-alloc_device(dev, udev);
 +}
 +
 +int usb_stop(void)
 +{

i think you are already planning to add remove() call for host
controller here,
alongwith freeing the device, usb_free_device().

 +   return 0;
 +}
 +
 +int usb_init(void)
 +{
 +   int controllers_initialized = 0;
 +   struct usb_device *udev;
 +   struct udevice *dev;
 +   struct uclass *uc;
 +   int count = 0;
 +   int ret;
 +
 +   asynch_allowed = 1;

 you may still want to do a usb_hub_reset() like usb_init()
 in common/usb.c does ?

 Also make all devices unknown initially
i think this may not be required.


 +   ret = uclass_get(UCLASS_USB, uc);
 +   if (ret)
 +   return ret;

 nit: just add an extra line here.

 +   uclass_foreach_dev(dev, uc) {
 +   struct dm_usb_info *usb;
 +
 +   /* init low_level USB */
 +   count++;
 +   printf(USB);
 +   ret = device_probe(dev);
 +   printf(%d:   , dev-seq);
 +   if (ret == -ENODEV) {   /* No such device. */
 +   puts(Port not available.\n);
 +   controllers_initialized++;
 +   continue;
 +   }
 +
 +   if (ret) {  /* Other error. */
 +   puts(probe failed\n);
 +   continue;
 +   }
 +   /*
 +* lowlevel init is OK, now scan the bus for devices
 +* i.e. search HUBs and configure them
 +*/
 +   controllers_initialized++;
 +   printf(scanning bus %d for devices... , dev-seq);
 +   ret = usb_alloc_new_device(dev, udev);
 +   /*
 +* device 0 is always present

Re: [U-Boot] [RFC PATCH 3/7] dm: usb: Adjust users of the USB stack to work with driver model

2015-02-25 Thread Vivek Gautam
 device
 + *
 + * @devp: returns a pointer of a new device structure
 + * @return 0 if OK, -ENOSPC if we have found out of room for new devices
 + */
 +int usb_alloc_new_device(struct udevice *controller, struct usb_device 
 **devp);
 +
 +struct usb_device *usb_get_dev_index(struct udevice *controller, int index);
 +
 +#else
 +
 +void usb_free_device(void *controller);
 +/**
 + * usb_alloc_new_device() - Allocate a new device
 + *
 + * @devp: returns a pointer of a new device structure
 + * @return 0 if OK, -ENOSPC if we have found out of room for new devices
 + */
 +int usb_alloc_new_device(void *controller, struct usb_device **devp);
 +
 +struct usb_device *usb_get_dev_index(int index);
 +
 +#endif
 +
  int usb_hub_probe(struct usb_device *dev, int ifnum);
  void usb_hub_reset(void);
  int hub_port_reset(struct usb_device *dev, int port,
   unsigned short *portstat);

 -struct usb_device *usb_alloc_new_device(void *controller);
 -
  int usb_new_device(struct usb_device *dev);
 -void usb_free_device(void);
 +
  int usb_alloc_device(struct usb_device *dev);

  #endif /*_USB_H_ */
 --
 2.2.0.rc0.207.ga3a616c

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



-- 
Best Regards
Vivek Gautam
Samsung RD Institute, Bangalore
India
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC PATCH 0/7] RFC: dm: Add USB support

2015-02-25 Thread Vivek Gautam
/usb_defs.h   |  14 ++-
  26 files changed, 1294 insertions(+), 153 deletions(-)
  create mode 100644 arch/sandbox/include/asm/processor.h
  create mode 100644 drivers/usb/dev/Makefile
  create mode 100644 drivers/usb/dev/sandbox-flash.c
  create mode 100644 drivers/usb/dev/sandbox-hub.c
  create mode 100644 drivers/usb/dev/usb-emul-uclass.c
  create mode 100644 drivers/usb/host/usb-sandbox.c
  create mode 100644 drivers/usb/host/usb-uclass.c

 --
 2.2.0.rc0.207.ga3a616c

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



-- 
Best Regards
Vivek Gautam
Samsung RD Institute, Bangalore
India
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH RFC v2 0/6] usb: host: Add driver model support

2015-02-24 Thread Vivek Gautam
Hi Simon,


On Tue, Feb 24, 2015 at 10:17 PM, Simon Glass s...@chromium.org wrote:
 Hi Vivek,

 On 18 February 2015 at 06:30, Vivek Gautam gautamvivek1...@gmail.com wrote:
 Hi Simon,


 On Wed, Feb 18, 2015 at 6:45 PM, Simon Glass s...@chromium.org wrote:
 +mailing list

 On 18 February 2015 at 06:14, Simon Glass s...@chromium.org wrote:
 Hi Vivek,

 On 18 February 2015 at 03:40, Vivek Gautam gautam.vi...@samsung.com 
 wrote:
 Hi Marek, Simon,

 This patch-series comes as a update for an earlier posted series[1]
 [PATCH RFC 0/2] usb: host: Add a wrapper layer for mutiple host support
 which was posted long back.

 We had discussion to introduce the driver model instead of the approach 
 used
 in [1]. The driver model seems pretty straight-forward and easier to 
 implement
  besides giving a clean approach to use multiple host controller types, 
 viz.
 EHCI, XHCI or OHCI simultaneously on a platform which has such provision.

 It's rather bad on my side that it took so long to post the updated 
 version.
 Got busy with the projects. :-(

 So here's the RFC-v2 which implements the driver model approach.
 I have added support on OHCI, EHCI and XHCI and enabled EHCI and XHCI
  on Exynos5250 machines. Though not tested thoroughly, i can see EHCI
 and XHCI working together (enumerating the Root hubs).

 Let me know you comments on what you think of current approach.

 Great to see this - will take a look.
 Did you see my RFC on 30th Jan? E.g. this:

 sorry i did not check that patch earlier. Thanks for pointing out.


 https://patchwork.ozlabs.org/patch/434995/

 Will take a look at the series.

 Any thoughts on this please?

 I'd like to figure out what we should do next. I was hoping to get
 something in place in dm/next soon.

I had a cursory look at your patch-series, and it looks in a better shape than
mine.
While my approach seems very simple wherein the callbacks have just
been introduced in
the usb-uclass driver, i think your patches handle the things more efficiently.

I will be reviewing them completely today, and will test them also for
XHCI on snow board.

Sorry for keeping you waiting on this !!




 Regards,
 Simon


 Thanks
 Vivek

 [1] [PATCH RFC 0/2] usb: host: Add a wrapper layer for mutiple host 
 support
 http://lists.denx.de/pipermail/u-boot/2014-June/182559.html

 Vivek Gautam (6):
   usb: Rename usb_submit_int_msg() API to usb_int_msg()
   dm: usb: Make necessary changes in framework for driver model
   dm: usb-host: Add UCLASS driver for USB
   dm: usb-host: Add support for driver model in o/e/xhci.
   arm: exynos5: Enable EHCI and XHCI hcds through device tree.
   configs: smdk5250: Enable using XHCI and EHCI together

  arch/arm/dts/exynos5.dtsi   |8 +++
  common/usb.c|  101 
 ++---
  common/usb_hub.c|2 +-
  common/usb_kbd.c|4 +-
  common/usb_storage.c|2 +-
  drivers/usb/host/Kconfig|9 +++
  drivers/usb/host/Makefile   |3 +
  drivers/usb/host/ehci-hcd.c |   36 +---
  drivers/usb/host/ohci-hcd.c |   35 +---
  drivers/usb/host/usb-uclass.c   |  107 
 +++
  drivers/usb/host/xhci.c |   34 ---
  include/configs/exynos5-common.h|3 +
  include/configs/exynos5250-common.h |3 +
  include/configs/smdk5250.h  |2 +
  include/dm/uclass-id.h  |1 +
  include/usb.h   |   62 +++-
  16 files changed, 365 insertions(+), 47 deletions(-)
  create mode 100644 drivers/usb/host/usb-uclass.c

 --
 1.7.10.4

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



 --
 Best Regards
 Vivek Gautam
 Samsung RD Institute, Bangalore
 India

 REgards,
 Simon



-- 
Best Regards
Vivek Gautam
Samsung RD Institute, Bangalore
India
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH RFC 6/6] configs: smdk5250: Enable using XHCI and EHCI together

2015-02-18 Thread Vivek Gautam
With driver model now we can enable both EHCI and XHCI on
Exynos5250.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 include/configs/exynos5-common.h|3 +++
 include/configs/exynos5250-common.h |3 +++
 include/configs/smdk5250.h  |2 ++
 3 files changed, 8 insertions(+)

diff --git a/include/configs/exynos5-common.h b/include/configs/exynos5-common.h
index 0ba39a2..6f0e7f8 100644
--- a/include/configs/exynos5-common.h
+++ b/include/configs/exynos5-common.h
@@ -173,8 +173,11 @@
 
 #define CONFIG_CMD_GPIO
 
+#define CONFIG_DM
+
 /* USB */
 #define CONFIG_CMD_USB
+#define CONFIG_DM_USB
 #define CONFIG_USB_STORAGE
 #define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 3
 #define CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS 2
diff --git a/include/configs/exynos5250-common.h 
b/include/configs/exynos5250-common.h
index ae0e5ff..1843e25 100644
--- a/include/configs/exynos5250-common.h
+++ b/include/configs/exynos5250-common.h
@@ -41,6 +41,9 @@
 /* I2C */
 #define CONFIG_MAX_I2C_NUM 8
 
+/* USB */
+#define CONFIG_USB_MAX_CONTROLLER_COUNT2
+
 /* Display */
 #define CONFIG_LCD
 #ifdef CONFIG_LCD
diff --git a/include/configs/smdk5250.h b/include/configs/smdk5250.h
index 3b06d30..27ba454 100644
--- a/include/configs/smdk5250.h
+++ b/include/configs/smdk5250.h
@@ -24,6 +24,8 @@
 #define CONFIG_BOARD_COMMON
 #define CONFIG_ARCH_EARLY_INIT_R
 
+#define CONFIG_USB_EHCI
+#define CONFIG_USB_EHCI_EXYNOS
 #define CONFIG_USB_XHCI
 #define CONFIG_USB_XHCI_EXYNOS
 
-- 
1.7.10.4

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


[U-Boot] [PATCH RFC 5/6] arm: exynos5: Enable EHCI and XHCI hcds through device tree.

2015-02-18 Thread Vivek Gautam
Add devices for XHCI-HCD and EHCI-HCD in exynos5 family.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 arch/arm/dts/exynos5.dtsi |8 
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/dts/exynos5.dtsi b/arch/arm/dts/exynos5.dtsi
index 238acb8..5cdf406 100644
--- a/arch/arm/dts/exynos5.dtsi
+++ b/arch/arm/dts/exynos5.dtsi
@@ -157,6 +157,14 @@
};
};
 
+   ehcihcd {
+   compatible = ehci-hcd;
+   };
+
+   xhcihcd {
+   compatible = xhci-hcd;
+   };
+
tmu@1006 {
compatible = samsung,exynos-tmu;
reg = 0x1006 0x1;
-- 
1.7.10.4

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


[U-Boot] [PATCH RFC 1/6] usb: Rename usb_submit_int_msg() API to usb_int_msg()

2015-02-18 Thread Vivek Gautam
Until yet usb_**_msg() APIs don't contain the string 'submit'.
Rename it to make things uniform. This is also helping while
adding a host translational layer wherein we are using
usb_submit_**_msg string to name APIs.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 common/usb.c |4 ++--
 common/usb_kbd.c |4 ++--
 common/usb_storage.c |2 +-
 include/usb.h|2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/common/usb.c b/common/usb.c
index 32e15cd..849df27 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -162,10 +162,10 @@ int usb_disable_asynch(int disable)
 /*
  * submits an Interrupt Message
  */
-int usb_submit_int_msg(struct usb_device *dev, unsigned long pipe,
+int usb_int_msg(struct usb_device *dev, unsigned long pipe,
void *buffer, int transfer_len, int interval)
 {
-   return submit_int_msg(dev, pipe, buffer, transfer_len, interval);
+   return usb_submit_int_msg(dev, pipe, buffer, transfer_len, interval);
 }
 
 /*
diff --git a/common/usb_kbd.c b/common/usb_kbd.c
index ecc3085..d5d33a5 100644
--- a/common/usb_kbd.c
+++ b/common/usb_kbd.c
@@ -313,7 +313,7 @@ static inline void usb_kbd_poll_for_event(struct usb_device 
*dev)
struct usb_kbd_pdata *data = dev-privptr;
 
/* Submit a interrupt transfer request */
-   usb_submit_int_msg(dev, data-intpipe, data-new[0], data-intpktsize,
+   usb_int_msg(dev, data-intpipe, data-new[0], data-intpktsize,
   data-intinterval);
 
usb_kbd_irq_worker(dev);
@@ -458,7 +458,7 @@ static int usb_kbd_probe(struct usb_device *dev, unsigned 
int ifnum)
  data-intinterval);
if (!data-intq) {
 #else
-   if (usb_submit_int_msg(dev, data-intpipe, data-new, data-intpktsize,
+   if (usb_int_msg(dev, data-intpipe, data-new, data-intpktsize,
   data-intinterval)  0) {
 #endif
printf(Failed to get keyboard state from device %04x:%04x\n,
diff --git a/common/usb_storage.c b/common/usb_storage.c
index 1411737..7094eea 100644
--- a/common/usb_storage.c
+++ b/common/usb_storage.c
@@ -599,7 +599,7 @@ static int usb_stor_CBI_get_status(ccb *srb, struct us_data 
*us)
int timeout;
 
us-ip_wanted = 1;
-   submit_int_msg(us-pusb_dev, us-irqpipe,
+   usb_int_msg(us-pusb_dev, us-irqpipe,
(void *) us-ip_data, us-irqmaxp, us-irqinterval);
timeout = 1000;
while (timeout--) {
diff --git a/include/usb.h b/include/usb.h
index a8fee0b..d1576b2 100644
--- a/include/usb.h
+++ b/include/usb.h
@@ -252,7 +252,7 @@ int usb_control_msg(struct usb_device *dev, unsigned int 
pipe,
void *data, unsigned short size, int timeout);
 int usb_bulk_msg(struct usb_device *dev, unsigned int pipe,
void *data, int len, int *actual_length, int timeout);
-int usb_submit_int_msg(struct usb_device *dev, unsigned long pipe,
+int usb_int_msg(struct usb_device *dev, unsigned long pipe,
void *buffer, int transfer_len, int interval);
 int usb_disable_asynch(int disable);
 int usb_maxpacket(struct usb_device *dev, unsigned long pipe);
-- 
1.7.10.4

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


[U-Boot] [PATCH RFC 2/6] dm: usb: Make necessary changes in framework for driver model

2015-02-18 Thread Vivek Gautam
Add wrapper functions for usb layer operations for control, bulk,
interrupt transfers to accomodate support for driver model.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 common/usb.c   |   99 
 common/usb_hub.c   |2 +-
 include/dm/uclass-id.h |1 +
 include/usb.h  |   60 +++--
 4 files changed, 142 insertions(+), 20 deletions(-)

diff --git a/common/usb.c b/common/usb.c
index 849df27..407cc30 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -29,6 +29,7 @@
 #include common.h
 #include command.h
 #include asm/processor.h
+#include dm/uclass.h
 #include linux/compiler.h
 #include linux/ctype.h
 #include asm/byteorder.h
@@ -45,12 +46,83 @@ static struct usb_device usb_dev[USB_MAX_DEVICE];
 static int dev_index;
 static int asynch_allowed;
 
+static struct udevice *udev_usb;
+
 char usb_started; /* flag for the started/stopped USB status */
 
 #ifndef CONFIG_USB_MAX_CONTROLLER_COUNT
 #define CONFIG_USB_MAX_CONTROLLER_COUNT 1
 #endif
 
+#ifdef CONFIG_DM_USB
+/* Wrappers for Driver model */
+static inline int _usb_lowlevel_init(int index, enum usb_init_type init,
+   void **ctrl)
+{
+   return usb_lowlevel_init(index, USB_INIT_HOST, ctrl, udev_usb);
+}
+
+static inline int _usb_lowlevel_stop(int index)
+{
+   return usb_lowlevel_stop(index, udev_usb);
+}
+
+static inline int _usb_submit_control_msg(struct usb_device *dev,
+   unsigned long pipe, void *data,
+   int transfer_len, struct devrequest *setup)
+{
+   return usb_submit_control_msg(dev, pipe, data, transfer_len,
+ setup, dev-udev_usb);
+}
+
+static inline int _usb_submit_bulk_msg(struct usb_device *dev,
+   unsigned int pipe, void *data, int transfer_len)
+{
+   return usb_submit_bulk_msg(dev, pipe, data, transfer_len,
+  dev-udev_usb);
+}
+
+static inline int _usb_submit_int_msg(struct usb_device *dev,
+   unsigned long pipe, void *data,
+   int transfer_len, int interval)
+{
+   return usb_submit_int_msg(dev, pipe, data, transfer_len,
+ interval, dev-udev_usb);
+}
+#else
+static inline int _usb_lowlevel_init(int index, enum usb_init_type init,
+   void **ctrl)
+{
+   return usb_lowlevel_init(index, USB_INIT_HOST, ctrl);
+}
+
+static inline int _usb_lowlevel_stop(int index)
+{
+   return usb_lowlevel_stop(index);
+}
+
+static inline int _usb_submit_control_msg(struct usb_device *dev,
+   unsigned long pipe, void *data,
+   int transfer_len, struct devrequest *setup)
+{
+   return usb_submit_control_msg(dev, pipe, data, transfer_len, setup);
+}
+
+static inline int _usb_submit_bulk_msg(struct usb_device *dev,
+   unsigned int pipe, void *data, int transfer_len)
+{
+   return usb_submit_bulk_msg(dev, pipe, data, transfer_len);
+}
+
+static inline int _usb_submit_int_msg(struct usb_device *dev,
+   unsigned long pipe, void *data,
+   int transfer_len, int interval)
+{
+   return usb_submit_int_msg(dev, pipe, data, transfer_len, interval);
+}
+#endif
+
+
 /***
  * Init USB Device
  */
@@ -74,9 +146,20 @@ int usb_init(void)
 
/* init low_level USB */
for (i = 0; i  CONFIG_USB_MAX_CONTROLLER_COUNT; i++) {
+#ifdef CONFIG_DM_USB
+   /* Get the udevice here for given index */
+   uclass_get_device(UCLASS_USB, i, udev_usb);
+#else
+   udev_usb = -ERR_PTR(ENOSYS);
+#endif
+
+   /* Now this udev is a pointer to the particular controller
+* driver, which we can use now.
+*/
+
/* init low_level USB */
printf(USB%d:   , i);
-   ret = usb_lowlevel_init(i, USB_INIT_HOST, ctrl);
+   ret = _usb_lowlevel_init(i, USB_INIT_HOST, ctrl);
if (ret == -ENODEV) {   /* No such device. */
puts(Port not available.\n);
controllers_initialized++;
@@ -94,7 +177,7 @@ int usb_init(void)
controllers_initialized++;
start_index = dev_index;
printf(scanning bus %d for devices... , i);
-   dev = usb_alloc_new_device(ctrl);
+   dev = usb_alloc_new_device(ctrl, udev_usb);
/*
 * device 0 is always present
 * (root hub, so let it analyze)
@@ -132,7 +215,7 @@ int usb_stop(void)
usb_hub_reset();
 
for (i = 0; i

[U-Boot] [PATCH RFC 3/6] dm: usb-host: Add UCLASS driver for USB

2015-02-18 Thread Vivek Gautam
Adding a UCLASS driver for USB based on driver-model, to facilitate
binding mutiple host-controllers to their respective drivers, and
thereby enable using mutiple controllers simultaneously on a platform.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 drivers/usb/host/Kconfig  |9 
 drivers/usb/host/Makefile |3 ++
 drivers/usb/host/usb-uclass.c |  107 +
 3 files changed, 119 insertions(+)
 create mode 100644 drivers/usb/host/usb-uclass.c

diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig
index 30d1457..fceacbb 100644
--- a/drivers/usb/host/Kconfig
+++ b/drivers/usb/host/Kconfig
@@ -3,6 +3,15 @@
 #
 comment USB Host Controller Drivers
 
+config DM_USB
+   bool USB Driver model support
+   ---help---
+ Driver model support for USB host controller drivers.
+ This will allow use of mutiple kinds of host controllers viz. OHCI,
+ EHCI, XHCI, etc simultaneously which was not possible till now.
+ Say 'y' if you have mutiple types of controllers on your boards
+ and would like to enable support for all of them.
+
 config USB_XHCI_HCD
bool xHCI HCD (USB 3.0) support
---help---
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index 66d6e9a..d54e2a7 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -5,6 +5,9 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 
+# usb driver-model
+obj-$(CONFIG_DM_USB) += usb-uclass.o
+
 # ohci
 obj-$(CONFIG_USB_OHCI_NEW) += ohci-hcd.o
 obj-$(CONFIG_USB_ATMEL) += ohci-at91.o
diff --git a/drivers/usb/host/usb-uclass.c b/drivers/usb/host/usb-uclass.c
new file mode 100644
index 000..e7a97ec
--- /dev/null
+++ b/drivers/usb/host/usb-uclass.c
@@ -0,0 +1,107 @@
+/*
+ * Copyright (C) 2014 Samsung Electronics Co.Ltd
+ *
+ * Provides a smooth translation from usb_*() APIs from
+ * core usb drivers to controller drivers, enabling simultaneous
+ * use of different types of controller at once.
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+
+#include common.h
+#include dm.h
+#include errno.h
+#include linux/err.h
+#include asm/io.h
+#include usb.h
+//#include linux/list.h
+
+//DECLARE_GLOBAL_DATA_PTR;
+
+UCLASS_DRIVER(usb) = {
+   .name   = usb,
+   .id = UCLASS_USB,
+};
+
+int usb_lowlevel_init(int index, enum usb_init_type init,
+   void **controller, struct udevice *udev_usb)
+{
+   const struct usb_ops *ops;
+
+   if (IS_ERR(udev_usb))
+   return -EINVAL;
+
+   ops = device_get_ops(udev_usb);
+
+   if (!ops-lowlevel_init)
+   return -ENOSYS;
+
+   return ops-lowlevel_init(index, init, controller);
+}
+
+int usb_lowlevel_stop(int index, struct udevice *udev_usb)
+{
+   const struct usb_ops *ops;
+
+   if (IS_ERR(udev_usb))
+   return -EINVAL;
+
+   ops = device_get_ops(udev_usb);
+
+   if (!ops-lowlevel_stop)
+   return -ENOSYS;
+
+   return ops-lowlevel_stop(index);
+}
+
+int usb_submit_bulk_msg(struct usb_device *dev, unsigned long pipe,
+   void *buffer, int transfer_len,
+   struct udevice *udev_usb)
+{
+   const struct usb_ops *ops;
+
+   if (IS_ERR(udev_usb))
+   return -EINVAL;
+
+   ops = device_get_ops(udev_usb);
+
+   if (!ops-submit_bulk_msg)
+   return -ENOSYS;
+
+   return ops-submit_bulk_msg(dev, pipe, buffer, transfer_len);
+}
+
+int usb_submit_control_msg(struct usb_device *dev, unsigned long pipe,
+   void *buffer, int transfer_len,
+   struct devrequest *setup, struct udevice *udev_usb)
+{
+   const struct usb_ops *ops;
+
+   if (IS_ERR(udev_usb))
+   return -EINVAL;
+
+   ops = device_get_ops(udev_usb);
+
+   if (!ops-submit_ctrl_msg)
+   return -ENOSYS;
+
+   return ops-submit_ctrl_msg(dev,pipe, buffer, transfer_len, setup);
+}
+
+int usb_submit_int_msg(struct usb_device *dev, unsigned long pipe,
+   void *buffer, int transfer_len,
+   int interval, struct udevice *udev_usb)
+{
+   const struct usb_ops *ops;
+
+   if (IS_ERR(udev_usb))
+   return -EINVAL;
+
+   ops = device_get_ops(udev_usb);
+
+   if (!ops-submit_int_msg)
+   return -ENOSYS;
+
+   return ops-submit_int_msg(dev, pipe, buffer, transfer_len, interval);
+}
-- 
1.7.10.4

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


[U-Boot] [PATCH RFC 4/6] dm: usb-host: Add support for driver model in o/e/xhci.

2015-02-18 Thread Vivek Gautam
Adding support for driver model and necessary callbacks
in ohci/ehci/xhci.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 drivers/usb/host/ehci-hcd.c |   36 
 drivers/usb/host/ohci-hcd.c |   35 ---
 drivers/usb/host/xhci.c |   34 +++---
 3 files changed, 83 insertions(+), 22 deletions(-)

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index f1fb190..6320b98 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -930,13 +930,13 @@ unknown:
return -1;
 }
 
-int usb_lowlevel_stop(int index)
+int ehci_lowlevel_stop(int index)
 {
ehci_shutdown(ehcic[index]);
return ehci_hcd_stop(index);
 }
 
-int usb_lowlevel_init(int index, enum usb_init_type init, void **controller)
+int ehci_lowlevel_init(int index, enum usb_init_type init, void **controller)
 {
uint32_t reg;
uint32_t cmd;
@@ -1065,8 +1065,8 @@ done:
 }
 
 int
-submit_bulk_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
-   int length)
+ehci_submit_bulk_msg(struct usb_device *dev, unsigned long pipe,
+   void *buffer, int length)
 {
 
if (usb_pipetype(pipe) != PIPE_BULK) {
@@ -1077,8 +1077,8 @@ submit_bulk_msg(struct usb_device *dev, unsigned long 
pipe, void *buffer,
 }
 
 int
-submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
-  int length, struct devrequest *setup)
+ehci_submit_control_msg(struct usb_device *dev, unsigned long pipe,
+   void *buffer, int length, struct devrequest *setup)
 {
struct ehci_ctrl *ctrl = dev-controller;
 
@@ -1387,8 +1387,8 @@ out:
 }
 
 int
-submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
-  int length, int interval)
+ehci_submit_int_msg(struct usb_device *dev, unsigned long pipe,
+   void *buffer, int length, int interval)
 {
void *backbuffer;
struct int_queue *queue;
@@ -1423,3 +1423,23 @@ submit_int_msg(struct usb_device *dev, unsigned long 
pipe, void *buffer,
/* everything worked out fine */
return result;
 }
+
+static const struct udevice_id ehci_hcd_id[] = {
+   { ehci-hcd, 0 },
+   { },
+};
+
+static const struct usb_ops ehci_ops = {
+   .lowlevel_init   = ehci_lowlevel_init,
+   .lowlevel_stop   = ehci_lowlevel_stop,
+   .submit_ctrl_msg = ehci_submit_control_msg,
+   .submit_bulk_msg = ehci_submit_bulk_msg,
+   .submit_int_msg  = ehci_submit_int_msg,
+};
+
+U_BOOT_DRIVER(ehci_hcd_drv) = {
+   .name   = ehci_hcd_drv,
+   .of_match = ehci_hcd_id,
+   .id = UCLASS_USB,
+   .ops= ehci_ops,
+};
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c
index 97a7ede..3bfc295 100644
--- a/drivers/usb/host/ohci-hcd.c
+++ b/drivers/usb/host/ohci-hcd.c
@@ -1465,15 +1465,15 @@ int submit_common_msg(struct usb_device *dev, unsigned 
long pipe, void *buffer,
 }
 
 /* submit routines called from usb.c */
-int submit_bulk_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
-   int transfer_len)
+int ohci_submit_bulk_msg(struct usb_device *dev, unsigned long pipe,
+   void *buffer, int transfer_len)
 {
info(submit_bulk_msg);
return submit_common_msg(dev, pipe, buffer, transfer_len, NULL, 0);
 }
 
-int submit_control_msg(struct usb_device *dev, unsigned long pipe, void 
*buffer,
-   int transfer_len, struct devrequest *setup)
+int ohci_submit_control_msg(struct usb_device *dev, unsigned long pipe,
+   void *buffer, int transfer_len, struct devrequest *setup)
 {
int maxsize = usb_maxpacket(dev, pipe);
 
@@ -1499,7 +1499,7 @@ int submit_control_msg(struct usb_device *dev, unsigned 
long pipe, void *buffer,
return submit_common_msg(dev, pipe, buffer, transfer_len, setup, 0);
 }
 
-int submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
+int ohci_submit_int_msg(struct usb_device *dev, unsigned long pipe, void 
*buffer,
int transfer_len, int interval)
 {
info(submit_int_msg);
@@ -1748,7 +1748,8 @@ static void hc_release_ohci(ohci_t *ohci)
  */
 static char ohci_inited = 0;
 
-int usb_lowlevel_init(int index, enum usb_init_type init, void **controller)
+int ohci_lowlevel_init(int index, enum usb_init_type init,
+   void **controller)
 {
 #ifdef CONFIG_PCI_OHCI
pci_dev_t pdev;
@@ -1854,7 +1855,7 @@ int usb_lowlevel_init(int index, enum usb_init_type init, 
void **controller)
return 0;
 }
 
-int usb_lowlevel_stop(int index)
+int ohci_lowlevel_stop(int index)
 {
/* this gets called really early - before the controller has */
/* even been initialized! */
@@ -1880,3 +1881,23 @@ int usb_lowlevel_stop(int index)
ohci_inited = 0;
return 0;
 }
+
+static const struct udevice_id

[U-Boot] [PATCH RFC v2 0/6] usb: host: Add driver model support

2015-02-18 Thread Vivek Gautam
Hi Marek, Simon,

This patch-series comes as a update for an earlier posted series[1]
[PATCH RFC 0/2] usb: host: Add a wrapper layer for mutiple host support
which was posted long back.

We had discussion to introduce the driver model instead of the approach used
in [1]. The driver model seems pretty straight-forward and easier to implement
 besides giving a clean approach to use multiple host controller types, viz.
EHCI, XHCI or OHCI simultaneously on a platform which has such provision.

It's rather bad on my side that it took so long to post the updated version.
Got busy with the projects. :-(

So here's the RFC-v2 which implements the driver model approach.
I have added support on OHCI, EHCI and XHCI and enabled EHCI and XHCI
 on Exynos5250 machines. Though not tested thoroughly, i can see EHCI
and XHCI working together (enumerating the Root hubs).

Let me know you comments on what you think of current approach.

Thanks
Vivek

[1] [PATCH RFC 0/2] usb: host: Add a wrapper layer for mutiple host support
http://lists.denx.de/pipermail/u-boot/2014-June/182559.html

Vivek Gautam (6):
  usb: Rename usb_submit_int_msg() API to usb_int_msg()
  dm: usb: Make necessary changes in framework for driver model
  dm: usb-host: Add UCLASS driver for USB
  dm: usb-host: Add support for driver model in o/e/xhci.
  arm: exynos5: Enable EHCI and XHCI hcds through device tree.
  configs: smdk5250: Enable using XHCI and EHCI together

 arch/arm/dts/exynos5.dtsi   |8 +++
 common/usb.c|  101 ++---
 common/usb_hub.c|2 +-
 common/usb_kbd.c|4 +-
 common/usb_storage.c|2 +-
 drivers/usb/host/Kconfig|9 +++
 drivers/usb/host/Makefile   |3 +
 drivers/usb/host/ehci-hcd.c |   36 +---
 drivers/usb/host/ohci-hcd.c |   35 +---
 drivers/usb/host/usb-uclass.c   |  107 +++
 drivers/usb/host/xhci.c |   34 ---
 include/configs/exynos5-common.h|3 +
 include/configs/exynos5250-common.h |3 +
 include/configs/smdk5250.h  |2 +
 include/dm/uclass-id.h  |1 +
 include/usb.h   |   62 +++-
 16 files changed, 365 insertions(+), 47 deletions(-)
 create mode 100644 drivers/usb/host/usb-uclass.c

-- 
1.7.10.4

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


Re: [U-Boot] [PATCH RFC v2 0/6] usb: host: Add driver model support

2015-02-18 Thread Vivek Gautam
Hi Simon,


On Wed, Feb 18, 2015 at 6:45 PM, Simon Glass s...@chromium.org wrote:
 +mailing list

 On 18 February 2015 at 06:14, Simon Glass s...@chromium.org wrote:
 Hi Vivek,

 On 18 February 2015 at 03:40, Vivek Gautam gautam.vi...@samsung.com wrote:
 Hi Marek, Simon,

 This patch-series comes as a update for an earlier posted series[1]
 [PATCH RFC 0/2] usb: host: Add a wrapper layer for mutiple host support
 which was posted long back.

 We had discussion to introduce the driver model instead of the approach used
 in [1]. The driver model seems pretty straight-forward and easier to 
 implement
  besides giving a clean approach to use multiple host controller types, viz.
 EHCI, XHCI or OHCI simultaneously on a platform which has such provision.

 It's rather bad on my side that it took so long to post the updated version.
 Got busy with the projects. :-(

 So here's the RFC-v2 which implements the driver model approach.
 I have added support on OHCI, EHCI and XHCI and enabled EHCI and XHCI
  on Exynos5250 machines. Though not tested thoroughly, i can see EHCI
 and XHCI working together (enumerating the Root hubs).

 Let me know you comments on what you think of current approach.

 Great to see this - will take a look.
 Did you see my RFC on 30th Jan? E.g. this:

sorry i did not check that patch earlier. Thanks for pointing out.


 https://patchwork.ozlabs.org/patch/434995/

Will take a look at the series.


 Regards,
 Simon


 Thanks
 Vivek

 [1] [PATCH RFC 0/2] usb: host: Add a wrapper layer for mutiple host support
 http://lists.denx.de/pipermail/u-boot/2014-June/182559.html

 Vivek Gautam (6):
   usb: Rename usb_submit_int_msg() API to usb_int_msg()
   dm: usb: Make necessary changes in framework for driver model
   dm: usb-host: Add UCLASS driver for USB
   dm: usb-host: Add support for driver model in o/e/xhci.
   arm: exynos5: Enable EHCI and XHCI hcds through device tree.
   configs: smdk5250: Enable using XHCI and EHCI together

  arch/arm/dts/exynos5.dtsi   |8 +++
  common/usb.c|  101 
 ++---
  common/usb_hub.c|2 +-
  common/usb_kbd.c|4 +-
  common/usb_storage.c|2 +-
  drivers/usb/host/Kconfig|9 +++
  drivers/usb/host/Makefile   |3 +
  drivers/usb/host/ehci-hcd.c |   36 +---
  drivers/usb/host/ohci-hcd.c |   35 +---
  drivers/usb/host/usb-uclass.c   |  107 
 +++
  drivers/usb/host/xhci.c |   34 ---
  include/configs/exynos5-common.h|3 +
  include/configs/exynos5250-common.h |3 +
  include/configs/smdk5250.h  |2 +
  include/dm/uclass-id.h  |1 +
  include/usb.h   |   62 +++-
  16 files changed, 365 insertions(+), 47 deletions(-)
  create mode 100644 drivers/usb/host/usb-uclass.c

 --
 1.7.10.4

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



-- 
Best Regards
Vivek Gautam
Samsung RD Institute, Bangalore
India
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH RFC 0/2] usb: host: Add a wrapper layer for mutiple host support

2014-06-25 Thread Vivek Gautam
On Thu, Jun 26, 2014 at 8:00 AM, Simon Glass s...@chromium.org wrote:
 Hi Marek,

 On 25 June 2014 02:33, Marek Vasut ma...@denx.de wrote:
 On Wednesday, June 25, 2014 at 08:27:39 AM, Simon Glass wrote:
 [...]
model. Instead, I'd love to see a mean to instantiate each *HCI
controller and have a USB core which would track those instances. The
USB core would then be able to call whatever generic ops on those
instances as needed. Does that make sense please ?
  
   True, i understand your point here. I think the second approach i was
   talking of, goes in this direction.
   I think i could not put it well in words there.
  
   I will prepare an RFC patch for that, and post it as soon as its
   ready, so that you can have
   a look.
 
  Ah, this would be so very appreciated! Thank you!

 Should we consider just going straight for driver model?

 I was thinking about that, but I'm worried it might break USB support on some
 platforms. Also, the size of U-Boot will grow on many platforms, right?

 What do you think ?

 If you add CONFIG_DM_USB as an option, you can then pull in either
 usb-uclass.c or the old usb code. Since USB is often tied to a board
 then you can move just that board (or group of boards) to dm.

 I am keeping a working tree in u-boot-dm.git which does this for
 serial, SPI, SPI flash and GPIO. It seems to work fairly well as a
 technique for keeping both things in the tree in the interim..

 As to the size increase, yes it will increase the size, but not that
 much, and after all, aren't we trying to move the code to dm?

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



-- 
Best Regards
Vivek Gautam
Samsung RD Institute, Bangalore
India
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH RFC 0/2] usb: host: Add a wrapper layer for mutiple host support

2014-06-25 Thread Vivek Gautam
Hi Simon, Marek,


On Thu, Jun 26, 2014 at 10:04 AM, Vivek Gautam gautam.vi...@samsung.com wrote:

sorry for spamming, the earlier message got sent by mistake.

 On Thu, Jun 26, 2014 at 8:00 AM, Simon Glass s...@chromium.org wrote:
 Hi Marek,

 On 25 June 2014 02:33, Marek Vasut ma...@denx.de wrote:
 On Wednesday, June 25, 2014 at 08:27:39 AM, Simon Glass wrote:
 [...]
model. Instead, I'd love to see a mean to instantiate each *HCI
controller and have a USB core which would track those instances. The
USB core would then be able to call whatever generic ops on those
instances as needed. Does that make sense please ?
  
   True, i understand your point here. I think the second approach i was
   talking of, goes in this direction.
   I think i could not put it well in words there.
  
   I will prepare an RFC patch for that, and post it as soon as its
   ready, so that you can have
   a look.
 
  Ah, this would be so very appreciated! Thank you!

 Should we consider just going straight for driver model?

 I was thinking about that, but I'm worried it might break USB support on 
 some
 platforms. Also, the size of U-Boot will grow on many platforms, right?

 What do you think ?

 If you add CONFIG_DM_USB as an option, you can then pull in either
 usb-uclass.c or the old usb code. Since USB is often tied to a board
 then you can move just that board (or group of boards) to dm.

 I am keeping a working tree in u-boot-dm.git which does this for
 serial, SPI, SPI flash and GPIO. It seems to work fairly well as a
 technique for keeping both things in the tree in the interim..

Ok, so i am having a look at the u-boot-dm tree, and also going through the
documentation for driver-model.
The driver-model looks a promising choice at the moment keeping in mind
that later we would need to move to it anyways.

I will try understanding the things and raise a flag in case something
is not clear.


 As to the size increase, yes it will increase the size, but not that
 much, and after all, aren't we trying to move the code to dm?




-- 
Best Regards
Vivek Gautam
Samsung RD Institute, Bangalore
India
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH RFC 0/2] usb: host: Add a wrapper layer for mutiple host support

2014-06-24 Thread Vivek Gautam
Hi Marek,

It's been very long since we had discussion for introducing the wrapper layer
to enable using multiple usb controller types.
Its been unfortunate that i had been busy with other tasks, and couldn't
look into this.
Now that i got sometime, i have prepared a simple RFC patch which right now
supports APIs translation for submit_control_msg(), submit_bulk_msg(),
submit_int_msg(), and usb_lowlevel_init() as well as usb_lowlevel_stop().
This was the simplest approach that could differentiate between controller
types.

I had thought of another approach too, wherein there's a 'list' passed by the
usb core layer, which would be filled with 'host_controller_drv' structure, that
would contain information about the driver. And then each host controller driver
will register certain callbacks that can be called from the upper layers.
If you say i will send an RFC for this approach.

Let me know you comments on what you think of current approach.

Thanks
Vivek

Vivek Gautam (2):
  usb: Rename usb_submit_int_msg() API to usb_int_msg()
  RFC: usb: host: Introduce host translational layer

 common/usb.c  |   12 +++--
 common/usb_kbd.c  |6 +--
 common/usb_storage.c  |2 +-
 drivers/usb/host/Makefile |2 +
 drivers/usb/host/ehci-hcd.c   |   15 +++---
 drivers/usb/host/host_trans.c |  102 +
 drivers/usb/host/host_trans.h |   42 +
 drivers/usb/host/xhci.c   |   11 +++--
 include/usb.h |   17 ---
 9 files changed, 181 insertions(+), 28 deletions(-)
 create mode 100644 drivers/usb/host/host_trans.c
 create mode 100644 drivers/usb/host/host_trans.h

-- 
1.7.10.4

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


[U-Boot] [PATCH 1/2] usb: Rename usb_submit_int_msg() API to usb_int_msg()

2014-06-24 Thread Vivek Gautam
Until yet usb_**_msg() APIs don't contain the string 'submit'.
Rename it to make things uniform. This is also helping while
adding a host translational layer wherein we are using
usb_submit_**_msg string to name APIs.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 common/usb.c |4 ++--
 common/usb_kbd.c |6 +++---
 common/usb_storage.c |2 +-
 include/usb.h|2 +-
 4 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/common/usb.c b/common/usb.c
index 60daa10..5dd09aa 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -155,10 +155,10 @@ int usb_disable_asynch(int disable)
 /*
  * submits an Interrupt Message
  */
-int usb_submit_int_msg(struct usb_device *dev, unsigned long pipe,
+int usb_int_msg(struct usb_device *dev, unsigned long pipe,
void *buffer, int transfer_len, int interval)
 {
-   return submit_int_msg(dev, pipe, buffer, transfer_len, interval);
+   return usb_submit_int_msg(dev, pipe, buffer, transfer_len, interval);
 }
 
 /*
diff --git a/common/usb_kbd.c b/common/usb_kbd.c
index 0b77c16..d9802b0 100644
--- a/common/usb_kbd.c
+++ b/common/usb_kbd.c
@@ -136,7 +136,7 @@ void usb_kbd_generic_poll(void)
 
/* Submit a interrupt transfer request */
maxp = usb_maxpacket(usb_kbd_dev, pipe);
-   usb_submit_int_msg(usb_kbd_dev, pipe, data-new,
+   usb_int_msg(usb_kbd_dev, pipe, data-new,
min(maxp, USB_KBD_BOOT_REPORT_SIZE),
ep-bInterval);
 }
@@ -343,7 +343,7 @@ static inline void usb_kbd_poll_for_event(struct usb_device 
*dev)
 
/* Submit a interrupt transfer request */
maxp = usb_maxpacket(dev, pipe);
-   usb_submit_int_msg(dev, pipe, data-new[0],
+   usb_int_msg(dev, pipe, data-new[0],
min(maxp, USB_KBD_BOOT_REPORT_SIZE),
ep-bInterval);
 
@@ -472,7 +472,7 @@ static int usb_kbd_probe(struct usb_device *dev, unsigned 
int ifnum)
usb_set_idle(dev, iface-desc.bInterfaceNumber, REPEAT_RATE, 0);
 
debug(USB KBD: enable interrupt pipe...\n);
-   if (usb_submit_int_msg(dev, pipe, data-new,
+   if (usb_int_msg(dev, pipe, data-new,
   min(maxp, USB_KBD_BOOT_REPORT_SIZE),
   ep-bInterval)  0) {
printf(Failed to get keyboard state from device %04x:%04x\n,
diff --git a/common/usb_storage.c b/common/usb_storage.c
index 6ac358d..91a8a86 100644
--- a/common/usb_storage.c
+++ b/common/usb_storage.c
@@ -598,7 +598,7 @@ static int usb_stor_CBI_get_status(ccb *srb, struct us_data 
*us)
int timeout;
 
us-ip_wanted = 1;
-   submit_int_msg(us-pusb_dev, us-irqpipe,
+   usb_submit_int_msg(us-pusb_dev, us-irqpipe,
(void *) us-ip_data, us-irqmaxp, us-irqinterval);
timeout = 1000;
while (timeout--) {
diff --git a/include/usb.h b/include/usb.h
index d9fedee..30fc890 100644
--- a/include/usb.h
+++ b/include/usb.h
@@ -234,7 +234,7 @@ int usb_control_msg(struct usb_device *dev, unsigned int 
pipe,
void *data, unsigned short size, int timeout);
 int usb_bulk_msg(struct usb_device *dev, unsigned int pipe,
void *data, int len, int *actual_length, int timeout);
-int usb_submit_int_msg(struct usb_device *dev, unsigned long pipe,
+int usb_int_msg(struct usb_device *dev, unsigned long pipe,
void *buffer, int transfer_len, int interval);
 int usb_disable_asynch(int disable);
 int usb_maxpacket(struct usb_device *dev, unsigned long pipe);
-- 
1.7.10.4

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


[U-Boot] [PATCH 2/2] RFC: usb: host: Introduce host translational layer

2014-06-24 Thread Vivek Gautam
Introduce a wrapper layer to translate submit_**_msg() APIs
as well as usb_lowlevel_**() APIs so as to enable using
mutiple controller types viz. OHCI/EHCI/XHCI.

This is still WIP, with support for APIs translation for
EHCI and XHCI only.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 common/usb.c  |8 ++--
 drivers/usb/host/Makefile |2 +
 drivers/usb/host/ehci-hcd.c   |   15 +++---
 drivers/usb/host/host_trans.c |  102 +
 drivers/usb/host/host_trans.h |   42 +
 drivers/usb/host/xhci.c   |   11 +++--
 include/usb.h |   15 +++---
 7 files changed, 174 insertions(+), 21 deletions(-)
 create mode 100644 drivers/usb/host/host_trans.c
 create mode 100644 drivers/usb/host/host_trans.h

diff --git a/common/usb.c b/common/usb.c
index 5dd09aa..ae483d0 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -58,6 +58,7 @@ char usb_started; /* flag for the started/stopped USB status 
*/
 int usb_init(void)
 {
void *ctrl;
+   int ctrl_type;
struct usb_device *dev;
int i, start_index = 0;
 
@@ -75,7 +76,7 @@ int usb_init(void)
for (i = 0; i  CONFIG_USB_MAX_CONTROLLER_COUNT; i++) {
/* init low_level USB */
printf(USB%d:   , i);
-   if (usb_lowlevel_init(i, USB_INIT_HOST, ctrl)) {
+   if (usb_lowlevel_init(i, USB_INIT_HOST, ctrl, ctrl_type)) {
puts(lowlevel init failed\n);
continue;
}
@@ -86,6 +87,7 @@ int usb_init(void)
start_index = dev_index;
printf(scanning bus %d for devices... , i);
dev = usb_alloc_new_device(ctrl);
+   dev-ctrl_type = ctrl_type;
/*
 * device 0 is always present
 * (root hub, so let it analyze)
@@ -193,7 +195,7 @@ int usb_control_msg(struct usb_device *dev, unsigned int 
pipe,
  request, requesttype, value, index, size);
dev-status = USB_ST_NOT_PROC; /*not yet processed */
 
-   if (submit_control_msg(dev, pipe, data, size, setup_packet)  0)
+   if (usb_submit_control_msg(dev, pipe, data, size, setup_packet)  0)
return -1;
if (timeout == 0)
return (int)size;
@@ -226,7 +228,7 @@ int usb_bulk_msg(struct usb_device *dev, unsigned int pipe,
if (len  0)
return -1;
dev-status = USB_ST_NOT_PROC; /*not yet processed */
-   if (submit_bulk_msg(dev, pipe, data, len)  0)
+   if (usb_submit_bulk_msg(dev, pipe, data, len)  0)
return -1;
while (timeout--) {
if (!((volatile unsigned long)dev-status  USB_ST_NOT_PROC))
diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index 7211c6a..9c6eb84 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -43,3 +43,5 @@ obj-$(CONFIG_USB_EHCI_ZYNQ) += ehci-zynq.o
 obj-$(CONFIG_USB_XHCI) += xhci.o xhci-mem.o xhci-ring.o
 obj-$(CONFIG_USB_XHCI_EXYNOS) += xhci-exynos5.o
 obj-$(CONFIG_USB_XHCI_OMAP) += xhci-omap.o
+
+obj-$(CONFIG_USB_HOST_TRANS) += host_trans.o
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index eaf5913..460c509 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -31,6 +31,7 @@
 #include linux/compiler.h
 
 #include ehci.h
+#include host_trans.h
 
 #ifndef CONFIG_USB_MAX_CONTROLLER_COUNT
 #define CONFIG_USB_MAX_CONTROLLER_COUNT 1
@@ -917,13 +918,13 @@ unknown:
return -1;
 }
 
-int usb_lowlevel_stop(int index)
+int ehci_lowlevel_stop(int index)
 {
ehci_shutdown(ehcic[index]);
return ehci_hcd_stop(index);
 }
 
-int usb_lowlevel_init(int index, enum usb_init_type init, void **controller)
+int ehci_lowlevel_init(int index, enum usb_init_type init, void **controller)
 {
uint32_t reg;
uint32_t cmd;
@@ -1052,8 +1053,8 @@ done:
 }
 
 int
-submit_bulk_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
-   int length)
+ehci_submit_bulk_msg(struct usb_device *dev, unsigned long pipe,
+   void *buffer, int length)
 {
 
if (usb_pipetype(pipe) != PIPE_BULK) {
@@ -1064,8 +1065,8 @@ submit_bulk_msg(struct usb_device *dev, unsigned long 
pipe, void *buffer,
 }
 
 int
-submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
-  int length, struct devrequest *setup)
+ehci_submit_control_msg(struct usb_device *dev, unsigned long pipe,
+   void *buffer, int length, struct devrequest *setup)
 {
struct ehci_ctrl *ctrl = dev-controller;
 
@@ -1348,7 +1349,7 @@ out:
 }
 
 int
-submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
+ehci_submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
   int length, int interval)
 {
void *backbuffer;
diff --git a/drivers/usb/host/host_trans.c b

Re: [U-Boot] [PATCH RFC 0/2] usb: host: Add a wrapper layer for mutiple host support

2014-06-24 Thread Vivek Gautam
Hi Marek,


On Tue, Jun 24, 2014 at 7:56 PM, Marek Vasut ma...@denx.de wrote:
 On Tuesday, June 24, 2014 at 04:10:20 PM, Vivek Gautam wrote:
 Hi Marek,

 It's been very long since we had discussion for introducing the wrapper
 layer to enable using multiple usb controller types.
 Its been unfortunate that i had been busy with other tasks, and couldn't
 look into this.
 Now that i got sometime, i have prepared a simple RFC patch which right now
 supports APIs translation for submit_control_msg(), submit_bulk_msg(),
 submit_int_msg(), and usb_lowlevel_init() as well as usb_lowlevel_stop().
 This was the simplest approach that could differentiate between controller
 types.

 I had thought of another approach too, wherein there's a 'list' passed by
 the usb core layer, which would be filled with 'host_controller_drv'
 structure, that would contain information about the driver. And then each
 host controller driver will register certain callbacks that can be called
 from the upper layers. If you say i will send an RFC for this approach.

 I think this approach in this patchset will not play well with the driver 
 model.
 Instead, I'd love to see a mean to instantiate each *HCI controller and have a
 USB core which would track those instances. The USB core would then be able to
 call whatever generic ops on those instances as needed. Does that make sense
 please ?

True, i understand your point here. I think the second approach i was
talking of, goes in this direction.
I think i could not put it well in words there.

I will prepare an RFC patch for that, and post it as soon as its
ready, so that you can have
a look.


-- 
Best Regards
Vivek Gautam
Samsung RD Institute, Bangalore
India
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 8/8] config: smdk5420: Enable support for multiple XHCI controllers

2014-01-07 Thread Vivek Gautam
HI Marek,


On Mon, Jan 6, 2014 at 9:24 PM, Marek Vasut ma...@denx.de wrote:

Thanks for reviewing this. :-)

 On Monday, January 06, 2014 at 10:29:43 AM, Vivek Gautam wrote:
 Update USB_MAX_CONTROLLER_COUNT to be '2' to enable support
 for both usb 3.0 controllers on exynos5420.

 NOTE: To use EHCI on exynos5420, this change will need to be
 reverted, since there's only one EHCI controller available on
 exynos5420.

 OK, this I seriously dislike. Hence a question ... my feeling is the XHCI and
 EHCI code for handling multiple controllers and multiple ports is almost the
 same. Can this code be adjusted to handle both EHCI and XHCI controllers
 indiscriminately ?

The controller count is actually used by the usb core (common/usb*)
framework, right ?
There's a need to add support for multiple controller types actually
(so that EHCI
and XHCI can be enabled simultaneously). Is that what you mean here ?


 This would result in having CONFIG_USB_MAX_CONTROLLER_COUNT 3 on this board 
 and
 being able to use both EHCI and XHCI . Would this be possible for you to
 implement please ? Thanks !

Ok, so you mean get all the controllers present on the board (EHCI and
XHCI) setup.
I think right now, the way USB core handles the controller count is
quite different, so
that 'CONFIG_USB_MAX_CONTROLLER_COUNT' helps in probing multiple controllers
of the same type.
I had plans to add support to use controllers of different types (EHCI
and XHCI etc) simultaneously.
But haven't really put a code for that yet.
Can you suggest some pointers about how would you like to see EHCI and
XHCI or even OHCI work
together :-)
I can take up this.


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



-- 
Best Regards
Vivek Gautam
Samsung RD Institute, Bangalore
India
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 7/8] smdk5420: Correct the vbus gpio configuration for USB controller

2014-01-07 Thread Vivek Gautam
On Tue, Jan 7, 2014 at 1:19 PM, Marek Vasut ma...@denx.de wrote:
 On Tuesday, January 07, 2014 at 07:37:46 AM, Vivek Gautam wrote:
 Hi Marek,

 On Mon, Jan 6, 2014 at 9:22 PM, Marek Vasut ma...@denx.de wrote:
  On Monday, January 06, 2014 at 10:29:42 AM, Vivek Gautam wrote:
  On smdk5420 two availbale XHCI controllers require VBUS GPIO
  to be configured, the EHCI however doesn't have any such VBUS
  GPIO. So correcting the available board_usb_vbus_init() function
  to the needs.
 
  Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
  ---
 
   board/samsung/smdk5420/smdk5420.c |   11 ++-
   1 file changed, 6 insertions(+), 5 deletions(-)
 
  diff --git a/board/samsung/smdk5420/smdk5420.c
  b/board/samsung/smdk5420/smdk5420.c index 3ad2ad0..4f23000 100644
  --- a/board/samsung/smdk5420/smdk5420.c
  +++ b/board/samsung/smdk5420/smdk5420.c
  @@ -18,14 +18,15 @@
 
   DECLARE_GLOBAL_DATA_PTR;
 
  -#ifdef CONFIG_USB_EHCI_EXYNOS
  +#ifdef CONFIG_USB_XHCI_EXYNOS
 
   static int board_usb_vbus_init(void)
   {
 
  - struct exynos5_gpio_part1 *gpio1 = (struct exynos5_gpio_part1 *)
  -
  samsung_get_base_gpio_part1(); + struct exynos5420_gpio_part4
  *gpio4 = (struct exynos5420_gpio_part4 *) +
  samsung_get_base_gpio_part4();
 
/* Enable VBUS power switch */
 
  - s5p_gpio_direction_output(gpio1-x2, 6, 1);
  + s5p_gpio_direction_output(gpio4-g0, 5, 1);
  + s5p_gpio_direction_output(gpio4-g1, 4, 1);
 
  This VBUS toggling should happen on per-port basis, right ?

 No this VBUS gpio toggling is actually enabling the VBUS line of the
 controller. And since we have 2 controllers on exynos5420, so added the
 required 2 gpios for the purpose
 (GPG0[5], and GPG1[4]).

 So if I understand this correctly, it should happen on per-controller basis
 then?

True, i thought of putting this in DT actually, similar to what we do
for exynos5250 as also available in the patch :
[PATCH 1/2] exynos5250: usb: Fix VBus gpio numbers for ehci and xhci
controllers  (http://patchwork.ozlabs.org/patch/306553/)

But then the mathematics involved in gpio_direction_output() api
doesn't yield me the correct gpio pin (which actually gave in case of
Exynos5250).
So i thought of putting it in the board file only. I should have put
proper comment here although :-(


 Best regards,
 Marek Vasut



-- 
Best Regards
Vivek Gautam
Samsung RD Institute, Bangalore
India
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 5/8] usb: xhci-exynos5: Add support for multiple USB 3.0 controllers

2014-01-07 Thread Vivek Gautam
Hi Minkyu Kang,


On Tue, Jan 7, 2014 at 11:00 AM, Minkyu Kang mk7.k...@samsung.com wrote:
 Dear Vivek Gautam,

 On 06/01/14 18:29, Vivek Gautam wrote:
 Add required support to use multiple USB 3.0 controllers available
 on exynos5420 SoC.

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 ---
  arch/arm/cpu/armv7/exynos/power.c|   18 --
  arch/arm/include/asm/arch-exynos/cpu.h   |   10 
  arch/arm/include/asm/arch-exynos/power.h |2 +-
  drivers/usb/host/xhci-exynos5.c  |   91 
 +-
  drivers/usb/host/xhci.c  |4 --
  drivers/usb/host/xhci.h  |4 ++
  6 files changed, 91 insertions(+), 38 deletions(-)

 diff --git a/arch/arm/cpu/armv7/exynos/power.c 
 b/arch/arm/cpu/armv7/exynos/power.c
 index 563abd7..0f8aa98 100644
 --- a/arch/arm/cpu/armv7/exynos/power.c
 +++ b/arch/arm/cpu/armv7/exynos/power.c
 @@ -59,26 +59,34 @@ void set_usbhost_phy_ctrl(unsigned int enable)
   exynos5_set_usbhost_phy_ctrl(enable);
  }

 -static void exynos5_set_usbdrd_phy_ctrl(unsigned int enable)
 +static void exynos5_set_usbdrd_phy_ctrl(unsigned int enable, int dev_index)
  {
   struct exynos5_power *power =
   (struct exynos5_power *)samsung_get_base_power();

 + /*
 +  * Assuming here that the DRD_PHY_CONTROL registers
 +  * are contiguous, so that :
 +  * addressof(DRD_PHY1_CONTROL) = addressof(DRD_PHY_CONTROL) + 0x4;
 +  * which is the case with exynos5420.
 +  * For exynos5250 this should work out of box, since dev_index will
 +  * always be '0' in that case
 +  */
   if (enable) {
   /* Enabling USBDRD_PHY */
 - setbits_le32(power-usbdrd_phy_control,
 + setbits_le32(power-usbdrd_phy_control + dev_index,
   POWER_USB_DRD_PHY_CTRL_EN);
   } else {
   /* Disabling USBDRD_PHY */
 - clrbits_le32(power-usbdrd_phy_control,
 + clrbits_le32(power-usbdrd_phy_control + dev_index,
   POWER_USB_DRD_PHY_CTRL_EN);
   }
  }

 -void set_usbdrd_phy_ctrl(unsigned int enable)
 +void set_usbdrd_phy_ctrl(unsigned int enable, int dev_index)
  {
   if (cpu_is_exynos5())
 - exynos5_set_usbdrd_phy_ctrl(enable);
 + exynos5_set_usbdrd_phy_ctrl(enable, dev_index);
  }

  static void exynos5_dp_phy_control(unsigned int enable)
 diff --git a/arch/arm/include/asm/arch-exynos/cpu.h 
 b/arch/arm/include/asm/arch-exynos/cpu.h
 index 718940b..d93cba9 100644
 --- a/arch/arm/include/asm/arch-exynos/cpu.h
 +++ b/arch/arm/include/asm/arch-exynos/cpu.h
 @@ -54,6 +54,8 @@
  #define EXYNOS4_USB_HOST_XHCI_BASE   DEVICE_NOT_AVAILABLE
  #define EXYNOS4_USB3PHY_BASE DEVICE_NOT_AVAILABLE
  #define EXYNOS4_DMC_TZASC_BASE   DEVICE_NOT_AVAILABLE
 +#define EXYNOS4_USB_HOST_XHCI_1_BASE DEVICE_NOT_AVAILABLE
 +#define EXYNOS4_USB3PHY_1_BASE   DEVICE_NOT_AVAILABLE

  /* EXYNOS4X12 */
  #define EXYNOS4X12_GPIO_PART3_BASE   0x0386
 @@ -93,6 +95,8 @@
  #define EXYNOS4X12_USB_HOST_XHCI_BASEDEVICE_NOT_AVAILABLE
  #define EXYNOS4X12_USB3PHY_BASE  DEVICE_NOT_AVAILABLE
  #define EXYNOS4X12_DMC_TZASC_BASEDEVICE_NOT_AVAILABLE
 +#define EXYNOS4X12_USB_HOST_XHCI_1_BASE  DEVICE_NOT_AVAILABLE
 +#define EXYNOS4X12_USB3PHY_1_BASEDEVICE_NOT_AVAILABLE

  /* EXYNOS5 */
  #define EXYNOS5_I2C_SPACING  0x1
 @@ -132,6 +136,8 @@
  #define EXYNOS5_ADC_BASE DEVICE_NOT_AVAILABLE
  #define EXYNOS5_MODEM_BASE   DEVICE_NOT_AVAILABLE
  #define EXYNOS5_DMC_TZASC_BASE   DEVICE_NOT_AVAILABLE
 +#define EXYNOS5_USB_HOST_XHCI_1_BASE DEVICE_NOT_AVAILABLE
 +#define EXYNOS5_USB3PHY_1_BASE   DEVICE_NOT_AVAILABLE

  /* EXYNOS5420 */
  #define EXYNOS5420_AUDIOSS_BASE  0x0381
 @@ -153,6 +159,8 @@
  #define EXYNOS5420_USBPHY_BASE   0x1213
  #define EXYNOS5420_MMC_BASE  0x1220
  #define EXYNOS5420_SROMC_BASE0x1225
 +#define EXYNOS5420_USB_HOST_XHCI_1_BASE  0x1240
 +#define EXYNOS5420_USB3PHY_1_BASE0x1250

 No. we don't have to add phy_1 and xhci_1.
 It looks weird.
 please access phy1 and xhci1 by offset.

Ok, so you mean i should add offsets definitions for phy1 and xhci1
may be in the driver file or in
arch/arm/include/asm/arch-exynos/xhci-exynos.h file, and add these
offsets to xhci_base and
phy_base addresses ?
That should be fine, i will modify this accordingly.


  #define EXYNOS5420_UART_BASE 0x12C0
  #define EXYNOS5420_I2C_BASE  0x12C6
  #define EXYNOS5420_I2C_8910_BASE 0x12E0
 @@ -276,8 +284,10 @@ SAMSUNG_BASE(timer, PWMTIMER_BASE)
  SAMSUNG_BASE(uart, UART_BASE)
  SAMSUNG_BASE(usb_phy, USBPHY_BASE)
  SAMSUNG_BASE(usb3_phy, USB3PHY_BASE)
 +SAMSUNG_BASE(usb3_phy_1, USB3PHY_1_BASE)
  SAMSUNG_BASE(usb_ehci, USB_HOST_EHCI_BASE)
  SAMSUNG_BASE(usb_xhci

Re: [U-Boot] [PATCH 8/8] config: smdk5420: Enable support for multiple XHCI controllers

2014-01-07 Thread Vivek Gautam
On Tue, Jan 7, 2014 at 2:44 PM, Marek Vasut ma...@denx.de wrote:
 On Tuesday, January 07, 2014 at 09:55:37 AM, Vivek Gautam wrote:
 HI Marek,


 On Mon, Jan 6, 2014 at 9:24 PM, Marek Vasut ma...@denx.de wrote:

 Thanks for reviewing this. :-)

  On Monday, January 06, 2014 at 10:29:43 AM, Vivek Gautam wrote:
  Update USB_MAX_CONTROLLER_COUNT to be '2' to enable support
  for both usb 3.0 controllers on exynos5420.
 
  NOTE: To use EHCI on exynos5420, this change will need to be
  reverted, since there's only one EHCI controller available on
  exynos5420.
 
  OK, this I seriously dislike. Hence a question ... my feeling is the XHCI
  and EHCI code for handling multiple controllers and multiple ports is
  almost the same. Can this code be adjusted to handle both EHCI and XHCI
  controllers indiscriminately ?

 The controller count is actually used by the usb core (common/usb*)
 framework, right ?
 There's a need to add support for multiple controller types actually
 (so that EHCI
 and XHCI can be enabled simultaneously). Is that what you mean here ?

 Yes. That should not be too much of a problem though.

True :-)


  This would result in having CONFIG_USB_MAX_CONTROLLER_COUNT 3 on this
  board and being able to use both EHCI and XHCI . Would this be possible
  for you to implement please ? Thanks !

 Ok, so you mean get all the controllers present on the board (EHCI and
 XHCI) setup.

 Yes

 I think right now, the way USB core handles the controller count is
 quite different, so
 that 'CONFIG_USB_MAX_CONTROLLER_COUNT' helps in probing multiple
 controllers of the same type.

 The only problem is, that both EHCI and XHCI core implement:

 submit_control_msg()
 submit_bulk_msg()
 submit_int_msg()
 usb_lowlevel_init()
 usb_lowlevel_stop()

exactly.


 How I'd do this:
 1) Rename all these submit_*() functions to usb_submit_*()
 2) Rename all five usb_*() functions to ehci_*() resp. xhci_*()
This will happen in each controller drivers (ehci/xhci) which would
eventually be
called fro upper translation layer you mentioned below, right ?

 3) Implement translation layer, where the common code would still call usb_*()
and the layer would determine whether to call ehci_*() or xhci_*() call.

 Surely, you'd need to change the probe() logic a bit, the controller drivers
 would have to call some usb_register_driver() function for each controller.
 This function would generate a new entry in a linked list of all controllers
 registered and would add a flag whether this controller is EHCI or XHCI.

Ok, i can understand this. Will try to put up code for this.


 Effectively, this would even remove the need for 
 CONFIG_USB_MAX_CONTROLLER_COUNT
 at all, since you'd be tracking all the USB controllers in the USB core code 
 and
 in a linked list.

Yeah, right. We won't need the controller count in this case.


 I had plans to add support to use controllers of different types (EHCI
 and XHCI etc) simultaneously.
 But haven't really put a code for that yet.
 Can you suggest some pointers about how would you like to see EHCI and
 XHCI or even OHCI work
 together :-)
 I can take up this.

 Thank you, see above please. OHCI might be nastier, but should happen along
 these lines above as well.
Ok, so first i will take up EHCI and XHCI then, and later 'll see the OHCI part.


 Best regards,
 Marek Vasut



-- 
Best Regards
Vivek Gautam
Samsung RD Institute, Bangalore
India
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 5/8] usb: xhci-exynos5: Add support for multiple USB 3.0 controllers

2014-01-07 Thread Vivek Gautam
On Mon, Jan 6, 2014 at 9:21 PM, Marek Vasut ma...@denx.de wrote:
 On Monday, January 06, 2014 at 10:29:40 AM, Vivek Gautam wrote:
 Add required support to use multiple USB 3.0 controllers available
 on exynos5420 SoC.

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 ---
  arch/arm/cpu/armv7/exynos/power.c|   18 --
  arch/arm/include/asm/arch-exynos/cpu.h   |   10 
  arch/arm/include/asm/arch-exynos/power.h |2 +-
  drivers/usb/host/xhci-exynos5.c  |   91
 +- drivers/usb/host/xhci.c  |
   4 --
  drivers/usb/host/xhci.h  |4 ++
  6 files changed, 91 insertions(+), 38 deletions(-)

 diff --git a/arch/arm/cpu/armv7/exynos/power.c
 b/arch/arm/cpu/armv7/exynos/power.c index 563abd7..0f8aa98 100644
 --- a/arch/arm/cpu/armv7/exynos/power.c
 +++ b/arch/arm/cpu/armv7/exynos/power.c
 @@ -59,26 +59,34 @@ void set_usbhost_phy_ctrl(unsigned int enable)
   exynos5_set_usbhost_phy_ctrl(enable);
  }

 -static void exynos5_set_usbdrd_phy_ctrl(unsigned int enable)
 +static void exynos5_set_usbdrd_phy_ctrl(unsigned int enable, int
 dev_index) {
   struct exynos5_power *power =
   (struct exynos5_power *)samsung_get_base_power();

 + /*
 +  * Assuming here that the DRD_PHY_CONTROL registers
 +  * are contiguous, so that :
 +  * addressof(DRD_PHY1_CONTROL) = addressof(DRD_PHY_CONTROL) + 0x4;
 +  * which is the case with exynos5420.
 +  * For exynos5250 this should work out of box, since dev_index will
 +  * always be '0' in that case
 +  */

 Why don't you convert the entry for usbdrd_phy_control into an array in the
 'struct exynos5_power' structure instead ? Then you could index it with
 dev_index.

Aah, i should have been more careful here. There's already a structure
available for exynos5420 exynos5420_power,
which i can use. I just would need to use api proid_is_exynos5420()
or proid_is_exynos5250() to differentiate between
the two.


 [...]

 Do you think it'd be possible to split this patch into drivers/usb/ specific
 part and CPU-specific part ? I'd like to see that to prevent merge conflicts.

Ok, i'll separate out the two parts.


 [...]

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



-- 
Best Regards
Vivek Gautam
Samsung RD Institute, Bangalore
India
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 5/8] usb: xhci-exynos5: Add support for multiple USB 3.0 controllers

2014-01-07 Thread Vivek Gautam
On Tue, Jan 7, 2014 at 4:29 PM, Marek Vasut ma...@denx.de wrote:
 On Tuesday, January 07, 2014 at 10:15:20 AM, Vivek Gautam wrote:

 [...]

 Minor rant, please trim the email when replying so it contains only the 
 relevant
 parts. Otherwise, the irrelevant noise might cause some of the relevant 
 replies
 to get lost.

Sure, will keep that in mind.

-- 
Best Regards
Vivek Gautam
Samsung RD Institute, Bangalore
India
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/8] arm: exynos5420: Fix base address for USBPHY

2014-01-06 Thread Vivek Gautam
'USBPHY' which denotes USB 2.0 PHY is available on exynos5420
Add it's base address rather than making it 'DEVICE_NOT_AVAILABLE'

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 arch/arm/include/asm/arch-exynos/cpu.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/arch-exynos/cpu.h 
b/arch/arm/include/asm/arch-exynos/cpu.h
index 573f755..6f9b1c5 100644
--- a/arch/arm/include/asm/arch-exynos/cpu.h
+++ b/arch/arm/include/asm/arch-exynos/cpu.h
@@ -148,6 +148,7 @@
 #define EXYNOS5420_DMC_CTRL_BASE   0x10C2
 #define EXYNOS5420_DMC_TZASC_BASE  0x10D4
 #define EXYNOS5420_USB_HOST_EHCI_BASE  0x1211
+#define EXYNOS5420_USBPHY_BASE 0x1213
 #define EXYNOS5420_MMC_BASE0x1220
 #define EXYNOS5420_SROMC_BASE  0x1225
 #define EXYNOS5420_UART_BASE   0x12C0
@@ -164,7 +165,6 @@
 #define EXYNOS5420_MIPI_DSIM_BASE  0x1450
 #define EXYNOS5420_DP_BASE 0x145B
 
-#define EXYNOS5420_USBPHY_BASE DEVICE_NOT_AVAILABLE
 #define EXYNOS5420_USBOTG_BASE DEVICE_NOT_AVAILABLE
 #define EXYNOS5420_FIMD_BASE   DEVICE_NOT_AVAILABLE
 #define EXYNOS5420_ADC_BASEDEVICE_NOT_AVAILABLE
-- 
1.7.10.4

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


[U-Boot] [PATCH 0/8] Exynos5420: Add support for XHCI controller

2014-01-06 Thread Vivek Gautam
This patch series is based on u-boot-samsung 'master' branch.
The series is tested for both XHCI controller ports as well
as EHCI controller ports present on smdk5420 and smdk5250.

The series inclues few cleanup patches (cpu address fix, device
tree cleanup), plus multiple controller support for 'xhci' on
exynos5420 based systems.
The Vbus GPIO patch in the series is using the non-dt style of
configuring the GPIOs (using board_usb_vbus_init helper function).

Vivek Gautam (8):
  arm: exynos5420: Fix base address for USBPHY
  arm: exynos5420: Add base addresses for USB 3.0
  dts: exynos5250: Remove explicit device node of 'xhci'
  config: exynos5: Enable XHCI on all Exynos5 systems
  usb: xhci-exynos5: Add support for multiple USB 3.0 controllers
  dts: exynos5420: Move device node for xhci 2nd controller
  smdk5420: Correct the vbus gpio configuration for USB controller
  config: smdk5420: Enable support for multiple XHCI controllers

 arch/arm/cpu/armv7/exynos/power.c |   18 --
 arch/arm/dts/exynos5250.dtsi  |   14 -
 arch/arm/dts/exynos5420.dtsi  |   12 
 arch/arm/include/asm/arch-exynos/cpu.h|   16 -
 arch/arm/include/asm/arch-exynos/power.h  |2 +-
 board/samsung/dts/exynos5420-smdk5420.dts |   12 
 board/samsung/smdk5420/smdk5420.c |   11 ++--
 drivers/usb/host/xhci-exynos5.c   |   91 -
 drivers/usb/host/xhci.c   |4 --
 drivers/usb/host/xhci.h   |4 ++
 include/configs/exynos5-dt.h  |7 +++
 include/configs/exynos5250-dt.h   |7 ---
 include/configs/smdk5420.h|3 +
 13 files changed, 122 insertions(+), 79 deletions(-)

-- 
1.7.10.4

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


[U-Boot] [PATCH 8/8] config: smdk5420: Enable support for multiple XHCI controllers

2014-01-06 Thread Vivek Gautam
Update USB_MAX_CONTROLLER_COUNT to be '2' to enable support
for both usb 3.0 controllers on exynos5420.

NOTE: To use EHCI on exynos5420, this change will need to be
reverted, since there's only one EHCI controller available on
exynos5420.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 include/configs/smdk5420.h |3 +++
 1 file changed, 3 insertions(+)

diff --git a/include/configs/smdk5420.h b/include/configs/smdk5420.h
index 447f8e5..57d70bf 100644
--- a/include/configs/smdk5420.h
+++ b/include/configs/smdk5420.h
@@ -53,4 +53,7 @@
 
 #define CONFIG_MAX_I2C_NUM 11
 
+/* Multiple USB controller support */
+#define CONFIG_USB_MAX_CONTROLLER_COUNT2
+
 #endif /* __CONFIG_5420_H */
-- 
1.7.10.4

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


[U-Boot] [PATCH 3/8] dts: exynos5250: Remove explicit device node of 'xhci'

2014-01-06 Thread Vivek Gautam
Device node for 'xhci' already exists in 'exynos5' dtsi file,
so we don't need an explicit mention about it again in
'exynos5250' dtsi file.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 arch/arm/dts/exynos5250.dtsi |   14 --
 1 file changed, 14 deletions(-)

diff --git a/arch/arm/dts/exynos5250.dtsi b/arch/arm/dts/exynos5250.dtsi
index 0c644e7..bb3f361 100644
--- a/arch/arm/dts/exynos5250.dtsi
+++ b/arch/arm/dts/exynos5250.dtsi
@@ -63,18 +63,4 @@
samsung,i2s-bit-clk-framesize = 32;
samsung,i2s-id = 1;
};
-
-
-   xhci@1200 {
-   compatible = samsung,exynos5250-xhci;
-   reg = 0x1200 0x1;
-   #address-cells = 1;
-   #size-cells = 1;
-
-   phy {
-   compatible = samsung,exynos5250-usb3-phy;
-   reg = 0x1210 0x100;
-   };
-   };
-
 };
-- 
1.7.10.4

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


[U-Boot] [PATCH 6/8] dts: exynos5420: Move device node for xhci 2nd controller

2014-01-06 Thread Vivek Gautam
XHCI's 2nd controller is present on all Exynos5420 machines,
so moving the corresponding node from board dts to SoC dts
for exynos5420.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 arch/arm/dts/exynos5420.dtsi  |   12 
 board/samsung/dts/exynos5420-smdk5420.dts |   12 
 2 files changed, 12 insertions(+), 12 deletions(-)

diff --git a/arch/arm/dts/exynos5420.dtsi b/arch/arm/dts/exynos5420.dtsi
index 02ead61..edcb46d 100644
--- a/arch/arm/dts/exynos5420.dtsi
+++ b/arch/arm/dts/exynos5420.dtsi
@@ -67,4 +67,16 @@
reg = 0x12E2 0x100;
interrupts = 0 203 0;
};
+
+   xhci1: xhci@1240 {
+   compatible = samsung,exynos5250-xhci;
+   reg = 0x1240 0x1;
+   #address-cells = 1;
+   #size-cells = 1;
+
+   phy {
+   compatible = samsung,exynos5250-usb3-phy;
+   reg = 0x1250 0x100;
+   };
+   };
 };
diff --git a/board/samsung/dts/exynos5420-smdk5420.dts 
b/board/samsung/dts/exynos5420-smdk5420.dts
index d739763..958ff79 100644
--- a/board/samsung/dts/exynos5420-smdk5420.dts
+++ b/board/samsung/dts/exynos5420-smdk5420.dts
@@ -154,16 +154,4 @@
dmc {
mem-type = ddr3;
};
-
-   xhci1: xhci@1240 {
-   compatible = samsung,exynos5250-xhci;
-   reg = 0x1240 0x1;
-   #address-cells = 1;
-   #size-cells = 1;
-
-   phy {
-   compatible = samsung,exynos5250-usb3-phy;
-   reg = 0x1250 0x100;
-   };
-   };
 };
-- 
1.7.10.4

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


[U-Boot] [PATCH 7/8] smdk5420: Correct the vbus gpio configuration for USB controller

2014-01-06 Thread Vivek Gautam
On smdk5420 two availbale XHCI controllers require VBUS GPIO
to be configured, the EHCI however doesn't have any such VBUS
GPIO. So correcting the available board_usb_vbus_init() function
to the needs.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 board/samsung/smdk5420/smdk5420.c |   11 ++-
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/board/samsung/smdk5420/smdk5420.c 
b/board/samsung/smdk5420/smdk5420.c
index 3ad2ad0..4f23000 100644
--- a/board/samsung/smdk5420/smdk5420.c
+++ b/board/samsung/smdk5420/smdk5420.c
@@ -18,14 +18,15 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#ifdef CONFIG_USB_EHCI_EXYNOS
+#ifdef CONFIG_USB_XHCI_EXYNOS
 static int board_usb_vbus_init(void)
 {
-   struct exynos5_gpio_part1 *gpio1 = (struct exynos5_gpio_part1 *)
-   samsung_get_base_gpio_part1();
+   struct exynos5420_gpio_part4 *gpio4 = (struct exynos5420_gpio_part4 *)
+   samsung_get_base_gpio_part4();
 
/* Enable VBUS power switch */
-   s5p_gpio_direction_output(gpio1-x2, 6, 1);
+   s5p_gpio_direction_output(gpio4-g0, 5, 1);
+   s5p_gpio_direction_output(gpio4-g1, 4, 1);
 
/* VBUS turn ON time */
mdelay(3);
@@ -36,7 +37,7 @@ static int board_usb_vbus_init(void)
 
 int exynos_init(void)
 {
-#ifdef CONFIG_USB_EHCI_EXYNOS
+#ifdef CONFIG_USB_XHCI_EXYNOS
board_usb_vbus_init();
 #endif
return 0;
-- 
1.7.10.4

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


[U-Boot] [PATCH 4/8] config: exynos5: Enable XHCI on all Exynos5 systems

2014-01-06 Thread Vivek Gautam
XHCI host controller is present on Exynos5250 as well as
Exynos5420, so enabling the correseponding config for
all Exynos5 systems.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 include/configs/exynos5-dt.h|7 +++
 include/configs/exynos5250-dt.h |7 ---
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/include/configs/exynos5-dt.h b/include/configs/exynos5-dt.h
index d684790..b2068a5 100644
--- a/include/configs/exynos5-dt.h
+++ b/include/configs/exynos5-dt.h
@@ -231,6 +231,13 @@
 #define CONFIG_SYS_I2C_S3C24X0_SLAVE0x0
 #define CONFIG_I2C_EDID
 
+/* USB */
+#define CONFIG_CMD_USB
+#define CONFIG_USB_XHCI
+#define CONFIG_USB_XHCI_EXYNOS
+#define CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS 2
+#define CONFIG_USB_STORAGE
+
 /* SPI */
 #define CONFIG_ENV_IS_IN_SPI_FLASH
 #define CONFIG_SPI_FLASH
diff --git a/include/configs/exynos5250-dt.h b/include/configs/exynos5250-dt.h
index 615df64..ebf5d88 100644
--- a/include/configs/exynos5250-dt.h
+++ b/include/configs/exynos5250-dt.h
@@ -20,13 +20,6 @@
 #define MACH_TYPE_SMDK5250 3774
 #define CONFIG_MACH_TYPE   MACH_TYPE_SMDK5250
 
-/* USB */
-#define CONFIG_CMD_USB
-#define CONFIG_USB_XHCI
-#define CONFIG_USB_XHCI_EXYNOS
-#define CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS 2
-#define CONFIG_USB_STORAGE
-
 /* USB boot mode */
 #define CONFIG_USB_BOOTING
 #define EXYNOS_COPY_USB_FNPTR_ADDR 0x02020070
-- 
1.7.10.4

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


[U-Boot] [PATCH 5/8] usb: xhci-exynos5: Add support for multiple USB 3.0 controllers

2014-01-06 Thread Vivek Gautam
Add required support to use multiple USB 3.0 controllers available
on exynos5420 SoC.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 arch/arm/cpu/armv7/exynos/power.c|   18 --
 arch/arm/include/asm/arch-exynos/cpu.h   |   10 
 arch/arm/include/asm/arch-exynos/power.h |2 +-
 drivers/usb/host/xhci-exynos5.c  |   91 +-
 drivers/usb/host/xhci.c  |4 --
 drivers/usb/host/xhci.h  |4 ++
 6 files changed, 91 insertions(+), 38 deletions(-)

diff --git a/arch/arm/cpu/armv7/exynos/power.c 
b/arch/arm/cpu/armv7/exynos/power.c
index 563abd7..0f8aa98 100644
--- a/arch/arm/cpu/armv7/exynos/power.c
+++ b/arch/arm/cpu/armv7/exynos/power.c
@@ -59,26 +59,34 @@ void set_usbhost_phy_ctrl(unsigned int enable)
exynos5_set_usbhost_phy_ctrl(enable);
 }
 
-static void exynos5_set_usbdrd_phy_ctrl(unsigned int enable)
+static void exynos5_set_usbdrd_phy_ctrl(unsigned int enable, int dev_index)
 {
struct exynos5_power *power =
(struct exynos5_power *)samsung_get_base_power();
 
+   /*
+* Assuming here that the DRD_PHY_CONTROL registers
+* are contiguous, so that :
+* addressof(DRD_PHY1_CONTROL) = addressof(DRD_PHY_CONTROL) + 0x4;
+* which is the case with exynos5420.
+* For exynos5250 this should work out of box, since dev_index will
+* always be '0' in that case
+*/
if (enable) {
/* Enabling USBDRD_PHY */
-   setbits_le32(power-usbdrd_phy_control,
+   setbits_le32(power-usbdrd_phy_control + dev_index,
POWER_USB_DRD_PHY_CTRL_EN);
} else {
/* Disabling USBDRD_PHY */
-   clrbits_le32(power-usbdrd_phy_control,
+   clrbits_le32(power-usbdrd_phy_control + dev_index,
POWER_USB_DRD_PHY_CTRL_EN);
}
 }
 
-void set_usbdrd_phy_ctrl(unsigned int enable)
+void set_usbdrd_phy_ctrl(unsigned int enable, int dev_index)
 {
if (cpu_is_exynos5())
-   exynos5_set_usbdrd_phy_ctrl(enable);
+   exynos5_set_usbdrd_phy_ctrl(enable, dev_index);
 }
 
 static void exynos5_dp_phy_control(unsigned int enable)
diff --git a/arch/arm/include/asm/arch-exynos/cpu.h 
b/arch/arm/include/asm/arch-exynos/cpu.h
index 718940b..d93cba9 100644
--- a/arch/arm/include/asm/arch-exynos/cpu.h
+++ b/arch/arm/include/asm/arch-exynos/cpu.h
@@ -54,6 +54,8 @@
 #define EXYNOS4_USB_HOST_XHCI_BASE DEVICE_NOT_AVAILABLE
 #define EXYNOS4_USB3PHY_BASE   DEVICE_NOT_AVAILABLE
 #define EXYNOS4_DMC_TZASC_BASE DEVICE_NOT_AVAILABLE
+#define EXYNOS4_USB_HOST_XHCI_1_BASE   DEVICE_NOT_AVAILABLE
+#define EXYNOS4_USB3PHY_1_BASE DEVICE_NOT_AVAILABLE
 
 /* EXYNOS4X12 */
 #define EXYNOS4X12_GPIO_PART3_BASE 0x0386
@@ -93,6 +95,8 @@
 #define EXYNOS4X12_USB_HOST_XHCI_BASE  DEVICE_NOT_AVAILABLE
 #define EXYNOS4X12_USB3PHY_BASEDEVICE_NOT_AVAILABLE
 #define EXYNOS4X12_DMC_TZASC_BASE  DEVICE_NOT_AVAILABLE
+#define EXYNOS4X12_USB_HOST_XHCI_1_BASEDEVICE_NOT_AVAILABLE
+#define EXYNOS4X12_USB3PHY_1_BASE  DEVICE_NOT_AVAILABLE
 
 /* EXYNOS5 */
 #define EXYNOS5_I2C_SPACING0x1
@@ -132,6 +136,8 @@
 #define EXYNOS5_ADC_BASE   DEVICE_NOT_AVAILABLE
 #define EXYNOS5_MODEM_BASE DEVICE_NOT_AVAILABLE
 #define EXYNOS5_DMC_TZASC_BASE DEVICE_NOT_AVAILABLE
+#define EXYNOS5_USB_HOST_XHCI_1_BASE   DEVICE_NOT_AVAILABLE
+#define EXYNOS5_USB3PHY_1_BASE DEVICE_NOT_AVAILABLE
 
 /* EXYNOS5420 */
 #define EXYNOS5420_AUDIOSS_BASE0x0381
@@ -153,6 +159,8 @@
 #define EXYNOS5420_USBPHY_BASE 0x1213
 #define EXYNOS5420_MMC_BASE0x1220
 #define EXYNOS5420_SROMC_BASE  0x1225
+#define EXYNOS5420_USB_HOST_XHCI_1_BASE0x1240
+#define EXYNOS5420_USB3PHY_1_BASE  0x1250
 #define EXYNOS5420_UART_BASE   0x12C0
 #define EXYNOS5420_I2C_BASE0x12C6
 #define EXYNOS5420_I2C_8910_BASE   0x12E0
@@ -276,8 +284,10 @@ SAMSUNG_BASE(timer, PWMTIMER_BASE)
 SAMSUNG_BASE(uart, UART_BASE)
 SAMSUNG_BASE(usb_phy, USBPHY_BASE)
 SAMSUNG_BASE(usb3_phy, USB3PHY_BASE)
+SAMSUNG_BASE(usb3_phy_1, USB3PHY_1_BASE)
 SAMSUNG_BASE(usb_ehci, USB_HOST_EHCI_BASE)
 SAMSUNG_BASE(usb_xhci, USB_HOST_XHCI_BASE)
+SAMSUNG_BASE(usb_xhci_1, USB_HOST_XHCI_1_BASE)
 SAMSUNG_BASE(usb_otg, USBOTG_BASE)
 SAMSUNG_BASE(watchdog, WATCHDOG_BASE)
 SAMSUNG_BASE(power, POWER_BASE)
diff --git a/arch/arm/include/asm/arch-exynos/power.h 
b/arch/arm/include/asm/arch-exynos/power.h
index c9609a2..c3f2ef0 100644
--- a/arch/arm/include/asm/arch-exynos/power.h
+++ b/arch/arm/include/asm/arch-exynos/power.h
@@ -1684,7 +1684,7 @@ void set_hw_thermal_trip(void);
 #define POWER_USB_HOST_PHY_CTRL_EN (1  0)
 #define POWER_USB_HOST_PHY_CTRL_DISABLE(0  0)
 
-void

[U-Boot] [PATCH 2/8] arm: exynos5420: Add base addresses for USB 3.0

2014-01-06 Thread Vivek Gautam
Adding missing base addresses for XHCI and USB3-PHY,
to enable support for XHCI on exynos5420 systems.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 arch/arm/include/asm/arch-exynos/cpu.h |4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/arm/include/asm/arch-exynos/cpu.h 
b/arch/arm/include/asm/arch-exynos/cpu.h
index 6f9b1c5..718940b 100644
--- a/arch/arm/include/asm/arch-exynos/cpu.h
+++ b/arch/arm/include/asm/arch-exynos/cpu.h
@@ -147,6 +147,8 @@
 #define EXYNOS5420_DMC_PHY_BASE0x10C0
 #define EXYNOS5420_DMC_CTRL_BASE   0x10C2
 #define EXYNOS5420_DMC_TZASC_BASE  0x10D4
+#define EXYNOS5420_USB_HOST_XHCI_BASE  0x1200
+#define EXYNOS5420_USB3PHY_BASE0x1210
 #define EXYNOS5420_USB_HOST_EHCI_BASE  0x1211
 #define EXYNOS5420_USBPHY_BASE 0x1213
 #define EXYNOS5420_MMC_BASE0x1220
@@ -169,8 +171,6 @@
 #define EXYNOS5420_FIMD_BASE   DEVICE_NOT_AVAILABLE
 #define EXYNOS5420_ADC_BASEDEVICE_NOT_AVAILABLE
 #define EXYNOS5420_MODEM_BASE  DEVICE_NOT_AVAILABLE
-#define EXYNOS5420_USB3PHY_BASEDEVICE_NOT_AVAILABLE
-#define EXYNOS5420_USB_HOST_XHCI_BASE  DEVICE_NOT_AVAILABLE
 
 #ifndef __ASSEMBLY__
 #include asm/io.h
-- 
1.7.10.4

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


Re: [U-Boot] [PATCH 7/8] smdk5420: Correct the vbus gpio configuration for USB controller

2014-01-06 Thread Vivek Gautam
Hi Marek,


On Mon, Jan 6, 2014 at 9:22 PM, Marek Vasut ma...@denx.de wrote:
 On Monday, January 06, 2014 at 10:29:42 AM, Vivek Gautam wrote:
 On smdk5420 two availbale XHCI controllers require VBUS GPIO
 to be configured, the EHCI however doesn't have any such VBUS
 GPIO. So correcting the available board_usb_vbus_init() function
 to the needs.

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 ---
  board/samsung/smdk5420/smdk5420.c |   11 ++-
  1 file changed, 6 insertions(+), 5 deletions(-)

 diff --git a/board/samsung/smdk5420/smdk5420.c
 b/board/samsung/smdk5420/smdk5420.c index 3ad2ad0..4f23000 100644
 --- a/board/samsung/smdk5420/smdk5420.c
 +++ b/board/samsung/smdk5420/smdk5420.c
 @@ -18,14 +18,15 @@

  DECLARE_GLOBAL_DATA_PTR;

 -#ifdef CONFIG_USB_EHCI_EXYNOS
 +#ifdef CONFIG_USB_XHCI_EXYNOS
  static int board_usb_vbus_init(void)
  {
 - struct exynos5_gpio_part1 *gpio1 = (struct exynos5_gpio_part1 *)
 - samsung_get_base_gpio_part1();
 + struct exynos5420_gpio_part4 *gpio4 = (struct exynos5420_gpio_part4 *)
 + samsung_get_base_gpio_part4();

   /* Enable VBUS power switch */
 - s5p_gpio_direction_output(gpio1-x2, 6, 1);
 + s5p_gpio_direction_output(gpio4-g0, 5, 1);
 + s5p_gpio_direction_output(gpio4-g1, 4, 1);

 This VBUS toggling should happen on per-port basis, right ?

No this VBUS gpio toggling is actually enabling the VBUS line of the controller.
And since we have 2 controllers on exynos5420, so added the required 2
gpios for the purpose
(GPG0[5], and GPG1[4]).


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



-- 
Best Regards
Vivek Gautam
Samsung RD Institute, Bangalore
India
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/2] exynos5250: usb: Fix VBus gpio numbers for ehci and xhci controllers

2014-01-03 Thread Vivek Gautam
The gpio_*() apis require the exact gpio line number to deduce
the gpio bank and the gpio pin addresses.
So fix the gpio number for VBUS used for EHCI ports as well as
XHCI ports on exynos5250 boards.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Cc: Julius Werner jwer...@chromium.org
Cc: Minkyu Kang mk7.k...@samsung.com
Cc: Marek Vasut ma...@denx.de
---
 board/samsung/dts/exynos5250-smdk5250.dts |2 +-
 board/samsung/dts/exynos5250-snow.dts |4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/board/samsung/dts/exynos5250-smdk5250.dts 
b/board/samsung/dts/exynos5250-smdk5250.dts
index c4ed346..9020382 100644
--- a/board/samsung/dts/exynos5250-smdk5250.dts
+++ b/board/samsung/dts/exynos5250-smdk5250.dts
@@ -146,6 +146,6 @@
};
 
ehci@1211 {
-   samsung,vbus-gpio = gpio 0xbe 0; /* X26 */
+   samsung,vbus-gpio = gpio 0x316 0; /* X26 */
};
 };
diff --git a/board/samsung/dts/exynos5250-snow.dts 
b/board/samsung/dts/exynos5250-snow.dts
index 091cdb9..9b48a0c 100644
--- a/board/samsung/dts/exynos5250-snow.dts
+++ b/board/samsung/dts/exynos5250-snow.dts
@@ -110,11 +110,11 @@
};
 
ehci@1211 {
-   samsung,vbus-gpio = gpio 0xb1 0; /* X11 */
+   samsung,vbus-gpio = gpio 0x309 0; /* X11 */
};
 
xhci@1200 {
-   samsung,vbus-gpio = gpio 0xbf 0; /* X27 */
+   samsung,vbus-gpio = gpio 0x317 0; /* X27 */
};
 
tmu@1006 {
-- 
1.7.10.4

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


[U-Boot] [PATCH 2/2] smdk5250: Remove 'board_usb_vbus_init()' function

2014-01-03 Thread Vivek Gautam
Previously as a part of moving the VBUS gpio support to device tree
following patch removed this and added relevant support in driver:
4a271cb exynos: usb: Switch USB VBUS GPIOs to be device tree configured

Recent changes for common board file migration for exynos platform
added it again. So removing it now.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Cc: Julius Werner jwer...@chromium.org
Cc: Minkyu Kang mk7.k...@samsung.com
Cc: Marek Vasut ma...@denx.de
---
 board/samsung/smdk5250/smdk5250.c |   19 ---
 1 file changed, 19 deletions(-)

diff --git a/board/samsung/smdk5250/smdk5250.c 
b/board/samsung/smdk5250/smdk5250.c
index 943c29a..a69f73d 100644
--- a/board/samsung/smdk5250/smdk5250.c
+++ b/board/samsung/smdk5250/smdk5250.c
@@ -26,22 +26,6 @@
 
 DECLARE_GLOBAL_DATA_PTR;
 
-#ifdef CONFIG_USB_EHCI_EXYNOS
-static int board_usb_vbus_init(void)
-{
-   struct exynos5_gpio_part1 *gpio1 = (struct exynos5_gpio_part1 *)
-   samsung_get_base_gpio_part1();
-
-   /* Enable VBUS power switch */
-   s5p_gpio_direction_output(gpio1-x2, 6, 1);
-
-   /* VBUS turn ON time */
-   mdelay(3);
-
-   return 0;
-}
-#endif
-
 #ifdef CONFIG_SOUND_MAX98095
 static void  board_enable_audio_codec(void)
 {
@@ -56,9 +40,6 @@ static void  board_enable_audio_codec(void)
 
 int exynos_init(void)
 {
-#ifdef CONFIG_USB_EHCI_EXYNOS
-   board_usb_vbus_init();
-#endif
 #ifdef CONFIG_SOUND_MAX98095
board_enable_audio_codec();
 #endif
-- 
1.7.10.4

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


Re: [U-Boot] [PATCH 2/2] smdk5250: Remove 'board_usb_vbus_init()' function

2014-01-03 Thread Vivek Gautam
On Fri, Jan 3, 2014 at 4:10 PM, Vivek Gautam gautam.vi...@samsung.com wrote:
 Previously as a part of moving the VBUS gpio support to device tree
 following patch removed this and added relevant support in driver:
 4a271cb exynos: usb: Switch USB VBUS GPIOs to be device tree configured

 Recent changes for common board file migration for exynos platform
 added it again. So removing it now.

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 Cc: Julius Werner jwer...@chromium.org
 Cc: Minkyu Kang mk7.k...@samsung.com
 Cc: Marek Vasut ma...@denx.de
 ---

Based on u-boot-samsung 'master' branch.

  board/samsung/smdk5250/smdk5250.c |   19 ---
  1 file changed, 19 deletions(-)

 diff --git a/board/samsung/smdk5250/smdk5250.c 
 b/board/samsung/smdk5250/smdk5250.c
 index 943c29a..a69f73d 100644
 --- a/board/samsung/smdk5250/smdk5250.c
 +++ b/board/samsung/smdk5250/smdk5250.c
 @@ -26,22 +26,6 @@

  DECLARE_GLOBAL_DATA_PTR;

 -#ifdef CONFIG_USB_EHCI_EXYNOS
 -static int board_usb_vbus_init(void)
 -{
 -   struct exynos5_gpio_part1 *gpio1 = (struct exynos5_gpio_part1 *)
 -   samsung_get_base_gpio_part1();
 -
 -   /* Enable VBUS power switch */
 -   s5p_gpio_direction_output(gpio1-x2, 6, 1);
 -
 -   /* VBUS turn ON time */
 -   mdelay(3);
 -
 -   return 0;
 -}
 -#endif
 -
  #ifdef CONFIG_SOUND_MAX98095
  static void  board_enable_audio_codec(void)
  {
 @@ -56,9 +40,6 @@ static void  board_enable_audio_codec(void)

  int exynos_init(void)
  {
 -#ifdef CONFIG_USB_EHCI_EXYNOS
 -   board_usb_vbus_init();
 -#endif
  #ifdef CONFIG_SOUND_MAX98095
 board_enable_audio_codec();
  #endif
 --
 1.7.10.4

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



-- 
Best Regards
Vivek Gautam
Samsung RD Institute, Bangalore
India
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/2] exynos5250: usb: Fix VBus gpio numbers for ehci and xhci controllers

2014-01-03 Thread Vivek Gautam
On Fri, Jan 3, 2014 at 4:10 PM, Vivek Gautam gautam.vi...@samsung.com wrote:
 The gpio_*() apis require the exact gpio line number to deduce
 the gpio bank and the gpio pin addresses.
 So fix the gpio number for VBUS used for EHCI ports as well as
 XHCI ports on exynos5250 boards.

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 Cc: Julius Werner jwer...@chromium.org
 Cc: Minkyu Kang mk7.k...@samsung.com
 Cc: Marek Vasut ma...@denx.de
 ---

Based on u-boot-samsung 'master' branch.
Tested on smkd5250 and snow board for EHCI and XHCI ports.

  board/samsung/dts/exynos5250-smdk5250.dts |2 +-
  board/samsung/dts/exynos5250-snow.dts |4 ++--
  2 files changed, 3 insertions(+), 3 deletions(-)

 diff --git a/board/samsung/dts/exynos5250-smdk5250.dts 
 b/board/samsung/dts/exynos5250-smdk5250.dts
 index c4ed346..9020382 100644
 --- a/board/samsung/dts/exynos5250-smdk5250.dts
 +++ b/board/samsung/dts/exynos5250-smdk5250.dts
 @@ -146,6 +146,6 @@
 };

 ehci@1211 {
 -   samsung,vbus-gpio = gpio 0xbe 0; /* X26 */
 +   samsung,vbus-gpio = gpio 0x316 0; /* X26 */
 };
  };
 diff --git a/board/samsung/dts/exynos5250-snow.dts 
 b/board/samsung/dts/exynos5250-snow.dts
 index 091cdb9..9b48a0c 100644
 --- a/board/samsung/dts/exynos5250-snow.dts
 +++ b/board/samsung/dts/exynos5250-snow.dts
 @@ -110,11 +110,11 @@
 };

 ehci@1211 {
 -   samsung,vbus-gpio = gpio 0xb1 0; /* X11 */
 +   samsung,vbus-gpio = gpio 0x309 0; /* X11 */
 };

 xhci@1200 {
 -   samsung,vbus-gpio = gpio 0xbf 0; /* X27 */
 +   samsung,vbus-gpio = gpio 0x317 0; /* X27 */
 };

 tmu@1006 {
 --
 1.7.10.4

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



-- 
Best Regards
Vivek Gautam
Samsung RD Institute, Bangalore
India
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 00/10] USB: XHCI: Add xHCI host controller stack driver

2013-09-24 Thread Vivek Gautam
On Tue, Sep 24, 2013 at 12:30 PM, Marek Vasut ma...@denx.de wrote:
 Dear Vivek Gautam,

 Hi Marek,

 On Mon, Sep 23, 2013 at 8:59 PM, Marek Vasut ma...@denx.de wrote:
  Dear Vivek Gautam,
 
  + Marek, Dan, Julius, Simon and Vikas for this cover patch ;-)
 
  [...]
 
  Thanks, I have the patches lined up. Just waiting for Dans' talk with
  Sarah. Maybe we should put her on CC too next time so she can rip us to
  shreds for our mistakes in the implementation ? :)

 Yeah, of-course. Always welcome for improvements.
 Do you want me to CC Sarah here in this thread itself, or should i
 re-spin the patches keeping her in CC. :-)

 Let's wait for Dan a bit.

Ok



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


Re: [U-Boot] - Help with usb3503 hub enumeration

2013-09-24 Thread Vivek Gautam
Hi,


On Sun, Sep 15, 2013 at 4:55 AM, Suriyan Ramasami suriya...@gmail.com wrote:
 Hello All and especially Dan Murphy,
 Reading thru the mailing list Dan seems to have worked on usb3503a +
 LAN9730 enumeration wrt the OMAP5. Hence, I seek his help and anyone else!

This is with regards to an odroid-u2. It is Exynos 4412 prime based. It
 has a usb3503a hub and also a LAN 9730 - I am guessing pretty much like the
 omap5.

   From the clock source and the PMIC perspective I do see that the usb3503a
 is powered up and gets a REF_CLK. (I can verify this as I can read and
 write via I2C to the usb3503a and get/set its configuration.

Did you also check the basic host operation, if you have any external
port coming out of USB2.0 PHY (not HSIC phy)
where you can connect a mass storage device or n/w device may be and
see if that's getting enumerated.


 Also, I do
 have the correct GPIO pins for the INT_N, RESET_N and HUB_CONNECT wrt the
 usb3503a.

So are you doing a proper reset of USB3503 hub using RESET_N line ?
Basically what i could see from Linaro's git also and they are doing a
pull-down followed by pull-up
of RESET_N and HUB_CONNECT gpios when setting up the HSIC phy.

Please have a look at following patch if this helps:
https://launchpadlibrarian.net/122816176/0001-DRIVERS-USB-Initialize-HSIC-PHYs-and-enable-network-.patch


   In the platform based ehci-exynos.c I do initialize the the USB_PHY,
 HSIC_1_PHY and HSIC2_PHY that is present in the Exynos 4412 SoC. These I
 have copied over from the Linux kernel (which has full usb support and
 works). Once this is done, I can see that the values for hccr and hcor
 appear correct as reported by Linux too.

Can you attach the patch here which you are using for setting up the
required PHY settings.
In the first look there's PHY that is to be suspected.


   When it comes to starting up usb via usb start, I seem to hit the below
 sequence - with debug on ... The u-boot is quite an older u-boot, but I
 have ported most of the usb code over from the arndale port over at
 insignal - which seems to have usb working (they too have a usb3503a but
 with exynos5)

 My question is how do I debug this to get it working. Looks like the hcd
 does not see the usb3503a, am I correct?
  8 
(Re)start USB...
 USB:   Exynos4412-ehci: init hccr 1258 and hcor 12580010 hc_length 10
 Register 1313 NbrPorts 3
 USB EHCI 1.00
 samsung_gpiolib_4bit_output: base: 11000c60 offset: 5 value: 0
 s3c_gpiolib_set: reg: 11000c64 offset: 5 value: 0
 samsung_gpiolib_4bit_output: base: 11000c60 offset: 0 value: 0
 s3c_gpiolib_set: reg: 11000c64 offset: 0 value: 0
 samsung_gpiolib_4bit_output: base: 11000c60 offset: 4 value: 0
 s3c_gpiolib_set: reg: 11000c64 offset: 4 value: 0
 s3c_gpiolib_set: reg: 11000c64 offset: 5 value: 1
 Read 32 from USB3503 SP_ILOCK
 s3c_gpiolib_set: reg: 11000c64 offset: 4 value: 1
 Wrote 33 to USB3503_SP_ILOCK
 samsung_gpiolib_4bit_input: base: 11000c60 offset: 0
 scanning bus for devices... New Device 0
 usb_control_msg: request: 0x6, requesttype: 0x80, value 0x100 index 0x0
 length 0x40
 set address 1
 usb_control_msg: request: 0x5, requesttype: 0x0, value 0x1 index 0x0 length
 0x0
 usb_control_msg: request: 0x6, requesttype: 0x80, value 0x100 index 0x0
 length 0x12
 usb_control_msg: request: 0x6, requesttype: 0x80, value 0x200 index 0x0
 length 0x9
 usb_control_msg: request: 0x6, requesttype: 0x80, value 0x200 index 0x0
 length 0x19
 get_conf_no 0 Result 25, wLength 25
 if 0, ep 0
 ##EP epmaxpacketin[1] = 8
 set configuration 1
 usb_control_msg: request: 0x9, requesttype: 0x0, value 0x1 index 0x0 length
 0x0
 new device strings: Mfr=1, Product=2, SerialNumber=0
 usb_control_msg: request: 0x6, requesttype: 0x80, value 0x300 index 0x0
 length 0xFF
 USB device number 1 default language ID 0x1
 usb_control_msg: request: 0x6, requesttype: 0x80, value 0x301 index 0x1
 length 0xFF
 usb_control_msg: request: 0x6, requesttype: 0x80, value 0x302 index 0x1
 length 0xFF
 Manufacturer u-boot
 Product  EHCI Host Controller
 SerialNumber
 Vendor: 0x  Product 0x Version 1.0
 USB hub found
 usb_control_msg: request: 0x6, requesttype: 0xA0, value 0x2900 index 0x0
 length 0x4
 usb_control_msg: request: 0x6, requesttype: 0xA0, value 0x2900 index 0x0
 length 0x8
 3 ports detected
 individual port power switching
 standalone hub
 global over-current protection
 power on to power good time: 20ms
 hub controller current requirement: 0mA
 port 1 is removable
 port 2 is removable
 port 3 is removable
 usb_control_msg: request: 0x0, requesttype: 0xA0, value 0x0 index 0x0
 length 0x4
 get_hub_status returned status 1, change 103
 local power source is lost (inactive)
 no over-current condition exists
 enabling power on all ports
 usb_control_msg: request: 0x1, requesttype: 0x23, value 0x8 index 0x1
 length 0x0
 port 1 returns 0
 usb_control_msg: request: 0x1, requesttype: 0x23, value 0x8 index 0x2
 length 0x0
 

Re: [U-Boot] [PATCH v3 00/10] USB: XHCI: Add xHCI host controller stack driver

2013-09-23 Thread Vivek Gautam
Hi Marek,


On Mon, Sep 23, 2013 at 8:59 PM, Marek Vasut ma...@denx.de wrote:
 Dear Vivek Gautam,

 + Marek, Dan, Julius, Simon and Vikas for this cover patch ;-)

 [...]

 Thanks, I have the patches lined up. Just waiting for Dans' talk with Sarah.
 Maybe we should put her on CC too next time so she can rip us to shreds for 
 our
 mistakes in the implementation ? :)

Yeah, of-course. Always welcome for improvements.
Do you want me to CC Sarah here in this thread itself, or should i
re-spin the patches keeping her in CC. :-)


 Best regards,
 Marek Vasut



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


Re: [U-Boot] [PATCH v3 01/10] usb: Move 'bmRequestType' USB device request macros from EHCI header

2013-09-16 Thread Vivek Gautam
Hi Marek,


On Tue, Sep 17, 2013 at 8:32 AM, Marek Vasut ma...@denx.de wrote:
 Dear Vivek Gautam,

 Macros defining bmRequestType field of USB device request,
 given in table 9.2 USB 2.0 spec, are rather generic macros
 which can be further used by other Host controller stacks.
 So moving them to usb_defs header.

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 Cc: Julius Werner jwer...@chromium.org
 Cc: Simon Glass s...@chromium.org
 Cc: Minkyu Kang mk7.k...@samsung.com
 Cc: Dan Murphy dmur...@ti.com
 Cc: Marek Vasut ma...@denx.de

 Why not just use include/usb.h ?

The bit field definitions for usb-types usb-recipient, and directions
are itself defined in usb_defs.h;
so i thought of keeping their combination just below it, so that it
would not be difficult to reference.

Please let me know if you want me to move them to include/usb.h


 Best regards,
 Marek Vasut



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


[U-Boot] [PATCH v3 05/10] exynos5: dts: Add COMPAT string data for USB 3.0 PHY and XHCI

2013-09-14 Thread Vivek Gautam
Adding required compatible string for xHCI host controller
as well as USB 3.0 PHY to enable dt support for usb 3.0 on
exynos5.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Cc: Julius Werner jwer...@chromium.org
Cc: Simon Glass s...@chromium.org
Cc: Minkyu Kang mk7.k...@samsung.com
Cc: Dan Murphy dmur...@ti.com
Cc: Marek Vasut ma...@denx.de
---

Changes since v2:
 - Nothing.

 include/fdtdec.h |2 ++
 lib/fdtdec.c |2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/include/fdtdec.h b/include/fdtdec.h
index 6bf83bf..433d6a7 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -73,7 +73,9 @@ enum fdt_compat_id {
COMPAT_GOOGLE_CROS_EC,  /* Google CROS_EC Protocol */
COMPAT_GOOGLE_CROS_EC_KEYB, /* Google CROS_EC Keyboard */
COMPAT_SAMSUNG_EXYNOS_EHCI, /* Exynos EHCI controller */
+   COMPAT_SAMSUNG_EXYNOS5_XHCI,/* Exynos5 XHCI controller */
COMPAT_SAMSUNG_EXYNOS_USB_PHY,  /* Exynos phy controller for usb2.0 */
+   COMPAT_SAMSUNG_EXYNOS5_USB3_PHY,/* Exynos phy controller for usb3.0 */
COMPAT_SAMSUNG_EXYNOS_TMU,  /* Exynos TMU */
COMPAT_SAMSUNG_EXYNOS_FIMD, /* Exynos Display controller */
COMPAT_SAMSUNG_EXYNOS5_DP,  /* Exynos Display port controller */
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index dc35856..51fa868 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -46,7 +46,9 @@ static const char * const compat_names[COMPAT_COUNT] = {
COMPAT(GOOGLE_CROS_EC, google,cros-ec),
COMPAT(GOOGLE_CROS_EC_KEYB, google,cros-ec-keyb),
COMPAT(SAMSUNG_EXYNOS_EHCI, samsung,exynos-ehci),
+   COMPAT(SAMSUNG_EXYNOS5_XHCI, samsung,exynos5250-xhci),
COMPAT(SAMSUNG_EXYNOS_USB_PHY, samsung,exynos-usb-phy),
+   COMPAT(SAMSUNG_EXYNOS5_USB3_PHY, samsung,exynos5250-usb3-phy),
COMPAT(SAMSUNG_EXYNOS_TMU, samsung,exynos-tmu),
COMPAT(SAMSUNG_EXYNOS_FIMD, samsung,exynos-fimd),
COMPAT(SAMSUNG_EXYNOS5_DP, samsung,exynos5-dp),
-- 
1.7.6.5

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


[U-Boot] [PATCH v3 01/10] usb: Move 'bmRequestType' USB device request macros from EHCI header

2013-09-14 Thread Vivek Gautam
Macros defining bmRequestType field of USB device request,
given in table 9.2 USB 2.0 spec, are rather generic macros
which can be further used by other Host controller stacks.
So moving them to usb_defs header.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Cc: Julius Werner jwer...@chromium.org
Cc: Simon Glass s...@chromium.org
Cc: Minkyu Kang mk7.k...@samsung.com
Cc: Dan Murphy dmur...@ti.com
Cc: Marek Vasut ma...@denx.de
---

Changes since v2:
 - This patch is newly added in this version of the series.

 drivers/usb/host/ehci.h |   16 
 include/usb_defs.h  |   19 +++
 2 files changed, 19 insertions(+), 16 deletions(-)

diff --git a/drivers/usb/host/ehci.h b/drivers/usb/host/ehci.h
index bd52afe..3e1c312 100644
--- a/drivers/usb/host/ehci.h
+++ b/drivers/usb/host/ehci.h
@@ -28,22 +28,6 @@
 #define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 2
 #endif
 
-/* (shifted) direction/type/recipient from the USB 2.0 spec, table 9.2 */
-#define DeviceRequest \
-   ((USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_DEVICE)  8)
-
-#define DeviceOutRequest \
-   ((USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE)  8)
-
-#define InterfaceRequest \
-   ((USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_INTERFACE)  8)
-
-#define EndpointRequest \
-   ((USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_INTERFACE)  8)
-
-#define EndpointOutRequest \
-   ((USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_INTERFACE)  8)
-
 /*
  * Register Space.
  */
diff --git a/include/usb_defs.h b/include/usb_defs.h
index 0cf5f2d..236a5ec 100644
--- a/include/usb_defs.h
+++ b/include/usb_defs.h
@@ -63,6 +63,25 @@
 #define USB_DIR_OUT   0
 #define USB_DIR_IN0x80
 
+/*
+ * bmRequestType: USB Device Requests, table 9.2 USB 2.0 spec.
+ * (shifted) direction/type/recipient.
+ */
+#define DeviceRequest \
+   ((USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_DEVICE)  8)
+
+#define DeviceOutRequest \
+   ((USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_DEVICE)  8)
+
+#define InterfaceRequest \
+   ((USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_INTERFACE)  8)
+
+#define EndpointRequest \
+   ((USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_INTERFACE)  8)
+
+#define EndpointOutRequest \
+   ((USB_DIR_OUT | USB_TYPE_STANDARD | USB_RECIP_INTERFACE)  8)
+
 /* Descriptor types */
 #define USB_DT_DEVICE0x01
 #define USB_DT_CONFIG0x02
-- 
1.7.6.5

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


[U-Boot] [PATCH v3 00/10] USB: XHCI: Add xHCI host controller stack driver

2013-09-14 Thread Vivek Gautam
Based on 'master' branch of u-boot-usb tree.

The series also includes patches to support xHCI on exynos5250,
including required driver, device tree changes.

Changes since V2:
 - Added patch to move 'bmRequestType' (Table 9-2, Ch9) definitions
   from EHCI header file to usb_defs.h so that XHCI can also use it:
   usb: Move 'bmRequestType' USB device request macros from EHCI header
 - Added patches to rework the Vbus GPIO setup for ehci and xhci in
   exynos SoCs:
   exynos: usb: Switch USB VBUS GPIOs to be device tree configured
   exynos: dts: Add USB VBUS GPIOs to the device tree
 - Added the top commit history for drivers/usb/host/xhci* of Linux kernel
   version 3.4 from where the xHCI code was initially imported.
 - Replaced GPL license with new SPDX license GPL-2.0+.
 - Moved this asm/io.h file inclusion to xhci.h
 - Reworked 'return -1' globally to return meaningful error numbers.
 - Added required comment in common/usb.c for not calling first get_descriptor
   request for XHCI.

Julius Werner (2):
  exynos: usb: Switch USB VBUS GPIOs to be device tree configured
  exynos: dts: Add USB VBUS GPIOs to the device tree

Vivek Gautam (8):
  usb: Move 'bmRequestType' USB device request macros from EHCI header
  USB: xHCI: Add stack support for xHCI
  USB: XHCI: Add xHCI host controller support for Exynos5
  arm: exynos: Add methods to control power to USB 3.0 PHY
  exynos5: dts: Add COMPAT string data for USB 3.0 PHY and XHCI
  exynos5: dts: Add device node for XHCI
  config: arm: exynos5250: Define CONFIG_SYS_CACHELINE_SIZE
  temp: config: exynos5250: Enable xHCI support for Exynos5

 arch/arm/cpu/armv7/exynos/power.c  |   22 +
 arch/arm/dts/exynos5250.dtsi   |   12 +
 arch/arm/include/asm/arch-exynos/cpu.h |8 +
 arch/arm/include/asm/arch-exynos/power.h   |5 +
 arch/arm/include/asm/arch-exynos/xhci-exynos.h |   88 ++
 board/samsung/dts/exynos5250-smdk5250.dts  |4 +
 board/samsung/dts/exynos5250-snow.dts  |8 +
 board/samsung/smdk5250/exynos5-dt.c|   19 -
 common/usb.c   |   33 +-
 drivers/usb/host/Makefile  |4 +
 drivers/usb/host/ehci-exynos.c |   11 +
 drivers/usb/host/ehci.h|   16 -
 drivers/usb/host/xhci-exynos5.c|  327 ++
 drivers/usb/host/xhci-mem.c|  720 ++
 drivers/usb/host/xhci-ring.c   |  939 ++
 drivers/usb/host/xhci.c| 1030 +++
 drivers/usb/host/xhci.h| 1255 
 include/configs/exynos5250-dt.h|7 +-
 include/fdtdec.h   |2 +
 include/linux/usb/dwc3.h   |  188 
 include/usb.h  |9 +-
 include/usb_defs.h |   19 +
 lib/fdtdec.c   |2 +
 23 files changed, 4688 insertions(+), 40 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-exynos/xhci-exynos.h
 create mode 100644 drivers/usb/host/xhci-exynos5.c
 create mode 100644 drivers/usb/host/xhci-mem.c
 create mode 100644 drivers/usb/host/xhci-ring.c
 create mode 100644 drivers/usb/host/xhci.c
 create mode 100644 drivers/usb/host/xhci.h
 create mode 100644 include/linux/usb/dwc3.h

-- 
1.7.6.5

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


[U-Boot] [PATCH v3 06/10] exynos5: dts: Add device node for XHCI

2013-09-14 Thread Vivek Gautam
Adding device node for xhci host controller to enable
usb 3.0 on exynos5250.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Cc: Julius Werner jwer...@chromium.org
Cc: Simon Glass s...@chromium.org
Cc: Minkyu Kang mk7.k...@samsung.com
Cc: Dan Murphy dmur...@ti.com
Cc: Marek Vasut ma...@denx.de
---

Changes since v2:
 - Nothing.

 arch/arm/dts/exynos5250.dtsi |   12 
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/arch/arm/dts/exynos5250.dtsi b/arch/arm/dts/exynos5250.dtsi
index 4fff5e3..57be6a7 100644
--- a/arch/arm/dts/exynos5250.dtsi
+++ b/arch/arm/dts/exynos5250.dtsi
@@ -139,6 +139,18 @@
interrupts = 0 130 0;
};
 
+   xhci@1200 {
+   compatible = samsung,exynos5250-xhci;
+   reg = 0x1200 0x1;
+   #address-cells = 1;
+   #size-cells = 1;
+
+   phy {
+   compatible = samsung,exynos5250-usb3-phy;
+   reg = 0x1210 0x100;
+   };
+   };
+
ehci@1211 {
compatible = samsung,exynos-ehci;
reg = 0x1211 0x100;
-- 
1.7.6.5

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


[U-Boot] [PATCH v3 03/10] USB: XHCI: Add xHCI host controller support for Exynos5

2013-09-14 Thread Vivek Gautam
This adds driver layer for xHCI controller in Samsung's
exynos5 soc. This interacts with xHCI host controller stack.

Signed-off-by: Vikas C Sajjan vikas.saj...@samsung.com
Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Cc: Julius Werner jwer...@chromium.org
Cc: Simon Glass s...@chromium.org
Cc: Minkyu Kang mk7.k...@samsung.com
Cc: Dan Murphy dmur...@ti.com
Cc: Marek Vasut ma...@denx.de
---

Changes since v2:
 - Replaced GPL license with new SPDX license GPL-2.0+.

 arch/arm/include/asm/arch-exynos/cpu.h |8 +
 arch/arm/include/asm/arch-exynos/xhci-exynos.h |   88 +++
 drivers/usb/host/Makefile  |1 +
 drivers/usb/host/xhci-exynos5.c|  316 
 include/linux/usb/dwc3.h   |  188 ++
 5 files changed, 601 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-exynos/xhci-exynos.h
 create mode 100644 drivers/usb/host/xhci-exynos5.c
 create mode 100644 include/linux/usb/dwc3.h

diff --git a/arch/arm/include/asm/arch-exynos/cpu.h 
b/arch/arm/include/asm/arch-exynos/cpu.h
index cb924fb..0d2b511 100644
--- a/arch/arm/include/asm/arch-exynos/cpu.h
+++ b/arch/arm/include/asm/arch-exynos/cpu.h
@@ -50,6 +50,8 @@
 #define EXYNOS4_SPI_ISP_BASE   DEVICE_NOT_AVAILABLE
 #define EXYNOS4_ACE_SFR_BASE   DEVICE_NOT_AVAILABLE
 #define EXYNOS4_DMC_PHY_BASE   DEVICE_NOT_AVAILABLE
+#define EXYNOS4_USB_HOST_XHCI_BASE DEVICE_NOT_AVAILABLE
+#define EXYNOS4_USB3PHY_BASE   DEVICE_NOT_AVAILABLE
 
 /* EXYNOS4X12 */
 #define EXYNOS4X12_GPIO_PART3_BASE 0x0386
@@ -85,6 +87,8 @@
 #define EXYNOS4X12_SPI_ISP_BASEDEVICE_NOT_AVAILABLE
 #define EXYNOS4X12_ACE_SFR_BASEDEVICE_NOT_AVAILABLE
 #define EXYNOS4X12_DMC_PHY_BASEDEVICE_NOT_AVAILABLE
+#define EXYNOS4X12_USB_HOST_XHCI_BASE  DEVICE_NOT_AVAILABLE
+#define EXYNOS4X12_USB3PHY_BASEDEVICE_NOT_AVAILABLE
 
 /* EXYNOS5 Common*/
 #define EXYNOS5_I2C_SPACING0x1
@@ -103,6 +107,8 @@
 #define EXYNOS5_DMC_CTRL_BASE  0x10DD
 #define EXYNOS5_GPIO_PART1_BASE0x1140
 #define EXYNOS5_MIPI_DSIM_BASE 0x11D0
+#define EXYNOS5_USB_HOST_XHCI_BASE 0x1200
+#define EXYNOS5_USB3PHY_BASE   0x1210
 #define EXYNOS5_USB_HOST_EHCI_BASE 0x1211
 #define EXYNOS5_USBPHY_BASE0x1213
 #define EXYNOS5_USBOTG_BASE0x1214
@@ -217,7 +223,9 @@ SAMSUNG_BASE(swreset, SWRESET)
 SAMSUNG_BASE(timer, PWMTIMER_BASE)
 SAMSUNG_BASE(uart, UART_BASE)
 SAMSUNG_BASE(usb_phy, USBPHY_BASE)
+SAMSUNG_BASE(usb3_phy, USB3PHY_BASE)
 SAMSUNG_BASE(usb_ehci, USB_HOST_EHCI_BASE)
+SAMSUNG_BASE(usb_xhci, USB_HOST_XHCI_BASE)
 SAMSUNG_BASE(usb_otg, USBOTG_BASE)
 SAMSUNG_BASE(watchdog, WATCHDOG_BASE)
 SAMSUNG_BASE(power, POWER_BASE)
diff --git a/arch/arm/include/asm/arch-exynos/xhci-exynos.h 
b/arch/arm/include/asm/arch-exynos/xhci-exynos.h
new file mode 100644
index 000..92b90a4
--- /dev/null
+++ b/arch/arm/include/asm/arch-exynos/xhci-exynos.h
@@ -0,0 +1,88 @@
+/* Copyright (c) 2012 Samsung Electronics Co. Ltd
+ *
+ * Exynos Phy register definitions
+ *
+ * SPDX-License-Identifier:GPL-2.0+
+ */
+
+#ifndef _ASM_ARCH_XHCI_EXYNOS_H_
+#define _ASM_ARCH_XHCI_EXYNOS_H_
+
+/* Phy register MACRO definitions */
+
+#define LINKSYSTEM_FLADJ_MASK  (0x3f  1)
+#define LINKSYSTEM_FLADJ(_x)   ((_x)  1)
+#define LINKSYSTEM_XHCI_VERSION_CONTROL(0x1  27)
+
+#define PHYUTMI_OTGDISABLE (1  6)
+#define PHYUTMI_FORCESUSPEND   (1  1)
+#define PHYUTMI_FORCESLEEP (1  0)
+
+#define PHYCLKRST_SSC_REFCLKSEL_MASK   (0xff  23)
+#define PHYCLKRST_SSC_REFCLKSEL(_x)((_x)  23)
+
+#define PHYCLKRST_SSC_RANGE_MASK   (0x03  21)
+#define PHYCLKRST_SSC_RANGE(_x)((_x)  21)
+
+#define PHYCLKRST_SSC_EN   (0x1  20)
+#define PHYCLKRST_REF_SSP_EN   (0x1  19)
+#define PHYCLKRST_REF_CLKDIV2  (0x1  18)
+
+#define PHYCLKRST_MPLL_MULTIPLIER_MASK (0x7f  11)
+#define PHYCLKRST_MPLL_MULTIPLIER_100MHZ_REF   (0x19  11)
+#define PHYCLKRST_MPLL_MULTIPLIER_50M_REF  (0x02  11)
+#define PHYCLKRST_MPLL_MULTIPLIER_24MHZ_REF(0x68  11)
+#define PHYCLKRST_MPLL_MULTIPLIER_20MHZ_REF(0x7d  11)
+#define PHYCLKRST_MPLL_MULTIPLIER_19200KHZ_REF (0x02  11)
+
+#define PHYCLKRST_FSEL_MASK(0x3f  5)
+#define PHYCLKRST_FSEL(_x) ((_x)  5)
+#define PHYCLKRST_FSEL_PAD_100MHZ  (0x27  5)
+#define PHYCLKRST_FSEL_PAD_24MHZ   (0x2a  5)
+#define PHYCLKRST_FSEL_PAD_20MHZ   (0x31  5)
+#define PHYCLKRST_FSEL_PAD_19_2MHZ (0x38  5)
+
+#define PHYCLKRST_RETENABLEN   (0x1  4)
+
+#define PHYCLKRST_REFCLKSEL_MASK   (0x03  2)
+#define

[U-Boot] [PATCH v3 04/10] arm: exynos: Add methods to control power to USB 3.0 PHY

2013-09-14 Thread Vivek Gautam
Adding methods to turn on/off power to USB3.0 type PHY
as and when required by the controller.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Cc: Julius Werner jwer...@chromium.org
Cc: Simon Glass s...@chromium.org
Cc: Minkyu Kang mk7.k...@samsung.com
Cc: Dan Murphy dmur...@ti.com
Cc: Marek Vasut ma...@denx.de
---

Changes since v2:
 - Nothing.

 arch/arm/cpu/armv7/exynos/power.c|   22 ++
 arch/arm/include/asm/arch-exynos/power.h |5 +
 2 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/armv7/exynos/power.c 
b/arch/arm/cpu/armv7/exynos/power.c
index 517e804..563abd7 100644
--- a/arch/arm/cpu/armv7/exynos/power.c
+++ b/arch/arm/cpu/armv7/exynos/power.c
@@ -59,6 +59,28 @@ void set_usbhost_phy_ctrl(unsigned int enable)
exynos5_set_usbhost_phy_ctrl(enable);
 }
 
+static void exynos5_set_usbdrd_phy_ctrl(unsigned int enable)
+{
+   struct exynos5_power *power =
+   (struct exynos5_power *)samsung_get_base_power();
+
+   if (enable) {
+   /* Enabling USBDRD_PHY */
+   setbits_le32(power-usbdrd_phy_control,
+   POWER_USB_DRD_PHY_CTRL_EN);
+   } else {
+   /* Disabling USBDRD_PHY */
+   clrbits_le32(power-usbdrd_phy_control,
+   POWER_USB_DRD_PHY_CTRL_EN);
+   }
+}
+
+void set_usbdrd_phy_ctrl(unsigned int enable)
+{
+   if (cpu_is_exynos5())
+   exynos5_set_usbdrd_phy_ctrl(enable);
+}
+
 static void exynos5_dp_phy_control(unsigned int enable)
 {
unsigned int cfg;
diff --git a/arch/arm/include/asm/arch-exynos/power.h 
b/arch/arm/include/asm/arch-exynos/power.h
index 3241327..8db18c5 100644
--- a/arch/arm/include/asm/arch-exynos/power.h
+++ b/arch/arm/include/asm/arch-exynos/power.h
@@ -847,6 +847,11 @@ void set_hw_thermal_trip(void);
 #define POWER_USB_HOST_PHY_CTRL_EN (1  0)
 #define POWER_USB_HOST_PHY_CTRL_DISABLE(0  0)
 
+void set_usbdrd_phy_ctrl(unsigned int enable);
+
+#define POWER_USB_DRD_PHY_CTRL_EN  (1  0)
+#define POWER_USB_DRD_PHY_CTRL_DISABLE (0  0)
+
 void set_dp_phy_ctrl(unsigned int enable);
 
 #define EXYNOS_DP_PHY_ENABLE   (1  0)
-- 
1.7.6.5

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


[U-Boot] [PATCH v3 07/10] config: arm: exynos5250: Define CONFIG_SYS_CACHELINE_SIZE

2013-09-14 Thread Vivek Gautam
XHCI stack driver needs this to align buffers to
CacheLine boundary. So define the same to be '64'

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Cc: Julius Werner jwer...@chromium.org
Cc: Simon Glass s...@chromium.org
Cc: Minkyu Kang mk7.k...@samsung.com
Cc: Dan Murphy dmur...@ti.com
Cc: Marek Vasut ma...@denx.de
---

Changes since v2:
 - Nothing

 include/configs/exynos5250-dt.h |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/configs/exynos5250-dt.h b/include/configs/exynos5250-dt.h
index 8f8f85f..86d57e3 100644
--- a/include/configs/exynos5250-dt.h
+++ b/include/configs/exynos5250-dt.h
@@ -37,6 +37,8 @@
 /* Keep L2 Cache Disabled */
 #define CONFIG_SYS_DCACHE_OFF
 
+#define CONFIG_SYS_CACHELINE_SIZE  64
+
 /* Enable ACE acceleration for SHA1 and SHA256 */
 #define CONFIG_EXYNOS_ACE_SHA
 #define CONFIG_SHA_HW_ACCEL
-- 
1.7.6.5

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


[U-Boot] [PATCH v3 08/10] temp: config: exynos5250: Enable xHCI support for Exynos5

2013-09-14 Thread Vivek Gautam
This enables support for xHCI host controller on Exynos5
and further disables EHCI support, to make sure only one
host controller is enabled at a time, since right now
using two controllers at a time is not possible with
current usb core infrastructure.

Anyone who wants to enable EHCI support again needs to
enable CONFIG_USB_EHCI, CONFIG_USB_EHCI_EXYNOS once again
in exynos5-dt config.

Signed-off-by: Vikas C Sajjan vikas.saj...@samsung.com
Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Cc: Julius Werner jwer...@chromium.org
Cc: Simon Glass s...@chromium.org
Cc: Minkyu Kang mk7.k...@samsung.com
Cc: Dan Murphy dmur...@ti.com
Cc: Marek Vasut ma...@denx.de
---

Changes since v2:
 - Eliminating the EHCI configs rather than just commenting them.

 include/configs/exynos5250-dt.h |5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/include/configs/exynos5250-dt.h b/include/configs/exynos5250-dt.h
index 86d57e3..e3fb519 100644
--- a/include/configs/exynos5250-dt.h
+++ b/include/configs/exynos5250-dt.h
@@ -134,8 +134,9 @@
 
 /* USB */
 #define CONFIG_CMD_USB
-#define CONFIG_USB_EHCI
-#define CONFIG_USB_EHCI_EXYNOS
+#define CONFIG_USB_XHCI
+#define CONFIG_USB_XHCI_EXYNOS
+#define CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS 2
 #define CONFIG_USB_STORAGE
 
 /* USB boot mode */
-- 
1.7.6.5

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


[U-Boot] [PATCH v3 10/10] exynos: dts: Add USB VBUS GPIOs to the device tree

2013-09-14 Thread Vivek Gautam
From: Julius Werner jwer...@chromium.org

This patch adds a new samsung,vbus-gpio parameter to the device tree, in
preparation of replacing the currently hardcoded VBUS GPIO mechanism in
exynos5-dt.c with a device tree controlled solution, just as it already
exists in the Linux kernel.

Signed-off-by: Julius Werner jwer...@chromium.org
Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Cc: Simon Glass s...@chromium.org
Cc: Minkyu Kang mk7.k...@samsung.com
Cc: Marek Vasut ma...@denx.de
---

Changes since v2:
 - This patch is newly added in this version of the series.

 board/samsung/dts/exynos5250-smdk5250.dts |4 
 board/samsung/dts/exynos5250-snow.dts |8 
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/board/samsung/dts/exynos5250-smdk5250.dts 
b/board/samsung/dts/exynos5250-smdk5250.dts
index 1e94c7f..6d6b0ba 100644
--- a/board/samsung/dts/exynos5250-smdk5250.dts
+++ b/board/samsung/dts/exynos5250-smdk5250.dts
@@ -145,4 +145,8 @@
mmc@1223 {
status = disabled;
};
+
+   ehci@1211 {
+   samsung,vbus-gpio = gpio 0xbe 0; /* X26 */
+   };
 };
diff --git a/board/samsung/dts/exynos5250-snow.dts 
b/board/samsung/dts/exynos5250-snow.dts
index 7832e4e..e023661 100644
--- a/board/samsung/dts/exynos5250-snow.dts
+++ b/board/samsung/dts/exynos5250-snow.dts
@@ -109,6 +109,14 @@
status = disabled;
};
 
+   ehci@1211 {
+   samsung,vbus-gpio = gpio 0xb1 0; /* X11 */
+   };
+
+   xhci@1200 {
+   samsung,vbus-gpio = gpio 0xbf 0; /* X27 */
+   };
+
tmu@1006 {
samsung,min-temp= 25;
samsung,max-temp= 125;
-- 
1.7.6.5

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


[U-Boot] [PATCH v3 09/10] exynos: usb: Switch USB VBUS GPIOs to be device tree configured

2013-09-14 Thread Vivek Gautam
From: Julius Werner jwer...@chromium.org

Some Exynos boards, such as the SMDK5250, control USB port power through
a GPIO pin. For now this had been hardcoded in the exynos5-dt board
file, but not all boards use the same pin, requiring local changes to
support different boards.

This patch moves the GPIO initialization into the USB host controller
drivers which they belong to, and uses the samsung,vbus-gpio parameter
in the device tree to configure it.

Signed-off-by: Julius Werner jwer...@chromium.org
Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Cc: Simon Glass s...@chromium.org
Cc: Minkyu Kang mk7.k...@samsung.com
Cc: Marek Vasut ma...@denx.de
---

Changes since v2:
 - This patch is newly added in this version of the series.

 board/samsung/smdk5250/exynos5-dt.c |   19 ---
 drivers/usb/host/ehci-exynos.c  |   11 +++
 drivers/usb/host/xhci-exynos5.c |   11 +++
 3 files changed, 22 insertions(+), 19 deletions(-)

diff --git a/board/samsung/smdk5250/exynos5-dt.c 
b/board/samsung/smdk5250/exynos5-dt.c
index bb4a82f..6bcc883 100644
--- a/board/samsung/smdk5250/exynos5-dt.c
+++ b/board/samsung/smdk5250/exynos5-dt.c
@@ -61,22 +61,6 @@ struct local_info {
 
 static struct local_info local;
 
-#ifdef CONFIG_USB_EHCI_EXYNOS
-int board_usb_vbus_init(void)
-{
-   struct exynos5_gpio_part1 *gpio1 = (struct exynos5_gpio_part1 *)
-   samsung_get_base_gpio_part1();
-
-   /* Enable VBUS power switch */
-   s5p_gpio_direction_output(gpio1-x2, 6, 1);
-
-   /* VBUS turn ON time */
-   mdelay(3);
-
-   return 0;
-}
-#endif
-
 #ifdef CONFIG_SOUND_MAX98095
 static void  board_enable_audio_codec(void)
 {
@@ -122,9 +106,6 @@ int board_init(void)
if (board_init_cros_ec_devices(gd-fdt_blob))
return -1;
 
-#ifdef CONFIG_USB_EHCI_EXYNOS
-   board_usb_vbus_init();
-#endif
 #ifdef CONFIG_SOUND_MAX98095
board_enable_audio_codec();
 #endif
diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c
index 155677e..15926c4 100644
--- a/drivers/usb/host/ehci-exynos.c
+++ b/drivers/usb/host/ehci-exynos.c
@@ -16,6 +16,7 @@
 #include asm/arch/ehci.h
 #include asm/arch/system.h
 #include asm/arch/power.h
+#include asm/gpio.h
 #include asm-generic/errno.h
 #include linux/compat.h
 #include ehci.h
@@ -30,6 +31,7 @@ DECLARE_GLOBAL_DATA_PTR;
 struct exynos_ehci {
struct exynos_usb_phy *usb;
struct ehci_hccr *hcd;
+   struct fdt_gpio_state vbus_gpio;
 };
 
 static struct exynos_ehci exynos;
@@ -58,6 +60,9 @@ static int exynos_usb_parse_dt(const void *blob, struct 
exynos_ehci *exynos)
 
exynos-hcd = (struct ehci_hccr *)addr;
 
+   /* Vbus gpio */
+   fdtdec_decode_gpio(blob, node, samsung,vbus-gpio, exynos-vbus_gpio);
+
depth = 0;
node = fdtdec_next_compatible_subnode(blob, node,
COMPAT_SAMSUNG_EXYNOS_USB_PHY, depth);
@@ -150,6 +155,12 @@ int ehci_hcd_init(int index, struct ehci_hccr **hccr, 
struct ehci_hcor **hcor)
ctx-hcd = (struct ehci_hccr *)samsung_get_base_usb_ehci();
 #endif
 
+#ifdef CONFIG_OF_CONTROL
+   /* setup the Vbus gpio here */
+   if (!fdtdec_setup_gpio(ctx-vbus_gpio))
+   gpio_direction_output(ctx-vbus_gpio.gpio, 1);
+#endif
+
setup_usb_phy(ctx-usb);
 
*hccr = ctx-hcd;
diff --git a/drivers/usb/host/xhci-exynos5.c b/drivers/usb/host/xhci-exynos5.c
index eb0ef6c..1146d10 100644
--- a/drivers/usb/host/xhci-exynos5.c
+++ b/drivers/usb/host/xhci-exynos5.c
@@ -22,6 +22,7 @@
 #include asm/arch/cpu.h
 #include asm/arch/power.h
 #include asm/arch/xhci-exynos.h
+#include asm/gpio.h
 #include asm-generic/errno.h
 #include linux/compat.h
 #include linux/usb/dwc3.h
@@ -39,6 +40,7 @@ struct exynos_xhci {
struct exynos_usb3_phy *usb3_phy;
struct xhci_hccr *hcd;
struct dwc3 *dwc3_reg;
+   struct fdt_gpio_state vbus_gpio;
 };
 
 static struct exynos_xhci exynos;
@@ -66,6 +68,9 @@ static int exynos_usb3_parse_dt(const void *blob, struct 
exynos_xhci *exynos)
}
exynos-hcd = (struct xhci_hccr *)addr;
 
+   /* Vbus gpio */
+   fdtdec_decode_gpio(blob, node, samsung,vbus-gpio, exynos-vbus_gpio);
+
depth = 0;
node = fdtdec_next_compatible_subnode(blob, node,
COMPAT_SAMSUNG_EXYNOS5_USB3_PHY, depth);
@@ -291,6 +296,12 @@ int xhci_hcd_init(int index, struct xhci_hccr **hccr, 
struct xhci_hcor **hcor)
 
ctx-dwc3_reg = (struct dwc3 *)((char *)(ctx-hcd) + DWC3_REG_OFFSET);
 
+#ifdef CONFIG_OF_CONTROL
+   /* setup the Vbus gpio here */
+   if (!fdtdec_setup_gpio(ctx-vbus_gpio))
+   gpio_direction_output(ctx-vbus_gpio.gpio, 1);
+#endif
+
ret = exynos_xhci_core_init(ctx);
if (ret) {
puts(XHCI: failed to initialize controller\n);
-- 
1.7.6.5

___
U-Boot mailing

Re: [U-Boot] [PATCH v3 00/10] USB: XHCI: Add xHCI host controller stack driver

2013-09-14 Thread Vivek Gautam
+ Marek, Dan, Julius, Simon and Vikas for this cover patch ;-)

On Sat, Sep 14, 2013 at 2:02 PM, Vivek Gautam gautam.vi...@samsung.com wrote:
 Based on 'master' branch of u-boot-usb tree.

 The series also includes patches to support xHCI on exynos5250,
 including required driver, device tree changes.

 Changes since V2:
  - Added patch to move 'bmRequestType' (Table 9-2, Ch9) definitions
from EHCI header file to usb_defs.h so that XHCI can also use it:
usb: Move 'bmRequestType' USB device request macros from EHCI header
  - Added patches to rework the Vbus GPIO setup for ehci and xhci in
exynos SoCs:
exynos: usb: Switch USB VBUS GPIOs to be device tree configured
exynos: dts: Add USB VBUS GPIOs to the device tree
  - Added the top commit history for drivers/usb/host/xhci* of Linux kernel
version 3.4 from where the xHCI code was initially imported.
  - Replaced GPL license with new SPDX license GPL-2.0+.
  - Moved this asm/io.h file inclusion to xhci.h
  - Reworked 'return -1' globally to return meaningful error numbers.
  - Added required comment in common/usb.c for not calling first get_descriptor
request for XHCI.

 Julius Werner (2):
   exynos: usb: Switch USB VBUS GPIOs to be device tree configured
   exynos: dts: Add USB VBUS GPIOs to the device tree

 Vivek Gautam (8):
   usb: Move 'bmRequestType' USB device request macros from EHCI header
   USB: xHCI: Add stack support for xHCI
   USB: XHCI: Add xHCI host controller support for Exynos5
   arm: exynos: Add methods to control power to USB 3.0 PHY
   exynos5: dts: Add COMPAT string data for USB 3.0 PHY and XHCI
   exynos5: dts: Add device node for XHCI
   config: arm: exynos5250: Define CONFIG_SYS_CACHELINE_SIZE
   temp: config: exynos5250: Enable xHCI support for Exynos5

  arch/arm/cpu/armv7/exynos/power.c  |   22 +
  arch/arm/dts/exynos5250.dtsi   |   12 +
  arch/arm/include/asm/arch-exynos/cpu.h |8 +
  arch/arm/include/asm/arch-exynos/power.h   |5 +
  arch/arm/include/asm/arch-exynos/xhci-exynos.h |   88 ++
  board/samsung/dts/exynos5250-smdk5250.dts  |4 +
  board/samsung/dts/exynos5250-snow.dts  |8 +
  board/samsung/smdk5250/exynos5-dt.c|   19 -
  common/usb.c   |   33 +-
  drivers/usb/host/Makefile  |4 +
  drivers/usb/host/ehci-exynos.c |   11 +
  drivers/usb/host/ehci.h|   16 -
  drivers/usb/host/xhci-exynos5.c|  327 ++
  drivers/usb/host/xhci-mem.c|  720 ++
  drivers/usb/host/xhci-ring.c   |  939 ++
  drivers/usb/host/xhci.c| 1030 +++
  drivers/usb/host/xhci.h| 1255 
 
  include/configs/exynos5250-dt.h|7 +-
  include/fdtdec.h   |2 +
  include/linux/usb/dwc3.h   |  188 
  include/usb.h  |9 +-
  include/usb_defs.h |   19 +
  lib/fdtdec.c   |2 +
  23 files changed, 4688 insertions(+), 40 deletions(-)
  create mode 100644 arch/arm/include/asm/arch-exynos/xhci-exynos.h
  create mode 100644 drivers/usb/host/xhci-exynos5.c
  create mode 100644 drivers/usb/host/xhci-mem.c
  create mode 100644 drivers/usb/host/xhci-ring.c
  create mode 100644 drivers/usb/host/xhci.c
  create mode 100644 drivers/usb/host/xhci.h
  create mode 100644 include/linux/usb/dwc3.h

 --
 1.7.6.5

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



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


[U-Boot] [PATCH v2 4/7] exynos5: dts: Add COMPAT string data for USB 3.0 PHY and XHCI

2013-08-21 Thread Vivek Gautam
Adding required compatible string for xHCI host controller
as well as USB 3.0 PHY to enable dt support for usb 3.0 on
exynos5.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Cc: Julius Werner jwer...@chromium.org
Cc: Simon Glass s...@chromium.org
Cc: Minkyu Kang mk7.k...@samsung.com
Cc: Dan Murphy dmur...@ti.com
Cc: Marek Vasut ma...@denx.de
---
 include/fdtdec.h |2 ++
 lib/fdtdec.c |2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/include/fdtdec.h b/include/fdtdec.h
index 6bf83bf..433d6a7 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -73,7 +73,9 @@ enum fdt_compat_id {
COMPAT_GOOGLE_CROS_EC,  /* Google CROS_EC Protocol */
COMPAT_GOOGLE_CROS_EC_KEYB, /* Google CROS_EC Keyboard */
COMPAT_SAMSUNG_EXYNOS_EHCI, /* Exynos EHCI controller */
+   COMPAT_SAMSUNG_EXYNOS5_XHCI,/* Exynos5 XHCI controller */
COMPAT_SAMSUNG_EXYNOS_USB_PHY,  /* Exynos phy controller for usb2.0 */
+   COMPAT_SAMSUNG_EXYNOS5_USB3_PHY,/* Exynos phy controller for usb3.0 */
COMPAT_SAMSUNG_EXYNOS_TMU,  /* Exynos TMU */
COMPAT_SAMSUNG_EXYNOS_FIMD, /* Exynos Display controller */
COMPAT_SAMSUNG_EXYNOS5_DP,  /* Exynos Display port controller */
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index dc35856..51fa868 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -46,7 +46,9 @@ static const char * const compat_names[COMPAT_COUNT] = {
COMPAT(GOOGLE_CROS_EC, google,cros-ec),
COMPAT(GOOGLE_CROS_EC_KEYB, google,cros-ec-keyb),
COMPAT(SAMSUNG_EXYNOS_EHCI, samsung,exynos-ehci),
+   COMPAT(SAMSUNG_EXYNOS5_XHCI, samsung,exynos5250-xhci),
COMPAT(SAMSUNG_EXYNOS_USB_PHY, samsung,exynos-usb-phy),
+   COMPAT(SAMSUNG_EXYNOS5_USB3_PHY, samsung,exynos5250-usb3-phy),
COMPAT(SAMSUNG_EXYNOS_TMU, samsung,exynos-tmu),
COMPAT(SAMSUNG_EXYNOS_FIMD, samsung,exynos-fimd),
COMPAT(SAMSUNG_EXYNOS5_DP, samsung,exynos5-dp),
-- 
1.7.6.5

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


[U-Boot] [PATCH v2 3/7] arm: exynos: Add methods to control power to USB 3.0 PHY

2013-08-21 Thread Vivek Gautam
Adding methods to turn on/off power to USB3.0 type PHY
as and when required by the controller.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Cc: Julius Werner jwer...@chromium.org
Cc: Simon Glass s...@chromium.org
Cc: Minkyu Kang mk7.k...@samsung.com
Cc: Dan Murphy dmur...@ti.com
Cc: Marek Vasut ma...@denx.de
---
 arch/arm/cpu/armv7/exynos/power.c|   22 ++
 arch/arm/include/asm/arch-exynos/power.h |5 +
 2 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/armv7/exynos/power.c 
b/arch/arm/cpu/armv7/exynos/power.c
index 517e804..563abd7 100644
--- a/arch/arm/cpu/armv7/exynos/power.c
+++ b/arch/arm/cpu/armv7/exynos/power.c
@@ -59,6 +59,28 @@ void set_usbhost_phy_ctrl(unsigned int enable)
exynos5_set_usbhost_phy_ctrl(enable);
 }
 
+static void exynos5_set_usbdrd_phy_ctrl(unsigned int enable)
+{
+   struct exynos5_power *power =
+   (struct exynos5_power *)samsung_get_base_power();
+
+   if (enable) {
+   /* Enabling USBDRD_PHY */
+   setbits_le32(power-usbdrd_phy_control,
+   POWER_USB_DRD_PHY_CTRL_EN);
+   } else {
+   /* Disabling USBDRD_PHY */
+   clrbits_le32(power-usbdrd_phy_control,
+   POWER_USB_DRD_PHY_CTRL_EN);
+   }
+}
+
+void set_usbdrd_phy_ctrl(unsigned int enable)
+{
+   if (cpu_is_exynos5())
+   exynos5_set_usbdrd_phy_ctrl(enable);
+}
+
 static void exynos5_dp_phy_control(unsigned int enable)
 {
unsigned int cfg;
diff --git a/arch/arm/include/asm/arch-exynos/power.h 
b/arch/arm/include/asm/arch-exynos/power.h
index 3241327..8db18c5 100644
--- a/arch/arm/include/asm/arch-exynos/power.h
+++ b/arch/arm/include/asm/arch-exynos/power.h
@@ -847,6 +847,11 @@ void set_hw_thermal_trip(void);
 #define POWER_USB_HOST_PHY_CTRL_EN (1  0)
 #define POWER_USB_HOST_PHY_CTRL_DISABLE(0  0)
 
+void set_usbdrd_phy_ctrl(unsigned int enable);
+
+#define POWER_USB_DRD_PHY_CTRL_EN  (1  0)
+#define POWER_USB_DRD_PHY_CTRL_DISABLE (0  0)
+
 void set_dp_phy_ctrl(unsigned int enable);
 
 #define EXYNOS_DP_PHY_ENABLE   (1  0)
-- 
1.7.6.5

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


[U-Boot] [PATCH v2 0/7] USB: XHCI: Add xHCI host controller stack driver

2013-08-21 Thread Vivek Gautam
Based on 'master' branch of u-boot-usb tree.

The series also includes patches to support xHCI on exynos5250,
including required driver, device tree changes and a temporary
config change to test things finally on smdk5250.

Changes in V2:
 - xHCI stack side, have added provision for handling transfer
   timeouts, from the patch by Julius Werner, availbale at:
   https://gerrit.chromium.org/gerrit/#/c/62307/
   But maintained a single patch for xHCI for now, since this
   being the base code version.

Rest other patches are similar to v1 of this series, only change
is the order in which patches are now arranged.

With current usb infrastructure, EHCI and XHCI won't work together,
since they both are using same function naming scheme to interact
with upper usb layers.
Marek,
   Was there any thread for device driver architecture sometime back,
   with which we could have had EHCI and XHCI working simultaneously.

Dan,
   I have posted the exynos specific patches also alongwith the
   xHCI stack, just in case someone want to test on exynos5250.
   I am still available, if you want me to change structurally how
   dwc3 and exynos stuff is covered in this series.

Vivek Gautam (7):
  USB: xHCI: Add stack support for xHCI
  USB: XHCI: Add xHCI host controller support for Exynos5
  arm: exynos: Add methods to control power to USB 3.0 PHY
  exynos5: dts: Add COMPAT string data for USB 3.0 PHY and XHCI
  exynos5: dts: Add device node for XHCI
  config: arm: exynos5250: Define CONFIG_SYS_CACHELINE_SIZE
  temp: config: exynos5250: Enable xHCI support for Exynos5

 arch/arm/cpu/armv7/exynos/power.c  |   22 +
 arch/arm/dts/exynos5250.dtsi   |   12 +
 arch/arm/include/asm/arch-exynos/cpu.h |8 +
 arch/arm/include/asm/arch-exynos/power.h   |5 +
 arch/arm/include/asm/arch-exynos/xhci-exynos.h |   90 ++
 common/usb.c   |   27 +-
 drivers/usb/host/Makefile  |4 +
 drivers/usb/host/xhci-exynos5.c|  324 ++
 drivers/usb/host/xhci-mem.c|  731 ++
 drivers/usb/host/xhci-ring.c   |  950 ++
 drivers/usb/host/xhci.c| 1040 +++
 drivers/usb/host/xhci.h| 1280 
 include/configs/exynos5250-dt.h|7 +
 include/fdtdec.h   |2 +
 include/linux/usb/dwc3.h   |  190 
 include/usb.h  |9 +-
 lib/fdtdec.c   |2 +
 17 files changed, 4700 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-exynos/xhci-exynos.h
 create mode 100644 drivers/usb/host/xhci-exynos5.c
 create mode 100644 drivers/usb/host/xhci-mem.c
 create mode 100644 drivers/usb/host/xhci-ring.c
 create mode 100644 drivers/usb/host/xhci.c
 create mode 100644 drivers/usb/host/xhci.h
 create mode 100644 include/linux/usb/dwc3.h

-- 
1.7.6.5

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


[U-Boot] [PATCH v2 6/7] config: arm: exynos5250: Define CONFIG_SYS_CACHELINE_SIZE

2013-08-21 Thread Vivek Gautam
XHCI stack driver needs this to align buffers to
CacheLine boundary. So define the same to be '64'

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Cc: Julius Werner jwer...@chromium.org
Cc: Simon Glass s...@chromium.org
Cc: Minkyu Kang mk7.k...@samsung.com
Cc: Dan Murphy dmur...@ti.com
Cc: Marek Vasut ma...@denx.de
---
 include/configs/exynos5250-dt.h |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/configs/exynos5250-dt.h b/include/configs/exynos5250-dt.h
index 8f8f85f..86d57e3 100644
--- a/include/configs/exynos5250-dt.h
+++ b/include/configs/exynos5250-dt.h
@@ -37,6 +37,8 @@
 /* Keep L2 Cache Disabled */
 #define CONFIG_SYS_DCACHE_OFF
 
+#define CONFIG_SYS_CACHELINE_SIZE  64
+
 /* Enable ACE acceleration for SHA1 and SHA256 */
 #define CONFIG_EXYNOS_ACE_SHA
 #define CONFIG_SHA_HW_ACCEL
-- 
1.7.6.5

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


[U-Boot] [PATCH v2 2/7] USB: XHCI: Add xHCI host controller support for Exynos5

2013-08-21 Thread Vivek Gautam
This adds driver layer for xHCI controller in Samsung's
exynos5 soc. This interacts with xHCI host controller stack.

Signed-off-by: Vikas C Sajjan vikas.saj...@samsung.com
Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Cc: Julius Werner jwer...@chromium.org
Cc: Simon Glass s...@chromium.org
Cc: Minkyu Kang mk7.k...@samsung.com
Cc: Dan Murphy dmur...@ti.com
Cc: Marek Vasut ma...@denx.de
---
 arch/arm/include/asm/arch-exynos/cpu.h |8 +
 arch/arm/include/asm/arch-exynos/xhci-exynos.h |   90 +++
 drivers/usb/host/Makefile  |1 +
 drivers/usb/host/xhci-exynos5.c|  324 
 include/linux/usb/dwc3.h   |  190 ++
 5 files changed, 613 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-exynos/xhci-exynos.h
 create mode 100644 drivers/usb/host/xhci-exynos5.c
 create mode 100644 include/linux/usb/dwc3.h

diff --git a/arch/arm/include/asm/arch-exynos/cpu.h 
b/arch/arm/include/asm/arch-exynos/cpu.h
index cb924fb..0d2b511 100644
--- a/arch/arm/include/asm/arch-exynos/cpu.h
+++ b/arch/arm/include/asm/arch-exynos/cpu.h
@@ -50,6 +50,8 @@
 #define EXYNOS4_SPI_ISP_BASE   DEVICE_NOT_AVAILABLE
 #define EXYNOS4_ACE_SFR_BASE   DEVICE_NOT_AVAILABLE
 #define EXYNOS4_DMC_PHY_BASE   DEVICE_NOT_AVAILABLE
+#define EXYNOS4_USB_HOST_XHCI_BASE DEVICE_NOT_AVAILABLE
+#define EXYNOS4_USB3PHY_BASE   DEVICE_NOT_AVAILABLE
 
 /* EXYNOS4X12 */
 #define EXYNOS4X12_GPIO_PART3_BASE 0x0386
@@ -85,6 +87,8 @@
 #define EXYNOS4X12_SPI_ISP_BASEDEVICE_NOT_AVAILABLE
 #define EXYNOS4X12_ACE_SFR_BASEDEVICE_NOT_AVAILABLE
 #define EXYNOS4X12_DMC_PHY_BASEDEVICE_NOT_AVAILABLE
+#define EXYNOS4X12_USB_HOST_XHCI_BASE  DEVICE_NOT_AVAILABLE
+#define EXYNOS4X12_USB3PHY_BASEDEVICE_NOT_AVAILABLE
 
 /* EXYNOS5 Common*/
 #define EXYNOS5_I2C_SPACING0x1
@@ -103,6 +107,8 @@
 #define EXYNOS5_DMC_CTRL_BASE  0x10DD
 #define EXYNOS5_GPIO_PART1_BASE0x1140
 #define EXYNOS5_MIPI_DSIM_BASE 0x11D0
+#define EXYNOS5_USB_HOST_XHCI_BASE 0x1200
+#define EXYNOS5_USB3PHY_BASE   0x1210
 #define EXYNOS5_USB_HOST_EHCI_BASE 0x1211
 #define EXYNOS5_USBPHY_BASE0x1213
 #define EXYNOS5_USBOTG_BASE0x1214
@@ -217,7 +223,9 @@ SAMSUNG_BASE(swreset, SWRESET)
 SAMSUNG_BASE(timer, PWMTIMER_BASE)
 SAMSUNG_BASE(uart, UART_BASE)
 SAMSUNG_BASE(usb_phy, USBPHY_BASE)
+SAMSUNG_BASE(usb3_phy, USB3PHY_BASE)
 SAMSUNG_BASE(usb_ehci, USB_HOST_EHCI_BASE)
+SAMSUNG_BASE(usb_xhci, USB_HOST_XHCI_BASE)
 SAMSUNG_BASE(usb_otg, USBOTG_BASE)
 SAMSUNG_BASE(watchdog, WATCHDOG_BASE)
 SAMSUNG_BASE(power, POWER_BASE)
diff --git a/arch/arm/include/asm/arch-exynos/xhci-exynos.h 
b/arch/arm/include/asm/arch-exynos/xhci-exynos.h
new file mode 100644
index 000..acbb37d
--- /dev/null
+++ b/arch/arm/include/asm/arch-exynos/xhci-exynos.h
@@ -0,0 +1,90 @@
+/* Copyright (c) 2012 Samsung Electronics Co. Ltd
+ *
+ * Exynos Phy register definitions
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _ASM_ARCH_XHCI_EXYNOS_H_
+#define _ASM_ARCH_XHCI_EXYNOS_H_
+
+/* Phy register MACRO definitions */
+
+#define LINKSYSTEM_FLADJ_MASK  (0x3f  1)
+#define LINKSYSTEM_FLADJ(_x)   ((_x)  1)
+#define LINKSYSTEM_XHCI_VERSION_CONTROL(0x1  27)
+
+#define PHYUTMI_OTGDISABLE (1  6)
+#define PHYUTMI_FORCESUSPEND   (1  1)
+#define PHYUTMI_FORCESLEEP (1  0)
+
+#define PHYCLKRST_SSC_REFCLKSEL_MASK   (0xff  23)
+#define PHYCLKRST_SSC_REFCLKSEL(_x)((_x)  23)
+
+#define PHYCLKRST_SSC_RANGE_MASK   (0x03  21)
+#define PHYCLKRST_SSC_RANGE(_x)((_x)  21)
+
+#define PHYCLKRST_SSC_EN   (0x1  20)
+#define PHYCLKRST_REF_SSP_EN   (0x1  19)
+#define PHYCLKRST_REF_CLKDIV2  (0x1  18)
+
+#define PHYCLKRST_MPLL_MULTIPLIER_MASK (0x7f  11)
+#define PHYCLKRST_MPLL_MULTIPLIER_100MHZ_REF   (0x19  11)
+#define PHYCLKRST_MPLL_MULTIPLIER_50M_REF  (0x02  11)
+#define PHYCLKRST_MPLL_MULTIPLIER_24MHZ_REF(0x68  11)
+#define PHYCLKRST_MPLL_MULTIPLIER_20MHZ_REF(0x7d  11)
+#define PHYCLKRST_MPLL_MULTIPLIER_19200KHZ_REF (0x02  11)
+
+#define PHYCLKRST_FSEL_MASK(0x3f  5)
+#define PHYCLKRST_FSEL(_x) ((_x)  5)
+#define PHYCLKRST_FSEL_PAD_100MHZ  (0x27  5)
+#define PHYCLKRST_FSEL_PAD_24MHZ   (0x2a  5)
+#define PHYCLKRST_FSEL_PAD_20MHZ   (0x31  5)
+#define PHYCLKRST_FSEL_PAD_19_2MHZ (0x38  5)
+
+#define PHYCLKRST_RETENABLEN   (0x1  4)
+
+#define

[U-Boot] [PATCH v2 7/7] temp: config: exynos5250: Enable xHCI support for Exynos5

2013-08-21 Thread Vivek Gautam
This enables support for xHCI host controller on Exynos5
and further disables EHCI support, to make sure only one
host controller is enabled at a time.

Signed-off-by: Vikas C Sajjan vikas.saj...@samsung.com
Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Cc: Julius Werner jwer...@chromium.org
Cc: Simon Glass s...@chromium.org
Cc: Minkyu Kang mk7.k...@samsung.com
Cc: Dan Murphy dmur...@ti.com
Cc: Marek Vasut ma...@denx.de
---

This is just a temporary patch, wherein we can clearly see that,
we are disabling support for EHCI and XHCI. Right now EHCI and
XHCI don't go together, since they both have same function naming
scheme to interact with usb core layer.

 include/configs/exynos5250-dt.h |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/include/configs/exynos5250-dt.h b/include/configs/exynos5250-dt.h
index 86d57e3..6cc7c12 100644
--- a/include/configs/exynos5250-dt.h
+++ b/include/configs/exynos5250-dt.h
@@ -134,8 +134,13 @@
 
 /* USB */
 #define CONFIG_CMD_USB
+/*
 #define CONFIG_USB_EHCI
 #define CONFIG_USB_EHCI_EXYNOS
+*/
+#define CONFIG_USB_XHCI
+#define CONFIG_USB_XHCI_EXYNOS
+#define CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS 2
 #define CONFIG_USB_STORAGE
 
 /* USB boot mode */
-- 
1.7.6.5

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


[U-Boot] [PATCH v2 5/7] exynos5: dts: Add device node for XHCI

2013-08-21 Thread Vivek Gautam
Adding device node for xhci host controller to enable
usb 3.0 on exynos5250.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Cc: Julius Werner jwer...@chromium.org
Cc: Simon Glass s...@chromium.org
Cc: Minkyu Kang mk7.k...@samsung.com
Cc: Dan Murphy dmur...@ti.com
Cc: Marek Vasut ma...@denx.de
---
 arch/arm/dts/exynos5250.dtsi |   12 
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/arch/arm/dts/exynos5250.dtsi b/arch/arm/dts/exynos5250.dtsi
index 4fff5e3..57be6a7 100644
--- a/arch/arm/dts/exynos5250.dtsi
+++ b/arch/arm/dts/exynos5250.dtsi
@@ -139,6 +139,18 @@
interrupts = 0 130 0;
};
 
+   xhci@1200 {
+   compatible = samsung,exynos5250-xhci;
+   reg = 0x1200 0x1;
+   #address-cells = 1;
+   #size-cells = 1;
+
+   phy {
+   compatible = samsung,exynos5250-usb3-phy;
+   reg = 0x1210 0x100;
+   };
+   };
+
ehci@1211 {
compatible = samsung,exynos-ehci;
reg = 0x1211 0x100;
-- 
1.7.6.5

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


Re: [U-Boot] [PATCH 0/7] USB: XHCI: Add xHCI host controller stack driver

2013-07-31 Thread Vivek Gautam
Hi Dan,


On Wed, Jul 31, 2013 at 6:31 PM, Dan Murphy dmur...@ti.com wrote:
 Vivek
 On 07/02/2013 07:59 AM, Vivek Gautam wrote:
 This change adds necessary xHCI host controller stack layer.
 This stack will eventually interact with SoC specific USB 3.0
 controller drivers to enable USB 3.0 support on different boards.

 Based on 'master' branch of u-boot-usb tree.

 The series also includes patches to support xHCI on exynos5250,
 including required driver, device tree changes and a temporary
 config change to test things finally on smdk5250.

 Vivek Gautam (7):
   arm: exynos5250: Define CONFIG_SYS_CACHELINE_SIZE
   USB: xHCI: Add stack support for xHCI
   USB: XHCI: Add xHCI host controller support for Exynos5
   arm: exynos: Add methods to control power to USB 3.0 PHY
   exynos5: dts: Add COMPAT string data for USB 3.0 PHY and XHCI
   exynos5: dts: Add device node for XHCI
   temp: ARM: EXYNOS5: Enable xHCI support for Exynos5

  arch/arm/cpu/armv7/exynos/power.c  |   22 +
  arch/arm/dts/exynos5250.dtsi   |   12 +
  arch/arm/include/asm/arch-exynos/cpu.h |8 +
  arch/arm/include/asm/arch-exynos/power.h   |5 +
  arch/arm/include/asm/arch-exynos/xhci-exynos.h |   90 ++
  common/usb.c   |   27 +-
  drivers/usb/host/Makefile  |4 +
  drivers/usb/host/xhci-exynos5.c|  324 ++
  drivers/usb/host/xhci-mem.c|  731 ++
  drivers/usb/host/xhci-ring.c   |  899 +
  drivers/usb/host/xhci.c| 1040 +++
  drivers/usb/host/xhci.h| 1281 
 
  include/configs/exynos5250-dt.h|7 +
  include/fdtdec.h   |2 +
  include/linux/usb/dwc3.h   |  190 
  include/usb.h  |9 +-
  lib/fdtdec.c   |2 +
  17 files changed, 4650 insertions(+), 3 deletions(-)
  create mode 100644 arch/arm/include/asm/arch-exynos/xhci-exynos.h
  create mode 100644 drivers/usb/host/xhci-exynos5.c
  create mode 100644 drivers/usb/host/xhci-mem.c
  create mode 100644 drivers/usb/host/xhci-ring.c
  create mode 100644 drivers/usb/host/xhci.c
  create mode 100644 drivers/usb/host/xhci.h
  create mode 100644 include/linux/usb/dwc3.h


 Did you have an updated patch set for the xHCI code?

At this point of time, we would have one or two fixes on top of this
version of patches for xHCI.
I can post those patches patches based on this series, so that you can
just pick up those. But they are
more of some BUG case handling and all.


 I have a working implementation on top of this patchset for the OMAP5 device.

Great!! so may be once you are ready you can post, and i can add the
exynos part to the dwc3 and test things at my end.


 So we probably should go with this patch set instead of trying to back port 
 the full xHCI stack from the kernel.

Cool.


 Dan

 --
 --
 Dan Murphy

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



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


Re: [U-Boot] Regression due to 020bbcb usb: hub: Power-cycle on root-hub ports

2013-07-09 Thread Vivek Gautam
On Tue, Jul 9, 2013 at 1:23 AM, Stephen Warren swar...@wwwdotorg.org wrote:
 On 07/08/2013 01:50 PM, Marek Vasut wrote:
 Dear Stephen Warren,

 [...]

 I had already tested the commit in your tree right before the reverts
 (a36466c50b1b3614c3cfdae194227f7dd8e2c592); that's how I noticed that
 the reverts weren't necessary, since I'd expected that commit to fail
 but it didn't.

Good to hear that things are working now. :-)
Sorry, i missed to notice that patch from Simon, i should have caught
that earlier on u-boot-usb/master.


 So we are now all good? Ready for release, no problems anywhere?

 As far as I know, yes.

 (Although I haven't tested u-boot/master recently, but anyway)



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


Re: [U-Boot] Regression due to 020bbcb usb: hub: Power-cycle on root-hub ports

2013-07-08 Thread Vivek Gautam
Hi Marek,


On Mon, Jul 8, 2013 at 6:33 PM, Marek Vasut ma...@denx.de wrote:
 Hi guys,

 On Mon, Jul 1, 2013 at 10:11 PM, Stephen Warren swar...@wwwdotorg.org 
 wrote:
  On 07/01/2013 07:49 AM, Vivek Gautam wrote:
  Hi Marek,
 
  On Sun, Jun 30, 2013 at 10:08 PM, Marek Vasut ma...@denx.de wrote:
  Dear Stephen Warren,
 
  (Sorry to those on to/cc; I'm resending this so it goes to the correct
  mailing list)
 
  Dear Stephen,
  sorry for the delay in responding to this.
 
  Commit 020bbcb usb: hub: Power-cycle on root-hub ports causes a
  regression on Tegra systems.
 
  The first time usb start is executed, it appears to work correctly.
  However, any subsequent time it is executed, it takes a long time, and
  eventually fails to find any USB devices.
 
  This situation can happen quite often; for example, if the user
  forgets to plug in a USB device before booting, runs usb start,
  realizes that, then plugs it in and runs usb start again. This is
  compounded on at least one of the Tegra boards, since CONFIG_PREBOOT
  is set to usb start on systems (laptops/clamshells) which have
  built-in USB keyboards.
 
  If I simply revert this patch, then everything works again. (Yes,
  reverting requires fixing a small merge conflict.)
 
  Do you have any idea what the problem can be? I'm tempted to simply
  ask for the patch to be reverted since it causes a regression.
 
  Thanks for any idea how to fix this!
 
  BUMP? Vivek, any ideas? Otherwise I'm reverting this.
 
  ...
 
  There's one BUG that i could see in  0bf796f  commit.
  Now that we parallelized the sequence to power cycle ports, so if
  get_port_status for any port failed,
  it returns from hub_power_on() and not power-on any of the port.
 
  Below is the change i suggest.
 
  ...
 
  can you please confirm if you problem is related to this BUG in the
  sequence of power-cycling the ports.
 
  I applied that change, and it does not solve the problem on Tegra, nor
  do I see any of the messages that were changed from debug to printf.
  Below is the log:
 
  U-Boot 2013.04-00281-g0e8ef51 (Jul 01 2013 - 10:33:36)
 
  TEGRA20
  Board: NVIDIA Seaboard
  DRAM:  1 GiB
  NAND:  512 MiB
  MMC:   Tegra SD/MMC: 0, Tegra SD/MMC: 1
  In:tegra-kbc
  Out:   lcd
  Err:   lcd
  Net:   Net Initialization Skipped
  No ethernet found.
  (Re)start USB...
  USB0:   USB EHCI 1.00
  scanning bus 0 for devices... 2 USB Device(s) found
  USB1:   USB EHCI 1.00
  scanning bus 1 for devices... 2 USB Device(s) found
  USB2:   lowlevel init failed
 
 scanning usb for storage devices... 0 Storage Device(s) found
 scanning usb for ethernet devices...
 
  Warning: asx0 using MAC address from net device
  1 Ethernet Device(s) found
  Hit any key to stop autoboot:  0
 
 
  Tegra20 (SeaBoard) # usb start
  (Re)start USB...
  USB0:   USB EHCI 1.00
  scanning bus 0 for devices... 2 USB Device(s) found
  USB1:   USB EHCI 1.00
  scanning bus 1 for devices... 1 USB Device(s) found
 
  (there's a much longer pause when scanning this bus every time except
  the very first)

 This long pause could be from the 10sec delay present in
 common/usb_hub.c: usb_hub_configure(): line 475
 (the do-while loop present to check Current Connect Status and Connect
 Status Change bits)

 I could actually see somewhat similar issue of long pause on xHCI
 port, if we didn't apply patches:
 0bf796f usb: hub: Parallelize power-cycling of root-hub ports
 020bbcb usb: hub: Power-cycle on root-hub ports

 This was because, once usb_hub_power_on() was called, Connect Status
 Change bit of xHC port was
 getting cleared though Current Connect Status was still asserted, even
 untill that no code handles that bit.

 For xHC, setting the Port_power bit, in case that bit was initially
 asserted clears CSC bit.

  USB2:   lowlevel init failed
 
 scanning usb for storage devices... 0 Storage Device(s) found
 scanning usb for ethernet devices... 0 Ethernet Device(s) found
 
  Tegra20 (SeaBoard) # usb start
  (Re)start USB...
  USB0:   USB EHCI 1.00
  scanning bus 0 for devices... 2 USB Device(s) found
  USB1:   USB EHCI 1.00
  scanning bus 1 for devices... 1 USB Device(s) found
  USB2:   lowlevel init failed
 
 scanning usb for storage devices... 0 Storage Device(s) found
 scanning usb for ethernet devices... 0 Ethernet Device(s) found

 I think we should be checking EHCI registers now, PORTSC register to
 be specific to see how the
 port power is getting affected.
 On smdk5250 i am unable see this behavior, which is having only one
 controller unlike
 seaboard which i can see has 3 controllers.

 Vivek, what do I have to revert to fix this flub? I will do that now, since 
 this
 discussion is stalled.

0bf796f usb: hub: Parallelize power-cycling of root-hub ports
020bbcb usb: hub: Power-cycle on root-hub ports

Above two patches are the one which changed the hub_power_on() functionality.
If Stephen can confirm that reverting these patches really solves the
problem

Re: [U-Boot] [PATCH 0/7] USB: XHCI: Add xHCI host controller stack driver

2013-07-03 Thread Vivek Gautam
Hi Marek,


On Wed, Jul 3, 2013 at 2:57 AM, Marek Vasut ma...@denx.de wrote:
 Dear Dan Murphy,

 Vivek

 On 07/02/2013 07:59 AM, Vivek Gautam wrote:
  This change adds necessary xHCI host controller stack layer.
  This stack will eventually interact with SoC specific USB 3.0
  controller drivers to enable USB 3.0 support on different boards.
 
  Based on 'master' branch of u-boot-usb tree.
 
  The series also includes patches to support xHCI on exynos5250,
  including required driver, device tree changes and a temporary
  config change to test things finally on smdk5250.
 
  Vivek Gautam (7):
arm: exynos5250: Define CONFIG_SYS_CACHELINE_SIZE
USB: xHCI: Add stack support for xHCI
USB: XHCI: Add xHCI host controller support for Exynos5
arm: exynos: Add methods to control power to USB 3.0 PHY
exynos5: dts: Add COMPAT string data for USB 3.0 PHY and XHCI
exynos5: dts: Add device node for XHCI
temp: ARM: EXYNOS5: Enable xHCI support for Exynos5
 
   arch/arm/cpu/armv7/exynos/power.c  |   22 +
   arch/arm/dts/exynos5250.dtsi   |   12 +
   arch/arm/include/asm/arch-exynos/cpu.h |8 +
   arch/arm/include/asm/arch-exynos/power.h   |5 +
   arch/arm/include/asm/arch-exynos/xhci-exynos.h |   90 ++
   common/usb.c   |   27 +-
   drivers/usb/host/Makefile  |4 +
   drivers/usb/host/xhci-exynos5.c|  324 ++
   drivers/usb/host/xhci-mem.c|  731 ++
   drivers/usb/host/xhci-ring.c   |  899 +
   drivers/usb/host/xhci.c| 1040
   +++ drivers/usb/host/xhci.h|
   1281  include/configs/exynos5250-dt.h
|7 +
   include/fdtdec.h   |2 +
   include/linux/usb/dwc3.h   |  190 
   include/usb.h  |9 +-
   lib/fdtdec.c   |2 +
   17 files changed, 4650 insertions(+), 3 deletions(-)
   create mode 100644 arch/arm/include/asm/arch-exynos/xhci-exynos.h
   create mode 100644 drivers/usb/host/xhci-exynos5.c
   create mode 100644 drivers/usb/host/xhci-mem.c
   create mode 100644 drivers/usb/host/xhci-ring.c
   create mode 100644 drivers/usb/host/xhci.c
   create mode 100644 drivers/usb/host/xhci.h
   create mode 100644 include/linux/usb/dwc3.h

 I have done similar work for the DWC and xHCI back port.  We seem to have
 two different implementations.

 See my V3 patch series.  If you want the initial patch sets or v2 let me
 know. http://patchwork.ozlabs.org/patch/256451/
 http://patchwork.ozlabs.org/patch/256449/
 3/7 is waiting approval
 http://patchwork.ozlabs.org/patch/256452/
 http://patchwork.ozlabs.org/patch/256450/
 6/7 is waiting approval
 http://patchwork.ozlabs.org/patch/256453/

 Marek

 Please let us know which xHCI/DWC implementation you would like to have in
 main line.

 I'd like you two to have a discussion, of course we're not having two separate
 stacks. So far, Dans' stack looks better, since it can be nicely re-synced 
 with
 Linux and it fairy contained. On the other hand, I like how Vivek's stack is 
 so
 small in size and Vivek worked on it for a long time now, so it's already 
 fairy
 well debugged.

Very well said. I can see Dan's stack is nicely sync'ed with Linux
(with ifdef's ;-) which i am sure are going to vanish down the line)
I had a initial look at Dan's patches, which have backported DWC3 and
XHCI, but i am sure we are going to
need some amount of code to be put in usb core framework (common/usb*.c),
if we are going to enable complete xHCI (super speed) support.

For DWC3, i leave it to you, as to how much code we want to pull in.
Ofcourse my driver for exynos did some basic DWC3 initialization,
making it hard for other vendors who are using DWC3 to resuse the code.


 What I'd like to see is Vivek's version merged into Dan's version, that should
 be easy (by the looks of it) and then this combined version merged mainline.
 This should hopefully retain the easy possibility to update the USB3 code from
 Linux. It should also cut down the time it will take to get Dan's code into
 working state (since that's done in Vivek's tree already).

We can go ahead merging the two versions. But i do have few doubts
with how Dan is
structuring things.
Better i comment on his patches and clear my doubts.

Dear Dan,

Please suggest on how you are planning going ahead and merging the two
versions of xHCI stack.


 Now you can flame me to death.




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


[U-Boot] [PATCH 0/7] USB: XHCI: Add xHCI host controller stack driver

2013-07-02 Thread Vivek Gautam
This change adds necessary xHCI host controller stack layer.
This stack will eventually interact with SoC specific USB 3.0
controller drivers to enable USB 3.0 support on different boards.

Based on 'master' branch of u-boot-usb tree.

The series also includes patches to support xHCI on exynos5250,
including required driver, device tree changes and a temporary
config change to test things finally on smdk5250.

Vivek Gautam (7):
  arm: exynos5250: Define CONFIG_SYS_CACHELINE_SIZE
  USB: xHCI: Add stack support for xHCI
  USB: XHCI: Add xHCI host controller support for Exynos5
  arm: exynos: Add methods to control power to USB 3.0 PHY
  exynos5: dts: Add COMPAT string data for USB 3.0 PHY and XHCI
  exynos5: dts: Add device node for XHCI
  temp: ARM: EXYNOS5: Enable xHCI support for Exynos5

 arch/arm/cpu/armv7/exynos/power.c  |   22 +
 arch/arm/dts/exynos5250.dtsi   |   12 +
 arch/arm/include/asm/arch-exynos/cpu.h |8 +
 arch/arm/include/asm/arch-exynos/power.h   |5 +
 arch/arm/include/asm/arch-exynos/xhci-exynos.h |   90 ++
 common/usb.c   |   27 +-
 drivers/usb/host/Makefile  |4 +
 drivers/usb/host/xhci-exynos5.c|  324 ++
 drivers/usb/host/xhci-mem.c|  731 ++
 drivers/usb/host/xhci-ring.c   |  899 +
 drivers/usb/host/xhci.c| 1040 +++
 drivers/usb/host/xhci.h| 1281 
 include/configs/exynos5250-dt.h|7 +
 include/fdtdec.h   |2 +
 include/linux/usb/dwc3.h   |  190 
 include/usb.h  |9 +-
 lib/fdtdec.c   |2 +
 17 files changed, 4650 insertions(+), 3 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-exynos/xhci-exynos.h
 create mode 100644 drivers/usb/host/xhci-exynos5.c
 create mode 100644 drivers/usb/host/xhci-mem.c
 create mode 100644 drivers/usb/host/xhci-ring.c
 create mode 100644 drivers/usb/host/xhci.c
 create mode 100644 drivers/usb/host/xhci.h
 create mode 100644 include/linux/usb/dwc3.h

-- 
1.7.6.5

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


[U-Boot] [PATCH 1/7] arm: exynos5250: Define CONFIG_SYS_CACHELINE_SIZE

2013-07-02 Thread Vivek Gautam
XHCI stack driver needs this to align buffers to
CacheLine boundary. So define the same to be '64'

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Cc: Minkyu Kang mk7.k...@samsung.com
Cc: Julius Werner jwer...@chromium.org
Cc: Simon Glass s...@chromium.org
Cc: Marek Vasut ma...@denx.de
---
 include/configs/exynos5250-dt.h |2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/include/configs/exynos5250-dt.h b/include/configs/exynos5250-dt.h
index e2a096b..de76836 100644
--- a/include/configs/exynos5250-dt.h
+++ b/include/configs/exynos5250-dt.h
@@ -54,6 +54,8 @@
 /* Keep L2 Cache Disabled */
 #define CONFIG_SYS_DCACHE_OFF
 
+#define CONFIG_SYS_CACHELINE_SIZE  64
+
 /* Enable ACE acceleration for SHA1 and SHA256 */
 #define CONFIG_EXYNOS_ACE_SHA
 #define CONFIG_SHA_HW_ACCEL
-- 
1.7.6.5

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


[U-Boot] [PATCH 3/7] USB: XHCI: Add xHCI host controller support for Exynos5

2013-07-02 Thread Vivek Gautam
This adds driver layer for xHCI controller in Samsung's
exynos5 soc. This interacts with xHCI host controller stack.

Signed-off-by: Vikas C Sajjan vikas.saj...@samsung.com
Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Cc: Julius Werner jwer...@chromium.org
Cc: Simon Glass s...@chromium.org
Cc: Marek Vasut ma...@denx.de
---
 arch/arm/include/asm/arch-exynos/cpu.h |8 +
 arch/arm/include/asm/arch-exynos/xhci-exynos.h |   90 +++
 drivers/usb/host/Makefile  |1 +
 drivers/usb/host/xhci-exynos5.c|  324 
 include/linux/usb/dwc3.h   |  190 ++
 5 files changed, 613 insertions(+), 0 deletions(-)
 create mode 100644 arch/arm/include/asm/arch-exynos/xhci-exynos.h
 create mode 100644 drivers/usb/host/xhci-exynos5.c
 create mode 100644 include/linux/usb/dwc3.h

diff --git a/arch/arm/include/asm/arch-exynos/cpu.h 
b/arch/arm/include/asm/arch-exynos/cpu.h
index 1ff7642..9c3d4c2 100644
--- a/arch/arm/include/asm/arch-exynos/cpu.h
+++ b/arch/arm/include/asm/arch-exynos/cpu.h
@@ -64,6 +64,8 @@
 #define EXYNOS4_DP_BASEDEVICE_NOT_AVAILABLE
 #define EXYNOS4_SPI_ISP_BASE   DEVICE_NOT_AVAILABLE
 #define EXYNOS4_ACE_SFR_BASE   DEVICE_NOT_AVAILABLE
+#define EXYNOS4_USB_HOST_XHCI_BASE DEVICE_NOT_AVAILABLE
+#define EXYNOS4_USB3PHY_BASE   DEVICE_NOT_AVAILABLE
 
 /* EXYNOS4X12 */
 #define EXYNOS4X12_GPIO_PART3_BASE 0x0386
@@ -99,6 +101,8 @@
 #define EXYNOS4X12_SPI_BASEDEVICE_NOT_AVAILABLE
 #define EXYNOS4X12_SPI_ISP_BASEDEVICE_NOT_AVAILABLE
 #define EXYNOS4X12_ACE_SFR_BASEDEVICE_NOT_AVAILABLE
+#define EXYNOS4X12_USB_HOST_XHCI_BASE  DEVICE_NOT_AVAILABLE
+#define EXYNOS4X12_USB3PHY_BASEDEVICE_NOT_AVAILABLE
 
 /* EXYNOS5 Common*/
 #define EXYNOS5_I2C_SPACING0x1
@@ -118,6 +122,8 @@
 #define EXYNOS5_DMC_CTRL_BASE  0x10DD
 #define EXYNOS5_GPIO_PART1_BASE0x1140
 #define EXYNOS5_MIPI_DSIM_BASE 0x11D0
+#define EXYNOS5_USB_HOST_XHCI_BASE 0x1200
+#define EXYNOS5_USB3PHY_BASE   0x1210
 #define EXYNOS5_USB_HOST_EHCI_BASE 0x1211
 #define EXYNOS5_USBPHY_BASE0x1213
 #define EXYNOS5_USBOTG_BASE0x1214
@@ -232,7 +238,9 @@ SAMSUNG_BASE(swreset, SWRESET)
 SAMSUNG_BASE(timer, PWMTIMER_BASE)
 SAMSUNG_BASE(uart, UART_BASE)
 SAMSUNG_BASE(usb_phy, USBPHY_BASE)
+SAMSUNG_BASE(usb3_phy, USB3PHY_BASE)
 SAMSUNG_BASE(usb_ehci, USB_HOST_EHCI_BASE)
+SAMSUNG_BASE(usb_xhci, USB_HOST_XHCI_BASE)
 SAMSUNG_BASE(usb_otg, USBOTG_BASE)
 SAMSUNG_BASE(watchdog, WATCHDOG_BASE)
 SAMSUNG_BASE(power, POWER_BASE)
diff --git a/arch/arm/include/asm/arch-exynos/xhci-exynos.h 
b/arch/arm/include/asm/arch-exynos/xhci-exynos.h
new file mode 100644
index 000..acbb37d
--- /dev/null
+++ b/arch/arm/include/asm/arch-exynos/xhci-exynos.h
@@ -0,0 +1,90 @@
+/* Copyright (c) 2012 Samsung Electronics Co. Ltd
+ *
+ * Exynos Phy register definitions
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+#ifndef _ASM_ARCH_XHCI_EXYNOS_H_
+#define _ASM_ARCH_XHCI_EXYNOS_H_
+
+/* Phy register MACRO definitions */
+
+#define LINKSYSTEM_FLADJ_MASK  (0x3f  1)
+#define LINKSYSTEM_FLADJ(_x)   ((_x)  1)
+#define LINKSYSTEM_XHCI_VERSION_CONTROL(0x1  27)
+
+#define PHYUTMI_OTGDISABLE (1  6)
+#define PHYUTMI_FORCESUSPEND   (1  1)
+#define PHYUTMI_FORCESLEEP (1  0)
+
+#define PHYCLKRST_SSC_REFCLKSEL_MASK   (0xff  23)
+#define PHYCLKRST_SSC_REFCLKSEL(_x)((_x)  23)
+
+#define PHYCLKRST_SSC_RANGE_MASK   (0x03  21)
+#define PHYCLKRST_SSC_RANGE(_x)((_x)  21)
+
+#define PHYCLKRST_SSC_EN   (0x1  20)
+#define PHYCLKRST_REF_SSP_EN   (0x1  19)
+#define PHYCLKRST_REF_CLKDIV2  (0x1  18)
+
+#define PHYCLKRST_MPLL_MULTIPLIER_MASK (0x7f  11)
+#define PHYCLKRST_MPLL_MULTIPLIER_100MHZ_REF   (0x19  11)
+#define PHYCLKRST_MPLL_MULTIPLIER_50M_REF  (0x02  11)
+#define PHYCLKRST_MPLL_MULTIPLIER_24MHZ_REF(0x68  11)
+#define PHYCLKRST_MPLL_MULTIPLIER_20MHZ_REF(0x7d  11)
+#define PHYCLKRST_MPLL_MULTIPLIER_19200KHZ_REF (0x02  11)
+
+#define PHYCLKRST_FSEL_MASK(0x3f  5)
+#define PHYCLKRST_FSEL(_x) ((_x)  5)
+#define PHYCLKRST_FSEL_PAD_100MHZ  (0x27  5)
+#define PHYCLKRST_FSEL_PAD_24MHZ   (0x2a  5)
+#define PHYCLKRST_FSEL_PAD_20MHZ   (0x31  5)
+#define PHYCLKRST_FSEL_PAD_19_2MHZ (0x38  5)
+
+#define PHYCLKRST_RETENABLEN   (0x1  4)
+
+#define PHYCLKRST_REFCLKSEL_MASK   (0x03  2)
+#define

[U-Boot] [PATCH 4/7] arm: exynos: Add methods to control power to USB 3.0 PHY

2013-07-02 Thread Vivek Gautam
Adding methods to turn on/off power to USB3.0 type PHY
as and when required by the controller.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Cc: Julius Werner jwer...@chromium.org
Cc: Simon Glass s...@chromium.org
Cc: Marek Vasut ma...@denx.de
---
 arch/arm/cpu/armv7/exynos/power.c|   22 ++
 arch/arm/include/asm/arch-exynos/power.h |5 +
 2 files changed, 27 insertions(+), 0 deletions(-)

diff --git a/arch/arm/cpu/armv7/exynos/power.c 
b/arch/arm/cpu/armv7/exynos/power.c
index 6375a81..f5e631b 100644
--- a/arch/arm/cpu/armv7/exynos/power.c
+++ b/arch/arm/cpu/armv7/exynos/power.c
@@ -75,6 +75,28 @@ void set_usbhost_phy_ctrl(unsigned int enable)
exynos5_set_usbhost_phy_ctrl(enable);
 }
 
+static void exynos5_set_usbdrd_phy_ctrl(unsigned int enable)
+{
+   struct exynos5_power *power =
+   (struct exynos5_power *)samsung_get_base_power();
+
+   if (enable) {
+   /* Enabling USBDRD_PHY */
+   setbits_le32(power-usbdrd_phy_control,
+   POWER_USB_DRD_PHY_CTRL_EN);
+   } else {
+   /* Disabling USBDRD_PHY */
+   clrbits_le32(power-usbdrd_phy_control,
+   POWER_USB_DRD_PHY_CTRL_EN);
+   }
+}
+
+void set_usbdrd_phy_ctrl(unsigned int enable)
+{
+   if (cpu_is_exynos5())
+   exynos5_set_usbdrd_phy_ctrl(enable);
+}
+
 static void exynos5_dp_phy_control(unsigned int enable)
 {
unsigned int cfg;
diff --git a/arch/arm/include/asm/arch-exynos/power.h 
b/arch/arm/include/asm/arch-exynos/power.h
index 3549667..41db585 100644
--- a/arch/arm/include/asm/arch-exynos/power.h
+++ b/arch/arm/include/asm/arch-exynos/power.h
@@ -863,6 +863,11 @@ void set_hw_thermal_trip(void);
 #define POWER_USB_HOST_PHY_CTRL_EN (1  0)
 #define POWER_USB_HOST_PHY_CTRL_DISABLE(0  0)
 
+void set_usbdrd_phy_ctrl(unsigned int enable);
+
+#define POWER_USB_DRD_PHY_CTRL_EN  (1  0)
+#define POWER_USB_DRD_PHY_CTRL_DISABLE (0  0)
+
 void set_dp_phy_ctrl(unsigned int enable);
 
 #define EXYNOS_DP_PHY_ENABLE   (1  0)
-- 
1.7.6.5

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


[U-Boot] [PATCH 7/7] temp: ARM: EXYNOS5: Enable xHCI support for Exynos5

2013-07-02 Thread Vivek Gautam
This enables support for xHCI host controller on Exynos5
and further disables EHCI support, to make sure only one
host controller is enabled at a time.

Signed-off-by: Vikas C Sajjan vikas.saj...@samsung.com
Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Cc: Julius Werner jwer...@chromium.org
Cc: Simon Glass s...@chromium.org
Cc: Marek Vasut ma...@denx.de
---
 include/configs/exynos5250-dt.h |5 +
 1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/include/configs/exynos5250-dt.h b/include/configs/exynos5250-dt.h
index de76836..bf7bab6 100644
--- a/include/configs/exynos5250-dt.h
+++ b/include/configs/exynos5250-dt.h
@@ -150,8 +150,13 @@
 
 /* USB */
 #define CONFIG_CMD_USB
+/*
 #define CONFIG_USB_EHCI
 #define CONFIG_USB_EHCI_EXYNOS
+*/
+#define CONFIG_USB_XHCI
+#define CONFIG_USB_XHCI_EXYNOS
+#define CONFIG_SYS_USB_XHCI_MAX_ROOT_PORTS 2
 #define CONFIG_USB_STORAGE
 
 /* USB boot mode */
-- 
1.7.6.5

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


[U-Boot] [PATCH 5/7] exynos5: dts: Add COMPAT string data for USB 3.0 PHY and XHCI

2013-07-02 Thread Vivek Gautam
Adding required compatible string for xHCI host controller
as well as USB 3.0 PHY to enable dt support for usb 3.0 on
exynos5.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Cc: Julius Werner jwer...@chromium.org
Cc: Simon Glass s...@chromium.org
Cc: Marek Vasut ma...@denx.de
---
 include/fdtdec.h |2 ++
 lib/fdtdec.c |2 ++
 2 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/include/fdtdec.h b/include/fdtdec.h
index d93e102..28b426e 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -87,7 +87,9 @@ enum fdt_compat_id {
COMPAT_GOOGLE_CROS_EC,  /* Google CROS_EC Protocol */
COMPAT_GOOGLE_CROS_EC_KEYB, /* Google CROS_EC Keyboard */
COMPAT_SAMSUNG_EXYNOS_EHCI, /* Exynos EHCI controller */
+   COMPAT_SAMSUNG_EXYNOS5_XHCI,/* Exynos5 XHCI controller */
COMPAT_SAMSUNG_EXYNOS_USB_PHY,  /* Exynos phy controller for usb2.0 */
+   COMPAT_SAMSUNG_EXYNOS5_USB3_PHY,/* Exynos phy controller for usb3.0 */
COMPAT_SAMSUNG_EXYNOS_TMU,  /* Exynos TMU */
COMPAT_SAMSUNG_EXYNOS_FIMD, /* Exynos Display controller */
COMPAT_SAMSUNG_EXYNOS5_DP,  /* Exynos Display port controller */
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index b314268..e62fed0 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -60,7 +60,9 @@ static const char * const compat_names[COMPAT_COUNT] = {
COMPAT(GOOGLE_CROS_EC, google,cros-ec),
COMPAT(GOOGLE_CROS_EC_KEYB, google,cros-ec-keyb),
COMPAT(SAMSUNG_EXYNOS_EHCI, samsung,exynos-ehci),
+   COMPAT(SAMSUNG_EXYNOS5_XHCI, samsung,exynos5250-xhci),
COMPAT(SAMSUNG_EXYNOS_USB_PHY, samsung,exynos-usb-phy),
+   COMPAT(SAMSUNG_EXYNOS5_USB3_PHY, samsung,exynos5250-usb3-phy),
COMPAT(SAMSUNG_EXYNOS_TMU, samsung,exynos-tmu),
COMPAT(SAMSUNG_EXYNOS_FIMD, samsung,exynos-fimd),
COMPAT(SAMSUNG_EXYNOS5_DP, samsung,exynos5-dp),
-- 
1.7.6.5

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


[U-Boot] [PATCH 6/7] exynos5: dts: Add device node for XHCI

2013-07-02 Thread Vivek Gautam
Adding device node for xhci host controller to enable
usb 3.0 on exynos5250.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Cc: Julius Werner jwer...@chromium.org
Cc: Simon Glass s...@chromium.org
Cc: Marek Vasut ma...@denx.de
---
 arch/arm/dts/exynos5250.dtsi |   12 
 1 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/arch/arm/dts/exynos5250.dtsi b/arch/arm/dts/exynos5250.dtsi
index 2d6dfff..b6a247a 100644
--- a/arch/arm/dts/exynos5250.dtsi
+++ b/arch/arm/dts/exynos5250.dtsi
@@ -139,6 +139,18 @@
interrupts = 0 130 0;
};
 
+   xhci@1200 {
+   compatible = samsung,exynos5250-xhci;
+   reg = 0x1200 0x1;
+   #address-cells = 1;
+   #size-cells = 1;
+
+   phy {
+   compatible = samsung,exynos5250-usb3-phy;
+   reg = 0x1210 0x100;
+   };
+   };
+
ehci@1211 {
compatible = samsung,exynos-ehci;
reg = 0x1211 0x100;
-- 
1.7.6.5

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


Re: [U-Boot] Regression due to 020bbcb usb: hub: Power-cycle on root-hub ports

2013-07-02 Thread Vivek Gautam
On Mon, Jul 1, 2013 at 10:11 PM, Stephen Warren swar...@wwwdotorg.org wrote:
 On 07/01/2013 07:49 AM, Vivek Gautam wrote:
 Hi Marek,


 On Sun, Jun 30, 2013 at 10:08 PM, Marek Vasut ma...@denx.de wrote:
 Dear Stephen Warren,

 (Sorry to those on to/cc; I'm resending this so it goes to the correct
 mailing list)

 Dear Stephen,
 sorry for the delay in responding to this.


 Commit 020bbcb usb: hub: Power-cycle on root-hub ports causes a
 regression on Tegra systems.

 The first time usb start is executed, it appears to work correctly.
 However, any subsequent time it is executed, it takes a long time, and
 eventually fails to find any USB devices.

 This situation can happen quite often; for example, if the user forgets
 to plug in a USB device before booting, runs usb start, realizes that,
 then plugs it in and runs usb start again. This is compounded on at
 least one of the Tegra boards, since CONFIG_PREBOOT is set to usb
 start on systems (laptops/clamshells) which have built-in USB keyboards.

 If I simply revert this patch, then everything works again. (Yes,
 reverting requires fixing a small merge conflict.)

 Do you have any idea what the problem can be? I'm tempted to simply ask
 for the patch to be reverted since it causes a regression.

 Thanks for any idea how to fix this!

 BUMP? Vivek, any ideas? Otherwise I'm reverting this.
 ...
 There's one BUG that i could see in  0bf796f  commit.
 Now that we parallelized the sequence to power cycle ports, so if
 get_port_status for any port failed,
 it returns from hub_power_on() and not power-on any of the port.

 Below is the change i suggest.
 ...
 can you please confirm if you problem is related to this BUG in the
 sequence of power-cycling the ports.

 I applied that change, and it does not solve the problem on Tegra, nor
 do I see any of the messages that were changed from debug to printf.
 Below is the log:

 U-Boot 2013.04-00281-g0e8ef51 (Jul 01 2013 - 10:33:36)

 TEGRA20
 Board: NVIDIA Seaboard
 DRAM:  1 GiB
 NAND:  512 MiB
 MMC:   Tegra SD/MMC: 0, Tegra SD/MMC: 1
 In:tegra-kbc
 Out:   lcd
 Err:   lcd
 Net:   Net Initialization Skipped
 No ethernet found.
 (Re)start USB...
 USB0:   USB EHCI 1.00
 scanning bus 0 for devices... 2 USB Device(s) found
 USB1:   USB EHCI 1.00
 scanning bus 1 for devices... 2 USB Device(s) found
 USB2:   lowlevel init failed
scanning usb for storage devices... 0 Storage Device(s) found
scanning usb for ethernet devices...
 Warning: asx0 using MAC address from net device
 1 Ethernet Device(s) found
 Hit any key to stop autoboot:  0


 Tegra20 (SeaBoard) # usb start
 (Re)start USB...
 USB0:   USB EHCI 1.00
 scanning bus 0 for devices... 2 USB Device(s) found
 USB1:   USB EHCI 1.00
 scanning bus 1 for devices... 1 USB Device(s) found

 (there's a much longer pause when scanning this bus every time except
 the very first)

This long pause could be from the 10sec delay present in
common/usb_hub.c: usb_hub_configure(): line 475
(the do-while loop present to check Current Connect Status and Connect
Status Change bits)

I could actually see somewhat similar issue of long pause on xHCI
port, if we didn't apply patches:
0bf796f usb: hub: Parallelize power-cycling of root-hub ports
020bbcb usb: hub: Power-cycle on root-hub ports

This was because, once usb_hub_power_on() was called, Connect Status
Change bit of xHC port was
getting cleared though Current Connect Status was still asserted, even
untill that no code handles that bit.

For xHC, setting the Port_power bit, in case that bit was initially
asserted clears CSC bit.


 USB2:   lowlevel init failed
scanning usb for storage devices... 0 Storage Device(s) found
scanning usb for ethernet devices... 0 Ethernet Device(s) found


 Tegra20 (SeaBoard) # usb start
 (Re)start USB...
 USB0:   USB EHCI 1.00
 scanning bus 0 for devices... 2 USB Device(s) found
 USB1:   USB EHCI 1.00
 scanning bus 1 for devices... 1 USB Device(s) found
 USB2:   lowlevel init failed
scanning usb for storage devices... 0 Storage Device(s) found
scanning usb for ethernet devices... 0 Ethernet Device(s) found

I think we should be checking EHCI registers now, PORTSC register to
be specific to see how the
port power is getting affected.
On smdk5250 i am unable see this behavior, which is having only one
controller unlike
seaboard which i can see has 3 controllers.



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


Re: [U-Boot] Regression due to 020bbcb usb: hub: Power-cycle on root-hub ports

2013-07-01 Thread Vivek Gautam
Hi Marek,


On Sun, Jun 30, 2013 at 10:08 PM, Marek Vasut ma...@denx.de wrote:
 Dear Stephen Warren,

 (Sorry to those on to/cc; I'm resending this so it goes to the correct
 mailing list)

Dear Stephen,
sorry for the delay in responding to this.


 Commit 020bbcb usb: hub: Power-cycle on root-hub ports causes a
 regression on Tegra systems.

 The first time usb start is executed, it appears to work correctly.
 However, any subsequent time it is executed, it takes a long time, and
 eventually fails to find any USB devices.

 This situation can happen quite often; for example, if the user forgets
 to plug in a USB device before booting, runs usb start, realizes that,
 then plugs it in and runs usb start again. This is compounded on at
 least one of the Tegra boards, since CONFIG_PREBOOT is set to usb
 start on systems (laptops/clamshells) which have built-in USB keyboards.

 If I simply revert this patch, then everything works again. (Yes,
 reverting requires fixing a small merge conflict.)

 Do you have any idea what the problem can be? I'm tempted to simply ask
 for the patch to be reverted since it causes a regression.

 Thanks for any idea how to fix this!

 BUMP? Vivek, any ideas? Otherwise I'm reverting this.

Tried this at my end on smdk5250 board, and since we have 3 ports on
EHCI (which we haven't defined in 5250's config --
CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS);
the issue was very much reproducible.

For this following commits should be under scan:
0bf796f usb: hub: Parallelize power-cycling of root-hub ports
020bbcb usb: hub: Power-cycle on root-hub ports

There's one BUG that i could see in  0bf796f  commit.
Now that we parallelized the sequence to power cycle ports, so if
get_port_status for any port failed,
it returns from hub_power_on() and not power-on any of the port.

Below is the change i suggest.

diff --git a/common/usb_hub.c b/common/usb_hub.c
index 774ba63..437a51f 100644
--- a/common/usb_hub.c
+++ b/common/usb_hub.c
@@ -127,7 +127,7 @@ static void usb_hub_power_on(struct usb_hub_device *hub)
for (i = 0; i  dev-maxchild; i++) {
ret = usb_get_port_status(dev, i + 1, portsts);
if (ret  0) {
-   debug(port %d: get_port_status failed\n, i + 1);
+   printf(port %d: get_port_status failed\n, i + 1);
return;
}

@@ -142,12 +142,10 @@ static void usb_hub_power_on(struct usb_hub_device *hub)
 */
portstatus = le16_to_cpu(portsts-wPortStatus);
if (portstatus  (USB_PORT_STAT_POWER  1)) {
-   debug(port %d: Port power change failed\n, i + 1);
+   printf(port %d: Port power change failed\n, i + 1);
return;
}
-   }

-   for (i = 0; i  dev-maxchild; i++) {
usb_set_port_feature(dev, i + 1, USB_PORT_FEAT_POWER);
debug(port %d returns %lX\n, i + 1, dev-status);
}


Dear Stephen,

can you please confirm if you problem is related to this BUG in the
sequence of power-cycling the ports.

With this change i can see that USB 2.0 does not detect attached
device for the first time we give 'usb start',
but subsequently every time it comes and detects the device.
But similar behavior is observed when i revert both of above mentioned
commits, so this i should look into.



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


[U-Boot] [PATCH 1/2] usb: Use get_unaligned() in usb_endpoint_maxp() for wMaxPacketSize

2013-05-13 Thread Vivek Gautam
Use unaligned access to fetch wMaxPacketSize in usb_endpoint_maxp()
api.
In its absence we see following data abort message:
==
data abort

MAYBE you should read doc/README.arm-unaligned-accesses

pc : [bf794e24]  lr : [bf794e1c]
sp : bf37c7b0  ip : 002f fp : 
r10:   r9 : 0002 r8 : bf37fecc
r7 : 0001  r6 : bf7d8931 r5 : bf7d891c  r4 : bf7d8800
r3 : bf7d65b0  r2 : 0002 r1 : bf7d65b4  r0 : 0027
Flags: nZCv  IRQs off  FIQs off  Mode SVC_32
Resetting CPU ...

resetting ...
==

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Cc: Ilya Yanok ilya.ya...@cogentembedded.com
Cc: Marek Vasut ma...@denx.de
---

Based on u-boot-usb/next. Tested with 'u-boot-usb/master' branch.

 include/linux/usb/ch9.h |3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h
index d1d732c..bd48704 100644
--- a/include/linux/usb/ch9.h
+++ b/include/linux/usb/ch9.h
@@ -35,6 +35,7 @@
 
 #include linux/types.h   /* __u8 etc */
 #include asm/byteorder.h /* le16_to_cpu */
+#include asm/unaligned.h /* get_unaligned() */
 
 /*-*/
 
@@ -596,7 +597,7 @@ static inline int usb_endpoint_is_isoc_out(
  */
 static inline int usb_endpoint_maxp(const struct usb_endpoint_descriptor *epd)
 {
-   return __le16_to_cpu(epd-wMaxPacketSize);
+   return __le16_to_cpu(get_unaligned(epd-wMaxPacketSize));
 }
 
 static inline int usb_endpoint_interrupt_type(
-- 
1.7.6.5

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


[U-Boot] [PATCH 2/2] usb: gadget: Use unaligned access for wMaxPacketSize

2013-05-13 Thread Vivek Gautam
Use get_unaligned() while fetching wMaxPacketSize to avoid
voilating any alignment rules.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
Cc: Lukasz Majewski l.majew...@samsung.com
Cc: Piotr Wilczek p.wilc...@samsung.com
Cc: Kyungmin Park kyungmin.p...@samsung.com
Cc: Lukasz Dalek luk0...@gmail.com
Cc: Marek Vasut ma...@denx.de
---

Just did a build test on u-boot-usb/master branch.
Need to be tested further.

Based on u-boot-usb/next.

 drivers/usb/gadget/f_mass_storage.c |3 ++-
 drivers/usb/gadget/pxa25x_udc.c |   13 +++--
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/gadget/f_mass_storage.c 
b/drivers/usb/gadget/f_mass_storage.c
index c28866f..45bc132 100644
--- a/drivers/usb/gadget/f_mass_storage.c
+++ b/drivers/usb/gadget/f_mass_storage.c
@@ -2261,7 +2261,8 @@ reset:
if (rc)
goto reset;
fsg-bulk_out_enabled = 1;
-   common-bulk_out_maxpacket = le16_to_cpu(d-wMaxPacketSize);
+   common-bulk_out_maxpacket =
+   le16_to_cpu(get_unaligned(d-wMaxPacketSize));
clear_bit(IGNORE_BULK_OUT, fsg-atomic_bitflags);
 
/* Allocate the requests */
diff --git a/drivers/usb/gadget/pxa25x_udc.c b/drivers/usb/gadget/pxa25x_udc.c
index 9ce98f0..085503d 100644
--- a/drivers/usb/gadget/pxa25x_udc.c
+++ b/drivers/usb/gadget/pxa25x_udc.c
@@ -314,7 +314,8 @@ static int pxa25x_ep_enable(struct usb_ep *_ep,
if (!_ep || !desc || ep-desc || _ep-name == ep0name
|| desc-bDescriptorType != USB_DT_ENDPOINT
|| ep-bEndpointAddress != desc-bEndpointAddress
-   || ep-fifo_size  le16_to_cpu(desc-wMaxPacketSize)) {
+   || ep-fifo_size 
+  le16_to_cpu(get_unaligned(desc-wMaxPacketSize))) {
printf(%s, bad ep or descriptor\n, __func__);
return -EINVAL;
}
@@ -329,9 +330,9 @@ static int pxa25x_ep_enable(struct usb_ep *_ep,
 
/* hardware _could_ do smaller, but driver doesn't */
if ((desc-bmAttributes == USB_ENDPOINT_XFER_BULK
-le16_to_cpu(desc-wMaxPacketSize)
+le16_to_cpu(get_unaligned(desc-wMaxPacketSize))
!= BULK_FIFO_SIZE)
-   || !desc-wMaxPacketSize) {
+   || !get_unaligned(desc-wMaxPacketSize)) {
printf(%s, bad %s maxpacket\n, __func__, _ep-name);
return -ERANGE;
}
@@ -345,7 +346,7 @@ static int pxa25x_ep_enable(struct usb_ep *_ep,
ep-desc = desc;
ep-stopped = 0;
ep-pio_irqs = 0;
-   ep-ep.maxpacket = le16_to_cpu(desc-wMaxPacketSize);
+   ep-ep.maxpacket = le16_to_cpu(get_unaligned(desc-wMaxPacketSize));
 
/* flush fifo (mostly for OUT buffers) */
pxa25x_ep_fifo_flush(_ep);
@@ -485,7 +486,7 @@ write_fifo(struct pxa25x_ep *ep, struct pxa25x_request *req)
 {
unsigned max;
 
-   max = le16_to_cpu(ep-desc-wMaxPacketSize);
+   max = le16_to_cpu(get_unaligned(ep-desc-wMaxPacketSize));
do {
unsigned count;
int is_last, is_short;
@@ -766,7 +767,7 @@ pxa25x_ep_queue(struct usb_ep *_ep, struct usb_request 
*_req, gfp_t gfp_flags)
 */
if (unlikely(ep-bmAttributes == USB_ENDPOINT_XFER_ISOC
 req-req.length 
-   le16_to_cpu(ep-desc-wMaxPacketSize)))
+   le16_to_cpu(get_unaligned(ep-desc-wMaxPacketSize
return -EMSGSIZE;
 
debug_cond(NOISY, %s queue req %p, len %d buf %p\n,
-- 
1.7.6.5

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


Re: [U-Boot] [PATCH 2/2] usb: gadget: Use unaligned access for wMaxPacketSize

2013-05-13 Thread Vivek Gautam
Hi,


On Mon, May 13, 2013 at 4:20 PM, Kyungmin Park kmp...@infradead.org wrote:
 On Mon, May 13, 2013 at 7:23 PM, Vivek Gautam gautam.vi...@samsung.comwrote:

 Use get_unaligned() while fetching wMaxPacketSize to avoid
 voilating any alignment rules.

typo here s/voilating/violating



 It's another story, can we get performance gain with unaligned access
 feature? In case of kernel, we got some gains.

This change was necessary since we get data abort if we try to fetch
wMaxPacketSize
which violates the natural alignment rules being a member of struct
usb_endpoint_descriptor.

I am not sure of the performance gains with this. However, if you can
guide me how to
measure that, we can get the numbers if any.


 Anyway, good job!

Thanks !


 Acked-by: Kyungmin Park kyungmin.p...@samsung.com


 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 Cc: Lukasz Majewski l.majew...@samsung.com
 Cc: Piotr Wilczek p.wilc...@samsung.com
 Cc: Kyungmin Park kyungmin.p...@samsung.com
 Cc: Lukasz Dalek luk0...@gmail.com
 Cc: Marek Vasut ma...@denx.de
 ---

 Just did a build test on u-boot-usb/master branch.
 Need to be tested further.

 Based on u-boot-usb/next.

  drivers/usb/gadget/f_mass_storage.c |3 ++-
  drivers/usb/gadget/pxa25x_udc.c |   13 +++--
  2 files changed, 9 insertions(+), 7 deletions(-)

 diff --git a/drivers/usb/gadget/f_mass_storage.c
 b/drivers/usb/gadget/f_mass_storage.c
 index c28866f..45bc132 100644
 --- a/drivers/usb/gadget/f_mass_storage.c
 +++ b/drivers/usb/gadget/f_mass_storage.c
 @@ -2261,7 +2261,8 @@ reset:
 if (rc)
 goto reset;
 fsg-bulk_out_enabled = 1;
 -   common-bulk_out_maxpacket = le16_to_cpu(d-wMaxPacketSize);
 +   common-bulk_out_maxpacket =
 +
 le16_to_cpu(get_unaligned(d-wMaxPacketSize));
 clear_bit(IGNORE_BULK_OUT, fsg-atomic_bitflags);

 /* Allocate the requests */
 diff --git a/drivers/usb/gadget/pxa25x_udc.c
 b/drivers/usb/gadget/pxa25x_udc.c
 index 9ce98f0..085503d 100644
 --- a/drivers/usb/gadget/pxa25x_udc.c
 +++ b/drivers/usb/gadget/pxa25x_udc.c
 @@ -314,7 +314,8 @@ static int pxa25x_ep_enable(struct usb_ep *_ep,
 if (!_ep || !desc || ep-desc || _ep-name == ep0name
 || desc-bDescriptorType != USB_DT_ENDPOINT
 || ep-bEndpointAddress != desc-bEndpointAddress
 -   || ep-fifo_size 
 le16_to_cpu(desc-wMaxPacketSize)) {
 +   || ep-fifo_size 
 +
  le16_to_cpu(get_unaligned(desc-wMaxPacketSize))) {
 printf(%s, bad ep or descriptor\n, __func__);
 return -EINVAL;
 }
 @@ -329,9 +330,9 @@ static int pxa25x_ep_enable(struct usb_ep *_ep,

 /* hardware _could_ do smaller, but driver doesn't */
 if ((desc-bmAttributes == USB_ENDPOINT_XFER_BULK
 -le16_to_cpu(desc-wMaxPacketSize)
 +   
 le16_to_cpu(get_unaligned(desc-wMaxPacketSize))
 != BULK_FIFO_SIZE)
 -   || !desc-wMaxPacketSize) {
 +   || !get_unaligned(desc-wMaxPacketSize)) {
 printf(%s, bad %s maxpacket\n, __func__, _ep-name);
 return -ERANGE;
 }
 @@ -345,7 +346,7 @@ static int pxa25x_ep_enable(struct usb_ep *_ep,
 ep-desc = desc;
 ep-stopped = 0;
 ep-pio_irqs = 0;
 -   ep-ep.maxpacket = le16_to_cpu(desc-wMaxPacketSize);
 +   ep-ep.maxpacket =
 le16_to_cpu(get_unaligned(desc-wMaxPacketSize));

 /* flush fifo (mostly for OUT buffers) */
 pxa25x_ep_fifo_flush(_ep);
 @@ -485,7 +486,7 @@ write_fifo(struct pxa25x_ep *ep, struct pxa25x_request
 *req)
  {
 unsigned max;

 -   max = le16_to_cpu(ep-desc-wMaxPacketSize);
 +   max = le16_to_cpu(get_unaligned(ep-desc-wMaxPacketSize));
 do {
 unsigned count;
 int is_last, is_short;
 @@ -766,7 +767,7 @@ pxa25x_ep_queue(struct usb_ep *_ep, struct usb_request
 *_req, gfp_t gfp_flags)
  */
 if (unlikely(ep-bmAttributes == USB_ENDPOINT_XFER_ISOC
  req-req.length 
 -   le16_to_cpu(ep-desc-wMaxPacketSize)))
 +
 le16_to_cpu(get_unaligned(ep-desc-wMaxPacketSize
 return -EMSGSIZE;

 debug_cond(NOISY, %s queue req %p, len %d buf %p\n,
 --
 1.7.6.5

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


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




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


Re: [U-Boot] [U-Boot,v3,7/8] usb: hub: Reset only usb 2.0 ports

2013-04-30 Thread Vivek Gautam
Hi Marek,


On Wed, Apr 24, 2013 at 11:38 AM, Vivek Gautam
gautamvivek1...@gmail.com wrote:
 On Wed, Apr 24, 2013 at 5:51 AM, Marek Vasut ma...@denx.de wrote:
 Dear Julius Werner,

 Sorry, forgot this one yesterday. I would consider to just drop/revert
 this patch entirely. It's not wrong, but it adds complexity where it is
 not needed. You don't have to reset SuperSpeed devices, but it shouldn't
 hurt either and from what I can tell Linux does it as well.

 Ok, I can drop this one.

We need to drop this from u-boot-usb/next branch, right ?
I am sure this is added to you to-do list, just wanted to make sure
since i could
see it in 'next' right now.
Thanks !!


 Alright, we will drop this.
 I think a possible bug related to calling xhci_port_state_to_neutral()
 in xhci_submit_root()
 (one pointed by Julius in [PATCH v3 3/8] usb: hub: Power-cycle on
 root-hub ports) was causing
 USB 3.0 protocol ports fail while resetting.
 Now things are fine.


  As per XHCI specifications USB 3.0 protocol ports attempt
  to advance to 'Enabled' state; however USB 2.0 protocol ports
  require software reset to advance them to 'Enabled' state.
  Thereby, inferring that software need to reset USB 2.0 protocol
  ports invariably (as per EHCI spec or xHCI spec).
 
  Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 
  ---
  This patch added in V3(current-version) of this patch-series.
 
   common/usb_hub.c |   23 +++
   1 files changed, 19 insertions(+), 4 deletions(-)
 
  diff --git a/common/usb_hub.c b/common/usb_hub.c
  index 1e225e6..eedbcf2 100644
  --- a/common/usb_hub.c
  +++ b/common/usb_hub.c
  @@ -233,6 +233,7 @@ void usb_hub_port_connect_change(struct usb_device
  *dev, int port)
 
  struct usb_device *usb;
  ALLOC_CACHE_ALIGN_BUFFER(struct usb_port_status, portsts, 1);
  unsigned short portstatus;
 
  +   uint32_t do_port_reset = 1;
 
  /* Check status */
  if (usb_get_port_status(dev, port + 1, portsts)  0) {
 
  @@ -246,6 +247,9 @@ void usb_hub_port_connect_change(struct usb_device
  *dev, int port)
 
le16_to_cpu(portsts-wPortChange),
portspeed(portstatus));
 
  +   if (portstatus  (1  USB_PORT_FEAT_SUPERSPEED))
  +   do_port_reset = 0;
  +
 
  /* Clear the connection change status */
  usb_clear_port_feature(dev, port + 1, USB_PORT_FEAT_C_CONNECTION);
 
  @@ -259,10 +263,21 @@ void usb_hub_port_connect_change(struct usb_device
  *dev, int port)
 
  }
  mdelay(200);
 
  -   /* Reset the port */
  -   if (hub_port_reset(dev, port, portstatus)  0) {
  -   printf(cannot reset port %i!?\n, port + 1);
  -   return;
  +   /*
  +* Reset the port:
  +* As per xHCI protocol, USB 3.0 devices do not require
  +* a port reset, however USB 2.0 device do require the same
  +* to let ports proceed to 'enabled' state
  +*
  +* XXX: Will this break EHCI ??
  +* probably not, above condition for 'do_port_reset' checks for
  +* speed, and for EHCI it can't reach Super speed anyways.
  +*/
  +   if (do_port_reset) {
  +   if (hub_port_reset(dev, port, portstatus)  0) {
  +   printf(cannot reset port %i!?\n, port + 1);
  +   return;
  +   }
 
  }
 
  mdelay(200);


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


Re: [U-Boot] [U-Boot,v3,7/8] usb: hub: Reset only usb 2.0 ports

2013-04-24 Thread Vivek Gautam
On Wed, Apr 24, 2013 at 5:51 AM, Marek Vasut ma...@denx.de wrote:
 Dear Julius Werner,

 Sorry, forgot this one yesterday. I would consider to just drop/revert
 this patch entirely. It's not wrong, but it adds complexity where it is
 not needed. You don't have to reset SuperSpeed devices, but it shouldn't
 hurt either and from what I can tell Linux does it as well.

 Ok, I can drop this one.

Alright, we will drop this.
I think a possible bug related to calling xhci_port_state_to_neutral()
in xhci_submit_root()
(one pointed by Julius in [PATCH v3 3/8] usb: hub: Power-cycle on
root-hub ports) was causing
USB 3.0 protocol ports fail while resetting.
Now things are fine.


  As per XHCI specifications USB 3.0 protocol ports attempt
  to advance to 'Enabled' state; however USB 2.0 protocol ports
  require software reset to advance them to 'Enabled' state.
  Thereby, inferring that software need to reset USB 2.0 protocol
  ports invariably (as per EHCI spec or xHCI spec).
 
  Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 
  ---
  This patch added in V3(current-version) of this patch-series.
 
   common/usb_hub.c |   23 +++
   1 files changed, 19 insertions(+), 4 deletions(-)
 
  diff --git a/common/usb_hub.c b/common/usb_hub.c
  index 1e225e6..eedbcf2 100644
  --- a/common/usb_hub.c
  +++ b/common/usb_hub.c
  @@ -233,6 +233,7 @@ void usb_hub_port_connect_change(struct usb_device
  *dev, int port)
 
  struct usb_device *usb;
  ALLOC_CACHE_ALIGN_BUFFER(struct usb_port_status, portsts, 1);
  unsigned short portstatus;
 
  +   uint32_t do_port_reset = 1;
 
  /* Check status */
  if (usb_get_port_status(dev, port + 1, portsts)  0) {
 
  @@ -246,6 +247,9 @@ void usb_hub_port_connect_change(struct usb_device
  *dev, int port)
 
le16_to_cpu(portsts-wPortChange),
portspeed(portstatus));
 
  +   if (portstatus  (1  USB_PORT_FEAT_SUPERSPEED))
  +   do_port_reset = 0;
  +
 
  /* Clear the connection change status */
  usb_clear_port_feature(dev, port + 1, USB_PORT_FEAT_C_CONNECTION);
 
  @@ -259,10 +263,21 @@ void usb_hub_port_connect_change(struct usb_device
  *dev, int port)
 
  }
  mdelay(200);
 
  -   /* Reset the port */
  -   if (hub_port_reset(dev, port, portstatus)  0) {
  -   printf(cannot reset port %i!?\n, port + 1);
  -   return;
  +   /*
  +* Reset the port:
  +* As per xHCI protocol, USB 3.0 devices do not require
  +* a port reset, however USB 2.0 device do require the same
  +* to let ports proceed to 'enabled' state
  +*
  +* XXX: Will this break EHCI ??
  +* probably not, above condition for 'do_port_reset' checks for
  +* speed, and for EHCI it can't reach Super speed anyways.
  +*/
  +   if (do_port_reset) {
  +   if (hub_port_reset(dev, port, portstatus)  0) {
  +   printf(cannot reset port %i!?\n, port + 1);
  +   return;
  +   }
 
  }
 
  mdelay(200);

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



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


Re: [U-Boot] [PATCH] usb: common: Use a global definition for 'min3'

2013-04-24 Thread Vivek Gautam
On Mon, Apr 22, 2013 at 7:15 PM, Tom Rini tr...@ti.com wrote:
 On Fri, Apr 19, 2013 at 01:29:12PM +0200, Marek Vasut wrote:
 Dear Vivek Gautam,

  We can use a common global method for calculating minimum of
  3 numbers. Put the same in 'common header' and let 'ehci'
  use it.
 
  Signed-off-by: Vivek Gautam gautam.vi...@samsung.com

 Applied, thanks

 NAK, sorry.  Lets re-sync with the kernel's min/max/min3/max3 defines
 here instead.

Alright, i shall sync the definitions with Linux kernel and send the
patch for same.




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


Re: [U-Boot] [PATCH] usb: common: Use a global definition for 'min3'

2013-04-24 Thread Vivek Gautam
Hi Marek,


On Wed, Apr 24, 2013 at 11:49 AM, Vivek Gautam
gautamvivek1...@gmail.com wrote:
 On Mon, Apr 22, 2013 at 7:15 PM, Tom Rini tr...@ti.com wrote:
 On Fri, Apr 19, 2013 at 01:29:12PM +0200, Marek Vasut wrote:
 Dear Vivek Gautam,

  We can use a common global method for calculating minimum of
  3 numbers. Put the same in 'common header' and let 'ehci'
  use it.
 
  Signed-off-by: Vivek Gautam gautam.vi...@samsung.com

 Applied, thanks

 NAK, sorry.  Lets re-sync with the kernel's min/max/min3/max3 defines
 here instead.

 Alright, i shall sync the definitions with Linux kernel and send the
 patch for same.

Will you be dropping this patch from u-boot-usb/next or shall i send a
subsequent patch on
top of this ?


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


[U-Boot] [PATCH 0/3] usb: ss: Fixes for super speed framework

2013-04-24 Thread Vivek Gautam
This patch series fixes changes for Super speed framework
which got pulled-in 'u-boot-usb/next'.
First patch fixes Port Status and Port feature macro constants,
then next patch parallelizes power-cycling of power on root-hub
ports.
3rd patch in this series also sync the min3/max3 definitions
with Linux kernel.

Based on u-boot-usb/next branch with following patch reverted:
usb: hub: Reset only usb 2.0 ports

Vivek Gautam (3):
  usb: hub: Parallelize power-cycling of root-hub ports
  usb: fix: Fixing Port status and feature number constants
  usb: common: Use a global definition for 'min3'

 common/usb_hub.c|   63 --
 drivers/usb/host/ehci-hcd.c |   10 ---
 include/common.h|   25 ++---
 include/usb_defs.h  |   39 +++---
 4 files changed, 86 insertions(+), 51 deletions(-)

-- 
1.7.6.5

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


[U-Boot] [PATCH 1/3] usb: hub: Parallelize power-cycling of root-hub ports

2013-04-24 Thread Vivek Gautam
Untill now we power-cycle (aka: disable power on a port
and re-enabling again) one port at a time.
Delay of 20ms for Port-power to change multiplies with
number of ports in this case.
So better we parallelize this process:
disable power on all ports, wait for port-power to stabilize
and then re-enable the power subsequently.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 common/usb_hub.c |   23 ++-
 1 files changed, 14 insertions(+), 9 deletions(-)

diff --git a/common/usb_hub.c b/common/usb_hub.c
index 1e225e6..dad0409 100644
--- a/common/usb_hub.c
+++ b/common/usb_hub.c
@@ -105,22 +105,25 @@ static void usb_hub_power_on(struct usb_hub_device *hub)
int ret;
 
dev = hub-pusb_dev;
-   /* Enable power to the ports */
+
+   /*
+* Enable power to the ports:
+* Here we Power-cycle the ports: aka,
+* turning them off and turning on again.
+*/
debug(enabling power on all ports\n);
for (i = 0; i  dev-maxchild; i++) {
-   /*
-* Power-cycle the ports here: aka,
-* turning them off and turning on again.
-*/
usb_clear_port_feature(dev, i + 1, USB_PORT_FEAT_POWER);
debug(port %d returns %lX\n, i + 1, dev-status);
+   }
 
-   /* Wait at least 2*bPwrOn2PwrGood for PP to change */
-   mdelay(pgood_delay);
+   /* Wait at least 2*bPwrOn2PwrGood for PP to change */
+   mdelay(pgood_delay);
 
+   for (i = 0; i  dev-maxchild; i++) {
ret = usb_get_port_status(dev, i + 1, portsts);
if (ret  0) {
-   debug(port %d: get_port_status failed\n, i + 1);
+   printf(port %d: get_port_status failed\n, i + 1);
return;
}
 
@@ -135,10 +138,12 @@ static void usb_hub_power_on(struct usb_hub_device *hub)
 */
portstatus = le16_to_cpu(portsts-wPortStatus);
if (portstatus  (USB_PORT_STAT_POWER  1)) {
-   debug(port %d: Port power change failed\n, i + 1);
+   printf(port %d: Port power change failed\n, i + 1);
return;
}
+   }
 
+   for (i = 0; i  dev-maxchild; i++) {
usb_set_port_feature(dev, i + 1, USB_PORT_FEAT_POWER);
debug(port %d returns %lX\n, i + 1, dev-status);
}
-- 
1.7.6.5

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


[U-Boot] [PATCH 2/3] usb: fix: Fixing Port status and feature number constants

2013-04-24 Thread Vivek Gautam
Fix the Port status bit constants and Port feature number
constants as a part of USB 2.0 and USB 3.0 Hub class.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 common/usb_hub.c   |   40 
 include/usb_defs.h |   39 +++
 2 files changed, 51 insertions(+), 28 deletions(-)

diff --git a/common/usb_hub.c b/common/usb_hub.c
index dad0409..d9816e4 100644
--- a/common/usb_hub.c
+++ b/common/usb_hub.c
@@ -170,14 +170,24 @@ static struct usb_hub_device *usb_hub_allocate(void)
 
 static inline char *portspeed(int portstatus)
 {
-   if (portstatus  (1  USB_PORT_FEAT_SUPERSPEED))
-   return 5 Gb/s;
-   else if (portstatus  (1  USB_PORT_FEAT_HIGHSPEED))
-   return 480 Mb/s;
-   else if (portstatus  (1  USB_PORT_FEAT_LOWSPEED))
-   return 1.5 Mb/s;
-   else
-   return 12 Mb/s;
+   char *speed_str;
+
+   switch (portstatus  USB_PORT_STAT_SPEED_MASK) {
+   case USB_PORT_STAT_SUPER_SPEED:
+   speed_str = 5 Gb/s;
+   break;
+   case USB_PORT_STAT_HIGH_SPEED:
+   speed_str = 480 Mb/s;
+   break;
+   case USB_PORT_STAT_LOW_SPEED:
+   speed_str = 1.5 Mb/s;
+   break;
+   default:
+   speed_str = 12 Mb/s;
+   break;
+   }
+
+   return speed_str;
 }
 
 int hub_port_reset(struct usb_device *dev, int port,
@@ -275,14 +285,20 @@ void usb_hub_port_connect_change(struct usb_device *dev, 
int port)
/* Allocate a new device struct for it */
usb = usb_alloc_new_device(dev-controller);
 
-   if (portstatus  USB_PORT_STAT_SUPER_SPEED)
+   switch (portstatus  USB_PORT_STAT_SPEED_MASK) {
+   case USB_PORT_STAT_SUPER_SPEED:
usb-speed = USB_SPEED_SUPER;
-   else if (portstatus  USB_PORT_STAT_HIGH_SPEED)
+   break;
+   case USB_PORT_STAT_HIGH_SPEED:
usb-speed = USB_SPEED_HIGH;
-   else if (portstatus  USB_PORT_STAT_LOW_SPEED)
+   break;
+   case USB_PORT_STAT_LOW_SPEED:
usb-speed = USB_SPEED_LOW;
-   else
+   break;
+   default:
usb-speed = USB_SPEED_FULL;
+   break;
+   }
 
dev-children[port] = usb;
usb-parent = dev;
diff --git a/include/usb_defs.h b/include/usb_defs.h
index 6ce6791..4f3601a 100644
--- a/include/usb_defs.h
+++ b/include/usb_defs.h
@@ -215,8 +215,6 @@
 #define USB_PORT_FEAT_POWER  8
 #define USB_PORT_FEAT_LOWSPEED   9
 #define USB_PORT_FEAT_HIGHSPEED  10
-#define USB_PORT_FEAT_FULLSPEED  11
-#define USB_PORT_FEAT_SUPERSPEED 12
 #define USB_PORT_FEAT_C_CONNECTION   16
 #define USB_PORT_FEAT_C_ENABLE   17
 #define USB_PORT_FEAT_C_SUSPEND  18
@@ -224,6 +222,17 @@
 #define USB_PORT_FEAT_C_RESET20
 #define USB_PORT_FEAT_TEST   21
 
+/*
+ * Changes to Port feature numbers for Super speed,
+ * from USB 3.0 spec Table 10-8
+ */
+#define USB_SS_PORT_FEAT_U1_TIMEOUT23
+#define USB_SS_PORT_FEAT_U2_TIMEOUT24
+#define USB_SS_PORT_FEAT_C_LINK_STATE  25
+#define USB_SS_PORT_FEAT_C_CONFIG_ERROR26
+#define USB_SS_PORT_FEAT_BH_RESET  28
+#define USB_SS_PORT_FEAT_C_BH_RESET29
+
 /* wPortStatus bits */
 #define USB_PORT_STAT_CONNECTION0x0001
 #define USB_PORT_STAT_ENABLE0x0002
@@ -233,20 +242,18 @@
 #define USB_PORT_STAT_POWER 0x0100
 #define USB_PORT_STAT_LOW_SPEED 0x0200
 #define USB_PORT_STAT_HIGH_SPEED0x0400 /* support for EHCI */
-#define USB_PORT_STAT_FULL_SPEED0x0800
-#define USB_PORT_STAT_SUPER_SPEED   0x1000 /* support for XHCI */
-#define USB_PORT_STAT_SPEED\
-   (USB_PORT_STAT_LOW_SPEED | USB_PORT_STAT_HIGH_SPEED | \
-   USB_PORT_STAT_FULL_SPEED | USB_PORT_STAT_SUPER_SPEED)
+#define USB_PORT_STAT_SUPER_SPEED   0x0600 /* faking support to XHCI */
+#define USB_PORT_STAT_SPEED_MASK   \
+   (USB_PORT_STAT_LOW_SPEED | USB_PORT_STAT_HIGH_SPEED)
 
 /*
- * Additions to wPortStatus bit field from USB 3.0
- * See USB 3.0 spec Table 10-10
+ * Changes to wPortStatus bit field in USB 3.0
+ * See USB 3.0 spec Table 10-11
  */
-#define USB_PORT_STAT_LINK_STATE   0x01e0
+#define USB_SS_PORT_STAT_LINK_STATE0x01e0
 #define USB_SS_PORT_STAT_POWER 0x0200
 #define USB_SS_PORT_STAT_SPEED 0x1c00
-#define USB_PORT_STAT_SPEED_5GBPS  0x
+#define USB_SS_PORT_STAT_SPEED_5GBPS   0x
 
 /* wPortChange bits */
 #define USB_PORT_STAT_C_CONNECTION  0x0001
@@ -256,12 +263,12 @@
 #define USB_PORT_STAT_C_RESET   0x0010
 
 /*
- * Addition to wPortChange bit fields form USB 3.0
- * See USB 3.0 spec Table 10-11
+ * Changes to wPortChange bit fields in USB 3.0
+ * See USB 3.0 spec Table 10-12
  */
-#define USB_PORT_STAT_C_BH_RESET   0x0020
-#define USB_PORT_STAT_C_LINK_STATE 0x0040
-#define USB_PORT_STAT_C_CONFIG_ERROR   0x0080
+#define

[U-Boot] [PATCH 3/3] usb: common: Use a global definition for 'min3'

2013-04-24 Thread Vivek Gautam
We can use a common global method for calculating minimum of
3 numbers. Put the same in 'common header' and let 'ehci'
use it.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 drivers/usb/host/ehci-hcd.c |   10 --
 include/common.h|   25 +
 2 files changed, 21 insertions(+), 14 deletions(-)

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 19d4352..e0f3e4b 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -603,16 +603,6 @@ fail:
return -1;
 }
 
-static inline int min3(int a, int b, int c)
-{
-
-   if (b  a)
-   a = b;
-   if (c  a)
-   a = c;
-   return a;
-}
-
 int
 ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
 int length, struct devrequest *req)
diff --git a/include/common.h b/include/common.h
index 0cfa6a8..b0258a0 100644
--- a/include/common.h
+++ b/include/common.h
@@ -199,18 +199,35 @@ typedef void (interrupt_handler_t)(void *);
  * General Purpose Utilities
  */
 #define min(X, Y)  \
-   ({ typeof (X) __x = (X);\
-   typeof (Y) __y = (Y);   \
+   ({ typeof(X) __x = (X); \
+   typeof(Y) __y = (Y);\
(__x  __y) ? __x : __y; })
 
 #define max(X, Y)  \
-   ({ typeof (X) __x = (X);\
-   typeof (Y) __y = (Y);   \
+   ({ typeof(X) __x = (X); \
+   typeof(Y) __y = (Y);\
(__x  __y) ? __x : __y; })
 
 #define MIN(x, y)  min(x, y)
 #define MAX(x, y)  max(x, y)
 
+#define min3(X, Y, Z)  \
+   ({ typeof(X) __x = (X); \
+   typeof(Y) __y = (Y);\
+   typeof(Z) __z = (Z);\
+   __x  __y ? (__x  __z ? __x : __z) :   \
+   (__y  __z ? __y : __z); })
+
+#define max3(X, Y, Z)  \
+   ({ typeof(X) __x = (X); \
+   typeof(Y) __y = (Y);\
+   typeof(Z) __z = (Z);\
+   __x  __y ? (__x  __z ? __x : __z) :   \
+   (__y  __z ? __y : __z); })
+
+#define MIN3(x, y, z)  min3(x, y, z)
+#define MAX3(x, y, z)  max3(x, y, z)
+
 /*
  * Return the absolute value of a number.
  *
-- 
1.7.6.5

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


Re: [U-Boot] [PATCH 3/3] usb: common: Use a global definition for 'min3'

2013-04-24 Thread Vivek Gautam
CC: Tom Rini


On Wed, Apr 24, 2013 at 6:20 PM, Vivek Gautam gautam.vi...@samsung.com wrote:
 We can use a common global method for calculating minimum of
 3 numbers. Put the same in 'common header' and let 'ehci'
 use it.

 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
 ---
  drivers/usb/host/ehci-hcd.c |   10 --
  include/common.h|   25 +
  2 files changed, 21 insertions(+), 14 deletions(-)

 diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
 index 19d4352..e0f3e4b 100644
 --- a/drivers/usb/host/ehci-hcd.c
 +++ b/drivers/usb/host/ehci-hcd.c
 @@ -603,16 +603,6 @@ fail:
 return -1;
  }

 -static inline int min3(int a, int b, int c)
 -{
 -
 -   if (b  a)
 -   a = b;
 -   if (c  a)
 -   a = c;
 -   return a;
 -}
 -
  int
  ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
  int length, struct devrequest *req)
 diff --git a/include/common.h b/include/common.h
 index 0cfa6a8..b0258a0 100644
 --- a/include/common.h
 +++ b/include/common.h
 @@ -199,18 +199,35 @@ typedef void (interrupt_handler_t)(void *);
   * General Purpose Utilities
   */
  #define min(X, Y)  \
 -   ({ typeof (X) __x = (X);\
 -   typeof (Y) __y = (Y);   \
 +   ({ typeof(X) __x = (X); \
 +   typeof(Y) __y = (Y);\
 (__x  __y) ? __x : __y; })

  #define max(X, Y)  \
 -   ({ typeof (X) __x = (X);\
 -   typeof (Y) __y = (Y);   \
 +   ({ typeof(X) __x = (X); \
 +   typeof(Y) __y = (Y);\
 (__x  __y) ? __x : __y; })

  #define MIN(x, y)  min(x, y)
  #define MAX(x, y)  max(x, y)

 +#define min3(X, Y, Z)  \
 +   ({ typeof(X) __x = (X); \
 +   typeof(Y) __y = (Y);\
 +   typeof(Z) __z = (Z);\
 +   __x  __y ? (__x  __z ? __x : __z) :   \
 +   (__y  __z ? __y : __z); })
 +
 +#define max3(X, Y, Z)  \
 +   ({ typeof(X) __x = (X); \
 +   typeof(Y) __y = (Y);\
 +   typeof(Z) __z = (Z);\
 +   __x  __y ? (__x  __z ? __x : __z) :   \
 +   (__y  __z ? __y : __z); })
 +
 +#define MIN3(x, y, z)  min3(x, y, z)
 +#define MAX3(x, y, z)  max3(x, y, z)
 +
  /*
   * Return the absolute value of a number.
   *
 --
 1.7.6.5



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


Re: [U-Boot] [PATCH 0/3] usb: ss: Fixes for super speed framework

2013-04-24 Thread Vivek Gautam
Hi Marek,


On Thu, Apr 25, 2013 at 8:32 AM, Marek Vasut ma...@denx.de wrote:
 Dear Vivek Gautam,

 This patch series fixes changes for Super speed framework
 which got pulled-in 'u-boot-usb/next'.
 First patch fixes Port Status and Port feature macro constants,
 then next patch parallelizes power-cycling of power on root-hub
 ports.
 3rd patch in this series also sync the min3/max3 definitions
 with Linux kernel.

 Based on u-boot-usb/next branch with following patch reverted:
 usb: hub: Reset only usb 2.0 ports

 Fixed Julius's comment , applied and pushed.

Thanks :-)



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


Re: [U-Boot] [U-Boot, v3, 3/8] usb: hub: Power-cycle on root-hub ports

2013-04-23 Thread Vivek Gautam
Hi,


On Tue, Apr 23, 2013 at 3:32 AM, Julius Werner jwer...@chromium.org wrote:
 This 20ms delay is truely being taken to be on safer side (twice of
 Power-on-to-power-good),
 its not observational.
 In my earlier patch-series, we were doing the same way as you are
 suggesting here (power-on
 ports only if they aren't), however Marek suggested to power-cycle the
 ports. This would ensure
 that we don't have any spurious Port status (telling us that port is
 powered up).

 Fair enough... I guess 20ms overall is not a big deal in the whole
 picture. I sometimes tend to overoptimize things...

 Actually i was seeing a strage behavior on USB 2.0 protocol ports
 available with XHCI.
 Since all ports with XHCI are powered-up after a Chip-reset, the
 instant we do a power-on
 on these ports (as with original code - simply setting the PORT_POWER
 feature), the Connect status
 change bit used to get cleared (however Current connect status bit was
 still set).

 This is a bug in your XHCI code I hadn't spotted before: in
 xhci_submit_root(SET_FEATURE) you read the PORTSC register, add a bit,
 and write it again... without calling xhci_port_state_to_neutral()
 inbetween. Thus you clear any pending change events when you set
 PORT_POWER.

Right, we need to do that.

 (Seems the EHCI code has a similar bug in CLEAR_FEATURE,
 now that I'm looking at it... someone should put a 'reg =
 ~EHCI_PS_CLEAR;' in there.)

True, EHCI has it for SET_FEATURE but not for CLEAR_FEATURE.


 Hmm, so right now we are doing this for one port at a time.
 I am sure parallelising things as you suggested would be best to do here, but
 can you please explain, would handling one port at a time lead to unwanted
 behavior from Host's side somehow ?

 It doesn't affect correctness, just the amount of time wasted. Doing
 it one port at a time means you wait 100ms on a 5 port root hub, while
 you could get by with 20ms overall by parallelizing it.

True, will amend this as required.



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


Re: [U-Boot] [U-Boot, v3, 6/8] USB: SS: Add support for Super Speed USB interface

2013-04-23 Thread Vivek Gautam
Hi Marek,


On Tue, Apr 23, 2013 at 7:54 AM, Marek Vasut ma...@denx.de wrote:
 Dear Vivek Gautam,

 Hi Marek,

 On Sat, Apr 20, 2013 at 5:27 PM, Marek Vasut ma...@denx.de wrote:
  Dear Julius Werner,
 
  These patches haven't gone in yet, right? I think Vivek wants to
  discuss/update them himself, he just asked me to move my reviews to
  this thread.
 
  They're not in, but they're already pushed in my tree. It'd be also
  easier to review diff instead of full patches again.

 I shall send a diff patchset for these changes, but do we have a
 possibility of squashing the changes
 to earler commits at some point of time later, so that clean changes
 get to u-boot ?
 Or we shall go as you suggest.

 Just send a subsequent patch ;-)

Sure, will send subsequent patches on u-boot-usb/next


 Best regards,
 Marek Vasut



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


Re: [U-Boot] [U-Boot, v3, 6/8] USB: SS: Add support for Super Speed USB interface

2013-04-22 Thread Vivek Gautam
Hi Julius,


On Fri, Apr 19, 2013 at 11:52 PM, Julius Werner jwer...@chromium.org wrote:
 Migrating my comments here for public discussion.

Thanks for your valuable comments here.


 This adds usb framework support for super-speed usb, which will
 further facilitate to add stack support for xHCI.

 Signed-off-by: Vikas C Sajjan vikas.saj...@samsung.com
 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com

 ---
 Changes from v2:
  - Replacing if-else with switch-case in portspeed() in cmd_usb.c

  common/cmd_usb.c   |   24 ++--
  common/usb.c   |5 +
  common/usb_hub.c   |8 ++--
  include/usb.h  |6 ++
  include/usb_defs.h |   24 +++-
  5 files changed, 58 insertions(+), 9 deletions(-)

 diff --git a/common/cmd_usb.c b/common/cmd_usb.c
 index dacdc2d..594385a 100644
 --- a/common/cmd_usb.c
 +++ b/common/cmd_usb.c
 @@ -271,12 +271,24 @@ static void usb_display_config(struct usb_device *dev)

  static inline char *portspeed(int speed)
  {
 - if (speed == USB_SPEED_HIGH)
 - return 480 Mb/s;
 - else if (speed == USB_SPEED_LOW)
 - return 1.5 Mb/s;
 - else
 - return 12 Mb/s;
 + char *speed_str;
 +
 + switch (speed) {
 + case USB_SPEED_SUPER:
 + speed_str = 5 Gb/s;
 + break;
 + case USB_SPEED_HIGH:
 + speed_str = 480 Mb/s;
 + break;
 + case USB_SPEED_LOW:
 + speed_str = 1.5 Mb/s;
 + break;
 + default:
 + speed_str = 12 Mb/s;
 + break;
 + }
 +
 + return speed_str;
  }

  /* shows the device tree recursively */
 diff --git a/common/usb.c b/common/usb.c
 index 3a96a34..55fff5b 100644
 --- a/common/usb.c
 +++ b/common/usb.c
 @@ -409,6 +409,11 @@ static int usb_parse_config(struct usb_device *dev,
   wMaxPacketSize);
   debug(if %d, ep %d\n, ifno, epno);
   break;
 + case USB_DT_SS_ENDPOINT_COMP:
 + if_desc = dev-config.if_desc[ifno];
 + memcpy(if_desc-ss_ep_comp_desc[epno],
 + buffer[index], buffer[index]);
 + break;
   default:
   if (head-bLength == 0)
   return 1;
 diff --git a/common/usb_hub.c b/common/usb_hub.c
 index ab41943..1e225e6 100644
 --- a/common/usb_hub.c
 +++ b/common/usb_hub.c
 @@ -165,7 +165,9 @@ static struct usb_hub_device *usb_hub_allocate(void)

  static inline char *portspeed(int portstatus)
  {
 - if (portstatus  (1  USB_PORT_FEAT_HIGHSPEED))
 + if (portstatus  (1  USB_PORT_FEAT_SUPERSPEED))

 It doesn't make sense to use the USB_PORT_FEAT_ constants to read a port 
 status
 here. These should be USB_PORT_STAT_ instead (you could use a switch statement
 if you mask and shift them correctly).

True, we should be 'ANDing' here with respectve PORT_STAT_ constants,
will modify this as required.


 + return 5 Gb/s;
 + else if (portstatus  (1  USB_PORT_FEAT_HIGHSPEED))
   return 480 Mb/s;
   else if (portstatus  (1  USB_PORT_FEAT_LOWSPEED))
   return 1.5 Mb/s;
 @@ -268,7 +270,9 @@ void usb_hub_port_connect_change(struct usb_device *dev, 
 int port)
   /* Allocate a new device struct for it */
   usb = usb_alloc_new_device(dev-controller);

 - if (portstatus  USB_PORT_STAT_HIGH_SPEED)
 + if (portstatus  USB_PORT_STAT_SUPER_SPEED)
 + usb-speed = USB_SPEED_SUPER;
 + else if (portstatus  USB_PORT_STAT_HIGH_SPEED)
   usb-speed = USB_SPEED_HIGH;
   else if (portstatus  USB_PORT_STAT_LOW_SPEED)
   usb-speed = USB_SPEED_LOW;

 Should change to switch statement after implementing my suggestion to
 usb_defs.h

Sure,


 diff --git a/include/usb.h b/include/usb.h
 index d79c865..d7b082d 100644
 --- a/include/usb.h
 +++ b/include/usb.h
 @@ -76,6 +76,12 @@ struct usb_interface {
   unsigned char   act_altsetting;

   struct usb_endpoint_descriptor ep_desc[USB_MAXENDPOINTS];
 + /*
 +  * Super Speed Device will have Super Speed Endpoint
 +  * Companion Descriptor  (section 9.6.7 of usb 3.0 spec)
 +  * Revision 1.0 June 6th 2011
 +  */
 + struct usb_ss_ep_comp_descriptor ss_ep_comp_desc[USB_MAXENDPOINTS];
  } __attribute__ ((packed));

  /* Configuration information.. */
 diff --git a/include/usb_defs.h b/include/usb_defs.h
 index 0c78d9d..e2aaef3 100644
 --- a/include/usb_defs.h
 +++ b/include/usb_defs.h
 @@ -203,6 +203,8 @@
  #define USB_PORT_FEAT_POWER  8
  #define USB_PORT_FEAT_LOWSPEED   9
  #define USB_PORT_FEAT_HIGHSPEED  10
 +#define USB_PORT_FEAT_FULLSPEED  11
 +#define USB_PORT_FEAT_SUPERSPEED 12

 Speed is never set as a feature anyway. We should just get rid of all of these
 and always use USB_PORT_STAT_ for them.

These are simply 'Hub class feature numbers' given

Re: [U-Boot] [U-Boot, v3, 6/8] USB: SS: Add support for Super Speed USB interface

2013-04-22 Thread Vivek Gautam
Hi Marek,


On Sat, Apr 20, 2013 at 5:27 PM, Marek Vasut ma...@denx.de wrote:
 Dear Julius Werner,

 These patches haven't gone in yet, right? I think Vivek wants to
 discuss/update them himself, he just asked me to move my reviews to
 this thread.

 They're not in, but they're already pushed in my tree. It'd be also easier to
 review diff instead of full patches again.

I shall send a diff patchset for these changes, but do we have a
possibility of squashing the changes
to earler commits at some point of time later, so that clean changes
get to u-boot ?
Or we shall go as you suggest.



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


Re: [U-Boot] [U-Boot, v3, 3/8] usb: hub: Power-cycle on root-hub ports

2013-04-22 Thread Vivek Gautam
HI Julius,


On Sat, Apr 20, 2013 at 12:30 AM, Julius Werner jwer...@chromium.org wrote:
 XHCI ports are powered on after a H/W reset, however
 EHCI ports are not. So disabling and re-enabling power
 on all ports invariably.

 Signed-off-by: Amar amarendra...@samsung.com
 Signed-off-by: Vivek Gautam gautam.vi...@samsung.com

 ---
 Changes from v2:
  - Replaced USB_HUB_PRINTFs to debug()

  common/usb_hub.c |   34 ++
  1 files changed, 34 insertions(+), 0 deletions(-)

 diff --git a/common/usb_hub.c b/common/usb_hub.c
 index f2a0285..e4f4e3c 100644
 --- a/common/usb_hub.c
 +++ b/common/usb_hub.c
 @@ -100,11 +100,45 @@ static void usb_hub_power_on(struct usb_hub_device 
 *hub)
   int i;
   struct usb_device *dev;
   unsigned pgood_delay = hub-desc.bPwrOn2PwrGood * 2;
 + ALLOC_CACHE_ALIGN_BUFFER(struct usb_port_status, portsts, 1);
 + unsigned short portstatus;
 + int ret;

   dev = hub-pusb_dev;
   /* Enable power to the ports */
   debug(enabling power on all ports\n);
   for (i = 0; i  dev-maxchild; i++) {
 + /*
 +  * Power-cycle the ports here: aka,
 +  * turning them off and turning on again.
 +  */
 + usb_clear_port_feature(dev, i + 1, USB_PORT_FEAT_POWER);
 + debug(port %d returns %lX\n, i + 1, dev-status);
 +
 + /* Wait at least 2*bPwrOn2PwrGood for PP to change */
 + mdelay(pgood_delay);

 This adds 20ms per port to USB boot times... is it really necessary? Why do we
 need to powercycle XHCI ports? Couldn't we just check if the ports are powered
 and only power them on if they aren't?

This 20ms delay is truely being taken to be on safer side (twice of
Power-on-to-power-good),
its not observational.
In my earlier patch-series, we were doing the same way as you are
suggesting here (power-on
ports only if they aren't), however Marek suggested to power-cycle the
ports. This would ensure
that we don't have any spurious Port status (telling us that port is
powered up).

Actually i was seeing a strage behavior on USB 2.0 protocol ports
available with XHCI.
Since all ports with XHCI are powered-up after a Chip-reset, the
instant we do a power-on
on these ports (as with original code - simply setting the PORT_POWER
feature), the Connect status
change bit used to get cleared (however Current connect status bit was
still set).

So we arrived at solution that either we don't power-up XHCI ports or
do a power-cycle on them.


 If you insist, please at least parallelize this. Disable power on all ports,
 wait, then check and reenable it.

Hmm, so right now we are doing this for one port at a time.
I am sure parallelising things as you suggested would be best to do here, but
can you please explain, would handling one port at a time lead to unwanted
behavior from Host's side somehow ?


 +
 + ret = usb_get_port_status(dev, i + 1, portsts);
 + if (ret  0) {
 + debug(port %d: get_port_status failed\n, i + 1);

 This is a severe error (because the ports won't come up again), so I think it
 should be a printf() instead of a debug().

Sure, will change this to pritnf()


 + return;
 + }
 +
 + /*
 +  * Check to confirm the state of Port Power:
 +  * xHCI says After modifying PP, s/w shall read
 +  * PP and confirm that it has reached the desired state
 +  * before modifying it again, undefined behavior may occur
 +  * if this procedure is not followed.
 +  * EHCI doesn't say anything like this, but no harm in keeping
 +  * this.
 +  */
 + portstatus = le16_to_cpu(portsts-wPortStatus);
 + if (portstatus  (USB_PORT_STAT_POWER  1)) {
 + debug(port %d: Port power change failed\n, i + 1);

 Same as above.

Sure, will change this.


 + return;
 + }
 +
   usb_set_port_feature(dev, i + 1, USB_PORT_FEAT_POWER);
   debug(port %d returns %lX\n, i + 1, dev-status);
   }



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


Re: [U-Boot] [U-Boot, v3, 6/8] USB: SS: Add support for Super Speed USB interface

2013-04-22 Thread Vivek Gautam
Hi Julius,


On Tue, Apr 23, 2013 at 3:44 AM, Julius Werner jwer...@chromium.org wrote:
 I would reword Additions to Changes and explicitly state that these 
 fields
 concern the new USB 3.0 hub descriptor format, which is different and
 exclusively applies to SuperSpeed hubs.

 This bit fields are actually additions to USB 3.0 framework. These
 fields are not defined in
 USB 2.0 specs, or else they are reserved there. If you insist i can
 modify this as suggested.

 Yes, okay, I think we mean the same thing here. I just wanted to point
 out that the USB 3.0 port status is actually a completely different
 thing from the USB 2.0 port status (which is still valid for
 non-SuperSpeed hubs in USB 3.0 environments, even though the spec
 hasn't printed it out again). They did not just *add* a few bits to
 the old status bit field, they actually *changed* existing bits (not
 just reserved ones)... e.g. bit 9 means LOW_SPEED for USB 2.0 hubs but
 PORT_POWER for SuperSpeed hubs. I found this very confusing when I
 first read it, so I thought it might be worth making it extra obvious
 through comments.

Fair enough, i shall change this accordingly, Thanks !!



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


[U-Boot] [PATCH] usb: common: Use a global definition for 'min3'

2013-04-19 Thread Vivek Gautam
We can use a common global method for calculating minimum of
3 numbers. Put the same in 'common header' and let 'ehci'
use it.

Signed-off-by: Vivek Gautam gautam.vi...@samsung.com
---
 drivers/usb/host/ehci-hcd.c |   10 --
 include/common.h|5 +
 2 files changed, 5 insertions(+), 10 deletions(-)

diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c
index 19d4352..e0f3e4b 100644
--- a/drivers/usb/host/ehci-hcd.c
+++ b/drivers/usb/host/ehci-hcd.c
@@ -603,16 +603,6 @@ fail:
return -1;
 }
 
-static inline int min3(int a, int b, int c)
-{
-
-   if (b  a)
-   a = b;
-   if (c  a)
-   a = c;
-   return a;
-}
-
 int
 ehci_submit_root(struct usb_device *dev, unsigned long pipe, void *buffer,
 int length, struct devrequest *req)
diff --git a/include/common.h b/include/common.h
index 0cfa6a8..611edca 100644
--- a/include/common.h
+++ b/include/common.h
@@ -211,6 +211,11 @@ typedef void (interrupt_handler_t)(void *);
 #define MIN(x, y)  min(x, y)
 #define MAX(x, y)  max(x, y)
 
+static inline int min3(int a, int b, int c)
+{
+   return min(min(a, b), c);
+}
+
 /*
  * Return the absolute value of a number.
  *
-- 
1.7.6.5

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


Re: [U-Boot] [PATCH v3 0/8] usb: ss: Some fixes and cleanup for USB super-speed support

2013-04-18 Thread Vivek Gautam
Hi Marek,


On Sun, Apr 14, 2013 at 11:43 PM, Marek Vasut ma...@denx.de wrote:
 Dear Vivek Gautam,

 Based on 'u-boot-usb' master branch.

 This patch-series includes majorly some clean-up, few fixes and
 then some basic super-speed usb infrastructure addition, to help
 put support for XHCI in near future.

 btw can you test your patches with MAKEALL -a arm? I get this:

 - SUMMARY 
 Boards compiled: 306
 Boards with errors: 65 ( qong mx35pdk gplugd at91sam9m10g45ek_nandflash 
 pogo_e02
 dns325 iconnect lschlv2 lsxhl d2net_v2 inetspace_v2 net2big_v2 
 netspace_lite_v2
 netspace_max_v2 netspace_v2 wireless_space dreamplug guruplug mv88f6281gtw_ge
 openrd_base openrd_client openrd_ultimate rd6281a sheevaplug ib62x0 dockstar
 tk71 zmx25 mx23_olinuxino apx4devkit mx23evk m28evk mx28evk sc_sps_1 edminiv2
 mx51_efikamx mx51_efikasb mx51evk mx53loco mx6qsabreauto mx6qsabrelite
 nitrogen6dl nitrogen6dl2g nitrogen6q nitrogen6q2g nitrogen6s nitrogen6s1g 
 cm_t35
 mt_ventoux omap3_beagle mcx twister omap4_panda snow smdk5250 harmony seaboard
 ventana whistler colibri_t20_iris plutux medcom-wide tec paz00 trimslice )
 --

Tried with MAKEALL
got following result

- SUMMARY 
Boards compiled: 306
Boards with errors: 1 ( omap3_evm )
Boards with warnings but no errors: 17 ( VCMA9 smdk2410 kzm9g balloon3
h2200 lubbock palmld palmtc polaris pxa255_idp trizepsiv
vpac270_nor_128 vpac270_nor_256 vpac270_ond_256 xaeniax zipitz2
colibri_pxa270 )
--

There's something to do with Cross Compiler version ??
btw what environment are you compiling the source with.


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


Re: [U-Boot] [PATCH v3 0/8] usb: ss: Some fixes and cleanup for USB super-speed support

2013-04-18 Thread Vivek Gautam
Hi,


On Sun, Apr 14, 2013 at 10:44 PM, Marek Vasut ma...@denx.de wrote:
 Dear Vivek Gautam,

 Based on 'u-boot-usb' master branch.

 This patch-series includes majorly some clean-up, few fixes and
 then some basic super-speed usb infrastructure addition, to help
 put support for XHCI in near future.

 Changes from v2:
  - Added a patch usb: common: Weed out USB_**_PRINTFs from usb framework
to replace USB_***_PRINTF with debug() so as to get rid of unnecessary
DEBUG macros in usb common framework and thereby rebasing other patches
on top of this so that no USB_PRINTF appears further.
  - Added a patch to reset only USB 2.0 ports, since USB 3.0 protocol ports
don't require a reset to happen to move to 'enabled' state.
  - Added a patch to move definition of 'min3()' out of ehci-hcd and putting
the same as macro definition in common header.
  - Using a 'switch-case' in portspeed() in cmd_usb.c

 Changes from v1:
  - Fixing the issue with 'ifno' as well as added 'if_desc'.
  - Instead of turning-on only powered-off hub ports, power-cycle all
the hub ports (aka: turning off and then turning on again power to
all the ports.
  - Fixing commenting style problem in
'usb: Update device class in usb device's descriptor'
  - Fixing typo in commit message for
'usb: hub: Fix enumration timeout'
  - Removing separate definition for 'struct usb_ep_desc'; thereby adding
'struct usb_ss_ep_comp_descriptor' to 'struct usb_interface' only.
As a result modifying the patch accordingly also dropping the patch
'usb: eth: Fix for updated usb interface descriptor structure'
  - Dropping the patch 'usb: hub: Increase device enumeration timeout for
 broken drives' for now (will come back with a solution at later point of
 time).

 Applied all but the last one, let's now base all subsequent patches on u-boot-
 usb/next please.

And i can't see these patches on u-boot-usb/next. Possibly you haven't
pushed out yet ??



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


Re: [U-Boot] [PATCH v3 0/8] usb: ss: Some fixes and cleanup for USB super-speed support

2013-04-18 Thread Vivek Gautam
On Thu, Apr 18, 2013 at 11:54 AM, Vivek Gautam
gautamvivek1...@gmail.com wrote:
 Hi Marek,


 On Sun, Apr 14, 2013 at 11:43 PM, Marek Vasut ma...@denx.de wrote:
 Dear Vivek Gautam,

 Based on 'u-boot-usb' master branch.

 This patch-series includes majorly some clean-up, few fixes and
 then some basic super-speed usb infrastructure addition, to help
 put support for XHCI in near future.

 btw can you test your patches with MAKEALL -a arm? I get this:

 - SUMMARY 
 Boards compiled: 306
 Boards with errors: 65 ( qong mx35pdk gplugd at91sam9m10g45ek_nandflash 
 pogo_e02
 dns325 iconnect lschlv2 lsxhl d2net_v2 inetspace_v2 net2big_v2 
 netspace_lite_v2
 netspace_max_v2 netspace_v2 wireless_space dreamplug guruplug mv88f6281gtw_ge
 openrd_base openrd_client openrd_ultimate rd6281a sheevaplug ib62x0 dockstar
 tk71 zmx25 mx23_olinuxino apx4devkit mx23evk m28evk mx28evk sc_sps_1 edminiv2
 mx51_efikamx mx51_efikasb mx51evk mx53loco mx6qsabreauto mx6qsabrelite
 nitrogen6dl nitrogen6dl2g nitrogen6q nitrogen6q2g nitrogen6s nitrogen6s1g 
 cm_t35
 mt_ventoux omap3_beagle mcx twister omap4_panda snow smdk5250 harmony 
 seaboard
 ventana whistler colibri_t20_iris plutux medcom-wide tec paz00 trimslice )
 --

 Tried with MAKEALL
 got following result

 - SUMMARY 
 Boards compiled: 306
 Boards with errors: 1 ( omap3_evm )
 Boards with warnings but no errors: 17 ( VCMA9 smdk2410 kzm9g balloon3
 h2200 lubbock palmld palmtc polaris pxa255_idp trizepsiv
 vpac270_nor_128 vpac270_nor_256 vpac270_ond_256 xaeniax zipitz2
 colibri_pxa270 )
 --


**Without my patches i get following result

- SUMMARY 
Boards compiled: 306
Boards with warnings but no errors: 17 ( VCMA9 smdk2410 kzm9g balloon3
h2200 lubbock palmld palmtc polaris pxa255_idp trizepsiv
vpac270_nor_128 vpac270_nor_256 vpac270_ond_256 xaeniax zipitz2
colibri_pxa270 )
--


 There's something to do with Cross Compiler version ??
 btw what environment are you compiling the source with.


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


Re: [U-Boot] [PATCH v3 0/8] usb: ss: Some fixes and cleanup for USB super-speed support

2013-04-18 Thread Vivek Gautam
HI Marek,


On Thu, Apr 18, 2013 at 4:29 PM, Vivek Gautam gautamvivek1...@gmail.com wrote:
 On Thu, Apr 18, 2013 at 11:54 AM, Vivek Gautam
 gautamvivek1...@gmail.com wrote:
 Hi Marek,


 On Sun, Apr 14, 2013 at 11:43 PM, Marek Vasut ma...@denx.de wrote:
 Dear Vivek Gautam,

 Based on 'u-boot-usb' master branch.

 This patch-series includes majorly some clean-up, few fixes and
 then some basic super-speed usb infrastructure addition, to help
 put support for XHCI in near future.

 btw can you test your patches with MAKEALL -a arm? I get this:

 - SUMMARY 
 Boards compiled: 306
 Boards with errors: 65 ( qong mx35pdk gplugd at91sam9m10g45ek_nandflash 
 pogo_e02
 dns325 iconnect lschlv2 lsxhl d2net_v2 inetspace_v2 net2big_v2 
 netspace_lite_v2
 netspace_max_v2 netspace_v2 wireless_space dreamplug guruplug 
 mv88f6281gtw_ge
 openrd_base openrd_client openrd_ultimate rd6281a sheevaplug ib62x0 dockstar
 tk71 zmx25 mx23_olinuxino apx4devkit mx23evk m28evk mx28evk sc_sps_1 
 edminiv2
 mx51_efikamx mx51_efikasb mx51evk mx53loco mx6qsabreauto mx6qsabrelite
 nitrogen6dl nitrogen6dl2g nitrogen6q nitrogen6q2g nitrogen6s nitrogen6s1g 
 cm_t35
 mt_ventoux omap3_beagle mcx twister omap4_panda snow smdk5250 harmony 
 seaboard
 ventana whistler colibri_t20_iris plutux medcom-wide tec paz00 trimslice )
 --

 Tried with MAKEALL
 got following result

 - SUMMARY 
 Boards compiled: 306
 Boards with errors: 1 ( omap3_evm )
 Boards with warnings but no errors: 17 ( VCMA9 smdk2410 kzm9g balloon3
 h2200 lubbock palmld palmtc polaris pxa255_idp trizepsiv
 vpac270_nor_128 vpac270_nor_256 vpac270_ond_256 xaeniax zipitz2
 colibri_pxa270 )
 --

I actually checked now just for omap3_evm configuration by trying out:
  make distclean
  make omap3_evm_config
  make

But strangely i didn't get any build errros for omap3_evm board on
explicitly compiling for it.
Any clue ?



 **Without my patches i get following result

 - SUMMARY 
 Boards compiled: 306
 Boards with warnings but no errors: 17 ( VCMA9 smdk2410 kzm9g balloon3
 h2200 lubbock palmld palmtc polaris pxa255_idp trizepsiv
 vpac270_nor_128 vpac270_nor_256 vpac270_ond_256 xaeniax zipitz2
 colibri_pxa270 )
 --


 There's something to do with Cross Compiler version ??
 btw what environment are you compiling the source with.

I am using arm-2011.09 cross toolchain.



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


Re: [U-Boot] [PATCH v3 0/8] usb: ss: Some fixes and cleanup for USB super-speed support

2013-04-18 Thread Vivek Gautam
On Thu, Apr 18, 2013 at 6:08 PM, Marek Vasut ma...@denx.de wrote:
 Dear Vivek Gautam,

 Hi,

 On Sun, Apr 14, 2013 at 10:44 PM, Marek Vasut ma...@denx.de wrote:
  Dear Vivek Gautam,
 
  Based on 'u-boot-usb' master branch.
 
  This patch-series includes majorly some clean-up, few fixes and
  then some basic super-speed usb infrastructure addition, to help
  put support for XHCI in near future.
 
  Changes from v2:
   - Added a patch usb: common: Weed out USB_**_PRINTFs from usb
   framework
 
 to replace USB_***_PRINTF with debug() so as to get rid of
 unnecessary DEBUG macros in usb common framework and thereby
 rebasing other patches on top of this so that no USB_PRINTF appears
 further.
 
   - Added a patch to reset only USB 2.0 ports, since USB 3.0 protocol
   ports
 
 don't require a reset to happen to move to 'enabled' state.
 
   - Added a patch to move definition of 'min3()' out of ehci-hcd and
   putting
 
 the same as macro definition in common header.
 
   - Using a 'switch-case' in portspeed() in cmd_usb.c
 
  Changes from v1:
   - Fixing the issue with 'ifno' as well as added 'if_desc'.
   - Instead of turning-on only powered-off hub ports, power-cycle all
 
 the hub ports (aka: turning off and then turning on again power to
 all the ports.
 
   - Fixing commenting style problem in
 
 'usb: Update device class in usb device's descriptor'
 
   - Fixing typo in commit message for
 
 'usb: hub: Fix enumration timeout'
 
   - Removing separate definition for 'struct usb_ep_desc'; thereby adding
 
 'struct usb_ss_ep_comp_descriptor' to 'struct usb_interface' only.
 As a result modifying the patch accordingly also dropping the patch
 'usb: eth: Fix for updated usb interface descriptor structure'
 
   - Dropping the patch 'usb: hub: Increase device enumeration timeout for
 
  broken drives' for now (will come back with a solution at later point of
  time).
 
  Applied all but the last one, let's now base all subsequent patches on
  u-boot- usb/next please.

 And i can't see these patches on u-boot-usb/next. Possibly you haven't
 pushed out yet ??

 You're right, sorry! Fixed now

Thanks you so much !!

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


Re: [U-Boot] [PATCH v3 0/8] usb: ss: Some fixes and cleanup for USB super-speed support

2013-04-18 Thread Vivek Gautam
On Fri, Apr 19, 2013 at 12:45 AM, Marek Vasut ma...@denx.de wrote:
 Hi Julius,

 Hi Marek,

 I'm sorry, that must have slipped by when I ported the change from my
 local fork. Your patch is correct, you just need to add the ctrl-
 there.

 Well, next time please make sure to compile-test your patches at least before
 you send them.

 The stuff is now pushed, Vivek.

Thanks Marek.



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


  1   2   >