From owner-freebsd-embedded@FreeBSD.ORG Wed Nov 30 11:05:54 2011 Return-Path: Delivered-To: freebsd-embedded@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id F0185106564A for ; Wed, 30 Nov 2011 11:05:54 +0000 (UTC) (envelope-from stb@lassitu.de) Received: from gilb.zs64.net (gilb.zs64.net [IPv6:2001:470:1f0b:105e::1ea]) by mx1.freebsd.org (Postfix) with ESMTP id 79FC68FC1F for ; Wed, 30 Nov 2011 11:05:54 +0000 (UTC) Received: by gilb.zs64.net (Postfix, from stb@lassitu.de) id AA6361009A1 for ; Wed, 30 Nov 2011 12:05:53 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Apple Message framework v1084) From: Stefan Bethke In-Reply-To: <86030CEE-6839-4B96-ACDC-2BA9AC1E4AE4@lassitu.de> Date: Wed, 30 Nov 2011 12:05:53 +0100 Content-Transfer-Encoding: quoted-printable Message-Id: <2D625CC9-A0E3-47AA-A504-CE8FB2F90245@lassitu.de> References: <68ABED76-CB1F-405A-8036-EC254F7511FA@lassitu.de> <3B3DB17D-BF87-40EE-B1C1-445F178E8844@lassitu.de> <86030CEE-6839-4B96-ACDC-2BA9AC1E4AE4@lassitu.de> To: freebsd-embedded@freebsd.org X-Mailer: Apple Mail (2.1084) Subject: Re: TL-WR1043: switch X-BeenThere: freebsd-embedded@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Dedicated and Embedded Systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 30 Nov 2011 11:05:55 -0000 Am 29.11.2011 um 23:59 schrieb Stefan Bethke: > Am 28.11.2011 um 23:29 schrieb Stefan Bethke: >=20 >> Am 28.11.2011 um 23:18 schrieb Stefan Bethke: >>=20 >>> So with the GPIOs working, the next step would be to attach a = bit-banging I2C device to GPIO 18 and 19. My kernel foo is probably not = up to creating the appropriate newbus attachment myself. Anybody want = to give me a hint? I'd start by copying lpbb, replacing the parallel = port code with appropirate gpio calls. >>>=20 >>> I haven't taken a detailed look at the OpenWrt code, but the = datasheet for the RTL8366 can be googled, including a full register map = and a description of the VLAN configuration (which I'm most interested = in). With a working I2C bus, that shouldn't be too hard, I'd think. >>=20 >> Further looking around, we already have dev/gpio/gpioiic.c. I'll see = if I can get it to attach. >=20 > I couldn't get iic to work, so I rolled my own userland bitbanging = utility, based roughly on the OpenWrt code (minus some small bugs) and = the datasheet. >=20 > I can read and write registers, but to my consternation, most of the = functionality (MIB counters, ST controls, etc.) seems to be somehow = disabled or just plain missing. >=20 > I'll try to get a basic utility up and running to use the basic VLAN = mode (not the table-based mode) tomorrow. Once that's working = suffiently well, I could make it into a stand-alone driver, or see if it = can be integrated into Aleksandrs work. Either I'm doing something wrong, or the RTL8366 is working a lot = differently from the datasheet. I've put the source as well as a binary = up for download; could someone with a running WR1043 run the command and = post the results here? http://www.lassitu.de/freebsd/rtl.tbz Here's my output directly after reboot: # ./rtl -D 00 0830 0000 0000 0000 00b0 2805 0000 0000=20 08 0000 0f45 83ed 0101 0000 0200 0000 0001=20 10 ffff ffff ffff ffff 7660 6060 fe76 6060=20 18 0000 0000 0000 0000 0000 0000 0000 0000=20 20 0001 ffff 0000 0002 0000 0000 0003 0000=20 28 0000 0004 0000 0000 0005 0000 0000 0006=20 30 0000 0000 0007 0000 0000 0008 0000 0000=20 38 0009 0000 0000 000a 0000 0000 000b 0000=20 40 0000 000c 0000 0000 000d 0000 0000 000e=20 48 0000 0000 000f 0000 0000 0010 0000 0000=20 50 ffff ffff ffff ffff ffff ffff ffff ffff=20 58 0000 0000 0000 0000 5937 0000 0000 0000=20 60 0000 0000 0000 0000 0000 0000 0000 0000=20 68 0000 0000 0000 0000 0000 0000 0000 0000=20 70 0000 0000 0000 0000 0000 0000 0000 0000=20 78 0000 0000 0000 0000 0000 0000 0000 0000=20 # ./rtl -v VTCR0[0] EN_VLAN =3D enabled VTCR0[1] VLAN_TAG_AWARE =3D disabled VTCR0[2] VLAN_TAG_ADMIT =3D enabled VTCR0[3] EN_INGRESS_RULE =3D disabled VTCR0[4] EN_UC_LEAKY =3D disabled VTCR0[5] EN_ARP_LEAKY =3D disabled VTCR0[6] EN_IPMC_LEAKY =3D disabled VTCR0[12] EN_TG_DROP =3D disabled WAN 1 2 3 4 CPU = =20 Tagging keep keep keep keep keep keep = =20 00=3D 3702 - - - - - * = =20 01=3D 0 - - - - - - = =20 02=3D 0 - - - - - - = =20 03=3D 0 - - - - - - = =20 04=3D 0 - - - - - - = =20 05=3D 1 * * * * * * = =20 06=3D 0 - * - - - - = =20 07=3D 0 - - - - - - = =20 08=3D 3 - - - - - - = =20 09=3D 0 - - * - - - = =20 10=3D 0 - - - - - - = =20 11=3D 5 - - - - - - = =20 12=3D 0 - * * - - - = =20 13=3D 0 - - - - - - = =20 14=3D 7 - - - - - - = =20 15=3D 0 - - - * - - = =20 Stefan --=20 Stefan Bethke Fon +49 151 14070811