Received: by 2002:ac0:a5a7:0:0:0:0:0 with SMTP id m36-v6csp3288286imm; Sun, 29 Jul 2018 15:07:05 -0700 (PDT) X-Google-Smtp-Source: AAOMgpc37107HU6jEJ3A+2QHn/YcLSAIDzj3CJSQipeqUPR2rIWVp/MtXxBnAANDdDUKbaCfcPye X-Received: by 2002:a62:d8c:: with SMTP id 12-v6mr15413348pfn.202.1532902025597; Sun, 29 Jul 2018 15:07:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1532902025; cv=none; d=google.com; s=arc-20160816; b=i9/sEvES4F9SrOcsoMHXNJ1Y2hlyNcWIEdYPQbG9PRPssnv6vUs2PSgNH1crb95LJd Z7iC9KGeikF2E0YhT75yFujVUuvf7vv66faXYfmg17KoWzGdVSJ2MtfzP+CcLCxVN9u6 qlpN9eFUUenMFl0OR5QO0KazlGE3Z4vEUQrJ7hcZDuaayp6+iXEixjYweegYOxQkU9N0 0GRlMGKPMeXfMW2Adz4QF1Dy4iXFxTE4J89uJQ/Vq7JJSnIGVlJBjqSY/uPwHntFrWSu 9VvcW9QNEYKTnlplZ58gEG5MPQ6xVnPL2Fnfa222puiG6NUuODSB3lF7mcmdF4Oy+Ywg apcg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature :arc-authentication-results; bh=X7bZhcyTpE+i4skso6b+guWe1n4YDRE/3xREZIjVyiA=; b=dVQYS/zdim5UmO4LQZ8nKlxOcO8UIaZ6BOS8PlvxQ5BKjMjYtT2un0Us2OdSCojfHi ZeQtNXZVcG7Jpu07EKsoAcj/z7aY+RbsGKqbvSvyfAVhh9Ir+b2MHCoN2OOUiv30DbNh lm1+jLxeb1pZPHlG2tXV0B6A9GJ82p4rSioq7Zo66rVA3Q+1tz8Nur1pmkzNz9aHJU+x 7kcMG6D9/oxpdxDacEk+OJGCM5wMDwOoik6EX7Psls5w/mxMOyRx7H7A2Tc+6tKSCZzj uIRj4CSaqApjeyUj7/mtiLagbNzKZJsRPEyRZLz5dvbtPAYWiIObSkHeWBMnIIEiNPT3 B0Ig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R89q5oPF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id a20-v6si9220181pls.237.2018.07.29.15.06.51; Sun, 29 Jul 2018 15:07:05 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=R89q5oPF; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731973AbeG2Xb7 (ORCPT + 99 others); Sun, 29 Jul 2018 19:31:59 -0400 Received: from mail-it0-f67.google.com ([209.85.214.67]:37449 "EHLO mail-it0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731589AbeG2Xb7 (ORCPT ); Sun, 29 Jul 2018 19:31:59 -0400 Received: by mail-it0-f67.google.com with SMTP id h20-v6so14286100itf.2 for ; Sun, 29 Jul 2018 14:59:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=X7bZhcyTpE+i4skso6b+guWe1n4YDRE/3xREZIjVyiA=; b=R89q5oPFQU0WYedUgAws16ttipG+p4zgfD9c1uHZ+lhtcNHDOZ7hi+FsuCNqJLq+fN N0U/8Rj7/Fah/gUaYcDKum1WSOflRQlPsomNVfcfnZm12QL0+3rYj8bAYh35o5qpY/Bj XY3UiGW3Z1Niu+CIPOjbxUwGm1pJg8qdkLR4Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=X7bZhcyTpE+i4skso6b+guWe1n4YDRE/3xREZIjVyiA=; b=h1LcdQu757ST5DLMrGeng085xr7XZp8PCMYou9kXFrMmVjWD/aWs43qWH4svhmjJMp cmGaKn8OU+X/jGQMqb+ZvcmjhDDGTj1KiN5AAQptiKQbYmU3loekE5kODn3BrgdEvlIQ GlR8nAgXEE3DFXOPfTqBYKqDa2tgMwcGpl048tyG72uKtBNV+MzcbjL55psgSX1LHfmt 7I345Z8ZslFMSqEAINshwOYz4A0lnRCZzL+kPp0G/j5GB9BoqstG9oD1i+wPBnSPGWrF 1uB4ucTmvmeGbwEqmosS6nq8C6zT9vlyP8pzarM6LW647Zm9no9S13t3FBaxK0Pwf3S3 hhuQ== X-Gm-Message-State: AOUpUlHrTYWuOnj0f+6JP3br96G2yN2lDcWdKbWNwpcZW4J6zLtKIQb9 WJzScZ8fZw41BPRF0a5TwdOi6kzOxkO/r7G1ztHhpQ== X-Received: by 2002:a02:2505:: with SMTP id g5-v6mr14110254jag.112.1532901599201; Sun, 29 Jul 2018 14:59:59 -0700 (PDT) MIME-Version: 1.0 References: <20180712214203.114844-1-tmaimon77@gmail.com> <20180712214203.114844-3-tmaimon77@gmail.com> In-Reply-To: From: Linus Walleij Date: Sun, 29 Jul 2018 23:59:45 +0200 Message-ID: Subject: Re: [PATCH v2 2/2] pinctrl: nuvoton: add NPCM7xx pinctrl and GPIO driver To: tmaimon77@gmail.com Cc: Rob Herring , Mark Rutland , avifishman70@gmail.com, Nancy Yuen , Brendan Higgins , Patrick Venture , Joel Stanley , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "linux-kernel@vger.kernel.org" , "open list:GPIO SUBSYSTEM" , OpenBMC Maillist Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 26, 2018 at 2:01 AM Tomer Maimon wrote: > I initialize bgpio as follow: > > ret = bgpio_init(&pctrl->gpio_bank[id].gc, > pctrl->dev, 4, > pctrl->gpio_bank[id].base + > NPCM7XX_GP_N_DIN, > pctrl->gpio_bank[id].base + > NPCM7XX_GP_N_DOUT, > NULL, > NULL, > pctrl->gpio_bank[id].base + > NPCM7XX_GP_N_IEM, > BGPIOF_READ_OUTPUT_REG_SET); (...) > The problem occur when reading the GPIO value from bgpio_get_set function, > because the directions value are inverse it reading the wrong I/O registers > > For direction out it reading dat register (instead of set register) > > For direction in it calling set register (instead of dat register) Hm I don't quite get it... sorry. Maybe if you show your fix and what you expect to happen I can understand better? Do you mean that because you write the inverse value to IEM this happens, and the BGPIO code assumes that you always write 1 to set a line as input and 0 to set it as output? I would say if this causes the problem we should just add a new BGPIOF_INVERTED_REG_DIR with comment in include/linux/gpio/driver.h and make the necessary fix to respect this flag in the gpio-mmio.c core so it works right. If you do this as a separate patch I would be grateful :) Yours, Linus Walleij