Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp1191748pxf; Fri, 19 Mar 2021 00:53:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyPTV1uee3m+/8G4y7vt5zF8SxxDA8/5TuADGdqgJunTc9cR1avNMd++GI8j9EsmVK0iIGB X-Received: by 2002:a17:906:6044:: with SMTP id p4mr2938621ejj.82.1616140425594; Fri, 19 Mar 2021 00:53:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1616140425; cv=none; d=google.com; s=arc-20160816; b=qb6MQimtwuSpILiHfJervwgQsw7mmRppj9vtKQK/kLVoVS2XaPV9Bn8WSZhkNcrNNG B7CsZTx+jl4CszcLiVfHy022Q1OmwE//xu4LISNh3W3KEbSPzdP3qlD4S1/7xuHfiCKz mslRips9AM1zGuYdiRxKDg1v5CkfD0ahanaDmWTh4OJu+4ZpZmmVL/Jp3BUL5GuvEKBL VZbSsZi5pC3fb/HItwndH0WdCpttONKXsyuGuRUzw5Dyhf8CWYN3T/7PIJtnWkq+RnOS B0fsFQPih38O2BmWhTzvE4I0kSkCjLNA68m+YzwNAWss/Tw/0NL4jdqrdGzRMFhIjDp/ z+7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:user-agent:references:in-reply-to :subject:cc:to:from:date:content-transfer-encoding:mime-version :dkim-signature; bh=xPE75ypMFqVVpybthj8RHnplfS56SjWrWzo/EeOduNI=; b=0vo21FOZ8i5DBT2rXI3tCBh8drzlwCx+Ipj4QY84K1wSeYYitCLvQM3zsaZLnuORU0 X9Bpvu/+WTiVQKReO3T77uyJZIeNERqD//dc1TCQdDdCMtIc7CVjYnKmjbVri+x6e5X/ bORgrqkzv869OPvRiTRHdU7ifnUvSBVS/oJFdZod3wu2ZPvhYLLxl+ZbEqZIop+Ddaxf gMWg9BosmR1bdvVckGns/NyuMEGVuEi2olh0evegvv1NxlPkHdqr2jmfQRDkm+O2hjOp aW3WVvCDJk8n0z9E3pNgGwgWTryfXWOWV/OYrILnYH+4XTxBTk/DH5WcRdcoqDVtaTzZ 9uGg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@walle.cc header.s=mail2016061301 header.b="mTZ/UTsk"; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p22si3785205ejm.148.2021.03.19.00.53.23; Fri, 19 Mar 2021 00:53:45 -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=@walle.cc header.s=mail2016061301 header.b="mTZ/UTsk"; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233993AbhCSHwA (ORCPT + 99 others); Fri, 19 Mar 2021 03:52:00 -0400 Received: from ssl.serverraum.org ([176.9.125.105]:44167 "EHLO ssl.serverraum.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233819AbhCSHvl (ORCPT ); Fri, 19 Mar 2021 03:51:41 -0400 Received: from ssl.serverraum.org (web.serverraum.org [172.16.0.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ssl.serverraum.org (Postfix) with ESMTPSA id 8FF2C22239; Fri, 19 Mar 2021 08:51:38 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=walle.cc; s=mail2016061301; t=1616140299; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=xPE75ypMFqVVpybthj8RHnplfS56SjWrWzo/EeOduNI=; b=mTZ/UTskjZ/nLqef7Ab0501ArRgZNOPeFz/Yz5p7wLMt3zEp/CzcEhIhphuOfXZN8utEoK 7jcMvyN6ki04mG3uLHL1PNgV95GC9UFtFPdOLSqKMR61PxdqCJXQtjSadxQpp84mPQwi/R qegFICJQxsu2x29q9yldzOZm564NwYU= MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII; format=flowed Content-Transfer-Encoding: 7bit Date: Fri, 19 Mar 2021 08:51:37 +0100 From: Michael Walle To: Ran Wang Cc: Linus Walleij , Andy Shevchenko , Bartosz Golaszewski , linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2] gpio: mpc8xxx: Add ACPI support In-Reply-To: <20210319025332.36659-1-ran.wang_1@nxp.com> References: <20210319025332.36659-1-ran.wang_1@nxp.com> User-Agent: Roundcube Webmail/1.4.11 Message-ID: X-Sender: michael@walle.cc Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 2021-03-19 03:53, schrieb Ran Wang: > Current implementation only supports DT, now add ACPI support. > > Note that compared to device of 'fsl,qoriq-gpio', LS1028A and > LS1088A's GPIO have no extra programming, so simplify related checking. > > Signed-off-by: Ran Wang > --- > Change in v2: > - Initialize devtype with NULL to fix compile warning. > - Replace of_device_get_match_data() and acpi_match_device with > device_get_match_data(). > - Replace acpi_match_device() with simpler checking logic per Andy's > suggestion. > > drivers/gpio/gpio-mpc8xxx.c | 34 +++++++++++++++++++++++----------- > 1 file changed, 23 insertions(+), 11 deletions(-) > > diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c > index 6dfca83bcd90..646225fa3e73 100644 > --- a/drivers/gpio/gpio-mpc8xxx.c > +++ b/drivers/gpio/gpio-mpc8xxx.c > @@ -9,6 +9,7 @@ > * kind, whether express or implied. > */ > > +#include > #include > #include > #include > @@ -292,8 +293,6 @@ static const struct of_device_id mpc8xxx_gpio_ids[] > = { > { .compatible = "fsl,mpc5121-gpio", .data = &mpc512x_gpio_devtype, }, > { .compatible = "fsl,mpc5125-gpio", .data = &mpc5125_gpio_devtype, }, > { .compatible = "fsl,pq3-gpio", }, > - { .compatible = "fsl,ls1028a-gpio", }, > - { .compatible = "fsl,ls1088a-gpio", }, > { .compatible = "fsl,qoriq-gpio", }, > {} > }; > @@ -303,8 +302,8 @@ static int mpc8xxx_probe(struct platform_device > *pdev) > struct device_node *np = pdev->dev.of_node; > struct mpc8xxx_gpio_chip *mpc8xxx_gc; > struct gpio_chip *gc; > - const struct mpc8xxx_gpio_devtype *devtype = > - of_device_get_match_data(&pdev->dev); > + const struct mpc8xxx_gpio_devtype *devtype = NULL; > + struct fwnode_handle *fwnode; > int ret; > > mpc8xxx_gc = devm_kzalloc(&pdev->dev, sizeof(*mpc8xxx_gc), > GFP_KERNEL); > @@ -315,14 +314,14 @@ static int mpc8xxx_probe(struct platform_device > *pdev) > > raw_spin_lock_init(&mpc8xxx_gc->lock); > > - mpc8xxx_gc->regs = of_iomap(np, 0); > + mpc8xxx_gc->regs = devm_platform_ioremap_resource(pdev, 0); > if (!mpc8xxx_gc->regs) > return -ENOMEM; > > gc = &mpc8xxx_gc->gc; > gc->parent = &pdev->dev; > > - if (of_property_read_bool(np, "little-endian")) { > + if (device_property_read_bool(&pdev->dev, "little-endian")) { > ret = bgpio_init(gc, &pdev->dev, 4, > mpc8xxx_gc->regs + GPIO_DAT, > NULL, NULL, > @@ -345,6 +344,7 @@ static int mpc8xxx_probe(struct platform_device > *pdev) > > mpc8xxx_gc->direction_output = gc->direction_output; > > + devtype = device_get_match_data(&pdev->dev); > if (!devtype) > devtype = &mpc8xxx_gpio_devtype_default; > > @@ -369,9 +369,9 @@ static int mpc8xxx_probe(struct platform_device > *pdev) > * associated input enable must be set (GPIOxGPIE[IEn]=1) to > propagate > * the port value to the GPIO Data Register. > */ > + fwnode = dev_fwnode(&pdev->dev); > if (of_device_is_compatible(np, "fsl,qoriq-gpio") || > - of_device_is_compatible(np, "fsl,ls1028a-gpio") || > - of_device_is_compatible(np, "fsl,ls1088a-gpio")) Again, please keep this. The DT bindings don't mention "fsl,qoriq-gpio" is required. Alternatively, change the binding (ideally convert it to YAML) and get an ack by Rob. -michael