Send commitlog mailing list submissions to
        [email protected]

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.openmoko.org/mailman/listinfo/commitlog
or, via email, send a message with subject or body 'help' to
        [EMAIL PROTECTED]

You can reach the person managing the list at
        [EMAIL PROTECTED]

When replying, please edit your Subject line so it is more specific
than "Re: Contents of commitlog digest..."
Today's Topics:

   1. r1929 - in trunk/src/host/qemu-neo1973: . hw
      ([EMAIL PROTECTED])
   2. r1930 - trunk/src/target/u-boot/patches
      ([EMAIL PROTECTED])
   3. r1931 - trunk/src/target/kernel/patches
      ([EMAIL PROTECTED])
--- Begin Message ---
Author: andrew
Date: 2007-05-08 17:25:51 +0200 (Tue, 08 May 2007)
New Revision: 1929

Modified:
   trunk/src/host/qemu-neo1973/hw/usb.c
   trunk/src/host/qemu-neo1973/hw/usb.h
   trunk/src/host/qemu-neo1973/monitor.c
   trunk/src/host/qemu-neo1973/usb-linux-gadget.c
   trunk/src/host/qemu-neo1973/vl.c
   trunk/src/host/qemu-neo1973/vl.h
Log:
New monitor commands for managing multiple USB slave configurations (should be 
user-ready now).


Modified: trunk/src/host/qemu-neo1973/hw/usb.c
===================================================================
--- trunk/src/host/qemu-neo1973/hw/usb.c        2007-05-08 09:21:11 UTC (rev 
1928)
+++ trunk/src/host/qemu-neo1973/hw/usb.c        2007-05-08 15:25:51 UTC (rev 
1929)
@@ -184,7 +184,7 @@
     q = buf;
     len = strlen(str);
     *q++ = 2 * len + 2;
-    *q++ = 3;
+    *q++ = USB_DT_STRING;
     for(i = 0; i < len; i++) {
         *q++ = str[i];
         *q++ = 0;
@@ -192,6 +192,22 @@
     return q - buf;
 }
 
+int get_usb_string(char *buf, const uint8_t *str)
+{
+    int len, i;
+    char *q;
+
+    q = str;
+    len = (*q++ - 2) / 2;
+    q++;
+    for(i = 0; i < len; i++) {
+        buf[i] = *q++;
+        q++;
+    }
+    buf[i] = 0;
+    return len;
+}
+
 /* Send an internal message to a USB device.  */
 void usb_send_msg(USBDevice *dev, int msg)
 {

Modified: trunk/src/host/qemu-neo1973/hw/usb.h
===================================================================
--- trunk/src/host/qemu-neo1973/hw/usb.h        2007-05-08 09:21:11 UTC (rev 
1928)
+++ trunk/src/host/qemu-neo1973/hw/usb.h        2007-05-08 15:25:51 UTC (rev 
1929)
@@ -195,6 +195,7 @@
 void usb_attach(USBPort *port, USBDevice *dev);
 int usb_generic_handle_packet(USBDevice *s, USBPacket *p);
 int set_usb_string(uint8_t *buf, const char *str);
+int get_usb_string(char *buf, const uint8_t *str);
 void usb_send_msg(USBDevice *dev, int msg);
 
 void usb_packet_complete(USBPacket *p);
@@ -216,6 +217,7 @@
 
 /* usb-linux-gadget.c */
 int usb_gadget_init(void);
+void usb_gadget_config_set(USBPort *port, int config);
 
 /* usb-hid.c */
 USBDevice *usb_mouse_init(void);

Modified: trunk/src/host/qemu-neo1973/monitor.c
===================================================================
--- trunk/src/host/qemu-neo1973/monitor.c       2007-05-08 09:21:11 UTC (rev 
1928)
+++ trunk/src/host/qemu-neo1973/monitor.c       2007-05-08 15:25:51 UTC (rev 
1929)
@@ -1279,6 +1279,8 @@
       "", "show guest USB devices", },
     { "usbhost", "", usb_host_info,
       "", "show host USB devices", },
+    { "usbslave", "", usb_slave_info,
+      "", "show USB configurations exported by guest", },
     { "profile", "", do_info_profile,
       "", "show profiling information", },
     { "capture", "", do_info_capture,

Modified: trunk/src/host/qemu-neo1973/usb-linux-gadget.c
===================================================================
--- trunk/src/host/qemu-neo1973/usb-linux-gadget.c      2007-05-08 09:21:11 UTC 
(rev 1928)
+++ trunk/src/host/qemu-neo1973/usb-linux-gadget.c      2007-05-08 15:25:51 UTC 
(rev 1929)
@@ -797,6 +797,12 @@
     return ret;
 }
 
+void usb_gadget_config_set(USBPort *port, int config)
+{
+    struct gadget_state_s *hci = (struct gadget_state_s *) port->opaque;
+    hci->config_num = config;
+}
+
 #else
 #include "vl.h"
 
@@ -805,4 +811,8 @@
     return -ENODEV;
 }
 
+void usb_gadget_config_set(USBPort *port, int config)
+{
+}
+
 #endif

Modified: trunk/src/host/qemu-neo1973/vl.c
===================================================================
--- trunk/src/host/qemu-neo1973/vl.c    2007-05-08 09:21:11 UTC (rev 1928)
+++ trunk/src/host/qemu-neo1973/vl.c    2007-05-08 15:25:51 UTC (rev 1929)
@@ -4001,11 +4001,15 @@
        if (nr >= (unsigned int)nb_nics || strcmp(nd_table[nr].model, "usb"))
                return -1;
         dev = usb_net_init(&nd_table[nr]);
-    } else if (!strcmp(devname, "gadget")) {
+    } else if (strstart(devname, "gadget", &p)) {
         dev = usb_gadget;
         port = host_usb_ports;
         if (!dev || !port)
             return -1;
+        if (p[0] == ':')
+            usb_gadget_config_set(port, strtoul(&p[1], NULL, 0));
+        else if (p[0] != 0)
+            return -1;
         goto attach;
     } else {
         return 0;
@@ -4132,6 +4136,187 @@
     }
 }
 
+struct usb_slave_info_s {
+    uint8_t buffer[256];
+    int config_num;
+    int packet_num;
+    USBPacket packet[2];
+    uint64_t timeout;
+    USBDevice *slave;
+    int timedout;
+    int config;
+    int manf_str;
+    int prod_str;
+    USBCallback *cb;
+    QEMUTimer *timeout_tm;
+};
+
+static void usb_packet_next(USBPacket *prev, void *opaque)
+{
+    struct usb_slave_info_s *info = (struct usb_slave_info_s *) opaque;
+    int ret;
+    int num;
+
+    if (info->timedout)
+        return;
+
+    num = info->packet_num ++;
+
+    if (num >= 2) {
+        if (qemu_timer_pending(info->timeout_tm))
+            qemu_del_timer(info->timeout_tm);
+        info->cb(prev, opaque);
+        return;
+    }
+
+    ret = info->slave->handle_packet(info->slave, &info->packet[num]);
+
+    if (ret >= 0) {
+        info->packet[num].len = ret;
+        info->packet[num].complete_cb(&info->packet[num],
+                                      info->packet[num].complete_opaque);
+    } else if (ret == USB_RET_ASYNC) {
+        qemu_mod_timer(info->timeout_tm,
+                       qemu_get_clock(rt_clock) + info->timeout);
+    } else {
+        term_printf("Packet not handled\n");
+    }
+}
+
+static void usb_get_descriptor(struct usb_slave_info_s *info, USBCallback cb,
+                               int desc, int idx)
+{
+    info->packet_num = 0;
+    info->cb = cb;
+
+    /* Ask for the descriptor */
+    info->packet[0].pid = USB_TOKEN_SETUP;
+    info->packet[0].devaddr = 0;
+    info->packet[0].devep = 0;
+    info->packet[0].data = info->buffer;
+    info->packet[0].len = 8;
+    info->packet[0].complete_cb = usb_packet_next;
+    info->packet[0].complete_opaque = info;
+
+    info->buffer[0] = USB_DIR_IN | USB_TYPE_STANDARD | USB_RECIP_DEVICE;
+    info->buffer[1] = USB_REQ_GET_DESCRIPTOR;
+    info->buffer[2] = idx;
+    info->buffer[3] = desc;
+    info->buffer[4] = 0x00;
+    info->buffer[5] = 0x00;
+    info->buffer[6] = sizeof(info->buffer) & 0xff;
+    info->buffer[7] = sizeof(info->buffer) >> 8;
+
+    /* Read the response */
+    info->packet[1].pid = USB_TOKEN_IN;
+    info->packet[1].devaddr = 0;
+    info->packet[1].devep = 0;
+    info->packet[1].data = info->buffer;
+    info->packet[1].len = sizeof(info->buffer);
+    info->packet[1].complete_cb = usb_packet_next;
+    info->packet[1].complete_opaque = info;
+
+    usb_packet_next(0, info);
+}
+
+static void usb_config_desc(USBPacket *packet, void *opaque)
+{
+    struct usb_slave_info_s *info = (struct usb_slave_info_s *) opaque;
+    char buffer[128];
+    int config_str;
+
+    if (packet->data[1] == USB_DT_CONFIG) {
+        config_str = packet->data[6];
+        usb_get_descriptor(info, usb_config_desc, USB_DT_STRING, config_str);
+    } else if (packet->data[1] == USB_DT_STRING) {
+        get_usb_string(buffer, packet->data);
+        term_printf("Configuration %i: %s\n", info->config, buffer);
+
+        if (++ info->config < info->config_num)
+            usb_get_descriptor(info, usb_config_desc,
+                               USB_DT_CONFIG, info->config);
+    } else {
+        term_printf("Response unrecognised\n");
+    }
+}
+
+static void usb_prod_string(USBPacket *packet, void *opaque)
+{
+    struct usb_slave_info_s *info = (struct usb_slave_info_s *) opaque;
+    char buffer[128];
+
+    if (packet->data[1] != USB_DT_STRING) {
+        term_printf("Response unrecognised\n");
+        return;
+    }
+
+    get_usb_string(buffer, packet->data);
+    term_printf("Product: %s\n", buffer);
+
+    info->config = 0;
+    usb_get_descriptor(info, usb_config_desc, USB_DT_CONFIG, 0);
+}
+
+static void usb_manf_string(USBPacket *packet, void *opaque)
+{
+    struct usb_slave_info_s *info = (struct usb_slave_info_s *) opaque;
+    char buffer[128];
+
+    if (packet->data[1] != USB_DT_STRING) {
+        term_printf("Response unrecognised\n");
+        return;
+    }
+
+    get_usb_string(buffer, packet->data);
+    term_printf("Manufacturer: %s\n", buffer);
+
+    usb_get_descriptor(info, usb_prod_string, USB_DT_STRING, info->prod_str);
+}
+
+static void usb_dev_desc(USBPacket *packet, void *opaque)
+{
+    struct usb_slave_info_s *info = (struct usb_slave_info_s *) opaque;
+
+    if (packet->data[1] != USB_DT_DEVICE) {
+        term_printf("Response unrecognised\n");
+        return;
+    }
+
+    info->config_num = packet->data[17];
+    info->manf_str = packet->data[14];
+    info->prod_str = packet->data[15];
+    term_printf("USB%x.%x device %04x:%04x:\n",
+                packet->data[3], packet->data[4],
+                (packet->data[9] << 8) | packet->data[8],
+                (packet->data[11] << 8) | packet->data[10]);
+
+    usb_get_descriptor(info, usb_manf_string, USB_DT_STRING, info->manf_str);
+}
+
+void usb_timeout_tick(void *opaque)
+{
+    struct usb_slave_info_s *info = (struct usb_slave_info_s *) opaque;
+    term_printf("Slave device response time-out\n");
+    info->timedout = 1;
+}
+
+void usb_slave_info(void)
+{
+    struct usb_slave_info_s *info =
+            qemu_mallocz(sizeof(struct usb_slave_info_s));
+    if (!usb_gadget) {
+        term_printf("No USB slave functionality\n");
+        return;
+    }
+
+    info->slave = usb_gadget;
+    info->timeout = 500;
+    info->timedout = 0;
+    info->timeout_tm = qemu_new_timer(rt_clock, usb_timeout_tick, info);
+
+    usb_get_descriptor(info, usb_dev_desc, USB_DT_DEVICE, 0);
+}
+
 /***********************************************************/
 /* PCMCIA/Cardbus */
 

Modified: trunk/src/host/qemu-neo1973/vl.h
===================================================================
--- trunk/src/host/qemu-neo1973/vl.h    2007-05-08 09:21:11 UTC (rev 1928)
+++ trunk/src/host/qemu-neo1973/vl.h    2007-05-08 15:25:51 UTC (rev 1929)
@@ -1239,6 +1239,7 @@
 void do_usb_add(const char *devname);
 void do_usb_del(const char *devname);
 void usb_info(void);
+void usb_slave_info(void);
 
 /* scsi-disk.c */
 enum scsi_reason {




--- End Message ---
--- Begin Message ---
Author: laforge
Date: 2007-05-09 09:41:42 +0200 (Wed, 09 May 2007)
New Revision: 1930

Modified:
   trunk/src/target/u-boot/patches/uboot-hxd8.patch
Log:
* HXD8: use correct rootfs partition size for 1GByte NAND flash
* HXD8: fix GPIO initialization for NAND chip select (fixes NAND write)
* HXD8: disable u-boot video driver since it currently crashes ;)
* HXD8: use dynamic partition and dynamic environment


Modified: trunk/src/target/u-boot/patches/uboot-hxd8.patch
===================================================================
--- trunk/src/target/u-boot/patches/uboot-hxd8.patch    2007-05-08 15:25:51 UTC 
(rev 1929)
+++ trunk/src/target/u-boot/patches/uboot-hxd8.patch    2007-05-09 07:41:42 UTC 
(rev 1930)
@@ -4,7 +4,7 @@
 ===================================================================
 --- u-boot.orig/Makefile
 +++ u-boot/Makefile
-@@ -1995,6 +1995,9 @@
+@@ -1999,6 +1999,9 @@
  qt2410_config :       unconfig
        @./mkconfig $(@:_config=) arm arm920t qt2410 NULL s3c24x0
  
@@ -88,7 +88,7 @@
 ===================================================================
 --- /dev/null
 +++ u-boot/board/hxd8/hxd8.c
-@@ -0,0 +1,169 @@
+@@ -0,0 +1,170 @@
 +/*
 + * (C) Copyright 2007 by OpenMoko, Inc.
 + * Author: Harald Welte <[EMAIL PROTECTED]>
@@ -187,6 +187,7 @@
 +
 +      /* set up the I/O ports */
 +      gpio->GPACON = 0x005E0FFE;
++      gpio->GPADAT = 0x0001C000;
 +      gpio->GPBCON = 0x00045542;
 +      gpio->GPBUP = 0x000007FF;
 +      gpio->GPCCON = 0xAAAA55A9;
@@ -253,7 +254,7 @@
 +   images: 640*480*2*2 = 1228800 < 1245184. */
 +
 +unsigned int dynpart_size[] = {
-+    CFG_UBOOT_SIZE, 0x20000, 0x200000, 0xa0000, 0x3d5c000-CFG_UBOOT_SIZE, 0 };
++    CFG_UBOOT_SIZE, 0x20000, 0x200000, 0xa0000, 0x3fd00000, 0 };
 +char *dynpart_names[] = {
 +    "u-boot", "u-boot_env", "kernel", "splash", "rootfs", NULL };
 +
@@ -438,7 +439,7 @@
 ===================================================================
 --- /dev/null
 +++ u-boot/include/configs/hxd8.h
-@@ -0,0 +1,272 @@
+@@ -0,0 +1,275 @@
 +/*
 + * (C) Copyright 2007 OpenMoko, Inc.
 + * Author: Harald Welte <[EMAIL PROTECTED]>
@@ -479,8 +480,8 @@
 + * (easy to change)
 + */
 +#define CONFIG_ARM920T                1       /* This is an ARM920T Core      
*/
-+#define       CONFIG_S3C2440          1       /* in a SAMSUNG S3C2410 SoC     
*/
-+#define CONFIG_SMDK2440               1       /* on a SAMSUNG SMDK2410 Board  
*/
++#define       CONFIG_S3C2440          1       /* in a SAMSUNG S3C2440 SoC     
*/
++#define CONFIG_SMDK2440               1       /* on a SAMSUNG SMDK2440 Board  
*/
 +
 +/* input clock of PLL */
 +#define CONFIG_SYS_CLK_FREQ   16934400/* the HXD8 has this input clock */
@@ -492,7 +493,7 @@
 +/*
 + * Size of malloc() pool
 + */
-+#define CFG_MALLOC_LEN                (CFG_ENV_SIZE + 400*1024)
++#define CFG_MALLOC_LEN                (CFG_ENV_SIZE + 2048*1024)
 +                                      /* >> CFG_VIDEO_LOGO_MAX_SIZE */
 +#define CFG_GBL_DATA_SIZE     128     /* size in bytes reserved for initial 
data */
 +
@@ -529,7 +530,7 @@
 +                      /* CFG_CMD_IRQ   | */  \
 +                      CFG_CMD_BOOTD    | \
 +                      CFG_CMD_CONSOLE  | \
-+                      CFG_CMD_BMP      | \
++                      /* CFG_CMD_BMP   | */ \
 +                      CFG_CMD_ASKENV   | \
 +                      CFG_CMD_RUN      | \
 +                      CFG_CMD_ECHO     | \
@@ -596,7 +597,7 @@
 + *
 + * The stack sizes are set up in start.S using the settings below
 + */
-+#define CONFIG_STACKSIZE      (128*1024)      /* regular stack */
++#define CONFIG_STACKSIZE      (512*1024)      /* regular stack */
 +#ifdef CONFIG_USE_IRQ
 +#define CONFIG_STACKSIZE_IRQ  (8*1024)        /* IRQ stack */
 +#define CONFIG_STACKSIZE_FIQ  (4*1024)        /* FIQ stack */
@@ -641,9 +642,9 @@
 +/* No NOR flash in this device */
 +#define CFG_NO_FLASH          1
 +
++#define CFG_ENV_SIZE          0x20000         /* 128k Total Size of 
Environment Sector */
 +#define       CFG_ENV_IS_IN_NAND      1
-+#define CFG_ENV_SIZE          0x4000          /* 16k Total Size of 
Environment Sector */
-+#define CFG_ENV_OFFSET_OOB    1               /* Location of ENV stored in 
block 0 OOB */
++#define CFG_ENV_OFFSET_OOB    1               /* Location of ENV stored in 
block 0 OOB */
 +#define       CFG_PREBOOT_OVERRIDE    1       /* allow preboot from memory */
 +
 +#define NAND_MAX_CHIPS                1
@@ -685,6 +686,7 @@
 +/* we have a board_late_init() function */
 +#define BOARD_LATE_INIT                       1
 +
++#if 0
 +#define CONFIG_VIDEO
 +#define CONFIG_VIDEO_S3C2410
 +#define CONFIG_CFB_CONSOLE
@@ -700,6 +702,7 @@
 +#define VIDEO_GETC_FCT                serial_getc
 +
 +#define LCD_VIDEO_ADDR                0x33d00000
++#endif
 +
 +#define CONFIG_S3C2410_NAND_BBT                1
 +//#define CONFIG_S3C2410_NAND_HWECC              1
@@ -707,8 +710,9 @@
 +#define CONFIG_DRIVER_PCF50606                1
 +
 +#define MTDIDS_DEFAULT        "nand0=hxd8-nand"
-+#define MTPARTS_DEFAULT       
"hxd8-nand:256k(u-boot),16k(u-boot_env),2M(kernel),640k(splash),-(jffs2)"
++#define MTPARTS_DEFAULT       
"hxd8-nand:256k(u-boot),128k(u-boot_env),2M(kernel),640k(splash),0x3fd00000(jffs2)"
 +#define CFG_NAND_DYNPART_MTD_KERNEL_NAME "hxd8-nand"
++#define CONFIG_NAND_DYNPART
 +
 +#endif        /* __CONFIG_H */
 Index: u-boot/board/hxd8/udc.c




--- End Message ---
--- Begin Message ---
Author: laforge
Date: 2007-05-09 10:43:38 +0200 (Wed, 09 May 2007)
New Revision: 1931

Modified:
   trunk/src/target/kernel/patches/hxd8-core.patch
Log:
* HXD8: remove static nand partition table, u-boot generates mtdparts 
commandline
* HXD8: fix machine type 


Modified: trunk/src/target/kernel/patches/hxd8-core.patch
===================================================================
--- trunk/src/target/kernel/patches/hxd8-core.patch     2007-05-09 07:41:42 UTC 
(rev 1930)
+++ trunk/src/target/kernel/patches/hxd8-core.patch     2007-05-09 08:43:38 UTC 
(rev 1931)
@@ -29,7 +29,7 @@
 ===================================================================
 --- /dev/null
 +++ linux-2.6.21-moko/arch/arm/mach-s3c2440/mach-hxd8.c
-@@ -0,0 +1,430 @@
+@@ -0,0 +1,393 @@
 +/* linux/arch/arm/mach-s3c2440/mach-hxd8.c
 + *
 + * S3C2440 Machine Support for the FIC HXD8
@@ -161,47 +161,10 @@
 +      }
 +};
 +
-+/* NAND partitions.  Once we use dynpart, this goes away */
-+static struct mtd_partition hxd8_default_nand_part[] = {
-+      [0] = {
-+              .name   = "U-Boot",
-+              .size   = 0x100000,
-+              .offset = 0,
-+      },
-+      [1] = {
-+              .name   = "kernel",
-+              .offset = 0x100000,
-+              .size   = SZ_2M,
-+      },
-+      [2] = {
-+              .name   = "update",
-+              .offset = 0x300000,
-+              .size   = SZ_2M,
-+      },
-+      [3] = {
-+              .name   = "splash",
-+              .offset = 0x500000,
-+              .size   = SZ_1M,
-+      },
-+      [4] = {
-+              .name   = "jffs2",
-+              .offset = 0x600000,
-+              .size   = SZ_2M * 10,
-+      },
-+      [5] = {
-+              .name   = "temp",
-+              .offset = 0x1a00000,
-+              .size   = 0x30000000,
-+      },
-+};
-+
 +static struct s3c2410_nand_set hxd8_nand_sets[] = {
 +      [0] = {
 +              .name           = "hxd8-nand",
 +              .nr_chips       = 1,
-+              /* FIXME: the static partition table should be removed soon */
-+              .nr_partitions  = ARRAY_SIZE(hxd8_default_nand_part),
-+              .partitions     = hxd8_default_nand_part,
 +      },
 +};
 +
@@ -449,7 +412,7 @@
 +      s3c2410_pm_init();
 +}
 +
-+MACHINE_START(S3C2440, "HXD8")
++MACHINE_START(HXD8, "HXD8")
 +      /* Maintainer: Harald Welte <[EMAIL PROTECTED]> */
 +      .phys_io        = S3C2410_PA_UART,
 +      .io_pg_offst    = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,




--- End Message ---
_______________________________________________
commitlog mailing list
[email protected]
http://lists.openmoko.org/mailman/listinfo/commitlog

Reply via email to