Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp687470pxu; Wed, 7 Oct 2020 13:10:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwnbVbnbDrcUEf1LelxbNycr2XrB1sIOvhIYWo6cf0kQZTmSli/uV7n25m8u39zt6PFBsfg X-Received: by 2002:a17:906:c35a:: with SMTP id ci26mr3362102ejb.98.1602101451064; Wed, 07 Oct 2020 13:10:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1602101451; cv=none; d=google.com; s=arc-20160816; b=xP3OKP3YAuLWv9TLot/nJeerGUmAngQWSf8RWIstcuRGQucyrVwzC0W8vN+xxgoVgF 14vgtdZoGwfQEdPLb9bhB+OxtFSofi1ihuWmI8Xch9P4dio5LyuMlHjwCQpEbM4ZUBZ8 Hqt0wXUZSk8vO1LqkQD8PKhAaVarjN65Djp77ScxVbS1DA3Z8zh0BS+GG56B9EIrZiIL c+wKlvGaHJsq8PGDhQYiGzweMZFW2v4RKflZPHVJvkI5Ye8Cbx72psgTQ4OmLU7D2/xN AIRP210NQEsA0j2S+lgpXx2QsimyYocnDnnIf7qN9HeL/ZK6f39864RlrbOzlXlNUL6b asag== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=oM1KSjc+Cmt4y9Jj6zCUXHMJeHtERnQiykUH9iP1mAs=; b=Wn9TIoVCzERatZYGb+aPJiRUVJ86/APn/U0LPkBflr5zgCj2y6jYmy29jdc0hRyQ1i D/t8r2KPd9cAzS1KdcQZ+AGBXFRzPSrUe8XWHRXBgxEN+U3JDV7S24XzvpODBV0HxlZz TGEv0gU/sDSsmSnjxI6i1d3dyjRl0KfFpjGYG0iZbX2PA3qhdj0mkrMQm2/ktSIWrJ7R QtqOC7O3jrA6puxg019Zk41KTQBhojRRT3FvF6Z3+stBrKr1OFy9vb/tb/CcT3/Y+Glg 8cJodSWMHj0NloY1SDvFV4VNyVTaOMYdkhFI9uKS+s9o9wj4Q65vD3/IE8amsRozKnwI wNwA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b=X2MaHONZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d2si668603ejm.502.2020.10.07.13.10.25; Wed, 07 Oct 2020 13:10:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@googlemail.com header.s=20161025 header.b=X2MaHONZ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728425AbgJGTpE (ORCPT + 99 others); Wed, 7 Oct 2020 15:45:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:52774 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727698AbgJGTpE (ORCPT ); Wed, 7 Oct 2020 15:45:04 -0400 Received: from mail-ed1-x541.google.com (mail-ed1-x541.google.com [IPv6:2a00:1450:4864:20::541]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 295DBC061755; Wed, 7 Oct 2020 12:45:04 -0700 (PDT) Received: by mail-ed1-x541.google.com with SMTP id 33so3400622edq.13; Wed, 07 Oct 2020 12:45:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=oM1KSjc+Cmt4y9Jj6zCUXHMJeHtERnQiykUH9iP1mAs=; b=X2MaHONZDjMMlot2K0Pp4HEsKv73KiL7KKKLkTAfaFw90cV1qYFyDIE2mgXka0Ztz+ 1JOUbW8L8JRv0UE5x1l4Nr/c6o+Sp0mXSLRi76LAD5vxnmHQ27MF72zL7/C0kOKzWQiv /cdarhUUZjaQftwXRyN3cIree84pfhAGuYrYaE/oV47i+9z9G2YEG5luyO+T2O4BL2CY R6O8X0bgn711qKaEZPyPEH8UWdKnnKYOJZQBhAJG8GYGNOHYFEUTX1kUUwaVjkqUOHDY EdHnf9glGr1Dnmyv86V7ZIrFzgz19iHheA+5+vr6xdcxZyO7O24HdDgW0g+WZZtRzqnw EM7w== 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=oM1KSjc+Cmt4y9Jj6zCUXHMJeHtERnQiykUH9iP1mAs=; b=Og0lfQ/CQY3Y6oq38nndT61hZEQIpM7BS1Bpvoa7dgsZ79i+fPc6J70txieRlLCfW8 SmR8xQzWXm6BW9f5r/aAp3Vi0spJFIyAXooFhlaQjK1OcJ0OA5YhYQYxvdMUeoMxrGTj Nk0rdXr/mJBt+oTN8pRu4xI+27l4C1MmPsyRRJX05zA75wgzMnQVj4hnAOpEs5pnXBzp LQohS4zwgXVha/tZPWBbY1Ut+4e1+kywxR6lVhsD2yf2nD8C2fT/a0oBANArspmtk6JA eG6QEDTFBatVoEGqfRJVvbfHzzVtksRcUlredv4HBo6srBpVz7oNonJHgr0U5Z325INN SrmQ== X-Gm-Message-State: AOAM530kHFrGQnGsm3j5/r0AY9frdMs+799XcXRhUILF9CwEjJq4Up3v zM6Ie9JsxU0117qwX6MoIdnfj37FLrRwZMh6inQ= X-Received: by 2002:a50:9ea6:: with SMTP id a35mr5591929edf.52.1602099902773; Wed, 07 Oct 2020 12:45:02 -0700 (PDT) MIME-Version: 1.0 References: <20201004162908.3216898-1-martin.blumenstingl@googlemail.com> <20201004162908.3216898-4-martin.blumenstingl@googlemail.com> In-Reply-To: From: Martin Blumenstingl Date: Wed, 7 Oct 2020 21:44:51 +0200 Message-ID: Subject: Re: [RFC PATCH 3/3] gpio: ej1x8: Add GPIO driver for Etron Tech Inc. EJ168/EJ188/EJ198 To: Linus Walleij Cc: linux-usb , linux-pci , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , "open list:GPIO SUBSYSTEM" , Rob Herring , Bartosz Golaszewski , "linux-kernel@vger.kernel.org" , Bjorn Helgaas Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Linus, On Wed, Oct 7, 2020 at 11:29 AM Linus Walleij wrote: > > Hi Martin, > > thanks for your patch! thank you for reviewing the whole series! > As noted on the earlier patches I think this should be folded into the > existing XHCI USB driver in drivers/usb/host/xhci-pci.c or, if that > gets messy, as a separate bolt-on, something like > xhci-pci-gpio.[c|h] in the drivers/usb/host/* directory. > You can use a Kconfig symbol for the GPIO portions or not. OK, I will do that if there are no objections from other developers I am intending to place the relevant code in xhci-pci-etron.c, similar to what we already have with xhci-pci-renesas.c [...] > This should not be necessary. Tie the GPIO state into the PCI device > driver state, possibly using some #ifdefs. > > > +static u8 ej1x8_gpio_shift(unsigned int gpio, u8 mask) > > +{ > > + return (gpio * fls(mask)); > > +} > > + > > +static u8 ej1x8_gpio_mask(unsigned int gpio, u8 mask) > > +{ > > + return mask << ej1x8_gpio_shift(gpio, mask); > > +} > > This looks a bit like regmap but trying to use regmap for this > would probably be overengineering. the problem is also the "INIT" register which needs to be set before writing the registers > Looking at the code I get annoyed that it uses the config space to > manipulate the GPIOs, else you could have used GPIO_GENERIC > but now you can't, how typical. I think this won't work in practice because of the EJ1X8_GPIO_CTRL for which we have to read from bits [7:0] but write to bits [23:16] due to this (and the INIT register as mentioned above) I did not consider GPIO_GENERIC any further > Other than that the code looks nice, but fold it into the USB > host driver somehow unless there is a compelling argument > as to why not. will do so, thanks! Best regards, Martin