OpenWrt Forum Archive

Topic: [bcm63xx] Usb2 not working on Huawei HG553

The content of this topic has been archived between 13 Apr 2018 and 18 Apr 2018. Unfortunately there are posts – most likely complete pages – missing.

falegname wrote:

We used a kernel module that writes or reads, and when you write any long (4 bytes) to 0xfffe1500 or 0xfffe150c, the usb stops working, at this point when you try to reboot or only to discharge and charge ohci & ehci module, the router (the serial output) is blocked but after some minutes it reboot and both usb work as ehci until you power off the router (like after installation from B21)

I understand better now, so looks like the RSET_USBH_PRIV memory address is directly related with the problem, it's weird that after reboot all the 40 bytes return "normal"

And what means that "0x1c0020" on TestPortControl???

Has someone found the flag values definitions of "USBH_PRIV_TEST_REG"?

---------

swap control:

the difference between openwrt and stock values is caused by the lines of code that are changing the flag values

reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_REG);
reg &= ~USBH_PRIV_SWAP_OHCI_ENDN_MASK;
reg |= USBH_PRIV_SWAP_OHCI_DATA_MASK;
bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SWAP_REG);

0x12 -> 10010
0x11 -> 10001

openwrt does:

disables USBH_PRIV_SWAP_OHCI_ENDN_MASK  (x0x)
enables  USBH_PRIV_SWAP_OHCI_DATA_MASK  (xx1)

that's why you get 0x11

--

It should be interesting reading swapcontrol before that changes (on openwrt)

We could test deleting those lines and see what happens

We could change or add the ehci flags:

USBH_PRIV_SWAP_EHCI_ENDN_MASK
USBH_PRIV_SWAP_EHCI_DATA_MASK

by the same way

--------

maybe something gets changed inside soc regs (bcm63xx_io.h)

--------

finally i was thinking that it could be a timing problem, because, as i said before, on my router sometimes work and sometimes not (at boot time and without changing anything)

early value change = doesn't work
late value change = kernel freeze

I'm sorry but i cannot make tests atm because i'm using my huawei as main router on my house...

I also vote for a timing problem. I think the swap control registers are totally right in Openwrt.

@protomax, if you want to try something just write here and we will test

you may try to introduce delays everywhere, in the stuff related with usb:
msleep(1000)

Example

#include <linux/init.h>
#include <linux/clk.h>
#include <linux/platform_device.h>
#include <bcm63xx_cpu.h>
#include <bcm63xx_regs.h>
#include <bcm63xx_io.h>

static struct clk *usb_host_clock;

static int ehci_bcm63xx_setup(struct usb_hcd *hcd)
{
    struct ehci_hcd *ehci = hcd_to_ehci(hcd);
    int retval;

    retval = ehci_halt(ehci);
    if (retval)
        return retval;

    retval = ehci_init(hcd);
    if (retval)
        return retval;

    ehci_reset(ehci);
    msleep(1000);
    ehci_port_power(ehci, 0);
    msleep(1000);
    
    return retval;
}


static const struct hc_driver ehci_bcm63xx_hc_driver = {
    .description =        hcd_name,
    .product_desc =        "BCM63XX integrated EHCI controller",
    .hcd_priv_size =    sizeof(struct ehci_hcd),

    .irq =            ehci_irq,
    .flags =        HCD_MEMORY | HCD_USB2,

    .reset =        ehci_bcm63xx_setup,
    .start =        ehci_run,
    .stop =            ehci_stop,
    .shutdown =        ehci_shutdown,

    .urb_enqueue =        ehci_urb_enqueue,
    .urb_dequeue =        ehci_urb_dequeue,
    .endpoint_disable =    ehci_endpoint_disable,

    .get_frame_number =    ehci_get_frame,

    .hub_status_data =    ehci_hub_status_data,
    .hub_control =        ehci_hub_control,
    .bus_suspend =        ehci_bus_suspend,
    .bus_resume =        ehci_bus_resume,
    .relinquish_port =    ehci_relinquish_port,
    .port_handed_over =    ehci_port_handed_over,
};

static int __devinit ehci_hcd_bcm63xx_drv_probe(struct platform_device *pdev)
{
    struct resource *res_mem;
    struct usb_hcd *hcd;
    struct ehci_hcd *ehci;
    struct clk *clk;
    u32 reg;
    int ret, irq;

    res_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
    msleep(1000);
    irq = platform_get_irq(pdev, 0);;
    if (!res_mem || irq < 0)
        return -ENODEV;

    /* enable USB host clock */
    clk = clk_get(&pdev->dev, "usbh");
    if (IS_ERR(clk))
        return -ENODEV;

    clk_enable(clk);
    msleep(1000);
    usb_host_clock = clk;
    msleep(1000);

    if (BCMCPU_IS_6358()) {
        reg = bcm_rset_readl(RSET_USBH_PRIV, USBH_PRIV_SWAP_6358_REG);
    msleep(1000);
        reg &= ~USBH_PRIV_SWAP_EHCI_DATA_MASK;
    msleep(1000);
        reg |= USBH_PRIV_SWAP_EHCI_ENDN_MASK;
    msleep(1000);
        bcm_rset_writel(RSET_USBH_PRIV, reg, USBH_PRIV_SWAP_6358_REG);

        /*
         * The magic value comes for the original vendor BSP
         * and is needed for USB to work. Datasheet does not
         * help, so the magic value is used as-is.
         */
        bcm_rset_writel(RSET_USBH_PRIV, 0x1c0020,
                USBH_PRIV_TEST_6358_REG);

    } else if (BCMCPU_IS_6368()) {
.
.
..
.
.
.

@danitool, done, but nothing.....

any news on this? I reflashed my previous working VS and now the USB port near ethernet doesn't work ( it doesn't power devices ) and the USB top port works only in usb 1.1, damn sad

@crisman, do you remember what revision of openwrt works for this router?

(Last edited by falegname on 21 Jun 2012, 11:19)

previously I was running trunk r30919...

crisman wrote:

previously I was running trunk r30919...

maybe you have the revision working after loading from b21, without reboot

Small update uninteresting.
One of the last trunk (33633) still does not work. The usb port near the power supply did not recognize any device. I do not know if it is a random error. However, nothing new.

hi,
I've not more skills on openwrt but some time ago i tried to put ignore-oc flag on /etc/modules.d/40-usb2 file and two things happens:
1: after reboot the usb port near power switch start to recognize all usb 2.0 devices but not 1.1 or 1.0, the upper port have only usb 1.1-1.0 capability;
2: even if in /etc/modules.d the ehci module have less start number then ohci in the dmesg ohci module has been loaded before.

I don't know if this could be usefull or not but with this i can use both port even when i switch on and off several time, sometime it stop to work without any changes in the system.

with this weak solution, all port have some functionality even i don't flash b21 before

BR
Nino

cillo273 wrote:

hi,
I've not more skills on openwrt but some time ago i tried to put ignore-oc flag on /etc/modules.d/40-usb2 file and two things happens:
1: after reboot the usb port near power switch start to recognize all usb 2.0 devices but not 1.1 or 1.0, the upper port have only usb 1.1-1.0 capability;
2: even if in /etc/modules.d the ehci module have less start number then ohci in the dmesg ohci module has been loaded before.

I don't know if this could be usefull or not but with this i can use both port even when i switch on and off several time, sometime it stop to work without any changes in the system.

with this weak solution, all port have some functionality even i don't flash b21 before

BR
Nino


Can you share which USB modules did you employ?

Hi, i would like to report that i'm testing with a clean  ATTITUDE ADJUSTMENT (12.09, r36088) and  both ports are working fine, can someone please confirm?

I've tried with last revision (38621) and seems that it works. Now let's wait for another confirmations.

Hi to all, I have the same problem, using a firmware compiled for HG553 by a guy named roleo using a base firmware of DLINK routers based on same hardware. Infact, each time router restarts it is unpredictable if the usb ports will work as USB 1.1 or USB 2.0.
I have the full toolchain of this firmware and I added some customizations both in kernel and in apps. Now I have the problem with USB. I tried many many things but no result. Just the b21 firmware is always USB 2.0.

Now I see that with openWRT someone of you is reporting that problem maybe is solved. Can you help to figure out which could be the solution?
Thank you.

Confirmed both usb loaded with ehci driver with lastest trunk r38843. I confirm that install with clean rom. mtd -r erase rootfs before flash lastest openwrt firmware it will bring to autorebort & softreset (open browser 192.168.1.1), upload firmware & bring you to kernel panic after autoreboot but don't worry. turn off router & try to 30s reset & upload firmware again & openwrt will load successfully.

USB Port near LAN

root@OpenWrt:/etc# lsusb
Bus 001 Device 002: ID 1a40:0101 Terminus Technology Inc. 4-Port HUB
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 003: ID 1976:4082 Chipsbrand Microelectronics (HK) Co., Ltd.
root@OpenWrt:/etc# hdparm -tT /dev/sda

/dev/sda:
 Timing cached reads:    74 MB in  2.03 seconds =  36.38 MB/sec
 Timing buffered disk reads:  40 MB in  3.03 seconds =  13.22 MB/sec
root@OpenWrt:/etc# cat openwrt_release
DISTRIB_ID="OpenWrt"
DISTRIB_RELEASE="Bleeding Edge"
DISTRIB_REVISION="r38843"
DISTRIB_CODENAME="barrier_breaker"
DISTRIB_TARGET="brcm63xx/generic"
DISTRIB_DESCRIPTION="OpenWrt Barrier Breaker r38843"
root@OpenWrt:/etc#

(Last edited by cindy.wijaya on 19 Nov 2013, 10:48)

any test I can do to the roleo firmware to have usb2?

(Last edited by thecode on 19 Nov 2013, 11:51)

Anyone of you can help me to understand which are the changes that were done in openwrt to make possible that usb ports are already loaded by ehci driver? I would like to patch the 'roleo' firmware.

Hello

Is there anything new on this problem, because with trunk version 39646, USB still not reliable.
My modem has a wifi key plugged in and sometimes when the modem boots, it sees it and sometimes it does not see it.
When the modem does not detect the Wifi key, it does not detect any USB devices (i tried a flash key) on any of the two USB ports.
Very annoying because i wanted to use this modem as a Wifi relay, but if i can't connect my Wifi key, i'm stuck.

I've you are still having problems. I think it can be solved adding this code

    unsigned int * reg = (unsigned int *) 0xfffe150c;
    /* power cycle the USB PLL */
    *reg &= ~0x02000000;
    mdelay(1);
    *reg |= 0x02000000;

to the funcion prom_init at the bcm63xx prom.c file. I found this code in the recently relased huawei gpl.

Please report if this works, otherwise nobody will know if the problem still persists and can be solved with this code. This problem is a bit random, I cannot test it since I never noticed the problem in my router. I repeat, the feedback is very important.

Regards.

I tried your solution but i can't tell you if it works because i don't have anymore the Wifi key for which i had the problem.
I try another Wifi key and i don't encounter the problem but it's very difficult to say that the problem is resolved.

Where do you get recently released huawei gpl code ?
Because before i install OpenWrt i made an attempt to compile Huawei firmware with sources found at http://www.sbrk.co.uk/hw553/huawei/gpl2.html (kernel 2.6.21).
And with these sources i had problems with usb too. This time it was with a simple USB flash key (quite old but without any problem on my PC).
- sometimes when the modem starts, the USB controller doesn't see any devices. Even if i unplug the device and re plug it, the device is not recognized (nor any other device). The only solution is to reboot the modem.
- sometimes when the modem starts the device is recognized but shortly after there are I/O errors and like before, even if i unplug the device and re plug it, the errors still remain. The only solution is to reboot the modem.

With others USB flash key i never had any problems.

For me (but i'm far from being an expert) it's a problem of power supplied to the usb device : if the usb device needs too much power, there are problems.

(Last edited by pgid69 on 11 Jun 2014, 12:24)

pgid69 wrote:

Hi Gelip,

You can download for a few days a copy at this address
https://gibbi.omega.ovh/hg553.tar.gz

I'm sorry but I have not added the topic to subscribe and link expired. Please upload one more time.

Thx.

pgid69 wrote:

Hi pgid69, I need a little help, how to contact you directly?

(Last edited by fika82 on 16 Nov 2016, 01:48)

The discussion might have continued from here.