]> git.sur5r.net Git - u-boot/commitdiff
Merge git://git.denx.de/u-boot-dm
authorTom Rini <trini@konsulko.com>
Fri, 8 Jan 2016 15:02:25 +0000 (10:02 -0500)
committerTom Rini <trini@konsulko.com>
Fri, 8 Jan 2016 15:02:25 +0000 (10:02 -0500)
arch/sandbox/dts/test.dts
common/fdt_support.c
common/usb_kbd.c
common/usb_storage.c
drivers/net/sandbox.c
include/usb.h
net/eth.c
net/net.c
test/dm/Makefile

index b6d9a15da4a78782da6c5ebf95d6d37e1041c065..2e0d320b1e48d4c9b37a4d600c91d63b98afec76 100644 (file)
                        0x38 8>;
        };
 
+       timer {
+               compatible = "sandbox,timer";
+               clock-frequency = <1000000>;
+       };
+
        uart0: serial {
                compatible = "sandbox,serial";
                u-boot,dm-pre-reloc;
index 66464dbfd8b74f267dec13d1692a2b21d48838d5..a539389a9e88b5eb75a36b73de45c5214ea256a1 100644 (file)
@@ -952,8 +952,7 @@ void fdt_del_node_and_alias(void *blob, const char *alias)
 /* Max address size we deal with */
 #define OF_MAX_ADDR_CELLS      4
 #define OF_BAD_ADDR    FDT_ADDR_T_NONE
-#define OF_CHECK_COUNTS(na, ns)        ((na) > 0 && (na) <= OF_MAX_ADDR_CELLS && \
-                       (ns) > 0)
+#define OF_CHECK_COUNTS(na)    ((na) > 0 && (na) <= OF_MAX_ADDR_CELLS)
 
 /* Debug utility */
 #ifdef DEBUG
@@ -1121,7 +1120,7 @@ static u64 __of_translate_address(void *blob, int node_offset, const fdt32_t *in
 
        /* Cound address cells & copy address locally */
        bus->count_cells(blob, parent, &na, &ns);
-       if (!OF_CHECK_COUNTS(na, ns)) {
+       if (!OF_CHECK_COUNTS(na)) {
                printf("%s: Bad cell count for %s\n", __FUNCTION__,
                       fdt_get_name(blob, node_offset, NULL));
                goto bail;
@@ -1148,7 +1147,7 @@ static u64 __of_translate_address(void *blob, int node_offset, const fdt32_t *in
                /* Get new parent bus and counts */
                pbus = &of_busses[0];
                pbus->count_cells(blob, parent, &pna, &pns);
-               if (!OF_CHECK_COUNTS(pna, pns)) {
+               if (!OF_CHECK_COUNTS(pna)) {
                        printf("%s: Bad cell count for %s\n", __FUNCTION__,
                                fdt_get_name(blob, node_offset, NULL));
                        break;
index 9617a4848ad3b0d2dd3fd82d787403ccb6287b4b..cbb1995de3398431878811f92f6e79551b947965 100644 (file)
@@ -611,6 +611,41 @@ static int usb_kbd_probe(struct udevice *dev)
        return ret;
 }
 
+static int usb_kbd_remove(struct udevice *dev)
+{
+       struct usb_device *udev = dev_get_parent_priv(dev);
+       struct usb_kbd_pdata *data;
+       struct stdio_dev *sdev;
+       int ret;
+
+       sdev = stdio_get_by_name(DEVNAME);
+       if (!sdev) {
+               ret = -ENXIO;
+               goto err;
+       }
+       data = udev->privptr;
+       if (stdio_deregister_dev(sdev, true)) {
+               ret = -EPERM;
+               goto err;
+       }
+#ifdef CONFIG_CONSOLE_MUX
+       if (iomux_doenv(stdin, getenv("stdin"))) {
+               ret = -ENOLINK;
+               goto err;
+       }
+#endif
+#ifdef CONFIG_SYS_USB_EVENT_POLL_VIA_INT_QUEUE
+       destroy_int_queue(udev, data->intq);
+#endif
+       free(data->new);
+       free(data);
+
+       return 0;
+err:
+       printf("%s: warning, ret=%d", __func__, ret);
+       return ret;
+}
+
 static const struct udevice_id usb_kbd_ids[] = {
        { .compatible = "usb-keyboard" },
        { }
@@ -621,6 +656,7 @@ U_BOOT_DRIVER(usb_kbd) = {
        .id     = UCLASS_KEYBOARD,
        .of_match = usb_kbd_ids,
        .probe = usb_kbd_probe,
+       .remove = usb_kbd_remove,
 };
 
 static const struct usb_device_id kbd_id_table[] = {
index 4fa6538db58af627ffce1ae39b29e84ab2c6b510..e61a8c8adfd02e82c320169dc6da9e28f515d8ef 100644 (file)
@@ -65,7 +65,7 @@ static const unsigned char us_direction[256/8] = {
 static ccb usb_ccb __attribute__((aligned(ARCH_DMA_MINALIGN)));
 static __u32 CBWTag;
 
-#define USB_MAX_STOR_DEV 5
+#define USB_MAX_STOR_DEV 7
 static int usb_max_devs; /* number of highest available usb device */
 
 static block_dev_desc_t usb_dev_desc[USB_MAX_STOR_DEV];
index 6763a248f28d0b327c8b14ff757206cf10a26432..d538d379bbec77cb54c7072b63480218f3d456dd 100644 (file)
@@ -157,7 +157,7 @@ static int sb_eth_recv(struct udevice *dev, int flags, uchar **packetp)
        struct eth_sandbox_priv *priv = dev_get_priv(dev);
 
        if (skip_timeout) {
-               sandbox_timer_add_offset(10000UL);
+               sandbox_timer_add_offset(11000UL);
                skip_timeout = false;
        }
 
index 253936456595b18e0cb477a0c999f96cf4e2004a..0b410b6cd10b6cece52ba0748be4ff83b768f573 100644 (file)
@@ -227,7 +227,7 @@ int board_usb_cleanup(int index, enum usb_init_type init);
 
 #ifdef CONFIG_USB_STORAGE
 
-#define USB_MAX_STOR_DEV 5
+#define USB_MAX_STOR_DEV 7
 block_dev_desc_t *usb_stor_get_dev(int index);
 int usb_stor_scan(int mode);
 int usb_stor_info(void);
index 6cf3a353a347d7a91e1e344d204bd82a27ccc7b4..18c53bf58ab28adfa9cbe6e4cf6a933f21599864 100644 (file)
--- a/net/eth.c
+++ b/net/eth.c
@@ -337,14 +337,30 @@ U_BOOT_ENV_CALLBACK(ethaddr, on_ethaddr);
 
 int eth_init(void)
 {
-       struct udevice *current;
+       char *ethact = getenv("ethact");
+       char *ethrotate = getenv("ethrotate");
+       struct udevice *current = NULL;
        struct udevice *old_current;
        int ret = -ENODEV;
 
-       current = eth_get_dev();
+       /*
+        * When 'ethrotate' variable is set to 'no' and 'ethact' variable
+        * is already set to an ethernet device, we should stick to 'ethact'.
+        */
+       if ((ethrotate != NULL) && (strcmp(ethrotate, "no") == 0)) {
+               if (ethact) {
+                       current = eth_get_dev_by_name(ethact);
+                       if (!current)
+                               return -EINVAL;
+               }
+       }
+
        if (!current) {
-               printf("No ethernet found.\n");
-               return -ENODEV;
+               current = eth_get_dev();
+               if (!current) {
+                       printf("No ethernet found.\n");
+                       return -ENODEV;
+               }
        }
 
        old_current = current;
@@ -1039,6 +1055,17 @@ int eth_receive(void *packet, int length)
 static void eth_current_changed(void)
 {
        char *act = getenv("ethact");
+       char *ethrotate;
+
+       /*
+        * The call to eth_get_dev() below has a side effect of rotating
+        * ethernet device if uc_priv->current == NULL. This is not what
+        * we want when 'ethrotate' variable is 'no'.
+        */
+       ethrotate = getenv("ethrotate");
+       if ((ethrotate != NULL) && (strcmp(ethrotate, "no") == 0))
+               return;
+
        /* update current ethernet name */
        if (eth_get_dev()) {
                if (act == NULL || strcmp(act, eth_get_name()) != 0)
index 4d5746a7b356d84319b91346c02661f6768e570d..fba111edfba263846f00e178852740efc3b08349 100644 (file)
--- a/net/net.c
+++ b/net/net.c
@@ -542,6 +542,9 @@ restart:
 #ifdef CONFIG_SHOW_ACTIVITY
                show_activity(1);
 #endif
+               if (arp_timeout_check() > 0)
+                       time_start = get_timer(0);
+
                /*
                 *      Check the ethernet for a new packet.  The ethernet
                 *      receive routine will process it.
@@ -570,10 +573,6 @@ restart:
                        goto done;
                }
 
-               if (arp_timeout_check() > 0) {
-                   time_start = get_timer(0);
-               }
-
                /*
                 *      Check for a timeout, and run the timeout handler
                 *      if we have one.
index 681c6aec71468c4958212e320185a427dc0c0ecf..3ff1b75e6f840600b5bbb97cbead84b03497aab8 100644 (file)
@@ -27,8 +27,8 @@ obj-y += regmap.o
 obj-$(CONFIG_REMOTEPROC) += remoteproc.o
 obj-$(CONFIG_RESET) += reset.o
 obj-$(CONFIG_DM_RTC) += rtc.o
-obj-$(CONFIG_DM_SPI_FLASH) += sf.o
-obj-$(CONFIG_DM_SPI) += spi.o
+#obj-$(CONFIG_DM_SPI_FLASH) += sf.o
+#obj-$(CONFIG_DM_SPI) += spi.o
 obj-y += syscon.o
 obj-$(CONFIG_DM_USB) += usb.o
 obj-$(CONFIG_DM_PMIC) += pmic.o