Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions board/tess/flash.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh

./output/host/usr/bin/sunxi-fel -v uboot output/images/u-boot-sunxi-with-spl.bin \
./output/host/usr/bin/sunxi-fel --progress -v uboot output/images/u-boot-sunxi-with-spl.bin \
write 0x42000000 output/images/zImage \
write 0x43000000 output/images/sun8i-t113s-tess.dtb \
write 0x43100000 output/images/boot.scr \
write 0x43300000 output/images/rootfs.cpio.uboot
write 0x43300000 output/images/rootfs.cpio.uboot
79 changes: 79 additions & 0 deletions board/tess/patches/uboot/0001-fix-sunxi-usb-gadget.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
--- a/drivers/usb/musb-new/sunxi.c
+++ b/drivers/usb/musb-new/sunxi.c
@@ -429,6 +429,16 @@ static struct musb_hdrc_config musb_config_h3 = {
.ram_bits = SUNXI_MUSB_RAM_BITS,
};

+#if CONFIG_IS_ENABLED(DM_USB_GADGET)
+int dm_usb_gadget_handle_interrupts(struct udevice *dev) {
+ struct sunxi_glue *glue = dev_get_priv(dev);
+ struct musb_host_data *host = &glue->mdata;
+
+ host->host->isr(0, host->host);
+ return 0;
+}
+#endif
+
static int musb_usb_probe(struct udevice *dev)
{
struct sunxi_glue *glue = dev_get_priv(dev);
@@ -437,10 +447,6 @@ static int musb_usb_probe(struct udevice *dev)
void *base = dev_read_addr_ptr(dev);
int ret;

-#ifdef CONFIG_USB_MUSB_HOST
- struct usb_bus_priv *priv = dev_get_uclass_priv(dev);
-#endif
-
if (!base)
return -EINVAL;

@@ -471,25 +477,30 @@ static int musb_usb_probe(struct udevice *dev)
pdata.platform_ops = &sunxi_musb_ops;
pdata.config = glue->cfg->config;

-#ifdef CONFIG_USB_MUSB_HOST
- priv->desc_before_addr = true;
-
- pdata.mode = MUSB_HOST;
- host->host = musb_init_controller(&pdata, &glue->dev, base);
- if (!host->host)
- return -EIO;
-
- ret = musb_lowlevel_init(host);
- if (!ret)
- printf("Allwinner mUSB OTG (Host)\n");
-#else
- pdata.mode = MUSB_PERIPHERAL;
- host->host = musb_register(&pdata, &glue->dev, base);
- if (IS_ERR_OR_NULL(host->host))
- return -EIO;
+ if (IS_ENABLED(CONFIG_USB_MUSB_HOST)) {
+ struct usb_bus_priv *priv = dev_get_uclass_priv(dev);
+ priv->desc_before_addr = true;
+
+ pdata.mode = MUSB_HOST;
+ host->host = musb_init_controller(&pdata, &glue->dev, base);
+ if (!host->host)
+ return -EIO;
+
+ return musb_lowlevel_init(host);
+ } else if (CONFIG_IS_ENABLED(DM_USB_GADGET)) {
+ pdata.mode = MUSB_PERIPHERAL;
+ host->host = musb_init_controller(&pdata, &glue->dev, base);
+ if (!host->host)
+ return -EIO;
+ return usb_add_gadget_udc(&glue->dev, &host->host->g);
+ } else {
+ pdata.mode = MUSB_PERIPHERAL;
+ host->host = musb_register(&pdata, &glue->dev, base);
+ if (IS_ERR_OR_NULL(host->host))
+ return -EIO;

- printf("Allwinner mUSB OTG (Peripheral)\n");
-#endif
+ return 0;
+ }

return ret;
}
9 changes: 9 additions & 0 deletions board/tess/uboot/tess_defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,18 @@ CONFIG_DRAM_CLK=792
CONFIG_DRAM_ZQ=8092667
CONFIG_SUNXI_MINIMUM_DRAM_MB=128
# CONFIG_SYS_MALLOC_CLEAR_ON_INIT is not set
CONFIG_SYS_STDIO_DEREGISTER=y
# CONFIG_SYS_DEVICE_NULLDEV is not set
CONFIG_CMD_USB_MASS_STORAGE=y
# CONFIG_USB_FUNCTION_FASTBOOT is not set
CONFIG_DRAM_SUNXI_ODT_EN=0
CONFIG_DRAM_SUNXI_TPR0=0x004a2195
CONFIG_DRAM_SUNXI_TPR11=0x340000
CONFIG_DRAM_SUNXI_TPR12=0x46
CONFIG_DRAM_SUNXI_TPR13=0x34000100
CONFIG_CONS_INDEX=4
CONFIG_DM_USB_GADGET=y
CONFIG_USB_MUSB_GADGET=y
CONFIG_USB_GADGET_DOWNLOAD=y
# CONFIG_USB_ETHER is not set
CONFIG_CIRCBUF=y