From owner-freebsd-embedded@FreeBSD.ORG Sat Sep 7 17:31:19 2013 Return-Path: Delivered-To: freebsd-embedded@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [8.8.178.115]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 797598C5; Sat, 7 Sep 2013 17:31:19 +0000 (UTC) (envelope-from lists.br@gmail.com) Received: from mail-lb0-x229.google.com (mail-lb0-x229.google.com [IPv6:2a00:1450:4010:c04::229]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id CB7AC2B95; Sat, 7 Sep 2013 17:31:18 +0000 (UTC) Received: by mail-lb0-f169.google.com with SMTP id z5so3897735lbh.0 for ; Sat, 07 Sep 2013 10:31:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=X5JAMoLLVIoNQLbZbav8kmkjkMjQpFIzfcYucmSAOy4=; b=UCbFbeLgBHP4RnrZpjMkAkyxSxtSYGX8Ba0ivau6Q8moBTo3aYUAaRuKTEYIKszTlI 96SKrYBfo7jIlGVY9W2Y8tIwvMSCTKdt9RVeZd9lC/S1GFi6IN1EQfxq90wtJLJUgsQY 1sH9YwLJpV5IPIK4fVsE1SdnKesMxPl3bf3bALGwP0SeEtNUWgRyA3jiexegP/1oN1XJ /t9IB/XDIStlgCLJ4o84Uw7edxYHm6B2ANAPjXPcfFjd9H66kg4diZWs4bSt+jdDIfvg vSmiHZKmtLLoFqoeM4cSJ5BvCV7JuA2hr5ncTIzx1w0UTrkTRVqBL8XDForeEfgUURAQ 7WIQ== MIME-Version: 1.0 X-Received: by 10.152.37.41 with SMTP id v9mr7939168laj.9.1378575076806; Sat, 07 Sep 2013 10:31:16 -0700 (PDT) Received: by 10.112.148.37 with HTTP; Sat, 7 Sep 2013 10:31:16 -0700 (PDT) In-Reply-To: <1378573596.1588.7.camel@localhost> References: <1378491503.48812.5.camel@localhost> <1378493166.48894.1.camel@localhost> <1378573350.1588.6.camel@localhost> <1378573596.1588.7.camel@localhost> Date: Sat, 7 Sep 2013 14:31:16 -0300 Message-ID: Subject: Re: DIR-825B1 iicbus thing From: Luiz Otavio O Souza To: Sean Bruno Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.14 Cc: freebsd-embedded X-BeenThere: freebsd-embedded@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Dedicated and Embedded Systems List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 07 Sep 2013 17:31:19 -0000 On 7 September 2013 14:06, Sean Bruno wrote: > On Sat, 2013-09-07 at 10:02 -0700, Sean Bruno wrote: > > > Humm and 0x00a0 also seems wrong for DIR825: > > > +# Pin 5 - WPS (LED blue) --> works > > > +# Pin 6 - RTL8366RB switch data line > > > +# Pin 7 - Planet (LED orange)--> works > > > +# Pin 8 - RTL8366RB switch clock line > > > If i'm not mistaken the correct mask is 0x140 (for pin 6 and pin 8) > > > and then set the correct pin index for sda and scl. > > > > > > > > > > I don't come up with 0x140 for bit 6 and bit 8 being set, I get 0xa0. > > setting 0x140 would enable bit 7 and 9. Right? > > > > Sean > > Yeah, its 0x0a here. If I set 0x140 I conflict with pin 7: > > gpio0: on apb0 > gpio0: [GIANT-LOCKED] > gpio0: function_set: 0x0 > gpio0: function_clear: 0x0 > gpio0: gpio pinmask=0x9ff > gpioc0: on gpio0 > gpiobus0: on gpio0 > gpioiic0: warning: pin 6 is already mapped > gpioled0: at pin(s) 0 on gpiobus0 > gpioled1: at pin(s) 1 on gpiobus0 > gpioled2: at pin(s) 2 on gpiobus0 > gpioled3: at pin(s) 4 on gpiobus0 > gpioled4: at pin(s) 6 on gpiobus0 > gpioled5: at pin(s) 11 on gpiobus0 > > Right, the GPIO pins start at 0, the pins 6 and 8 used by switch are actually the pins 5 and 7. But when it comes to specifying pin masks you always need to think as pin + 1 to cover the pin 0 case which is going to be represented by the first bit (or simply, pinmask == 1 << pin). For your case you need a mask which covers pins (1 << 5) | (1 << 7) == 0xa0. So yes, your pinmask is correct, sorry for the confusion. Luiz