Received: by 2002:a25:ad19:0:0:0:0:0 with SMTP id y25csp2074266ybi; Thu, 18 Jul 2019 03:01:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqxyslqdYC4eAVvpudwYN3N7Vus9LydKVGpzsX05FglD1oP5gSvmBAuAhCQRtDm5p69mxXvq X-Received: by 2002:a63:e54f:: with SMTP id z15mr46749665pgj.4.1563444094713; Thu, 18 Jul 2019 03:01:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1563444094; cv=none; d=google.com; s=arc-20160816; b=sy5UywMRNnCeHDiGj2O3iRScO2D9QC+LMrEFS6Xw895unS2RwN3Axgu+MUVwI7pqLI C6mj0469oWWbVxzyZqzGiQoaQh+OuMeUd6VMjvvC14fEURHFY7JVk/mhn4uK9gD01ln+ FNfIRDy6Ljc8+yIPPUlTPG48McWwcIOqV8AFCruaeQXsAoslYUnezr7R0vrWUvxjHStS sW9xPhyQA+3sE7Bu7Yz64fa3dONNrTgWnX6U4ujw9GbR8wXJK9AfdG/d2QUsPyb87uv6 n75MOneH046NGkvWMuJgasHHPqh6GvHFzD7yJCIr+YtB/AWZnX/CXkv8BjroWuVYRKPa 0ZIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=6exHNBJGwr21fVwVtQEdRojRCnJoh2X0ZpwHUDiUu80=; b=yL84xzLfc2QJjRQr9oiyLnvTFlR7fjLW5tXoqp5v0HxClhM+VHpD6pWHrvr41cjVTw jEyGyW8t/IcUvXzeSKdAFwS0TowIvE7Jqrb6A9x7eH+866VmlpAm0vyThqGlewEbfgtA isKLo4+A9l5iT7xITxW6vtIPdWkKltqcVLwE29XxEKOVEUTKpZz9deNj1RSnmilpgo5g c97RXfMVSLEwTdgRXrrC8ncBR8tDVgEoGFxIXBr0RBdP+WQc5ohc1xlYeFb1MsJeACL6 Tx6o2WG1ysuCCdQXp4owVOzPvX1jYXkdjMGL3UX/APe/uJp019c1EbGUIuMMzTxyIDMe a01Q== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o21si1179427pgm.453.2019.07.18.03.01.17; Thu, 18 Jul 2019 03:01:34 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389933AbfGRJ7B (ORCPT + 99 others); Thu, 18 Jul 2019 05:59:01 -0400 Received: from inva020.nxp.com ([92.121.34.13]:35456 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726383AbfGRJ7A (ORCPT ); Thu, 18 Jul 2019 05:59:00 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 812141A0047; Thu, 18 Jul 2019 11:58:57 +0200 (CEST) Received: from invc005.ap-rdc01.nxp.com (invc005.ap-rdc01.nxp.com [165.114.16.14]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 802091A00EE; Thu, 18 Jul 2019 11:58:51 +0200 (CEST) Received: from titan.ap.freescale.net (TITAN.ap.freescale.net [10.192.208.233]) by invc005.ap-rdc01.nxp.com (Postfix) with ESMTP id 479FE402D5; Thu, 18 Jul 2019 17:58:44 +0800 (SGT) From: Hui Song To: Shawn Guo , Li Yang , Rob Herring , Mark Rutland , Linus Walleij , Bartosz Golaszewski Cc: linux-arm-kernel@lists.infradead.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Song Hui Subject: [PATCH 2/2] gpio: mpc8xxx: Add ls1028a device specify function. Date: Thu, 18 Jul 2019 17:49:02 +0800 Message-Id: <20190718094902.15562-2-hui.song_1@nxp.com> X-Mailer: git-send-email 2.9.5 In-Reply-To: <20190718094902.15562-1-hui.song_1@nxp.com> References: <20190718094902.15562-1-hui.song_1@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Song Hui There is a device specify register(named GPIO_IBE) on ls1028a need to enable in initial stage. Signed-off-by: Song Hui --- drivers/gpio/gpio-mpc8xxx.c | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) diff --git a/drivers/gpio/gpio-mpc8xxx.c b/drivers/gpio/gpio-mpc8xxx.c index c8673a5..1a680aa 100644 --- a/drivers/gpio/gpio-mpc8xxx.c +++ b/drivers/gpio/gpio-mpc8xxx.c @@ -32,6 +32,7 @@ #define GPIO_IMR 0x10 #define GPIO_ICR 0x14 #define GPIO_ICR2 0x18 +#define GPIO_IBE 0x18 struct mpc8xxx_gpio_chip { struct gpio_chip gc; @@ -45,6 +46,27 @@ struct mpc8xxx_gpio_chip { unsigned int irqn; }; +/* The GPIO Input Buffer Enable register(GPIO_IBE) is used to + * control the input enable of each individual GPIO port. + * When an individual GPIO port’s direction is set to + * input (GPIO_GPDIR[DRn=0]), the associated input enable must be + * set (GPIOxGPIE[IEn]=1) to propagate the port value to the GPIO + * Data Register. + */ +static int ls1028a_gpio_dir_in_init(struct gpio_chip *gc) +{ + unsigned long flags; + struct mpc8xxx_gpio_chip *mpc8xxx_gc = gpiochip_get_data(gc); + + spin_lock_irqsave(&gc->bgpio_lock, flags); + + gc->write_reg(mpc8xxx_gc->regs + GPIO_IBE, 0xffffffff); + + spin_unlock_irqrestore(&gc->bgpio_lock, flags); + + return 0; +} + /* * This hardware has a big endian bit assignment such that GPIO line 0 is * connected to bit 31, line 1 to bit 30 ... line 31 to bit 0. @@ -261,6 +283,7 @@ static const struct irq_domain_ops mpc8xxx_gpio_irq_ops = { }; struct mpc8xxx_gpio_devtype { + int (*gpio_dir_in_init)(struct gpio_chip *chip); int (*gpio_dir_out)(struct gpio_chip *, unsigned int, int); int (*gpio_get)(struct gpio_chip *, unsigned int); int (*irq_set_type)(struct irq_data *, unsigned int); @@ -271,6 +294,10 @@ static const struct mpc8xxx_gpio_devtype mpc512x_gpio_devtype = { .irq_set_type = mpc512x_irq_set_type, }; +static const struct mpc8xxx_gpio_devtype ls1028a_gpio_devtype = { + .gpio_dir_in_init = ls1028a_gpio_dir_in_init, +}; + static const struct mpc8xxx_gpio_devtype mpc5125_gpio_devtype = { .gpio_dir_out = mpc5125_gpio_dir_out, .irq_set_type = mpc512x_irq_set_type, @@ -291,6 +318,7 @@ 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", .data = &ls1028a_gpio_devtype, }, { .compatible = "fsl,qoriq-gpio", }, {} }; @@ -376,6 +404,9 @@ static int mpc8xxx_probe(struct platform_device *pdev) /* ack and mask all irqs */ gc->write_reg(mpc8xxx_gc->regs + GPIO_IER, 0xffffffff); gc->write_reg(mpc8xxx_gc->regs + GPIO_IMR, 0); + /* enable input buffer */ + if (devtype->gpio_dir_in_init) + devtype->gpio_dir_in_init(gc); irq_set_chained_handler_and_data(mpc8xxx_gc->irqn, mpc8xxx_gpio_irq_cascade, mpc8xxx_gc); -- 2.9.5