[U-Boot] [PATCH] image: Convert to use fdt_for_each_subnode macro

2015-02-06 Thread Axel Lin
Signed-off-by: Axel Lin 
---
 common/image-fit.c |  4 +---
 common/image-sig.c | 16 
 2 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/common/image-fit.c b/common/image-fit.c
index b47d110..778d2a1 100644
--- a/common/image-fit.c
+++ b/common/image-fit.c
@@ -1010,9 +1010,7 @@ int fit_image_verify(const void *fit, int image_noffset)
}
 
/* Process all hash subnodes of the component image node */
-   for (noffset = fdt_first_subnode(fit, image_noffset);
-noffset >= 0;
-noffset = fdt_next_subnode(fit, noffset)) {
+   fdt_for_each_subnode(fit, noffset, image_noffset) {
const char *name = fit_get_name(fit, noffset, NULL);
 
/*
diff --git a/common/image-sig.c b/common/image-sig.c
index 2c9f0cd..eda5e13 100644
--- a/common/image-sig.c
+++ b/common/image-sig.c
@@ -212,9 +212,7 @@ static int fit_image_verify_sig(const void *fit, int 
image_noffset,
int ret;
 
/* Process all hash subnodes of the component image node */
-   for (noffset = fdt_first_subnode(fit, image_noffset);
-noffset >= 0;
-noffset = fdt_next_subnode(fit, noffset)) {
+   fdt_for_each_subnode(fit, noffset, image_noffset) {
const char *name = fit_get_name(fit, noffset, NULL);
 
if (!strncmp(name, FIT_SIG_NODENAME,
@@ -262,9 +260,7 @@ int fit_image_verify_required_sigs(const void *fit, int 
image_noffset,
return 0;
}
 
-   for (noffset = fdt_first_subnode(sig_blob, sig_node);
-noffset >= 0;
-noffset = fdt_next_subnode(sig_blob, noffset)) {
+   fdt_for_each_subnode(sig_blob, noffset, sig_node) {
const char *required;
int ret;
 
@@ -397,9 +393,7 @@ static int fit_config_verify_sig(const void *fit, int 
conf_noffset,
int ret;
 
/* Process all hash subnodes of the component conf node */
-   for (noffset = fdt_first_subnode(fit, conf_noffset);
-noffset >= 0;
-noffset = fdt_next_subnode(fit, noffset)) {
+   fdt_for_each_subnode(fit, noffset, conf_noffset) {
const char *name = fit_get_name(fit, noffset, NULL);
 
if (!strncmp(name, FIT_SIG_NODENAME,
@@ -444,9 +438,7 @@ int fit_config_verify_required_sigs(const void *fit, int 
conf_noffset,
return 0;
}
 
-   for (noffset = fdt_first_subnode(sig_blob, sig_node);
-noffset >= 0;
-noffset = fdt_next_subnode(sig_blob, noffset)) {
+   fdt_for_each_subnode(sig_blob, noffset, sig_node) {
const char *required;
int ret;
 
-- 
1.9.1



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


[U-Boot] [PATCH v2] spl, spl_nor: fix compiler warning

2015-02-06 Thread Heiko Schocher
executing "tools/buildman/buildman mpc5xx" drops this warning:

common/spl/spl_nor.c: In function 'spl_nor_load_image':
common/spl/spl_nor.c:26:10: warning: assignment discards 'const' qualifier from 
pointer target type [enabled by default]

fix this.

Signed-off-by: Heiko Schocher 

---

Changes in v2:
- add comment from Masahiro Yamada:
  - add const to "struct image_header *header;"
  - change subject prefix from "powerpc, mpc5xx" to "spl, spl_nor"

 common/spl/spl_nor.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/common/spl/spl_nor.c b/common/spl/spl_nor.c
index 2c0e8e0..c2fee01 100644
--- a/common/spl/spl_nor.c
+++ b/common/spl/spl_nor.c
@@ -17,7 +17,7 @@ void spl_nor_load_image(void)
 
 #ifdef CONFIG_SPL_OS_BOOT
if (!spl_start_uboot()) {
-   struct image_header *header;
+   const struct image_header *header;
 
/*
 * Load Linux from its location in NOR flash to its defined
-- 
2.1.0

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


[U-Boot] [u-boot 00/40] dra7xx: am43xx: add dwc3 gadget driver support and enable dfu

2015-02-06 Thread Kishon Vijay Abraham I
This patch series ports dwc3 gadget driver from linux kernel (3.19-rc1)
to u-boot.

Changes from RFC:
*) A patch has been added to copy the driver from linux kernel to u-boot and 
then
   it's modfied to make it work in u-boot. This will help to understand the 
changes
   that's been done to make it work in u-boot and will also be easier to review.
*) Implemented chained TRB support in dwc3 ep0 so that we need not increase the 
size
   of bounce buffer

Testing:
*) tested DFU RAM and DFU MMC in dra7xx and am43xx

TODO:
*) Add Kconfig support
*) Adapt dwc3 driver to use the driver model.
*) Make composite driver similar to the one in linux kernel.

Pushed these patches to
git://git.ti.com/~kishon/ti-u-boot/kishons-ti-u-boot.git dwc3_upstream_v1

Kishon Vijay Abraham I (40):
  ARM: DRA7: Enable clocks for USB OTGSS and USB PHY
  ARM: AM43xx: Enable clocks for USB OTGSS and USB PHY
  usb: gadget: udc: add udc-core from linux kernel to u-boot
  include: usb: modify gadget.h to include udc support
  usb: gadget: udc: make udc-core compile in u-boot build
  include: asm: dma-mapping: get rid of the compilation warning in
udc-core
  usb: dwc3: add dwc3 folder from linux kernel to u-boot
  usb: dwc3: remove un-used files from dwc3 folder
  usb: dwc3: Modify the file headers to u-boot format
  usb: dwc3: remove trace_* APIs from dwc3 driver
  usb: dwc3: fix dwc3 header files
  usb: dwc3: remove pm related operations from dwc3 driver
  arm: asm: dma-mapping: added dma_free_coherent API
  usb: dwc3: linux-compat: Add header for dwc3 linux compatibiltiy
  usb: dwc3: gadget: make dwc3 gadget build in uboot
  include: asm: types: add resource_size_t type
  usb: dwc3: ep0: make dwc3 ep0 build in uboot
  include: usb: composite: add USB_GADGET_DELAYED_STATUS to avoid
compilation error
  usb: dwc3: core: make dwc3 core build in uboot
  include: dwc3-uboot: add a structure for populating platform data
  dwc3: core: change probe and remove to uboot init and uboot exit code
  dwc3: core: add support for multiple dwc3 controllers
  dwc3: core: added an API to invoke irq handlers
  usb: dwc3: dwc3-omap: make dwc3-omap build in uboot
  include: dwc3-omap-uboot: add a structure for populating dwc3-omap
platform data
  usb: dwc3: dwc3-omap: change probe and remove to uboot init and uboot
exit code
  dwc3: dwc3-omap: add support for multiple dwc3-omap controllers
  usb: dwc3: dwc3-omap: add interrupt status API to check for
interrupts
  usb: dwc3: TI PHY: PHY driver for dwc3 in TI platforms
  dwc3: flush the buffers before using it
  usb: dwc3: ep0: preparation for implementing chained TRB
  usb: dwc3: Add chained TRB support for ep0
  usb: dwc3: Makefile: Make dwc3 driver compile in u-boot
  usb: gadget: defer setting maxpacket till ->setup()
  common: cmd_dfu: invoke board_usb_cleanup() for cleaning up
  board: ti: DRA7: added USB initializtion code
  include: configs: Enable DWC3 and DFU in DRA7xx
  board: ti: AM43xx: added USB initializtion code
  include: configs: Enable DWC3 and DFU in AM43xx
  usb: modify usb_gadget_handle_interrupts to take controller index

 Makefile   |2 +
 arch/arm/cpu/armv7/am33xx/clock_am43xx.c   |   12 +
 arch/arm/cpu/armv7/omap5/hw_data.c |   14 +
 arch/arm/cpu/armv7/omap5/prcm-regs.c   |   10 +-
 arch/arm/include/asm/arch-am33xx/cpu.h |   22 +-
 arch/arm/include/asm/arch-am33xx/hardware_am43xx.h |   13 +
 arch/arm/include/asm/arch-omap5/omap.h |   12 +
 arch/arm/include/asm/dma-mapping.h |9 +-
 arch/arm/include/asm/omap_common.h |4 +-
 arch/arm/include/asm/types.h   |1 +
 board/ti/am43xx/board.c|  108 +
 board/ti/dra7xx/evm.c  |  109 +
 common/cmd_dfu.c   |3 +-
 common/cmd_fastboot.c  |2 +-
 common/cmd_usb_mass_storage.c  |2 +-
 common/usb.c   |7 +
 drivers/usb/dwc3/Makefile  |8 +
 drivers/usb/dwc3/core.c|  792 ++
 drivers/usb/dwc3/core.h| 1033 
 drivers/usb/dwc3/dwc3-omap.c   |  441 
 drivers/usb/dwc3/ep0.c | 1112 
 drivers/usb/dwc3/gadget.c  | 2679 
 drivers/usb/dwc3/gadget.h  |  108 +
 drivers/usb/dwc3/io.h  |   56 +
 drivers/usb/dwc3/linux-compat.h|   38 +
 drivers/usb/dwc3/ti_usb_phy.c  |  309 +++
 drivers/usb/gadget/atmel_usba_udc.c|2 +-
 drivers/usb/gadget/ci_udc.c|2 +-
 drivers/usb/gadget/composite.c |4 +-
 drivers/usb/gadget/ether.c |   12 +

[U-Boot] [u-boot 06/40] include: asm: dma-mapping: get rid of the compilation warning in udc-core

2015-02-06 Thread Kishon Vijay Abraham I
Fixed the following warning here.
"warning: ‘dma_alloc_coherent’ defined but not used" while compiling
udc-core

Signed-off-by: Kishon Vijay Abraham I 
---
 arch/arm/include/asm/dma-mapping.h |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/arch/arm/include/asm/dma-mapping.h 
b/arch/arm/include/asm/dma-mapping.h
index 55a4e26..14f00efd2 100644
--- a/arch/arm/include/asm/dma-mapping.h
+++ b/arch/arm/include/asm/dma-mapping.h
@@ -14,7 +14,7 @@ enum dma_data_direction {
DMA_FROM_DEVICE = 2,
 };
 
-static void *dma_alloc_coherent(size_t len, unsigned long *handle)
+static inline void *dma_alloc_coherent(size_t len, unsigned long *handle)
 {
*handle = (unsigned long)memalign(ARCH_DMA_MINALIGN, len);
return (void *)*handle;
-- 
1.7.9.5

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


[U-Boot] [u-boot 03/40] usb: gadget: udc: add udc-core from linux kernel to u-boot

2015-02-06 Thread Kishon Vijay Abraham I
Added udc-core.c from linux kernel 3.19-rc1 (97bf6af1f9) to u-boot.
This will be adapted to work with u-boot in the
following patches.
Adding support for udc will help to seamlessly port dwc3 driver from
linux kernel to u-boot (since dwc3 uses udc-core) and it'll also help
to add support for multiple gadget controllers to be functional at the
same time.
All other gadget drivers can also be adapted to use udc-core.

Signed-off-by: Kishon Vijay Abraham I 
---
 drivers/usb/gadget/udc/Makefile   |4 +
 drivers/usb/gadget/udc/udc-core.c |  637 +
 2 files changed, 641 insertions(+)
 create mode 100644 drivers/usb/gadget/udc/Makefile
 create mode 100644 drivers/usb/gadget/udc/udc-core.c

diff --git a/drivers/usb/gadget/udc/Makefile b/drivers/usb/gadget/udc/Makefile
new file mode 100644
index 000..be265aa
--- /dev/null
+++ b/drivers/usb/gadget/udc/Makefile
@@ -0,0 +1,4 @@
+#
+# USB peripheral controller drivers
+#
+obj-$(CONFIG_USB_GADGET)   += udc-core.o
diff --git a/drivers/usb/gadget/udc/udc-core.c 
b/drivers/usb/gadget/udc/udc-core.c
new file mode 100644
index 000..e31d574
--- /dev/null
+++ b/drivers/usb/gadget/udc/udc-core.c
@@ -0,0 +1,637 @@
+/**
+ * udc.c - Core UDC Framework
+ *
+ * Copyright (C) 2010 Texas Instruments
+ * Author: Felipe Balbi 
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2  of
+ * the License as published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see .
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+/**
+ * struct usb_udc - describes one usb device controller
+ * @driver - the gadget driver pointer. For use by the class code
+ * @dev - the child device to the actual controller
+ * @gadget - the gadget. For use by the class code
+ * @list - for use by the udc class driver
+ *
+ * This represents the internal data structure which is used by the UDC-class
+ * to hold information about udc driver and gadget together.
+ */
+struct usb_udc {
+   struct usb_gadget_driver*driver;
+   struct usb_gadget   *gadget;
+   struct device   dev;
+   struct list_headlist;
+};
+
+static struct class *udc_class;
+static LIST_HEAD(udc_list);
+static DEFINE_MUTEX(udc_lock);
+
+/* - */
+
+#ifdef CONFIG_HAS_DMA
+
+int usb_gadget_map_request(struct usb_gadget *gadget,
+   struct usb_request *req, int is_in)
+{
+   if (req->length == 0)
+   return 0;
+
+   if (req->num_sgs) {
+   int mapped;
+
+   mapped = dma_map_sg(&gadget->dev, req->sg, req->num_sgs,
+   is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
+   if (mapped == 0) {
+   dev_err(&gadget->dev, "failed to map SGs\n");
+   return -EFAULT;
+   }
+
+   req->num_mapped_sgs = mapped;
+   } else {
+   req->dma = dma_map_single(&gadget->dev, req->buf, req->length,
+   is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
+
+   if (dma_mapping_error(&gadget->dev, req->dma)) {
+   dev_err(&gadget->dev, "failed to map buffer\n");
+   return -EFAULT;
+   }
+   }
+
+   return 0;
+}
+EXPORT_SYMBOL_GPL(usb_gadget_map_request);
+
+void usb_gadget_unmap_request(struct usb_gadget *gadget,
+   struct usb_request *req, int is_in)
+{
+   if (req->length == 0)
+   return;
+
+   if (req->num_mapped_sgs) {
+   dma_unmap_sg(&gadget->dev, req->sg, req->num_mapped_sgs,
+   is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
+
+   req->num_mapped_sgs = 0;
+   } else {
+   dma_unmap_single(&gadget->dev, req->dma, req->length,
+   is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
+   }
+}
+EXPORT_SYMBOL_GPL(usb_gadget_unmap_request);
+
+#endif /* CONFIG_HAS_DMA */
+
+/* - */
+
+/**
+ * usb_gadget_giveback_request - give the request back to the gadget layer
+ * Context: in_interrupt()
+ *
+ * This is called by device controller drivers in order to return the
+ * completed request back to the gadget layer.
+ */
+void usb_gadget_giveback_request(struct usb_ep *ep,
+   struct usb_request *req)
+{
+ 

[U-Boot] [u-boot 04/40] include: usb: modify gadget.h to include udc support

2015-02-06 Thread Kishon Vijay Abraham I
Made changes in gadget.h that is required after adding udc-core.c
except changes that might break other platforms.

Signed-off-by: Kishon Vijay Abraham I 
---
 include/linux/usb/gadget.h |   43 +++
 1 file changed, 43 insertions(+)

diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h
index 9bccd45..1960958 100644
--- a/include/linux/usb/gadget.h
+++ b/include/linux/usb/gadget.h
@@ -396,6 +396,7 @@ static inline void usb_ep_fifo_flush(struct usb_ep *ep)
 /*-*/
 
 struct usb_gadget;
+struct usb_gadget_driver;
 
 /* the rest of the api to the controller hardware: device operations,
  * which don't involve endpoints (or i/o).
@@ -409,6 +410,9 @@ struct usb_gadget_ops {
int (*pullup) (struct usb_gadget *, int is_on);
int (*ioctl)(struct usb_gadget *,
unsigned code, unsigned long param);
+   int (*udc_start)(struct usb_gadget *,
+struct usb_gadget_driver *);
+   int (*udc_stop)(struct usb_gadget *);
 };
 
 /**
@@ -459,6 +463,7 @@ struct usb_gadget {
struct usb_ep   *ep0;
struct list_headep_list;/* of usb_ep */
enum usb_device_speed   speed;
+   enum usb_device_state   state;
unsignedis_dualspeed:1;
unsignedis_otg:1;
unsignedis_a_peripheral:1;
@@ -686,6 +691,7 @@ static inline int usb_gadget_disconnect(struct usb_gadget 
*gadget)
 
 /**
  * struct usb_gadget_driver - driver for usb 'slave' devices
+ * @function: String describing the gadget's function
  * @speed: Highest speed the driver handles.
  * @bind: Invoked when the driver is bound to a gadget, usually
  * after registering the driver.
@@ -707,6 +713,8 @@ static inline int usb_gadget_disconnect(struct usb_gadget 
*gadget)
  * Called in a context that permits sleeping.
  * @suspend: Invoked on USB suspend.  May be called in_interrupt.
  * @resume: Invoked on USB resume.  May be called in_interrupt.
+ * @reset: Invoked on USB bus reset. It is mandatory for all gadget drivers
+ * and should be called in_interrupt.
  *
  * Devices are disabled till a gadget driver successfully bind()s, which
  * means the driver will handle setup() requests needed to enumerate (and
@@ -753,6 +761,7 @@ static inline int usb_gadget_disconnect(struct usb_gadget 
*gadget)
  * power is maintained.
  */
 struct usb_gadget_driver {
+   char*function;
enum usb_device_speed   speed;
int (*bind)(struct usb_gadget *);
void(*unbind)(struct usb_gadget *);
@@ -761,6 +770,7 @@ struct usb_gadget_driver {
void(*disconnect)(struct usb_gadget *);
void(*suspend)(struct usb_gadget *);
void(*resume)(struct usb_gadget *);
+   void(*reset)(struct usb_gadget *);
 };
 
 
@@ -801,6 +811,10 @@ int usb_gadget_register_driver(struct usb_gadget_driver 
*driver);
  */
 int usb_gadget_unregister_driver(struct usb_gadget_driver *driver);
 
+int usb_add_gadget_udc_release(struct device *parent,
+   struct usb_gadget *gadget, void (*release)(struct device *dev));
+int usb_add_gadget_udc(struct device *parent, struct usb_gadget *gadget);
+void usb_del_gadget_udc(struct usb_gadget *gadget);
 /*-*/
 
 /* utility to simplify dealing with string descriptors */
@@ -847,6 +861,35 @@ int usb_gadget_config_buf(const struct 
usb_config_descriptor *config,
void *buf, unsigned buflen, const struct usb_descriptor_header **desc);
 
 /*-*/
+/* utility to simplify map/unmap of usb_requests to/from DMA */
+
+extern int usb_gadget_map_request(struct usb_gadget *gadget,
+ struct usb_request *req, int is_in);
+
+extern void usb_gadget_unmap_request(struct usb_gadget *gadget,
+struct usb_request *req, int is_in);
+
+/*-*/
+
+/* utility to set gadget state properly */
+
+extern void usb_gadget_set_state(struct usb_gadget *gadget,
+enum usb_device_state state);
+
+/*-*/
+
+/* utility to tell udc core that the bus reset occurs */
+extern void usb_gadget_udc_reset(struct usb_gadget *gadget,
+struct usb_gadget_driver *driver);
+
+/*-*/
+
+/* utility to give requests back to the gadget layer */
+
+extern void usb_gadget_giveback_r

[U-Boot] [u-boot 11/40] usb: dwc3: fix dwc3 header files

2015-02-06 Thread Kishon Vijay Abraham I
Changed the header files included in core.h and io.h to the u-boot header
files so that these files can be included in other dwc3 source files and
be compiled in uboot. Also added otg.h which has the defines for dr_mode.

Signed-off-by: Kishon Vijay Abraham I 
---
 drivers/usb/dwc3/core.h |   13 ++---
 drivers/usb/dwc3/io.h   |4 +---
 include/linux/usb/otg.h |   20 
 3 files changed, 23 insertions(+), 14 deletions(-)
 create mode 100644 include/linux/usb/otg.h

diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 09cec53..a7a7082 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -18,20 +18,11 @@
 #ifndef __DRIVERS_USB_DWC3_CORE_H
 #define __DRIVERS_USB_DWC3_CORE_H
 
-#include 
-#include 
 #include 
-#include 
-#include 
-#include 
-#include 
 
 #include 
-#include 
 #include 
 
-#include 
-
 #define DWC3_MSG_MAX   500
 
 /* Global constants */
@@ -981,7 +972,7 @@ struct dwc3_gadget_ep_cmd_params {
 void dwc3_set_mode(struct dwc3 *dwc, u32 mode);
 int dwc3_gadget_resize_tx_fifos(struct dwc3 *dwc);
 
-#if IS_ENABLED(CONFIG_USB_DWC3_HOST) || IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE)
+#ifdef CONFIG_USB_DWC3_HOST
 int dwc3_host_init(struct dwc3 *dwc);
 void dwc3_host_exit(struct dwc3 *dwc);
 #else
@@ -991,7 +982,7 @@ static inline void dwc3_host_exit(struct dwc3 *dwc)
 { }
 #endif
 
-#if IS_ENABLED(CONFIG_USB_DWC3_GADGET) || IS_ENABLED(CONFIG_USB_DWC3_DUAL_ROLE)
+#ifdef CONFIG_USB_DWC3_GADGET
 int dwc3_gadget_init(struct dwc3 *dwc);
 void dwc3_gadget_exit(struct dwc3 *dwc);
 int dwc3_gadget_set_test_mode(struct dwc3 *dwc, int mode);
diff --git a/drivers/usb/dwc3/io.h b/drivers/usb/dwc3/io.h
index f9f22b0..b6da135 100644
--- a/drivers/usb/dwc3/io.h
+++ b/drivers/usb/dwc3/io.h
@@ -18,9 +18,7 @@
 #ifndef __DRIVERS_USB_DWC3_IO_H
 #define __DRIVERS_USB_DWC3_IO_H
 
-#include 
-#include "debug.h"
-#include "core.h"
+#include 
 
 static inline u32 dwc3_readl(void __iomem *base, u32 offset)
 {
diff --git a/include/linux/usb/otg.h b/include/linux/usb/otg.h
new file mode 100644
index 000..7ec5550
--- /dev/null
+++ b/include/linux/usb/otg.h
@@ -0,0 +1,20 @@
+/* include/linux/usb/otg.h
+ *
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * USB OTG (On The Go) defines
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#ifndef __LINUX_USB_OTG_H
+#define __LINUX_USB_OTG_H
+
+enum usb_dr_mode {
+   USB_DR_MODE_UNKNOWN,
+   USB_DR_MODE_HOST,
+   USB_DR_MODE_PERIPHERAL,
+   USB_DR_MODE_OTG,
+};
+
+#endif /* __LINUX_USB_OTG_H */
-- 
1.7.9.5

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


[U-Boot] [u-boot 13/40] arm: asm: dma-mapping: added dma_free_coherent API

2015-02-06 Thread Kishon Vijay Abraham I
Added dma_free_coherent corresponding to the dma_alloc_coherent in
dma-mapping.h in order to free memory allocated using dma_alloc_coherent.
This API is used in dwc3 driver.

Signed-off-by: Kishon Vijay Abraham I 
---
 arch/arm/include/asm/dma-mapping.h |7 +++
 1 file changed, 7 insertions(+)

diff --git a/arch/arm/include/asm/dma-mapping.h 
b/arch/arm/include/asm/dma-mapping.h
index 14f00efd2..a5821f5 100644
--- a/arch/arm/include/asm/dma-mapping.h
+++ b/arch/arm/include/asm/dma-mapping.h
@@ -8,6 +8,8 @@
 #ifndef __ASM_ARM_DMA_MAPPING_H
 #define __ASM_ARM_DMA_MAPPING_H
 
+#definedma_mapping_error(x, y) 0
+
 enum dma_data_direction {
DMA_BIDIRECTIONAL   = 0,
DMA_TO_DEVICE   = 1,
@@ -20,6 +22,11 @@ static inline void *dma_alloc_coherent(size_t len, unsigned 
long *handle)
return (void *)*handle;
 }
 
+static inline void dma_free_coherent(void *addr)
+{
+   free(addr);
+}
+
 static inline unsigned long dma_map_single(volatile void *vaddr, size_t len,
   enum dma_data_direction dir)
 {
-- 
1.7.9.5

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


[U-Boot] [u-boot 10/40] usb: dwc3: remove trace_* APIs from dwc3 driver

2015-02-06 Thread Kishon Vijay Abraham I
Removed most of the trace_* APIs from dwc3 driver since tracepoints are not
supported in u-boot. Replaced some of the trace_* API with dev_dbg/dev/vdbg.

Signed-off-by: Kishon Vijay Abraham I 
---
 drivers/usb/dwc3/Makefile |5 +---
 drivers/usb/dwc3/ep0.c|   70 ++---
 drivers/usb/dwc3/gadget.c |   17 ---
 drivers/usb/dwc3/io.h |   17 ---
 4 files changed, 29 insertions(+), 80 deletions(-)

diff --git a/drivers/usb/dwc3/Makefile b/drivers/usb/dwc3/Makefile
index bb34fbc..afaa767 100644
--- a/drivers/usb/dwc3/Makefile
+++ b/drivers/usb/dwc3/Makefile
@@ -1,12 +1,9 @@
-# define_trace.h needs to know how to find our header
-CFLAGS_trace.o := -I$(src)
-
 ccflags-$(CONFIG_USB_DWC3_DEBUG)   := -DDEBUG
 ccflags-$(CONFIG_USB_DWC3_VERBOSE) += -DVERBOSE_DEBUG
 
 obj-$(CONFIG_USB_DWC3) += dwc3.o
 
-dwc3-y := core.o debug.o trace.o
+dwc3-y := core.o debug.o
 
 ifneq ($(filter y,$(CONFIG_USB_DWC3_HOST) $(CONFIG_USB_DWC3_DUAL_ROLE)),)
dwc3-y  += host.o
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index c9fcb77..1751b1d 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -64,7 +64,7 @@ static int dwc3_ep0_start_trans(struct dwc3 *dwc, u8 epnum, 
dma_addr_t buf_dma,
 
dep = dwc->eps[epnum];
if (dep->flags & DWC3_EP_BUSY) {
-   dwc3_trace(trace_dwc3_ep0, "%s still busy", dep->name);
+   dev_vdbg(dwc->dev, "%s still busy", dep->name);
return 0;
}
 
@@ -84,13 +84,10 @@ static int dwc3_ep0_start_trans(struct dwc3 *dwc, u8 epnum, 
dma_addr_t buf_dma,
params.param0 = upper_32_bits(dwc->ep0_trb_addr);
params.param1 = lower_32_bits(dwc->ep0_trb_addr);
 
-   trace_dwc3_prepare_trb(dep, trb);
-
ret = dwc3_send_gadget_ep_cmd(dwc, dep->number,
DWC3_DEPCMD_STARTTRANSFER, ¶ms);
if (ret < 0) {
-   dwc3_trace(trace_dwc3_ep0, "%s STARTTRANSFER failed",
-   dep->name);
+   dev_dbg(dwc->dev, "%s STARTTRANSFER failed", dep->name);
return ret;
}
 
@@ -155,8 +152,7 @@ static int __dwc3_gadget_ep0_queue(struct dwc3_ep *dep,
if (dwc->ep0state == EP0_STATUS_PHASE)
__dwc3_ep0_do_control_status(dwc, dwc->eps[direction]);
else
-   dwc3_trace(trace_dwc3_ep0,
-   "too early for delayed status");
+   dev_dbg(dwc->dev, "too early for delayed status");
 
return 0;
}
@@ -220,8 +216,7 @@ int dwc3_gadget_ep0_queue(struct usb_ep *ep, struct 
usb_request *request,
 
spin_lock_irqsave(&dwc->lock, flags);
if (!dep->endpoint.desc) {
-   dwc3_trace(trace_dwc3_ep0,
-   "trying to queue request %p to disabled %s",
+   dev_dbg(dwc->dev, "trying to queue request %p to disabled %s",
request, dep->name);
ret = -ESHUTDOWN;
goto out;
@@ -233,8 +228,7 @@ int dwc3_gadget_ep0_queue(struct usb_ep *ep, struct 
usb_request *request,
goto out;
}
 
-   dwc3_trace(trace_dwc3_ep0,
-   "queueing request %p to %s length %d state '%s'",
+   dev_vdbg(dwc->dev, "queueing request %p to %s length %d state '%s'",
request, dep->name, request->length,
dwc3_ep0_state_string(dwc->ep0state));
 
@@ -503,13 +497,12 @@ static int dwc3_ep0_set_address(struct dwc3 *dwc, struct 
usb_ctrlrequest *ctrl)
 
addr = le16_to_cpu(ctrl->wValue);
if (addr > 127) {
-   dwc3_trace(trace_dwc3_ep0, "invalid device address %d", addr);
+   dev_dbg(dwc->dev, "invalid device address %d", addr);
return -EINVAL;
}
 
if (state == USB_STATE_CONFIGURED) {
-   dwc3_trace(trace_dwc3_ep0,
-   "trying to set address when configured");
+   dev_dbg(dwc->dev, "trying to set address when configured");
return -EINVAL;
}
 
@@ -574,7 +567,7 @@ static int dwc3_ep0_set_config(struct dwc3 *dwc, struct 
usb_ctrlrequest *ctrl)
dwc3_writel(dwc->regs, DWC3_DCTL, reg);
 
dwc->resize_fifos = true;
-   dwc3_trace(trace_dwc3_ep0, "resize FIFOs flag SET");
+   dev_dbg(dwc->dev, "resize FIFOs flag SET");
}
break;
 
@@ -698,35 +691,35 @@ static int dwc3_ep0_std_request(struct dwc3 *dwc, struct 
usb_ctrlrequest *ctrl)
 
switch (ctrl->bRequest) {
case USB_REQ_GET_STATUS:
-   dwc3_trace(trace_dwc3_ep0, "USB_REQ_GET_STATUS");
+   dev_

[U-Boot] [u-boot 09/40] usb: dwc3: Modify the file headers to u-boot format

2015-02-06 Thread Kishon Vijay Abraham I
Modified the file header to the format that is used in u-boot. Also
included in the header, the commit in linux kernel from which each of
these files are added.

Signed-off-by: Kishon Vijay Abraham I 
---
 drivers/usb/dwc3/core.c  |   15 +--
 drivers/usb/dwc3/core.h  |   15 +++
 drivers/usb/dwc3/dwc3-omap.c |   14 ++
 drivers/usb/dwc3/ep0.c   |   14 ++
 drivers/usb/dwc3/gadget.c|   14 ++
 drivers/usb/dwc3/gadget.h|   16 
 drivers/usb/dwc3/io.h|   15 +++
 7 files changed, 45 insertions(+), 58 deletions(-)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 25ddc39..b79a8b3 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -1,22 +1,17 @@
 /**
  * core.c - DesignWare USB3 DRD Controller Core file
  *
- * Copyright (C) 2010-2011 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com
  *
  * Authors: Felipe Balbi ,
  * Sebastian Andrzej Siewior 
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2  of
- * the License as published by the Free Software Foundation.
+ * Taken from Linux Kernel v3.19-rc1 (drivers/usb/dwc3/core.c) and ported
+ * to uboot.
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * commit cd72f890d2 : usb: dwc3: core: enable phy suspend quirk on non-FPGA
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * SPDX-License-Identifier: GPL-2.0
  */
 
 #include 
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 4bb9aa6..09cec53 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -1,19 +1,18 @@
 /**
  * core.h - DesignWare USB3 DRD Core Header
  *
- * Copyright (C) 2010-2011 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com
  *
  * Authors: Felipe Balbi ,
  * Sebastian Andrzej Siewior 
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2  of
- * the License as published by the Free Software Foundation.
+ * Taken from Linux Kernel v3.19-rc1 (drivers/usb/dwc3/core.h) and ported
+ * to uboot.
+ *
+ * commit 460d098cb6 : usb: dwc3: make HIRD threshold configurable
+ *
+ * SPDX-License-Identifier: GPL-2.0
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
  */
 
 #ifndef __DRIVERS_USB_DWC3_CORE_H
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index 172d64e..12b57cf 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -1,19 +1,17 @@
 /**
  * dwc3-omap.c - OMAP Specific Glue layer
  *
- * Copyright (C) 2010-2011 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com
  *
  * Authors: Felipe Balbi ,
  * Sebastian Andrzej Siewior 
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2  of
- * the License as published by the Free Software Foundation.
+ * Taken from Linux Kernel v3.19-rc1 (drivers/usb/dwc3/dwc3-omap.c) and ported
+ * to uboot.
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * commit 7ee2566ff5 : usb: dwc3: dwc3-omap: get rid of 
->prepare()/->complete()
+ *
+ * SPDX-License-Identifier: GPL-2.0
  */
 
 #include 
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index 1bc77a3..c9fcb77 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -1,19 +1,17 @@
 /**
  * ep0.c - DesignWare USB3 DRD Controller Endpoint 0 Handling
  *
- * Copyright (C) 2010-2011 Texas Instruments Incorporated - http://www.ti.com
+ * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com
  *
  * Authors: Felipe Balbi ,
  * Sebastian Andrzej Siewior 
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2  of
- * the License as published by the Free Software Foundation.
+ * Taken from Linux Kernel v3.19-rc1 (drivers/usb/dwc3/ep0.c) and port

[U-Boot] [u-boot 25/40] include: dwc3-omap-uboot: add a structure for populating dwc3-omap platform data

2015-02-06 Thread Kishon Vijay Abraham I
Added a structure to populate dwc3 omap platform data. The board file should
populate these platform data before invoking dwc3 omap driver.

This will be removed once dwc3-omap driver is adapted to use the driver model.

Signed-off-by: Kishon Vijay Abraham I 
---
 drivers/usb/dwc3/dwc3-omap.c |7 ---
 include/dwc3-omap-uboot.h|   27 +++
 2 files changed, 27 insertions(+), 7 deletions(-)
 create mode 100644 include/dwc3-omap-uboot.h

diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index b385987..31a2aa3 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -120,13 +120,6 @@ struct dwc3_omap {
u32 dma_status:1;
 };
 
-enum omap_dwc3_vbus_id_status {
-   OMAP_DWC3_ID_FLOAT,
-   OMAP_DWC3_ID_GROUND,
-   OMAP_DWC3_VBUS_OFF,
-   OMAP_DWC3_VBUS_VALID,
-};
-
 static inline u32 dwc3_omap_readl(void __iomem *base, u32 offset)
 {
return readl(base + offset);
diff --git a/include/dwc3-omap-uboot.h b/include/dwc3-omap-uboot.h
new file mode 100644
index 000..b313b64
--- /dev/null
+++ b/include/dwc3-omap-uboot.h
@@ -0,0 +1,27 @@
+/* include/dwc3_omap_uboot.h
+ *
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * Designware SuperSpeed OMAP Glue uboot init
+ *
+ * SPDX-License-Identifier: GPL-2.0
+ */
+
+#ifndef __DWC3_OMAP_UBOOT_H_
+#define __DWC3_OMAP_UBOOT_H_
+
+#include 
+
+enum omap_dwc3_vbus_id_status {
+   OMAP_DWC3_ID_FLOAT,
+   OMAP_DWC3_ID_GROUND,
+   OMAP_DWC3_VBUS_OFF,
+   OMAP_DWC3_VBUS_VALID,
+};
+
+struct dwc3_omap_device {
+   void *base;
+   enum dwc3_omap_utmi_mode utmi_mode;
+   enum omap_dwc3_vbus_id_status vbus_id_status;
+};
+#endif /* __DWC3_OMAP_UBOOT_H_ */
-- 
1.7.9.5

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


[U-Boot] [u-boot 24/40] usb: dwc3: dwc3-omap: make dwc3-omap build in uboot

2015-02-06 Thread Kishon Vijay Abraham I
*) Changed the included header files to that used in u-boot.
*) Removed extcon_* APIs
*) Removed regulator_* APIs
*) Fixed other misc warnings
*) Added dwc3-omap.h to include the definitions of UTMI modes.

Signed-off-by: Kishon Vijay Abraham I 
---
 drivers/usb/dwc3/dwc3-omap.c  |  144 +++--
 include/linux/usb/dwc3-omap.h |   19 ++
 2 files changed, 27 insertions(+), 136 deletions(-)
 create mode 100644 include/linux/usb/dwc3-omap.h

diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index ce2d6a6..b385987 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -14,21 +14,16 @@
  * SPDX-License-Identifier: GPL-2.0
  */
 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
+#include 
+#include 
+#include 
+#include 
 #include 
-#include 
-#include 
-#include 
-#include 
-#include 
 
 #include 
+#include 
+
+#include "linux-compat.h"
 
 /*
  * All these registers belong to OMAP's Wrapper around the
@@ -113,7 +108,6 @@
 struct dwc3_omap {
struct device   *dev;
 
-   int irq;
void __iomem*base;
 
u32 utmi_otg_status;
@@ -124,13 +118,6 @@ struct dwc3_omap {
u32 irq0_offset;
 
u32 dma_status:1;
-
-   struct extcon_specific_cable_nb extcon_vbus_dev;
-   struct extcon_specific_cable_nb extcon_id_dev;
-   struct notifier_block   vbus_nb;
-   struct notifier_block   id_nb;
-
-   struct regulator*vbus_reg;
 };
 
 enum omap_dwc3_vbus_id_status {
@@ -205,21 +192,12 @@ static void dwc3_omap_write_irq0_set(struct dwc3_omap 
*omap, u32 value)
 static void dwc3_omap_set_mailbox(struct dwc3_omap *omap,
enum omap_dwc3_vbus_id_status status)
 {
-   int ret;
u32 val;
 
switch (status) {
case OMAP_DWC3_ID_GROUND:
dev_dbg(omap->dev, "ID GND\n");
 
-   if (omap->vbus_reg) {
-   ret = regulator_enable(omap->vbus_reg);
-   if (ret) {
-   dev_dbg(omap->dev, "regulator enable failed\n");
-   return;
-   }
-   }
-
val = dwc3_omap_read_utmi_status(omap);
val &= ~(USBOTGSS_UTMI_OTG_STATUS_IDDIG
| USBOTGSS_UTMI_OTG_STATUS_VBUSVALID
@@ -242,9 +220,6 @@ static void dwc3_omap_set_mailbox(struct dwc3_omap *omap,
break;
 
case OMAP_DWC3_ID_FLOAT:
-   if (omap->vbus_reg)
-   regulator_disable(omap->vbus_reg);
-
case OMAP_DWC3_VBUS_OFF:
dev_dbg(omap->dev, "VBUS Disconnect\n");
 
@@ -349,32 +324,6 @@ static void dwc3_omap_disable_irqs(struct dwc3_omap *omap)
 
 static u64 dwc3_omap_dma_mask = DMA_BIT_MASK(32);
 
-static int dwc3_omap_id_notifier(struct notifier_block *nb,
-   unsigned long event, void *ptr)
-{
-   struct dwc3_omap *omap = container_of(nb, struct dwc3_omap, id_nb);
-
-   if (event)
-   dwc3_omap_set_mailbox(omap, OMAP_DWC3_ID_GROUND);
-   else
-   dwc3_omap_set_mailbox(omap, OMAP_DWC3_ID_FLOAT);
-
-   return NOTIFY_DONE;
-}
-
-static int dwc3_omap_vbus_notifier(struct notifier_block *nb,
-   unsigned long event, void *ptr)
-{
-   struct dwc3_omap *omap = container_of(nb, struct dwc3_omap, vbus_nb);
-
-   if (event)
-   dwc3_omap_set_mailbox(omap, OMAP_DWC3_VBUS_VALID);
-   else
-   dwc3_omap_set_mailbox(omap, OMAP_DWC3_VBUS_OFF);
-
-   return NOTIFY_DONE;
-}
-
 static void dwc3_omap_map_offset(struct dwc3_omap *omap)
 {
struct device_node  *node = omap->dev->of_node;
@@ -420,42 +369,6 @@ static void dwc3_omap_set_utmi_mode(struct dwc3_omap *omap)
dwc3_omap_write_utmi_status(omap, reg);
 }
 
-static int dwc3_omap_extcon_register(struct dwc3_omap *omap)
-{
-   int ret;
-   struct device_node  *node = omap->dev->of_node;
-   struct extcon_dev   *edev;
-
-   if (of_property_read_bool(node, "extcon")) {
-   edev = extcon_get_edev_by_phandle(omap->dev, 0);
-   if (IS_ERR(edev)) {
-   dev_vdbg(omap->dev, "couldn't get extcon device\n");
-   return -EPROBE_DEFER;
-   }
-
-   omap->vbus_nb.notifier_call = dwc3_omap_vbus_notifier;
-   ret = extcon_register_interest(&omap->extcon_vbus_dev,
-  edev->name, "USB",
-  &omap->vbus_nb);
-   if (ret < 0)
-   dev_vdbg(omap->dev, "failed to register notifier for 
USB\n");
-
-   omap->id_nb.notifier_call = dwc3_omap_id_notifier;
-   ret = extcon_register_interest(&omap->extcon_id_dev,
-  

[U-Boot] [u-boot 22/40] dwc3: core: add support for multiple dwc3 controllers

2015-02-06 Thread Kishon Vijay Abraham I
Added support for multiple dwc3 controllers. This gives uboot
the capability to control multiple dwc3 controllers.

Signed-off-by: Kishon Vijay Abraham I 
---
 drivers/usb/dwc3/core.c |   32 
 drivers/usb/dwc3/core.h |4 
 include/dwc3-uboot.h|3 ++-
 3 files changed, 30 insertions(+), 9 deletions(-)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 58c3bfd..bd34dbd 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -29,7 +29,7 @@
 
 #include "linux-compat.h"
 
-struct dwc3 *dwc;
+static LIST_HEAD(dwc3_list);
 /* -- 
*/
 
 void dwc3_set_mode(struct dwc3 *dwc, u32 mode)
@@ -612,6 +612,7 @@ static void dwc3_core_exit_mode(struct dwc3 *dwc)
  */
 int dwc3_uboot_init(struct dwc3_device *dwc3_dev)
 {
+   struct dwc3 *dwc;
struct device   *dev;
u8  lpm_nyet_threshold;
u8  tx_de_emphasis;
@@ -678,6 +679,8 @@ int dwc3_uboot_init(struct dwc3_device *dwc3_dev)
dwc->hird_threshold = hird_threshold
| (dwc->is_utmi_l1_suspend << 4);
 
+   dwc->index = dwc3_dev->index;
+
dwc3_cache_hwparams(dwc);
 
ret = dwc3_alloc_event_buffers(dwc, DWC3_EVENT_BUFFERS_SIZE);
@@ -710,6 +713,8 @@ int dwc3_uboot_init(struct dwc3_device *dwc3_dev)
if (ret)
goto err2;
 
+   list_add_tail(&dwc->list, &dwc3_list);
+
return 0;
 
 err2:
@@ -729,17 +734,28 @@ err0:
  * @index: index of this controller
  *
  * Performs cleanup of memory allocated in dwc3_uboot_init and other misc
- * cleanups (equivalent to dwc3_remove in linux).
+ * cleanups (equivalent to dwc3_remove in linux). index of _this_ controller
+ * should be passed and should match with the index passed in
+ * dwc3_device during init.
  *
  * Generally called from board file.
  */
-void dwc3_uboot_exit()
+void dwc3_uboot_exit(int index)
 {
-   dwc3_core_exit_mode(dwc);
-   dwc3_event_buffers_cleanup(dwc);
-   dwc3_free_event_buffers(dwc);
-   dwc3_core_exit(dwc);
-   kfree(dwc->mem);
+   struct dwc3 *dwc;
+
+   list_for_each_entry(dwc, &dwc3_list, list) {
+   if (dwc->index != index)
+   continue;
+
+   dwc3_core_exit_mode(dwc);
+   dwc3_event_buffers_cleanup(dwc);
+   dwc3_free_event_buffers(dwc);
+   dwc3_core_exit(dwc);
+   list_del(&dwc->list);
+   kfree(dwc->mem);
+   break;
+   }
 }
 
 MODULE_ALIAS("platform:dwc3");
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 0d507c1..c5debf7 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -695,6 +695,8 @@ struct dwc3_scratchpad_array {
  * 1   - -3.5dB de-emphasis
  * 2   - No de-emphasis
  * 3   - Reserved
+ * @index: index of _this_ controller
+ * @list: to maintain the list of dwc3 controllers
  */
 struct dwc3 {
struct usb_ctrlrequest  *ctrl_req;
@@ -811,6 +813,8 @@ struct dwc3 {
 
unsignedtx_de_emphasis_quirk:1;
unsignedtx_de_emphasis:2;
+   int index;
+   struct list_headlist;
 };
 
 /* -- 
*/
diff --git a/include/dwc3-uboot.h b/include/dwc3-uboot.h
index 6d1b42a..272a020 100644
--- a/include/dwc3-uboot.h
+++ b/include/dwc3-uboot.h
@@ -33,8 +33,9 @@ struct dwc3_device {
unsigned dis_u2_susphy_quirk;
unsigned tx_de_emphasis_quirk;
unsigned tx_de_emphasis;
+   int index;
 };
 
 int dwc3_uboot_init(struct dwc3_device *dev);
-void dwc3_uboot_exit(void);
+void dwc3_uboot_exit(int index);
 #endif /* __DWC3_UBOOT_H_ */
-- 
1.7.9.5

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


[U-Boot] [u-boot 18/40] include: usb: composite: add USB_GADGET_DELAYED_STATUS to avoid compilation error

2015-02-06 Thread Kishon Vijay Abraham I
Added USB_GADGET_DELAYED_STATUS to avoid the following compilation error.
error: ‘USB_GADGET_DELAYED_STATUS’ undeclared (first use in this function)
while compiling dwc3/ep0.c

While this is been added only to avoid compilation error, the complete fix
should be something like the one added in linux kernel. The complete fix
will be ported once we have the composite driver in u-boot look similar to
the one in linux kernel.
commit 1b9ba000177ee47bcc5b44c7c34e48e735f5f9b1
Author: Roger Quadros 
Date:   Mon May 9 13:08:06 2011 +0300

usb: gadget: composite: Allow function drivers to pause control transfers

Signed-off-by: Kishon Vijay Abraham I 
---
 include/linux/usb/composite.h |9 +
 1 file changed, 9 insertions(+)

diff --git a/include/linux/usb/composite.h b/include/linux/usb/composite.h
index f833d10..86e1cea 100644
--- a/include/linux/usb/composite.h
+++ b/include/linux/usb/composite.h
@@ -27,6 +27,15 @@
 #include 
 #include 
 
+/*
+ * USB function drivers should return USB_GADGET_DELAYED_STATUS if they
+ * wish to delay the data/status stages of the control transfer till they
+ * are ready. The control transfer will then be kept from completing till
+ * all the function drivers that requested for USB_GADGET_DELAYED_STAUS
+ * invoke usb_composite_setup_continue().
+ */
+#defineUSB_GADGET_DELAYED_STATUS   0x7fff /* Impossibly large 
value */
+
 struct usb_configuration;
 
 /**
-- 
1.7.9.5

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


[U-Boot] [u-boot 14/40] usb: dwc3: linux-compat: Add header for dwc3 linux compatibiltiy

2015-02-06 Thread Kishon Vijay Abraham I
Added a header file to include various linux specific APIs like
pr_debug, WARN_ WARN_ON_ONCE etc.. in order to avoid compilation
error while building dwc3 driver.

Signed-off-by: Kishon Vijay Abraham I 
---
 drivers/usb/dwc3/linux-compat.h |   30 ++
 1 file changed, 30 insertions(+)
 create mode 100644 drivers/usb/dwc3/linux-compat.h

diff --git a/drivers/usb/dwc3/linux-compat.h b/drivers/usb/dwc3/linux-compat.h
new file mode 100644
index 000..58c4716
--- /dev/null
+++ b/drivers/usb/dwc3/linux-compat.h
@@ -0,0 +1,30 @@
+/**
+ * linux-compat.h - DesignWare USB3 Linux Compatibiltiy Adapter  Header
+ *
+ * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * Authors: Kishon Vijay Abraham I 
+ *
+ * Taken from Linux Kernel v3.16 (drivers/usb/dwc3/core.c) and ported
+ * to uboot.
+ *
+ * SPDX-License-Identifier:GPL-2.0
+ *
+ */
+
+#ifndef __DWC3_LINUX_COMPAT__
+#define __DWC3_LINUX_COMPAT__
+
+#define pr_debug(format)debug(format)
+#define WARN(val, format, arg...)  debug(format, ##arg)
+#define WARN_ON_ONCE(val)  debug("Error %d\n", val)
+
+#define BUILD_BUG_ON_NOT_POWER_OF_2(n)
+
+static inline size_t strlcat(char *dest, const char *src, size_t n)
+{
+   strcat(dest, src);
+   return strlen(dest) + strlen(src);
+}
+
+#endif
-- 
1.7.9.5

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


[U-Boot] [u-boot 29/40] usb: dwc3: TI PHY: PHY driver for dwc3 in TI platforms

2015-02-06 Thread Kishon Vijay Abraham I
Added a single driver for both USB2 PHY programming and USB3 PHY
programming.

USB3 PHY is taken from drivers/phy/phy-ti-pipe3.c in linux kernel.
commit 56042e : phy: ti-pipe3: Fix suspend/resume and module reload.

USB2 PHY is taken from drivers/phy/phy-omap-usb2.c in linux kernel.
commit eb82a3 : phy: omap-usb2: Balance pm_runtime_enable() on probe
failure and remove.

Signed-off-by: Kishon Vijay Abraham I 
---
 drivers/usb/dwc3/ti_usb_phy.c |  309 +
 include/ti-usb-phy-uboot.h|   22 +++
 2 files changed, 331 insertions(+)
 create mode 100644 drivers/usb/dwc3/ti_usb_phy.c
 create mode 100644 include/ti-usb-phy-uboot.h

diff --git a/drivers/usb/dwc3/ti_usb_phy.c b/drivers/usb/dwc3/ti_usb_phy.c
new file mode 100644
index 000..e6048eb
--- /dev/null
+++ b/drivers/usb/dwc3/ti_usb_phy.c
@@ -0,0 +1,309 @@
+/**
+ * ti_usb_phy.c - USB3 and USB3 PHY programming for dwc3
+ *
+ * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * Author: Kishon Vijay Abraham I 
+ *
+ * Taken from Linux Kernel v3.16 (drivers/phy/phy-ti-pipe3.c and
+ * drivers/phy/phy-omap-usb2.c) and ported to uboot.
+ *
+ * "commit 56042e : phy: ti-pipe3: Fix suspend/resume and module reload" for
+ * phy-ti-pipe3.c
+ *
+ * "commit eb82a3 : phy: omap-usb2: Balance pm_runtime_enable() on probe 
failure
+ * and remove" for phy-omap-usb2.c
+ *
+ * SPDX-License-Identifier: GPL-2.0+
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "linux-compat.h"
+
+#define PLL_STATUS 0x0004
+#define PLL_GO 0x0008
+#define PLL_CONFIGURATION1 0x000C
+#define PLL_CONFIGURATION2 0x0010
+#define PLL_CONFIGURATION3 0x0014
+#define PLL_CONFIGURATION4 0x0020
+
+#define PLL_REGM_MASK  0x001FFE00
+#define PLL_REGM_SHIFT 0x9
+#define PLL_REGM_F_MASK0x0003
+#define PLL_REGM_F_SHIFT   0x0
+#define PLL_REGN_MASK  0x01FE
+#define PLL_REGN_SHIFT 0x1
+#define PLL_SELFREQDCO_MASK0x000E
+#define PLL_SELFREQDCO_SHIFT   0x1
+#define PLL_SD_MASK0x0003FC00
+#define PLL_SD_SHIFT   10
+#define SET_PLL_GO 0x1
+#define PLL_LDOPWDNBIT(15)
+#define PLL_TICOPWDN   BIT(16)
+#define PLL_LOCK   0x2
+#define PLL_IDLE   0x1
+
+#define OMAP_CTRL_DEV_PHY_PD   BIT(0)
+#define OMAP_CTRL_USB3_PHY_PWRCTL_CLK_CMD_MASK 0x003FC000
+#define OMAP_CTRL_USB3_PHY_PWRCTL_CLK_CMD_SHIFT0xE
+
+#define OMAP_CTRL_USB3_PHY_PWRCTL_CLK_FREQ_MASK0xFFC0
+#define OMAP_CTRL_USB3_PHY_PWRCTL_CLK_FREQ_SHIFT   0x16
+
+#define OMAP_CTRL_USB3_PHY_TX_RX_POWERON   0x3
+#define OMAP_CTRL_USB3_PHY_TX_RX_POWEROFF  0x0
+
+#define OMAP_CTRL_USB2_PHY_PD  BIT(28)
+
+#define AM437X_CTRL_USB2_PHY_PDBIT(0)
+#define AM437X_CTRL_USB2_OTG_PDBIT(1)
+#define AM437X_CTRL_USB2_OTGVDET_ENBIT(19)
+#define AM437X_CTRL_USB2_OTGSESSEND_EN BIT(20)
+
+static LIST_HEAD(ti_usb_phy_list);
+typedef unsigned int u32;
+
+struct usb3_dpll_params {
+   u16 m;
+   u8  n;
+   u8  freq:3;
+   u8  sd;
+   u32 mf;
+};
+
+struct usb3_dpll_map {
+   unsigned long rate;
+   struct usb3_dpll_params params;
+   struct usb3_dpll_map *dpll_map;
+};
+
+struct ti_usb_phy {
+   void __iomem *pll_ctrl_base;
+   void __iomem *usb2_phy_power;
+   void __iomem *usb3_phy_power;
+   struct usb3_dpll_map *dpll_map;
+   struct list_head list;
+   int index;
+};
+
+static struct usb3_dpll_map dpll_map_usb[] = {
+   {1200, {1250, 5, 4, 20, 0} },   /* 12 MHz */
+   {1680, {3125, 20, 4, 20, 0} },  /* 16.8 MHz */
+   {1920, {1172, 8, 4, 20, 65537} },   /* 19.2 MHz */
+   {2000, {1000, 7, 4, 10, 0} },   /* 20 MHz */
+   {2600, {1250, 12, 4, 20, 0} },  /* 26 MHz */
+   {3840, {3125, 47, 4, 20, 92843} },  /* 38.4 MHz */
+   { },/* Terminator */
+};
+
+static inline unsigned int ti_usb3_readl(void __iomem *base, u32 offset)
+{
+   return readl(base + offset);
+}
+
+static inline void ti_usb3_writel(void __iomem *base, u32 offset, u32 value)
+{
+   writel(value, base + offset);
+}
+
+#ifndef CONFIG_AM43XX
+static struct usb3_dpll_params *ti_usb3_get_dpll_params(struct ti_usb_phy *phy)
+{
+   unsigned long rate;
+   struct usb3_dpll_map *dpll_map = phy->dpll_map;
+
+   rate = get_sys_clk_freq();
+
+   for (; dpll_map->rate; dpll_map++) {
+   if (rate == dpll_map->rate)
+   return &dpll_map->params;
+   }
+
+   dev_err(phy->dev, "No DPLL configuration for %lu Hz SYS CLK\n", rate);
+
+   return NULL;
+}
+
+static int ti_usb3_dpll_wait_lock(struct ti_usb_phy *phy)
+{
+  

[U-Boot] [u-boot 27/40] dwc3: dwc3-omap: add support for multiple dwc3-omap controllers

2015-02-06 Thread Kishon Vijay Abraham I
Added support for multiple dwc3 omap controllers. This gives uboot
the capability to control multiple dwc3 omap controllers.

Signed-off-by: Kishon Vijay Abraham I 
---
 drivers/usb/dwc3/dwc3-omap.c |   26 --
 include/dwc3-omap-uboot.h|3 ++-
 2 files changed, 22 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index 30d7210..c8275c7 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -119,9 +119,11 @@ struct dwc3_omap {
u32 irq0_offset;
 
u32 dma_status:1;
+   struct list_headlist;
+   u32 index;
 };
 
-struct dwc3_omap *omap;
+static LIST_HEAD(dwc3_omap_list);
 
 static inline u32 dwc3_omap_readl(void __iomem *base, u32 offset)
 {
@@ -363,12 +365,14 @@ int dwc3_omap_uboot_init(struct dwc3_omap_device 
*omap_dev)
 {
u32 reg;
struct device   *dev;
+   struct dwc3_omap*omap;
 
omap = devm_kzalloc(dev, sizeof(*omap), GFP_KERNEL);
if (!omap)
return -ENOMEM;
 
omap->base  = omap_dev->base;
+   omap->index = omap_dev->index;
 
dwc3_omap_map_offset(omap);
dwc3_omap_set_utmi_mode(omap, omap_dev->utmi_mode);
@@ -380,6 +384,7 @@ int dwc3_omap_uboot_init(struct dwc3_omap_device *omap_dev)
dwc3_omap_set_mailbox(omap, omap_dev->vbus_id_status);
 
dwc3_omap_enable_irqs(omap);
+   list_add_tail(&omap->list, &dwc3_omap_list);
 
return 0;
 }
@@ -389,16 +394,25 @@ int dwc3_omap_uboot_init(struct dwc3_omap_device 
*omap_dev)
  * @index: index of this controller
  *
  * Performs cleanup of memory allocated in dwc3_omap_uboot_init
- * (equivalent to dwc3_omap_remove in linux).
+ * (equivalent to dwc3_omap_remove in linux). index of _this_ controller
+ * should be passed and should match with the index passed in
+ * dwc3_omap_device during init.
  *
  * Generally called from board file.
  */
-void dwc3_omap_uboot_exit(void)
+void dwc3_omap_uboot_exit(int index)
 {
-   dwc3_omap_disable_irqs(omap);
-   kfree(omap);
+   struct dwc3_omap *omap = NULL;
 
-   return 0;
+   list_for_each_entry(omap, &dwc3_omap_list, list) {
+   if (omap->index != index)
+   continue;
+
+   dwc3_omap_disable_irqs(omap);
+   list_del(&omap->list);
+   kfree(omap);
+   break;
+   }
 }
 
 MODULE_ALIAS("platform:omap-dwc3");
diff --git a/include/dwc3-omap-uboot.h b/include/dwc3-omap-uboot.h
index 99f8f38..29f02f8 100644
--- a/include/dwc3-omap-uboot.h
+++ b/include/dwc3-omap-uboot.h
@@ -21,10 +21,11 @@ enum omap_dwc3_vbus_id_status {
 
 struct dwc3_omap_device {
void *base;
+   int index;
enum dwc3_omap_utmi_mode utmi_mode;
enum omap_dwc3_vbus_id_status vbus_id_status;
 };
 
 int dwc3_omap_uboot_init(struct dwc3_omap_device *dev);
-void dwc3_omap_uboot_exit(void);
+void dwc3_omap_uboot_exit(int index);
 #endif /* __DWC3_OMAP_UBOOT_H_ */
-- 
1.7.9.5

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


[U-Boot] [u-boot 30/40] dwc3: flush the buffers before using it

2015-02-06 Thread Kishon Vijay Abraham I
In the linux kernel, non cacheable buffers are used. However in uboot
since there are no APIs to allocate non cacheable memory, all
the buffers should be flushed before using it.

Signed-off-by: Kishon Vijay Abraham I 
---
 drivers/usb/dwc3/core.c   |7 +++
 drivers/usb/dwc3/ep0.c|6 ++
 drivers/usb/dwc3/gadget.c |5 +
 drivers/usb/dwc3/io.h |6 ++
 4 files changed, 24 insertions(+)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 5a8d5ea..4c3637f 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -769,11 +769,18 @@ void dwc3_uboot_exit(int index)
 void dwc3_uboot_handle_interrupt(int index)
 {
struct dwc3 *dwc = NULL;
+   int i;
+   struct dwc3_event_buffer *evt;
 
list_for_each_entry(dwc, &dwc3_list, list) {
if (dwc->index != index)
continue;
 
+   for (i = 0; i < dwc->num_event_buffers; i++) {
+   evt = dwc->ev_buffs[i];
+   dwc3_flush_cache((int)evt->buf, evt->length);
+   }
+
dwc3_gadget_uboot_handle_interrupt(dwc);
break;
}
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index 803ba51..977d6d4 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -74,6 +74,9 @@ static int dwc3_ep0_start_trans(struct dwc3 *dwc, u8 epnum, 
dma_addr_t buf_dma,
| DWC3_TRB_CTRL_IOC
| DWC3_TRB_CTRL_ISP_IMI);
 
+   dwc3_flush_cache((int)buf_dma, len);
+   dwc3_flush_cache((int)trb, sizeof(*trb));
+
memset(¶ms, 0, sizeof(params));
params.param0 = upper_32_bits(dwc->ep0_trb_addr);
params.param1 = lower_32_bits(dwc->ep0_trb_addr);
@@ -774,6 +777,8 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
if (!r)
return;
 
+   dwc3_flush_cache((int)trb, sizeof(*trb));
+
status = DWC3_TRB_SIZE_TRBSTS(trb->size);
if (status == DWC3_TRBSTS_SETUP_PENDING) {
dev_dbg(dwc->dev, "Setup Pending received");
@@ -795,6 +800,7 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
transfer_size += (maxp - (transfer_size % maxp));
transferred = min_t(u32, ur->length,
transfer_size - length);
+   dwc3_flush_cache((int)dwc->ep0_bounce, DWC3_EP0_BOUNCE_SIZE);
memcpy(ur->buf, dwc->ep0_bounce, transferred);
} else {
transferred = ur->length - length;
diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 1f97729..b68b6a4 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -244,6 +244,7 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct 
dwc3_request *req,
 
list_del(&req->list);
req->trb = NULL;
+   dwc3_flush_cache((int)req->request.dma, req->request.length);
 
if (req->request.status == -EINPROGRESS)
req->request.status = status;
@@ -769,6 +770,9 @@ static void dwc3_prepare_one_trb(struct dwc3_ep *dep,
trb->ctrl |= DWC3_TRB_CTRL_SID_SOFN(req->request.stream_id);
 
trb->ctrl |= DWC3_TRB_CTRL_HWO;
+
+   dwc3_flush_cache((int)dma, length);
+   dwc3_flush_cache((int)trb, sizeof(*trb));
 }
 
 /*
@@ -1770,6 +1774,7 @@ static int dwc3_cleanup_done_reqs(struct dwc3 *dwc, 
struct dwc3_ep *dep,
slot %= DWC3_TRB_NUM;
trb = &dep->trb_pool[slot];
 
+   dwc3_flush_cache((int)trb, sizeof(*trb));
ret = __dwc3_cleanup_done_trbs(dwc, dep, req, trb,
event, status);
if (ret)
diff --git a/drivers/usb/dwc3/io.h b/drivers/usb/dwc3/io.h
index b6da135..31606de 100644
--- a/drivers/usb/dwc3/io.h
+++ b/drivers/usb/dwc3/io.h
@@ -20,6 +20,7 @@
 
 #include 
 
+#defineCACHELINE_SIZE  CONFIG_SYS_CACHELINE_SIZE
 static inline u32 dwc3_readl(void __iomem *base, u32 offset)
 {
u32 offs = offset - DWC3_GLOBALS_REGS_START;
@@ -47,4 +48,9 @@ static inline void dwc3_writel(void __iomem *base, u32 
offset, u32 value)
writel(value, base + offs);
 }
 
+static inline void dwc3_flush_cache(int addr, int length)
+{
+   flush_dcache_range(addr & ~(CACHELINE_SIZE - 1),
+  ALIGN(addr + length, CACHELINE_SIZE));
+}
 #endif /* __DRIVERS_USB_DWC3_IO_H */
-- 
1.7.9.5

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


[U-Boot] [u-boot 37/40] include: configs: Enable DWC3 and DFU in DRA7xx

2015-02-06 Thread Kishon Vijay Abraham I
Enabled dwc3, dwc3-omap and PHY for dwc3 are enabled. Also enabled
support for DFU.

Signed-off-by: Kishon Vijay Abraham I 
---
 include/configs/dra7xx_evm.h  |   63 +
 include/configs/ti_omap5_common.h |5 +++
 2 files changed, 68 insertions(+)

diff --git a/include/configs/dra7xx_evm.h b/include/configs/dra7xx_evm.h
index 174a711..75b55d9 100644
--- a/include/configs/dra7xx_evm.h
+++ b/include/configs/dra7xx_evm.h
@@ -43,6 +43,47 @@
"uuid_disk=${uuid_gpt_disk};" \
"name=rootfs,start=2MiB,size=-,uuid=${uuid_gpt_rootfs}"
 
+#define DFU_ALT_INFO_MMC \
+   "dfu_alt_info_mmc=" \
+   "boot part 0 1;" \
+   "rootfs part 0 2;" \
+   "MLO fat 0 1;" \
+   "MLO.raw raw 0x100 0x100;" \
+   "u-boot.img.raw raw 0x300 0x400;" \
+   "spl-os-args.raw raw 0x80 0x80;" \
+   "spl-os-image.raw raw 0x900 0x2000;" \
+   "spl-os-args fat 0 1;" \
+   "spl-os-image fat 0 1;" \
+   "u-boot.img fat 0 1;" \
+   "uEnv.txt fat 0 1\0"
+
+#define DFU_ALT_INFO_EMMC \
+   "dfu_alt_info_emmc=" \
+   "rawemmc raw 0 3751936;" \
+   "boot part 1 1;" \
+   "rootfs part 1 2;" \
+   "MLO fat 1 1;" \
+   "MLO.raw raw 0x100 0x100;" \
+   "u-boot.img.raw raw 0x300 0x400;" \
+   "spl-os-args.raw raw 0x80 0x80;" \
+   "spl-os-image.raw raw 0x900 0x2000;" \
+   "spl-os-args fat 1 1;" \
+   "spl-os-image fat 1 1;" \
+   "u-boot.img fat 1 1;" \
+   "uEnv.txt fat 1 1\0"
+
+#define DFU_ALT_INFO_RAM \
+   "dfu_alt_info_ram=" \
+   "kernel ram 0x8020 0x400;" \
+   "fdt ram 0x80f8 0x8;" \
+   "ramdisk ram 0x8100 0x400\0"
+
+#define DFUARGS \
+   "dfu_bufsiz=0x1\0" \
+   DFU_ALT_INFO_MMC \
+   DFU_ALT_INFO_EMMC \
+   DFU_ALT_INFO_RAM
+
 #include 
 
 /* Enhance our eMMC support / experience. */
@@ -132,6 +173,28 @@
 #define CONFIG_OMAP_USB_PHY
 #define CONFIG_OMAP_USB2PHY2_HOST
 
+/* USB GADGET */
+#define CONFIG_USB_DWC3_PHY_OMAP
+#define CONFIG_USB_DWC3_OMAP
+#define CONFIG_USB_DWC3
+#define CONFIG_USB_DWC3_GADGET
+
+#define CONFIG_USB_GADGET
+#define CONFIG_USBDOWNLOAD_GADGET
+#define CONFIG_USB_GADGET_VBUS_DRAW 2
+#define CONFIG_G_DNL_MANUFACTURER "Texas Instruments"
+#define CONFIG_G_DNL_VENDOR_NUM 0x0403
+#define CONFIG_G_DNL_PRODUCT_NUM 0xBD00
+#define CONFIG_USB_GADGET_DUALSPEED
+
+/* USB Device Firmware Update support */
+#define CONFIG_DFU_FUNCTION
+#define CONFIG_DFU_RAM
+#define CONFIG_CMD_DFU
+
+#define CONFIG_DFU_MMC
+#define CONFIG_DFU_RAM
+
 /* SATA */
 #define CONFIG_BOARD_LATE_INIT
 #define CONFIG_CMD_SCSI
diff --git a/include/configs/ti_omap5_common.h 
b/include/configs/ti_omap5_common.h
index c47651d..cdc539c 100644
--- a/include/configs/ti_omap5_common.h
+++ b/include/configs/ti_omap5_common.h
@@ -65,6 +65,10 @@
 #define PARTS_DEFAULT
 #endif
 
+#ifndef DFUARGS
+#define DFUARGS
+#endif
+
 #define CONFIG_ENV_VARS_UBOOT_RUNTIME_CONFIG
 #define CONFIG_EXTRA_ENV_SETTINGS \
DEFAULT_LINUX_BOOT_ENV \
@@ -122,6 +126,7 @@
"if test $fdtfile = undefined; then " \
"echo WARNING: Could not determine device tree to use; 
fi; \0" \
"loadfdt=load mmc ${bootpart} ${fdtaddr} ${bootdir}/${fdtfile};\0" \
+   DFUARGS \
 
 #define CONFIG_BOOTCOMMAND \
"run findfdt; " \
-- 
1.7.9.5

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


[U-Boot] [u-boot 38/40] board: ti: AM43xx: added USB initializtion code

2015-02-06 Thread Kishon Vijay Abraham I
Implemented board_usb_init(), board_usb_cleanup() and
usb_gadget_handle_interrupts() in am43xx board file that
can be invoked by various gadget drivers.

Signed-off-by: Kishon Vijay Abraham I 
---
 arch/arm/include/asm/arch-am33xx/hardware_am43xx.h |9 ++
 board/ti/am43xx/board.c|  108 
 2 files changed, 117 insertions(+)

diff --git a/arch/arm/include/asm/arch-am33xx/hardware_am43xx.h 
b/arch/arm/include/asm/arch-am33xx/hardware_am43xx.h
index 5f259da..110f329 100644
--- a/arch/arm/include/asm/arch-am33xx/hardware_am43xx.h
+++ b/arch/arm/include/asm/arch-am33xx/hardware_am43xx.h
@@ -61,6 +61,15 @@
 /* RTC base address */
 #define RTC_BASE   0x44E3E000
 
+/* USB OTG */
+#define USB_OTG_SS1_BASE   0x4839
+#define USB_OTG_SS1_GLUE_BASE  0x4838
+#define USB2_PHY1_POWER0x44E10620
+
+#define USB_OTG_SS2_BASE   0x483D
+#define USB_OTG_SS2_GLUE_BASE  0x483C
+#define USB2_PHY2_POWER0x44E10628
+
 /* USB Clock Control */
 #define PRM_PER_USB_OTG_SS0_CLKCTRL (CM_PER + 0x260)
 #define PRM_PER_USB_OTG_SS1_CLKCTRL (CM_PER + 0x268)
diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c
index a1c3c17..a8796b1 100644
--- a/board/ti/am43xx/board.c
+++ b/board/ti/am43xx/board.c
@@ -12,6 +12,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -23,6 +24,10 @@
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
+#include 
 
 DECLARE_GLOBAL_DATA_PTR;
 
@@ -686,6 +691,109 @@ int board_late_init(void)
 }
 #endif
 
+#ifdef CONFIG_USB_DWC3
+static struct dwc3_device usb_otg_ss1 = {
+   .maximum_speed = USB_SPEED_HIGH,
+   .base = USB_OTG_SS1_BASE,
+   .tx_fifo_resize = false,
+   .index = 0,
+};
+
+static struct dwc3_omap_device usb_otg_ss1_glue = {
+   .base = (void *)USB_OTG_SS1_GLUE_BASE,
+   .utmi_mode = DWC3_OMAP_UTMI_MODE_SW,
+   .vbus_id_status = OMAP_DWC3_VBUS_VALID,
+   .index = 0,
+};
+
+static struct ti_usb_phy_device usb_phy1_device = {
+   .usb2_phy_power = (void *)USB2_PHY1_POWER,
+   .index = 0,
+};
+
+static struct dwc3_device usb_otg_ss2 = {
+   .maximum_speed = USB_SPEED_HIGH,
+   .base = USB_OTG_SS2_BASE,
+   .tx_fifo_resize = false,
+   .index = 1,
+};
+
+static struct dwc3_omap_device usb_otg_ss2_glue = {
+   .base = (void *)USB_OTG_SS2_GLUE_BASE,
+   .utmi_mode = DWC3_OMAP_UTMI_MODE_SW,
+   .vbus_id_status = OMAP_DWC3_VBUS_VALID,
+   .index = 1,
+};
+
+static struct ti_usb_phy_device usb_phy2_device = {
+   .usb2_phy_power = (void *)USB2_PHY2_POWER,
+   .index = 1,
+};
+
+int board_usb_init(int index, enum usb_init_type init)
+{
+   switch (index) {
+   case 0:
+   if (init == USB_INIT_DEVICE) {
+   usb_otg_ss1.dr_mode = USB_DR_MODE_PERIPHERAL;
+   usb_otg_ss1_glue.vbus_id_status = OMAP_DWC3_VBUS_VALID;
+   } else {
+   usb_otg_ss1.dr_mode = USB_DR_MODE_HOST;
+   usb_otg_ss1_glue.vbus_id_status = OMAP_DWC3_ID_GROUND;
+   }
+
+   dwc3_omap_uboot_init(&usb_otg_ss1_glue);
+   ti_usb_phy_uboot_init(&usb_phy1_device);
+   dwc3_uboot_init(&usb_otg_ss1);
+   break;
+   case 1:
+   if (init == USB_INIT_DEVICE) {
+   usb_otg_ss2.dr_mode = USB_DR_MODE_PERIPHERAL;
+   usb_otg_ss2_glue.vbus_id_status = OMAP_DWC3_VBUS_VALID;
+   } else {
+   usb_otg_ss2.dr_mode = USB_DR_MODE_HOST;
+   usb_otg_ss2_glue.vbus_id_status = OMAP_DWC3_ID_GROUND;
+   }
+
+   ti_usb_phy_uboot_init(&usb_phy2_device);
+   dwc3_omap_uboot_init(&usb_otg_ss2_glue);
+   dwc3_uboot_init(&usb_otg_ss2);
+   break;
+   default:
+   printf("Invalid Controller Index\n");
+   }
+
+   return 0;
+}
+
+int board_usb_cleanup(int index, enum usb_init_type init)
+{
+   switch (index) {
+   case 0:
+   case 1:
+   ti_usb_phy_uboot_exit(index);
+   dwc3_uboot_exit(index);
+   dwc3_omap_uboot_exit(index);
+   break;
+   default:
+   printf("Invalid Controller Index\n");
+   }
+
+   return 0;
+}
+
+int usb_gadget_handle_interrupts(void)
+{
+   u32 status;
+
+   status = dwc3_omap_uboot_interrupt_status(0);
+   if (status)
+   dwc3_uboot_handle_interrupt(0);
+
+   return 0;
+}
+#endif
+
 #ifdef CONFIG_DRIVER_TI_CPSW
 
 static void cpsw_control(int enabled)
-- 
1.7.9.5

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


[U-Boot] [u-boot 40/40] usb: modify usb_gadget_handle_interrupts to take controller index

2015-02-06 Thread Kishon Vijay Abraham I
Since we support multiple dwc3 controllers to be existent at the same
time, in order to handle the interrupts of a particular dwc3 controller
usb_gadget_handle_interrutps should take controller index as an
argument.

Hence the API of usb_gadget_handle_interrupts is modified to take
controller index as an argument and made the corresponding changes to all
the usb_gadget_handle_interrupts calls.

Signed-off-by: Kishon Vijay Abraham I 
---
 board/ti/am43xx/board.c |6 +++---
 board/ti/dra7xx/evm.c   |6 +++---
 common/cmd_dfu.c|2 +-
 common/cmd_fastboot.c   |2 +-
 common/cmd_usb_mass_storage.c   |2 +-
 drivers/usb/gadget/atmel_usba_udc.c |2 +-
 drivers/usb/gadget/ci_udc.c |2 +-
 drivers/usb/gadget/ether.c  |   10 +-
 drivers/usb/gadget/f_mass_storage.c |2 +-
 drivers/usb/gadget/f_thor.c |6 +++---
 drivers/usb/gadget/fotg210.c|2 +-
 drivers/usb/gadget/pxa25x_udc.c |2 +-
 drivers/usb/gadget/s3c_udc_otg.c|2 +-
 drivers/usb/musb-new/musb_uboot.c   |2 +-
 include/linux/usb/gadget.h  |2 +-
 15 files changed, 25 insertions(+), 25 deletions(-)

diff --git a/board/ti/am43xx/board.c b/board/ti/am43xx/board.c
index a8796b1..096e5db 100644
--- a/board/ti/am43xx/board.c
+++ b/board/ti/am43xx/board.c
@@ -782,13 +782,13 @@ int board_usb_cleanup(int index, enum usb_init_type init)
return 0;
 }
 
-int usb_gadget_handle_interrupts(void)
+int usb_gadget_handle_interrupts(int index)
 {
u32 status;
 
-   status = dwc3_omap_uboot_interrupt_status(0);
+   status = dwc3_omap_uboot_interrupt_status(index);
if (status)
-   dwc3_uboot_handle_interrupt(0);
+   dwc3_uboot_handle_interrupt(index);
 
return 0;
 }
diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c
index 284775c..3089fa2 100644
--- a/board/ti/dra7xx/evm.c
+++ b/board/ti/dra7xx/evm.c
@@ -220,13 +220,13 @@ int board_usb_cleanup(int index, enum usb_init_type init)
return 0;
 }
 
-int usb_gadget_handle_interrupts(void)
+int usb_gadget_handle_interrupts(int index)
 {
u32 status;
 
-   status = dwc3_omap_uboot_interrupt_status(0);
+   status = dwc3_omap_uboot_interrupt_status(index);
if (status)
-   dwc3_uboot_handle_interrupt(0);
+   dwc3_uboot_handle_interrupt(index);
 
return 0;
 }
diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c
index 161d38b..ec90998 100644
--- a/common/cmd_dfu.c
+++ b/common/cmd_dfu.c
@@ -64,7 +64,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char 
* const argv[])
if (ctrlc())
goto exit;
 
-   usb_gadget_handle_interrupts();
+   usb_gadget_handle_interrupts(controller_index);
}
 exit:
g_dnl_unregister();
diff --git a/common/cmd_fastboot.c b/common/cmd_fastboot.c
index b72f4f3..8281f8e 100644
--- a/common/cmd_fastboot.c
+++ b/common/cmd_fastboot.c
@@ -25,7 +25,7 @@ static int do_fastboot(cmd_tbl_t *cmdtp, int flag, int argc, 
char *const argv[])
break;
if (ctrlc())
break;
-   usb_gadget_handle_interrupts();
+   usb_gadget_handle_interrupts(0);
}
 
g_dnl_unregister();
diff --git a/common/cmd_usb_mass_storage.c b/common/cmd_usb_mass_storage.c
index 2c879ea..c5f909d 100644
--- a/common/cmd_usb_mass_storage.c
+++ b/common/cmd_usb_mass_storage.c
@@ -137,7 +137,7 @@ int do_usb_mass_storage(cmd_tbl_t *cmdtp, int flag,
}
 
while (1) {
-   usb_gadget_handle_interrupts();
+   usb_gadget_handle_interrupts(controller_index);
 
rc = fsg_main_thread(NULL);
if (rc) {
diff --git a/drivers/usb/gadget/atmel_usba_udc.c 
b/drivers/usb/gadget/atmel_usba_udc.c
index fbc74f3..1e23d09 100644
--- a/drivers/usb/gadget/atmel_usba_udc.c
+++ b/drivers/usb/gadget/atmel_usba_udc.c
@@ -1199,7 +1199,7 @@ static struct usba_udc controller = {
},
 };
 
-int usb_gadget_handle_interrupts(void)
+int usb_gadget_handle_interrupts(int index)
 {
struct usba_udc *udc = &controller;
 
diff --git a/drivers/usb/gadget/ci_udc.c b/drivers/usb/gadget/ci_udc.c
index b0ef35e..a7dc0b2 100644
--- a/drivers/usb/gadget/ci_udc.c
+++ b/drivers/usb/gadget/ci_udc.c
@@ -741,7 +741,7 @@ void udc_irq(void)
}
 }
 
-int usb_gadget_handle_interrupts(void)
+int usb_gadget_handle_interrupts(int index)
 {
u32 value;
struct ci_udc *udc = (struct ci_udc *)controller.ctrl->hcor;
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index 8ccf9b0..ba79faf 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -1908,7 +1908,7 @@ static int eth_stop(struct eth_dev *dev)
/* Wait until host receives OID_GEN_MEDIA_CONNECT_STATUS */
ts = get_timer(0);

[U-Boot] [u-boot 39/40] include: configs: Enable DWC3 and DFU in AM43xx

2015-02-06 Thread Kishon Vijay Abraham I
Enabled dwc3, dwc3-omap and PHY for dwc3 are enabled. Also enabled
support for DFU.

Signed-off-by: Kishon Vijay Abraham I 
---
 include/configs/am43xx_evm.h |   61 +-
 1 file changed, 60 insertions(+), 1 deletion(-)

diff --git a/include/configs/am43xx_evm.h b/include/configs/am43xx_evm.h
index 4472c3e..3fcd99e 100644
--- a/include/configs/am43xx_evm.h
+++ b/include/configs/am43xx_evm.h
@@ -108,6 +108,64 @@
 #define CONFIG_OMAP_USB_PHY
 #define CONFIG_AM437X_USB2PHY2_HOST
 
+/* USB GADGET */
+#if !defined(CONFIG_SPL_BUILD) || \
+   (defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_USBETH_SUPPORT))
+#define CONFIG_USB_DWC3_PHY_OMAP
+#define CONFIG_USB_DWC3_OMAP
+#define CONFIG_USB_DWC3
+#define CONFIG_USB_DWC3_GADGET
+
+#define CONFIG_USB_GADGET
+#define CONFIG_USB_ETHER
+#define CONFIG_USB_ETH_RNDIS
+#define CONFIG_USBNET_HOST_ADDR"de:ad:be:af:00:00"
+#define CONFIG_USBDOWNLOAD_GADGET
+#define CONFIG_USB_GADGET_VBUS_DRAW 2
+#define CONFIG_G_DNL_MANUFACTURER "Texas Instruments"
+#define CONFIG_G_DNL_VENDOR_NUM 0x0403
+#define CONFIG_G_DNL_PRODUCT_NUM 0xBD00
+#define CONFIG_USB_GADGET_DUALSPEED
+#endif
+
+#ifndef CONFIG_SPL_BUILD
+/* USB Device Firmware Update support */
+#define CONFIG_DFU_FUNCTION
+#define CONFIG_DFU_RAM
+#define CONFIG_CMD_DFU
+
+#define CONFIG_DFU_MMC
+#define DFU_ALT_INFO_MMC \
+   "dfu_alt_info_mmc=" \
+   "boot part 0 1;" \
+   "rootfs part 0 2;" \
+   "MLO fat 0 1;" \
+   "spl-os-args fat 0 1;" \
+   "spl-os-image fat 0 1;" \
+   "u-boot.img fat 0 1;" \
+   "uEnv.txt fat 0 1\0"
+
+#define DFU_ALT_INFO_EMMC \
+   "dfu_alt_info_emmc=" \
+   "MLO raw 0x100 0x100 mmcpart 0;" \
+   "u-boot.img raw 0x300 0x1000 mmcpart 0\0"
+
+#define CONFIG_DFU_RAM
+#define DFU_ALT_INFO_RAM \
+   "dfu_alt_info_ram=" \
+   "kernel ram 0x8020 0x400;" \
+   "fdt ram 0x80f8 0x8;" \
+   "ramdisk ram 0x8100 0x400\0"
+
+#define DFUARGS \
+   "dfu_bufsiz=0x1\0" \
+   DFU_ALT_INFO_MMC \
+   DFU_ALT_INFO_EMMC \
+   DFU_ALT_INFO_RAM
+#else
+#define DFUARGS
+#endif
+
 #ifdef CONFIG_QSPI_BOOT
 #define CONFIG_SYS_TEXT_BASE   0x3000
 #undef CONFIG_ENV_IS_IN_FAT
@@ -238,7 +296,8 @@
"if test $board_name = AM43__SK; then " \
"setenv fdtfile am437x-sk-evm.dtb; fi; " \
"if test $fdtfile = undefined; then " \
-   "echo WARNING: Could not determine device tree; fi; \0"
+   "echo WARNING: Could not determine device tree; fi; \0" 
\
+   DFUARGS \
 
 #define CONFIG_BOOTCOMMAND \
"run findfdt; " \
-- 
1.7.9.5

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


[U-Boot] [u-boot 36/40] board: ti: DRA7: added USB initializtion code

2015-02-06 Thread Kishon Vijay Abraham I
Implemented board_usb_init(), board_usb_cleanup() and
usb_gadget_handle_interrupts() in dra7xx board file that
can be invoked by various gadget drivers.

Signed-off-by: Kishon Vijay Abraham I 
---
 arch/arm/include/asm/arch-omap5/omap.h |   12 
 board/ti/dra7xx/evm.c  |  109 
 2 files changed, 121 insertions(+)

diff --git a/arch/arm/include/asm/arch-omap5/omap.h 
b/arch/arm/include/asm/arch-omap5/omap.h
index e218159..e844bfb 100644
--- a/arch/arm/include/asm/arch-omap5/omap.h
+++ b/arch/arm/include/asm/arch-omap5/omap.h
@@ -33,6 +33,18 @@
 #define CONTROL_ID_CODECONTROL_CORE_ID_CODE
 #endif
 
+#ifdef CONFIG_DRA7XX
+#define DRA7_USB_OTG_SS1_BASE  0x4889
+#define DRA7_USB_OTG_SS1_GLUE_BASE 0x4888
+#define DRA7_USB3_PHY1_PLL_CTRL0x4A084C00
+#define DRA7_USB3_PHY1_POWER   0x4A002370
+#define DRA7_USB2_PHY1_POWER   0x4A002300
+
+#define DRA7_USB_OTG_SS2_BASE  0x488D
+#define DRA7_USB_OTG_SS2_GLUE_BASE 0x488C
+#define DRA7_USB2_PHY2_POWER   0x4A002E74
+#endif
+
 /* To be verified */
 #define OMAP5430_CONTROL_ID_CODE_ES1_0 0x0B94202F
 #define OMAP5430_CONTROL_ID_CODE_ES2_0  0x1B94202F
diff --git a/board/ti/dra7xx/evm.c b/board/ti/dra7xx/evm.c
index 6522241..284775c 100644
--- a/board/ti/dra7xx/evm.c
+++ b/board/ti/dra7xx/evm.c
@@ -14,11 +14,16 @@
 #include 
 #include 
 #include 
+#include 
+#include 
 #include 
 #include 
 #include 
 #include 
 #include 
+#include 
+#include 
+#include 
 
 #include "mux_data.h"
 
@@ -123,6 +128,110 @@ int board_mmc_init(bd_t *bis)
 }
 #endif
 
+#ifdef CONFIG_USB_DWC3
+static struct dwc3_device usb_otg_ss1 = {
+   .maximum_speed = USB_SPEED_SUPER,
+   .base = DRA7_USB_OTG_SS1_BASE,
+   .tx_fifo_resize = false,
+   .index = 0,
+};
+
+static struct dwc3_omap_device usb_otg_ss1_glue = {
+   .base = (void *)DRA7_USB_OTG_SS1_GLUE_BASE,
+   .utmi_mode = DWC3_OMAP_UTMI_MODE_SW,
+   .vbus_id_status = OMAP_DWC3_VBUS_VALID,
+   .index = 0,
+};
+
+static struct ti_usb_phy_device usb_phy1_device = {
+   .pll_ctrl_base = (void *)DRA7_USB3_PHY1_PLL_CTRL,
+   .usb2_phy_power = (void *)DRA7_USB2_PHY1_POWER,
+   .usb3_phy_power = (void *)DRA7_USB3_PHY1_POWER,
+   .index = 0,
+};
+
+static struct dwc3_device usb_otg_ss2 = {
+   .maximum_speed = USB_SPEED_SUPER,
+   .base = DRA7_USB_OTG_SS2_BASE,
+   .tx_fifo_resize = false,
+   .index = 1,
+};
+
+static struct dwc3_omap_device usb_otg_ss2_glue = {
+   .base = (void *)DRA7_USB_OTG_SS2_GLUE_BASE,
+   .utmi_mode = DWC3_OMAP_UTMI_MODE_SW,
+   .vbus_id_status = OMAP_DWC3_VBUS_VALID,
+   .index = 1,
+};
+
+static struct ti_usb_phy_device usb_phy2_device = {
+   .usb2_phy_power = (void *)DRA7_USB2_PHY2_POWER,
+   .index = 1,
+};
+
+int board_usb_init(int index, enum usb_init_type init)
+{
+   switch (index) {
+   case 0:
+   if (init == USB_INIT_DEVICE) {
+   usb_otg_ss1.dr_mode = USB_DR_MODE_PERIPHERAL;
+   usb_otg_ss1_glue.vbus_id_status = OMAP_DWC3_VBUS_VALID;
+   } else {
+   usb_otg_ss1.dr_mode = USB_DR_MODE_HOST;
+   usb_otg_ss1_glue.vbus_id_status = OMAP_DWC3_ID_GROUND;
+   }
+
+   ti_usb_phy_uboot_init(&usb_phy1_device);
+   dwc3_omap_uboot_init(&usb_otg_ss1_glue);
+   dwc3_uboot_init(&usb_otg_ss1);
+   break;
+   case 1:
+   if (init == USB_INIT_DEVICE) {
+   usb_otg_ss2.dr_mode = USB_DR_MODE_PERIPHERAL;
+   usb_otg_ss2_glue.vbus_id_status = OMAP_DWC3_VBUS_VALID;
+   } else {
+   usb_otg_ss2.dr_mode = USB_DR_MODE_HOST;
+   usb_otg_ss2_glue.vbus_id_status = OMAP_DWC3_ID_GROUND;
+   }
+
+   ti_usb_phy_uboot_init(&usb_phy2_device);
+   dwc3_omap_uboot_init(&usb_otg_ss2_glue);
+   dwc3_uboot_init(&usb_otg_ss2);
+   break;
+   default:
+   printf("Invalid Controller Index\n");
+   }
+
+   return 0;
+}
+
+int board_usb_cleanup(int index, enum usb_init_type init)
+{
+   switch (index) {
+   case 0:
+   case 1:
+   ti_usb_phy_uboot_exit(index);
+   dwc3_uboot_exit(index);
+   dwc3_omap_uboot_exit(index);
+   break;
+   default:
+   printf("Invalid Controller Index\n");
+   }
+   return 0;
+}
+
+int usb_gadget_handle_interrupts(void)
+{
+   u32 status;
+
+   status = dwc3_omap_uboot_interrupt_status(0);
+   if (status)
+   dwc3_uboot_handle_interrupt(0);
+
+   return 0;
+}
+#endif
+
 #if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_OS_BOOT)
 int spl_start_uboot(void)
 {
-- 
1.7.9.5

___
U-Boot

[U-Boot] [u-boot 31/40] usb: dwc3: ep0: preparation for implementing chained TRB

2015-02-06 Thread Kishon Vijay Abraham I
No functional change. Modified few things so that there are no
code duplication while implementing chained TRB.

Signed-off-by: Kishon Vijay Abraham I 
---
 drivers/usb/dwc3/ep0.c |   20 
 1 file changed, 12 insertions(+), 8 deletions(-)

diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index 977d6d4..fce2558 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -761,7 +761,10 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
struct usb_request  *ur;
struct dwc3_trb *trb;
struct dwc3_ep  *ep0;
-   u32 transferred;
+   unsignedtransfer_size = 0;
+   unsignedmaxp;
+   void*buf;
+   u32 transferred = 0;
u32 status;
u32 length;
u8  epnum;
@@ -790,18 +793,19 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
}
 
ur = &r->request;
+   buf = ur->buf;
 
length = trb->size & DWC3_TRB_SIZE_MASK;
 
-   if (dwc->ep0_bounced) {
-   unsigned transfer_size = ur->length;
-   unsigned maxp = ep0->endpoint.maxpacket;
+   maxp = ep0->endpoint.maxpacket;
 
-   transfer_size += (maxp - (transfer_size % maxp));
-   transferred = min_t(u32, ur->length,
-   transfer_size - length);
+   if (dwc->ep0_bounced) {
+   transfer_size = roundup((ur->length - transfer_size),
+   maxp);
+   transferred = min_t(u32, ur->length - transferred,
+   transfer_size - length);
dwc3_flush_cache((int)dwc->ep0_bounce, DWC3_EP0_BOUNCE_SIZE);
-   memcpy(ur->buf, dwc->ep0_bounce, transferred);
+   memcpy(buf, dwc->ep0_bounce, transferred);
} else {
transferred = ur->length - length;
}
-- 
1.7.9.5

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


[U-Boot] [u-boot 32/40] usb: dwc3: Add chained TRB support for ep0

2015-02-06 Thread Kishon Vijay Abraham I
dwc3 can do only max packet aligned transfers. So in case request length
is not max packet aligned and is bigger than DWC3_EP0_BOUNCE_SIZE
two chained TRBs is required to handle the transfer.

Signed-off-by: Kishon Vijay Abraham I 
---
 drivers/usb/dwc3/ep0.c|   72 +
 drivers/usb/dwc3/gadget.c |2 +-
 2 files changed, 55 insertions(+), 19 deletions(-)

diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index fce2558..c2fe0ec 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -48,7 +48,7 @@ static const char *dwc3_ep0_state_string(enum dwc3_ep0_state 
state)
 }
 
 static int dwc3_ep0_start_trans(struct dwc3 *dwc, u8 epnum, dma_addr_t buf_dma,
-   u32 len, u32 type)
+   u32 len, u32 type, unsigned chain)
 {
struct dwc3_gadget_ep_cmd_params params;
struct dwc3_trb *trb;
@@ -62,7 +62,10 @@ static int dwc3_ep0_start_trans(struct dwc3 *dwc, u8 epnum, 
dma_addr_t buf_dma,
return 0;
}
 
-   trb = dwc->ep0_trb;
+   trb = &dwc->ep0_trb[dep->free_slot];
+
+   if (chain)
+   dep->free_slot++;
 
trb->bpl = lower_32_bits(buf_dma);
trb->bph = upper_32_bits(buf_dma);
@@ -70,13 +73,20 @@ static int dwc3_ep0_start_trans(struct dwc3 *dwc, u8 epnum, 
dma_addr_t buf_dma,
trb->ctrl = type;
 
trb->ctrl |= (DWC3_TRB_CTRL_HWO
-   | DWC3_TRB_CTRL_LST
-   | DWC3_TRB_CTRL_IOC
| DWC3_TRB_CTRL_ISP_IMI);
 
+   if (chain)
+   trb->ctrl |= DWC3_TRB_CTRL_CHN;
+   else
+   trb->ctrl |= (DWC3_TRB_CTRL_IOC
+   | DWC3_TRB_CTRL_LST);
+
dwc3_flush_cache((int)buf_dma, len);
dwc3_flush_cache((int)trb, sizeof(*trb));
 
+   if (chain)
+   return 0;
+
memset(¶ms, 0, sizeof(params));
params.param0 = upper_32_bits(dwc->ep0_trb_addr);
params.param1 = lower_32_bits(dwc->ep0_trb_addr);
@@ -289,7 +299,7 @@ void dwc3_ep0_out_start(struct dwc3 *dwc)
int ret;
 
ret = dwc3_ep0_start_trans(dwc, 0, dwc->ctrl_req_addr, 8,
-   DWC3_TRBCTL_CONTROL_SETUP);
+  DWC3_TRBCTL_CONTROL_SETUP, 0);
WARN_ON(ret < 0);
 }
 
@@ -799,6 +809,23 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
 
maxp = ep0->endpoint.maxpacket;
 
+   /* Handle the first TRB before handling the bounce buffer if the request
+* length is greater than the bounce buffer size
+*/
+   if (!IS_ALIGNED(ur->length, maxp) &&
+   ur->length > DWC3_EP0_BOUNCE_SIZE) {
+   transfer_size = (ur->length / maxp) * maxp;
+   transferred = transfer_size - length;
+   buf = (u8 *)buf + transferred;
+   ur->actual += transferred;
+
+   trb++;
+   dwc3_flush_cache((int)trb, sizeof(*trb));
+   length = trb->size & DWC3_TRB_SIZE_MASK;
+
+   ep0->free_slot = 0;
+   }
+
if (dwc->ep0_bounced) {
transfer_size = roundup((ur->length - transfer_size),
maxp);
@@ -827,7 +854,7 @@ static void dwc3_ep0_complete_data(struct dwc3 *dwc,
 
ret = dwc3_ep0_start_trans(dwc, epnum,
dwc->ctrl_req_addr, 0,
-   DWC3_TRBCTL_CONTROL_DATA);
+   DWC3_TRBCTL_CONTROL_DATA, 0);
WARN_ON(ret < 0);
}
}
@@ -908,11 +935,11 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc,
 
if (req->request.length == 0) {
ret = dwc3_ep0_start_trans(dwc, dep->number,
-   dwc->ctrl_req_addr, 0,
-   DWC3_TRBCTL_CONTROL_DATA);
-   } else if (!IS_ALIGNED(req->request.length, dep->endpoint.maxpacket)
-   && (dep->number == 0)) {
-   u32 transfer_size;
+  dwc->ctrl_req_addr, 0,
+  DWC3_TRBCTL_CONTROL_DATA, 0);
+   } else if (!IS_ALIGNED(req->request.length, dep->endpoint.maxpacket) &&
+   (dep->number == 0)) {
+   u32 transfer_size = 0;
u32 maxpacket;
 
ret = usb_gadget_map_request(&dwc->gadget, &req->request,
@@ -922,10 +949,18 @@ static void __dwc3_ep0_do_control_data(struct dwc3 *dwc,
return;
}
 
-   WARN_ON(req->request.length > DWC3_EP0_BOUNCE_SIZE);
-
maxpacket = dep->endpoint.maxpacket;
-   transfer_size = roundup(req->request.length, maxpacket);
+   if (req->request.length > DWC3_EP0_BOUNCE_SIZE) {
+

[U-Boot] [u-boot 34/40] usb: gadget: defer setting maxpacket till ->setup()

2015-02-06 Thread Kishon Vijay Abraham I
Taken from linux kernel with commit
commit 765f5b830e547229bb752e7b232ee83e2b3d49d5
Author: Sebastian Andrzej Siewior 
Date:   Thu Jun 23 14:26:11 2011 +0200

usb: gadget: defer setting maxpacket till ->setup()

Signed-off-by: Kishon Vijay Abraham I 
---
 drivers/usb/gadget/composite.c |4 +++-
 drivers/usb/gadget/ether.c |2 +-
 2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/gadget/composite.c b/drivers/usb/gadget/composite.c
index a4c5606..5cedc9e 100644
--- a/drivers/usb/gadget/composite.c
+++ b/drivers/usb/gadget/composite.c
@@ -283,7 +283,7 @@ static void device_qual(struct usb_composite_dev *cdev)
qual->bDeviceSubClass = cdev->desc.bDeviceSubClass;
qual->bDeviceProtocol = cdev->desc.bDeviceProtocol;
/* ASSUME same EP0 fifo size at both speeds */
-   qual->bMaxPacketSize0 = cdev->desc.bMaxPacketSize0;
+   qual->bMaxPacketSize0 = cdev->gadget->ep0->maxpacket;
qual->bNumConfigurations = count_configs(cdev, USB_DT_DEVICE_QUALIFIER);
qual->bRESERVED = 0;
 }
@@ -736,6 +736,8 @@ composite_setup(struct usb_gadget *gadget, const struct 
usb_ctrlrequest *ctrl)
case USB_DT_DEVICE:
cdev->desc.bNumConfigurations =
count_configs(cdev, USB_DT_DEVICE);
+   cdev->desc.bMaxPacketSize0 =
+   cdev->gadget->ep0->maxpacket;
value = min(w_length, (u16) sizeof cdev->desc);
memcpy(req->buf, &cdev->desc, value);
break;
diff --git a/drivers/usb/gadget/ether.c b/drivers/usb/gadget/ether.c
index ba442d5..8ccf9b0 100644
--- a/drivers/usb/gadget/ether.c
+++ b/drivers/usb/gadget/ether.c
@@ -1249,6 +1249,7 @@ eth_setup(struct usb_gadget *gadget, const struct 
usb_ctrlrequest *ctrl)
switch (wValue >> 8) {
 
case USB_DT_DEVICE:
+   device_desc.bMaxPacketSize0 = gadget->ep0->maxpacket;
value = min(wLength, (u16) sizeof device_desc);
memcpy(req->buf, &device_desc, value);
break;
@@ -2133,7 +2134,6 @@ autoconf_fail:
hs_subset_descriptors();
}
 
-   device_desc.bMaxPacketSize0 = gadget->ep0->maxpacket;
usb_gadget_set_selfpowered(gadget);
 
/* For now RNDIS is always a second config */
-- 
1.7.9.5

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


[U-Boot] [u-boot 23/40] dwc3: core: added an API to invoke irq handlers

2015-02-06 Thread Kishon Vijay Abraham I
Since interrupt support is not present in u-boot, added an
API to handle the interrupts in dwc3 core. This API can be
polled to handle the interrupts.

Signed-off-by: Kishon Vijay Abraham I 
---
 drivers/usb/dwc3/core.c |   21 +
 include/dwc3-uboot.h|1 +
 2 files changed, 22 insertions(+)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index bd34dbd..5a8d5ea 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -758,6 +758,27 @@ void dwc3_uboot_exit(int index)
}
 }
 
+/**
+ * dwc3_uboot_handle_interrupt - handle dwc3 core interrupt
+ * @index: index of this controller
+ *
+ * Invokes dwc3 gadget interrupts.
+ *
+ * Generally called from board file.
+ */
+void dwc3_uboot_handle_interrupt(int index)
+{
+   struct dwc3 *dwc = NULL;
+
+   list_for_each_entry(dwc, &dwc3_list, list) {
+   if (dwc->index != index)
+   continue;
+
+   dwc3_gadget_uboot_handle_interrupt(dwc);
+   break;
+   }
+}
+
 MODULE_ALIAS("platform:dwc3");
 MODULE_AUTHOR("Felipe Balbi ");
 MODULE_LICENSE("GPL v2");
diff --git a/include/dwc3-uboot.h b/include/dwc3-uboot.h
index 272a020..09ff8a7 100644
--- a/include/dwc3-uboot.h
+++ b/include/dwc3-uboot.h
@@ -38,4 +38,5 @@ struct dwc3_device {
 
 int dwc3_uboot_init(struct dwc3_device *dev);
 void dwc3_uboot_exit(int index);
+void dwc3_uboot_handle_interrupt(int index);
 #endif /* __DWC3_UBOOT_H_ */
-- 
1.7.9.5

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


[U-Boot] [u-boot 16/40] include: asm: types: add resource_size_t type

2015-02-06 Thread Kishon Vijay Abraham I
Added resource_size_t type in order to get rid of the following
compilation error whiel building dwc3 gadget.
include/linux/ioport.h:19:2: error: unknown type name ‘resource_size_t’

Signed-off-by: Kishon Vijay Abraham I 
---
 arch/arm/include/asm/types.h |1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/arm/include/asm/types.h b/arch/arm/include/asm/types.h
index 2326420..ee77c41 100644
--- a/arch/arm/include/asm/types.h
+++ b/arch/arm/include/asm/types.h
@@ -54,4 +54,5 @@ typedef unsigned long phys_size_t;
 
 #endif /* __KERNEL__ */
 
+typedef unsigned long resource_size_t;
 #endif
-- 
1.7.9.5

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


[U-Boot] [u-boot 33/40] usb: dwc3: Makefile: Make dwc3 driver compile in u-boot

2015-02-06 Thread Kishon Vijay Abraham I
Now that the entire dwc3 driver is adapted to compile with uboot build,
modify the Makefiles so that the dwc3 driver can be built.

Signed-off-by: Kishon Vijay Abraham I 
---
 Makefile|2 ++
 drivers/usb/dwc3/Makefile   |   35 +++
 drivers/usb/gadget/udc/Makefile |2 +-
 3 files changed, 6 insertions(+), 33 deletions(-)

diff --git a/Makefile b/Makefile
index 1eb6821..ca0fd76 100644
--- a/Makefile
+++ b/Makefile
@@ -632,8 +632,10 @@ libs-y += drivers/spi/
 libs-$(CONFIG_FMAN_ENET) += drivers/net/fm/
 libs-$(CONFIG_SYS_FSL_DDR) += drivers/ddr/fsl/
 libs-y += drivers/serial/
+libs-y += drivers/usb/dwc3/
 libs-y += drivers/usb/eth/
 libs-y += drivers/usb/gadget/
+libs-y += drivers/usb/gadget/udc/
 libs-y += drivers/usb/host/
 libs-y += drivers/usb/musb/
 libs-y += drivers/usb/musb-new/
diff --git a/drivers/usb/dwc3/Makefile b/drivers/usb/dwc3/Makefile
index afaa767..e455a52 100644
--- a/drivers/usb/dwc3/Makefile
+++ b/drivers/usb/dwc3/Makefile
@@ -1,37 +1,8 @@
-ccflags-$(CONFIG_USB_DWC3_DEBUG)   := -DDEBUG
-ccflags-$(CONFIG_USB_DWC3_VERBOSE) += -DVERBOSE_DEBUG
-
 obj-$(CONFIG_USB_DWC3) += dwc3.o
 
-dwc3-y := core.o debug.o
-
-ifneq ($(filter y,$(CONFIG_USB_DWC3_HOST) $(CONFIG_USB_DWC3_DUAL_ROLE)),)
-   dwc3-y  += host.o
-endif
-
-ifneq ($(filter y,$(CONFIG_USB_DWC3_GADGET) $(CONFIG_USB_DWC3_DUAL_ROLE)),)
-   dwc3-y  += gadget.o ep0.o
-endif
-
-ifneq ($(CONFIG_DEBUG_FS),)
-   dwc3-y  += debugfs.o
-endif
+dwc3-y := core.o
 
-##
-# Platform-specific glue layers go here
-#
-# NOTICE: Make sure your glue layer doesn't depend on anything
-# which is arch-specific and that it compiles on all situations.
-#
-# We want to keep this requirement in order to be able to compile
-# the entire driver (with all its glue layers) on several architectures
-# and make sure it compiles fine. This will also help with allmodconfig
-# and allyesconfig builds.
-##
+dwc3-y += gadget.o ep0.o
 
 obj-$(CONFIG_USB_DWC3_OMAP)+= dwc3-omap.o
-obj-$(CONFIG_USB_DWC3_EXYNOS)  += dwc3-exynos.o
-obj-$(CONFIG_USB_DWC3_PCI) += dwc3-pci.o
-obj-$(CONFIG_USB_DWC3_KEYSTONE)+= dwc3-keystone.o
-obj-$(CONFIG_USB_DWC3_QCOM)+= dwc3-qcom.o
-obj-$(CONFIG_USB_DWC3_ST)  += dwc3-st.o
+obj-$(CONFIG_USB_DWC3_PHY_OMAP)+= ti_usb_phy.o
diff --git a/drivers/usb/gadget/udc/Makefile b/drivers/usb/gadget/udc/Makefile
index be265aa..12380f4 100644
--- a/drivers/usb/gadget/udc/Makefile
+++ b/drivers/usb/gadget/udc/Makefile
@@ -1,4 +1,4 @@
 #
 # USB peripheral controller drivers
 #
-obj-$(CONFIG_USB_GADGET)   += udc-core.o
+obj-$(CONFIG_USB_DWC3_GADGET)  += udc-core.o
-- 
1.7.9.5

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


[U-Boot] [u-boot 28/40] usb: dwc3: dwc3-omap: add interrupt status API to check for interrupts

2015-02-06 Thread Kishon Vijay Abraham I
Added an API to check for interrupt status. This API is generally
called from board file to check for interrupt status.

Signed-off-by: Kishon Vijay Abraham I 
---
 drivers/usb/dwc3/dwc3-omap.c |   20 
 include/dwc3-omap-uboot.h|1 +
 2 files changed, 21 insertions(+)

diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index c8275c7..46af109 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -415,6 +415,26 @@ void dwc3_omap_uboot_exit(int index)
}
 }
 
+/**
+ * dwc3_omap_uboot_interrupt_status - check the status of interrupt
+ * @index: index of this controller
+ *
+ * Checks the status of interrupts and returns true if an interrupt
+ * is detected or false otherwise.
+ *
+ * Generally called from board file.
+ */
+int dwc3_omap_uboot_interrupt_status(int index)
+{
+   struct dwc3_omap *omap = NULL;
+
+   list_for_each_entry(omap, &dwc3_omap_list, list)
+   if (omap->index == index)
+   return dwc3_omap_interrupt(-1, omap);
+
+   return 0;
+}
+
 MODULE_ALIAS("platform:omap-dwc3");
 MODULE_AUTHOR("Felipe Balbi ");
 MODULE_LICENSE("GPL v2");
diff --git a/include/dwc3-omap-uboot.h b/include/dwc3-omap-uboot.h
index 29f02f8..db002b9 100644
--- a/include/dwc3-omap-uboot.h
+++ b/include/dwc3-omap-uboot.h
@@ -28,4 +28,5 @@ struct dwc3_omap_device {
 
 int dwc3_omap_uboot_init(struct dwc3_omap_device *dev);
 void dwc3_omap_uboot_exit(int index);
+int dwc3_omap_uboot_interrupt_status(int index);
 #endif /* __DWC3_OMAP_UBOOT_H_ */
-- 
1.7.9.5

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


[U-Boot] [u-boot 17/40] usb: dwc3: ep0: make dwc3 ep0 build in uboot

2015-02-06 Thread Kishon Vijay Abraham I
*) Changed the included header files to that used in u-boot.
*) added dwc3_ep_event_string() used in ep0.c
*) Fixed other misc warnings

Signed-off-by: Kishon Vijay Abraham I 
---
 drivers/usb/dwc3/core.h |   24 
 drivers/usb/dwc3/ep0.c  |   14 ++
 drivers/usb/dwc3/linux-compat.h |1 +
 3 files changed, 27 insertions(+), 12 deletions(-)

diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index 97f71ad..0ffcb7d 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -841,6 +841,30 @@ struct dwc3_event_type {
 #define DWC3_DEPEVT_EPCMDCMPLT 0x07
 
 /**
+ * dwc3_ep_event_string - returns event name
+ * @event: then event code
+ */
+static inline const char *dwc3_ep_event_string(u8 event)
+{
+   switch (event) {
+   case DWC3_DEPEVT_XFERCOMPLETE:
+   return "Transfer Complete";
+   case DWC3_DEPEVT_XFERINPROGRESS:
+   return "Transfer In-Progress";
+   case DWC3_DEPEVT_XFERNOTREADY:
+   return "Transfer Not Ready";
+   case DWC3_DEPEVT_RXTXFIFOEVT:
+   return "FIFO";
+   case DWC3_DEPEVT_STREAMEVT:
+   return "Stream";
+   case DWC3_DEPEVT_EPCMDCMPLT:
+   return "Endpoint Command Complete";
+   }
+
+   return "UNKNOWN";
+}
+
+/**
  * struct dwc3_event_depvt - Device Endpoint Events
  * @one_bit: indicates this is an endpoint event (not used)
  * @endpoint_number: number of the endpoint
diff --git a/drivers/usb/dwc3/ep0.c b/drivers/usb/dwc3/ep0.c
index 1751b1d..803ba51 100644
--- a/drivers/usb/dwc3/ep0.c
+++ b/drivers/usb/dwc3/ep0.c
@@ -15,24 +15,18 @@
  */
 
 #include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
 #include 
-#include 
 
 #include 
 #include 
 #include 
 
 #include "core.h"
-#include "debug.h"
 #include "gadget.h"
 #include "io.h"
 
+#include "linux-compat.h"
+
 static void __dwc3_ep0_do_control_status(struct dwc3 *dwc, struct dwc3_ep 
*dep);
 static void __dwc3_ep0_do_control_data(struct dwc3 *dwc,
struct dwc3_ep *dep, struct dwc3_request *req);
@@ -277,8 +271,6 @@ int __dwc3_gadget_ep0_set_halt(struct usb_ep *ep, int value)
 
 int dwc3_gadget_ep0_set_halt(struct usb_ep *ep, int value)
 {
-   struct dwc3_ep  *dep = to_dwc3_ep(ep);
-   struct dwc3 *dwc = dep->dwc;
unsigned long   flags;
int ret;
 
@@ -632,12 +624,10 @@ static int dwc3_ep0_set_sel(struct dwc3 *dwc, struct 
usb_ctrlrequest *ctrl)
struct dwc3_ep  *dep;
enum usb_device_state state = dwc->gadget.state;
u16 wLength;
-   u16 wValue;
 
if (state == USB_STATE_DEFAULT)
return -EINVAL;
 
-   wValue = le16_to_cpu(ctrl->wValue);
wLength = le16_to_cpu(ctrl->wLength);
 
if (wLength != 6) {
diff --git a/drivers/usb/dwc3/linux-compat.h b/drivers/usb/dwc3/linux-compat.h
index 719e82e..cbfb946 100644
--- a/drivers/usb/dwc3/linux-compat.h
+++ b/drivers/usb/dwc3/linux-compat.h
@@ -14,6 +14,7 @@
 
 #define pr_debug(format)debug(format)
 #define WARN(val, format, arg...)  debug(format, ##arg)
+#define dev_WARN(dev, format, arg...)  debug(format, ##arg)
 #define WARN_ON_ONCE(val)  debug("Error %d\n", val)
 
 #define BUILD_BUG_ON_NOT_POWER_OF_2(n)
-- 
1.7.9.5

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


[U-Boot] [u-boot 01/40] ARM: DRA7: Enable clocks for USB OTGSS and USB PHY

2015-02-06 Thread Kishon Vijay Abraham I
Enabled clocks for dwc3 controller and USB PHY present in DRA7.

Signed-off-by: Kishon Vijay Abraham I 
---
 arch/arm/cpu/armv7/omap5/hw_data.c   |   14 ++
 arch/arm/cpu/armv7/omap5/prcm-regs.c |   10 +-
 arch/arm/include/asm/omap_common.h   |4 ++--
 3 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/arch/arm/cpu/armv7/omap5/hw_data.c 
b/arch/arm/cpu/armv7/omap5/hw_data.c
index 95f1686..9315bce 100644
--- a/arch/arm/cpu/armv7/omap5/hw_data.c
+++ b/arch/arm/cpu/armv7/omap5/hw_data.c
@@ -455,6 +455,10 @@ void enable_basic_clocks(void)
(*prcm)->cm_l4per_gpio6_clkctrl,
(*prcm)->cm_l4per_gpio7_clkctrl,
(*prcm)->cm_l4per_gpio8_clkctrl,
+#ifdef CONFIG_USB_DWC3
+   (*prcm)->cm_l3init_ocp2scp1_clkctrl,
+   (*prcm)->cm_l3init_usb_otg_ss1_clkctrl,
+#endif
0
};
 
@@ -486,6 +490,16 @@ void enable_basic_clocks(void)
setbits_le32((*prcm)->cm_l3init_hsmmc2_clkctrl,
HSMMC_CLKCTRL_CLKSEL_MASK);
 
+#ifdef CONFIG_USB_DWC3
+   /* Enable 960 MHz clock for dwc3 */
+   setbits_le32((*prcm)->cm_l3init_usb_otg_ss1_clkctrl,
+OPTFCLKEN_REFCLK960M);
+
+   /* Enable 32 KHz clock for dwc3 */
+   setbits_le32((*prcm)->cm_coreaon_usb_phy1_core_clkctrl,
+USBPHY_CORE_CLKCTRL_OPTFCLKEN_CLK32K);
+#endif
+
/* Set the correct clock dividers for mmc */
setbits_le32((*prcm)->cm_l3init_hsmmc1_clkctrl,
HSMMC_CLKCTRL_CLKSEL_DIV_MASK);
diff --git a/arch/arm/cpu/armv7/omap5/prcm-regs.c 
b/arch/arm/cpu/armv7/omap5/prcm-regs.c
index 0745d42..440bb40 100644
--- a/arch/arm/cpu/armv7/omap5/prcm-regs.c
+++ b/arch/arm/cpu/armv7/omap5/prcm-regs.c
@@ -575,7 +575,7 @@ struct prcm_regs const omap5_es2_prcm = {
.cm_div_m2_dpll_unipro = 0x4a0081d0,
.cm_ssc_deltamstep_dpll_unipro = 0x4a0081e8,
.cm_ssc_modfreqdiv_dpll_unipro = 0x4a0081ec,
-   .cm_coreaon_usb_phy_core_clkctrl = 0x4A008640,
+   .cm_coreaon_usb_phy1_core_clkctrl = 0x4A008640,
.cm_coreaon_bandgap_clkctrl = 0x4a008648,
.cm_coreaon_io_srcomp_clkctrl = 0x4a008650,
 
@@ -709,7 +709,7 @@ struct prcm_regs const omap5_es2_prcm = {
.cm_l3init_fsusb_clkctrl = 0x4a0096d0,
.cm_l3init_ocp2scp1_clkctrl = 0x4a0096e0,
.cm_l3init_ocp2scp3_clkctrl = 0x4a0096e8,
-   .cm_l3init_usb_otg_ss_clkctrl = 0x4a0096f0,
+   .cm_l3init_usb_otg_ss1_clkctrl = 0x4a0096f0,
 
/* prm irqstatus regs */
.prm_irqstatus_mpu_2 = 0x4ae06014,
@@ -801,8 +801,8 @@ struct prcm_regs const dra7xx_prcm = {
.cm_clkmode_dpll_dsp= 0x4a005234,
.cm_shadow_freq_config1 = 0x4a005260,
.cm_clkmode_dpll_gmac   = 0x4a0052a8,
-   .cm_coreaon_usb_phy_core_clkctrl= 0x4a008640,
-   .cm_coreaon_usb_phy2_core_clkctrl = 0x4a008688,
+   .cm_coreaon_usb_phy1_core_clkctrl   = 0x4a008640,
+   .cm_coreaon_usb_phy2_core_clkctrl   = 0x4a008688,
 
/* cm1.mpu */
.cm_mpu_mpu_clkctrl = 0x4a005320,
@@ -908,7 +908,7 @@ struct prcm_regs const dra7xx_prcm = {
.cm_gmac_gmac_clkctrl   = 0x4a0093d0,
.cm_l3init_ocp2scp1_clkctrl = 0x4a0093e0,
.cm_l3init_ocp2scp3_clkctrl = 0x4a0093e8,
-   .cm_l3init_usb_otg_ss_clkctrl   = 0x4a0093f0,
+   .cm_l3init_usb_otg_ss1_clkctrl  = 0x4a0093f0,
 
/* cm2.l4per */
.cm_l4per_clkstctrl = 0x4a009700,
diff --git a/arch/arm/include/asm/omap_common.h 
b/arch/arm/include/asm/omap_common.h
index 323952f..bd43099 100644
--- a/arch/arm/include/asm/omap_common.h
+++ b/arch/arm/include/asm/omap_common.h
@@ -143,7 +143,7 @@ struct prcm_regs {
u32 cm_div_m2_dpll_unipro;
u32 cm_ssc_deltamstep_dpll_unipro;
u32 cm_ssc_modfreqdiv_dpll_unipro;
-   u32 cm_coreaon_usb_phy_core_clkctrl;
+   u32 cm_coreaon_usb_phy1_core_clkctrl;
u32 cm_coreaon_usb_phy2_core_clkctrl;
 
/* cm2.core */
@@ -230,7 +230,7 @@ struct prcm_regs {
u32 cm_l3init_fsusb_clkctrl;
u32 cm_l3init_ocp2scp1_clkctrl;
u32 cm_l3init_ocp2scp3_clkctrl;
-   u32 cm_l3init_usb_otg_ss_clkctrl;
+   u32 cm_l3init_usb_otg_ss1_clkctrl;
 
u32 prm_irqstatus_mpu_2;
 
-- 
1.7.9.5

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


[U-Boot] [u-boot 26/40] usb: dwc3: dwc3-omap: change probe and remove to uboot init and uboot exit code

2015-02-06 Thread Kishon Vijay Abraham I
Removed probe and remove that are specific to linux and replaced it with
uboot init and uboot exit. These functions will be invoked from boardfile.

This will change once we have dwc3-omap driver adapted to use the uboot
driver model.

Signed-off-by: Kishon Vijay Abraham I 
---
 drivers/usb/dwc3/dwc3-omap.c |  128 +-
 include/dwc3-omap-uboot.h|3 +
 2 files changed, 42 insertions(+), 89 deletions(-)

diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index 31a2aa3..30d7210 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -17,6 +17,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -120,6 +121,8 @@ struct dwc3_omap {
u32 dma_status:1;
 };
 
+struct dwc3_omap *omap;
+
 static inline u32 dwc3_omap_readl(void __iomem *base, u32 offset)
 {
return readl(base + offset);
@@ -278,15 +281,6 @@ static irqreturn_t dwc3_omap_interrupt(int irq, void 
*_omap)
return IRQ_HANDLED;
 }
 
-static int dwc3_omap_remove_core(struct device *dev, void *c)
-{
-   struct platform_device *pdev = to_platform_device(dev);
-
-   of_device_unregister(pdev);
-
-   return 0;
-}
-
 static void dwc3_omap_enable_irqs(struct dwc3_omap *omap)
 {
u32 reg;
@@ -315,12 +309,8 @@ static void dwc3_omap_disable_irqs(struct dwc3_omap *omap)
dwc3_omap_write_irq0_set(omap, 0x00);
 }
 
-static u64 dwc3_omap_dma_mask = DMA_BIT_MASK(32);
-
 static void dwc3_omap_map_offset(struct dwc3_omap *omap)
 {
-   struct device_node  *node = omap->dev->of_node;
-
/*
 * Differentiate between OMAP5 and AM437x.
 *
@@ -329,25 +319,21 @@ static void dwc3_omap_map_offset(struct dwc3_omap *omap)
 *
 * Using dt compatible to differentiate AM437x.
 */
-   if (of_device_is_compatible(node, "ti,am437x-dwc3")) {
-   omap->irq_eoi_offset = USBOTGSS_EOI_OFFSET;
-   omap->irq0_offset = USBOTGSS_IRQ0_OFFSET;
-   omap->irqmisc_offset = USBOTGSS_IRQMISC_OFFSET;
-   omap->utmi_otg_offset = USBOTGSS_UTMI_OTG_OFFSET;
-   omap->debug_offset = USBOTGSS_DEBUG_OFFSET;
-   }
+#ifdef CONFIG_AM43XX
+   omap->irq_eoi_offset = USBOTGSS_EOI_OFFSET;
+   omap->irq0_offset = USBOTGSS_IRQ0_OFFSET;
+   omap->irqmisc_offset = USBOTGSS_IRQMISC_OFFSET;
+   omap->utmi_otg_offset = USBOTGSS_UTMI_OTG_OFFSET;
+   omap->debug_offset = USBOTGSS_DEBUG_OFFSET;
+#endif
 }
 
-static void dwc3_omap_set_utmi_mode(struct dwc3_omap *omap)
+static void dwc3_omap_set_utmi_mode(struct dwc3_omap *omap, int utmi_mode)
 {
u32 reg;
-   struct device_node  *node = omap->dev->of_node;
-   int utmi_mode = 0;
 
reg = dwc3_omap_read_utmi_status(omap);
 
-   of_property_read_u32(node, "utmi-mode", &utmi_mode);
-
switch (utmi_mode) {
case DWC3_OMAP_UTMI_MODE_SW:
reg |= USBOTGSS_UTMI_OTG_STATUS_SW_MODE;
@@ -362,95 +348,59 @@ static void dwc3_omap_set_utmi_mode(struct dwc3_omap 
*omap)
dwc3_omap_write_utmi_status(omap, reg);
 }
 
-static int dwc3_omap_probe(struct platform_device *pdev)
+/**
+ * dwc3_omap_uboot_init - dwc3 omap uboot initialization code
+ * @dev: struct dwc3_omap_device containing initialization data
+ *
+ * Entry point for dwc3 omap driver (equivalent to dwc3_omap_probe in linux
+ * kernel driver). Pointer to dwc3_omap_device should be passed containing
+ * base address and other initialization data. Returns '0' on success and
+ * a negative value on failure.
+ *
+ * Generally called from board_usb_init() implemented in board file.
+ */
+int dwc3_omap_uboot_init(struct dwc3_omap_device *omap_dev)
 {
-   struct device_node  *node = pdev->dev.of_node;
-
-   struct dwc3_omap*omap;
-   struct resource *res;
-   struct device   *dev = &pdev->dev;
-
-   int ret;
u32 reg;
-
-   void __iomem*base;
-
-   if (!node) {
-   dev_err(dev, "device node not found\n");
-   return -EINVAL;
-   }
+   struct device   *dev;
 
omap = devm_kzalloc(dev, sizeof(*omap), GFP_KERNEL);
if (!omap)
return -ENOMEM;
 
-   platform_set_drvdata(pdev, omap);
-
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   base = devm_ioremap_resource(dev, res);
-   if (IS_ERR(base))
-   return PTR_ERR(base);
-
-   omap->dev   = dev;
-   omap->base  = base;
-   dev->dma_mask   = &dwc3_omap_dma_mask;
+   omap->base  = omap_dev->base;
 
dwc3_omap_map_offset(omap);
-   dwc3_omap_set_utmi_mode(omap);
+   dwc3_omap_set_utmi_mode(omap, omap_dev->utmi_mode);
 
/* check the DMA Status */
reg = dwc3_omap_readl(omap->base, USBOTGS

[U-Boot] [u-boot 21/40] dwc3: core: change probe and remove to uboot init and uboot exit code

2015-02-06 Thread Kishon Vijay Abraham I
Removed probe and remove that are specific to linux and replaced it with
uboot init and uboot exit. These functions will be invoked from boardfile.

Signed-off-by: Kishon Vijay Abraham I 
---
 drivers/usb/dwc3/core.c |  218 +++
 1 file changed, 52 insertions(+), 166 deletions(-)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index 78322b7..58c3bfd 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -16,6 +16,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -28,6 +29,7 @@
 
 #include "linux-compat.h"
 
+struct dwc3 *dwc;
 /* -- 
*/
 
 void dwc3_set_mode(struct dwc3 *dwc, u32 mode)
@@ -597,20 +599,26 @@ static void dwc3_core_exit_mode(struct dwc3 *dwc)
 
 #define DWC3_ALIGN_MASK(16 - 1)
 
-static int dwc3_probe(struct platform_device *pdev)
+/**
+ * dwc3_uboot_init - dwc3 core uboot initialization code
+ * @dwc3_dev: struct dwc3_device containing initialization data
+ *
+ * Entry point for dwc3 driver (equivalent to dwc3_probe in linux
+ * kernel driver). Pointer to dwc3_device should be passed containing
+ * base address and other initialization data. Returns '0' on success and
+ * a negative value on failure.
+ *
+ * Generally called from board_usb_init() implemented in board file.
+ */
+int dwc3_uboot_init(struct dwc3_device *dwc3_dev)
 {
-   struct device   *dev = &pdev->dev;
-   struct dwc3_platform_data *pdata = dev_get_platdata(dev);
-   struct device_node  *node = dev->of_node;
-   struct resource *res;
-   struct dwc3 *dwc;
+   struct device   *dev;
u8  lpm_nyet_threshold;
u8  tx_de_emphasis;
u8  hird_threshold;
 
int ret;
 
-   void __iomem*regs;
void*mem;
 
mem = devm_kzalloc(dev, sizeof(*dwc) + DWC3_ALIGN_MASK, GFP_KERNEL);
@@ -619,48 +627,8 @@ static int dwc3_probe(struct platform_device *pdev)
 
dwc = PTR_ALIGN(mem, DWC3_ALIGN_MASK + 1);
dwc->mem = mem;
-   dwc->dev = dev;
-
-   res = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
-   if (!res) {
-   dev_err(dev, "missing IRQ\n");
-   return -ENODEV;
-   }
-   dwc->xhci_resources[1].start = res->start;
-   dwc->xhci_resources[1].end = res->end;
-   dwc->xhci_resources[1].flags = res->flags;
-   dwc->xhci_resources[1].name = res->name;
-
-   res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
-   if (!res) {
-   dev_err(dev, "missing memory resource\n");
-   return -ENODEV;
-   }
 
-   dwc->xhci_resources[0].start = res->start;
-   dwc->xhci_resources[0].end = dwc->xhci_resources[0].start +
-   DWC3_XHCI_REGS_END;
-   dwc->xhci_resources[0].flags = res->flags;
-   dwc->xhci_resources[0].name = res->name;
-
-   res->start += DWC3_GLOBALS_REGS_START;
-
-   /*
-* Request memory region but exclude xHCI regs,
-* since it will be requested by the xhci-plat driver.
-*/
-   regs = devm_ioremap_resource(dev, res);
-   if (IS_ERR(regs))
-   return PTR_ERR(regs);
-
-   dwc->regs   = regs;
-   dwc->regs_size  = resource_size(res);
-   /*
-* restore res->start back to its original value so that,
-* in case the probe is deferred, we don't end up getting error in
-* request the memory region the next time probe is called.
-*/
-   res->start -= DWC3_GLOBALS_REGS_START;
+   dwc->regs   = (int *)(dwc3_dev->base + DWC3_GLOBALS_REGS_START);
 
/* default to highest possible threshold */
lpm_nyet_threshold = 0xff;
@@ -674,73 +642,31 @@ static int dwc3_probe(struct platform_device *pdev)
 */
hird_threshold = 12;
 
-   if (node) {
-   dwc->maximum_speed = of_usb_get_maximum_speed(node);
-   dwc->has_lpm_erratum = of_property_read_bool(node,
-   "snps,has-lpm-erratum");
-   of_property_read_u8(node, "snps,lpm-nyet-threshold",
-   &lpm_nyet_threshold);
-   dwc->is_utmi_l1_suspend = of_property_read_bool(node,
-   "snps,is-utmi-l1-suspend");
-   of_property_read_u8(node, "snps,hird-threshold",
-   &hird_threshold);
-
-   dwc->needs_fifo_resize = of_property_read_bool(node,
-   "tx-fifo-resize");
-   dwc->dr_mode = of_usb_get_dr_mode(node);
-
-   dwc->disable_scramble_quirk = of_property_read_bool(node,
-   "snps,disable_scramble_quirk");
-   dwc->u2exit_lfps_quirk = of_property_read_bool(nod

[U-Boot] [u-boot 19/40] usb: dwc3: core: make dwc3 core build in uboot

2015-02-06 Thread Kishon Vijay Abraham I
*) Changed the include header files to that used in u-boot.
*) Removed phy_* APIs
*) Removed jiffies and used a simple while loop
*) Used dma_alloc_coherent and dma_free_coherent APIs of u-boot
*) Fixed other misc warnings

Signed-off-by: Kishon Vijay Abraham I 
---
 drivers/usb/dwc3/core.c |  216 ++-
 drivers/usb/dwc3/core.h |   10 --
 drivers/usb/dwc3/linux-compat.h |   10 ++
 3 files changed, 40 insertions(+), 196 deletions(-)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index ebfb6ca..78322b7 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -14,32 +14,19 @@
  * SPDX-License-Identifier: GPL-2.0
  */
 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
+#include 
+#include 
+#include 
 #include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
 
 #include 
 #include 
-#include 
-#include 
 
-#include "platform_data.h"
 #include "core.h"
 #include "gadget.h"
 #include "io.h"
 
-#include "debug.h"
+#include "linux-compat.h"
 
 /* -- 
*/
 
@@ -60,7 +47,6 @@ void dwc3_set_mode(struct dwc3 *dwc, u32 mode)
 static int dwc3_core_soft_reset(struct dwc3 *dwc)
 {
u32 reg;
-   int ret;
 
/* Before Resetting PHY, put Core in Reset */
reg = dwc3_readl(dwc->regs, DWC3_GCTL);
@@ -77,17 +63,6 @@ static int dwc3_core_soft_reset(struct dwc3 *dwc)
reg |= DWC3_GUSB2PHYCFG_PHYSOFTRST;
dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
 
-   usb_phy_init(dwc->usb2_phy);
-   usb_phy_init(dwc->usb3_phy);
-   ret = phy_init(dwc->usb2_generic_phy);
-   if (ret < 0)
-   return ret;
-
-   ret = phy_init(dwc->usb3_generic_phy);
-   if (ret < 0) {
-   phy_exit(dwc->usb2_generic_phy);
-   return ret;
-   }
mdelay(100);
 
/* Clear USB3 PHY reset */
@@ -118,7 +93,7 @@ static int dwc3_core_soft_reset(struct dwc3 *dwc)
 static void dwc3_free_one_event_buffer(struct dwc3 *dwc,
struct dwc3_event_buffer *evt)
 {
-   dma_free_coherent(dwc->dev, evt->length, evt->buf, evt->dma);
+   dma_free_coherent(evt->buf);
 }
 
 /**
@@ -140,8 +115,8 @@ static struct dwc3_event_buffer 
*dwc3_alloc_one_event_buffer(struct dwc3 *dwc,
 
evt->dwc= dwc;
evt->length = length;
-   evt->buf= dma_alloc_coherent(dwc->dev, length,
-   &evt->dma, GFP_KERNEL);
+   evt->buf= dma_alloc_coherent(length,
+(unsigned long *)&evt->dma);
if (!evt->buf)
return ERR_PTR(-ENOMEM);
 
@@ -276,13 +251,9 @@ static int dwc3_setup_scratch_buffers(struct dwc3 *dwc)
if (!dwc->nr_scratch)
return 0;
 
-/* should never fall here */
-   if (!WARN_ON(dwc->scratchbuf))
-   return 0;
-
-   scratch_addr = dma_map_single(dwc->dev, dwc->scratchbuf,
-   dwc->nr_scratch * DWC3_SCRATCHBUF_SIZE,
-   DMA_BIDIRECTIONAL);
+   scratch_addr = dma_map_single(dwc->scratchbuf,
+ dwc->nr_scratch * DWC3_SCRATCHBUF_SIZE,
+ DMA_BIDIRECTIONAL);
if (dma_mapping_error(dwc->dev, scratch_addr)) {
dev_err(dwc->dev, "failed to map scratch buffer\n");
ret = -EFAULT;
@@ -308,8 +279,8 @@ static int dwc3_setup_scratch_buffers(struct dwc3 *dwc)
return 0;
 
 err1:
-   dma_unmap_single(dwc->dev, dwc->scratch_addr, dwc->nr_scratch *
-   DWC3_SCRATCHBUF_SIZE, DMA_BIDIRECTIONAL);
+   dma_unmap_single((void *)dwc->scratch_addr, dwc->nr_scratch *
+DWC3_SCRATCHBUF_SIZE, DMA_BIDIRECTIONAL);
 
 err0:
return ret;
@@ -323,12 +294,8 @@ static void dwc3_free_scratch_buffers(struct dwc3 *dwc)
if (!dwc->nr_scratch)
return;
 
-/* should never fall here */
-   if (!WARN_ON(dwc->scratchbuf))
-   return;
-
-   dma_unmap_single(dwc->dev, dwc->scratch_addr, dwc->nr_scratch *
-   DWC3_SCRATCHBUF_SIZE, DMA_BIDIRECTIONAL);
+   dma_unmap_single((void *)dwc->scratch_addr, dwc->nr_scratch *
+DWC3_SCRATCHBUF_SIZE, DMA_BIDIRECTIONAL);
kfree(dwc->scratchbuf);
 }
 
@@ -446,12 +413,6 @@ static int dwc3_core_init(struct dwc3 *dwc)
}
dwc->revision = reg;
 
-   /*
-* Write Linux Version Code to our GUID register so it's easy to figure
-* out which kernel version a bug was found.
-*/
-   dwc3_writel(dwc->regs, DWC3_GUID, LINUX_VERSION_CODE);
-
/* Handle USB2.0-only core configuration */
if (DWC3_GHWPARAMS3_SSPHY_IFC(dwc->hwparams.hwparams3) ==
DWC3_GHWPARAMS3_SSPHY_IFC_DIS) {
@@ -460,21 

[U-Boot] [u-boot 15/40] usb: dwc3: gadget: make dwc3 gadget build in uboot

2015-02-06 Thread Kishon Vijay Abraham I
Did a bunch of things to get dwc3/gadget.c compile in u-boot without
build errors and warnings
*) Changed the included header files to that used in u-boot.
*) Used dma_alloc_coherent and dma_free_coherent APIs of u-boot
*) removed sg support
*) remove jiffies and used a simple while loop
*) removed irq support and added a function to call these interrupt handler.

Signed-off-by: Kishon Vijay Abraham I 
---
 drivers/usb/dwc3/gadget.c   |  244 ++-
 drivers/usb/dwc3/gadget.h   |1 +
 drivers/usb/dwc3/linux-compat.h |3 -
 include/linux/compat.h  |1 +
 include/linux/usb/gadget.h  |   39 +++
 5 files changed, 125 insertions(+), 163 deletions(-)

diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c
index 7c932c6..1f97729 100644
--- a/drivers/usb/dwc3/gadget.c
+++ b/drivers/usb/dwc3/gadget.c
@@ -14,25 +14,22 @@
  * SPDX-License-Identifier: GPL-2.0
  */
 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
+#include 
+#include 
+#include 
+#include 
 #include 
-#include 
 
 #include 
 #include 
+#include 
 
-#include "debug.h"
 #include "core.h"
 #include "gadget.h"
 #include "io.h"
 
+#include "linux-compat.h"
+
 /**
  * dwc3_gadget_set_test_mode - Enables USB2 Test Modes
  * @dwc: pointer to our context structure
@@ -166,7 +163,6 @@ int dwc3_gadget_set_link_state(struct dwc3 *dwc, enum 
dwc3_link_state state)
 int dwc3_gadget_resize_tx_fifos(struct dwc3 *dwc)
 {
int last_fifo_depth = 0;
-   int ram1_depth;
int fifo_size;
int mdwidth;
int num;
@@ -174,7 +170,6 @@ int dwc3_gadget_resize_tx_fifos(struct dwc3 *dwc)
if (!dwc->needs_fifo_resize)
return 0;
 
-   ram1_depth = DWC3_RAM1_DEPTH(dwc->hwparams.hwparams7);
mdwidth = DWC3_MDWIDTH(dwc->hwparams.hwparams0);
 
/* MDWIDTH is represented in bits, we need it in bytes */
@@ -232,24 +227,21 @@ void dwc3_gadget_giveback(struct dwc3_ep *dep, struct 
dwc3_request *req,
int status)
 {
struct dwc3 *dwc = dep->dwc;
-   int i;
 
if (req->queued) {
-   i = 0;
-   do {
+   dep->busy_slot++;
+   /*
+* Skip LINK TRB. We can't use req->trb and check for
+* DWC3_TRBCTL_LINK_TRB because it points the TRB we
+* just completed (not the LINK TRB).
+*/
+   if (((dep->busy_slot & DWC3_TRB_MASK) ==
+   DWC3_TRB_NUM- 1) &&
+   usb_endpoint_xfer_isoc(dep->endpoint.desc))
dep->busy_slot++;
-   /*
-* Skip LINK TRB. We can't use req->trb and check for
-* DWC3_TRBCTL_LINK_TRB because it points the TRB we
-* just completed (not the LINK TRB).
-*/
-   if (((dep->busy_slot & DWC3_TRB_MASK) ==
-   DWC3_TRB_NUM- 1) &&
-   usb_endpoint_xfer_isoc(dep->endpoint.desc))
-   dep->busy_slot++;
-   } while(++i < req->request.num_mapped_sgs);
req->queued = false;
}
+
list_del(&req->list);
req->trb = NULL;
 
@@ -301,7 +293,6 @@ int dwc3_send_gadget_generic_command(struct dwc3 *dwc, 
unsigned cmd, u32 param)
 int dwc3_send_gadget_ep_cmd(struct dwc3 *dwc, unsigned ep,
unsigned cmd, struct dwc3_gadget_ep_cmd_params *params)
 {
-   struct dwc3_ep  *dep = dwc->eps[ep];
u32 timeout = 500;
u32 reg;
 
@@ -340,17 +331,15 @@ static dma_addr_t dwc3_trb_dma_offset(struct dwc3_ep *dep,
 
 static int dwc3_alloc_trb_pool(struct dwc3_ep *dep)
 {
-   struct dwc3 *dwc = dep->dwc;
-
if (dep->trb_pool)
return 0;
 
if (dep->number == 0 || dep->number == 1)
return 0;
 
-   dep->trb_pool = dma_alloc_coherent(dwc->dev,
-   sizeof(struct dwc3_trb) * DWC3_TRB_NUM,
-   &dep->trb_pool_dma, GFP_KERNEL);
+   dep->trb_pool = dma_alloc_coherent(sizeof(struct dwc3_trb) *
+  DWC3_TRB_NUM,
+  (unsigned long *)&dep->trb_pool_dma);
if (!dep->trb_pool) {
dev_err(dep->dwc->dev, "failed to allocate trb pool for %s\n",
dep->name);
@@ -362,10 +351,7 @@ static int dwc3_alloc_trb_pool(struct dwc3_ep *dep)
 
 static void dwc3_free_trb_pool(struct dwc3_ep *dep)
 {
-   struct dwc3 *dwc = dep->dwc;
-
-   dma_free_coherent(dwc->dev, sizeof(struct dwc3_trb) * DWC3_TRB_NUM,
-   dep->trb_pool, dep->trb

[U-Boot] [u-boot 12/40] usb: dwc3: remove pm related operations from dwc3 driver

2015-02-06 Thread Kishon Vijay Abraham I
Removed all pm related operations including pm_runtime APIs,
suspend/resume hooks as support for these are not present in u-boot.

Signed-off-by: Kishon Vijay Abraham I 
---
 drivers/usb/dwc3/core.c  |   96 --
 drivers/usb/dwc3/core.h  |   16 ---
 drivers/usb/dwc3/dwc3-omap.c |   61 +++
 drivers/usb/dwc3/gadget.c|   55 
 4 files changed, 5 insertions(+), 223 deletions(-)

diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c
index b79a8b3..ebfb6ca 100644
--- a/drivers/usb/dwc3/core.c
+++ b/drivers/usb/dwc3/core.c
@@ -20,7 +20,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -884,10 +883,6 @@ static int dwc3_probe(struct platform_device *pdev)
dma_set_coherent_mask(dev, dev->parent->coherent_dma_mask);
}
 
-   pm_runtime_enable(dev);
-   pm_runtime_get_sync(dev);
-   pm_runtime_forbid(dev);
-
dwc3_cache_hwparams(dwc);
 
ret = dwc3_alloc_event_buffers(dwc, DWC3_EVENT_BUFFERS_SIZE);
@@ -937,8 +932,6 @@ static int dwc3_probe(struct platform_device *pdev)
goto err3;
}
 
-   pm_runtime_allow(dev);
-
return 0;
 
 err3:
@@ -980,97 +973,9 @@ static int dwc3_remove(struct platform_device *pdev)
 
dwc3_core_exit(dwc);
 
-   pm_runtime_put_sync(&pdev->dev);
-   pm_runtime_disable(&pdev->dev);
-
-   return 0;
-}
-
-#ifdef CONFIG_PM_SLEEP
-static int dwc3_suspend(struct device *dev)
-{
-   struct dwc3 *dwc = dev_get_drvdata(dev);
-   unsigned long   flags;
-
-   spin_lock_irqsave(&dwc->lock, flags);
-
-   switch (dwc->dr_mode) {
-   case USB_DR_MODE_PERIPHERAL:
-   case USB_DR_MODE_OTG:
-   dwc3_gadget_suspend(dwc);
-   /* FALLTHROUGH */
-   case USB_DR_MODE_HOST:
-   default:
-   dwc3_event_buffers_cleanup(dwc);
-   break;
-   }
-
-   dwc->gctl = dwc3_readl(dwc->regs, DWC3_GCTL);
-   spin_unlock_irqrestore(&dwc->lock, flags);
-
-   usb_phy_shutdown(dwc->usb3_phy);
-   usb_phy_shutdown(dwc->usb2_phy);
-   phy_exit(dwc->usb2_generic_phy);
-   phy_exit(dwc->usb3_generic_phy);
-
return 0;
 }
 
-static int dwc3_resume(struct device *dev)
-{
-   struct dwc3 *dwc = dev_get_drvdata(dev);
-   unsigned long   flags;
-   int ret;
-
-   usb_phy_init(dwc->usb3_phy);
-   usb_phy_init(dwc->usb2_phy);
-   ret = phy_init(dwc->usb2_generic_phy);
-   if (ret < 0)
-   return ret;
-
-   ret = phy_init(dwc->usb3_generic_phy);
-   if (ret < 0)
-   goto err_usb2phy_init;
-
-   spin_lock_irqsave(&dwc->lock, flags);
-
-   dwc3_event_buffers_setup(dwc);
-   dwc3_writel(dwc->regs, DWC3_GCTL, dwc->gctl);
-
-   switch (dwc->dr_mode) {
-   case USB_DR_MODE_PERIPHERAL:
-   case USB_DR_MODE_OTG:
-   dwc3_gadget_resume(dwc);
-   /* FALLTHROUGH */
-   case USB_DR_MODE_HOST:
-   default:
-   /* do nothing */
-   break;
-   }
-
-   spin_unlock_irqrestore(&dwc->lock, flags);
-
-   pm_runtime_disable(dev);
-   pm_runtime_set_active(dev);
-   pm_runtime_enable(dev);
-
-   return 0;
-
-err_usb2phy_init:
-   phy_exit(dwc->usb2_generic_phy);
-
-   return ret;
-}
-
-static const struct dev_pm_ops dwc3_dev_pm_ops = {
-   SET_SYSTEM_SLEEP_PM_OPS(dwc3_suspend, dwc3_resume)
-};
-
-#define DWC3_PM_OPS&(dwc3_dev_pm_ops)
-#else
-#define DWC3_PM_OPSNULL
-#endif
-
 #ifdef CONFIG_OF
 static const struct of_device_id of_dwc3_match[] = {
{
@@ -1102,7 +1007,6 @@ static struct platform_driver dwc3_driver = {
.name   = "dwc3",
.of_match_table = of_match_ptr(of_dwc3_match),
.acpi_match_table = ACPI_PTR(dwc3_acpi_match),
-   .pm = DWC3_PM_OPS,
},
 };
 
diff --git a/drivers/usb/dwc3/core.h b/drivers/usb/dwc3/core.h
index a7a7082..97f71ad 100644
--- a/drivers/usb/dwc3/core.h
+++ b/drivers/usb/dwc3/core.h
@@ -1012,20 +1012,4 @@ static inline int 
dwc3_send_gadget_generic_command(struct dwc3 *dwc,
 { return 0; }
 #endif
 
-/* power management interface */
-#if !IS_ENABLED(CONFIG_USB_DWC3_HOST)
-int dwc3_gadget_suspend(struct dwc3 *dwc);
-int dwc3_gadget_resume(struct dwc3 *dwc);
-#else
-static inline int dwc3_gadget_suspend(struct dwc3 *dwc)
-{
-   return 0;
-}
-
-static inline int dwc3_gadget_resume(struct dwc3 *dwc)
-{
-   return 0;
-}
-#endif /* !IS_ENABLED(CONFIG_USB_DWC3_HOST) */
-
 #endif /* __DRIVERS_USB_DWC3_CORE_H */
diff --git a/drivers/usb/dwc3/dwc3-omap.c b/drivers/usb/dwc3/dwc3-omap.c
index 12b57cf..ce2d6a6 100644
--- a/drivers/usb/dwc3/dwc3-omap.c
+++ b/drivers/usb/dwc3/dwc3-omap.c
@@ -20,7 +20,6 @@
 #include 
 #include 
 #include 
-#include 
 #include 
 #include 
 #include 
@@ -509,13 +508,6 @@ static int dwc3_omap_

[U-Boot] [u-boot 05/40] usb: gadget: udc: make udc-core compile in u-boot build

2015-02-06 Thread Kishon Vijay Abraham I
Make udc-core compile in u-boot by removing all linux specific
stuff and having only the bare minimal udc-core required for
usb gadget drivers. Also modified the file header to a format that is
generally being used in u-boot.

Signed-off-by: Kishon Vijay Abraham I 
---
 drivers/usb/gadget/udc/udc-core.c |  335 +++--
 1 file changed, 26 insertions(+), 309 deletions(-)

diff --git a/drivers/usb/gadget/udc/udc-core.c 
b/drivers/usb/gadget/udc/udc-core.c
index e31d574..875e998 100644
--- a/drivers/usb/gadget/udc/udc-core.c
+++ b/drivers/usb/gadget/udc/udc-core.c
@@ -1,33 +1,27 @@
 /**
- * udc.c - Core UDC Framework
+ * udc-core.c - Core UDC Framework
+ *
+ * Copyright (C) 2015 Texas Instruments Incorporated - http://www.ti.com
  *
- * Copyright (C) 2010 Texas Instruments
  * Author: Felipe Balbi 
  *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2  of
- * the License as published by the Free Software Foundation.
+ * Taken from Linux Kernel v3.19-rc1 (drivers/usb/gadget/udc-core.c) and ported
+ * to uboot.
  *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
+ * commit 02e8c96627 : usb: gadget: udc: core: prepend udc_attach_driver with
+ *usb_
  *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see .
+ * SPDX-License-Identifier: GPL-2.0
  */
 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
-#include 
+#include 
+#include 
+#include 
+#include 
+#include 
 
 #include 
 #include 
-#include 
 
 /**
  * struct usb_udc - describes one usb device controller
@@ -48,38 +42,18 @@ struct usb_udc {
 
 static struct class *udc_class;
 static LIST_HEAD(udc_list);
-static DEFINE_MUTEX(udc_lock);
+DEFINE_MUTEX(udc_lock);
 
 /* - */
 
-#ifdef CONFIG_HAS_DMA
-
 int usb_gadget_map_request(struct usb_gadget *gadget,
struct usb_request *req, int is_in)
 {
if (req->length == 0)
return 0;
 
-   if (req->num_sgs) {
-   int mapped;
-
-   mapped = dma_map_sg(&gadget->dev, req->sg, req->num_sgs,
-   is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
-   if (mapped == 0) {
-   dev_err(&gadget->dev, "failed to map SGs\n");
-   return -EFAULT;
-   }
-
-   req->num_mapped_sgs = mapped;
-   } else {
-   req->dma = dma_map_single(&gadget->dev, req->buf, req->length,
-   is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
-
-   if (dma_mapping_error(&gadget->dev, req->dma)) {
-   dev_err(&gadget->dev, "failed to map buffer\n");
-   return -EFAULT;
-   }
-   }
+   req->dma = dma_map_single(req->buf, req->length,
+ is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
 
return 0;
 }
@@ -91,20 +65,11 @@ void usb_gadget_unmap_request(struct usb_gadget *gadget,
if (req->length == 0)
return;
 
-   if (req->num_mapped_sgs) {
-   dma_unmap_sg(&gadget->dev, req->sg, req->num_mapped_sgs,
-   is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
-
-   req->num_mapped_sgs = 0;
-   } else {
-   dma_unmap_single(&gadget->dev, req->dma, req->length,
-   is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
-   }
+   dma_unmap_single((void *)req->dma, req->length,
+is_in ? DMA_TO_DEVICE : DMA_FROM_DEVICE);
 }
 EXPORT_SYMBOL_GPL(usb_gadget_unmap_request);
 
-#endif /* CONFIG_HAS_DMA */
-
 /* - */
 
 /**
@@ -117,39 +82,16 @@ EXPORT_SYMBOL_GPL(usb_gadget_unmap_request);
 void usb_gadget_giveback_request(struct usb_ep *ep,
struct usb_request *req)
 {
-   if (likely(req->status == 0))
-   usb_led_activity(USB_LED_EVENT_GADGET);
-
req->complete(ep, req);
 }
 EXPORT_SYMBOL_GPL(usb_gadget_giveback_request);
 
 /* - */
 
-static void usb_gadget_state_work(struct work_struct *work)
-{
-   struct usb_gadget   *gadget = work_to_gadget(work);
-   struct usb_udc  *udc = NULL;
-
-   mutex_lock(&udc_lock);
-   list_for_each_entry(udc, &udc_list, list)
-   if (udc->gadget == gadget)
-   goto found;
-   mutex_unlock(&udc_lock);
-
-   return;
-
-found:
-   mutex_unlock(&udc_lock);
-

[U-Boot] [u-boot 08/40] usb: dwc3: remove un-used files from dwc3 folder

2015-02-06 Thread Kishon Vijay Abraham I
removed un-used/un-supported files from dwc3. These files can be added
later as and when the support is added.

Signed-off-by: Kishon Vijay Abraham I 
---
 drivers/usb/dwc3/Kconfig |  120 ---
 drivers/usb/dwc3/debug.c |   32 --
 drivers/usb/dwc3/debug.h |  228 -
 drivers/usb/dwc3/debugfs.c   |  690 --
 drivers/usb/dwc3/dwc3-exynos.c   |  301 -
 drivers/usb/dwc3/dwc3-keystone.c |  197 ---
 drivers/usb/dwc3/dwc3-pci.c  |  272 ---
 drivers/usb/dwc3/dwc3-qcom.c |  130 ---
 drivers/usb/dwc3/dwc3-st.c   |  367 
 drivers/usb/dwc3/host.c  |   91 -
 drivers/usb/dwc3/platform_data.h |   47 ---
 drivers/usb/dwc3/trace.c |   19 --
 drivers/usb/dwc3/trace.h |  247 --
 13 files changed, 2741 deletions(-)
 delete mode 100644 drivers/usb/dwc3/Kconfig
 delete mode 100644 drivers/usb/dwc3/debug.c
 delete mode 100644 drivers/usb/dwc3/debug.h
 delete mode 100644 drivers/usb/dwc3/debugfs.c
 delete mode 100644 drivers/usb/dwc3/dwc3-exynos.c
 delete mode 100644 drivers/usb/dwc3/dwc3-keystone.c
 delete mode 100644 drivers/usb/dwc3/dwc3-pci.c
 delete mode 100644 drivers/usb/dwc3/dwc3-qcom.c
 delete mode 100644 drivers/usb/dwc3/dwc3-st.c
 delete mode 100644 drivers/usb/dwc3/host.c
 delete mode 100644 drivers/usb/dwc3/platform_data.h
 delete mode 100644 drivers/usb/dwc3/trace.c
 delete mode 100644 drivers/usb/dwc3/trace.h

diff --git a/drivers/usb/dwc3/Kconfig b/drivers/usb/dwc3/Kconfig
deleted file mode 100644
index 58b5b2c..000
--- a/drivers/usb/dwc3/Kconfig
+++ /dev/null
@@ -1,120 +0,0 @@
-config USB_DWC3
-   tristate "DesignWare USB3 DRD Core Support"
-   depends on (USB || USB_GADGET) && HAS_DMA
-   select USB_XHCI_PLATFORM if USB_SUPPORT && USB_XHCI_HCD
-   help
- Say Y or M here if your system has a Dual Role SuperSpeed
- USB controller based on the DesignWare USB3 IP Core.
-
- If you choose to build this driver is a dynamically linked
- module, the module will be called dwc3.ko.
-
-if USB_DWC3
-
-choice
-   bool "DWC3 Mode Selection"
-   default USB_DWC3_DUAL_ROLE if (USB && USB_GADGET)
-   default USB_DWC3_HOST if (USB && !USB_GADGET)
-   default USB_DWC3_GADGET if (!USB && USB_GADGET)
-
-config USB_DWC3_HOST
-   bool "Host only mode"
-   depends on USB=y || USB=USB_DWC3
-   help
- Select this when you want to use DWC3 in host mode only,
- thereby the gadget feature will be regressed.
-
-config USB_DWC3_GADGET
-   bool "Gadget only mode"
-   depends on USB_GADGET=y || USB_GADGET=USB_DWC3
-   help
- Select this when you want to use DWC3 in gadget mode only,
- thereby the host feature will be regressed.
-
-config USB_DWC3_DUAL_ROLE
-   bool "Dual Role mode"
-   depends on ((USB=y || USB=USB_DWC3) && (USB_GADGET=y || 
USB_GADGET=USB_DWC3))
-   help
- This is the default mode of working of DWC3 controller where
- both host and gadget features are enabled.
-
-endchoice
-
-comment "Platform Glue Driver Support"
-
-config USB_DWC3_OMAP
-   tristate "Texas Instruments OMAP5 and similar Platforms"
-   depends on EXTCON && (ARCH_OMAP2PLUS || COMPILE_TEST)
-   depends on OF
-   default USB_DWC3
-   help
- Some platforms from Texas Instruments like OMAP5, DRA7xxx and
- AM437x use this IP for USB2/3 functionality.
-
- Say 'Y' or 'M' here if you have one such device
-
-config USB_DWC3_EXYNOS
-   tristate "Samsung Exynos Platform"
-   depends on ARCH_EXYNOS && OF || COMPILE_TEST
-   default USB_DWC3
-   help
- Recent Exynos5 SoCs ship with one DesignWare Core USB3 IP inside,
- say 'Y' or 'M' if you have one such device.
-
-config USB_DWC3_PCI
-   tristate "PCIe-based Platforms"
-   depends on PCI
-   default USB_DWC3
-   help
- If you're using the DesignWare Core IP with a PCIe, please say
- 'Y' or 'M' here.
-
- One such PCIe-based platform is Synopsys' PCIe HAPS model of
- this IP.
-
-config USB_DWC3_KEYSTONE
-   tristate "Texas Instruments Keystone2 Platforms"
-   depends on ARCH_KEYSTONE || COMPILE_TEST
-   default USB_DWC3
-   help
- Support of USB2/3 functionality in TI Keystone2 platforms.
- Say 'Y' or 'M' here if you have one such device
-
-config USB_DWC3_ST
-   tristate "STMicroelectronics Platforms"
-   depends on ARCH_STI && OF
-   default USB_DWC3
-   help
- STMicroelectronics SoCs with one DesignWare Core USB3 IP
- inside (i.e. STiH407).
- Say 'Y' or 'M' if you have one such device.
-
-config USB_DWC3_QCOM
-   tristate "Qualcomm Platforms"
-   depends on ARCH_QCOM || COMPILE_TEST
-   default USB_DWC3
-   help
- Recent Qualcomm SoCs ship with one DesignWare Core USB3 IP ins

[U-Boot] [u-boot 35/40] common: cmd_dfu: invoke board_usb_cleanup() for cleaning up

2015-02-06 Thread Kishon Vijay Abraham I
Invoked board_usb_cleanup for cleaning up initialized USB. It
will be invoked if the user enterts ctrl-C.

Signed-off-by: Kishon Vijay Abraham I 
---
 common/cmd_dfu.c |1 +
 common/usb.c |7 +++
 2 files changed, 8 insertions(+)

diff --git a/common/cmd_dfu.c b/common/cmd_dfu.c
index e975abe..161d38b 100644
--- a/common/cmd_dfu.c
+++ b/common/cmd_dfu.c
@@ -68,6 +68,7 @@ static int do_dfu(cmd_tbl_t *cmdtp, int flag, int argc, char 
* const argv[])
}
 exit:
g_dnl_unregister();
+   board_usb_cleanup(controller_index, USB_INIT_DEVICE);
 done:
dfu_free_entities();
 
diff --git a/common/usb.c b/common/usb.c
index 736cd9f..c7cc1b1 100644
--- a/common/usb.c
+++ b/common/usb.c
@@ -1063,4 +1063,11 @@ int board_usb_init(int index, enum usb_init_type init)
 {
return 0;
 }
+
+
+__weak
+int board_usb_cleanup(int index, enum usb_init_type init)
+{
+   return 0;
+}
 /* EOF */
-- 
1.7.9.5

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


[U-Boot] [u-boot 02/40] ARM: AM43xx: Enable clocks for USB OTGSS and USB PHY

2015-02-06 Thread Kishon Vijay Abraham I
Enabled clocks for dwc3 controller and USB PHY present in AM43xx.

Signed-off-by: Kishon Vijay Abraham I 
---
 arch/arm/cpu/armv7/am33xx/clock_am43xx.c   |   12 +++
 arch/arm/include/asm/arch-am33xx/cpu.h |   22 ++--
 arch/arm/include/asm/arch-am33xx/hardware_am43xx.h |4 
 3 files changed, 32 insertions(+), 6 deletions(-)

diff --git a/arch/arm/cpu/armv7/am33xx/clock_am43xx.c 
b/arch/arm/cpu/armv7/am33xx/clock_am43xx.c
index 31188c8..252135d 100644
--- a/arch/arm/cpu/armv7/am33xx/clock_am43xx.c
+++ b/arch/arm/cpu/armv7/am33xx/clock_am43xx.c
@@ -111,9 +111,21 @@ void enable_basic_clocks(void)
&cmper->emifclkctrl,
&cmper->otfaemifclkctrl,
&cmper->qspiclkctrl,
+   &cmper->usb0clkctrl,
+   &cmper->usbphyocp2scp0clkctrl,
+   &cmper->usb1clkctrl,
+   &cmper->usbphyocp2scp1clkctrl,
0
};
 
+   setbits_le32(&cmper->usb0clkctrl,
+USBOTGSSX_CLKCTRL_OPTFCLKEN_REFCLK960);
+   setbits_le32(&cmwkup->usbphy0clkctrl,
+USBPHY0_CLKCTRL_OPTFCLKEN_CLK32K);
+   setbits_le32(&cmper->usb1clkctrl,
+USBOTGSSX_CLKCTRL_OPTFCLKEN_REFCLK960);
+   setbits_le32(&cmwkup->usbphy1clkctrl,
+USBPHY0_CLKCTRL_OPTFCLKEN_CLK32K);
do_enable_clocks(clk_domains, clk_modules_explicit_en, 1);
 
/* Select the Master osc clk as Timer2 clock source */
diff --git a/arch/arm/include/asm/arch-am33xx/cpu.h 
b/arch/arm/include/asm/arch-am33xx/cpu.h
index 8dd69b3..1caa24e 100644
--- a/arch/arm/include/asm/arch-am33xx/cpu.h
+++ b/arch/arm/include/asm/arch-am33xx/cpu.h
@@ -224,7 +224,11 @@ struct cm_dpll {
 struct cm_wkuppll {
unsigned int resv0[136];
unsigned int wkl4wkclkctrl; /* offset 0x220 */
-   unsigned int resv1[55];
+   unsigned int resv1[7];
+   unsigned int usbphy0clkctrl;/* offset 0x240 */
+   unsigned int resv112;
+   unsigned int usbphy1clkctrl;/* offset 0x248 */
+   unsigned int resv113[45];
unsigned int wkclkstctrl;   /* offset 0x300 */
unsigned int resv2[15];
unsigned int wkup_i2c0ctrl; /* offset 0x340 */
@@ -275,7 +279,7 @@ struct cm_wkuppll {
unsigned int divm2dplldisp; /* offset 0x630 */
 };
 
-/*
+/*get_sys_clk_freq
  * Encapsulating peripheral functional clocks
  * pll registers
  */
@@ -283,7 +287,7 @@ struct cm_perpll {
unsigned int l3clkstctrl;   /* offset 0x00 */
unsigned int resv0[7];
unsigned int l3clkctrl; /* Offset 0x20 */
-   unsigned int resv1[7];
+   unsigned int resv112[7];
unsigned int l3instrclkctrl;/* offset 0x40 */
unsigned int resv2[3];
unsigned int ocmcramclkctrl;/* offset 0x50 */
@@ -310,7 +314,9 @@ struct cm_perpll {
unsigned int qspiclkctrl;   /* offset 0x258 */
unsigned int resv121;
unsigned int usb0clkctrl;   /* offset 0x260 */
-   unsigned int resv13[103];
+   unsigned int resv122;
+   unsigned int usb1clkctrl;   /* offset 0x268 */
+   unsigned int resv13[101];
unsigned int l4lsclkstctrl; /* offset 0x400 */
unsigned int resv14[7];
unsigned int l4lsclkctrl;   /* offset 0x420 */
@@ -364,10 +370,14 @@ struct cm_perpll {
unsigned int uart4clkctrl;  /* offset 0x598 */
unsigned int resv35;
unsigned int uart5clkctrl;  /* offset 0x5A0 */
-   unsigned int resv36[87];
+   unsigned int resv36[5];
+   unsigned int usbphyocp2scp0clkctrl; /* offset 0x5B8 */
+   unsigned int resv361;
+   unsigned int usbphyocp2scp1clkctrl; /* offset 0x5C0 */
+   unsigned int resv3611[79];
 
unsigned int emifclkstctrl; /* offset 0x700 */
-   unsigned int resv361[7];
+   unsigned int resv362[7];
unsigned int emifclkctrl;   /* offset 0x720 */
unsigned int resv37[3];
unsigned int emiffwclkctrl; /* offset 0x730 */
diff --git a/arch/arm/include/asm/arch-am33xx/hardware_am43xx.h 
b/arch/arm/include/asm/arch-am33xx/hardware_am43xx.h
index efdecf4..5f259da 100644
--- a/arch/arm/include/asm/arch-am33xx/hardware_am43xx.h
+++ b/arch/arm/include/asm/arch-am33xx/hardware_am43xx.h
@@ -72,6 +72,10 @@
 #define USBPHYOCPSCP_MODULE_EN (1 << 1)
 #define CM_DEVICE_INST 0x44df4100
 
+#defineUSBOTGSSX_CLKCTRL_OPTFCLKEN_REFCLK960   (1 << 8)
+#defineUSBPHY0_CLKCTRL_OPTFCLKEN_CLK32K(1 << 8)
+
+
 /* Control status register */
 #define CTRL_CRYSTAL_FREQ_SRC_MASK (1 << 31)
 #define CTRL_CRYSTAL_FREQ_SRC_SHIFT31
-- 
1.7.9.5

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


[U-Boot] [u-boot 20/40] include: dwc3-uboot: add a structure for populating platform data

2015-02-06 Thread Kishon Vijay Abraham I
Added a structure to populate dwc3 core platform data. The board file should
populate these platform data before invoking dwc3 driver.
This will be removed once we have dwc3 driver adapted to use the driver model.

Signed-off-by: Kishon Vijay Abraham I 
---
 include/dwc3-uboot.h |   40 
 1 file changed, 40 insertions(+)
 create mode 100644 include/dwc3-uboot.h

diff --git a/include/dwc3-uboot.h b/include/dwc3-uboot.h
new file mode 100644
index 000..6d1b42a
--- /dev/null
+++ b/include/dwc3-uboot.h
@@ -0,0 +1,40 @@
+/* include/dwc3-uboot.h
+ *
+ * Copyright (c) 2015 Texas Instruments Incorporated - http://www.ti.com
+ *
+ * Designware SuperSpeed USB uboot init
+ *
+ * SPDX-License-Identifier: GPL-2.0
+ */
+
+#ifndef __DWC3_UBOOT_H_
+#define __DWC3_UBOOT_H_
+
+#include 
+
+struct dwc3_device {
+   int base;
+   enum usb_dr_mode dr_mode;
+   u32 maximum_speed;
+   unsigned tx_fifo_resize:1;
+   unsigned has_lpm_erratum;
+   u8 lpm_nyet_threshold;
+   unsigned is_utmi_l1_suspend;
+   u8 hird_threshold;
+   unsigned disable_scramble_quirk;
+   unsigned u2exit_lfps_quirk;
+   unsigned u2ss_inp3_quirk;
+   unsigned req_p1p2p3_quirk;
+   unsigned del_p1p2p3_quirk;
+   unsigned del_phy_power_chg_quirk;
+   unsigned lfps_filter_quirk;
+   unsigned rx_detect_poll_quirk;
+   unsigned dis_u3_susphy_quirk;
+   unsigned dis_u2_susphy_quirk;
+   unsigned tx_de_emphasis_quirk;
+   unsigned tx_de_emphasis;
+};
+
+int dwc3_uboot_init(struct dwc3_device *dev);
+void dwc3_uboot_exit(void);
+#endif /* __DWC3_UBOOT_H_ */
-- 
1.7.9.5

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


Re: [U-Boot] relocation on freescale mx35 doesn't work after update to 2015.01

2015-02-06 Thread Priebe, Sebastian
Hello Albert,

thanks for your answer.
I tried to look up some information in the iMX35 reference manual but couldn't 
find anything. It doesn't say anything about the exception vectors. Can you 
point me at any direction where to look for information?

What is the consequence of skipping the relocation?
Until now we don't use interrupts in the U-Boot.
I want to know if we could update to the new version using the workaround I 
used, or if we might facing problems with that.

Greetings,
Sebastian Priebe
Telefon: +49 (0)621 685996-26




==
CADCON
Ingenieurgesellschaft mbH & Co. KG
Geschaeftsfuehrer: Robert Bauer, Andreas Gundel
Sitz der Gesellschaft: D-86368 Gersthofen
Registergericht: Amtsgericht Augsburg HRA 14521
==

-Ursprüngliche Nachricht-
Von: Albert ARIBAUD [mailto:albert.u.b...@aribaud.net]
Gesendet: Freitag, 6. Februar 2015 01:16
An: Priebe, Sebastian
Cc: U-Boot
Betreff: Re: relocation on freescale mx35 doesn't work after update to 2015.01

Hello Sebastian,

On Thu, 5 Feb 2015 15:24:40 +, Priebe, Sebastian 
 wrote:
> Hello,
>
> I'm using a custom board with iMX35 CPU (ARM1136).
> After I updated to version 2015.01 the relocation doesn't work anymore.
> I turned on CONFIG_DEBUG and the last output I saw was:
> Relocating to 83f89000, new gd at 83e84ec8, sp at 83e84ea0
>
> I recognized the new function "relocate_vectors".
> I copied the special handling (strong function) from mx25, which is just 
> skipping the relocation of the vectors and with that the U-Boot is booting 
> again on my board.
>
> Do I need some special handling for mx35, too? Does anyone have the same 
> problem?
>
> Any advice?

Yes, you quite possibly need some special handling. Look up the i.MX35 
documentation and see how the exception vectors are handled. Probably there is 
something similar to what had to be done with i.MX27 (and that probably should 
(have) be(en) done wth i.MX25 too instead of just skipping the whole thing).

> Thanks,
> Sebastian

Amicalement,
--
Albert.


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


Re: [U-Boot] relocation on freescale mx35 doesn't work after update to 2015.01

2015-02-06 Thread Albert ARIBAUD
Hello Sebastian,

Cc:ing Stefano since he's the i.MX custodian.

On Fri, 6 Feb 2015 09:38:17 +, Priebe, Sebastian
 wrote:
> Hello Albert,
> 
> thanks for your answer.
> I tried to look up some information in the iMX35 reference manual but 
> couldn't find anything. It doesn't say anything about the exception vectors. 
> Can you point me at any direction where to look for information?

I'll try and have a look, but basically, you should search for a
chapter describing the boot sequence or exception handling.

> What is the consequence of skipping the relocation?
> Until now we don't use interrupts in the U-Boot.

It's not only about interrupts... It's about exceptions, which include
data aborts, prefetch aborts, undefined instructions...

Catching such exceptions properly means you will get to *know*
something went wrong, and moreover you will get to know *what*
was going wrong exactly.

Without proper exception vectors... Maybe you'll get a board reset
when the exception occurs, and you strictly won't have any clue as to
what happened and why.

> I want to know if we could update to the new version using the workaround I 
> used, or if we might facing problems with that.

Depends. Do you feel lucky? :)

If so, you can go on with not relocating vectors at all; but if I have
my say, that patch won't end up in the mainline, so you'll have to keep
it somewhere locally.

If you think you might encounter data or prefetch aborts for some
reason while working on U-Boot, and if you don't want to spend hours
just finding out that you hit an abort then trying to determine why
you did, then I'd say you should fix the vector relocation properly.

> Greetings,
> Sebastian Priebe
> Telefon: +49 (0)621 685996-26

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


Re: [U-Boot] [PATCH V3] cmd_i2c: Provide option for bulk 'i2c write' in one transaction

2015-02-06 Thread Lubomir Popov
Hi Heiko,

> Hello Simon, Lubomir,
>
> Am 03.02.2015 01:59, schrieb Simon Glass:
>> Hi,
>>
>> On 30 January 2015 at 10:56, Lubomir Popov  wrote:
>>> I2C chips do exist that require a write of some multi-byte data to occur in
>>> a single bus transaction (aka atomic transfer), otherwise either the write
>>> does not come into effect at all, or normal operation of internal circuitry
>>> cannot be guaranteed. The current implementation of the 'i2c write' command
>>> (transfer of multiple bytes from a memory buffer) in fact performs a 
>>> separate
>>> transaction for each byte to be written and thus cannot support such types 
>>> of
>>> I2C slave devices.
>>>
>>> This patch provides an alternative by allowing 'i2c write' to execute the
>>> write transfer of the given number of bytes in a single bus transaction if
>>> the '-s' option is specified as a final command argument. Else the current
>>> re-addressing method is used.
>>>
>>> Signed-off-by: Lubomir Popov 
>>> ---
>>> Changes in V3:
>>> Rebased on current master.
>>> Changes in V2:
>>> The option to use bulk transfer vs re-addressing is implemented as a 
>>> run-time
>>> command argument. V1 used conditional compilation through a board header
>>> definition.
>>>
>>>   common/cmd_i2c.c |   39 ++-
>>>   1 file changed, 30 insertions(+), 9 deletions(-)
>
> I should try to apply a patch before saying I tend to accept a patch ;-)
>
> This patch fails again (Sorry Lubomir) ... because in the meantime
> this patch from Simon is in mainline:
>
> commit f9a4c2da72d04e13b05deecb800f232d2948eb85
> Author: Simon Glass 
> Date:   Mon Jan 12 18:02:07 2015 -0700
>
>  dm: i2c: Rename driver model I2C functions to permit compatibility
>
> Which introduced dm_i2c_write() ...
>
>> What platform are you testing on?
>>
>> It seems like you could implement this using driver model - just set
>> or clear the DM_I2C_CHIP_WR_ADDRESS flag.
>>
>> That would solve the problem of existing platforms, since they could
>> be tested when converted to driver model.
>>
>> So what do you think about adjusting this patch to move the '#ifdef
>> CONFIG_DM_I2C' outside the while loop, and set the flag instead?
>> Although then your feature would only be available for driver model.
>
> Thinking about this, wouldn;t it be better to add this patch to
> this patch?
>
> diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c
> index a1a269f..df18b3f 100644
> --- a/common/cmd_i2c.c
> +++ b/common/cmd_i2c.c
> @@ -342,6 +342,7 @@ static int do_i2c_write(cmd_tbl_t *cmdtp, int flag, int 
> argc, char * const argv[
>  int ret;
>   #ifdef CONFIG_DM_I2C
>  struct udevice *dev;
> +   struct dm_i2c_chip *i2c_chip;
>   #endif
>
>  if ((argc < 5) || (argc > 6))
> @@ -377,6 +378,9 @@ static int do_i2c_write(cmd_tbl_t *cmdtp, int flag, int 
> argc, char * const argv[
>  ret = i2c_set_chip_offset_len(dev, alen);
>  if (ret)
>  return i2c_report_err(ret, I2C_ERR_WRITE);
> +   i2c_chip = dev_get_parent_platdata(dev);
> +   if (!i2c_chip)
> +   return i2c_report_err(ret, I2C_ERR_WRITE);
>   #endif
>
>  if (argc == 6 && !strcmp(argv[5], "-s")) {
> @@ -387,7 +391,8 @@ static int do_i2c_write(cmd_tbl_t *cmdtp, int flag, int 
> argc, char * const argv[
>   * into account if linking commands.
>   */
>   #ifdef CONFIG_DM_I2C
> -   ret = i2c_write(dev, devaddr, memaddr, length);
> +   i2c_chip &= ~DM_I2C_CHIP_WR_ADDRESS;
> +   ret = dm_i2c_write(dev, devaddr, memaddr, length);
>   #else
>  ret = i2c_write(chip, devaddr, alen, memaddr, length);
>   #endif
> @@ -400,7 +405,8 @@ static int do_i2c_write(cmd_tbl_t *cmdtp, int flag, int 
> argc, char * const argv[
>   */
>  while (length-- > 0) {
>   #ifdef CONFIG_DM_I2C
> -   ret = i2c_write(dev, devaddr++, memaddr++, 1);
> +   i2c_chip |= DM_I2C_CHIP_WR_ADDRESS;
> +   ret = dm_i2c_write(dev, devaddr++, memaddr++, 1);
>   #else
>  ret = i2c_write(chip, devaddr++, alen, memaddr++, 1);
>   #endif
>
This looks OK to me; however, since I don't have any DM-enabled
board to test upon, nor currently have any time to test whatever
in general (really sorry), I'm leaving this in your hands, guys.

BR,
Lubo

> @Simon: Do I have to check if dev_get_parent_platdata() returns
> a pointer?
>
> bye,
> Heiko
>>> diff --git a/common/cmd_i2c.c b/common/cmd_i2c.c
>>> index 22db1bb..8d4f5f6 100644
>>> --- a/common/cmd_i2c.c
>>> +++ b/common/cmd_i2c.c
>>> @@ -344,7 +344,7 @@ static int do_i2c_write(cmd_tbl_t *cmdtp, int flag, int 
>>> argc, char * const argv[
>>>  struct udevice *dev;
>>>   #endif
>>>
>>> -   if (argc != 5)
>>> +   if ((argc < 5) || (argc > 6))
>>>  return cmd_usage(cmdtp);
>>>
>>>  /*
>>> @@ -367,7 +367,7 @@ static int d

Re: [U-Boot] [PATCH v2] armv8/vexpress64: make multientry conditional

2015-02-06 Thread Linus Walleij
On Wed, Feb 4, 2015 at 3:38 PM, FengHua  wrote:

>>  config TARGET_LS2085A_SIMU
>>   bool "Support ls2085a_simu"
>>   select ARM64
>> + select ARMV8_MULTIENTRY
>>
> VEXPRESS_AEMV8A and VEXPRESS_AEMV8A_SEMI are
> defaultly single entry?

Yes.

> That means we always has ATF exist.

Not necessarily, just that something keeps the secondary cores
in WFI. If that is ATF or something else (like the ROM, or just
them being kept in power-on state) not doesn't matter.

But the more important question is: who is using this on vexpress64?

If I can reproduce the usecase with some sane setup, I'll be happy
to handle the multientry case for the vexpress64's.

>>  master_cpu:
>> + /* On the master CPU */
>> +#endif /* CONFIG_ARMV8_MULTIENTRY */
>> +
>>   bl  _main
>>
> How about put the slave part of lowlevel_init in CONFIG_ARMV8_MULTIENTRY?
> although it still works with modified branch_if_master macro.

Yes it may save a few bytes, added some more #ifdefs.

>>  .macro armv8_switch_to_el2_m, xreg1
>> diff --git a/board/armltd/vexpress64/vexpress64.c 
>> b/board/armltd/vexpress64/vexpress64.c
>> index 58973185ecda..7ab000cca77b 100644
>> --- a/board/armltd/vexpress64/vexpress64.c
>> +++ b/board/armltd/vexpress64/vexpress64.c
>> @@ -22,12 +22,6 @@ int board_init(void)
>>
>>  int dram_init(void)
>>  {
>> - /*
>> -  * Clear spin table so that secondary processors
>> -  * observe the correct value after waken up from wfe.
>> -  */
>> - *(unsigned long *)CPU_RELEASE_ADDR = 0;
>> -
>
> Put them in CONFIG_ARMV8_MULTIENTRY instead of removing, so as to
> it works without ATF.

Do you have a system that uses this?

How can I reproduce a boot on one of the ARM vexpress64
simulators that will come up on multiple CPUs?

>> -
>> -/* SMP Spin Table Definitions */
>> -#ifdef CONFIG_TARGET_VEXPRESS64_BASE_FVP
>> -#define CPU_RELEASE_ADDR (CONFIG_SYS_SDRAM_BASE + 0x03f0)
>
> Are you sure Base FVP did not need MultiEntry?

Noone I know of uses it, if they exist the should speak up.

> why is CPU_RELEASE_ADDR defined here with different value?

I think somebody just put it in there because the #define was
needed to compile the U-boot. Noone has given any explanation
to these magic numbers...

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


[U-Boot] [PATCH][v3] crypto/fsl - Add progressive hashing support using hardware acceleration.

2015-02-06 Thread Gaurav Rana
Currently only normal hashing is supported using hardware acceleration.
Added support for progressinve hashing using h/w.

Signed-off-by: Ruchika Gupta 
Signed-off-by: Gaurav Rana 
CC: Simon Glass 
---

Changes in v3:
Remove duplication of code and create function gen_hash_type.
Modify MAX_SG to MAX_SG_32

Changes in v2:
Merge to common functions for SHA1 and SHA256.
Replace malloc and memset with calloc.
Remove cast conversions for void* pointers.
Replace hardcoded errors with Macros.
Corrected comments.

 README|   4 ++
 common/hash.c |  10 +++
 drivers/crypto/fsl/fsl_hash.c | 137 +-
 drivers/crypto/fsl/fsl_hash.h |  34 +++
 include/fsl_sec.h |  26 
 include/hw_sha.h  |  39 
 6 files changed, 249 insertions(+), 1 deletion(-)
 create mode 100644 drivers/crypto/fsl/fsl_hash.h

diff --git a/README b/README
index cac7978..4c72baa 100644
--- a/README
+++ b/README
@@ -3151,6 +3151,10 @@ CBFS (Coreboot Filesystem) support
 
CONFIG_SHA1 - support SHA1 hashing
CONFIG_SHA256 - support SHA256 hashing
+   CONFIG_SHA_HW_ACCEL - support SHA1 and SHA256 hashing using
+   hardware acceleration
+   CONFIG_SHA_PROG_HW_ACCEL - support SHA1 and SHA256 progressive
+   hashing using hw acceleration
 
Note: There is also a sha1sum command, which should perhaps
be deprecated in favour of 'hash sha1'.
diff --git a/common/hash.c b/common/hash.c
index d154d02..9e9f84b 100644
--- a/common/hash.c
+++ b/common/hash.c
@@ -127,11 +127,21 @@ static struct hash_algo hash_algo[] = {
SHA1_SUM_LEN,
hw_sha1,
CHUNKSZ_SHA1,
+#ifdef CONFIG_SHA_PROG_HW_ACCEL
+   hw_sha_init,
+   hw_sha_update,
+   hw_sha_finish,
+#endif
}, {
"sha256",
SHA256_SUM_LEN,
hw_sha256,
CHUNKSZ_SHA256,
+#ifdef CONFIG_SHA_PROG_HW_ACCEL
+   hw_sha_init,
+   hw_sha_update,
+   hw_sha_finish,
+#endif
},
 #endif
 #ifdef CONFIG_SHA1
diff --git a/drivers/crypto/fsl/fsl_hash.c b/drivers/crypto/fsl/fsl_hash.c
index d77f257..40dfe72 100644
--- a/drivers/crypto/fsl/fsl_hash.c
+++ b/drivers/crypto/fsl/fsl_hash.c
@@ -10,6 +10,8 @@
 #include "jobdesc.h"
 #include "desc.h"
 #include "jr.h"
+#include "fsl_hash.h"
+#include 
 
 #define CRYPTO_MAX_ALG_NAME80
 #define SHA1_DIGEST_SIZE20
@@ -39,6 +41,122 @@ static struct caam_hash_template driver_hash[] = {
},
 };
 
+static enum caam_hash_algos get_hash_type(struct hash_algo *algo)
+{
+   if (!strcmp(algo->name, driver_hash[SHA1].name))
+   return SHA1;
+   else
+   return SHA256;
+}
+
+/* Create the context for progressive hashing using h/w acceleration.
+ *
+ * @ctxp: Pointer to the pointer of the context for hashing
+ * @caam_algo: Enum for SHA1 or SHA256
+ * @return 0 if ok, -ENOMEM on error
+ */
+static int caam_hash_init(void **ctxp, enum caam_hash_algos caam_algo)
+{
+   *ctxp = calloc(1, sizeof(struct sha_ctx));
+   if (*ctxp == NULL) {
+   debug("Cannot allocate memory for context\n");
+   return -ENOMEM;
+   }
+   return 0;
+}
+
+/*
+ * Update sg table for progressive hashing using h/w acceleration
+ *
+ * The context is freed by this function if an error occurs.
+ * We support MAX of 32 SG Entries.
+ *
+ * @hash_ctx: Pointer to the context for hashing
+ * @buf: Pointer to the buffer being hashed
+ * @size: Size of the buffer being hashed
+ * @is_last: 1 if this is the last update; 0 otherwise
+ * @caam_algo: Enum for SHA1 or SHA256
+ * @return 0 if ok, -EINVAL on error
+ */
+static int caam_hash_update(void *hash_ctx, const void *buf,
+   unsigned int size, int is_last,
+   enum caam_hash_algos caam_algo)
+{
+   uint32_t final = 0;
+   dma_addr_t addr = virt_to_phys((void *)buf);
+   struct sha_ctx *ctx = hash_ctx;
+
+   if (ctx->sg_num >= MAX_SG_32) {
+   free(ctx);
+   return -EINVAL;
+   }
+
+#ifdef CONFIG_PHYS_64BIT
+   ctx->sg_tbl[ctx->sg_num].addr_hi = addr >> 32;
+#else
+   ctx->sg_tbl[ctx->sg_num].addr_hi = 0x0;
+#endif
+   ctx->sg_tbl[ctx->sg_num].addr_lo = addr;
+
+   sec_out32(&ctx->sg_tbl[ctx->sg_num].len_flag,
+ (size & SG_ENTRY_LENGTH_MASK));
+
+   ctx->sg_num++;
+
+   if (is_last) {
+   final = sec_in32(&ctx->sg_tbl[ctx->sg_num - 1].len_flag) |
+   SG_ENTRY_FINAL_BIT;
+   sec_out32(&ctx->sg_tbl[ctx->sg_num - 1].len_flag, final);
+   }
+
+   return 0;
+}
+
+/*
+ * Perform progressive hashing on the given buffer and copy hash at
+ * destination buffer
+ *
+ * The context is freed after completion of hash operat

Re: [U-Boot] x86: ACPI support suggestion

2015-02-06 Thread Bin Meng
Hi Gabriel,

Thank you for taking the initiative for the U-Boot ACPI support.

On Thu, Feb 5, 2015 at 3:52 AM, Simon Glass  wrote:
> +Bin
>
> Hi Gabriel,
>
> On 4 February 2015 at 12:22, Gabriel Huau  wrote:
>> Hi All,
>>
>> I'm currently thinking on how to integrate the ACPI support in u-boot x86.
>> I've investigated the coreboot implementation. My first thought was to port
>> all the source code over but looking at the source code in more details it
>> doesn't look like an easy option. For example, it involves reading a lot of
>> values over PCI to dynamically fill the tables, and integration a lot of SoC
>> specific headers (IRQ definition, GPIO, ...).
>
> That doesn't sound nice.

If we choose to implement generating ACPI tables by U-Boot, we have to
do that unfortunately. We may port coreboot stuff and fix anything
that is not good.

>>
>> Therefore, as a first implementation I was thinking about the following:
>> - booting a board with the Intel UEFI + Linux
>> - extracting all the ACPI tables (/sys/firmware/acpi/ or acpixtract)
>> - disassembling the binaries tables via iasl to allow people to modify
>> them
>> - integrating these files into u-boot in board specific folder (for
>> example: board/intel/minnowmax/acpi/*)
>> - generating one blob per table using iasl during build time which
>> requires iasl tool to be installed if we have the CONFIG_ACPI
>> - writing at the RSDP location all the ACPI tables previously exported
>>
>> With this flow, the integration would be quite simple. Also this allows the
>> tables to be modified easily when there is a new release or to add some new
>> devices to the DSDT.
>>
>> What are your thoughts about that?
>>
>> Feel free to provide some feedback on this implementation.
>
> It seems reasonable to me. Bin may have some comments so I copied him.
> We have been using the device tree to statically define the hardware,
> so there is some duplication here. I would like to avoid actually
> using ACPI in U-Boot (device tree seems to do everything we need in a
> boot loader), but generating it make sense, and so long as it is
> source code, we can change it, as you say.
>

This sounds a fast way to enable ACPI support. For the first
implementation, I think it's enough. Let's see how it looks like.

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


Re: [U-Boot] [PATCH v3 1/4] dm: introduce dev_get_addr interface

2015-02-06 Thread Simon Glass
Hi Peng,

On 5 February 2015 at 23:44, Peng Fan  wrote:
> Hi, Simon
>
>
> On 1/23/2015 5:25 AM, Simon Glass wrote:
>>
>> Hi,
>>
>> On 21 January 2015 at 04:09, Peng Fan  wrote:
>>>
>>> Abstracting dev_get_addr can improve drivers that want to
>>> get device's address.
>>>
>>> Signed-off-by: Peng Fan 
>>> ---
>>>   drivers/core/device.c | 19 +++
>>>   1 file changed, 19 insertions(+)
>>>
>>> diff --git a/drivers/core/device.c b/drivers/core/device.c
>>> index 963b16f..0ba5c76 100644
>>> --- a/drivers/core/device.c
>>> +++ b/drivers/core/device.c
>>> @@ -12,6 +12,7 @@
>>>   #include 
>>>   #include 
>>>   #include 
>>> +#include 
>>>   #include 
>>>   #include 
>>>   #include 
>>> @@ -390,3 +391,21 @@ ulong dev_get_of_data(struct udevice *dev)
>>>   {
>>>  return dev->of_id->data;
>>>   }
>>> +
>>> +#ifdef CONFIG_OF_CONTROL
>>> +void *dev_get_addr(struct udevice *dev)
>>
>> My approach so far has been to use a ulong for the device address
>> (e.g. in platform data) and only use a pointer when we know the type
>> (e.g. struct disp_ctlr *), typically in driver-private data.
>>
>> So do you think it would be better to return FDT_ADDR_T_NONE?
>
> Sorry for the long time delay to reply.
> Do you agree this way using ulong as the return type?
> "
> #ifdef CONFIG_OF_CONTROL
> unsigned long dev_get_addr(struct udevice *dev)
> {
> fdt_addr_t addr;
> addr = fdtdec_get_addr(gd->fdt_blob, dev->of_offset, "reg");
> return addr;
> }
> #else
> unsigned long dev_get_addr(struct udevice *dev)
> {
> return FDT_ADDR_T_NONE;
> }
> #endif
> "

Sure, but can you return fdt_addr_t?

> Is it better to move this piece of code to include/dm/device.h and using
> static inline prototype? or put them still in driver/core/device.c?

I'd suggest:
- static inline in the header for the case where CONFIG_OF_CONTROL is
not defined
- full implementation in device.c when that is defined

>>>
>>> +{
>>> +   fdt_addr_t addr;
>>> +
>>> +   addr = fdtdec_get_addr(gd->fdt_blob, dev->of_offset, "reg");
>>> +   if (addr == FDT_ADDR_T_NONE)
>>> +   return NULL;
>>> +   else
>>> +   return (void *)addr;
>>> +}
>>> +#else
>>> +void *dev_get_addr(struct udevice *dev)
>>> +{
>>> +   return NULL;
>>> +}
>>> +#endif
>>> --
>>> 1.8.4

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


Re: [U-Boot] [PATCH] ARM: UniPhier: remove dummy gpio.h

2015-02-06 Thread Masahiro YAMADA
2015-02-03 13:51 GMT+09:00 Masahiro Yamada :
> This dummy header was introduced by commit 630bf80ebb34 (ARM:
> UniPhier: add dummy gpio.h to enable CONFIG_OF_CONTROL).
>
> Thanks to commit a08d643dbd85 (dm: Drop gpio.h header from
> fdtdec.c), such an ugly workaround is no longer needed.
>
> Signed-off-by: Masahiro Yamada 


Applied to u-boot-uniphier/master.

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


Re: [U-Boot] [PATCH v2 0/6] ARM: UniPhier: add doc, improve I2C EEPROM access

2015-02-06 Thread Masahiro YAMADA
2015-02-05 14:30 GMT+09:00 Masahiro Yamada :
> Masahiro Yamada (6):
>   ARM: UniPhier: use "&&" instead of ";" in commands
>   ARM: UniPhier: add environment variable to update images in NAND
>   ARM: UniPhier: add a simple README file for UniPhier platform
>   MAINTAINERS: claim maintainership of files with "uniphier" pattern
>   ARM: UniPhier: move EEPROM device node into a separate DTS
>   ARM: UniPhier: set I2C offset length of on-board EEPROM in DTS
>

Series, Applied to u-boot-uniphier/master.

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


Re: [U-Boot] [RFC] m68k: generic board

2015-02-06 Thread Tom Rini
On Mon, Jan 26, 2015 at 09:39:13AM +, Huan Wang wrote:
> Hi, Tom,
> 
> > On Thu, Jan 15, 2015 at 04:08:40PM +0100, Angelo Dureghello wrote:
> > > Dear all,
> > >
> > > i would like to post a patch with the m68k generic board support,
> > > tested and working here, but of course not tested for all the other
> > > m68k boards except mine.
> > >
> > > My coldfire board is the "amcore" board not yet accepted.
> > >
> > > http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/193661
> > > http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/193660
> > >
> > > I need some suggestions on how to proceed now.
> > >
> > > I already modified my board config to work with generic board support.
> > >
> > > So my thought is to post 2 separate patches:
> > > 1
> > > - add generic board (1/1). Each board maintainer should then test it
> > > and report for feedbacks.
> > > 2
> > > Re-post a 2/2 patch (v8) of amcore using generic board:
> > > - amcore board (1),
> > > - mcf5307 support (2),
> > >
> > > This amcore board is the coldfire base i use here for all the general
> > > m68k tests.
> > >
> > > With your help commenting on this patch until it is conformant to the
> > > last recent coding guidelines could help me and Alison to know what
> > > has to be purged / changed, (eventually, if needed) in all other m68k
> > > boards code.
> > >
> > > What do you think ?
> > 
> > Lets go with #2 and we'll purge the rest of the boards that you don't
> > want to convert and compile test after -rc1.  Thanks!
> > 
> [Alison Wang] Do you mean you will purge the rest of the boards if
> they are not converted and tested?
> 
> I have these boards, such as m52277evb, m5253demo, m53017evb,
> m5329evb, m5373evb, m54418twr, m54451evb, m54455evb, m547xevb and
> m548xevb. I think I really need some time to convert and test them.

Please get them converted ASAP and remove the rest of the boards which
you do not plan to support.  Thanks!

-- 
Tom


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


Re: [U-Boot] [PATCH 0/2] ARM: UniPhier: refactor pinmon command

2015-02-06 Thread Masahiro YAMADA
2015-02-05 20:56 GMT+09:00 Masahiro Yamada :
>
>
>
> Masahiro Yamada (2):
>   ARM: UniPhier: refactor pinmon command
>   ARM: UniPhier: leave the last element of boot_device_table empty


Applied to u-boot-uniphier/master.



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


[U-Boot] Pull request: u-boot-uniphier

2015-02-06 Thread Masahiro YAMADA
Hi Tom,


The following changes since commit 7f641d53bbb3a426a3bfb132d8346153e86a9d08:

  Merge branch 'master' of git://git.denx.de/u-boot-ubi (2015-02-04
13:30:00 -0500)

are available in the git repository at:


  git://git.denx.de/u-boot-uniphier.git master

for you to fetch changes up to 4e79908044e4ebf186464cf118497458faf0903c:

  ARM: UniPhier: leave the last element of boot_device_table empty
(2015-02-07 00:15:03 +0900)


Masahiro Yamada (15):
  ARM: UniPhier: remove dummy gpio.h
  ARM: UniPhier: use "&&" instead of "; " in commands
  ARM: UniPhier: add environment variable to update images in NAND
  ARM: UniPhier: add a simple README file for UniPhier platform
  MAINTAINERS: claim maintainership of files with "uniphier" pattern
  ARM: UniPhier: move EEPROM device node into a separate DTS
  ARM: UniPhier: set I2C offset length of on-board EEPROM in DTS
  ARM: UniPhier: move pin_init() to board_early_init_f()
  ARM: UniPhier: move SPL init functions to spl_board_init()
  ARM: UniPhier: revive support card info
  ARM: UniPhier: remove unused checkboard() functions
  ARM: UniPhier: do not compile unnecessary objects
  ARM: UniPhier: enable I2C input pins for PH1-sLD8
  ARM: UniPhier: refactor pinmon command
  ARM: UniPhier: leave the last element of boot_device_table empty

 MAINTAINERS|  2 +-
 arch/arm/cpu/armv7/uniphier/Kconfig
 | 11 +
 arch/arm/cpu/armv7/uniphier/Makefile
 | 27 +++
 arch/arm/cpu/armv7/uniphier/board_early_init_f.c
 | 22 +
 arch/arm/cpu/armv7/uniphier/board_postclk_init.c
 | 47 --
 arch/arm/cpu/armv7/uniphier/cmd_pinmon.c
 | 15 +++---
 arch/arm/cpu/armv7/uniphier/dram_init.c
 | 23 +
 arch/arm/cpu/armv7/uniphier/ph1-ld4/Makefile
 | 14 +++---
 arch/arm/cpu/armv7/uniphier/ph1-pro4/Makefile
 | 13 +++--
 arch/arm/cpu/armv7/uniphier/ph1-pro4/board_info.c
 | 16 ---
 arch/arm/cpu/armv7/uniphier/ph1-pro4/boot-mode.c   |  6 +--
 arch/arm/cpu/armv7/uniphier/ph1-sld8/Makefile
 | 14 +++---
 arch/arm/cpu/armv7/uniphier/ph1-sld8/board_info.c
 | 16 ---
 arch/arm/cpu/armv7/uniphier/ph1-sld8/pinctrl.c
 |  9 
 .../arm/cpu/armv7/uniphier/{ph1-ld4/board_info.c => print_misc_info.c} |  7 +--
 arch/arm/cpu/armv7/uniphier/spl.c
 | 52 ++--
 arch/arm/dts/uniphier-ph1-ld4-ref.dts  |  7 +--
 arch/arm/dts/uniphier-ph1-pro4-ref.dts |  7 +--
 arch/arm/dts/uniphier-ph1-sld3-ref.dts |  7 +--
 arch/arm/dts/uniphier-ph1-sld8-ref.dts |  7 +--
 arch/arm/dts/uniphier-ref-daughter.dtsi
 | 16 +++
 arch/arm/include/asm/arch-uniphier/boot-device.h   |  2 +-
 arch/arm/include/asm/arch-uniphier/gpio.h  |  6 ---
 doc/README.uniphier
 | 85 +
 include/configs/uniphier.h
 | 19 +---
 25 files changed, 256 insertions(+), 194 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/uniphier/board_early_init_f.c
 delete mode 100644 arch/arm/cpu/armv7/uniphier/board_postclk_init.c
 delete mode 100644 arch/arm/cpu/armv7/uniphier/ph1-pro4/board_info.c
 delete mode 100644 arch/arm/cpu/armv7/uniphier/ph1-sld8/board_info.c
 rename arch/arm/cpu/armv7/uniphier/{ph1-ld4/board_info.c =>
print_misc_info.c} (57%)
 create mode 100644 arch/arm/dts/uniphier-ref-daughter.dtsi
 delete mode 100644 arch/arm/include/asm/arch-uniphier/gpio.h
 create mode 100644 doc/README.uniphier


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


Re: [U-Boot] [PATCH 0/7] ARM: UniPhier: code refactoring and I2C pin fix

2015-02-06 Thread Masahiro YAMADA
2015-02-05 14:42 GMT+09:00 Masahiro Yamada :
>
>
>
> Masahiro Yamada (7):
>   ARM: UniPhier: move pin_init() to board_early_init_f()
>   ARM: UniPhier: move SPL init functions to spl_board_init()
>   ARM: UniPhier: revive support card info
>   ARM: UniPhier: remove unused checkboard() functions
>   ARM: UniPhier: do not compile unnecessary objects
>   ARM: UniPhier: consolidate MEMCONF setting code
>   ARM: UniPhier: enable I2C input pins for PH1-sLD8
>

Series, Applied to u-boot-uniphier/master  except 6/7.
(I want to think about 6/7 a little more.)


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


[U-Boot] Please pull u-boot-marvell master

2015-02-06 Thread Luka Perkov
Hi Tom,

this series contains the last bits of pending kirkwood/mvebu patches that I'm
aware of. The changes from Gerald are minimal and I've merged Stefan's series
which have reached v3 on the list.

The following changes since commit 7f641d53bbb3a426a3bfb132d8346153e86a9d08:

  Merge branch 'master' of git://git.denx.de/u-boot-ubi (2015-02-04 13:30:00 
-0500)

are available in the git repository at:

  git://git.denx.de/u-boot-marvell.git 

for you to fetch changes up to 68102b81e8fb699087ec5757a75676c6c65af3fd:

  arm: mvebu: maxbcm: Fix compilation warning and add Spansion SPI NOR support 
(2015-02-06 17:25:08 +0100)


DrEagle (3):
  kirkwood: sheevaplug: fix style
  kirkwood: sheevaplug: fix multiple defines
  kirkwood: sheevaplug: add FDT support

Stefan Roese (11):
  arm: armada-xp: Change built target to include the SPL binary as bin_hdr
  arm: mvebu: Placeholder bin_hdr file can now be removed
  arm: maxbcm: Enable SPL to include DDR training code into U-Boot
  arm: db-mv784mp-gp: Enable SPL to include DDR training code into U-Boot
  Makefile: Add another kwb build target used on Marvell Armada-XP (AXP)
  tools: kwbimage: Support u-boot.img padding to CONFIG_SYS_SPI_U_BOOT_OFFS
  scripts/Makefile.spl: Add MVEBU DDR code to SPL
  arm: armada-xp: Add SPL support used to include the DDR training code
  arm: mvebu: Add Serdes PHY config code
  arm: mvebu: drivers/ddr: Add DDR3 driver with training code from Marvell 
bin_hdr
  arm: mvebu: maxbcm: Fix compilation warning and add Spansion SPI NOR 
support

 Makefile   |6 +
 arch/arm/Kconfig   |2 +
 arch/arm/cpu/armv7/armada-xp/Makefile  |2 +
 arch/arm/cpu/armv7/armada-xp/lowlevel_spl.S|   62 +
 arch/arm/cpu/armv7/armada-xp/spl.c |   38 +
 arch/arm/include/asm/arch-armada-xp/config.h   |4 +
 arch/arm/include/asm/arch-armada-xp/cpu.h  |   16 +
 arch/arm/mvebu-common/Makefile |2 +
 arch/arm/mvebu-common/serdes/Makefile  |6 +
 arch/arm/mvebu-common/serdes/board_env_spec.h  |  262 
 arch/arm/mvebu-common/serdes/high_speed_env_lib.c  | 1572 +++
 arch/arm/mvebu-common/serdes/high_speed_env_spec.c |  185 +++
 arch/arm/mvebu-common/serdes/high_speed_env_spec.h |   87 ++
 arch/arm/mvebu-common/u-boot-spl.lds   |   57 +
 board/Marvell/db-mv784mp-gp/binary.0   |   17 -
 board/Marvell/db-mv784mp-gp/kwbimage.cfg   |2 +-
 board/maxbcm/binary.0  |   17 -
 board/maxbcm/kwbimage.cfg  |2 +-
 board/maxbcm/maxbcm.c  |   85 +-
 configs/db-mv784mp-gp_defconfig|5 +-
 configs/maxbcm_defconfig   |5 +-
 drivers/ddr/mvebu/Makefile |   14 +
 drivers/ddr/mvebu/ddr3_axp.h   |  510 +++
 drivers/ddr/mvebu/ddr3_axp_config.h|  146 ++
 drivers/ddr/mvebu/ddr3_axp_mc_static.h |  284 
 drivers/ddr/mvebu/ddr3_axp_training_static.h   |  770 ++
 drivers/ddr/mvebu/ddr3_axp_vars.h  |  226 +++
 drivers/ddr/mvebu/ddr3_dfs.c   | 1552 +++
 drivers/ddr/mvebu/ddr3_dqs.c   | 1374 +
 drivers/ddr/mvebu/ddr3_hw_training.c   | 1115 ++
 drivers/ddr/mvebu/ddr3_hw_training.h   |  392 +
 drivers/ddr/mvebu/ddr3_init.c  | 1219 +++
 drivers/ddr/mvebu/ddr3_init.h  |  143 ++
 drivers/ddr/mvebu/ddr3_patterns_64bit.h|  924 
 drivers/ddr/mvebu/ddr3_pbs.c   | 1592 
 drivers/ddr/mvebu/ddr3_read_leveling.c | 1214 +++
 drivers/ddr/mvebu/ddr3_sdram.c |  669 
 drivers/ddr/mvebu/ddr3_spd.c   | 1300 
 drivers/ddr/mvebu/ddr3_write_leveling.c| 1366 +
 drivers/ddr/mvebu/xor.c|  436 ++
 drivers/ddr/mvebu/xor.h|   70 +
 drivers/ddr/mvebu/xor_regs.h   |  103 ++
 include/configs/db-mv784mp-gp.h|   49 +
 include/configs/maxbcm.h   |   49 +
 include/configs/sheevaplug.h   |7 +-
 scripts/Makefile.spl   |1 +
 tools/kwbimage.c   |   11 +
 47 files changed, 17925 insertions(+), 45 deletions(-)
 create mode 100644 arch/arm/cpu/armv7/armada-xp/lowlevel_spl.S
 create mode 100644 arch/arm/cpu/armv7/armada-xp/spl.c
 create mode 100644 arch/arm/mvebu-common/serdes/Makefile
 create mode 100644 arch/arm/mvebu-commo

Re: [U-Boot] [PATCH] image: Convert to use fdt_for_each_subnode macro

2015-02-06 Thread Simon Glass
Hi Axel,

On 6 February 2015 at 01:23, Axel Lin  wrote:
> Signed-off-by: Axel Lin 

Please can you add a commit message? The code looks fine.

> ---
>  common/image-fit.c |  4 +---
>  common/image-sig.c | 16 
>  2 files changed, 5 insertions(+), 15 deletions(-)
>
> diff --git a/common/image-fit.c b/common/image-fit.c
> index b47d110..778d2a1 100644
> --- a/common/image-fit.c
> +++ b/common/image-fit.c
> @@ -1010,9 +1010,7 @@ int fit_image_verify(const void *fit, int image_noffset)
> }
>
> /* Process all hash subnodes of the component image node */
> -   for (noffset = fdt_first_subnode(fit, image_noffset);
> -noffset >= 0;
> -noffset = fdt_next_subnode(fit, noffset)) {
> +   fdt_for_each_subnode(fit, noffset, image_noffset) {
> const char *name = fit_get_name(fit, noffset, NULL);
>
> /*
> diff --git a/common/image-sig.c b/common/image-sig.c
> index 2c9f0cd..eda5e13 100644
> --- a/common/image-sig.c
> +++ b/common/image-sig.c
> @@ -212,9 +212,7 @@ static int fit_image_verify_sig(const void *fit, int 
> image_noffset,
> int ret;
>
> /* Process all hash subnodes of the component image node */
> -   for (noffset = fdt_first_subnode(fit, image_noffset);
> -noffset >= 0;
> -noffset = fdt_next_subnode(fit, noffset)) {
> +   fdt_for_each_subnode(fit, noffset, image_noffset) {
> const char *name = fit_get_name(fit, noffset, NULL);
>
> if (!strncmp(name, FIT_SIG_NODENAME,
> @@ -262,9 +260,7 @@ int fit_image_verify_required_sigs(const void *fit, int 
> image_noffset,
> return 0;
> }
>
> -   for (noffset = fdt_first_subnode(sig_blob, sig_node);
> -noffset >= 0;
> -noffset = fdt_next_subnode(sig_blob, noffset)) {
> +   fdt_for_each_subnode(sig_blob, noffset, sig_node) {
> const char *required;
> int ret;
>
> @@ -397,9 +393,7 @@ static int fit_config_verify_sig(const void *fit, int 
> conf_noffset,
> int ret;
>
> /* Process all hash subnodes of the component conf node */
> -   for (noffset = fdt_first_subnode(fit, conf_noffset);
> -noffset >= 0;
> -noffset = fdt_next_subnode(fit, noffset)) {
> +   fdt_for_each_subnode(fit, noffset, conf_noffset) {
> const char *name = fit_get_name(fit, noffset, NULL);
>
> if (!strncmp(name, FIT_SIG_NODENAME,
> @@ -444,9 +438,7 @@ int fit_config_verify_required_sigs(const void *fit, int 
> conf_noffset,
> return 0;
> }
>
> -   for (noffset = fdt_first_subnode(sig_blob, sig_node);
> -noffset >= 0;
> -noffset = fdt_next_subnode(sig_blob, noffset)) {
> +   fdt_for_each_subnode(sig_blob, noffset, sig_node) {
> const char *required;
> int ret;
>
> --
> 1.9.1
>
>
>

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


Re: [U-Boot] netconsole: USB Ethernet connection dropping with ping or tftpboot

2015-02-06 Thread Stephen Warren

On 02/05/2015 06:06 PM, Jörg Krause wrote:

On Do, 2015-02-05 at 15:23 -0700, Stephen Warren wrote:


b) In ci_bounce(), the bounce buffer is only allocated if the
user-buffer is already aligned, and if a large-enough bounce buffer
wasn't previously allocated. If ci_req->b_buf was uninitialized it could
be non-zero (thus preventing the expected aligned allocation) yet not
actually aligned enough.


I can reproduce this issue now. After some "timeout sending packets to
usb ethernet" messages, the bounce buffer somehow gets corrupted.
ci_bounce() is called with an unaligned input buffer length
'req->length=66', but the bounce buffer length
'ci_req->b_len=1140305940' or in hex 'ci_req->b_len=0x43f7b014'. This
bounce buffer length is obviously an address, as the following
misaligned error message shows: "CACHE: Misaligned operation at range
[43f7b010, 43f7b070]".


Ah, I hadn't realized that was [start, length] rather than [start, end].

The question is: How is ci_req->b_len getting corrupted? Is it simply 
never initialized, or does something trash that value later?


ci_ep_alloc_request() appears to calloc() the whole struct ci_req, so I 
imagine an initialization/allocating error isn't happening.


The only issue there might be some code somehow creating its own struct 
usb_request instead of calling into the controller's ->alloc_request() 
function. I vaguely recall fixing some of those, but might have missed 
some in protocols that I didn't test (i.e. anything other than USB Mass 
Storage or DFU, although I might have very briefly tested netconsole once?).


I would suggest adding a whole ton of printfs() to catch where ci_reqs 
are being allocated, and where ci_req->b_len is getting written in which 
ci_req objects, and then mapping that back to the ci_req that the cache 
alignment error message complains about. Sorry, this will be a bit painful.


If the ci_req is always at the same address on different boots of the 
code, that will make it easier, especially if you have a debugger with a 
data watchpoint, or can write some code to use any data watchpoint 
self-hosted debug capability in your CPU.

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


Re: [U-Boot] recent tools on FreeBSD

2015-02-06 Thread Jeroen Hofstee

Hello Simon, +Andreas,

On 06-02-15 04:05, Simon Glass wrote:

Hi Jeroen,

On 5 February 2015 at 12:51, Jeroen Hofstee  wrote:

Hello Guilherme,

Thanks for commenting on this,

On 02/05/15 13:27, Guilherme Maciel Ferreira wrote:

Hi Jeroen,

My apologies, I didn't test the tools on BSD. The answers are inline.

Best regards,
Guilherme

Am 04.02.2015 19:37 schrieb "Jeroen Hofstee":

Hello Guilherme / Simon,

It seems that commit f86ed6a8d52c99bb2d17d3cac1647edca0c4399c,
"tools: moved code common to all image tools to a separated module."

I guess the culprit is commit a93648d197df48fa46dd55f925ff70468bd81c71,
"imagetool: replace image registration function by linker_lists feature".
Because that commit introduced the linker script to imagetools.


Likely, since some patches depend on each other I was unable to revert
a single commit.

Anyway as far as I am concerned there are two separate
build targets, the bare u-boot having an (almost) naked compiler, beside
stdarg and stdbool? without any other host includes or objects (well with
CONFIG_USE_PRIVATE_LIBGCC=y). U-boot provides linker scripts for them,
and we have fine grained control over them and an excuse to throw any
trick at them if it makes things faster / smaller etc. It is still nice if
this
compiles anywhere though..

On the other hand there are "tools" for the host / target userland, which
should build against the host / targets "std*". Those things should be
buildable
on any decent host / target and be straightforward (and _not_ define KERNEL
etc, since it are userland tools). There is no linker for them afaik, so
tweaking
them seems like a bad idea. Hence I am tempted to remove the use of
linker generated lists from tools...


- and really last, how do I test if it works..

There are two scripts to test the image tools, test-imagetools.sh and
test-fit.py. Running those scripts you make sure the linker list is
properly setup, because it is required by the imagetools to find the image
type.

$ make O=sandbox clean
$ make O=sandbox sandbox_config
$ make mrproper
$ make O=sandbox
$ ./test/image/test-imagetools.sh
$ ./test/image/test-fit.py -u sandbox/u-boot

Sandbox used to build on FreeBSD, but it is quite a mess at the moment.
But a I said, I think the best solution for tools is not to use linker
generated
list in the first place for tools.

Sandbox uses driver model so has the same problem. How can we solve this?

Why is the FreeBSD toolchain so different? Does it not have the
concept of link scripts?


First of all, the biggest problem for sandbox at the moment are header 
files.
For a "normal" cross target this works fine since the target uses u-boot 
headers

(linux/*) and the tools the (std*). For sandbox we end up with both of
them included at the same time at the moment, leading to redefinitions
of uint64_t, time_t, ptrdiff_t, fd_set etc. I will have to look in more 
details
if this is fixable. It is a different problem then the link error since 
it already

errors before attempting to link.

Regarding the linking problem, there is nothing special about FreeBSD ld,
it just is based on a version which has no idea what INSERT BEFORE .data
means.

there are several option I guess (not tested):
1) include a complete linker script so INSERT BEFORE .data is not needed
2) teach FreeBSD ld what INSERT BEFORE .data is supposed to mean
3) don't use linker magic in tools (and use a linux box for sandbox, at 
least for now)


1) sounds like a bad idea, the target/host might be any arch e.g.
2) won't magically fix problems as well, even if FreeBSD trunk can be 
teached to understand
this, things will still be broken on releases. And u-boot tools work on 
more host systems,
Andreas, can you check if Darwin is still able to compile tools from 
u-boot master?
3) the option I would be tempted to choose, just don't do linker magic 
for tools. This would
make sure at least mkimage etc can be build everywhere. sandbox won't 
build, but as said
it is already broken because of other issues. (and I doubt there is even 
an single user around

besides me to even try to build sandbox on FreeBSD).

So as far as I am concerned we go for option 3.

Regards,
Jeroen



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


[U-Boot] U-Boot uptime

2015-02-06 Thread Andrew Wozniak
Hi everyone,

It has a quite a while since my last post here. Our new project is running
U-Boot on a custom Beaglebone board. While running several overnight
user-space applications, the board reset and stopped at the U-Boot prompt.
We do not yet have any logging but I could monitor and record the console
output to see when this reset happened.

A simpler approach could employ an "uptime" clock at the U-Boot level. Does
U-Boot have such a timer?

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


[U-Boot] U-Boot with PXE

2015-02-06 Thread Islam Mukambetov
If there is any u-boot for parallella, with PXE booting?
If you have, please, can you send me a link, where i can find sources or
u-boot image, and flash it to parallella.



-- 
__
Ислам Мукамбетов
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 11/22] x86: Move common FSP code into a common location

2015-02-06 Thread Simon Glass
On 28 January 2015 at 16:44, Simon Glass  wrote:
> On 27 January 2015 at 21:13, Simon Glass  wrote:
>> Signed-off-by: Simon Glass 
>> Reviewed-by: Bin Meng 
>> Tested-by: Bin Meng 
>> ---
>>
>> Changes in v2: None
>
> Applied to u-boot-x86.

I had to change the Makefile slightly to only include this when
CONFIG_X86 is defined.

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


Re: [U-Boot] [RFC PATCH v3 1/7] x86: Add header files for Intel Quark SoC defines

2015-02-06 Thread Simon Glass
On 4 February 2015 at 08:07, Simon Glass  wrote:
> On 2 February 2015 at 07:35, Bin Meng  wrote:
>> device.h for integrated pci devices' bdf on Quark SoC and quark.h for
>> various memory-mapped and i/o-mapped base addresses within SoC.
>>
>> Signed-off-by: Bin Meng 
>>
>> ---
>>
>> Changes in v3:
>> - Add several macros for message bus port and registers
>>
>> Changes in v2:
>> - Move vairous components' base addresses within Quark SoC to Kconfig
>>
>>  arch/x86/include/asm/arch-quark/device.h | 28 ++
>>  arch/x86/include/asm/arch-quark/quark.h  | 40 
>> 
>>  2 files changed, 68 insertions(+)
>>  create mode 100644 arch/x86/include/asm/arch-quark/device.h
>>  create mode 100644 arch/x86/include/asm/arch-quark/quark.h
>
> Acked-by: Simon Glass 

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC PATCH v3 4/7] x86: quark: Add Cache-As-RAM initialization

2015-02-06 Thread Simon Glass
On 4 February 2015 at 08:07, Simon Glass  wrote:
> On 2 February 2015 at 07:35, Bin Meng  wrote:
>> Quark SoC contains an embedded 512KiB SRAM (eSRAM) that is
>> initialized by hardware. eSRAM is the ideal place to be used
>> for Cache-As-RAM (CAR) before system memory is available.
>>
>> Signed-off-by: Bin Meng 
>>
>> ---
>>
>> Changes in v3:
>> - Use macros from  and 
>>
>> Changes in v2:
>> - Replace upper case register names (EAX etc.) with lower case
>> - Use some macros from  and 
>>
>>  arch/x86/cpu/quark/car.S | 105 
>> +++
>>  1 file changed, 105 insertions(+)
>>  create mode 100644 arch/x86/cpu/quark/car.S
>
> Acked-by: Simon Glass 

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC PATCH v3 5/7] x86: Add basic Intel Quark processor support

2015-02-06 Thread Simon Glass
On 4 February 2015 at 08:07, Simon Glass  wrote:
> On 2 February 2015 at 07:35, Bin Meng  wrote:
>> Add minimum codes to support Intel Quark SoC. DRAM initialization
>> is not ready yet so a hardcoded gd->ram_size is assigned.
>>
>> Signed-off-by: Bin Meng 
>>
>> ---
>>
>> Changes in v3:
>> - Add simple help for ACPI PM1, PBLK and GEP0
>>
>> Changes in v2:
>> - Use machine-specific
>> - Move vairous components' base addresses within Quark SoC to Kconfig
>> - Rebase to u-boot-86/master
>>
>>  arch/x86/cpu/quark/Kconfig | 121 
>> +
>>  arch/x86/cpu/quark/Makefile|   8 +++
>>  arch/x86/cpu/quark/dram.c  |  39 +++
>>  arch/x86/cpu/quark/pci.c   |  70 +++
>>  arch/x86/cpu/quark/quark.c |  44 
>>  arch/x86/include/asm/arch-quark/gpio.h |  13 
>>  6 files changed, 295 insertions(+)
>>  create mode 100644 arch/x86/cpu/quark/Kconfig
>>  create mode 100644 arch/x86/cpu/quark/Makefile
>>  create mode 100644 arch/x86/cpu/quark/dram.c
>>  create mode 100644 arch/x86/cpu/quark/pci.c
>>  create mode 100644 arch/x86/cpu/quark/quark.c
>>  create mode 100644 arch/x86/include/asm/arch-quark/gpio.h
>
> Acked-by: Simon Glass 

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC PATCH v3 3/7] x86: Define macros for pci configuration space access

2015-02-06 Thread Simon Glass
On 4 February 2015 at 08:07, Simon Glass  wrote:
> On 2 February 2015 at 07:35, Bin Meng  wrote:
>> Move PCI_REG_ADDR and PCI_REG_DATA from arch/x86/lib/pci_type1.c to
>> arch/x86/include/asm/pci.h, also define PCI_CFG_EN so that these
>> macros can be used for pci configuration space access.
>>
>> Signed-off-by: Bin Meng 
>>
>> ---
>>
>> Changes in v3:
>> - New patch to define macros for pci configuration space access
>>
>> Changes in v2: None
>>
>>  arch/x86/include/asm/pci.h | 13 +++--
>>  arch/x86/lib/pci_type1.c   |  7 ++-
>>  2 files changed, 13 insertions(+), 7 deletions(-)
>
> Acked-by: Simon Glass 

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC PATCH v3 2/7] x86: quark: Add routines to access message bus registers

2015-02-06 Thread Simon Glass
On 2 February 2015 at 07:35, Bin Meng  wrote:
> In the Quark SoC, some chipset commands are accomplished by utilizing
> the internal message network within the host bridge (D0:F0). Accesses
> to this network are accomplished by populating the message control
> register (MCR), Message Control Register eXtension (MCRX) and the
> message data register (MDR).
>
> Signed-off-by: Bin Meng 
> Acked-by: Simon Glass 

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC PATCH v2 1/9] x86: Allow overriding TSC_FREQ_IN_MHZ

2015-02-06 Thread Simon Glass
On 5 February 2015 at 08:42, Bin Meng  wrote:
> We should allow the value of TSC_FREQ_IN_MHZ to be overridden by
> the one in arch/cpu//Kconfig.
>
> Signed-off-by: Bin Meng 
> Acked-by: Simon Glass 

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC PATCH v3 6/7] x86: Add basic Intel Galileo board support

2015-02-06 Thread Simon Glass
On 2 February 2015 at 07:35, Bin Meng  wrote:
> New board/intel/galileo board directory with minimum codes, plus
> board dts, defconfig and configuration files.
>
> Signed-off-by: Bin Meng 
> Reviewed-by: Simon Glass 
> Acked-by: Simon Glass 

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC PATCH v2 2/9] x86: quark: Bypass TSC calibration

2015-02-06 Thread Simon Glass
On 5 February 2015 at 08:42, Bin Meng  wrote:
> For some unknown reason, the TSC calibration via PIT does not work on
> Quark. Enable bypassing TSC calibration and override TSC_FREQ_IN_MHZ
> to 400 per Quark datasheet in the Kconfig.
>
> Signed-off-by: Bin Meng 
> Acked-by: Simon Glass 

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC PATCH v3 7/7] x86: Enable the Intel quark/galileo build

2015-02-06 Thread Simon Glass
On 2 February 2015 at 07:35, Bin Meng  wrote:
> Make the Intel quark/galileo support avaiable in Kconfig and Makefile.
> With this patch, we can generate u-boot.rom for Intel galileo board.
>
> Signed-off-by: Bin Meng 
> Reviewed-by: Simon Glass 
> Acked-by: Simon Glass 

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC PATCH v2 3/9] x86: quark: Add Memory Reference Code (MRC) main routines

2015-02-06 Thread Simon Glass
On 5 February 2015 at 17:51, Simon Glass  wrote:
> On 5 February 2015 at 08:42, Bin Meng  wrote:
>> Add the main routines for Quark Memory Reference Code (MRC).
>>
>> Signed-off-by: Bin Meng 
>>
>> ---
>> The are 24 checkpatch warnings in this patch, which is:
>>
>> warning: arch/x86/cpu/quark/mrc.c,43: line over 80 characters
>> ...
>>
>> I intentionally leave it as is now, as fixing these warnings
>> make the mrc initialization table a little bit harder to read.
>>
>> Changes in v2:
>> - Fixed issues per review comments. See the following link for details.
>>   http://lists.denx.de/pipermail/u-boot/2015-February/204023.html
>>
>>  arch/x86/cpu/quark/mrc.c  | 204 
>> ++
>>  arch/x86/include/asm/arch-quark/mrc.h | 187 +++
>>  2 files changed, 391 insertions(+)
>>  create mode 100644 arch/x86/cpu/quark/mrc.c
>>  create mode 100644 arch/x86/include/asm/arch-quark/mrc.h
>
> Acked-by: Simon Glass 

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC PATCH v2 4/9] x86: quark: Add utility codes needed for MRC

2015-02-06 Thread Simon Glass
On 5 February 2015 at 17:51, Simon Glass  wrote:
> Hi Bin,
>
> On 5 February 2015 at 08:42, Bin Meng  wrote:
>> Add various utility codes needed for Quark MRC.
>>
>> Signed-off-by: Bin Meng 
>>
>> ---
>> There are 12 checkpatch warnings in this patch, which are:
>>
>> warning: arch/x86/cpu/quark/mrc_util.c,1446: Too many leading tabs - 
>> consider code refactoring
>> warning: arch/x86/cpu/quark/mrc_util.c,1450: line over 80 characters
>> ...
>>
>> Fixing 'Too many leading tabs ...' will be very dangerous, as I don't have
>> all the details on how Intel's MRC codes are actually written to play with
>> the hardware. Trying to refactor them may lead to a non-working MRC codes.
>> For the 'line over 80 characters' issue, we have to leave them as is now
>> due to the 'Too many leading tabs ...', sigh.
>>
>> Changes in v2:
>> - Fixed issues per review comments. See the following link for details.
>>   http://lists.denx.de/pipermail/u-boot/2015-February/204044.html
>>
>>  arch/x86/cpu/quark/hte.c  |  396 +++
>>  arch/x86/cpu/quark/hte.h  |   44 ++
>>  arch/x86/cpu/quark/mrc_util.c | 1475 
>> +
>>  arch/x86/cpu/quark/mrc_util.h |  153 +
>>  4 files changed, 2068 insertions(+)
>>  create mode 100644 arch/x86/cpu/quark/hte.c
>>  create mode 100644 arch/x86/cpu/quark/hte.h
>>  create mode 100644 arch/x86/cpu/quark/mrc_util.c
>>  create mode 100644 arch/x86/cpu/quark/mrc_util.h
>
> We should revisit this with a follow-on patch to tidy this up before
> the release. I don't believe it will create correctness problems to
> split the code but that needs to be tested. Let's get this in for now
> as a stake in the ground.
>
> Acked-by: Simon Glass 

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC PATCH v2 7/9] fdtdec: Add compatible id and string for Intel Quark MRC

2015-02-06 Thread Simon Glass
On 5 February 2015 at 08:42, Bin Meng  wrote:
> Add COMPAT_INTEL_QRK_MRC and "intel,quark-mrc" so that fdtdec can
> decode Intel Quark MRC node.
>
> Signed-off-by: Bin Meng 
> Acked-by: Simon Glass 

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC PATCH v2 5/9] x86: quark: Add System Memory Controller support

2015-02-06 Thread Simon Glass
On 5 February 2015 at 17:52, Simon Glass  wrote:
> On 5 February 2015 at 08:42, Bin Meng  wrote:
>> The codes are actually doing the memory initialization stuff.
>>
>> Signed-off-by: Bin Meng 
>>
>> ---
>> The most ugly codes I've ever seen ...
>> There are 252 warnings and 127 checks in this patch, which are:
>>
>> check: arch/x86/cpu/quark/smc.c,1609: Alignment should match open parenthesis
>> warning: arch/x86/cpu/quark/smc.c,1610: line over 80 characters
>> warning: arch/x86/cpu/quark/smc.c,1633: Too many leading tabs - consider 
>> code refactoring
>> ...
>>
>> Fixing 'Too many leading tabs ...' will be very dangerous, as I don't have
>> all the details on how Intel's MRC codes are actually written to play with
>> the hardware. Trying to refactor them may lead to a non-working MRC codes.
>> For the 'line over 80 characters' issue, we have to leave them as is now
>> due to the 'Too many leading tabs ...'. If I am trying to fix the 'Alignment
>> should match open parenthesis' issue, I may end up adding more 'line over 80
>> characters' issues, so we have to bear with it. Sigh.
>>
>> Changes in v2:
>> - Write out the values instead of BIT in smc.h
>> - Removing the ending / in the file header comment block
>>
>>  arch/x86/cpu/quark/smc.c | 2764 
>> ++
>>  arch/x86/cpu/quark/smc.h |  446 
>>  2 files changed, 3210 insertions(+)
>>  create mode 100644 arch/x86/cpu/quark/smc.c
>>  create mode 100644 arch/x86/cpu/quark/smc.h
>
> As with the other patch we should be able to tidy this up a little
> more before the release (splitting code, reducing use of BIT). But
> this is a good starting point.
>
> Acked-by: Simon Glass 

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC PATCH 6/9] x86: quark: Enable the Memory Reference Code build

2015-02-06 Thread Simon Glass
[snip]
> I'm happy enough with this.
>
> Acked-by: Simon Glass 

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/6] x86: quark: Initialize non-standard BARs

2015-02-06 Thread Simon Glass
On 4 February 2015 at 20:26, Simon Glass  wrote:
> On 4 February 2015 at 01:26, Bin Meng  wrote:
>> Quark SoC has some non-standard BARs (excluding PCI standard BARs)
>> which need be initialized with suggested values. This includes GPIO,
>> WDT, RCBA, PCIe ECAM and some ACPI register block base addresses.
>>
>> Signed-off-by: Bin Meng 
>> ---
>>
>>  arch/x86/cpu/quark/quark.c  | 46 
>> +
>>  arch/x86/include/asm/arch-quark/quark.h | 32 +++
>>  2 files changed, 78 insertions(+)
>>
>
> Acked-by: Simon Glass 

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 3/6] x86: pci: Add pci ids for Quark SoC

2015-02-06 Thread Simon Glass
On 4 February 2015 at 20:26, Simon Glass  wrote:
> On 4 February 2015 at 01:26, Bin Meng  wrote:
>> Add pci ids for Intel Quark SoC.
>>
>> Signed-off-by: Bin Meng 
>> ---
>>
>>  include/pci_ids.h | 4 
>>  1 file changed, 4 insertions(+)
>
> Acked-by: Simon Glass 

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 5/6] x86: Add SD/MMC support to quark/galileo

2015-02-06 Thread Simon Glass
On 4 February 2015 at 20:26, Simon Glass  wrote:
> On 4 February 2015 at 01:26, Bin Meng  wrote:
>> Intel Galileo board has a microSD slot which is routed from Quark SoC
>> SDIO controller. Enable SD/MMC support so that we can use an SD card.
>>
>> Signed-off-by: Bin Meng 
>> ---
>>
>>  arch/x86/cpu/quark/quark.c | 11 +++
>>  include/configs/galileo.h  |  7 +++
>>  2 files changed, 18 insertions(+)
>
> Acked-by: Simon Glass 

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC PATCH v2 8/9] dt-bindings: Add Intel Quark MRC bindings

2015-02-06 Thread Simon Glass
On 5 February 2015 at 08:42, Bin Meng  wrote:
> Add standard dt-bindings macros to be used by Intel Quark MRC node.
>
> Signed-off-by: Bin Meng 
> Acked-by: Simon Glass 

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/6] x86: galileo: Add GPIO support

2015-02-06 Thread Simon Glass
On 4 February 2015 at 20:26, Simon Glass  wrote:
> On 4 February 2015 at 01:26, Bin Meng  wrote:
>> Quark SoC has a legacy GPIO block in the legacy bridge (D0:F31),
>> which is just the same one found in other x86 chipset. Since we
>> programmed the GPIO register block base address, we should be
>> able to enable the GPIO support on Intel Galileo board.
>>
>> Signed-off-by: Bin Meng 
>> ---
>>
>>  arch/x86/dts/galileo.dts | 14 ++
>>  1 file changed, 14 insertions(+)
>
> Acked-by: Simon Glass 

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC PATCH v2 9/9] x86: quark: Call MRC in dram_init()

2015-02-06 Thread Simon Glass
On 5 February 2015 at 22:23, Simon Glass  wrote:
> On 5 February 2015 at 08:42, Bin Meng  wrote:
>> Now that we have added Quark MRC codes, call MRC in dram_init() so
>> that DRAM can be initialized on a Quark based board.
>>
>> Signed-off-by: Bin Meng 
>>
>> ---
>>
>> Changes in v2:
>> - Update comment for calling mrc_init()
>> - Check return status of mrc_init()
>>
>>  arch/x86/cpu/quark/dram.c | 99 
>> ++-
>>  arch/x86/dts/galileo.dts  | 25 
>>  2 files changed, 122 insertions(+), 2 deletions(-)
>
> Acked-by: Simon Glass 

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 4/6] x86: Add SPI support to quark/galileo

2015-02-06 Thread Simon Glass
On 4 February 2015 at 20:26, Simon Glass  wrote:
> On 4 February 2015 at 01:26, Bin Meng  wrote:
>> The Quark SoC contains a legacy SPI controller in the legacy bridge
>> which is ICH7 compatible. Like Tunnel Creek and BayTrail, the BIOS
>> control register offset in the ICH SPI driver is wrong for the Quark
>> SoC too, unprotect_spi_flash() is added to enable the flash write.
>>
>> Signed-off-by: Bin Meng 
>> ---
>>
>>  arch/x86/cpu/quark/quark.c | 17 +
>>  arch/x86/dts/galileo.dts   | 13 +
>>  drivers/spi/ich.c  |  3 ++-
>>  3 files changed, 32 insertions(+), 1 deletion(-)
>
> Acked-by: Simon Glass 

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 6/6] x86: Add Intel Galileo instructions in README.x86

2015-02-06 Thread Simon Glass
On 4 February 2015 at 20:26, Simon Glass  wrote:
> On 4 February 2015 at 01:26, Bin Meng  wrote:
>> Add some instructions about building U-Boot for Intel Galileo board.
>>
>> Signed-off-by: Bin Meng 
>>
>> ---
>>
>>  doc/README.x86 | 24 
>>  1 file changed, 20 insertions(+), 4 deletions(-)
>
> Acked-by: Simon Glass 

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/2] bootstage: Fix typos in the comment

2015-02-06 Thread Simon Glass
On 2 February 2015 at 09:19, Simon Glass  wrote:
> On 2 February 2015 at 06:25, Bin Meng  wrote:
>> There are two typos in the comment block in bootstage.h, fix them.
>>
>> Signed-off-by: Bin Meng 
>> ---
>>
>>  include/bootstage.h | 4 ++--
>>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> Acked-by: Simon Glass 

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/2] x86: Use tab instead of space to indent in PCIE_ECAM_BASE

2015-02-06 Thread Simon Glass
On 2 February 2015 at 16:58, Simon Glass  wrote:
> On 2 February 2015 at 06:29, Bin Meng  wrote:
>> Hi Simon,
>>
>> On Mon, Feb 2, 2015 at 9:25 PM, Bin Meng  wrote:
>>> Space is used before 'default' in PCIE_ECAM_BASE in arch/x86/Kconfig
>>> so it looks misaligned. Replace the space with tab to indent.
>>>
>>> Signed-off-by: Bin Meng 
>>> ---
>>>
>>>  arch/x86/Kconfig | 2 +-
>>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>>
>>> diff --git a/arch/x86/Kconfig b/arch/x86/Kconfig
>>> index 2370c32..fef11f3 100644
>>> --- a/arch/x86/Kconfig
>>> +++ b/arch/x86/Kconfig
>>> @@ -428,7 +428,7 @@ source "board/intel/galileo/Kconfig"
>>
>> Ah, looks this patch depends on
>> http://patchwork.ozlabs.org/patch/434403/. Let me know if you need me
>> respin, or just have this patch applied after that one.
>>
>
> It's fine.
>
> Acked-by: Simon Glass 

Applied to u-boot-x86, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] imx: save reset cause in 'reset_cause' environment variable

2015-02-06 Thread Eric Nelson
Hi all,

On 02/05/2015 03:57 PM, Eric Nelson wrote:
> The cause of a reset is generally useful, and shouldn't be
> blindly cleared in the process of displaying it as a part
> of the boot announcement.
> 
> Stash the string representation in the environment variable
> "reset_cause".
> 
>
> 
> 
> Signed-off-by: Eric Nelson 
> ---
>  arch/arm/imx-common/cpu.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/arch/arm/imx-common/cpu.c b/arch/arm/imx-common/cpu.c
> index 28ccd29..31d6e61 100644
> --- a/arch/arm/imx-common/cpu.c
> +++ b/arch/arm/imx-common/cpu.c
> @@ -32,6 +32,8 @@ char *get_reset_cause(void)
>   cause = readl(&src_regs->srsr);
>   writel(cause, &src_regs->srsr);
>  
> + setenv_hex("reset_cause", cause);
> +

Nak.

This routine is called before the environment is initialized.

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


Re: [U-Boot] [PATCH] imx: save reset cause in 'reset_cause' environment variable

2015-02-06 Thread Eric Nelson
Hi all,

On 02/05/2015 03:58 PM, Eric Nelson wrote:
> The cause of a reset is generally useful, and shouldn't be
> blindly cleared in the process of displaying it as a part
> of the boot announcement.
> 
> 
> 
> diff --git a/arch/arm/imx-common/cpu.c b/arch/arm/imx-common/cpu.c
> index 28ccd29..4a54051 100644
> --- a/arch/arm/imx-common/cpu.c
> +++ b/arch/arm/imx-common/cpu.c
> @@ -28,6 +28,7 @@ char *get_reset_cause(void)
>  {
>   u32 cause;
>   struct src *src_regs = (struct src *)SRC_BASE_ADDR;
> + char *rval = "unknown";
>  
>   cause = readl(&src_regs->srsr);
> 
>
>   }
> + setenv("reset_cause", rval);
> + return rval;

Nak.

This routine is called before the environment is initialized.

There's no way to set the environment here, which I think
means that this patch is a pre-cursor to anything else.

http://patchwork.ozlabs.org/patch/436492/

If we feel the need to reset it before an O/S boots, there is a common
spot here:

http://git.denx.de/?p=u-boot.git;a=blob;f=arch/arm/imx-common/cpu.c;h=28ccd29594ed77976f45837039e40618e527a94f;hb=HEAD#l205

That won't be invoked if the O/S is started with "go" though
(often done with QNX or Windows).

Regards,


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


Re: [U-Boot] recent tools on FreeBSD

2015-02-06 Thread Andreas Bießmann
Hi,

On 06.02.15 20:56, Jeroen Hofstee wrote:
> Hello Simon, +Andreas,
> 
> On 06-02-15 04:05, Simon Glass wrote:
>> Hi Jeroen,
>>
>> On 5 February 2015 at 12:51, Jeroen Hofstee  wrote:
>>> Hello Guilherme,
>>>
>>> Thanks for commenting on this,
>>>
>>> On 02/05/15 13:27, Guilherme Maciel Ferreira wrote:
 Hi Jeroen,

 My apologies, I didn't test the tools on BSD. The answers are inline.

 Best regards,
 Guilherme

 Am 04.02.2015 19:37 schrieb "Jeroen Hofstee":

> Regarding the linking problem, there is nothing special about FreeBSD ld,
> it just is based on a version which has no idea what INSERT BEFORE .data
> means.
> 
> there are several option I guess (not tested):
> 1) include a complete linker script so INSERT BEFORE .data is not needed
> 2) teach FreeBSD ld what INSERT BEFORE .data is supposed to mean
> 3) don't use linker magic in tools (and use a linux box for sandbox, at
> least for now)
> 
> 1) sounds like a bad idea, the target/host might be any arch e.g.
> 2) won't magically fix problems as well, even if FreeBSD trunk can be
> teached to understand
> this, things will still be broken on releases. And u-boot tools work on
> more host systems,
> Andreas, can you check if Darwin is still able to compile tools from
> u-boot master?

unfortunately it does not.

---8<---
andreas@imac % git describe
v2015.04-rc1-4-g7f641d5
andreas@imac %
PATH=/Volumes/crosstool-ng/arm-unknown-linux-uclibcgnueabi/bin:$PATH
make CROSS_COMPILE=arm-unknown-linux-uclibcgnueabi- V=1
...
   gcc  -T ./tools/imagetool.lds -o tools/envcrc tools/envcrc.o
tools/lib/crc32.o tools/common/env_embedded.o tools/lib/sha1.o
ld: unknown option: -T
collect2: error: ld returned 1 exit status
make[1]: *** [tools/envcrc] Error 1
make: *** [tools] Error 2
andreas@imac % gcc --version
gcc (MacPorts gcc49 4.9.2_1) 4.9.2
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
--->8---

> 3) the option I would be tempted to choose, just don't do linker magic
> for tools. This would
> make sure at least mkimage etc can be build everywhere. sandbox won't
> build, but as said
> it is already broken because of other issues. (and I doubt there is even
> an single user around
> besides me to even try to build sandbox on FreeBSD).
> 
> So as far as I am concerned we go for option 3.

+1

Dynamic list-sections is in general a good thing. But beside the linker
problem here we will get another problem on darwin hosts when we want to
read the sections. I added a patch to linux kernel to get around [1].

So I have another option here:

4) setup the lists sections in code, add the magic handling for Mach-O
binaries and remove the linker foo.

Best regards

Andreas Bießmann

[1]
https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/commit/?id=dd2a3acaecd7abb2d43b09a823cf2e4c967fa2ac
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 08/12] i2c: s3c24x0: reduce transmission status timeout

2015-02-06 Thread Simon Glass
Hi,

On 27 January 2015 at 08:44, Przemyslaw Marczak  wrote:
> Hello,
>
> On 01/27/2015 04:38 PM, Simon Glass wrote:
>>
>> Hi,
>>
>> On 27 January 2015 at 05:36, Przemyslaw Marczak 
>> wrote:
>>>
>>> If no device is connected to I2C bus, the i2c probe command
>>> can take a lot of time for probe each address. This commit
>>> reduces the busy timeout to 10ms for standard and high speed
>>> modes. This doesn't break the transmission an also allow for
>>> properly probe the devices.
>>>
>>> Signed-off-by: Przemyslaw Marczak 
>>
>>
>> Tested-by: Simon Glass 
>>
>> This patch looks OK but I'd like to get other comments if possible.
>>
> [cut]
>
> Ok, that's fine. I tested this on Trats2 and Odroid XU3 and it works fine.

Well, as this patch has not attracted any comments, and seems to work
for me, I'll pick it up.

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


Re: [U-Boot] [PATCH] imx: save reset cause in 'reset_cause' environment variable

2015-02-06 Thread Bill Pringlemeir

> On 02/05/2015 03:58 PM, Eric Nelson wrote:
>> The cause of a reset is generally useful, and shouldn't be
>> blindly cleared in the process of displaying it as a part
>> of the boot announcement.
>>
>> 
>>
>> diff --git a/arch/arm/imx-common/cpu.c b/arch/arm/imx-common/cpu.c
>> index 28ccd29..4a54051 100644
>> --- a/arch/arm/imx-common/cpu.c
>> +++ b/arch/arm/imx-common/cpu.c
>> @@ -28,6 +28,7 @@ char *get_reset_cause(void)
>> {
>>  u32 cause;
>>  struct src *src_regs = (struct src *)SRC_BASE_ADDR;
>> +char *rval = "unknown";
>>
>>  cause = readl(&src_regs->srsr);
>> 
>>
>>  }
>> +setenv("reset_cause", rval);
>> +return rval;

On  6 Feb 2015, eric.nel...@boundarydevices.com wrote:

> Nak.

> This routine is called before the environment is initialized.

Okay, that makes sense we can't do this.

> There's no way to set the environment here, which I think
> means that this patch is a pre-cursor to anything else.

>   http://patchwork.ozlabs.org/patch/436492/

> If we feel the need to reset it before an O/S boots, there is a common
> spot here:
> http://git.denx.de/?p=u-boot.git;a=blob;f=arch/arm/imx-common/cpu.c;hb=HEAD#l205

> That won't be invoked if the O/S is started with "go" though
> (often done with QNX or Windows).

The 'write' is to prevent against multiple bits set.  Say for instance
you remove this check.  Someone has U-boot siting at a command line for
a long time before they boot an OS.  Occasionally, some memory/hardware
error happens and the device resets.  In this case, the reason will be
from multiple resets.

I think it is good to write/clear (and record) the reason early.  So, I
think just having 'cause' as a global or accessible when the environment
is ready would solve your problem.

Writing does two things,

 1. clears the 'reset cause' to prevent someone else to look at.
 2. primes the 'cause' for the next reset; the bits are sticky. w1c

I think we miss the last point with this patch.  The 'cause' just needs to
be recorded and kept around until the environment is up (or however we
want to pass it around).  

Recording it early and clearing is best as you can know what the 'last
cause' was.  Otherwise, you might get multiple causes in the register.

Err, maybe I mis-understand something?  If you do this patch and have
multiple soft resets (watchdog, CSU, JTAG, ipp, warm, etc) are the bits
accumulated?

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


Re: [U-Boot] recent tools on FreeBSD

2015-02-06 Thread Simon Glass
Hi,

On 6 February 2015 at 13:40, Andreas Bießmann
 wrote:
> Hi,
>
> On 06.02.15 20:56, Jeroen Hofstee wrote:
>> Hello Simon, +Andreas,
>>
>> On 06-02-15 04:05, Simon Glass wrote:
>>> Hi Jeroen,
>>>
>>> On 5 February 2015 at 12:51, Jeroen Hofstee  wrote:
 Hello Guilherme,

 Thanks for commenting on this,

 On 02/05/15 13:27, Guilherme Maciel Ferreira wrote:
> Hi Jeroen,
>
> My apologies, I didn't test the tools on BSD. The answers are inline.
>
> Best regards,
> Guilherme
>
> Am 04.02.2015 19:37 schrieb "Jeroen Hofstee":
>
>> Regarding the linking problem, there is nothing special about FreeBSD ld,
>> it just is based on a version which has no idea what INSERT BEFORE .data
>> means.
>>
>> there are several option I guess (not tested):
>> 1) include a complete linker script so INSERT BEFORE .data is not needed
>> 2) teach FreeBSD ld what INSERT BEFORE .data is supposed to mean
>> 3) don't use linker magic in tools (and use a linux box for sandbox, at
>> least for now)
>>
>> 1) sounds like a bad idea, the target/host might be any arch e.g.
>> 2) won't magically fix problems as well, even if FreeBSD trunk can be
>> teached to understand
>> this, things will still be broken on releases. And u-boot tools work on
>> more host systems,
>> Andreas, can you check if Darwin is still able to compile tools from
>> u-boot master?
>
> unfortunately it does not.
>
> ---8<---
> andreas@imac % git describe
> v2015.04-rc1-4-g7f641d5
> andreas@imac %
> PATH=/Volumes/crosstool-ng/arm-unknown-linux-uclibcgnueabi/bin:$PATH
> make CROSS_COMPILE=arm-unknown-linux-uclibcgnueabi- V=1
> ...
>gcc  -T ./tools/imagetool.lds -o tools/envcrc tools/envcrc.o
> tools/lib/crc32.o tools/common/env_embedded.o tools/lib/sha1.o
> ld: unknown option: -T
> collect2: error: ld returned 1 exit status
> make[1]: *** [tools/envcrc] Error 1
> make: *** [tools] Error 2
> andreas@imac % gcc --version
> gcc (MacPorts gcc49 4.9.2_1) 4.9.2
> Copyright (C) 2014 Free Software Foundation, Inc.
> This is free software; see the source for copying conditions.  There is NO
> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
> --->8---
>
>> 3) the option I would be tempted to choose, just don't do linker magic
>> for tools. This would
>> make sure at least mkimage etc can be build everywhere. sandbox won't
>> build, but as said
>> it is already broken because of other issues. (and I doubt there is even
>> an single user around
>> besides me to even try to build sandbox on FreeBSD).
>>
>> So as far as I am concerned we go for option 3.
>
> +1
>
> Dynamic list-sections is in general a good thing. But beside the linker
> problem here we will get another problem on darwin hosts when we want to
> read the sections. I added a patch to linux kernel to get around [1].
>
> So I have another option here:
>
> 4) setup the lists sections in code, add the magic handling for Mach-O
> binaries and remove the linker foo.

The lower-common-denominator approach is a bit frustrating. How does
FreeBSD compile U-Boot? What are you actually using that system for if
it cannot build U-Boot?

Re 1) I found an open in ld to produce the standard link script. I
actually used that before I found INSERT BEFORE.

Before giving up I think it would be worth exploring 1). It should
then be possible to make sandbox work also.

Finally, please point me to how I can install FreeBSD in viritualbox
or similar. I'm interested in that...

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


[U-Boot] [PATCH] sandbox: Return '-c command' exit value as sandbox exit code

2015-02-06 Thread Joe Hershberger
When a command is passed into sandbox using the '-c' argument the
command is run directly. This is most helpful when running tests (such
as test-dm.sh). Previously the exit code was an unused enum. Change it
to be the actual return code from the command so that the script calling
sandbox can know if the command succeeded (tests passed).  Also remove
the now completely unused "exit_state" in sandbox.

Signed-off-by: Joe Hershberger 

---

 arch/sandbox/cpu/start.c |  6 --
 arch/sandbox/cpu/state.c |  5 -
 arch/sandbox/include/asm/state.h | 15 ---
 3 files changed, 4 insertions(+), 22 deletions(-)

diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c
index 097f29a..ec01040 100644
--- a/arch/sandbox/cpu/start.c
+++ b/arch/sandbox/cpu/start.c
@@ -78,11 +78,13 @@ int sandbox_main_loop_init(void)
 
/* Execute command if required */
if (state->cmd) {
+   int retval;
+
cli_init();
 
-   run_command_list(state->cmd, -1, 0);
+   retval = run_command_list(state->cmd, -1, 0);
if (!state->interactive)
-   os_exit(state->exit_type);
+   os_exit(retval);
}
 
return 0;
diff --git a/arch/sandbox/cpu/state.c b/arch/sandbox/cpu/state.c
index ba73b7e..033958c 100644
--- a/arch/sandbox/cpu/state.c
+++ b/arch/sandbox/cpu/state.c
@@ -13,11 +13,6 @@
 static struct sandbox_state main_state;
 static struct sandbox_state *state;/* Pointer to current state record */
 
-void state_record_exit(enum exit_type_id exit_type)
-{
-   state->exit_type = exit_type;
-}
-
 static int state_ensure_space(int extra_size)
 {
void *blob = state->state_fdt;
diff --git a/arch/sandbox/include/asm/state.h b/arch/sandbox/include/asm/state.h
index 32d55cc..a0c24ba 100644
--- a/arch/sandbox/include/asm/state.h
+++ b/arch/sandbox/include/asm/state.h
@@ -10,13 +10,6 @@
 #include 
 #include 
 
-/* How we exited U-Boot */
-enum exit_type_id {
-   STATE_EXIT_NORMAL,
-   STATE_EXIT_COLD_REBOOT,
-   STATE_EXIT_POWER_OFF,
-};
-
 /**
  * Selects the behavior of the serial terminal.
  *
@@ -50,7 +43,6 @@ struct sandbox_state {
const char *cmd;/* Command to execute */
bool interactive;   /* Enable cmdline after execute */
const char *fdt_fname;  /* Filename of FDT binary */
-   enum exit_type_id exit_type;/* How we exited U-Boot */
const char *parse_err;  /* Error to report from parsing */
int argc;   /* Program arguments */
char **argv;/* Command line arguments */
@@ -139,13 +131,6 @@ struct sandbox_state_io {
}
 
 /**
- * Record the exit type to be reported by the test program.
- *
- * @param exit_typeExit type to record
- */
-void state_record_exit(enum exit_type_id exit_type);
-
-/**
  * Gets a pointer to the current state.
  *
  * @return pointer to state
-- 
1.7.11.5

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


Re: [U-Boot] [PATCH] RSA depends on DM

2015-02-06 Thread Simon Glass
On 4 February 2015 at 20:26, Simon Glass  wrote:
> On 4 February 2015 at 20:16, Chris Kuethe  wrote:
>> Discovered while experimenting with signature checking on vexpress
>> which doesn't typically use DM.
>> ---
>>  Kconfig | 1 +
>>  1 file changed, 1 insertion(+)
>
> Acked-by: Simon Glass 

Applied to u-boot-dm, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] dm: Prevent "demo hello" and "demo status" segfaults

2015-02-06 Thread Simon Glass
On 3 February 2015 at 12:23, Peter Tyser  wrote:
> Hi Simon,
>
> On Tue, 2015-02-03 at 13:18 -0600, Peter Tyser wrote:
>> Segfaults can occur when a mandatory argument is not provided to
>> "demo hello" and "demo status".  Eg:
>>
>>=> demo hello
>>Segmentation fault (core dumped)
>>
>> Add a check to ensure all required arguments are provided.
>>
>> Signed-off-by: Peter Tyser 
>
> The "1/3" in the subject line is an error - there are no other
> patches in the series.
>
> Peter

Applied to u-boot-dm, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH] gpio: omap: Pass correct argument to _get_gpio_direction()

2015-02-06 Thread Simon Glass
On 2 February 2015 at 17:55, Simon Glass  wrote:
> HI Axel,
>
> On 31 January 2015 at 07:23, Axel Lin  wrote:
>> Pass bank rather than bank->base to _get_gpio_direction().
>>
>> Signed-off-by: Axel Lin 
>> ---
>>  drivers/gpio/omap_gpio.c | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/gpio/omap_gpio.c b/drivers/gpio/omap_gpio.c
>> index f3a7ccb..19fc451 100644
>> --- a/drivers/gpio/omap_gpio.c
>> +++ b/drivers/gpio/omap_gpio.c
>> @@ -291,7 +291,7 @@ static int omap_gpio_get_function(struct udevice *dev, 
>> unsigned offset)
>> struct gpio_bank *bank = dev_get_priv(dev);
>>
>> /* GPIOF_FUNC is not implemented yet */
>> -   if (_get_gpio_direction(bank->base, offset) == OMAP_GPIO_DIR_OUT)
>> +   if (_get_gpio_direction(bank, offset) == OMAP_GPIO_DIR_OUT)
>> return GPIOF_OUTPUT;
>> else
>> return GPIOF_INPUT;
>
> Ah yes another reason why we need a struct rather than void * in
> struct gpio_bank.
>
> Thanks for the patch, will pick up for u-boot-dm.
>
> Acked-by: Simon Glass 

Applied to u-boot-dm, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH RFT v2] gpio: at91: Fix getting address of private data

2015-02-06 Thread Simon Glass
On 2 February 2015 at 17:55, Simon Glass  wrote:
> On 30 January 2015 at 23:47, Axel Lin  wrote:
>> Use dev_get_priv() rather than dev_get_platdata() to get correct address of
>> private data.
>>
>> Signed-off-by: Axel Lin 
>> ---
>> v2: Fix an obvious typo in subject line (s/addres/address).
>>  drivers/gpio/at91_gpio.c | 10 +-
>>  1 file changed, 5 insertions(+), 5 deletions(-)
>
> Acked-by: Simon Glass 
>
> Thanks for picking this up. I'll apply it to u-boot-dm soon as a bug fix.

Applied to u-boot-dm, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 08/12] i2c: s3c24x0: reduce transmission status timeout

2015-02-06 Thread Simon Glass
On 6 February 2015 at 13:48, Simon Glass  wrote:
> Hi,
>
> On 27 January 2015 at 08:44, Przemyslaw Marczak  wrote:
>> Hello,
>>
>> On 01/27/2015 04:38 PM, Simon Glass wrote:
>>>
>>> Hi,
>>>
>>> On 27 January 2015 at 05:36, Przemyslaw Marczak 
>>> wrote:

 If no device is connected to I2C bus, the i2c probe command
 can take a lot of time for probe each address. This commit
 reduces the busy timeout to 10ms for standard and high speed
 modes. This doesn't break the transmission an also allow for
 properly probe the devices.

 Signed-off-by: Przemyslaw Marczak 
>>>
>>>
>>> Tested-by: Simon Glass 
>>>
>>> This patch looks OK but I'd like to get other comments if possible.
>>>
>> [cut]
>>
>> Ok, that's fine. I tested this on Trats2 and Odroid XU3 and it works fine.
>
> Well, as this patch has not attracted any comments, and seems to work
> for me, I'll pick it up.
>
> Regards,
> Simon

Applied to u-boot-dm, thanks!
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC] m68k: generic board

2015-02-06 Thread Angelo Dureghello



On 06/02/2015 17:02, Tom Rini wrote:

On Mon, Jan 26, 2015 at 09:39:13AM +, Huan Wang wrote:

Hi, Tom,


On Thu, Jan 15, 2015 at 04:08:40PM +0100, Angelo Dureghello wrote:

Dear all,

i would like to post a patch with the m68k generic board support,
tested and working here, but of course not tested for all the other
m68k boards except mine.

My coldfire board is the "amcore" board not yet accepted.

http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/193661
http://thread.gmane.org/gmane.comp.boot-loaders.u-boot/193660

I need some suggestions on how to proceed now.

I already modified my board config to work with generic board support.

So my thought is to post 2 separate patches:
1
- add generic board (1/1). Each board maintainer should then test it
and report for feedbacks.
2
Re-post a 2/2 patch (v8) of amcore using generic board:
- amcore board (1),
- mcf5307 support (2),

This amcore board is the coldfire base i use here for all the general
m68k tests.

With your help commenting on this patch until it is conformant to the
last recent coding guidelines could help me and Alison to know what
has to be purged / changed, (eventually, if needed) in all other m68k
boards code.

What do you think ?


Lets go with #2 and we'll purge the rest of the boards that you don't
want to convert and compile test after -rc1.  Thanks!


[Alison Wang] Do you mean you will purge the rest of the boards if
they are not converted and tested?

I have these boards, such as m52277evb, m5253demo, m53017evb,
m5329evb, m5373evb, m54418twr, m54451evb, m54455evb, m547xevb and
m548xevb. I think I really need some time to convert and test them.


Please get them converted ASAP and remove the rest of the boards which
you do not plan to support.  Thanks!



Sorry but i had some delays in these days, especially due to a bug
in the kernel.org 4.6.3 toolchain for i686:

https://lkml.org/lkml/2015/2/6/654

I am about to send in some days amcore board patch
already set up to work with generic board support.

Once the set is accepted, we should be able to convert the other boards, 
or re-introduce easily the boards.


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


[U-Boot] Samsung patches

2015-02-06 Thread Simon Glass
Hi,

I see quite a few series sitting around to be applied, including the
Peach Pi display which is still waiting. Any news please?

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


  1   2   >