From patchwork Fri Nov 15 17:35:39 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Byrne X-Patchwork-Id: 1195779 X-Patchwork-Delegate: eugen.hristev@microchip.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.denx.de (client-ip=81.169.180.215; helo=lists.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=quarantine dis=none) header.from=origamienergy.com Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=origamienergy.com header.i=@origamienergy.com header.b="YUhE0NSJ"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=amazonses.com header.i=@amazonses.com header.b="S6QwphHR"; dkim-atps=neutral Received: from lists.denx.de (dione.denx.de [81.169.180.215]) by ozlabs.org (Postfix) with ESMTP id 47F59N1fgjz9sPT for ; Sat, 16 Nov 2019 04:35:52 +1100 (AEDT) Received: by lists.denx.de (Postfix, from userid 105) id DF89CC21DD9; Fri, 15 Nov 2019 17:35:43 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on lists.denx.de X-Spam-Level: X-Spam-Status: No, score=0.0 required=5.0 tests=T_DKIM_INVALID autolearn=unavailable autolearn_force=no version=3.4.0 Received: from lists.denx.de (localhost [IPv6:::1]) by lists.denx.de (Postfix) with ESMTP id 917EDC21DD9; Fri, 15 Nov 2019 17:35:42 +0000 (UTC) Received: by lists.denx.de (Postfix, from userid 105) id 6AF15C21DD9; Fri, 15 Nov 2019 17:35:40 +0000 (UTC) Received: from a6-171.smtp-out.eu-west-1.amazonses.com (a6-171.smtp-out.eu-west-1.amazonses.com [54.240.6.171]) by lists.denx.de (Postfix) with ESMTPS id 1ED48C21DD3 for ; Fri, 15 Nov 2019 17:35:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=awgt3ic55kqhwizgro5hhdlz56bi7lbf; d=origamienergy.com; t=1573839339; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Transfer-Encoding; bh=i30kFqUJcvlkGgqijKggYyzfd5gdWYV6DVI/wKuO2/A=; b=YUhE0NSJ31AGcFuJ8zQErV0PdZ1I1QQpy5d0CwwJuY9SFQ4sCGpQBHaBr90e57vw b19u2Tav6k5EsTZ061ssz8sgVPOyyhzdjUFtzayYuwJFR16CoHTYIVfqRwC6wFs1HCj MJMIen0affVFRJuSqHAoPpbgSGzxUPpQKB6Ndou8= DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/simple; s=ihchhvubuqgjsxyuhssfvqohv7z3u4hn; d=amazonses.com; t=1573839339; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version:Content-Transfer-Encoding:Feedback-ID; bh=i30kFqUJcvlkGgqijKggYyzfd5gdWYV6DVI/wKuO2/A=; b=S6QwphHRBIoefVGKVVgpKx4aRknR78Fc+iytpBd2Nf01/mvkspwnB4zC2+IFK9YJ rlROT9CpFrfVqh8K3LLrcERCIh5Uzocu6tfaxywb2q9360g68IOpo+Gyd+VdWY2i3Wp J5QAXA//lmUcTjKluEPoMjRLUYh7yxpyu+sJiZYA= From: James Byrne To: u-boot@lists.denx.de Date: Fri, 15 Nov 2019 17:35:39 +0000 Message-ID: <0102016e70227f41-fa11b1eb-51df-4af7-a6c5-70ba8cb73c02-000000@eu-west-1.amazonses.com> X-Mailer: git-send-email 2.24.0 MIME-Version: 1.0 X-SES-Outgoing: 2019.11.15-54.240.6.171 Feedback-ID: 1.eu-west-1.sQ65CuNSNkrvjFrT7j7oeWmhxZgivYoP5c3BHSC7Qc8=:AmazonSES Subject: [U-Boot] [PATCH] gpio: at91_gpio: Add bank names X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.18 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" Make the at91_gpio driver set sensible GPIO bank names in the platform data. This makes the 'gpio status' command a lot more useful. Signed-off-by: James Byrne --- drivers/gpio/at91_gpio.c | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) diff --git a/drivers/gpio/at91_gpio.c b/drivers/gpio/at91_gpio.c index 965becf77a..94b2b63a04 100644 --- a/drivers/gpio/at91_gpio.c +++ b/drivers/gpio/at91_gpio.c @@ -19,6 +19,28 @@ #define GPIO_PER_BANK 32 +static const char *at91_get_bank_name(uint32_t base_addr) +{ + switch (base_addr) { + case ATMEL_BASE_PIOA: + return "PIOA"; + case ATMEL_BASE_PIOB: + return "PIOB"; + case ATMEL_BASE_PIOC: + return "PIOC"; +#if (ATMEL_PIO_PORTS > 3) + case ATMEL_BASE_PIOD: + return "PIOD"; +#if (ATMEL_PIO_PORTS > 4) + case ATMEL_BASE_PIOE: + return "PIOE"; +#endif +#endif + } + + return ""; +} + static struct at91_port *at91_pio_get_port(unsigned port) { switch (port) { @@ -582,14 +604,15 @@ static int at91_gpio_probe(struct udevice *dev) clk_free(&clk); - uc_priv->bank_name = plat->bank_name; - uc_priv->gpio_count = GPIO_PER_BANK; - #if CONFIG_IS_ENABLED(OF_CONTROL) plat->base_addr = (uint32_t)devfdt_get_addr_ptr(dev); #endif + plat->bank_name = at91_get_bank_name(plat->base_addr); port->regs = (struct at91_port *)plat->base_addr; + uc_priv->bank_name = plat->bank_name; + uc_priv->gpio_count = GPIO_PER_BANK; + return 0; }