Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 22 Mar 2013 17:19:23 +0400
From:      Alexander Fedorov <alexander.fedorov@rtlservice.com>
To:        freebsd-arm@freebsd.org
Subject:   HACKBERRY USB problem
Message-ID:  <CAOcOT_wuN7kS7xy3UCp_2AUTzySNY6Xc8bv5iWxBpW%2BFgRSz1w@mail.gmail.com>

next in thread | raw e-mail | index | archive | help
Hi all,

I have a Miniand Hackberry board based on Allwinner A10 SOC:
https://www.miniand.com/products/Hackberry%20A10%20Developer%20Board

I'm trying to use kernel and FTD configuration from CUBIEBOARD. And, I
have little problem with USB setup.
The problem is, that Hackberry used different GPIO pin configuration
to setup USB power. Also, on Hackberry board
A10 USB Host controller connected to 4-port USB HUB (Genesys Logic
GL850G), and it need properly power configuration too.

I'm looking for pin configuration in FEX files. For CUBIEBOARD USB
configuration is
https://github.com/linux-sunxi/sunxi-boards/blob/master/sys_config/a10/cubieboard.fex:
For Hackberry: https://github.com/linux-sunxi/sunxi-boards/blob/master/sys_config/a10/hackberry.fex

And edit a10_ehci_attach function in sys/arm/allwiner/a10_echi.c file:

    /* Enable clock for USB */
    a10_clk_usb_activate();

    /* Give power to HUB pin PB09 (HACKBERRY) */
    GPIO_PIN_SETFLAGS(sc_gpio_dev, 41, GPIO_PIN_OUTPUT);
    GPIO_PIN_SET(sc_gpio_dev, 41, GPIO_PIN_HIGH);

    /* Give power to USB */
//  GPIO_PIN_SETFLAGS(sc_gpio_dev, GPIO_USB2_PWR, GPIO_PIN_OUTPUT);
//  GPIO_PIN_SET(sc_gpio_dev, GPIO_USB2_PWR, GPIO_PIN_HIGH);

    /* Give power to USB PH12 */
    GPIO_PIN_SETFLAGS(sc_gpio_dev, 236, GPIO_PIN_OUTPUT);
    GPIO_PIN_SET(sc_gpio_dev, 236, GPIO_PIN_HIGH);

    /* Give power to USB */
    GPIO_PIN_SETFLAGS(sc_gpio_dev, GPIO_USB1_PWR, GPIO_PIN_OUTPUT);
//  GPIO_PIN_SET(sc_gpio_dev, GPIO_USB1_PWR, GPIO_PIN_HIGH);
    GPIO_PIN_SET(sc_gpio_dev, GPIO_USB1_PWR, GPIO_PIN_LOW);

Now, kernel can attach external USB devices witch some restrictions.
When I plug USB-to-RS232 cable to
board before give power, Genesys Logic don't attached. I think it's
need properly reset sequence.

However, it's work:
ehci1: <Allwinner Integrated USB 2.0 controller> mem
0x1c1c000-0x1c1cfff irq 40 on simplebus0
usbus1: EHCI version 1.0
usbus1 on ehci1
uart0: <16750 or compatible> mem 0x1c28000-0x1c283ff irq 1 on
simplebus0
uart0: console (115200,n,8,1)
Timecounters tick every 10.000 msec
usbus0: 480Mbps High Speed USB v2.0
usbus1: 480Mbps High Speed USB v2.0
WARNING: WITNESS option enabled, expect reduced performance.
Root mount waiting for: usbus1 usbus0
ugen1.1: <Allwinner> at usbus1
uhub0: <Allwinner EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on
usbus1
ugen0.1: <Allwinner> at usbus0
uhub1: <Allwinner EHCI root HUB, class 9/0, rev 2.00/1.00, addr 1> on
usbus0
uhub0: 1 port with 1 removable, self powered
uhub1: 1 port with 1 removable, self powered
Root mount waiting for: usbus1 usbus0
ugen1.2: <Realtek> at usbus1
ugen0.2: <Genesys Logic> at usbus0
uhub2: <Genesys Logic USB2.0 Hub, class 9/0, rev 2.00/77.64, addr 2>
on usbus0
uhub2: 4 ports with 4 removable, self powered
Root mount waiting for: usbus0
Root mount waiting for: usbus0
ugen0.3: <JetFlash> at usbus0
umass0: <JetFlash Mass Storage Device, class 0/0, rev 2.00/11.00, addr
3> on usbus0
umass0:  SCSI over Bulk-Only; quirks = 0x0100
umass0:0:0:-1: Attached to scbus0
Root mount waiting for: usbus0
da0 at umass-sim0 bus 0 scbus0 target 0 lun 0
da0: <JetFlash Transcend 8GB 1100> Removable Direct Access SCSI-4
device
da0: 40.000MB/s transfers
da0: 7725MB (15820800 512 byte sectors: 255H 63S/T 984C)
Trying to mount root from ufs:/dev/da0s2 []...
WARNING: / was not properly dismounted

But, I think it's not good to edit ECHI driver.
Where is the right place in sources to put various board specific pin
settings and external chips configuration logic?

Alexander Fedorov



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAOcOT_wuN7kS7xy3UCp_2AUTzySNY6Xc8bv5iWxBpW%2BFgRSz1w>