From owner-freebsd-arm@FreeBSD.ORG Fri Mar 22 14:01:40 2013 Return-Path: Delivered-To: freebsd-arm@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id B829E253 for ; Fri, 22 Mar 2013 14:01:40 +0000 (UTC) (envelope-from ganbold@gmail.com) Received: from mail-ia0-x22e.google.com (mail-ia0-x22e.google.com [IPv6:2607:f8b0:4001:c02::22e]) by mx1.freebsd.org (Postfix) with ESMTP id 90746D7A for ; Fri, 22 Mar 2013 14:01:40 +0000 (UTC) Received: by mail-ia0-f174.google.com with SMTP id b35so3573823iac.33 for ; Fri, 22 Mar 2013 07:01:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=O0QiVhG6Kv7ryPHAb5sEVJ+kjr0RuySAz3tNAPL9Ypg=; b=qHkGlVJKMNVFDFWz+4YxLXPfsQRnUYTGcM/3YH4RxQsw5VcpUwGUhIjDX7ijMz8q+w inpOEBBf6+i+xhhQnXbVjyHemXByKZPVrQBfdIKI40VnQ9WwTP1piXETAN1kzJCXpIjD Gogm8LDUfO+naKUb+jfKNW8vqh5YDidZLa7KHPF5S+O70Apy3CUfPenkmHwkvHZqo5J3 Cx8zldkGml51Yz2kLlRSKRZXggjK+NaU4NonoZSb0tu8k9k16Riayh9Jx8qD731/uGJ3 FP20Y5YJD/smiyAZY+/DT5hwnO5NhMq6j3GTsXO5P2DNuSsyqB9hIhKu4jJ4WmP+y6sN Sr2Q== MIME-Version: 1.0 X-Received: by 10.50.100.201 with SMTP id fa9mr4711761igb.28.1363960900250; Fri, 22 Mar 2013 07:01:40 -0700 (PDT) Received: by 10.64.6.230 with HTTP; Fri, 22 Mar 2013 07:01:40 -0700 (PDT) In-Reply-To: References: Date: Fri, 22 Mar 2013 22:01:40 +0800 Message-ID: Subject: Re: HACKBERRY USB problem From: Ganbold Tsagaankhuu To: Alexander Fedorov Content-Type: text/plain; charset=ISO-8859-1 Cc: freebsd-arm@freebsd.org X-BeenThere: freebsd-arm@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Porting FreeBSD to the StrongARM Processor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 Mar 2013 14:01:40 -0000 On Fri, Mar 22, 2013 at 9:19 PM, Alexander Fedorov wrote: > 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: 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: at usbus1 > uhub0: on > usbus1 > ugen0.1: at usbus0 > uhub1: 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: at usbus1 > ugen0.2: at usbus0 > uhub2: > on usbus0 > uhub2: 4 ports with 4 removable, self powered > Root mount waiting for: usbus0 > Root mount waiting for: usbus0 > ugen0.3: at usbus0 > umass0: 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: 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? It seems like hackberry's usb2 gpio pin is different than cubieboard one. Did you try to use 2 usb devices for both usb port same time? Somehow I observed both works at boot time, but had some problem attaching after boot. I never managed to make usb0 work, since it supports both host and otg mode in cubieboard. As some docs say it is based on MentorGraphics USB-OTG IP and currently iirc we only have support of otg mode in musb. gonzo@ may be working on improving musb driver some time ago, so he maybe has better ideas. As for pins, probably right place would be the dts, where we should separate hackberry and cubieboard specific configs and make general config for sun4i's SoC. Ganbold > > Alexander Fedorov > _______________________________________________ > freebsd-arm@freebsd.org mailing list > http://lists.freebsd.org/mailman/listinfo/freebsd-arm > To unsubscribe, send any mail to "freebsd-arm-unsubscribe@freebsd.org"