[U-Boot] [PATCH v2 26/29] dm: Add child_pre_probe() and child_post_remove() methods

2014-07-08 Thread Simon Glass
Some devices (particularly bus devices) must track their children, knowing
when a new child is added so that it can be set up for communication on the
bus.

Add a child_pre_probe() method to provide this feature, and a corresponding
child_post_remove() method.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 doc/driver-model/README.txt | 68 -
 drivers/core/device.c   | 16 ++-
 include/dm/device.h |  6 
 include/dm/test.h   |  4 +++
 test/dm/bus.c   | 68 +
 5 files changed, 160 insertions(+), 2 deletions(-)

diff --git a/doc/driver-model/README.txt b/doc/driver-model/README.txt
index cb6b8fd..742b7c8 100644
--- a/doc/driver-model/README.txt
+++ b/doc/driver-model/README.txt
@@ -95,7 +95,7 @@ are provided in test/dm. To run them, try:
 You should see something like this:
 
 <...U-Boot banner...>
-Running 20 driver model tests
+Running 21 driver model tests
 Test: dm_test_autobind
 Test: dm_test_autoprobe
 Test: dm_test_bus_children
@@ -104,6 +104,7 @@ You should see something like this:
 Device 'c-test@1': seq 1 is in use by 'd-test'
 Test: dm_test_bus_children_funcs
 Test: dm_test_bus_parent_data
+Test: dm_test_bus_parent_ops
 Test: dm_test_children
 Test: dm_test_fdt
 Device 'd-test': seq 3 is in use by 'b-test'
@@ -425,6 +426,71 @@ entirely under the control of the board author so a 
conflict is generally
 an error.
 
 
+Bus Drivers
+---
+
+A common use of driver model is to implement a bus, a device which provides
+access to other devices. Example of buses include SPI and I2C. Typically
+the bus provides some sort of transport or translation that makes it
+possible to talk to the devices on the bus.
+
+Driver model provides a few useful features to help with implementing
+buses. Firstly, a bus can request that its children store some 'parent
+data' which can be used to keep track of child state. Secondly, the bus can
+define methods which are called when a child is probed or removed. This is
+similar to the methods the uclass driver provides.
+
+Here an explanation of how a bus fits with a uclass may be useful. Consider
+a USB bus with several devices attached to it, each from a different (made
+up) uclass:
+
+   xhci_usb (UCLASS_USB)
+  eth (UCLASS_ETHERNET)
+  camera (UCLASS_CAMERA)
+  flash (UCLASS_FLASH_STORAGE)
+
+Each of the devices is connected to a different address on the USB bus.
+The bus device wants to store this address and some other information such
+as the bus speed for each device.
+
+To achieve this, the bus device can use dev->parent_priv in each of its
+three children. This can be auto-allocated if the bus driver has a non-zero
+value for per_child_auto_alloc_size. If not, then the bus device can
+allocate the space itself before the child device is probed.
+
+Also the bus driver can define the child_pre_probe() and child_post_remove()
+methods to allow it to do some processing before the child is activated or
+after it is deactivated.
+
+Note that the information that controls this behaviour is in the bus's
+driver, not the child's. In fact it is possible that child has no knowledge
+that it is connected to a bus. The same child device may even be used on two
+different bus types. As an example. the 'flash' device shown above may also
+be connected on a SATA bus or standalone with no bus:
+
+   xhci_usb (UCLASS_USB)
+  flash (UCLASS_FLASH_STORAGE)  - parent data/methods defined by USB bus
+
+   sata (UCLASS_SATA)
+  flash (UCLASS_FLASH_STORAGE)  - parent data/methods defined by SATA bus
+
+   flash (UCLASS_FLASH_STORAGE)  - no parent data/methods (not on a bus)
+
+Above you can see that the driver for xhci_usb/sata controls the child's
+bus methods. In the third example the device is not on a bus, and therefore
+will not have these methods at all. Consider the case where the flash
+device defines child methods. These would be used for *its* children, and
+would be quite separate from the methods defined by the driver for the bus
+that the flash device is connetced to. The act of attaching a device to a
+parent device which is a bus, causes the device to start behaving like a
+bus device, regardless of its own views on the matter.
+
+The uclass for the device can also contain data private to that uclass.
+But note that each device on the bus may be a memeber of a different
+uclass, and this data has nothing to do with the child data for each child
+on the bus.
+
+
 Driver Lifecycle
 
 
diff --git a/drivers/core/device.c b/drivers/core/device.c
index 42d250f..166b073 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -291,6 +291,12 @@ int device_probe(struct udevice *dev)
}
dev->seq = seq;
 
+   if (dev->parent && dev->parent->driver->child_pre_probe) {
+   ret = dev->parent->driver->child_pre_probe(dev);
+  

[U-Boot] [PATCH v2 20/29] dm: Avoid accessing uclasses before they are ready

2014-07-08 Thread Simon Glass
Don't allow access to uclasses before they have been initialised.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 doc/driver-model/README.txt |  3 ++-
 drivers/core/uclass.c   |  2 ++
 test/dm/core.c  | 14 ++
 3 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/doc/driver-model/README.txt b/doc/driver-model/README.txt
index fad6284..33f077c 100644
--- a/doc/driver-model/README.txt
+++ b/doc/driver-model/README.txt
@@ -95,7 +95,7 @@ are provided in test/dm. To run them, try:
 You should see something like this:
 
 <...U-Boot banner...>
-Running 16 driver model tests
+Running 17 driver model tests
 Test: dm_test_autobind
 Test: dm_test_autoprobe
 Test: dm_test_children
@@ -116,6 +116,7 @@ You should see something like this:
 Test: dm_test_pre_reloc
 Test: dm_test_remove
 Test: dm_test_uclass
+Test: dm_test_uclass_before_ready
 Failures: 0
 
 
diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index a27f3d5..61ca17e 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -23,6 +23,8 @@ struct uclass *uclass_find(enum uclass_id key)
 {
struct uclass *uc;
 
+   if (!gd->dm_root)
+   return NULL;
/*
 * TODO(s...@chromium.org): Optimise this, perhaps moving the found
 * node to the start of the list, or creating a linear array mapping
diff --git a/test/dm/core.c b/test/dm/core.c
index 24e0b6b..b0cfb42 100644
--- a/test/dm/core.c
+++ b/test/dm/core.c
@@ -570,3 +570,17 @@ static int dm_test_pre_reloc(struct dm_test_state *dms)
return 0;
 }
 DM_TEST(dm_test_pre_reloc, 0);
+
+static int dm_test_uclass_before_ready(struct dm_test_state *dms)
+{
+   struct uclass *uc;
+
+   ut_assertok(uclass_get(UCLASS_TEST, &uc));
+
+   memset(gd, '\0', sizeof(*gd));
+   ut_asserteq_ptr(NULL, uclass_find(UCLASS_TEST));
+
+   return 0;
+}
+
+DM_TEST(dm_test_uclass_before_ready, 0);
-- 
2.0.0.526.g5318336

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


[U-Boot] [PATCH v2 06/29] dm: Provide a way to shut down driver model

2014-07-08 Thread Simon Glass
Add a new method which removes and unbinds all drivers.

Signed-off-by: Simon Glass 
Acked-by: Marek Vasut 
---

Changes in v2: None

 drivers/core/root.c | 8 
 include/dm/root.h   | 8 
 2 files changed, 16 insertions(+)

diff --git a/drivers/core/root.c b/drivers/core/root.c
index bc76370..1fa24c4 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -55,6 +55,14 @@ int dm_init(void)
return 0;
 }
 
+int dm_uninit(void)
+{
+   device_remove(dm_root());
+   device_unbind(dm_root());
+
+   return 0;
+}
+
 int dm_scan_platdata(void)
 {
int ret;
diff --git a/include/dm/root.h b/include/dm/root.h
index a4826a6..35818b1 100644
--- a/include/dm/root.h
+++ b/include/dm/root.h
@@ -50,4 +50,12 @@ int dm_scan_fdt(const void *blob);
  */
 int dm_init(void);
 
+/**
+ * dm_uninit - Uninitialise Driver Model structures
+ *
+ * All devices will be removed and unbound
+ * @return 0 if OK, -ve on error
+ */
+int dm_uninit(void);
+
 #endif
-- 
2.0.0.526.g5318336

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


[U-Boot] [PATCH v2 14/29] fdt: Add a function to get the alias sequence of a node

2014-07-08 Thread Simon Glass
Aliases are used to provide U-Boot's numbering of devices, such as:

aliases {
spi0 = "/spi@1233";
}

spi@1233 {
...
}

This tells us that the SPI controller at 1233 is considered to be the
first SPI controller (SPI 0). So we have a numbering for the SPI node.

Add a function that returns the numbering for a node assume that it exists
in the list of aliases.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 include/fdtdec.h | 18 ++
 lib/fdtdec.c | 46 ++
 2 files changed, 64 insertions(+)

diff --git a/include/fdtdec.h b/include/fdtdec.h
index a7e6ee7..f454f7e 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -345,6 +345,24 @@ int fdtdec_find_aliases_for_id(const void *blob, const 
char *name,
 int fdtdec_add_aliases_for_id(const void *blob, const char *name,
enum fdt_compat_id id, int *node_list, int maxcount);
 
+/**
+ * Get the alias sequence number of a node
+ *
+ * This works out whether a node is pointed to by an alias, and if so, the
+ * sequence number of that alias. Aliases are of the form  where
+ *  is the sequence number. For example spi2 would be sequence number
+ * 2.
+ *
+ * @param blob Device tree blob (if NULL, then error is returned)
+ * @param base Base name for alias (before the underscore)
+ * @param node Node to look up
+ * @param seqp This is set to the sequence number if one is found,
+ * but otherwise the value is left alone
+ * @return 0 if a sequence was found, -ve if not
+ */
+int fdtdec_get_alias_seq(const void *blob, const char *base, int node,
+int *seqp);
+
 /*
  * Get the name for a compatible ID
  *
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index aaa6620..1b4ae9f 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -5,9 +5,11 @@
 
 #ifndef USE_HOSTCC
 #include 
+#include 
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -319,6 +321,50 @@ int fdtdec_add_aliases_for_id(const void *blob, const char 
*name,
return num_found;
 }
 
+int fdtdec_get_alias_seq(const void *blob, const char *base, int offset,
+int *seqp)
+{
+   int base_len = strlen(base);
+   const char *find_name;
+   int find_namelen;
+   int prop_offset;
+   int aliases;
+
+   find_name = fdt_get_name(blob, offset, &find_namelen);
+   debug("Looking for '%s' at %d, name %s\n", base, offset, find_name);
+
+   aliases = fdt_path_offset(blob, "/aliases");
+   for (prop_offset = fdt_first_property_offset(blob, aliases);
+prop_offset > 0;
+prop_offset = fdt_next_property_offset(blob, prop_offset)) {
+   const char *prop;
+   const char *name;
+   const char *slash;
+   const char *p;
+   int len;
+
+   prop = fdt_getprop_by_offset(blob, prop_offset, &name, &len);
+   debug("   - %s, %s\n", name, prop);
+   if (len < find_namelen || *prop != '/' || prop[len - 1] ||
+   strncmp(name, base, base_len))
+   continue;
+
+   slash = strrchr(prop, '/');
+   if (strcmp(slash + 1, find_name))
+   continue;
+   for (p = name; *p; p++) {
+   if (isdigit(*p)) {
+   *seqp = simple_strtoul(p, NULL, 10);
+   debug("Found seq %d\n", *seqp);
+   return 0;
+   }
+   }
+   }
+
+   debug("Not found\n");
+   return -ENOENT;
+}
+
 int fdtdec_check_fdt(void)
 {
/*
-- 
2.0.0.526.g5318336

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


[U-Boot] [PATCH v2 24/29] dm: Add functions to access a device's children

2014-07-08 Thread Simon Glass
Devices can have childen that can be addressed by a simple index, the
sequence number or a device tree offset. Add functions to access a child
in each of these ways.

The index is typically used as a fallback when the sequence number is not
available. For example we may use a serial UART with sequence number 0 as
the console, but if no UART has sequence number 0, then we can fall back
to just using the first UART (index 0).

The device tree offset function is useful for buses, where they want to
locate one of their children. The device tree can be scanned to find the
offset of each child, and that offset can then find the device.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 doc/driver-model/README.txt |  3 +-
 drivers/core/device.c   | 93 +
 include/dm/device.h | 58 
 test/dm/bus.c   | 46 ++
 4 files changed, 199 insertions(+), 1 deletion(-)

diff --git a/doc/driver-model/README.txt b/doc/driver-model/README.txt
index a191f47..b29a79f 100644
--- a/doc/driver-model/README.txt
+++ b/doc/driver-model/README.txt
@@ -95,13 +95,14 @@ are provided in test/dm. To run them, try:
 You should see something like this:
 
 <...U-Boot banner...>
-Running 18 driver model tests
+Running 19 driver model tests
 Test: dm_test_autobind
 Test: dm_test_autoprobe
 Test: dm_test_bus_children
 Device 'd-test': seq 3 is in use by 'b-test'
 Device 'c-test@0': seq 0 is in use by 'a-test'
 Device 'c-test@1': seq 1 is in use by 'd-test'
+Test: dm_test_bus_children_funcs
 Test: dm_test_children
 Test: dm_test_fdt
 Device 'd-test': seq 3 is in use by 'b-test'
diff --git a/drivers/core/device.c b/drivers/core/device.c
index 848ce3b..74bb5f0 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -376,3 +376,96 @@ void *dev_get_priv(struct udevice *dev)
 
return dev->priv;
 }
+
+static int device_get_device_tail(struct udevice *dev, int ret,
+ struct udevice **devp)
+{
+   if (ret)
+   return ret;
+
+   ret = device_probe(dev);
+   if (ret)
+   return ret;
+
+   *devp = dev;
+
+   return 0;
+}
+
+int device_get_child(struct udevice *parent, int index, struct udevice **devp)
+{
+   struct udevice *dev;
+
+   list_for_each_entry(dev, &parent->child_head, sibling_node) {
+   if (!index--)
+   return device_get_device_tail(dev, 0, devp);
+   }
+
+   return -ENODEV;
+}
+
+int device_find_child_by_seq(struct udevice *parent, int seq_or_req_seq,
+bool find_req_seq, struct udevice **devp)
+{
+   struct udevice *dev;
+
+   *devp = NULL;
+   if (seq_or_req_seq == -1)
+   return -ENODEV;
+
+   list_for_each_entry(dev, &parent->child_head, sibling_node) {
+   if ((find_req_seq ? dev->req_seq : dev->seq) ==
+   seq_or_req_seq) {
+   *devp = dev;
+   return 0;
+   }
+   }
+
+   return -ENODEV;
+}
+
+int device_get_child_by_seq(struct udevice *parent, int seq,
+   struct udevice **devp)
+{
+   struct udevice *dev;
+   int ret;
+
+   *devp = NULL;
+   ret = device_find_child_by_seq(parent, seq, false, &dev);
+   if (ret == -ENODEV) {
+   /*
+* We didn't find it in probed devices. See if there is one
+* that will request this seq if probed.
+*/
+   ret = device_find_child_by_seq(parent, seq, true, &dev);
+   }
+   return device_get_device_tail(dev, ret, devp);
+}
+
+int device_find_child_by_of_offset(struct udevice *parent, int of_offset,
+  struct udevice **devp)
+{
+   struct udevice *dev;
+
+   *devp = NULL;
+
+   list_for_each_entry(dev, &parent->child_head, sibling_node) {
+   if (dev->of_offset == of_offset) {
+   *devp = dev;
+   return 0;
+   }
+   }
+
+   return -ENODEV;
+}
+
+int device_get_child_by_of_offset(struct udevice *parent, int seq,
+ struct udevice **devp)
+{
+   struct udevice *dev;
+   int ret;
+
+   *devp = NULL;
+   ret = device_find_child_by_of_offset(parent, seq, &dev);
+   return device_get_device_tail(dev, ret, devp);
+}
diff --git a/include/dm/device.h b/include/dm/device.h
index 9077490..3f0f711 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -169,6 +169,18 @@ void *dev_get_platdata(struct udevice *dev);
 void *dev_get_priv(struct udevice *dev);
 
 /**
+ * device_get_child() - Get the child of a device by index
+ *
+ * Returns the numbered child, 0 being the first. This does not use
+ * sequence numbers, only the natural order.
+ *
+ * @dev:   Parent devic

[U-Boot] [PATCH v2 19/29] dm: Allow a device to be found by its FDT offset

2014-07-08 Thread Simon Glass
Each device that was bound from a device tree has an node that caused it to
be bound. Add functions that find and return a device based on a device tree
offset.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 doc/driver-model/README.txt |  3 ++-
 drivers/core/uclass.c   | 35 +++
 include/dm/uclass.h | 16 
 test/dm/test-fdt.c  | 30 ++
 4 files changed, 83 insertions(+), 1 deletion(-)

diff --git a/doc/driver-model/README.txt b/doc/driver-model/README.txt
index 4ac6287..fad6284 100644
--- a/doc/driver-model/README.txt
+++ b/doc/driver-model/README.txt
@@ -95,12 +95,13 @@ are provided in test/dm. To run them, try:
 You should see something like this:
 
 <...U-Boot banner...>
-Running 15 driver model tests
+Running 16 driver model tests
 Test: dm_test_autobind
 Test: dm_test_autoprobe
 Test: dm_test_children
 Test: dm_test_fdt
 Device 'd-test': seq 3 is in use by 'b-test'
+Test: dm_test_fdt_offset
 Test: dm_test_fdt_pre_reloc
 Test: dm_test_fdt_uclass_seq
 Device 'd-test': seq 3 is in use by 'b-test'
diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index c28cf67..a27f3d5 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -187,6 +187,30 @@ int uclass_find_device_by_seq(enum uclass_id id, int 
seq_or_req_seq,
return -ENODEV;
 }
 
+static int uclass_find_device_by_of_offset(enum uclass_id id, int node,
+  struct udevice **devp)
+{
+   struct uclass *uc;
+   struct udevice *dev;
+   int ret;
+
+   *devp = NULL;
+   if (node < 0)
+   return -ENODEV;
+   ret = uclass_get(id, &uc);
+   if (ret)
+   return ret;
+
+   list_for_each_entry(dev, &uc->dev_head, uclass_node) {
+   if (dev->of_offset == node) {
+   *devp = dev;
+   return 0;
+   }
+   }
+
+   return -ENODEV;
+}
+
 /**
  * uclass_get_device_tail() - handle the end of a get_device call
  *
@@ -239,6 +263,17 @@ int uclass_get_device_by_seq(enum uclass_id id, int seq, 
struct udevice **devp)
return uclass_get_device_tail(dev, ret, devp);
 }
 
+int uclass_get_device_by_of_offset(enum uclass_id id, int node,
+  struct udevice **devp)
+{
+   struct udevice *dev;
+   int ret;
+
+   *devp = NULL;
+   ret = uclass_find_device_by_of_offset(id, node, &dev);
+   return uclass_get_device_tail(dev, ret, devp);
+}
+
 int uclass_first_device(enum uclass_id id, struct udevice **devp)
 {
struct uclass *uc;
diff --git a/include/dm/uclass.h b/include/dm/uclass.h
index 48ae242..0b5ade6 100644
--- a/include/dm/uclass.h
+++ b/include/dm/uclass.h
@@ -122,6 +122,22 @@ int uclass_get_device(enum uclass_id id, int index, struct 
udevice **devp);
 int uclass_get_device_by_seq(enum uclass_id id, int seq, struct udevice 
**devp);
 
 /**
+ * uclass_get_device_by_of_offset() - Get a uclass device by device tree node
+ *
+ * This searches the devices in the uclass for one attached to the given
+ * device tree node.
+ *
+ * The device is probed to activate it ready for use.
+ *
+ * @id: ID to look up
+ * @node: Device tree offset to search for (if -ve then -ENODEV is returned)
+ * @devp: Returns pointer to device (there is only one for each node)
+ * @return 0 if OK, -ve on error
+ */
+int uclass_get_device_by_of_offset(enum uclass_id id, int node,
+  struct udevice **devp);
+
+/**
  * uclass_first_device() - Get the first device in a uclass
  *
  * @id: Uclass ID to look up
diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c
index d8e94d8..7980a68 100644
--- a/test/dm/test-fdt.c
+++ b/test/dm/test-fdt.c
@@ -215,3 +215,33 @@ static int dm_test_fdt_uclass_seq(struct dm_test_state 
*dms)
return 0;
 }
 DM_TEST(dm_test_fdt_uclass_seq, DM_TESTF_SCAN_PDATA | DM_TESTF_SCAN_FDT);
+
+/* Test that we can find a device by device tree offset */
+static int dm_test_fdt_offset(struct dm_test_state *dms)
+{
+   const void *blob = gd->fdt_blob;
+   struct udevice *dev;
+   int node;
+
+   node = fdt_path_offset(blob, "/e-test");
+   ut_assert(node > 0);
+   ut_assertok(uclass_get_device_by_of_offset(UCLASS_TEST_FDT, node,
+  &dev));
+   ut_asserteq_str("e-test", dev->name);
+
+   /* This node should not be bound */
+   node = fdt_path_offset(blob, "/junk");
+   ut_assert(node > 0);
+   ut_asserteq(-ENODEV, uclass_get_device_by_of_offset(UCLASS_TEST_FDT,
+   node, &dev));
+
+   /* This is not a top level node so should not be probed */
+   node = fdt_path_offset(blob, "/some-bus/c-test");
+   ut_assert(node > 0);
+   ut_asserteq(-ENODEV, uclass_get_device_by_of_offset(UCLASS_TEST_FDT,
+ 

[U-Boot] [PATCH v2 25/29] dm: Introduce per-child data for devices

2014-07-08 Thread Simon Glass
Some device types can have child devices and want to store information
about them. For example a USB flash stick attached to a USB host
controller would likely use this space. The controller can hold
information about the USB state of each of its children.

The data is stored attached to the child device in the 'parent_priv'
member. It can be auto-allocated by dm when the child is probed. To
do this, add a per_child_auto_alloc_size value to the parent driver.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 doc/driver-model/README.txt | 25 +++--
 drivers/core/device.c   | 26 ++
 include/dm/device.h | 20 ++
 include/dm/test.h   |  9 +++
 test/dm/bus.c   | 65 +
 5 files changed, 137 insertions(+), 8 deletions(-)

diff --git a/doc/driver-model/README.txt b/doc/driver-model/README.txt
index b29a79f..cb6b8fd 100644
--- a/doc/driver-model/README.txt
+++ b/doc/driver-model/README.txt
@@ -95,7 +95,7 @@ are provided in test/dm. To run them, try:
 You should see something like this:
 
 <...U-Boot banner...>
-Running 19 driver model tests
+Running 20 driver model tests
 Test: dm_test_autobind
 Test: dm_test_autoprobe
 Test: dm_test_bus_children
@@ -103,6 +103,7 @@ You should see something like this:
 Device 'c-test@0': seq 0 is in use by 'a-test'
 Device 'c-test@1': seq 1 is in use by 'd-test'
 Test: dm_test_bus_children_funcs
+Test: dm_test_bus_parent_data
 Test: dm_test_children
 Test: dm_test_fdt
 Device 'd-test': seq 3 is in use by 'b-test'
@@ -489,16 +490,23 @@ steps (see device_probe()):
stored in the device, but it is uclass data. owned by the uclass driver.
It is possible for the device to access it.
 
-   d. All parent devices are probed. It is not possible to activate a device
+   d. If the device's immediate parent specifies a per_child_auto_alloc_size
+   then this space is allocated. This is intended for use by the parent
+   device to keep track of things related to the child. For example a USB
+   flash stick attached to a USB host controller would likely use this
+   space. The controller can hold information about the USB state of each
+   of its children.
+
+   e. All parent devices are probed. It is not possible to activate a device
unless its predecessors (all the way up to the root device) are activated.
This means (for example) that an I2C driver will require that its bus
be activated.
 
-   e. The device's sequence number is assigned, either the requested one
+   f. The device's sequence number is assigned, either the requested one
(assuming no conflicts) or the next available one if there is a conflict
or nothing particular is requested.
 
-   f. If the driver provides an ofdata_to_platdata() method, then this is
+   g. If the driver provides an ofdata_to_platdata() method, then this is
called to convert the device tree data into platform data. This should
do various calls like fdtdec_get_int(gd->fdt_blob, dev->of_offset, ...)
to access the node and store the resulting information into dev->platdata.
@@ -514,7 +522,7 @@ steps (see device_probe()):
data, one day it is possible that U-Boot will cache platformat data for
devices which are regularly de/activated).
 
-   g. The device's probe() method is called. This should do anything that
+   h. The device's probe() method is called. This should do anything that
is required by the device to get it going. This could include checking
that the hardware is actually present, setting up clocks for the
hardware and setting up hardware registers to initial values. The code
@@ -529,9 +537,9 @@ steps (see device_probe()):
allocate the priv space here yourself. The same applies also to
platdata_auto_alloc_size. Remember to free them in the remove() method.
 
-   h. The device is marked 'activated'
+   i. The device is marked 'activated'
 
-   i. The uclass's post_probe() method is called, if one exists. This may
+   j. The uclass's post_probe() method is called, if one exists. This may
cause the uclass to do some housekeeping to record the device as
activated and 'known' by the uclass.
 
@@ -562,7 +570,8 @@ remove it. This performs the probe steps in reverse:
to be sure that no hardware is running, it should be enough to remove
all devices.
 
-   d. The device memory is freed (platform data, private data, uclass data).
+   d. The device memory is freed (platform data, private data, uclass data,
+   parent data).
 
Note: Because the platform data for a U_BOOT_DEVICE() is defined with a
static pointer, it is not de-allocated during the remove() method. For
diff --git a/drivers/core/device.c b/drivers/core/device.c
index 74bb5f0..42d250f 100644
--- a/drivers/core/device.c
+++ b/drivers/core/device.c
@@ -218,6 +218,13 @@ static void device_free(struct udevice *dev)
free(dev->ucla

[U-Boot] [PATCH v2 23/29] dm: Provide a function to scan child FDT nodes

2014-07-08 Thread Simon Glass
At present only root nodes in the device tree are scanned for devices.
But some devices can have children. For example a SPI bus may have
several children for each of its chip selects.

Add a function which scans subnodes and binds devices for each one. This
can be used for the root node scan also, so change it.

A device can call this function in its bind() or probe() methods to bind
its children.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 doc/driver-model/README.txt |  6 -
 drivers/core/root.c | 34 +---
 include/dm/root.h   | 16 
 include/dm/test.h   |  9 +++
 include/dm/uclass-id.h  |  1 +
 test/dm/Makefile|  1 +
 test/dm/bus.c   | 63 +
 test/dm/test-fdt.c  | 63 +++--
 test/dm/test.dts| 16 +++-
 9 files changed, 167 insertions(+), 42 deletions(-)
 create mode 100644 test/dm/bus.c

diff --git a/doc/driver-model/README.txt b/doc/driver-model/README.txt
index 33f077c..a191f47 100644
--- a/doc/driver-model/README.txt
+++ b/doc/driver-model/README.txt
@@ -95,9 +95,13 @@ are provided in test/dm. To run them, try:
 You should see something like this:
 
 <...U-Boot banner...>
-Running 17 driver model tests
+Running 18 driver model tests
 Test: dm_test_autobind
 Test: dm_test_autoprobe
+Test: dm_test_bus_children
+Device 'd-test': seq 3 is in use by 'b-test'
+Device 'c-test@0': seq 0 is in use by 'a-test'
+Device 'c-test@1': seq 1 is in use by 'd-test'
 Test: dm_test_children
 Test: dm_test_fdt
 Device 'd-test': seq 3 is in use by 'b-test'
diff --git a/drivers/core/root.c b/drivers/core/root.c
index 9a7df11..bb535e0 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -15,6 +15,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -79,29 +80,32 @@ int dm_scan_platdata(bool pre_reloc_only)
 }
 
 #ifdef CONFIG_OF_CONTROL
-int dm_scan_fdt(const void *blob, bool pre_reloc_only)
+int dm_scan_fdt_node(struct udevice *parent, const void *blob, int offset,
+bool pre_reloc_only)
 {
-   int offset = 0;
int ret = 0, err;
-   int depth = 0;
-
-   do {
-   offset = fdt_next_node(blob, offset, &depth);
-   if (offset > 0 && depth == 1) {
-   if (pre_reloc_only &&
-   !fdt_getprop(blob, offset, "dm,pre-reloc", NULL))
-   continue;
-   err = lists_bind_fdt(gd->dm_root, blob, offset);
-   if (err && !ret)
-   ret = err;
-   }
-   } while (offset > 0);
+
+   for (offset = fdt_first_subnode(blob, offset);
+offset > 0;
+offset = fdt_next_subnode(blob, offset)) {
+   if (pre_reloc_only &&
+   !fdt_getprop(blob, offset, "dm,pre-reloc", NULL))
+   continue;
+   err = lists_bind_fdt(parent, blob, offset);
+   if (err && !ret)
+   ret = err;
+   }
 
if (ret)
dm_warn("Some drivers failed to bind\n");
 
return ret;
 }
+
+int dm_scan_fdt(const void *blob, bool pre_reloc_only)
+{
+   return dm_scan_fdt_node(gd->dm_root, blob, 0, pre_reloc_only);
+}
 #endif
 
 int dm_init_and_scan(bool pre_reloc_only)
diff --git a/include/dm/root.h b/include/dm/root.h
index 02c7788..33f951b 100644
--- a/include/dm/root.h
+++ b/include/dm/root.h
@@ -46,6 +46,22 @@ int dm_scan_platdata(bool pre_reloc_only);
 int dm_scan_fdt(const void *blob, bool pre_reloc_only);
 
 /**
+ * dm_scan_fdt_node() - Scan the device tree and bind drivers for a node
+ *
+ * This scans the subnodes of a device tree node and and creates a driver
+ * for each one.
+ *
+ * @parent: Parent device for the devices that will be created
+ * @blob: Pointer to device tree blob
+ * @offset: Offset of node to scan
+ * @pre_reloc_only: If true, bind only drivers with the DM_FLAG_PRE_RELOC
+ * flag. If false bind all drivers.
+ * @return 0 if OK, -ve on error
+ */
+int dm_scan_fdt_node(struct udevice *parent, const void *blob, int offset,
+bool pre_reloc_only);
+
+/**
  * dm_init_and_scan() - Initialise Driver Model structures and scan for devices
  *
  * This function initialises the roots of the driver tree and uclass trees,
diff --git a/include/dm/test.h b/include/dm/test.h
index 409f1a3..e8e1c0b 100644
--- a/include/dm/test.h
+++ b/include/dm/test.h
@@ -156,6 +156,15 @@ int dm_check_operations(struct dm_test_state *dms, struct 
udevice *dev,
uint32_t base, struct dm_test_priv *priv);
 
 /**
+ * dm_check_devices() - check the devices respond to operations correctly
+ *
+ * @dms: Overall test state
+ * @num_devices: Number of test devices to check
+ * @return 0 if OK, -ve on error

[U-Boot] [PATCH v2 10/29] stdio: Provide functions to add/remove devices using stdio_dev

2014-07-08 Thread Simon Glass
The current functions for adding and removing devices require a device name.
This is not convenient for driver model, which wants to store a pointer to
the relevant device. Add new functions which provide this feature and adjust
the old ones to call these.

Signed-off-by: Simon Glass 
---

Changes in v2:
- Return -ENODEV instead of -1 on error

 common/stdio.c  | 32 
 include/stdio_dev.h |  2 ++
 2 files changed, 26 insertions(+), 8 deletions(-)

diff --git a/common/stdio.c b/common/stdio.c
index dd402cc..692ca7f 100644
--- a/common/stdio.c
+++ b/common/stdio.c
@@ -11,6 +11,7 @@
 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -148,32 +149,35 @@ struct stdio_dev* stdio_clone(struct stdio_dev *dev)
return _dev;
 }
 
-int stdio_register (struct stdio_dev * dev)
+int stdio_register_dev(struct stdio_dev *dev, struct stdio_dev **devp)
 {
struct stdio_dev *_dev;
 
_dev = stdio_clone(dev);
if(!_dev)
-   return -1;
+   return -ENODEV;
list_add_tail(&(_dev->list), &(devs.list));
+   if (devp)
+   *devp = _dev;
+
return 0;
 }
 
+int stdio_register(struct stdio_dev *dev)
+{
+   return stdio_register_dev(dev, NULL);
+}
+
 /* deregister the device "devname".
  * returns 0 if success, -1 if device is assigned and 1 if devname not found
  */
 #ifdef CONFIG_SYS_STDIO_DEREGISTER
-int stdio_deregister(const char *devname)
+int stdio_deregister_dev(struct stdio_dev *dev)
 {
int l;
struct list_head *pos;
-   struct stdio_dev *dev;
char temp_names[3][16];
 
-   dev = stdio_get_by_name(devname);
-
-   if(!dev) /* device not found */
-   return -1;
/* get stdio devices (ListRemoveItem changes the dev list) */
for (l=0 ; l< MAX_FILES; l++) {
if (stdio_devices[l] == dev) {
@@ -197,6 +201,18 @@ int stdio_deregister(const char *devname)
}
return 0;
 }
+
+int stdio_deregister(const char *devname)
+{
+   struct stdio_dev *dev;
+
+   dev = stdio_get_by_name(devname);
+
+   if (!dev) /* device not found */
+   return -ENODEV;
+
+   return stdio_deregister_dev(dev);
+}
 #endif /* CONFIG_SYS_STDIO_DEREGISTER */
 
 int stdio_init (void)
diff --git a/include/stdio_dev.h b/include/stdio_dev.h
index 4587005..a7d0825 100644
--- a/include/stdio_dev.h
+++ b/include/stdio_dev.h
@@ -77,10 +77,12 @@ extern char *stdio_names[MAX_FILES];
  * PROTOTYPES
  */
 intstdio_register (struct stdio_dev * dev);
+int stdio_register_dev(struct stdio_dev *dev, struct stdio_dev **devp);
 intstdio_init (void);
 void   stdio_print_current_devices(void);
 #ifdef CONFIG_SYS_STDIO_DEREGISTER
 intstdio_deregister(const char *devname);
+int stdio_deregister_dev(struct stdio_dev *dev);
 #endif
 struct list_head* stdio_get_list(void);
 struct stdio_dev* stdio_get_by_name(const char* name);
-- 
2.0.0.526.g5318336

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


[U-Boot] [PATCH v2 08/29] dm: Allow drivers to be marked 'before relocation'

2014-07-08 Thread Simon Glass
Driver model currently only operates after relocation is complete. In this
state U-Boot typically has a small amount of memory available. In adding
support for driver model prior to relocation we must try to use as little
memory as possible.

In addition, on some machines the memory has not be inited and/or the CPU
is not running at full speed or the data cache is off. These can reduce
execution performance, so the less initialisation that is done before
relocation the better.

An immediately-obvious improvement is to only initialise drivers which are
actually going to be used before relocation. On many boards the only such
driver is a serial UART, so this provides a very large potential benefit.

Allow drivers to mark themselves as 'pre-reloc' which means that they will
be initialised prior to relocation. This can be done either with a driver
flag or with a 'dm,pre-reloc' device tree property.

To support this, the various dm scanning function now take a 'pre_reloc_only'
parameter which indicates that only drivers marked pre-reloc should be
bound.

Signed-off-by: Simon Glass 
---

Changes in v2:
- Rename struct device to struct udevice
- Update test output in doc/driver-model/README.txt

 common/board_r.c |  4 ++--
 doc/driver-model/README.txt  | 31 +---
 drivers/core/device.c|  6 --
 drivers/core/lists.c |  6 +++---
 drivers/core/root.c  | 11 ++
 include/dm/device-internal.h |  6 --
 include/dm/device.h  |  5 +
 include/dm/lists.h   |  2 +-
 include/dm/root.h|  8 ++--
 test/dm/core.c   | 48 +++-
 test/dm/test-driver.c| 11 ++
 test/dm/test-fdt.c   | 20 +-
 test/dm/test-main.c  |  4 ++--
 test/dm/test.dts | 11 ++
 14 files changed, 132 insertions(+), 41 deletions(-)

diff --git a/common/board_r.c b/common/board_r.c
index 86424a0..e43a318 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -280,13 +280,13 @@ static int initr_dm(void)
debug("dm_init() failed: %d\n", ret);
return ret;
}
-   ret = dm_scan_platdata();
+   ret = dm_scan_platdata(false);
if (ret) {
debug("dm_scan_platdata() failed: %d\n", ret);
return ret;
}
 #ifdef CONFIG_OF_CONTROL
-   ret = dm_scan_fdt(gd->fdt_blob);
+   ret = dm_scan_fdt(gd->fdt_blob, false);
if (ret) {
debug("dm_scan_fdt() failed: %d\n", ret);
return ret;
diff --git a/doc/driver-model/README.txt b/doc/driver-model/README.txt
index 22c3fcb..4858281 100644
--- a/doc/driver-model/README.txt
+++ b/doc/driver-model/README.txt
@@ -95,26 +95,24 @@ are provided in test/dm. To run them, try:
 You should see something like this:
 
 <...U-Boot banner...>
-Running 12 driver model tests
+Running 14 driver model tests
 Test: dm_test_autobind
 Test: dm_test_autoprobe
 Test: dm_test_children
 Test: dm_test_fdt
+Test: dm_test_fdt_pre_reloc
 Test: dm_test_gpio
 sandbox_gpio: sb_gpio_get_value: error: offset 4 not reserved
 Test: dm_test_leak
-Warning: Please add '#define DEBUG' to the top of common/dlmalloc.c
-Warning: Please add '#define DEBUG' to the top of common/dlmalloc.c
 Test: dm_test_lifecycle
 Test: dm_test_operations
 Test: dm_test_ordering
 Test: dm_test_platdata
+Test: dm_test_pre_reloc
 Test: dm_test_remove
 Test: dm_test_uclass
 Failures: 0
 
-(You can add '#define DEBUG' as suggested to check for memory leaks)
-
 
 What is going on?
 -
@@ -538,26 +536,35 @@ dealing with this might not be worth it.
 - Implemented a GPIO system, trying to keep it simple
 
 
+Pre-Relocation Support
+--
+
+For pre-relocation we simply call the driver model init function. Only
+drivers marked with DM_FLAG_PRE_RELOC or the device tree 'dm,pre-reloc'
+flag are initialised prior to relocation. This helps to reduce the driver
+model overhead.
+
+Then post relocation we throw that away and re-init driver model again.
+For drivers which require some sort of continuity between pre- and
+post-relocation devices, we can provide access to the pre-relocation
+device pointers, but this is not currently implemented (the root device
+pointer is saved but not made available through the driver model API).
+
+
 Things to punt for later
 
 
 - SPL support - this will have to be present before many drivers can be
 converted, but it seems like we can add it once we are happy with the
 core implementation.
-- Pre-relocation support - similar story
 
-That is not to say that no thinking has gone into these - in fact there
+That is not to say that no thinking has gone into this - in fact there
 is quite a lot there. However, getting these right is non-trivial and
 there is a high cost associated with going d

[U-Boot] [PATCH v2 11/29] console: Remove vprintf() optimisation for sandbox

2014-07-08 Thread Simon Glass
If the console is not present, we try to reduce overhead by stopping any
output in vprintf(), before it gets to putc(). This is of dubious merit
in general, but in the case of sandbox it is incorrect since we have a
fallback console which reports errors very early in U-Boot. If this is
defeated U-Boot can hang or exit with no indication of what is wrong.

Remove the optimisation for sandbox.

Signed-off-by: Simon Glass 
---

Changes in v2:
- Improve wording in commit message

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

diff --git a/common/console.c b/common/console.c
index 11c102a..5576dfd 100644
--- a/common/console.c
+++ b/common/console.c
@@ -504,7 +504,7 @@ int vprintf(const char *fmt, va_list args)
uint i;
char printbuffer[CONFIG_SYS_PBSIZE];
 
-#ifndef CONFIG_PRE_CONSOLE_BUFFER
+#if defined(CONFIG_PRE_CONSOLE_BUFFER) && !defined(CONFIG_SANDBOX)
if (!gd->have_console)
return 0;
 #endif
-- 
2.0.0.526.g5318336

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


[U-Boot] [PATCH v2 27/29] dm: Improve errors and warnings in lists_bind_fdt()

2014-07-08 Thread Simon Glass
Add a debug message for when a device tree node has no driver. Also reword
the warning when a device fails to bind, which was misleading.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 drivers/core/lists.c | 16 +---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/core/lists.c b/drivers/core/lists.c
index a8d3aa1..8c0a548 100644
--- a/drivers/core/lists.c
+++ b/drivers/core/lists.c
@@ -123,16 +123,19 @@ int lists_bind_fdt(struct udevice *parent, const void 
*blob, int offset)
const int n_ents = ll_entry_count(struct driver, driver);
struct driver *entry;
struct udevice *dev;
+   bool found = false;
const char *name;
int result = 0;
-   int ret;
+   int ret = 0;
 
dm_dbg("bind node %s\n", fdt_get_name(blob, offset, NULL));
for (entry = driver; entry != driver + n_ents; entry++) {
ret = driver_check_compatible(blob, offset, entry->of_match);
+   name = fdt_get_name(blob, offset, NULL);
if (ret == -ENOENT) {
continue;
} else if (ret == -ENODEV) {
+   dm_dbg("Device '%s' has no compatible string\n", name);
break;
} else if (ret) {
dm_warn("Device tree error at offset %d\n", offset);
@@ -141,14 +144,21 @@ int lists_bind_fdt(struct udevice *parent, const void 
*blob, int offset)
break;
}
 
-   name = fdt_get_name(blob, offset, NULL);
dm_dbg("   - found match at '%s'\n", entry->name);
ret = device_bind(parent, entry, name, NULL, offset, &dev);
if (ret) {
-   dm_warn("No match for driver '%s'\n", entry->name);
+   dm_warn("Error binding driver '%s'\n", entry->name);
if (!result || ret != -ENOENT)
result = ret;
+   } else {
+   found = true;
}
+   break;
+   }
+
+   if (!found && !result && ret != -ENODEV) {
+   dm_dbg("No match for node '%s'\n",
+  fdt_get_name(blob, offset, NULL));
}
 
return result;
-- 
2.0.0.526.g5318336

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


[U-Boot] [PATCH v2 29/29] dm: Give the demo uclass a name

2014-07-08 Thread Simon Glass
Uclasses should be named, so add a name for the demo uclass.

Signed-off-by: Simon Glass 
---

Changes in v2:
- Expand series to include all driver-model-required changes

 drivers/demo/demo-uclass.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/demo/demo-uclass.c b/drivers/demo/demo-uclass.c
index 636fd88..f6510d6 100644
--- a/drivers/demo/demo-uclass.c
+++ b/drivers/demo/demo-uclass.c
@@ -19,6 +19,7 @@
 DECLARE_GLOBAL_DATA_PTR;
 
 UCLASS_DRIVER(demo) = {
+   .name   = "demo",
.id = UCLASS_DEMO,
 };
 
-- 
2.0.0.526.g5318336

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


[U-Boot] [PATCH v2 18/29] dm: Display the sequence number for each device

2014-07-08 Thread Simon Glass
Add this information to 'dm tree' and 'dm uclass' commands.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 test/dm/cmd_dm.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/test/dm/cmd_dm.c b/test/dm/cmd_dm.c
index 93e5255..26980d2 100644
--- a/test/dm/cmd_dm.c
+++ b/test/dm/cmd_dm.c
@@ -29,6 +29,8 @@ static void dm_display_line(struct udevice *dev, char *buf)
printf("%s- %c %s @ %08lx", buf,
   dev->flags & DM_FLAG_ACTIVATED ? '*' : ' ',
   dev->name, (ulong)map_to_sysmem(dev));
+   if (dev->req_seq != -1)
+   printf(", %d", dev->req_seq);
puts("\n");
 }
 
-- 
2.0.0.526.g5318336

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


[U-Boot] [PATCH v2 12/29] Add a flag indicating when the serial console is ready

2014-07-08 Thread Simon Glass
For sandbox we have a fallback console which is used very early in
U-Boot, before serial drivers are available. Rather than try to guess
when to switch to the real console, add a flag so we can be sure. This
makes sure that sandbox can always output a panic() message, for example,
and avoids silent failure (which is very annoying in sandbox).

Signed-off-by: Simon Glass 
---

Changes in v2:
- Improve wording in commit message

 common/console.c  | 4 ++--
 drivers/serial/serial.c   | 1 +
 include/asm-generic/global_data.h | 1 +
 3 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/common/console.c b/common/console.c
index 5576dfd..898da39 100644
--- a/common/console.c
+++ b/common/console.c
@@ -417,7 +417,7 @@ static inline void print_pre_console_buffer(void) {}
 void putc(const char c)
 {
 #ifdef CONFIG_SANDBOX
-   if (!gd) {
+   if (!gd || !(gd->flags & GD_FLG_SERIAL_READY)) {
os_putc(c);
return;
}
@@ -447,7 +447,7 @@ void putc(const char c)
 void puts(const char *s)
 {
 #ifdef CONFIG_SANDBOX
-   if (!gd) {
+   if (!gd || !(gd->flags & GD_FLG_SERIAL_READY)) {
os_puts(s);
return;
}
diff --git a/drivers/serial/serial.c b/drivers/serial/serial.c
index 803d850..d2eb752 100644
--- a/drivers/serial/serial.c
+++ b/drivers/serial/serial.c
@@ -418,6 +418,7 @@ static struct serial_device *get_current(void)
  */
 int serial_init(void)
 {
+   gd->flags |= GD_FLG_SERIAL_READY;
return get_current()->start();
 }
 
diff --git a/include/asm-generic/global_data.h 
b/include/asm-generic/global_data.h
index edde9d7..74df210 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -106,5 +106,6 @@ typedef struct global_data {
 #define GD_FLG_LOGINIT 0x00020 /* Log Buffer has been initialized */
 #define GD_FLG_DISABLE_CONSOLE 0x00040 /* Disable console (in & out)  */
 #define GD_FLG_ENV_READY   0x00080 /* Env. imported into hash table   */
+#define GD_FLG_SERIAL_READY0x00100 /* Pre-reloc serial console ready  */
 
 #endif /* __ASM_GENERIC_GBL_DATA_H */
-- 
2.0.0.526.g5318336

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


[U-Boot] [PATCH v2 04/29] stdio: Pass device pointer to stdio methods

2014-07-08 Thread Simon Glass
At present stdio device functions do not get any clue as to which stdio
device is being acted on. Some implementations go to great lengths to work
around this, such as defining a whole separate set of functions for each
possible device.

For driver model we need to associate a stdio_dev with a device. It doesn't
seem possible to continue with this work-around approach.

Instead, add a stdio_dev pointer to each of the stdio member functions.

Note: The serial drivers have the same problem, but it is not strictly
necessary to fix that to get driver model running. Also, if we convert
serial over to driver model the problem will go away.

Code size increases by 244 bytes for Thumb2 and 428 for PowerPC.

22: stdio: Pass device pointer to stdio methods
   arm: (for 2/2 boards)  all +244.0  bss -4.0  text +248.0
   powerpc: (for 1/1 boards)  all +428.0  text +428.0

Signed-off-by: Simon Glass 
Acked-by: Marek Vasut 
---

Changes in v2:
- Remove changes to deleted board/netphone/phone_console.c board/rbc823/kbd.c

 arch/blackfin/cpu/jtag-console.c  | 10 
 arch/powerpc/cpu/mpc512x/serial.c | 10 
 arch/powerpc/cpu/mpc8xx/video.c   |  6 ++---
 arch/x86/lib/video.c  |  4 +--
 board/mpl/common/kbd.c|  4 +--
 board/mpl/common/kbd.h|  6 +++--
 board/mpl/pati/pati.c |  8 +++---
 board/nokia/rx51/rx51.c   |  6 ++---
 common/cmd_log.c  | 11 
 common/console.c  | 18 ++---
 common/lcd.c  | 14 --
 common/stdio.c| 34 +++-
 common/usb_kbd.c  |  4 +--
 drivers/input/cros_ec_keyb.c  |  6 ++---
 drivers/input/i8042.c |  4 +--
 drivers/input/keyboard.c  |  4 +--
 drivers/input/tegra-kbc.c |  6 ++---
 drivers/misc/cbmem_console.c  |  6 ++---
 drivers/net/netconsole.c  | 10 
 drivers/serial/serial.c   | 54 ++-
 drivers/serial/usbtty.c   |  8 +++---
 drivers/video/cfb_console.c   |  6 ++---
 include/common.h  |  5 
 include/configs/ELPPC.h   |  4 +--
 include/configs/MHPC.h|  4 +--
 include/configs/jadecpu.h |  4 +--
 include/configs/nokia_rx51.h  |  5 ++--
 include/i8042.h   |  6 +++--
 include/stdio_dev.h   | 15 ++-
 include/video.h   |  8 +++---
 30 files changed, 189 insertions(+), 101 deletions(-)

diff --git a/arch/blackfin/cpu/jtag-console.c b/arch/blackfin/cpu/jtag-console.c
index 7cddb85..b8be318 100644
--- a/arch/blackfin/cpu/jtag-console.c
+++ b/arch/blackfin/cpu/jtag-console.c
@@ -112,11 +112,11 @@ static void jtag_send(const char *raw_str, uint32_t len)
if (cooked_str != raw_str)
free((char *)cooked_str);
 }
-static void jtag_putc(const char c)
+static void jtag_putc(struct stdio_dev *dev, const char c)
 {
jtag_send(&c, 1);
 }
-static void jtag_puts(const char *s)
+static void jtag_puts(struct stdio_dev *dev, const char *s)
 {
jtag_send(s, strlen(s));
 }
@@ -133,7 +133,7 @@ static int jtag_tstc_dbg(void)
 }
 
 /* Higher layers want to know when any data is available */
-static int jtag_tstc(void)
+static int jtag_tstc(struct stdio_dev *dev)
 {
return jtag_tstc_dbg() || leftovers_len;
 }
@@ -142,7 +142,7 @@ static int jtag_tstc(void)
  * [32bit length][actual data]
  */
 static uint32_t leftovers;
-static int jtag_getc(void)
+static int jtag_getc(struct stdio_dev *dev)
 {
int ret;
uint32_t emudat;
@@ -173,7 +173,7 @@ static int jtag_getc(void)
leftovers = emudat;
}
 
-   return jtag_getc();
+   return jtag_getc(dev);
 }
 
 int drv_jtag_console_init(void)
diff --git a/arch/powerpc/cpu/mpc512x/serial.c 
b/arch/powerpc/cpu/mpc512x/serial.c
index 42e0dc9..4105a28 100644
--- a/arch/powerpc/cpu/mpc512x/serial.c
+++ b/arch/powerpc/cpu/mpc512x/serial.c
@@ -384,7 +384,7 @@ struct stdio_dev *open_port(int num, int baudrate)
sprintf(env_val, "%d", baudrate);
setenv(env_var, env_val);
 
-   if (port->start())
+   if (port->start(port))
return NULL;
 
set_bit(num, &initialized);
@@ -407,7 +407,7 @@ int close_port(int num)
if (!port)
return -1;
 
-   ret = port->stop();
+   ret = port->stop(port);
clear_bit(num, &initialized);
 
return ret;
@@ -418,7 +418,7 @@ int write_port(struct stdio_dev *port, char *buf)
if (!port || !buf)
return -1;
 
-   port->puts(buf);
+   port->puts(port, buf);
 
return 0;
 }
@@ -433,8 +433,8 @@ int read_port(struct stdio_dev *port, char *buf, int size)
if (!size)
return 0;
 
-   while (port->tstc()) {
-   buf[cnt++] = port->getc();
+   while (port->tstc(port)) {
+   bu

[U-Boot] [PATCH v2 09/29] dm: Support driver model prior to relocation

2014-07-08 Thread Simon Glass
Initialise devices marked 'pre-reloc' and make them available prior to
relocation. Note that this requires pre-reloc malloc() to be available.

Signed-off-by: Simon Glass 
---

Changes in v2:
- Minor reword to comment for dm_init_and_scan()

 common/board_f.c  | 16 
 common/board_r.c  | 25 -
 drivers/core/root.c   | 25 +
 include/asm-generic/global_data.h |  3 ++-
 include/dm/root.h | 13 +
 5 files changed, 60 insertions(+), 22 deletions(-)

diff --git a/common/board_f.c b/common/board_f.c
index b5e2031..8782c43 100644
--- a/common/board_f.c
+++ b/common/board_f.c
@@ -14,6 +14,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #if defined(CONFIG_CMD_IDE)
@@ -52,6 +53,7 @@
 #ifdef CONFIG_SANDBOX
 #include 
 #endif
+#include 
 #include 
 
 /*
@@ -787,6 +789,19 @@ static int initf_malloc(void)
return 0;
 }
 
+static int initf_dm(void)
+{
+#if defined(CONFIG_DM) && defined(CONFIG_SYS_MALLOC_F_LEN)
+   int ret;
+
+   ret = dm_init_and_scan(true);
+   if (ret)
+   return ret;
+#endif
+
+   return 0;
+}
+
 static init_fnc_t init_sequence_f[] = {
 #ifdef CONFIG_SANDBOX
setup_ram_buf,
@@ -845,6 +860,7 @@ static init_fnc_t init_sequence_f[] = {
init_timebase,
 #endif
initf_malloc,
+   initf_dm,
init_baud_rate, /* initialze baudrate settings */
serial_init,/* serial communications setup */
console_init_f, /* stage 1 init of console */
diff --git a/common/board_r.c b/common/board_r.c
index e43a318..a35ffa5 100644
--- a/common/board_r.c
+++ b/common/board_r.c
@@ -273,27 +273,10 @@ static int initr_malloc(void)
 #ifdef CONFIG_DM
 static int initr_dm(void)
 {
-   int ret;
-
-   ret = dm_init();
-   if (ret) {
-   debug("dm_init() failed: %d\n", ret);
-   return ret;
-   }
-   ret = dm_scan_platdata(false);
-   if (ret) {
-   debug("dm_scan_platdata() failed: %d\n", ret);
-   return ret;
-   }
-#ifdef CONFIG_OF_CONTROL
-   ret = dm_scan_fdt(gd->fdt_blob, false);
-   if (ret) {
-   debug("dm_scan_fdt() failed: %d\n", ret);
-   return ret;
-   }
-#endif
-
-   return 0;
+   /* Save the pre-reloc driver model and start a new one */
+   gd->dm_root_f = gd->dm_root;
+   gd->dm_root = NULL;
+   return dm_init_and_scan(false);
 }
 #endif
 
diff --git a/drivers/core/root.c b/drivers/core/root.c
index c75b60f..9a7df11 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -104,6 +104,31 @@ int dm_scan_fdt(const void *blob, bool pre_reloc_only)
 }
 #endif
 
+int dm_init_and_scan(bool pre_reloc_only)
+{
+   int ret;
+
+   ret = dm_init();
+   if (ret) {
+   debug("dm_init() failed: %d\n", ret);
+   return ret;
+   }
+   ret = dm_scan_platdata(pre_reloc_only);
+   if (ret) {
+   debug("dm_scan_platdata() failed: %d\n", ret);
+   return ret;
+   }
+#ifdef CONFIG_OF_CONTROL
+   ret = dm_scan_fdt(gd->fdt_blob, pre_reloc_only);
+   if (ret) {
+   debug("dm_scan_fdt() failed: %d\n", ret);
+   return ret;
+   }
+#endif
+
+   return 0;
+}
+
 /* This is the root driver - all drivers are children of this */
 U_BOOT_DRIVER(root_driver) = {
.name   = "root_driver",
diff --git a/include/asm-generic/global_data.h 
b/include/asm-generic/global_data.h
index f6a2a20..edde9d7 100644
--- a/include/asm-generic/global_data.h
+++ b/include/asm-generic/global_data.h
@@ -65,7 +65,8 @@ typedef struct global_data {
struct global_data *new_gd; /* relocated global data */
 
 #ifdef CONFIG_DM
-   struct udevice  *dm_root;/* Root instance for Driver Model */
+   struct udevice  *dm_root;   /* Root instance for Driver Model */
+   struct udevice  *dm_root_f; /* Pre-relocation root instance */
struct list_head uclass_root;   /* Head of core tree */
 #endif
 
diff --git a/include/dm/root.h b/include/dm/root.h
index d37b452..09f9303 100644
--- a/include/dm/root.h
+++ b/include/dm/root.h
@@ -45,6 +45,19 @@ int dm_scan_platdata(bool pre_reloc_only);
 int dm_scan_fdt(const void *blob, bool pre_reloc_only);
 
 /**
+ * dm_init_and_scan() - Initialise Driver Model structures and scan for devices
+ *
+ * This function initialises the roots of the driver tree and uclass trees,
+ * then scans and binds available devices from platform data and the FDT.
+ * This calls dm_init() to set up Driver Model structures.
+ *
+ * @pre_reloc_only: If true, bind only drivers with the DM_FLAG_PRE_RELOC
+ * flag. If false bind all drivers.
+ * @return 0 if OK, -ve on error
+ */
+int dm_init_and_scan(bool pre_reloc_only);
+
+/**
  * dm_init() - Initialise Driver Model structures
  *
  * This function will initialize roots of dr

[U-Boot] [PATCH v2 13/29] dm: Move uclass error checking/probing into a function

2014-07-08 Thread Simon Glass
Several functions will use this same pattern, so bring it into a function.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 drivers/core/uclass.c | 28 ++--
 1 file changed, 22 insertions(+), 6 deletions(-)

diff --git a/drivers/core/uclass.c b/drivers/core/uclass.c
index 34723ec..db91526 100644
--- a/drivers/core/uclass.c
+++ b/drivers/core/uclass.c
@@ -158,13 +158,19 @@ int uclass_find_device(enum uclass_id id, int index, 
struct udevice **devp)
return -ENODEV;
 }
 
-int uclass_get_device(enum uclass_id id, int index, struct udevice **devp)
+/**
+ * uclass_get_device_tail() - handle the end of a get_device call
+ *
+ * This handles returning an error or probing a device as needed.
+ *
+ * @dev: Device that needs to be probed
+ * @ret: Error to return. If non-zero then the device is not probed
+ * @devp: Returns the value of 'dev' if there is no error
+ * @return ret, if non-zero, else the result of the device_probe() call
+ */
+static int uclass_get_device_tail(struct udevice *dev, int ret,
+ struct udevice **devp)
 {
-   struct udevice *dev;
-   int ret;
-
-   *devp = NULL;
-   ret = uclass_find_device(id, index, &dev);
if (ret)
return ret;
 
@@ -177,6 +183,16 @@ int uclass_get_device(enum uclass_id id, int index, struct 
udevice **devp)
return 0;
 }
 
+int uclass_get_device(enum uclass_id id, int index, struct udevice **devp)
+{
+   struct udevice *dev;
+   int ret;
+
+   *devp = NULL;
+   ret = uclass_find_device(id, index, &dev);
+   return uclass_get_device_tail(dev, ret, devp);
+}
+
 int uclass_first_device(enum uclass_id id, struct udevice **devp)
 {
struct uclass *uc;
-- 
2.0.0.526.g5318336

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


[U-Boot] [PATCH v2 16/29] dm: Avoid activating devices in 'dm uclass' command

2014-07-08 Thread Simon Glass
This command currently activates devices as it lists them. This is not
desirable since it changes the system state. Fix it and avoid printing
a newline if there are no devices in a uclass.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 test/dm/cmd_dm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/test/dm/cmd_dm.c b/test/dm/cmd_dm.c
index 9b77a7f..93e5255 100644
--- a/test/dm/cmd_dm.c
+++ b/test/dm/cmd_dm.c
@@ -94,9 +94,9 @@ static int do_dm_dump_uclass(cmd_tbl_t *cmdtp, int flag, int 
argc,
continue;
 
printf("uclass %d: %s\n", id, uc->uc_drv->name);
-   for (ret = uclass_first_device(id, &dev);
-dev;
-ret = uclass_next_device(&dev)) {
+   if (list_empty(&uc->dev_head))
+   continue;
+   list_for_each_entry(dev, &uc->dev_head, uclass_node) {
dm_display_line(dev, "");
}
puts("\n");
-- 
2.0.0.526.g5318336

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


[U-Boot] [PATCH v2 15/29] dm: Move device display into its own function

2014-07-08 Thread Simon Glass
The device display for 'dm tree' and 'dm uclass' is mostly the same, so
move it into a common function.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 test/dm/cmd_dm.c | 27 +++
 1 file changed, 19 insertions(+), 8 deletions(-)

diff --git a/test/dm/cmd_dm.c b/test/dm/cmd_dm.c
index 96f10f3..9b77a7f 100644
--- a/test/dm/cmd_dm.c
+++ b/test/dm/cmd_dm.c
@@ -16,6 +16,22 @@
 #include 
 #include 
 
+/**
+ * dm_display_line() - Display information about a single device
+ *
+ * Displays a single line of information with an option prefix
+ *
+ * @dev:   Device to display
+ * @buf:   Prefix to display at the start of the line
+ */
+static void dm_display_line(struct udevice *dev, char *buf)
+{
+   printf("%s- %c %s @ %08lx", buf,
+  dev->flags & DM_FLAG_ACTIVATED ? '*' : ' ',
+  dev->name, (ulong)map_to_sysmem(dev));
+   puts("\n");
+}
+
 static int display_succ(struct udevice *in, char *buf)
 {
int len;
@@ -23,10 +39,7 @@ static int display_succ(struct udevice *in, char *buf)
char local[16];
struct udevice *pos, *n, *prev = NULL;
 
-   printf("%s- %c %s @ %08lx", buf,
-  in->flags & DM_FLAG_ACTIVATED ? '*' : ' ',
-  in->name, (ulong)map_to_sysmem(in));
-   puts("\n");
+   dm_display_line(in, buf);
 
if (list_empty(&in->child_head))
return 0;
@@ -84,9 +97,7 @@ static int do_dm_dump_uclass(cmd_tbl_t *cmdtp, int flag, int 
argc,
for (ret = uclass_first_device(id, &dev);
 dev;
 ret = uclass_next_device(&dev)) {
-   printf("  %c %s @ %08lx:\n",
-  dev->flags & DM_FLAG_ACTIVATED ? '*' : ' ',
-  dev->name, (ulong)map_to_sysmem(dev));
+   dm_display_line(dev, "");
}
puts("\n");
}
@@ -135,7 +146,7 @@ static int do_dm(cmd_tbl_t *cmdtp, int flag, int argc, char 
* const argv[])
 U_BOOT_CMD(
dm, 2,  1,  do_dm,
"Driver model low level access",
-   "tree Dump driver model tree\n"
+   "tree Dump driver model tree ('*' = activated)\n"
"dm uclassDump list of instances for each uclass"
TEST_HELP
 );
-- 
2.0.0.526.g5318336

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


[U-Boot] [PATCH v2 03/29] stdio: Remove redundant code around stdio_register() calls

2014-07-08 Thread Simon Glass
There is no point in setting a structure's memory to NULL when it has
already been zeroed with memset().

Also, there is no need to create a stub function for stdio to call - if the
function is NULL it will not be called.

This is a clean-up, with no change in functionality.

Signed-off-by: Simon Glass 
Acked-by: Marek Vasut 
---

Changes in v2:
- Remove change to board/rbc823/kbd.c, since it has been deleted
- Reformat commit message slightly

 arch/x86/lib/video.c|  4 
 board/bf527-ezkit/video.c   | 10 --
 board/bf548-ezkit/video.c   | 10 --
 board/cm-bf548/video.c  | 10 --
 board/mpl/common/kbd.c  |  2 --
 common/usb_kbd.c|  2 --
 drivers/input/keyboard.c|  2 --
 drivers/video/cfb_console.c |  2 --
 8 files changed, 42 deletions(-)

diff --git a/arch/x86/lib/video.c b/arch/x86/lib/video.c
index dfd2a84..eb9c595 100644
--- a/arch/x86/lib/video.c
+++ b/arch/x86/lib/video.c
@@ -178,8 +178,6 @@ int video_init(void)
vga_dev.flags = DEV_FLAGS_OUTPUT | DEV_FLAGS_SYSTEM;
vga_dev.putc  = video_putc;/* 'putc' function */
vga_dev.puts  = video_puts;/* 'puts' function */
-   vga_dev.tstc  = NULL;  /* 'tstc' function */
-   vga_dev.getc  = NULL;  /* 'getc' function */
 
if (stdio_register(&vga_dev) == 0)
return 1;
@@ -191,8 +189,6 @@ int video_init(void)
strcpy(kbd_dev.name, "kbd");
kbd_dev.ext   = 0;
kbd_dev.flags = DEV_FLAGS_INPUT | DEV_FLAGS_SYSTEM;
-   kbd_dev.putc  = NULL;/* 'putc' function */
-   kbd_dev.puts  = NULL;/* 'puts' function */
kbd_dev.tstc  = i8042_tstc;  /* 'tstc' function */
kbd_dev.getc  = i8042_getc;  /* 'getc' function */
 
diff --git a/board/bf527-ezkit/video.c b/board/bf527-ezkit/video.c
index 5d8a091..c2bf145 100644
--- a/board/bf527-ezkit/video.c
+++ b/board/bf527-ezkit/video.c
@@ -391,14 +391,6 @@ void video_stop(void)
 #endif
 }
 
-void video_putc(const char c)
-{
-}
-
-void video_puts(const char *s)
-{
-}
-
 int drv_video_init(void)
 {
int error, devices = 1;
@@ -448,8 +440,6 @@ int drv_video_init(void)
strcpy(videodev.name, "video");
videodev.ext = DEV_EXT_VIDEO;   /* Video extensions */
videodev.flags = DEV_FLAGS_SYSTEM;  /* No Output */
-   videodev.putc = video_putc; /* 'putc' function */
-   videodev.puts = video_puts; /* 'puts' function */
 
error = stdio_register(&videodev);
 
diff --git a/board/bf548-ezkit/video.c b/board/bf548-ezkit/video.c
index 6737ac1..47e68c6 100644
--- a/board/bf548-ezkit/video.c
+++ b/board/bf548-ezkit/video.c
@@ -281,14 +281,6 @@ static void dma_bitblit(void *dst, fastimage_t *logo, int 
x, int y)
 
 }
 
-void video_putc(const char c)
-{
-}
-
-void video_puts(const char *s)
-{
-}
-
 int drv_video_init(void)
 {
int error, devices = 1;
@@ -338,8 +330,6 @@ int drv_video_init(void)
strcpy(videodev.name, "video");
videodev.ext = DEV_EXT_VIDEO;   /* Video extensions */
videodev.flags = DEV_FLAGS_SYSTEM;  /* No Output */
-   videodev.putc = video_putc; /* 'putc' function */
-   videodev.puts = video_puts; /* 'puts' function */
 
error = stdio_register(&videodev);
 
diff --git a/board/cm-bf548/video.c b/board/cm-bf548/video.c
index c35d285..b098615 100644
--- a/board/cm-bf548/video.c
+++ b/board/cm-bf548/video.c
@@ -283,14 +283,6 @@ static void dma_bitblit(void *dst, fastimage_t *logo, int 
x, int y)
 
 }
 
-void video_putc(const char c)
-{
-}
-
-void video_puts(const char *s)
-{
-}
-
 int drv_video_init(void)
 {
int error, devices = 1;
@@ -342,8 +334,6 @@ int drv_video_init(void)
strcpy(videodev.name, "video");
videodev.ext = DEV_EXT_VIDEO;   /* Video extensions */
videodev.flags = DEV_FLAGS_SYSTEM;  /* No Output */
-   videodev.putc = video_putc; /* 'putc' function */
-   videodev.puts = video_puts; /* 'puts' function */
 
error = stdio_register(&videodev);
 
diff --git a/board/mpl/common/kbd.c b/board/mpl/common/kbd.c
index 1b5487b..f56545e 100644
--- a/board/mpl/common/kbd.c
+++ b/board/mpl/common/kbd.c
@@ -204,8 +204,6 @@ int drv_isa_kbd_init (void)
memset (&kbddev, 0, sizeof(kbddev));
strcpy(kbddev.name, DEVNAME);
kbddev.flags =  DEV_FLAGS_INPUT | DEV_FLAGS_SYSTEM;
-   kbddev.putc = NULL ;
-   kbddev.puts = NULL ;
kbddev.getc = kbd_getc ;
kbddev.tstc = kbd_testc ;
 
diff --git a/common/usb_kbd.c b/common/usb_kbd.c
index 0b77c16..371e5bc 100644
--- a/common/usb_kbd.c
+++ b/common/usb_kbd.c
@@ -522,8 +522,6 @@ int drv_usb_kbd_init(void)
memset(&usb_kbd_dev, 0, sizeof(struct stdio_dev));
strcpy(usb_kbd_dev.name, DEVNAME);
usb_kbd_dev.flags =  DEV_FLAGS_INPUT | DEV_FLAGS_SYSTEM;
-   usb_kbd_dev.putc = NULL;
-   usb_kbd_dev.puts = NULL;
  

[U-Boot] [PATCH v2 02/29] dm: Use an explicit expect value in core tests

2014-07-08 Thread Simon Glass
Rather than reusing the 'reg' property, use an explicit property for the
expected ping value used in testing.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 test/dm/test-fdt.c | 13 -
 test/dm/test.dts   |  5 -
 2 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/test/dm/test-fdt.c b/test/dm/test-fdt.c
index 98e3936..0f50537 100644
--- a/test/dm/test-fdt.c
+++ b/test/dm/test-fdt.c
@@ -39,7 +39,8 @@ static int testfdt_ofdata_to_platdata(struct udevice *dev)
 
pdata->ping_add = fdtdec_get_int(gd->fdt_blob, dev->of_offset,
"ping-add", -1);
-   pdata->base = fdtdec_get_addr(gd->fdt_blob, dev->of_offset, "reg");
+   pdata->base = fdtdec_get_addr(gd->fdt_blob, dev->of_offset,
+ "ping-expect");
 
return 0;
 }
@@ -127,11 +128,13 @@ static int dm_test_fdt(struct dm_test_state *dms)
ut_assert(!ret);
 
/*
-* Get the 'reg' property, which tells us what the ping add
-* should be. We don't use the platdata because we want
-* to test the code that sets that up (testfdt_drv_probe()).
+* Get the 'ping-expect' property, which tells us what the
+* ping add should be. We don't use the platdata because we
+* want to test the code that sets that up
+* (testfdt_drv_probe()).
 */
-   base = fdtdec_get_addr(gd->fdt_blob, dev->of_offset, "reg");
+   base = fdtdec_get_addr(gd->fdt_blob, dev->of_offset,
+  "ping-expect");
debug("dev=%d, base=%d: %s\n", i, base,
  fdt_get_name(gd->fdt_blob, dev->of_offset, NULL));
 
diff --git a/test/dm/test.dts b/test/dm/test.dts
index ec5364f..74d236b 100644
--- a/test/dm/test.dts
+++ b/test/dm/test.dts
@@ -9,6 +9,7 @@
a-test {
reg = <0>;
compatible = "denx,u-boot-fdt-test";
+   ping-expect = <0>;
ping-add = <0>;
};
 
@@ -24,13 +25,14 @@
b-test {
reg = <3>;
compatible = "denx,u-boot-fdt-test";
+   ping-expect = <3>;
ping-add = <3>;
};
 
some-bus {
#address-cells = <1>;
#size-cells = <0>;
-   reg = <4>;
+   ping-expect = <4>;
ping-add = <4>;
c-test {
compatible = "denx,u-boot-fdt-test";
@@ -41,6 +43,7 @@
 
d-test {
reg = <6>;
+   ping-expect = <6>;
ping-add = <6>;
compatible = "google,another-fdt-test";
};
-- 
2.0.0.526.g5318336

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


[U-Boot] [PATCH v2 05/29] dm: Make sure that the root device is probed

2014-07-08 Thread Simon Glass
The root device should be probed just like any other device. The effect of
this is to mark the device as activated, so that it can be removed (along
with its children) if required.

Signed-off-by: Simon Glass 
Acked-by: Marek Vasut 
---

Changes in v2: None

 drivers/core/root.c | 3 +++
 test/dm/core.c  | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/core/root.c b/drivers/core/root.c
index 1cbb096..bc76370 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -48,6 +48,9 @@ int dm_init(void)
ret = device_bind_by_name(NULL, &root_info, &DM_ROOT_NON_CONST);
if (ret)
return ret;
+   ret = device_probe(DM_ROOT_NON_CONST);
+   if (ret)
+   return ret;
 
return 0;
 }
diff --git a/test/dm/core.c b/test/dm/core.c
index be3646b..8c18780 100644
--- a/test/dm/core.c
+++ b/test/dm/core.c
@@ -106,7 +106,7 @@ static int dm_test_autoprobe(struct dm_test_state *dms)
ut_asserteq(0, dm_testdrv_op_count[DM_TEST_OP_POST_PROBE]);
 
/* The root device should not be activated until needed */
-   ut_assert(!(dms->root->flags & DM_FLAG_ACTIVATED));
+   ut_assert(dms->root->flags & DM_FLAG_ACTIVATED);
 
/*
 * We should be able to find the three test devices, and they should
-- 
2.0.0.526.g5318336

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


[U-Boot] [PATCH v2 07/29] sandbox: Remove all drivers before exit

2014-07-08 Thread Simon Glass
Drivers are supposed to be able to close down cleanly. To set a good example,
make sandbox shut down its driver model drivers and remove them before exit.

It may be desirable to do the same more generally once driver model is more
widely-used. This could be done during bootm, before U-Boot jumps to the OS.
It seems far too early to make this change.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 arch/sandbox/cpu/cpu.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/sandbox/cpu/cpu.c b/arch/sandbox/cpu/cpu.c
index 3f4005b..1aa397c 100644
--- a/arch/sandbox/cpu/cpu.c
+++ b/arch/sandbox/cpu/cpu.c
@@ -4,6 +4,7 @@
  */
 
 #include 
+#include 
 #include 
 #include 
 
@@ -14,6 +15,9 @@ void reset_cpu(ulong ignored)
if (state_uninit())
os_exit(2);
 
+   if (dm_uninit())
+   os_exit(2);
+
/* This is considered normal termination for now */
os_exit(0);
 }
-- 
2.0.0.526.g5318336

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


[U-Boot] [PATCH v2 28/29] dm: Add dm_scan_other() to locate board-specific devices

2014-07-08 Thread Simon Glass
Some boards will have devices which are not in the device tree and do not
have platform data. They may be programnatically created, for example.
Add a hook which boards can use to bind those devices early in boot.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 drivers/core/root.c |  8 
 include/dm/root.h   | 13 +
 2 files changed, 21 insertions(+)

diff --git a/drivers/core/root.c b/drivers/core/root.c
index bb535e0..1ad6c54 100644
--- a/drivers/core/root.c
+++ b/drivers/core/root.c
@@ -108,6 +108,11 @@ int dm_scan_fdt(const void *blob, bool pre_reloc_only)
 }
 #endif
 
+__weak int dm_scan_other(bool pre_reloc_only)
+{
+   return 0;
+}
+
 int dm_init_and_scan(bool pre_reloc_only)
 {
int ret;
@@ -129,6 +134,9 @@ int dm_init_and_scan(bool pre_reloc_only)
return ret;
}
 #endif
+   ret = dm_scan_other(pre_reloc_only);
+   if (ret)
+   return ret;
 
return 0;
 }
diff --git a/include/dm/root.h b/include/dm/root.h
index 33f951b..c7f0c1d 100644
--- a/include/dm/root.h
+++ b/include/dm/root.h
@@ -62,6 +62,19 @@ int dm_scan_fdt_node(struct udevice *parent, const void 
*blob, int offset,
 bool pre_reloc_only);
 
 /**
+ * dm_scan_other() - Scan for other devices
+ *
+ * Some devices may not be visible to Driver Model. This weak function can
+ * be provided by boards which wish to create their own devices
+ * programmaticaly. They should do this by calling device_bind() on each
+ * device.
+ *
+ * @pre_reloc_only: If true, bind only drivers with the DM_FLAG_PRE_RELOC
+ * flag. If false bind all drivers.
+ */
+int dm_scan_other(bool pre_reloc_only);
+
+/**
  * dm_init_and_scan() - Initialise Driver Model structures and scan for devices
  *
  * This function initialises the roots of the driver tree and uclass trees,
-- 
2.0.0.526.g5318336

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


[U-Boot] [PATCH v2 17/29] dm: Introduce device sequence numbering

2014-07-08 Thread Simon Glass
In U-Boot it is pretty common to number devices from 0 and access them
on the command line using this numbering. While it may come to pass that
we will move away from this numbering, the possibility seems remote at
present.

Given that devices within a uclass will have an implied numbering, it
makes sense to build this into driver model as a core feature. The cost
is fairly small in terms of code and data space.

With each uclass having numbered devices we can ask for SPI port 0 or
serial port 1 and receive a single device.

Devices typically request a sequence number using aliases in the device
tree. These are resolved when the device is probed, to deal with conflicts.
Sequence numbers need not be sequential and holes are permitted.

At present there is no support for sequence numbers using static platform
data. It could easily be added to 'struct driver_info' if needed, but it
seems better to add features as we find a use for them, and the use of -1
to mean 'no sequence' makes the default value somewhat painful.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 doc/driver-model/README.txt  | 101 ---
 drivers/core/device.c|  28 
 drivers/core/uclass.c|  78 +
 include/dm/device.h  |  29 +
 include/dm/uclass-internal.h |  23 ++
 include/dm/uclass.h  |  31 +
 test/dm/test-fdt.c   |  54 ++-
 test/dm/test.dts |  11 -
 8 files changed, 347 insertions(+), 8 deletions(-)

diff --git a/doc/driver-model/README.txt b/doc/driver-model/README.txt
index 4858281..4ac6287 100644
--- a/doc/driver-model/README.txt
+++ b/doc/driver-model/README.txt
@@ -95,12 +95,16 @@ are provided in test/dm. To run them, try:
 You should see something like this:
 
 <...U-Boot banner...>
-Running 14 driver model tests
+Running 15 driver model tests
 Test: dm_test_autobind
 Test: dm_test_autoprobe
 Test: dm_test_children
 Test: dm_test_fdt
+Device 'd-test': seq 3 is in use by 'b-test'
 Test: dm_test_fdt_pre_reloc
+Test: dm_test_fdt_uclass_seq
+Device 'd-test': seq 3 is in use by 'b-test'
+Device 'a-test': seq 0 is in use by 'd-test'
 Test: dm_test_gpio
 sandbox_gpio: sb_gpio_get_value: error: offset 4 not reserved
 Test: dm_test_leak
@@ -339,6 +343,80 @@ numbering comes from include/dm/uclass.h. To add a new 
uclass, add to the
 end of the enum there, then declare your uclass as above.
 
 
+Device Sequence Numbers
+---
+
+U-Boot numbers devices from 0 in many situations, such as in the command
+line for I2C and SPI buses, and the device names for serial ports (serial0,
+serial1, ...). Driver model supports this numbering and permits devices
+to be locating by their 'sequence'.
+
+Sequence numbers start from 0 but gaps are permitted. For example, a board
+may have I2C buses 0, 1, 4, 5 but no 2 or 3. The choice of how devices are
+numbered is up to a particular board, and may be set by the SoC in some
+cases. While it might be tempting to automatically renumber the devices
+where there are gaps in the sequence, this can lead to confusion and is
+not the way that U-Boot works.
+
+Each device can request a sequence number. If none is required then the
+device will be automatically allocated the next available sequence number.
+
+To specify the sequence number in the device tree an alias is typically
+used.
+
+aliases {
+   serial2 = "/serial@2223";
+};
+
+This indicates that in the uclass called "serial", the named node
+("/serial@2223") will be given sequence number 2. Any command or driver
+which requests serial device 2 will obtain this device.
+
+Some devices represent buses where the devices on the bus are numbered or
+addressed. For example, SPI typically numbers its slaves from 0, and I2C
+uses a 7-bit address. In these cases the 'reg' property of the subnode is
+used, for example:
+
+{
+   aliases {
+   spi2 = "/spi@2230";
+   };
+
+   spi@2230 {
+   #address-cells = <1>;
+   #size-cells = <1>;
+   spi-flash@0 {
+   reg = <0>;
+   ...
+   }
+   eeprom@1 {
+   reg = <1>;
+   };
+   };
+
+In this case we have a SPI bus with two slaves at 0 and 1. The SPI bus
+itself is numbered 2. So we might access the SPI flash with:
+
+   sf probe 2:0
+
+and the eeprom with
+
+   sspi 2:1 32 ef
+
+These commands simply need to look up the 2nd device in the SPI uclass to
+find the right SPI bus. Then, they look at the children of that bus for the
+right sequence number (0 or 1 in this case).
+
+Typically the alias method is used for top-level nodes and the 'reg' method
+is used only for buses.
+
+Device sequence numbers are resolved when a device is probed. Before then
+the sequence number is only

[U-Boot] [PATCH v2 21/29] fdt: Add a function to get the node offset of an alias

2014-07-08 Thread Simon Glass
This simple function returns the node offset of a named alias.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 include/fdtdec.h | 11 +++
 lib/fdtdec.c | 15 +++
 2 files changed, 26 insertions(+)

diff --git a/include/fdtdec.h b/include/fdtdec.h
index f454f7e..856e6cf 100644
--- a/include/fdtdec.h
+++ b/include/fdtdec.h
@@ -363,6 +363,17 @@ int fdtdec_add_aliases_for_id(const void *blob, const char 
*name,
 int fdtdec_get_alias_seq(const void *blob, const char *base, int node,
 int *seqp);
 
+/**
+ * Get the offset of the given alias node
+ *
+ * This looks up an alias in /aliases then finds the offset of that node.
+ *
+ * @param blob Device tree blob (if NULL, then error is returned)
+ * @param name Alias name, e.g. "console"
+ * @return Node offset referred to by that alias, or -ve FDT_ERR_...
+ */
+int fdtdec_get_alias_node(const void *blob, const char *name);
+
 /*
  * Get the name for a compatible ID
  *
diff --git a/lib/fdtdec.c b/lib/fdtdec.c
index 1b4ae9f..eb5aa20 100644
--- a/lib/fdtdec.c
+++ b/lib/fdtdec.c
@@ -365,6 +365,21 @@ int fdtdec_get_alias_seq(const void *blob, const char 
*base, int offset,
return -ENOENT;
 }
 
+int fdtdec_get_alias_node(const void *blob, const char *name)
+{
+   const char *prop;
+   int alias_node;
+   int len;
+
+   if (!blob)
+   return -FDT_ERR_NOTFOUND;
+   alias_node = fdt_path_offset(blob, "/aliases");
+   prop = fdt_getprop(blob, alias_node, name, &len);
+   if (!prop)
+   return -FDT_ERR_NOTFOUND;
+   return fdt_path_offset(blob, prop);
+}
+
 int fdtdec_check_fdt(void)
 {
/*
-- 
2.0.0.526.g5318336

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


[U-Boot] [PATCH v2 01/29] dm: gpio: Don't use the driver model uclass for SPL

2014-07-08 Thread Simon Glass
Driver model does not support SPL yet, so we should not use the GPIO
uclass for SPL.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 drivers/gpio/Makefile | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/gpio/Makefile b/drivers/gpio/Makefile
index 4e001e1..fb8dcd9 100644
--- a/drivers/gpio/Makefile
+++ b/drivers/gpio/Makefile
@@ -5,7 +5,9 @@
 # SPDX-License-Identifier: GPL-2.0+
 #
 
+ifndef CONFIG_SPL_BUILD
 obj-$(CONFIG_DM_GPIO)  += gpio-uclass.o
+endif
 
 obj-$(CONFIG_AT91_GPIO)+= at91_gpio.o
 obj-$(CONFIG_INTEL_ICH6_GPIO)  += intel_ich6_gpio.o
-- 
2.0.0.526.g5318336

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


[U-Boot] [PATCH v2 22/29] dm: Tidy up some header file comments

2014-07-08 Thread Simon Glass
Fix up the style of a few comments and add/clarify a few others.

Signed-off-by: Simon Glass 
---

Changes in v2: None

 include/dm/device.h|  2 +-
 include/dm/platdata.h  | 10 --
 include/dm/root.h  |  3 ++-
 include/dm/uclass-id.h |  2 +-
 include/dm/uclass.h|  2 +-
 5 files changed, 13 insertions(+), 6 deletions(-)

diff --git a/include/dm/device.h b/include/dm/device.h
index 6005e7e..9077490 100644
--- a/include/dm/device.h
+++ b/include/dm/device.h
@@ -124,7 +124,7 @@ struct udevice_id {
  * This is typically only useful for device-tree-aware drivers (those with
  * an of_match), since drivers which use platdata will have the data
  * provided in the U_BOOT_DEVICE() instantiation.
- * ops: Driver-specific operations. This is typically a list of function
+ * @ops: Driver-specific operations. This is typically a list of function
  * pointers defined by the driver, to implement driver functions required by
  * the uclass.
  * @flags: driver flags - see DM_FLAGS_...
diff --git a/include/dm/platdata.h b/include/dm/platdata.h
index 0ef3353..2bc8b14 100644
--- a/include/dm/platdata.h
+++ b/include/dm/platdata.h
@@ -11,9 +11,15 @@
 #ifndef _DM_PLATDATA_H
 #define _DM_PLATDATA_H
 
+/**
+ * struct driver_info - Information required to instantiate a device
+ *
+ * @name:  Device name
+ * @platdata:  Driver-specific platform data
+ */
 struct driver_info {
-   const char  *name;
-   const void  *platdata;
+   const char *name;
+   const void *platdata;
 };
 
 #define U_BOOT_DEVICE(__name)  \
diff --git a/include/dm/root.h b/include/dm/root.h
index 09f9303..02c7788 100644
--- a/include/dm/root.h
+++ b/include/dm/root.h
@@ -35,7 +35,8 @@ int dm_scan_platdata(bool pre_reloc_only);
 /**
  * dm_scan_fdt() - Scan the device tree and bind drivers
  *
- * This scans the device tree and creates a driver for each node
+ * This scans the device tree and creates a driver for each node. Only
+ * the top-level subnodes are examined.
  *
  * @blob: Pointer to device tree blob
  * @pre_reloc_only: If true, bind only drivers with the DM_FLAG_PRE_RELOC
diff --git a/include/dm/uclass-id.h b/include/dm/uclass-id.h
index f0e691c..77ff9ea 100644
--- a/include/dm/uclass-id.h
+++ b/include/dm/uclass-id.h
@@ -19,7 +19,7 @@ enum uclass_id {
UCLASS_TEST_FDT,
 
/* U-Boot uclasses start here */
-   UCLASS_GPIO,
+   UCLASS_GPIO,/* Bank of general-purpose I/O pins */
 
UCLASS_COUNT,
UCLASS_INVALID = -1,
diff --git a/include/dm/uclass.h b/include/dm/uclass.h
index 0b5ade6..8d09ecf 100644
--- a/include/dm/uclass.h
+++ b/include/dm/uclass.h
@@ -98,7 +98,7 @@ int uclass_get(enum uclass_id key, struct uclass **ucp);
  *
  * The device is probed to activate it ready for use.
  *
- * id: ID to look up
+ * @id: ID to look up
  * @index: Device number within that uclass (0=first)
  * @devp: Returns pointer to device (there is only one per for each ID)
  * @return 0 if OK, -ve on error
-- 
2.0.0.526.g5318336

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


[U-Boot] [PATCH v2 0/29] Add additional core driver model features

2014-07-08 Thread Simon Glass
This series includes a number of base driver model enhancements, mostly
targeted at pre-relocation and to enable buses to be easily implemented.

With the device tree, child nodes for buses can now be scanned to create
child devices, and bus-related information about each child can be
stored. Children can be numbered as a core driver model feature in U-Boot
(e.g. SPI bus 0 chip select 3).

Driver model now supports operation prior to relocation, assuming a
suitable malloc() implementation is available.

Several changes are added to permit driver model to be available early
after relocation, since we are unable to access any device until driver
model is ready.

This series is available at u-boot-dm.git branch 'working'.

Changes in v2:
- Remove change to board/rbc823/kbd.c, since it has been deleted
- Reformat commit message slightly
- Remove changes to deleted board/netphone/phone_console.c board/rbc823/kbd.c
- Rename struct device to struct udevice
- Update test output in doc/driver-model/README.txt
- Minor reword to comment for dm_init_and_scan()
- Return -ENODEV instead of -1 on error
- Improve wording in commit message
- Improve wording in commit message
- Expand series to include all driver-model-required changes

Simon Glass (29):
  dm: gpio: Don't use the driver model uclass for SPL
  dm: Use an explicit expect value in core tests
  stdio: Remove redundant code around stdio_register() calls
  stdio: Pass device pointer to stdio methods
  dm: Make sure that the root device is probed
  dm: Provide a way to shut down driver model
  sandbox: Remove all drivers before exit
  dm: Allow drivers to be marked 'before relocation'
  dm: Support driver model prior to relocation
  stdio: Provide functions to add/remove devices using stdio_dev
  console: Remove vprintf() optimisation for sandbox
  Add a flag indicating when the serial console is ready
  dm: Move uclass error checking/probing into a function
  fdt: Add a function to get the alias sequence of a node
  dm: Move device display into its own function
  dm: Avoid activating devices in 'dm uclass' command
  dm: Introduce device sequence numbering
  dm: Display the sequence number for each device
  dm: Allow a device to be found by its FDT offset
  dm: Avoid accessing uclasses before they are ready
  fdt: Add a function to get the node offset of an alias
  dm: Tidy up some header file comments
  dm: Provide a function to scan child FDT nodes
  dm: Add functions to access a device's children
  dm: Introduce per-child data for devices
  dm: Add child_pre_probe() and child_post_remove() methods
  dm: Improve errors and warnings in lists_bind_fdt()
  dm: Add dm_scan_other() to locate board-specific devices
  dm: Give the demo uclass a name

 arch/blackfin/cpu/jtag-console.c  |  10 +-
 arch/powerpc/cpu/mpc512x/serial.c |  10 +-
 arch/powerpc/cpu/mpc8xx/video.c   |   6 +-
 arch/sandbox/cpu/cpu.c|   4 +
 arch/x86/lib/video.c  |   8 +-
 board/bf527-ezkit/video.c |  10 --
 board/bf548-ezkit/video.c |  10 --
 board/cm-bf548/video.c|  10 --
 board/mpl/common/kbd.c|   6 +-
 board/mpl/common/kbd.h|   6 +-
 board/mpl/pati/pati.c |   8 +-
 board/nokia/rx51/rx51.c   |   6 +-
 common/board_f.c  |  16 +++
 common/board_r.c  |  25 +---
 common/cmd_log.c  |  11 +-
 common/console.c  |  24 ++--
 common/lcd.c  |  14 ++-
 common/stdio.c|  66 ---
 common/usb_kbd.c  |   6 +-
 doc/driver-model/README.txt   | 216 +++---
 drivers/core/device.c | 169 +-
 drivers/core/lists.c  |  22 +++-
 drivers/core/root.c   |  79 ++---
 drivers/core/uclass.c | 135 -
 drivers/demo/demo-uclass.c|   1 +
 drivers/gpio/Makefile |   2 +
 drivers/input/cros_ec_keyb.c  |   6 +-
 drivers/input/i8042.c |   4 +-
 drivers/input/keyboard.c  |   6 +-
 drivers/input/tegra-kbc.c |   6 +-
 drivers/misc/cbmem_console.c  |   6 +-
 drivers/net/netconsole.c  |  10 +-
 drivers/serial/serial.c   |  55 -
 drivers/serial/usbtty.c   |   8 +-
 drivers/video/cfb_console.c   |   8 +-
 include/asm-generic/global_data.h |   4 +-
 include/common.h  |   5 +
 include/configs/ELPPC.h   |   4 +-
 include/configs/MHPC.h|   4 +-
 include/configs/jadecpu.h |   4 +-
 include/configs/nokia_rx51.h  |   5 +-
 include/dm/device-internal.h  |   6 +-
 include/dm/device.h   | 120 ++-
 include/dm/lists.h|   2 +-
 include/dm/platdata.h |  10 +-
 include/dm/root.h |  61 +-
 include/dm/test.h |  22 
 include/dm/uclass-id.h|   3 +-
 include/dm/uclas

Re: [U-Boot] [PATCH] build: define CPU only when arch/${ARCH}/cpu/${CPU} exists

2014-07-08 Thread Masahiro Yamada
Hi Simon,


On Mon, 7 Jul 2014 16:44:36 -0600
Simon Glass  wrote:

> 
> But see question below.
> > diff --git a/mkconfig b/mkconfig
> > index 2bf5897..401f262 100755
> > --- a/mkconfig
> > +++ b/mkconfig
> > @@ -55,6 +55,11 @@ CONFIG_NAME="${7%_config}"
> >  arch="$2"
> >  cpu=`echo $3 | awk 'BEGIN {FS = ":"} ; {print $1}'`
> >  spl_cpu=`echo $3 | awk 'BEGIN {FS = ":"} ; {print $2}'`
> > +
> > +if [ "$cpu" = "-" ] ; then
> > +   cpu=
> > +fi
> > +
> >  if [ "$6" = "" ] ; then
> > board=
> >  elif [ "$6" = "-" ] ; then
> > @@ -114,10 +119,10 @@ fi
> >
> >  rm -f asm/arch
> >
> > -if [ -z "${soc}" ] ; then
> > -   ln -s ${LNPREFIX}arch-${cpu} asm/arch
> > -else
> > +if [ "${soc}" ] ; then
> 
> Will this work OK in dash? (or non-bash)
> 


Yes.
I am dash-user. :-)
This is working on dash too.



Best Regards
Masahiro Yamada

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


Re: [U-Boot] [U-Boot, v1, 3/3] ARM: omap: merge GPMC initialization code for all platform

2014-07-08 Thread Ash Charles
Hi Pekon,
On Mon, Jul 7, 2014 at 11:19 PM, Gupta, Pekon  wrote:
> Sorry seeing this bit late. Were you able to root cause the issue ?
Did you see http://patchwork.ozlabs.org/patch/356984/ ?
This resolves the issue for me but I'd welcome any feedback you have
on this fix.
...

> Also, the change in u-boot, should not affect the kernel.
> That means kernel's GPMC driver was depending on some pre-configured
> value, which is wrong.
> There were couple of fixes for SMSC controller pushed in 3.16 kernel,
> Are following in your tree ?
> fb677ef  t...@atomide.com  ARM: OMAP2+: Fix GPMC remap for devices using an 
> offset
> efe8072  t...@atomide.com  ARM: OMAP2+: Fix oops for GPMC free
Okay---I'd seen the breakage on both the standard 3.5 kernel for my
board (overo) as well as on the then-mainline version 3.15+ which is
why I dived into u-boot to find a fix.  I was likely missing these two
commits though!

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


Re: [U-Boot] [PATCH] am335x_evm / gumstix pepper: Correct DDR settings

2014-07-08 Thread Ash Charles
Works for me on the Pepper board.  Thanks for the fix!

Tested-By: Ash Charles 

On Mon, Jul 7, 2014 at 6:40 PM, Tom Rini  wrote:
> As noted by clang, we have been shifting certain values out of 32bit
> range when setting some DDR registers.  Upon further inspection these
> had been touching reserved fields (and having no impact).  These came in
> from historical bring-up code and can be discarded.  Similarly, we had
> been declaring some fields as 0 when they will be initialized that way.
> Tested on Beaglebone White.
>
> Reported-by: Jeroen Hofstee 
> Cc: Ash Charles 
> Signed-off-by: Tom Rini 
> ---
>  arch/arm/include/asm/arch-am33xx/ddr_defs.h |4 
>  board/gumstix/pepper/board.c|   30 
> +++
>  board/ti/am335x/board.c |   30 
> +++
>  3 files changed, 6 insertions(+), 58 deletions(-)
>
> diff --git a/arch/arm/include/asm/arch-am33xx/ddr_defs.h 
> b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
> index 4d89952..97bbfe2 100644
> --- a/arch/arm/include/asm/arch-am33xx/ddr_defs.h
> +++ b/arch/arm/include/asm/arch-am33xx/ddr_defs.h
> @@ -33,11 +33,7 @@
>  #define MT47H128M16RT25E_EMIF_SDCFG0x41805332
>  #define MT47H128M16RT25E_EMIF_SDREF0x081a
>  #define MT47H128M16RT25E_RATIO 0x80
> -#define MT47H128M16RT25E_INVERT_CLKOUT 0x00
>  #define MT47H128M16RT25E_RD_DQS0x12
> -#define MT47H128M16RT25E_WR_DQS0x00
> -#define MT47H128M16RT25E_PHY_WRLVL 0x00
> -#define MT47H128M16RT25E_PHY_GATELVL   0x00
>  #define MT47H128M16RT25E_PHY_WR_DATA   0x40
>  #define MT47H128M16RT25E_PHY_FIFO_WE   0x80
>  #define MT47H128M16RT25E_IOCTRL_VALUE  0x18B
> diff --git a/board/gumstix/pepper/board.c b/board/gumstix/pepper/board.c
> index 75aac49..f644f81 100644
> --- a/board/gumstix/pepper/board.c
> +++ b/board/gumstix/pepper/board.c
> @@ -34,41 +34,17 @@ DECLARE_GLOBAL_DATA_PTR;
>
>  #ifdef CONFIG_SPL_BUILD
>  static const struct ddr_data ddr2_data = {
> -   .datardsratio0 = ((MT47H128M16RT25E_RD_DQS<<30) |
> - (MT47H128M16RT25E_RD_DQS<<20) |
> - (MT47H128M16RT25E_RD_DQS<<10) |
> - (MT47H128M16RT25E_RD_DQS<<0)),
> -   .datawdsratio0 = ((MT47H128M16RT25E_WR_DQS<<30) |
> - (MT47H128M16RT25E_WR_DQS<<20) |
> - (MT47H128M16RT25E_WR_DQS<<10) |
> - (MT47H128M16RT25E_WR_DQS<<0)),
> -   .datawiratio0 = ((MT47H128M16RT25E_PHY_WRLVL<<30) |
> -(MT47H128M16RT25E_PHY_WRLVL<<20) |
> -(MT47H128M16RT25E_PHY_WRLVL<<10) |
> -(MT47H128M16RT25E_PHY_WRLVL<<0)),
> -   .datagiratio0 = ((MT47H128M16RT25E_PHY_GATELVL<<30) |
> -(MT47H128M16RT25E_PHY_GATELVL<<20) |
> -(MT47H128M16RT25E_PHY_GATELVL<<10) |
> -(MT47H128M16RT25E_PHY_GATELVL<<0)),
> -   .datafwsratio0 = ((MT47H128M16RT25E_PHY_FIFO_WE<<30) |
> - (MT47H128M16RT25E_PHY_FIFO_WE<<20) |
> - (MT47H128M16RT25E_PHY_FIFO_WE<<10) |
> - (MT47H128M16RT25E_PHY_FIFO_WE<<0)),
> -   .datawrsratio0 = ((MT47H128M16RT25E_PHY_WR_DATA<<30) |
> - (MT47H128M16RT25E_PHY_WR_DATA<<20) |
> - (MT47H128M16RT25E_PHY_WR_DATA<<10) |
> - (MT47H128M16RT25E_PHY_WR_DATA<<0)),
> +   .datardsratio0 = MT47H128M16RT25E_RD_DQS,
> +   .datafwsratio0 = MT47H128M16RT25E_PHY_FIFO_WE,
> +   .datawrsratio0 = MT47H128M16RT25E_PHY_WR_DATA,
>  };
>
>  static const struct cmd_control ddr2_cmd_ctrl_data = {
> .cmd0csratio = MT47H128M16RT25E_RATIO,
> -   .cmd0iclkout = MT47H128M16RT25E_INVERT_CLKOUT,
>
> .cmd1csratio = MT47H128M16RT25E_RATIO,
> -   .cmd1iclkout = MT47H128M16RT25E_INVERT_CLKOUT,
>
> .cmd2csratio = MT47H128M16RT25E_RATIO,
> -   .cmd2iclkout = MT47H128M16RT25E_INVERT_CLKOUT,
>  };
>
>  static const struct emif_regs ddr2_emif_reg_data = {
> diff --git a/board/ti/am335x/board.c b/board/ti/am335x/board.c
> index da780ed..d81eec9 100644
> --- a/board/ti/am335x/board.c
> +++ b/board/ti/am335x/board.c
> @@ -84,41 +84,17 @@ static int read_eeprom(struct am335x_baseboard_id *header)
>
>  #ifndef CONFIG_SKIP_LOWLEVEL_INIT
>  static const struct ddr_data ddr2_data = {
> -   .datardsratio0 = ((MT47H128M16RT25E_RD_DQS<<30) |
> - (MT47H128M16RT25E_RD_DQS<<20) |
> - (MT47H128M16RT25E_RD_DQS<<10) |
> - (MT47H128M16RT25E_RD_DQS<<0)),
> -   .datawdsratio0 = ((MT47H128M16RT25E_WR_DQS<<30) |
> - (MT47H128M16RT25E_WR_DQS<<20) |
> - (MT47H128M16RT25E_WR_DQS<<10) |
> - (MT47H128M16R

[U-Boot] Programming PHY firmware over MDIO

2014-07-08 Thread Danny Gale
We are working with the Broadcom BCM84834 PHY (4-port 10G-BASE-T) being 
controlled by a Freescale T4240. The 84834 needs firmware in order to 
operate. The device can either load its firmware from MDIO or from a SPI 
EEPROM. Once loaded via MDIO, the PHY can write its new firmware to 
EEPROM for future use.


Where is the appropriate place in u-boot to do this firmware download? 
Is it at the end of board_eth_init?


Is there a mechanism in place to do this kind of firmware load already? 
I didn't see one looking through the code.


Thanks,
Danny Gale
daniel.g...@coloradoengineeringinc.com
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


[U-Boot] [PATCH 1/2] spi: ST33ZP24 SPI TPM driver

2014-07-08 Thread Jean-Luc BLANC
This driver add support for STMicroelectronics ST33ZP24 SPI TPM.
Driver support 2 SPI TPMs.
Driver support also hash in Locality 4 feature (the only way to
update PCR17).
---
 README |   29 ++
 common/cmd_tpm.c   |   63 +++-
 drivers/tpm/Makefile   |1 +
 drivers/tpm/tpm_spi_stm_st33.c |  724 
 include/tis.h  |   11 +-
 include/tpm.h  |   22 ++
 lib/tpm.c  |   26 ++
 7 files changed, 874 insertions(+), 2 deletions(-)
 create mode 100644 drivers/tpm/tpm_spi_stm_st33.c

diff --git a/README b/README
index a248ab5..a4aa28a 100644
--- a/README
+++ b/README
@@ -1397,6 +1397,35 @@ The following options need to be configured:
Define this to enable authorized functions in the TPM library.
Requires CONFIG_TPM and CONFIG_SHA1.
 
+   CONFIG_TPM_ST
+   Support additional hash in locality 4 command for
+   STMicroelectronics TPMs (SPI or I2C). Require CONFIG_CMD_TPM.
+
+   CONFIG_TPM_ST_SPI
+   Support SPI STMicroelectronics TPM. Require SPI support
+
+   TPM0_SPI_MAX_SPEED
+   Define SPI frequency for TPM, 1000 Hz max
+
+   TPM0_SPI_BUS_NUM
+   Define SPI Bus ID connected to TPM
+
+   TPM0_SPI_CS
+   Define SPI Chip Select ID connected to TPM
+
+   CONFIG_TPM_ST_2TPM
+   Support additional STMicoelectronics SPI TPM.
+   Require CONFIG_TPM_ST_SPI
+
+   TPM1_SPI_MAX_SPEED
+   Define SPI frequency for TPM, 1000 Hz max
+
+   TPM1_SPI_BUS_NUM
+   Define SPI Bus ID connected to TPM
+
+   TPM1_SPI_CS
+   Define SPI Chip Select ID connected to TPM
+
 - USB Support:
At the moment only the UHCI host controller is
supported (PIP405, MIP405, MPC5200); define
diff --git a/common/cmd_tpm.c b/common/cmd_tpm.c
index 0294952..63f52e4 100644
--- a/common/cmd_tpm.c
+++ b/common/cmd_tpm.c
@@ -334,6 +334,29 @@ static int do_tpm_extend(cmd_tbl_t *cmdtp, int flag,
return convert_return_code(rc);
 }
 
+#ifdef CONFIG_TPM_ST
+static int do_tpm_hash_loc4(cmd_tbl_t *cmdtp, int flag,
+   int argc, char * const argv[])
+{
+   uint32_t rc;
+   size_t count;
+   void *data;
+
+   if (argc != 2)
+   return CMD_RET_USAGE;
+
+   data = parse_byte_string(argv[1], NULL, &count);
+   if (!data) {
+   printf("Couldn't parse byte string %s\n", argv[1]);
+   return CMD_RET_FAILURE;
+   }
+
+   rc = tpm_hash_loc4(data, count);
+   free(data);
+   return convert_return_code(rc);
+}
+#endif /* CONFIG_TPM_ST */
+
 static int do_tpm_pcr_read(cmd_tbl_t *cmdtp, int flag,
int argc, char * const argv[])
 {
@@ -355,6 +378,25 @@ static int do_tpm_pcr_read(cmd_tbl_t *cmdtp, int flag,
return convert_return_code(rc);
 }
 
+#ifdef CONFIG_TPM_ST_2TPM
+static int do_tpm_spi_select(cmd_tbl_t *cmdtp, int flag,
+int argc, char * const argv[])
+{
+   uint32_t rc, spi_number;
+
+   if (argc != 2)
+   return CMD_RET_USAGE;
+   spi_number = simple_strtoul(argv[1], NULL, 0);
+   if (spi_number < CONFIG_TPM_ST_2TPM) {
+   rc = tpm_spi_select(spi_number);
+   } else {
+   printf("Couldn't parse argument %s\n", argv[1]);
+   return CMD_RET_FAILURE;
+   }
+   return convert_return_code(rc);
+}
+#endif /* CONFIG_TPM_ST_2TPM */
+
 static int do_tpm_tsc_physical_presence(cmd_tbl_t *cmdtp, int flag,
int argc, char * const argv[])
 {
@@ -629,8 +671,16 @@ static cmd_tbl_t tpm_commands[] = {
do_tpm_nv_write_value, "", ""),
U_BOOT_CMD_MKENT(extend, 0, 1,
do_tpm_extend, "", ""),
+#ifdef CONFIG_TPM_ST
+   U_BOOT_CMD_MKENT(hash_loc4, 0, 1,
+do_tpm_hash_loc4, "", ""),
+#endif /* CONFIG_TPM_ST */
U_BOOT_CMD_MKENT(pcr_read, 0, 1,
-   do_tpm_pcr_read, "", ""),
+do_tpm_pcr_read, "", ""),
+#ifdef CONFIG_TPM_ST_2TPM
+   U_BOOT_CMD_MKENT(spi_select, 0, 1,
+do_tpm_spi_select, "", ""),
+#endif /* CONFIG_TPM_ST_2TPM */
U_BOOT_CMD_MKENT(tsc_physical_presence, 0, 1,
do_tpm_tsc_physical_presence, "", ""),
U_BOOT_CMD_MKENT(read_pubek, 0, 1,
@@ -723,6 +773,11 @@ U_BOOT_CMD(tpm, CONFIG_SYS_MAXARGS, 1, do_tpm,
 "  extend index digest_hex_string\n"
 "- Add a new measurement to a PCR.  Update PCR  with the 20-bytes\n"
 "  \n"
+#ifdef CONFIG_TPM_ST
+"  hash_loc4 digest_hex_string\n"
+"- Add a mesurement in PCR17. Update PCR 17 with the

Re: [U-Boot] Please pull u-boot-sunxi.git/next

2014-07-08 Thread Jeroen Hofstee


On 08-07-14 21:20, Ian Campbell wrote:

Hi Tom

Sending to you for #next in Albert's absence.

The following changes since commit 23f23f23d509e8e873797884456070c8a47d72b2:

   socfpga: Relocate arch common functions away from board (2014-07-05 10:14:46 
+0200)

are available in the git repository at:

   git://git.denx.de/u-boot-sunxi.git next

for you to fetch changes up to 799aff38dfc1b2d860ec8430572f9402d3ce9881:

   sunxi: Avoid unused variable warning. (2014-07-08 07:45:06 +0100)



I am a bit lost here, why do want to send next branches for
pull requests??

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


[U-Boot] [PATCH 2/5] sunxi: add USB EHCI driver

2014-07-08 Thread Roman Byshko
Signed-off-by: Roman Byshko 
---
 drivers/usb/host/Makefile |   1 +
 drivers/usb/host/ehci-sunxi.c | 236 ++
 2 files changed, 237 insertions(+)
 create mode 100644 drivers/usb/host/ehci-sunxi.c

diff --git a/drivers/usb/host/Makefile b/drivers/usb/host/Makefile
index 04c1a64..c4f5157 100644
--- a/drivers/usb/host/Makefile
+++ b/drivers/usb/host/Makefile
@@ -35,6 +35,7 @@ obj-$(CONFIG_USB_EHCI_PPC4XX) += ehci-ppc4xx.o
 obj-$(CONFIG_USB_EHCI_MARVELL) += ehci-marvell.o
 obj-$(CONFIG_USB_EHCI_PCI) += ehci-pci.o
 obj-$(CONFIG_USB_EHCI_SPEAR) += ehci-spear.o
+obj-$(CONFIG_USB_EHCI_SUNXI) += ehci-sunxi.o
 obj-$(CONFIG_USB_EHCI_TEGRA) += ehci-tegra.o
 obj-$(CONFIG_USB_EHCI_VCT) += ehci-vct.o
 obj-$(CONFIG_USB_EHCI_RMOBILE) += ehci-rmobile.o
diff --git a/drivers/usb/host/ehci-sunxi.c b/drivers/usb/host/ehci-sunxi.c
new file mode 100644
index 000..5817fc7
--- /dev/null
+++ b/drivers/usb/host/ehci-sunxi.c
@@ -0,0 +1,236 @@
+/*
+ * Copyright (C) 2014 arokux
+ *
+ * arokux 
+ *
+ * Based on code from
+ * Allwinner Technology Co., Ltd. 
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * 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, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include "ehci.h"
+
+#define BIT(x) (1 << (x))
+
+#define SUNXI_USB1_IO_BASE 0x01c14000
+#define SUNXI_USB2_IO_BASE 0x01c1c000
+
+#define SUNXI_USB_PMU_IRQ_ENABLE   0x800
+#define SUNXI_USB_CSR  0x01c13404
+#define SUNXI_USB_PASSBY_EN1
+
+#define SUNXI_EHCI_AHB_ICHR8_ENBIT(10)
+#define SUNXI_EHCI_AHB_INCR4_BURST_EN  BIT(9)
+#define SUNXI_EHCI_AHB_INCRX_ALIGN_EN  BIT(8)
+#define SUNXI_EHCI_ULPI_BYPASS_EN  BIT(0)
+
+static struct sunxi_ehci_hcd {
+   void *ehci_base;
+   struct usb_hcd *hcd;
+   int usb_rst_mask;
+   int ahb_clk_mask;
+   int gpio_vbus;
+   void *csr;
+   int irq;
+   int id;
+} sunxi_echi_hcd[CONFIG_USB_MAX_CONTROLLER_COUNT] = {
+   [0] = {
+   .ehci_base = (void *) SUNXI_USB1_IO_BASE,
+   .usb_rst_mask = CCM_USB_CTRL_PHY1_RST,
+   .ahb_clk_mask = BIT(AHB_GATE_OFFSET_USB_EHCI0),
+   .gpio_vbus = CONFIG_SUNXI_USB_VBUS0_GPIO,
+   .csr = (void*) SUNXI_USB_CSR,
+   .irq = 39,
+   .id = 1,
+   },
+#if (CONFIG_USB_MAX_CONTROLLER_COUNT > 1)
+   [1] = {
+   .ehci_base = (void *) SUNXI_USB2_IO_BASE,
+   .usb_rst_mask = CCM_USB_CTRL_PHY2_RST,
+   .ahb_clk_mask = BIT(AHB_GATE_OFFSET_USB_EHCI1),
+   .gpio_vbus = CONFIG_SUNXI_USB_VBUS1_GPIO,
+   .csr = (void*) SUNXI_USB_CSR,
+   .irq = 40,
+   .id = 2,
+   }
+#endif
+};
+
+static int sunxi_gpio_output(u32 pin, u32 val)
+{
+   u32 dat;
+   u32 bank = GPIO_BANK(pin);
+   u32 num = GPIO_NUM(pin);
+   struct sunxi_gpio *pio =
+   &((struct sunxi_gpio_reg *)SUNXI_PIO_BASE)->gpio_bank[bank];
+
+   dat = readl(&pio->dat);
+   if (val)
+   dat |= 0x1 << num;
+   else
+   dat &= ~(0x1 << num);
+
+   writel(dat, &pio->dat);
+
+   return 0;
+}
+
+static void usb_phy_write(struct sunxi_ehci_hcd *sunxi_ehci, int addr,
+ int data, int len)
+{
+   int temp = 0, j = 0, usbc_bit = 0;
+   void *dest = sunxi_ehci->csr;
+
+   usbc_bit = BIT(sunxi_ehci->id * 2);
+   for (j = 0; j < len; j++) {
+   /* set the bit address to be written */
+   temp = readl(dest);
+   temp &= ~(0xff << 8);
+   temp |= ((addr + j) << 8);
+   writel(temp, dest);
+
+   clrbits_le32(dest, usbc_bit);
+   /* set data bit */
+   if (data & 0x1)
+   temp |= BIT(7);
+   else
+   temp &= ~BIT(7);
+   writeb(temp, dest);
+
+   setbits_le32(dest, usbc_bit);
+
+   clrbits_le32( dest, usbc_bit);
+
+   data >>= 1;
+   }
+}
+
+static void sunxi_usb_phy_init(struct sunxi_ehci_hcd *sunxi_ehci)
+{
+   /* The following comments are machine
+* translated from Chinese, you hav

[U-Boot] [PATCH 4/5] sun7i: add USB EHCI configuration

2014-07-08 Thread Roman Byshko
Signed-off-by: Roman Byshko 
---
 include/configs/sun7i.h | 8 
 1 file changed, 8 insertions(+)

diff --git a/include/configs/sun7i.h b/include/configs/sun7i.h
index 9b693f7..0a1d83e 100644
--- a/include/configs/sun7i.h
+++ b/include/configs/sun7i.h
@@ -16,6 +16,14 @@
 
 #define CONFIG_SYS_PROMPT  "sun7i# "
 
+#ifdef CONFIG_USB_EHCI
+#define CONFIG_USB_EHCI_SUNXI
+
+#define CONFIG_USB_MAX_CONTROLLER_COUNT2
+#define CONFIG_SUNXI_USB_VBUS0_GPIO230
+#define CONFIG_SUNXI_USB_VBUS1_GPIO227
+#endif
+
 /*
  * Include common sunxi configuration where most the settings are
  */
-- 
2.0.0

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


[U-Boot] [PATCH 5/5] sun7i: cubietruck: enable USB EHCI

2014-07-08 Thread Roman Byshko
Signed-off-by: Roman Byshko 
---
 boards.cfg | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/boards.cfg b/boards.cfg
index f16a0e6..e039d4c 100644
--- a/boards.cfg
+++ b/boards.cfg
@@ -377,7 +377,7 @@ Active  arm armv7  rmobile renesas  
   lager
 Active  arm armv7  s5pc1xx samsung goni
s5p_goni  - 

Robert Baldyga 
 Active  arm armv7  s5pc1xx samsung smdkc100
smdkc100  - 

Minkyu Kang 
 Active  arm armv7  socfpga altera  socfpga 
socfpga_cyclone5  - 

-
-Active  arm armv7  sunxi   -   sunxi   
Cubietrucksun7i:CUBIETRUCK,SPL,SUNXI_GMAC,RGMII 

-
+Active  arm armv7  sunxi   -   sunxi   
Cubietruck
sun7i:CUBIETRUCK,SPL,SUNXI_GMAC,RGMII,USB_EHCI  
  -
 Active  arm armv7  sunxi   -   sunxi   
Cubietruck_FEL
sun7i:CUBIETRUCK,SPL_FEL,SUNXI_GMAC,RGMII   
  -
 Active  arm armv7  u8500   st-ericsson snowball
snowball  - 

Mathieu Poirier 
 Active  arm armv7  u8500   st-ericsson u8500   
u8500_href- 

-
-- 
2.0.0

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


[U-Boot] [PATCH 1/5] sunxi: add defines to control USB Host clocks/resets

2014-07-08 Thread Roman Byshko
Signed-off-by: Roman Byshko 
---
 arch/arm/include/asm/arch-sunxi/clock_sun4i.h | 4 
 1 file changed, 4 insertions(+)

diff --git a/arch/arm/include/asm/arch-sunxi/clock_sun4i.h 
b/arch/arm/include/asm/arch-sunxi/clock_sun4i.h
index 928f3f2..fe7348a 100644
--- a/arch/arm/include/asm/arch-sunxi/clock_sun4i.h
+++ b/arch/arm/include/asm/arch-sunxi/clock_sun4i.h
@@ -253,4 +253,8 @@ struct sunxi_ccm_reg {
 #define CCM_GMAC_CTRL_GPIT_MII (0x0 << 2)
 #define CCM_GMAC_CTRL_GPIT_RGMII (0x1 << 2)
 
+#define CCM_USB_CTRL_PHY1_RST (0x1 << 1)
+#define CCM_USB_CTRL_PHY2_RST (0x1 << 2)
+#define CCM_USB_CTRL_PHYGATE (0x1 << 8)
+
 #endif /* _SUNXI_CLOCK_SUN4I_H */
-- 
2.0.0

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


[U-Boot] [PATCH 0/5] ARM: Allwinner sun7i (A20) USB Host EHCI support

2014-07-08 Thread Roman Byshko
This patch series adds USB Host EHCI support to the sun7i SoC. It was
tested on Cubietruck. Now you could boot from a USB stick or use a
compatible Ethernet dongle to add a second Ethernet port in U-Boot.

ehci-sunxi.c contains some code for poking GPIOs. This code will go
away once some other patches for sunXi SoCs are applied against upstream.
For now this patch series is self-contained and has no dependencies.

Best,
Roman Byshko

Roman Byshko (5):
  sunxi: add defines to control USB Host clocks/resets
  sunxi: add USB EHCI driver
  sunxi: add USB options to configs
  sun7i: add USB EHCI configuration
  sun7i: cubietruck: enable USB EHCI

 arch/arm/include/asm/arch-sunxi/clock_sun4i.h |   4 +
 boards.cfg|   2 +-
 drivers/usb/host/Makefile |   1 +
 drivers/usb/host/ehci-sunxi.c | 236 ++
 include/configs/sun7i.h   |   8 +
 include/configs/sunxi-common.h|   6 +
 6 files changed, 256 insertions(+), 1 deletion(-)
 create mode 100644 drivers/usb/host/ehci-sunxi.c

-- 
2.0.0

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


[U-Boot] [PATCH 3/5] sunxi: add USB options to configs

2014-07-08 Thread Roman Byshko
Signed-off-by: Roman Byshko 
---
 include/configs/sunxi-common.h | 6 ++
 1 file changed, 6 insertions(+)

diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index 5d72d62..c7746bb 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -181,6 +181,12 @@
 #define CONFIG_BOOTP_SEND_HOSTNAME
 #endif
 
+#ifdef CONFIG_USB_EHCI
+#define CONFIG_CMD_USB
+#define CONFIG_SYS_USB_EHCI_MAX_ROOT_PORTS 1
+#define CONFIG_USB_STORAGE
+#endif
+
 #if !defined CONFIG_ENV_IS_IN_MMC && \
 !defined CONFIG_ENV_IS_IN_NAND && \
 !defined CONFIG_ENV_IS_IN_FAT && \
-- 
2.0.0

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


Re: [U-Boot] [PATCH v2 2/9] arm: Set up global data before board_init_f()

2014-07-08 Thread Jeroen Hofstee

Hello Simon,

On 08-07-14 20:41, Simon Glass wrote:

Hi Jeroen,

On 8 July 2014 11:13, Jeroen Hofstee  wrote:

diff --git a/arch/arm/include/asm/config.h b/arch/arm/include/asm/config.h
index 2a20a77..abf79e5 100644
--- a/arch/arm/include/asm/config.h
+++ b/arch/arm/include/asm/config.h
@@ -7,8 +7,6 @@
   #ifndef _ASM_CONFIG_H_
   #define _ASM_CONFIG_H_
   -#define CONFIG_SYS_GENERIC_GLOBAL_DATA
-


This bricks aarch64 I guess.

I'll see if I can add it there also.


If you manage actually boot an virtual aarch64 board (with console),
could you report how you did it. I gave up at the fifth loader or
something bl3.3?


   #define CONFIG_LMB
   #define CONFIG_SYS_BOOT_RAMDISK_HIGH
   diff --git a/arch/arm/lib/crt0.S b/arch/arm/lib/crt0.S
index dfc2de9..bbf3e41 100644
--- a/arch/arm/lib/crt0.S
+++ b/arch/arm/lib/crt0.S
@@ -67,9 +67,16 @@ ENTRY(_main)
 ldr sp, =(CONFIG_SYS_INIT_SP_ADDR)
   #endif
 bic sp, sp, #7  /* 8-byte alignment for ABI compliance */
+   mov r2, sp
 sub sp, sp, #GD_SIZE/* allocate one GD above SP */
 bic sp, sp, #7  /* 8-byte alignment for ABI compliance */
 mov r9, sp  /* GD is above SP */
+   mov r1, r9
+   mov r0, #0
+clr_gd:cmp r1, r2  /* while not at end of BSS
nitpicking, personal taste I guess: could you hit enter after the clr_gd 
label?



+   blo clr_gd
 mov r0, #0
 bl  board_init_f



The mov r0, #0 for the argument could be removed, but at
least deserves a comment if you do so.

OK, I'll add that too.


I leave that up to you.

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


[U-Boot] Please pull u-boot-sunxi.git/next

2014-07-08 Thread Ian Campbell
Hi Tom

Sending to you for #next in Albert's absence.

The following changes since commit 23f23f23d509e8e873797884456070c8a47d72b2:

  socfpga: Relocate arch common functions away from board (2014-07-05 10:14:46 
+0200)

are available in the git repository at:

  git://git.denx.de/u-boot-sunxi.git next

for you to fetch changes up to 799aff38dfc1b2d860ec8430572f9402d3ce9881:

  sunxi: Avoid unused variable warning. (2014-07-08 07:45:06 +0100)


Chen-Yu Tsai (1):
  sunxi: Add support for using MII phy-s with the GMAC nic

Hans de Goede (8):
  sunxi: mksunxiboot: Fix loading of files with a size which is not a 
multiple of 4
  sunxi: Fix u-boot-spl.lds to refer to .vectors
  sunxi: Remove mmc DMA support
  sunxi: Implement reset_cpu
  sunxi: Add sun4i support
  sunxi: Add sun5i support
  sunxi: Add emac glue, enable emac on the cubieboard
  sunxi: Add Ian Campbell and Hans de Goede as cubietruck board-maintainers

Ian Campbell (1):
  sunxi: Avoid unused variable warning.

Stefan Roese (1):
  net: Rename and cleanup sunxi (Allwinner) emac driver

 arch/arm/cpu/armv7/sunxi/Makefile   |   4 +
 arch/arm/cpu/armv7/sunxi/board.c|  31 +-
 arch/arm/cpu/armv7/sunxi/cpu_info.c |  15 +++
 arch/arm/cpu/armv7/sunxi/dram.c | 102 +++-
 arch/arm/cpu/armv7/sunxi/u-boot-spl.lds |   1 +
 arch/arm/include/asm/arch-sunxi/timer.h |   5 +
 board/sunxi/Makefile|   3 +
 board/sunxi/dram_a13_oli_micro.c|  32 +++
 board/sunxi/dram_cubieboard.c   |  31 ++
 board/sunxi/dram_r7dongle.c |  31 ++
 board/sunxi/gmac.c  |  11 +++
 boards.cfg  |   7 +-
 drivers/mmc/sunxi_mmc.c | 141 ++--
 drivers/net/Makefile|   2 +-
 drivers/net/{sunxi_wemac.c => sunxi_emac.c} | 140 ++-
 include/configs/sun4i.h |  23 +
 include/configs/sun5i.h |  23 +
 include/configs/sunxi-common.h  |   8 +-
 include/netdev.h|   2 +-
 tools/mksunxiboot.c |  10 +-
 20 files changed, 401 insertions(+), 221 deletions(-)
 create mode 100644 board/sunxi/dram_a13_oli_micro.c
 create mode 100644 board/sunxi/dram_cubieboard.c
 create mode 100644 board/sunxi/dram_r7dongle.c
 rename drivers/net/{sunxi_wemac.c => sunxi_emac.c} (78%)
 create mode 100644 include/configs/sun4i.h
 create mode 100644 include/configs/sun5i.h



signature.asc
Description: This is a digitally signed message part
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v2 2/9] arm: Set up global data before board_init_f()

2014-07-08 Thread Simon Glass
Hi Jeroen,

On 8 July 2014 11:13, Jeroen Hofstee  wrote:
> Hello Simon,
>
>
> On 08-07-14 01:19, Simon Glass wrote:
>>
>> At present arm defines CONFIG_SYS_GENERIC_GLOBAL_DATA, meaning that
>> the global_data pointer is set up in board_init_f(). However it is
>> actually set up before this, it just isn't zeroed.
>>
>> If we zero the global data before calling board_init_f() then we
>> don't need to define CONFIG_SYS_GENERIC_GLOBAL_DATA.
>>
>> Make this change to simplify the init process.
>>
>> Signed-off-by: Simon Glass 
>> ---
>>
>> Changes in v2: None
>>
>>   arch/arm/include/asm/config.h | 2 --
>>   arch/arm/lib/crt0.S   | 7 +++
>>   2 files changed, 7 insertions(+), 2 deletions(-)
>
>
> First of all, good idea.. I missed v1 apparently.
>
>
>> diff --git a/arch/arm/include/asm/config.h b/arch/arm/include/asm/config.h
>> index 2a20a77..abf79e5 100644
>> --- a/arch/arm/include/asm/config.h
>> +++ b/arch/arm/include/asm/config.h
>> @@ -7,8 +7,6 @@
>>   #ifndef _ASM_CONFIG_H_
>>   #define _ASM_CONFIG_H_
>>   -#define CONFIG_SYS_GENERIC_GLOBAL_DATA
>> -
>
>
> This bricks aarch64 I guess.

I'll see if I can add it there also.

>
>>   #define CONFIG_LMB
>>   #define CONFIG_SYS_BOOT_RAMDISK_HIGH
>>   diff --git a/arch/arm/lib/crt0.S b/arch/arm/lib/crt0.S
>> index dfc2de9..bbf3e41 100644
>> --- a/arch/arm/lib/crt0.S
>> +++ b/arch/arm/lib/crt0.S
>> @@ -67,9 +67,16 @@ ENTRY(_main)
>> ldr sp, =(CONFIG_SYS_INIT_SP_ADDR)
>>   #endif
>> bic sp, sp, #7  /* 8-byte alignment for ABI compliance */
>> +   mov r2, sp
>> sub sp, sp, #GD_SIZE/* allocate one GD above SP */
>> bic sp, sp, #7  /* 8-byte alignment for ABI compliance */
>> mov r9, sp  /* GD is above SP */
>> +   mov r1, r9
>> +   mov r0, #0
>> +clr_gd:cmp r1, r2  /* while not at end of BSS
>> */
>> +   strlo   r0, [r1]/* clear 32-bit BSS word */
>> +   addlo   r1, r1, #4  /* move to next */
>
>
> The comment should be updated, it is not BSS which is cleared.

Yes I have a new version which I'm testing and will send when ready.

>
>> +   blo clr_gd
>> mov r0, #0
>> bl  board_init_f
>>
>
>
> The mov r0, #0 for the argument could be removed, but at
> least deserves a comment if you do so.

OK, I'll add that too.

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


Re: [U-Boot] [PATCH] common: main.c: make show_boot_progress __weak

2014-07-08 Thread Simon Glass
On 26 June 2014 12:18, Jeroen Hofstee  wrote:
> This not only looks a bit better it also prevents a
> warning with W=1 (no previous prototype).
>
> Signed-off-by: Jeroen Hofstee 

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


Re: [U-Boot] [PATCH] common: board_f: cosmetic use __weak for leds

2014-07-08 Thread Simon Glass
On 23 June 2014 15:20, Jeroen Hofstee  wrote:
> First of all this looks a lot better, but it also
> prevents a gcc warning (W=1), that the weak function
> has no previous prototype.
>
> cc: Simon Glass 
> Signed-off-by: Jeroen Hofstee 

Build tested for sandbox and a few ARM boards.

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


[U-Boot] uboot-env.bin

2014-07-08 Thread Naitik Amin
Hi there,

I am trying to use the uboot-env.bin that I created using my uboot env 
settings. My question is how do I point uboot to use this newly generated 
settings file while loading up the environment ?

Thanks,

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


Re: [U-Boot] [Patch v1 2/4] armv8/fsl-lsch3: Release secondary cores from boot hold off with Boot Page

2014-07-08 Thread York Sun
On 07/04/2014 05:31 AM, Mark Rutland wrote:
> Hi York,
> 
> I spotted a couple of generic issues below. Most of these are issues
> with the existing code that you happen to be moving around, rather than
> with the new code this patch introduces.
> 
> There are a couple of gotchas around secondary startup that are painful
> with the bootwrapper for arm64 at present, and I think that we can avoid
> them by construction for U-Boot. More on that below.
> 
> On Fri, Jun 27, 2014 at 05:54:08PM +0100, York Sun wrote:
>> Secondary cores need to be released from holdoff by boot release
>> registers. With GPP bootrom, they can boot from main memory
>> directly. Individual spin table is used for each core. If a single
>> release address is needed, defining macro CONFIG_FSL_SMP_RELEASE_ALL
>> will use the CPU_RELEASE_ADDR. Spin table and the boot page is reserved
>> in device tree so OS won't overwrite.
>>
>> Signed-off-by: York Sun 
>> Signed-off-by: Arnab Basu 
>> ---
>> This set depends on this bundle 
>> http://patchwork.ozlabs.org/bundle/yorksun/armv8_fsl-lsch3/
>>
>>  arch/arm/cpu/armv8/fsl-lsch3/Makefile |2 +
>>  arch/arm/cpu/armv8/fsl-lsch3/cpu.c|   13 ++
>>  arch/arm/cpu/armv8/fsl-lsch3/cpu.h|1 +
>>  arch/arm/cpu/armv8/fsl-lsch3/fdt.c|   56 +++
>>  arch/arm/cpu/armv8/fsl-lsch3/lowlevel.S   |  119 +++---
>>  arch/arm/cpu/armv8/fsl-lsch3/mp.c |  171 
>> +
>>  arch/arm/cpu/armv8/fsl-lsch3/mp.h |   36 +
>>  arch/arm/cpu/armv8/transition.S   |   63 +---
>>  arch/arm/include/asm/arch-fsl-lsch3/config.h  |3 +-
>>  arch/arm/include/asm/arch-fsl-lsch3/immap_lsch3.h |   35 +
>>  arch/arm/include/asm/macro.h  |   81 ++
>>  arch/arm/lib/gic_64.S |   10 +-
>>  common/board_f.c  |2 +-
>>  13 files changed, 502 insertions(+), 90 deletions(-)
>>  create mode 100644 arch/arm/cpu/armv8/fsl-lsch3/fdt.c
>>  create mode 100644 arch/arm/cpu/armv8/fsl-lsch3/mp.c
>>  create mode 100644 arch/arm/cpu/armv8/fsl-lsch3/mp.h
>  
> [...]
> 
>> diff --git a/arch/arm/cpu/armv8/fsl-lsch3/fdt.c 
>> b/arch/arm/cpu/armv8/fsl-lsch3/fdt.c
>> new file mode 100644
>> index 000..cd34e16
>> --- /dev/null
>> +++ b/arch/arm/cpu/armv8/fsl-lsch3/fdt.c
>> @@ -0,0 +1,56 @@
>> +/*
>> + * Copyright 2014 Freescale Semiconductor, Inc.
>> + *
>> + * SPDX-License-Identifier:GPL-2.0+
>> + */
>> +
>> +#include 
>> +#include 
>> +#include 
>> +#include "mp.h"
>> +
>> +#ifdef CONFIG_MP
>> +void ft_fixup_cpu(void *blob)
>> +{
>> +   int off;
>> +   __maybe_unused u64 spin_tbl_addr = (u64)get_spin_tbl_addr();
>> +   u64 *reg;
>> +   u64 val;
>> +
>> +   off = fdt_node_offset_by_prop_value(blob, -1, "device_type", "cpu", 
>> 4);
>> +   while (off != -FDT_ERR_NOTFOUND) {
>> +   reg = (u64 *)fdt_getprop(blob, off, "reg", 0);
>> +   if (reg) {
>> +   val = spin_tbl_addr;
>> +#ifndef CONFIG_FSL_SMP_RELEASE_ALL
>> +   val += id_to_core(fdt64_to_cpu(*reg)) * 
>> SIZE_BOOT_ENTRY;
> 
> In Linux we read /cpus/#address-cells to determine the size of a
> CPU's reg property (and have dts where this is 1 cell). Will the above
> work for that?

I don't think so. Will have to add the same size check.

> 
>> +#endif
>> +   val = cpu_to_fdt64(val);
>> +   fdt_setprop_string(blob, off, "enable-method",
>> +  "spin-table");
>> +   fdt_setprop(blob, off, "cpu-release-addr",
>> +   &val, sizeof(val));
>> +   } else {
>> +   puts("cpu NULL\n");
>> +   }
>> +   off = fdt_node_offset_by_prop_value(blob, off, "device_type",
>> +   "cpu", 4);
>> +   }
>> +   /*
>> +* Boot page and spin table can be reserved here if not done 
>> staticlly
>> +* in device tree.
>> +*
>> +* fdt_add_mem_rsv(blob, bootpg,
>> +* *((u64 *)&(__secondary_boot_page_size)));
>> +* If defined CONFIG_FSL_SMP_RELEASE_ALL, the release address should
>> +* also be reserved.
>> +*/
> 
> I think that this reservation should _always_ be added by U-Boot unless
> specifically overridden.
> 
> A problem I had with the arm64 bootwrapper when adding PSCI support and
> now (as I am moving stuff about) was that the DTS in the kernel tree had
> a memreserve out-of-sync with what the wrapper actually needed. While I
> can add a new reservation, I can't remove any in case they are for
> something else, so I end up protecting too much, wasting memory.
> 
> Given that the reservation is to protect data which U-Boot is in control
> of choosing the address for, I think 

Re: [U-Boot] [PATCH v2 2/9] arm: Set up global data before board_init_f()

2014-07-08 Thread Jeroen Hofstee

Hello Simon,

On 08-07-14 01:19, Simon Glass wrote:

At present arm defines CONFIG_SYS_GENERIC_GLOBAL_DATA, meaning that
the global_data pointer is set up in board_init_f(). However it is
actually set up before this, it just isn't zeroed.

If we zero the global data before calling board_init_f() then we
don't need to define CONFIG_SYS_GENERIC_GLOBAL_DATA.

Make this change to simplify the init process.

Signed-off-by: Simon Glass 
---

Changes in v2: None

  arch/arm/include/asm/config.h | 2 --
  arch/arm/lib/crt0.S   | 7 +++
  2 files changed, 7 insertions(+), 2 deletions(-)


First of all, good idea.. I missed v1 apparently.


diff --git a/arch/arm/include/asm/config.h b/arch/arm/include/asm/config.h
index 2a20a77..abf79e5 100644
--- a/arch/arm/include/asm/config.h
+++ b/arch/arm/include/asm/config.h
@@ -7,8 +7,6 @@
  #ifndef _ASM_CONFIG_H_
  #define _ASM_CONFIG_H_
  
-#define CONFIG_SYS_GENERIC_GLOBAL_DATA

-


This bricks aarch64 I guess.

  #define CONFIG_LMB
  #define CONFIG_SYS_BOOT_RAMDISK_HIGH
  
diff --git a/arch/arm/lib/crt0.S b/arch/arm/lib/crt0.S

index dfc2de9..bbf3e41 100644
--- a/arch/arm/lib/crt0.S
+++ b/arch/arm/lib/crt0.S
@@ -67,9 +67,16 @@ ENTRY(_main)
ldr sp, =(CONFIG_SYS_INIT_SP_ADDR)
  #endif
bic sp, sp, #7  /* 8-byte alignment for ABI compliance */
+   mov r2, sp
sub sp, sp, #GD_SIZE/* allocate one GD above SP */
bic sp, sp, #7  /* 8-byte alignment for ABI compliance */
mov r9, sp  /* GD is above SP */
+   mov r1, r9
+   mov r0, #0
+clr_gd:cmp r1, r2  /* while not at end of BSS */
+   strlo   r0, [r1]/* clear 32-bit BSS word */
+   addlo   r1, r1, #4  /* move to next */


The comment should be updated, it is not BSS which is cleared.

+   blo clr_gd
mov r0, #0
bl  board_init_f
  


The mov r0, #0 for the argument could be removed, but at
least deserves a comment if you do so.

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


Re: [U-Boot] [PATCH v5 1/4] mx6: Add support for the mx6solox variant

2014-07-08 Thread Fabio Estevam
On Tue, Jul 8, 2014 at 6:08 AM, Stefano Babic  wrote:
> On 24/06/2014 22:40, Fabio Estevam wrote:
>> From: Fabio Estevam 
>>
>> mx6solox is the newest member of the mx6 family.
>>
>> Some of the new features on this variants are:
>> - Cortex M4 microcontroller (besides the CortexA9)
>> - Dual Gigabit Ethernet
>>
>> Add the initial support for it.
>>
>> Signed-off-by: Fabio Estevam 
>> ---
>
> Applied to u-boot-imx, -next branch, thanks !

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


Re: [U-Boot] [PATCH v3 00/10] sunxi: Bug fixes, sun4i and sun5i support and network improvements

2014-07-08 Thread Tom Rini
On Tue, Jul 08, 2014 at 08:23:11AM +0100, Ian Campbell wrote:
> On Mon, 2014-07-07 at 16:45 -0400, Tom Rini wrote:
> > On Mon, Jul 07, 2014 at 09:23:13PM +0100, Ian Campbell wrote:
> > > On Mon, 2014-07-07 at 12:47 -0400, Tom Rini wrote:
> > > > That's not how we like things to look however when we can help it.  Just
> > > > toss a __maybe_unused in front of the declaration (and make sure we have
> > > >  included.
> > > 
> > > OK. How about the following?
> > > 
> > > Hans, BTW, I spotted this issue with:
> > > CROSS_COMPILE=arm-linux-gnueabihf- ./MAKEALL -s sunxi
> > > which is a very useful invocation indeed!
> > 
> > FWIW, you might want to run -a arm from time to time since there's some
> > shared drivers between sunxi and others.
> 
> Ack.
> 
> I don't suppose there is a bot somewhere which provides baseline results
> for comparison?

Marek, is your builder still going?  Having more CI stuff available
widely is something I'd like but not far along.

-- 
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] SPL broken on i.mx31 platforms

2014-07-08 Thread Helmut Raiger

On 07/08/2014 02:32 PM, Helmut Raiger wrote:

On 07/08/2014 10:05 AM, Helmut Raiger wrote:


I meant, that the SPL is now doing the RAM init and copying of the 
SPL code
correctly. RAM is working, the SPL code is at 0x87dc after that 
(CRCed it via JTAG).
I could not track it further (I have very limited development time 
right now ... repeating myself).


After all I need to debug further. If someone could test the current 
state on the
mx31pdk, this still would be great. Just to rule out any other board 
specific issues.


Helmut


Ok, I've got some new input and I have no clue what's going on.

1) I fixed the first branch to reset (uses b reset instead of ldr pc, 
_reset)

2) The startup does:

  b reset
...

reset:
- set the cpu to SVC32 mode
- bl  cpu_init_crit (cache and MMU stuff, calls low_level_init)
- bl _main

low_level_init:
   unlike in mx31pdk this only does:

ldrr0, =ARM_PPMRR  /* start from AIPS 2GB region */
mcrp15, 0, r0, c15, c2, 4
movpc, lr

_main:
- set up stack pointer to internal SRAM
- bl board_init_f

As I can't break right after reset with peedi, I do:

  - reset stop
  - set pc 0xb800
  - go -> system never returns

next:
   reset stop
   - set pc 0xb800
   - break add hard 0xb8c8// set hardware breakpoint to 
the 'bl board_init_f' instruction

   - go
... it stops at the breakpoint
   - go
... I'm at the u-boot command prompt

If I set the breakpoint somewhere after the bl board_init_f it fails, 
if I break a few instructions
early and go from there it also fails. Tracking down the location 
in-between I end up at:


at the end of cpu_init_crit():

movip, lr/* persevere link reg across call */
bllowlevel_init/* go setup pll,mux,memory */
->movlr, ip/* restore link */
movpc, lr/* back to my caller */

That is, if I set the breakpoint to mov lr, ip it works, if I set it 
one instruction later it ends working.


Could be struggling with the debugger here, as the SPL probably ran a 
few instruction before it
was stopped. Might this be a cache issue? But it is invalidated in 
cpu_init_crit() anyway ...


Feeling a little dumbstruck right now ...

Sorry for the mess, but it's hard to describe.

Any ideas?
Helmut


Just putting 'to whom it may concern' in CC, don't know the rule here.
Helmut


--
Scanned by MailScanner.

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


Re: [U-Boot] SPL broken on i.mx31 platforms

2014-07-08 Thread Helmut Raiger

On 07/08/2014 10:05 AM, Helmut Raiger wrote:


I meant, that the SPL is now doing the RAM init and copying of the SPL 
code
correctly. RAM is working, the SPL code is at 0x87dc after that 
(CRCed it via JTAG).
I could not track it further (I have very limited development time 
right now ... repeating myself).


After all I need to debug further. If someone could test the current 
state on the
mx31pdk, this still would be great. Just to rule out any other board 
specific issues.


Helmut


Ok, I've got some new input and I have no clue what's going on.

1) I fixed the first branch to reset (uses b reset instead of ldr pc, 
_reset)

2) The startup does:

  b reset
...

reset:
- set the cpu to SVC32 mode
- bl  cpu_init_crit (cache and MMU stuff, calls low_level_init)
- bl _main

low_level_init:
   unlike in mx31pdk this only does:

ldrr0, =ARM_PPMRR  /* start from AIPS 2GB region */
mcrp15, 0, r0, c15, c2, 4
movpc, lr

_main:
- set up stack pointer to internal SRAM
- bl board_init_f

As I can't break right after reset with peedi, I do:

  - reset stop
  - set pc 0xb800
  - go -> system never returns

next:
   reset stop
   - set pc 0xb800
   - break add hard 0xb8c8// set hardware breakpoint to the 
'bl board_init_f' instruction

   - go
... it stops at the breakpoint
   - go
... I'm at the u-boot command prompt

If I set the breakpoint somewhere after the bl board_init_f it fails, if 
I break a few instructions
early and go from there it also fails. Tracking down the location 
in-between I end up at:


at the end of cpu_init_crit():

movip, lr/* persevere link reg across call */
bllowlevel_init/* go setup pll,mux,memory */
->movlr, ip/* restore link */
movpc, lr/* back to my caller */

That is, if I set the breakpoint to mov lr, ip it works, if I set it one 
instruction later it ends working.


Could be struggling with the debugger here, as the SPL probably ran a 
few instruction before it
was stopped. Might this be a cache issue? But it is invalidated in 
cpu_init_crit() anyway ...


Feeling a little dumbstruck right now ...

Sorry for the mess, but it's hard to describe.

Any ideas?
Helmut


--
Scanned by MailScanner.

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


[U-Boot] CONFIG_SYS_GENERIC_BOARD status

2014-07-08 Thread Simon Glass
Hi,

According to my calculations, as of commit 80a7cac we now have more
than 238 boards converted to generic board, out of 1171. That is a
little over 20%, which is a big improvement from last release. I am
unable to include MIPS or ARM64 so it is an under-estimate.


./tools/buildman/buildman -b dm3b --step 0 -k

grep -l CONFIG_SYS_GENERIC_BOARD
dm3b/01_of_93_g80a7cac0_Merge-branch-\'tom\'-o/*/autoconf.mk |\wc -l
238

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


Re: [U-Boot] [PATCH v2] mx6: add support of multi-processor command

2014-07-08 Thread Pavel Machek
On Sun 2014-06-22 17:09:28, Nikolay Dimitrov wrote:
> Hi Gabriel,
> 
> >This allows u-boot to load different OS or Bare Metal application on the
> >different cores of the i.MX6DQ.
> >For example: we can run Android on cpu0 and a RT OS like QNX/FreeRTOS on 
> >cpu1.
> 
> I think this explanation is a little misleading - if you run
> unmodified versions of Android & some RTOS, they will fight for the
> imx6 interrupt controller, power management and clocks. As far as I
> know, imx6 is not appropriate for AMP (asymmetric multi-processing)
> because it doesn't support virtualization extensions.

I did AMP configuration on socfpga (similar to i.mx6 in this
regard). Yes, Linux needs to be modified for this to work... but it
seems mostly unmodified u-boot can be used.

Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [RFC] Extend 'bootm' to support Linux kernel generated images

2014-07-08 Thread Pavel Machek

> > If someone really wants such a trial and error approach, he can still
> > do this without adding code that affects everybody with just a little
> > scripting - like "bootm $addr || bootz $addr || ...".
> 
> That's not the usecase really.  The usecase is roughly "I just want to
> boot what the kernel build spit out and not have to guess the command".
> 
> How about if we added a new command, 'boota[uto]' to make a few stabs at
> guessing the format?  The first problem that pops to mind here is
> passing around some flag to make sure that bootm doesn't get this new
> behaviour.

For the record, boota would be nice. Count me as one of developers
that dislike the extra steps...

Pavel
-- 
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) 
http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v4] mx6: add support of multi-processor command

2014-07-08 Thread Stefano Babic
Hi Gabriel,

On 25/06/2014 04:32, Gabriel Huau wrote:
> This allows u-boot to load different OS or Bare Metal application on the
> different cores of the i.MX6DQ.
> For example: we can run Android on cpu0 and a RT OS like QNX/FreeRTOS on cpu1.
> 
> Signed-off-by: Gabriel Huau 
> ---
> Changes for v2:
>   - Add a commit log message to explain the purpose of this patch
> Changes for v3:
>   - Remove unnecessary check for unsigned values when they are negative
> Changes for v4:
>   - Add CONFIG_MP to the common mx6 configuration
>   - Get the number of CPUs dynamically instead of using a macro
> 
>  arch/arm/cpu/armv7/mx6/Makefile   |   1 +
>  arch/arm/cpu/armv7/mx6/mp.c   | 134 
> ++
>  arch/arm/cpu/armv7/mx6/soc.c  |   6 ++
>  arch/arm/include/asm/arch-mx6/imx-regs.h  |  13 +++
>  arch/arm/include/asm/arch-mx6/sys_proto.h |   2 +
>  include/configs/mx6_common.h  |   2 +
>  6 files changed, 158 insertions(+)
>  create mode 100644 arch/arm/cpu/armv7/mx6/mp.c
> 

Your patch breaks some i.MX6 boards:

Configuring for udoo_quad - Board: udoo, Options:
IMX_CONFIG=board/udoo/udoo.cfg,MX6Q,DDR_MB=1024
common/board_f.c:45:20: fatal error: asm/mp.h: No such file or directory
make[1]: *** [common/board_f.o] Error 1

In fact, board_f.c includes asm/mp.h if CONFIG_MP is set. Can you take a
look ? Thanks !

Best regards,
Stefano Babic


-- 
=
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v5 3/4] mx6: clock: Do not enable sata and ipu clocks

2014-07-08 Thread Stefano Babic
On 24/06/2014 22:41, Fabio Estevam wrote:
> From: Fabio Estevam 
> 
> mx6sx does not have sata nor ipu blocks, so do not handle such clocks.
> 
> Signed-off-by: Fabio Estevam 
> ---

Applied to u-boot-imx, -next branch, thanks !

Best regards,
Stefano Babic



-- 
=
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v5 4/4] mx6sx: Add initial support for mx6sxsabresd board

2014-07-08 Thread Stefano Babic
On 24/06/2014 22:41, Fabio Estevam wrote:
> From: Fabio Estevam 
> 
> Signed-off-by: Fabio Estevam 
> ---

Applied to u-boot-imx, -next branch, thanks !

Best regards,
Stefano Babic


-- 
=
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v5 1/4] mx6: Add support for the mx6solox variant

2014-07-08 Thread Stefano Babic
On 24/06/2014 22:40, Fabio Estevam wrote:
> From: Fabio Estevam 
> 
> mx6solox is the newest member of the mx6 family.
> 
> Some of the new features on this variants are:
> - Cortex M4 microcontroller (besides the CortexA9)
> - Dual Gigabit Ethernet
> 
> Add the initial support for it.
> 
> Signed-off-by: Fabio Estevam 
> ---

Applied to u-boot-imx, -next branch, thanks !

Best regards,
Stefano Babic


-- 
=
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v5 2/4] mx6sx: Add pin definitions

2014-07-08 Thread Stefano Babic
On 24/06/2014 22:40, Fabio Estevam wrote:
> From: Fabio Estevam 
> 
> Add the pin definitions for mx6sx.
> 
> Signed-off-by: Fabio Estevam 
> ---

Applied to u-boot-imx, -next branch, thanks !

Best regards,
Stefano Babic


-- 
=
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v5 1/4] mx6: Add support for the mx6solox variant

2014-07-08 Thread Stefano Babic
Hi Fabio,

On 07/07/2014 16:18, Fabio Estevam wrote:
> Hi Stefano,
> 
> On Thu, Jul 3, 2014 at 3:22 PM, Fabio Estevam  wrote:
>> Hi Stefano,
>>
>> On Thu, Jul 3, 2014 at 4:15 AM, Stefano Babic  wrote:
>>
>>> I have only taken a short look because the series should flow after
>>> 2014.07. Anyway, I could push them into -next.
>>
>> Pushing them into -next would be very helpful, so that we can continue
>> on adding new support for mx6solox.
> 
> Would it be possible to review the initial series that adds mx6solox
> support and apply it to -next if you are happy with it?
> 
> Otherwise, I am not able to proceed with further mx6solox U-boot upstream 
> work.
> 

Sorry, I was not in office last week, I am back again. I will apply them
now.

Best regards,
Stefano


-- 
=
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sba...@denx.de
=
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] SPL broken on i.mx31 platforms

2014-07-08 Thread Helmut Raiger

On 07/03/2014 10:58 PM, Benoît Thébaudeau wrote:

Hi,

On Thu, Jul 3, 2014 at 10:19 AM, Helmut Raiger  wrote:

On 07/03/2014 01:20 AM, Benoît Thébaudeau wrote:

)Dear Helmut Raiger,

On Wed, Jul 2, 2014 at 9:04 AM, Helmut Raiger 
wrote:

   the commit 41623c91 breaks the SPL on i.mx31 platforms.

Here, you are talking about mx31pdk, right?

Actually im talking TT-01, but it has no contributed NAND boot code (which I
was working on), but it should hit mx31pdk in the same way.
This should answer Albert's question about the board.

Then, since you are out of tree, can you test with the HEAD vs.
41623c91 vs. 41623c91^ mx31pdk codes, replacing the _reset lines with
"b reset" or "bl reset" after "_start:" for 41623c91 and HEAD? It
would probably run U-Boot on TT-01 too. You can remove board-specific
initializations like GPIO outputs from mx31pdk.c in order not to risk
damaging the board (just keep a valid UART to see the boot). This is
just to make sure that there is nothing wrong in your out-of-tree code
that could interfere with the mainline changes, like a custom SPL
linker script that would miss the *(.vectors) section.


1) Simply reverting the 41623c91 on HEAD makes it work again.
2) Replace ldr pc, _reset with b reset, still hangs
3) I'm using no special linker scripts, board_init_f() is pretty much 
the same as in mx31pdk.




You are talking about rebasing, reverting, and testing with modified
mainline. Just to make things clear, do you confirm that reverting
commit 41623c91 on top of mainline works (not just rebasing before
this commit)? You mentioned failing tests with a modified mainline, so
I want to make sure that there is no other offending commit after
41623c91 that would interfere with these tests.

Yes reverting 41623c91 on HEAD works, there is no other offending commit.



I was using the word 'relocation' instead of copying. I did
what you suggest, but this does not completely fix the issue.
If the only wrong commit is 41623c91, I do not see what else could be
wrong, hence my questions above.

What do you mean by "not completely"? Is there any progress?


I meant, that the SPL is now doing the RAM init and copying of the SPL code
correctly. RAM is working, the SPL code is at 0x87dc after that 
(CRCed it via JTAG).
I could not track it further (I have very limited development time right 
now ... repeating myself).


After all I need to debug further. If someone could test the current 
state on the
mx31pdk, this still would be great. Just to rule out any other board 
specific issues.


Helmut


--
Scanned by MailScanner.

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


Re: [U-Boot] [PATCH 3/3] dfu: fix readback buffer overflow test

2014-07-08 Thread Lukasz Majewski
Hi Stephen,

> From: Stephen Warren 
> 
> The buffer is too small if it's < size to read, not if it's <= the
> size. This fixes the 1MB test case on Tegra, which has a 1MB buffer.
> 
> Signed-off-by: Stephen Warren 
> ---
>  drivers/dfu/dfu.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/dfu/dfu.c b/drivers/dfu/dfu.c
> index 6cd3fbb58ae4..3512b149c560 100644
> --- a/drivers/dfu/dfu.c
> +++ b/drivers/dfu/dfu.c
> @@ -332,7 +332,7 @@ int dfu_read(struct dfu_entity *dfu, void *buf,
> int size, int blk_seq_num) case DFU_RAM_ADDR:
>   break;
>   default:
> - if (dfu->r_left >= dfu_buf_size) {
> + if (dfu->r_left > dfu_buf_size) {
>   printf("%s: File too big for
> buffer\n", __func__);
>   return -EOVERFLOW;

Applied to u-boot-dfu tree.

Stephen, thanks for your support.

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 2/3] test: dfu: add some more test cases

2014-07-08 Thread Lukasz Majewski
Hi Stephen,

> From: Stephen Warren 
> 
> On Tegra, the DFU buffer size is 1M. Consequently, the 8M test always
> fails. Add tests for the 1M size, and one byte less as a corner case,
> so that some large tests are executed and expected to pass.
> 
> Signed-off-by: Stephen Warren 
> ---
>  test/dfu/dfu_gadget_test_init.sh | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/test/dfu/dfu_gadget_test_init.sh
> b/test/dfu/dfu_gadget_test_init.sh index fb54ad8c55ee..2163a685a55d
> 100755 --- a/test/dfu/dfu_gadget_test_init.sh
> +++ b/test/dfu/dfu_gadget_test_init.sh
> @@ -9,7 +9,7 @@ COLOUR_DEFAULT="\33[0m"
>  
>  LOG_DIR="./log"
>  
> -TEST_FILES_SIZES="63 64 65 127 128 129 4095 4096 4097 959 960 961 8M"
> +TEST_FILES_SIZES="63 64 65 127 128 129 4095 4096 4097 959 960 961
> 1048575 1048576 8M" 
>  printf "Init script for generating data necessary for DFU test
> script" 

Applied to u-boot-dfu tree.

Stephen, thanks for your support.

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH 1/3] test: dfu: cleanup before execution

2014-07-08 Thread Lukasz Majewski
Hi Stephen,

> From: Stephen Warren 
> 
> Call cleanup() before running tests too. If a previous test was
> CTRL-C'd some stale files may have been left around. dfu-util refuses
> to receive a file to a filename that already exists, which results in
> false test failures if the files aren't cleaned up first.
> 
> Signed-off-by: Stephen Warren 

Applied to u-boot-dfu tree.

Stephen, thanks for your support.

-- 
Best regards,

Lukasz Majewski

Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 00/10] sunxi: Bug fixes, sun4i and sun5i support and network improvements

2014-07-08 Thread Hans de Goede
Hi,

On 07/07/2014 10:23 PM, Ian Campbell wrote:
> On Mon, 2014-07-07 at 12:47 -0400, Tom Rini wrote:
>> That's not how we like things to look however when we can help it.  Just
>> toss a __maybe_unused in front of the declaration (and make sure we have
>>  included.
> 
> OK. How about the following?
> 
> Hans, BTW, I spotted this issue with:
> CROSS_COMPILE=arm-linux-gnueabihf- ./MAKEALL -s sunxi
> which is a very useful invocation indeed!

Indeed, I've saved it for future reference.

Regards,

Hans


> 
> 8<---
> 
> From 5e0659b772380114a9e86624aefd1dcb09a90bd9 Mon Sep 17 00:00:00 2001
> From: Ian Campbell 
> Date: Sun, 6 Jul 2014 20:03:20 +0100
> Subject: [PATCH] sunxi: Avoid unused variable warning.
> 
> Mark rc as __maybe_unused since it is infact unused on systems with neither
> EMAC nor GMAC.
> 
> Signed-off-by: Ian Campbell 
> ---
>  arch/arm/cpu/armv7/sunxi/board.c | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/arm/cpu/armv7/sunxi/board.c 
> b/arch/arm/cpu/armv7/sunxi/board.c
> index 1e506b5..538ffa7 100644
> --- a/arch/arm/cpu/armv7/sunxi/board.c
> +++ b/arch/arm/cpu/armv7/sunxi/board.c
> @@ -24,6 +24,8 @@
>  #include 
>  #include 
>  
> +#include 
> +
>  #ifdef CONFIG_SPL_BUILD
>  /* Pointer to the global data structure for SPL */
>  DECLARE_GLOBAL_DATA_PTR;
> @@ -115,7 +117,7 @@ void enable_caches(void)
>   */
>  int cpu_eth_init(bd_t *bis)
>  {
> - int rc;
> + __maybe_unused int rc;
>  
>  #ifdef CONFIG_SUNXI_EMAC
>   rc = sunxi_emac_initialize(bis);
> 
___
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot


Re: [U-Boot] [PATCH v3 00/10] sunxi: Bug fixes, sun4i and sun5i support and network improvements

2014-07-08 Thread Hans de Goede
Hi,

On 07/07/2014 05:13 PM, Ian Campbell wrote:
> On Mon, 2014-07-07 at 14:53 +0200, Hans de Goede wrote:
>> Hi,
>>
>> On 07/06/2014 09:26 PM, Ian Campbell wrote:
>>> On Mon, 2014-06-09 at 11:36 +0200, Hans de Goede wrote:
 adds sun4i and sun5i support
>>>
>>> Does this series omit FEL mode support or did you just not include it
>>> for the new boards?
>>
>> I just did not include it.
>>
>>> I think in general we want a _FEL variant for every board except the
>>> minority which don't have an OTG port etc.
>>
>> I'm not sold on this idea. Normal users (and distros) will never use
>> the FEL variants, and a developer needing a FEL build can just as
>> easily edit boards.cfg, instead of us having 2 lines there for each
>> and every sunxi board (of which there are *a lot*.
> 
> Actually Debian is providing the FEL binaries for CT in its u-boot
> packages already.

Hmm, ok.

> I was planning to provide a script to automatically install Debian
> starting from a bare board booted in FEL mode from a host system and
> getting the installer to put the bootloader on the MMC etc etc. (I'm a
> long way from actually having this working...)

Interesting (mostly for emmc devices, of which there are a few sunxi ones
now).

I'm still not sold on having 2 entries for each and every board though.

Have you looked at extending the SPL buildsys bits, which in essence do
2 builds, to do 3 builds for sunxi, so that we simply always build
both SPL flavors?

Regards,

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


Re: [U-Boot] [PATCH v3 00/10] sunxi: Bug fixes, sun4i and sun5i support and network improvements

2014-07-08 Thread Ian Campbell
On Mon, 2014-07-07 at 16:45 -0400, Tom Rini wrote:
> On Mon, Jul 07, 2014 at 09:23:13PM +0100, Ian Campbell wrote:
> > On Mon, 2014-07-07 at 12:47 -0400, Tom Rini wrote:
> > > That's not how we like things to look however when we can help it.  Just
> > > toss a __maybe_unused in front of the declaration (and make sure we have
> > >  included.
> > 
> > OK. How about the following?
> > 
> > Hans, BTW, I spotted this issue with:
> > CROSS_COMPILE=arm-linux-gnueabihf- ./MAKEALL -s sunxi
> > which is a very useful invocation indeed!
> 
> FWIW, you might want to run -a arm from time to time since there's some
> shared drivers between sunxi and others.

Ack.

I don't suppose there is a bot somewhere which provides baseline results
for comparison?

> > From 5e0659b772380114a9e86624aefd1dcb09a90bd9 Mon Sep 17 00:00:00 2001
> > From: Ian Campbell 
> > Date: Sun, 6 Jul 2014 20:03:20 +0100
> > Subject: [PATCH] sunxi: Avoid unused variable warning.
> > 
> > Mark rc as __maybe_unused since it is infact unused on systems with neither
> > EMAC nor GMAC.
> > 
> > Signed-off-by: Ian Campbell 
> 
> Acked-by: Tom Rini 
> 
> Thanks.

Thank you.

Ian.


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