From patchwork Sun Nov 25 22:52:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 151937 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp4908872ljp; Sun, 25 Nov 2018 14:54:50 -0800 (PST) X-Google-Smtp-Source: AFSGD/UHa0hMDdzeX+bnZHnJEJfo6AQMSRaxmGAoWq2vNspwJRrKNkI/1yt6dFKfrzXB8YFsAnDi X-Received: by 2002:a63:5a08:: with SMTP id o8mr22275626pgb.185.1543186490813; Sun, 25 Nov 2018 14:54:50 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543186490; cv=none; d=google.com; s=arc-20160816; b=GnWDyD4ravfwwoQYNw4Ryiw4uURCSt7sU6j14NkGEzsmZt2SLWxwQWmdk3pztHGGgk Wj4hxGJ0LZaxB9r9/6ag0w0KCuG/DO8DmwWg2ApJKgX5m9eg8zGk+NL1cugDR9gXYznw 97auFsR78Q9N5LvUHIjL4I00H8LXDvY28Qi6pkZo89lf/oRYN/bZMT/4V00TLlmKmfMv J2pYdyN6WjhdNYCcTfU55Ad/cde+PLcTLm+r0/X4XFNMFcNPgka19qppY0KOVQ8i6XrA 9SkcCwkK/BiANtLweBGowoCr6lcDc2LfofSPLyT8MdOgcmccwGdDlY5hlond1KKyStpj FrQQ== 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 :dkim-signature; bh=cvWRQECCVMRvpjdeVpz899PHBeTtRl3guFm2lyRSQCM=; b=PR++qOmwa5eyhPIrpBv/o4d3u/N5b31qPVGnwkMvmhAJ8nVpKyNXCJjrADhjXgbODh dOr/fFj2JRa5GKy5efd7slHw7Z7jNWLdqxk7OjaiUyBoN0nMGzIp3jSQX4RyaMOPU4qR HlTIJhd6o+MnM07TskD74pIpz0mvPDypFzvE/YISrtZDXcGV+kziw4k+pg7CTvClSFES yYcpZtgOJqIOToBgnVCPEPkWG6TSo/g9yGPqF4NRX/p5e00iYrQ2KuEeg7/R9jMWFrbZ L/hWorA0hPLzm1D8WWlk63WmGUyNSON4T6CujvyCa0Q6WLXC+xMt6G2nBAf64BqpUxF5 r/cQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=OeL9Q88D; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-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 m75si39838955pga.432.2018.11.25.14.54.50; Sun, 25 Nov 2018 14:54:50 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-mmc-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=OeL9Q88D; spf=pass (google.com: best guess record for domain of linux-mmc-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-mmc-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 S1726112AbeKZJrB (ORCPT + 5 others); Mon, 26 Nov 2018 04:47:01 -0500 Received: from mail-lj1-f196.google.com ([209.85.208.196]:37118 "EHLO mail-lj1-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726079AbeKZJrB (ORCPT ); Mon, 26 Nov 2018 04:47:01 -0500 Received: by mail-lj1-f196.google.com with SMTP id e5-v6so14828675lja.4 for ; Sun, 25 Nov 2018 14:54:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=cvWRQECCVMRvpjdeVpz899PHBeTtRl3guFm2lyRSQCM=; b=OeL9Q88DXOhNH+sw4HMZ+eCGdkl4IV7HmXxtCCc75ecQea/EL1Mh6F6oT2BExIBfFQ YfUTkNak4dfW/gYhvhNTSi/f8IHmzTFMgH15je+NzyZpBHOQm0CHO6aW7LlMjSgvpoEx qc+d0V0Djq0k8xW4zN+f7ivGoaoJK3IFcqpcU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=cvWRQECCVMRvpjdeVpz899PHBeTtRl3guFm2lyRSQCM=; b=d09lqi+zCRPR655tjWL2q78gBBykapLNRO9hlnkqnkFAfvgJaH/n8IX117zV8ExKP9 Dl/RKRRw6R0eZyLFKSrUHdbuGcN0JczCv6Z08aWD4PFNYlszKnQj0my78vPoMME5cnOc fOSAnsyasPhMBBpi9NWh3lmU7BB83v326l0r0VvJK/242BCpofhFnkYWLALhByYTG8Zu /bC1a+EJK6M7c4aRfIBvz2cD0zb/C3fNbuPKUsLTn+mGl5vZeMt90ue6UF1AlYq6ejI6 Auy0T4h501h1Zwzyc0AMJx07NZwn+vqOngrOMGKloionMWsHt3vbcgXbGDKFpasoyh8H X+vg== X-Gm-Message-State: AA+aEWYdphZXF/7xPvPy1Lbgcz9KxnMk99w8SO1lf4GyAyonXAniiojf xVEEF71Ih0f7XJMKQdHDJ0i7t8jtrXt9TQ== X-Received: by 2002:a2e:5109:: with SMTP id f9-v6mr16390086ljb.52.1543186486214; Sun, 25 Nov 2018 14:54:46 -0800 (PST) Received: from localhost.localdomain (c-ae7b71d5.014-348-6c756e10.bbcust.telenor.se. [213.113.123.174]) by smtp.gmail.com with ESMTPSA id c19sm9047235lfg.86.2018.11.25.14.54.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sun, 25 Nov 2018 14:54:45 -0800 (PST) From: Linus Walleij To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Linus Walleij , Daniel Mack , Robert Jarzmik , Bartosz Golaszewski , Andrea Adami Subject: [PATCH 06/11 v3] ARM: pxa: Add GPIO descriptors for Palm27x Date: Sun, 25 Nov 2018 23:52:12 +0100 Message-Id: <20181125225217.23201-7-linus.walleij@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181125225217.23201-1-linus.walleij@linaro.org> References: <20181125225217.23201-1-linus.walleij@linaro.org> MIME-Version: 1.0 Sender: linux-mmc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org The Palm27x devices set up the MMC card detect and write protect lines with a special helper function. Augment this helper function to also accept an optional GPIO descriptor table and pass and register this for all the Palm27x devices in that family. Cc: Daniel Mack Cc: Robert Jarzmik Cc: Bartosz Golaszewski Cc: Andrea Adami Signed-off-by: Linus Walleij --- ChangeLog v1->v3: - Split out as separate patch at Robert's request. - I took the Palm Pilots in a separate chunk since they were kind of complex. --- arch/arm/mach-pxa/palm27x.c | 9 +++++++-- arch/arm/mach-pxa/palm27x.h | 16 ++++++++++++---- arch/arm/mach-pxa/palmld.c | 17 +++++++++++++++-- arch/arm/mach-pxa/palmt5.c | 17 +++++++++++++++-- arch/arm/mach-pxa/palmtc.c | 2 +- arch/arm/mach-pxa/palmtreo.c | 32 ++++++++++++++++++++++++++++---- arch/arm/mach-pxa/palmtx.c | 17 +++++++++++++++-- arch/arm/mach-pxa/palmz72.c | 17 +++++++++++++++-- 8 files changed, 108 insertions(+), 19 deletions(-) -- 2.19.1 Acked-by: Robert Jarzmik diff --git a/arch/arm/mach-pxa/palm27x.c b/arch/arm/mach-pxa/palm27x.c index 1efe9bcf07fa..d854a8a2dd59 100644 --- a/arch/arm/mach-pxa/palm27x.c +++ b/arch/arm/mach-pxa/palm27x.c @@ -49,14 +49,19 @@ static struct pxamci_platform_data palm27x_mci_platform_data = { .detect_delay_ms = 200, }; -void __init palm27x_mmc_init(int detect, int ro, int power, - int power_inverted) +void __init palm27x_mmc_init(struct gpiod_lookup_table *gtable, + int detect, + int ro, + int power, + int power_inverted) { palm27x_mci_platform_data.gpio_card_detect = detect; palm27x_mci_platform_data.gpio_card_ro = ro; palm27x_mci_platform_data.gpio_power = power; palm27x_mci_platform_data.gpio_power_invert = power_inverted; + if (gtable) + gpiod_add_lookup_table(gtable); pxa_set_mci_info(&palm27x_mci_platform_data); } #endif diff --git a/arch/arm/mach-pxa/palm27x.h b/arch/arm/mach-pxa/palm27x.h index d4eac3d6ffb5..7ca02d0f45ae 100644 --- a/arch/arm/mach-pxa/palm27x.h +++ b/arch/arm/mach-pxa/palm27x.h @@ -12,12 +12,20 @@ #ifndef __INCLUDE_MACH_PALM27X__ #define __INCLUDE_MACH_PALM27X__ +#include + #if defined(CONFIG_MMC_PXA) || defined(CONFIG_MMC_PXA_MODULE) -extern void __init palm27x_mmc_init(int detect, int ro, int power, - int power_inverted); +extern void __init palm27x_mmc_init(struct gpiod_lookup_table *gtable, + int detect, + int ro, + int power, + int power_inverted); #else -static inline void palm27x_mmc_init(int detect, int ro, int power, - int power_inverted) +static inline void palm27x_mmc_init(struct gpiod_lookup_table *gtable, + int detect, + int ro, + int power, + int power_inverted) {} #endif diff --git a/arch/arm/mach-pxa/palmld.c b/arch/arm/mach-pxa/palmld.c index 980f2847f5b5..aefb65eb4f09 100644 --- a/arch/arm/mach-pxa/palmld.c +++ b/arch/arm/mach-pxa/palmld.c @@ -320,6 +320,17 @@ static void __init palmld_map_io(void) iotable_init(palmld_io_desc, ARRAY_SIZE(palmld_io_desc)); } +static struct gpiod_lookup_table palmld_mci_gpio_table = { + .dev_id = "pxa2xx-mci.0", + .table = { + GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMLD_SD_DETECT_N, + "cd", GPIO_ACTIVE_LOW), + GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMLD_SD_READONLY, + "wp", GPIO_ACTIVE_LOW), + { }, + }, +}; + static void __init palmld_init(void) { pxa2xx_mfp_config(ARRAY_AND_SIZE(palmld_pin_config)); @@ -327,8 +338,10 @@ static void __init palmld_init(void) pxa_set_btuart_info(NULL); pxa_set_stuart_info(NULL); - palm27x_mmc_init(GPIO_NR_PALMLD_SD_DETECT_N, GPIO_NR_PALMLD_SD_READONLY, - GPIO_NR_PALMLD_SD_POWER, 0); + palm27x_mmc_init(&palmld_mci_gpio_table, + GPIO_NR_PALMLD_SD_DETECT_N, + GPIO_NR_PALMLD_SD_READONLY, + GPIO_NR_PALMLD_SD_POWER, 0); palm27x_pm_init(PALMLD_STR_BASE); palm27x_lcd_init(-1, &palm_320x480_lcd_mode); palm27x_irda_init(GPIO_NR_PALMLD_IR_DISABLE); diff --git a/arch/arm/mach-pxa/palmt5.c b/arch/arm/mach-pxa/palmt5.c index 876144aa3564..86634a48aec7 100644 --- a/arch/arm/mach-pxa/palmt5.c +++ b/arch/arm/mach-pxa/palmt5.c @@ -182,6 +182,17 @@ static void __init palmt5_reserve(void) memblock_reserve(0xa0200000, 0x1000); } +static struct gpiod_lookup_table palmt5_mci_gpio_table = { + .dev_id = "pxa2xx-mci.0", + .table = { + GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMT5_SD_DETECT_N, + "cd", GPIO_ACTIVE_LOW), + GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMT5_SD_READONLY, + "wp", GPIO_ACTIVE_LOW), + { }, + }, +}; + static void __init palmt5_init(void) { pxa2xx_mfp_config(ARRAY_AND_SIZE(palmt5_pin_config)); @@ -189,8 +200,10 @@ static void __init palmt5_init(void) pxa_set_btuart_info(NULL); pxa_set_stuart_info(NULL); - palm27x_mmc_init(GPIO_NR_PALMT5_SD_DETECT_N, GPIO_NR_PALMT5_SD_READONLY, - GPIO_NR_PALMT5_SD_POWER, 0); + palm27x_mmc_init(&palmt5_mci_gpio_table, + GPIO_NR_PALMT5_SD_DETECT_N, + GPIO_NR_PALMT5_SD_READONLY, + GPIO_NR_PALMT5_SD_POWER, 0); palm27x_pm_init(PALMT5_STR_BASE); palm27x_lcd_init(-1, &palm_320x480_lcd_mode); palm27x_udc_init(GPIO_NR_PALMT5_USB_DETECT_N, diff --git a/arch/arm/mach-pxa/palmtc.c b/arch/arm/mach-pxa/palmtc.c index 4b04973c9bae..504cdefbf5ac 100644 --- a/arch/arm/mach-pxa/palmtc.c +++ b/arch/arm/mach-pxa/palmtc.c @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/arch/arm/mach-pxa/palmtreo.c b/arch/arm/mach-pxa/palmtreo.c index b66b0b11d717..250e8e27cab9 100644 --- a/arch/arm/mach-pxa/palmtreo.c +++ b/arch/arm/mach-pxa/palmtreo.c @@ -480,23 +480,47 @@ void __init treo680_gpio_init(void) gpio_free(GPIO_NR_TREO680_LCD_EN_N); } +static struct gpiod_lookup_table treo680_mci_gpio_table = { + .dev_id = "pxa2xx-mci.0", + .table = { + GPIO_LOOKUP("gpio-pxa", GPIO_NR_TREO_SD_DETECT_N, + "cd", GPIO_ACTIVE_LOW), + GPIO_LOOKUP("gpio-pxa", GPIO_NR_TREO680_SD_READONLY, + "wp", GPIO_ACTIVE_LOW), + { }, + }, +}; + static void __init treo680_init(void) { pxa2xx_mfp_config(ARRAY_AND_SIZE(treo680_pin_config)); palmphone_common_init(); treo680_gpio_init(); - palm27x_mmc_init(GPIO_NR_TREO_SD_DETECT_N, GPIO_NR_TREO680_SD_READONLY, - GPIO_NR_TREO680_SD_POWER, 0); + palm27x_mmc_init(&treo680_mci_gpio_table, + GPIO_NR_TREO_SD_DETECT_N, + GPIO_NR_TREO680_SD_READONLY, + GPIO_NR_TREO680_SD_POWER, 0); } #endif #ifdef CONFIG_MACH_CENTRO + +static struct gpiod_lookup_table centro685_mci_gpio_table = { + .dev_id = "pxa2xx-mci.0", + .table = { + GPIO_LOOKUP("gpio-pxa", GPIO_NR_TREO_SD_DETECT_N, + "cd", GPIO_ACTIVE_LOW), + { }, + }, +}; + static void __init centro_init(void) { pxa2xx_mfp_config(ARRAY_AND_SIZE(centro685_pin_config)); palmphone_common_init(); - palm27x_mmc_init(GPIO_NR_TREO_SD_DETECT_N, -1, - GPIO_NR_CENTRO_SD_POWER, 1); + palm27x_mmc_init(¢ro685_mci_gpio_table, + GPIO_NR_TREO_SD_DETECT_N, -1, + GPIO_NR_CENTRO_SD_POWER, 1); } #endif diff --git a/arch/arm/mach-pxa/palmtx.c b/arch/arm/mach-pxa/palmtx.c index 1d06a8e91d8f..5bb4ffeb4ba5 100644 --- a/arch/arm/mach-pxa/palmtx.c +++ b/arch/arm/mach-pxa/palmtx.c @@ -337,6 +337,17 @@ static void __init palmtx_map_io(void) iotable_init(palmtx_io_desc, ARRAY_SIZE(palmtx_io_desc)); } +static struct gpiod_lookup_table palmtx_mci_gpio_table = { + .dev_id = "pxa2xx-mci.0", + .table = { + GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTX_SD_DETECT_N, + "cd", GPIO_ACTIVE_LOW), + GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMTX_SD_READONLY, + "wp", GPIO_ACTIVE_LOW), + { }, + }, +}; + static void __init palmtx_init(void) { pxa2xx_mfp_config(ARRAY_AND_SIZE(palmtx_pin_config)); @@ -344,8 +355,10 @@ static void __init palmtx_init(void) pxa_set_btuart_info(NULL); pxa_set_stuart_info(NULL); - palm27x_mmc_init(GPIO_NR_PALMTX_SD_DETECT_N, GPIO_NR_PALMTX_SD_READONLY, - GPIO_NR_PALMTX_SD_POWER, 0); + palm27x_mmc_init(&palmtx_mci_gpio_table, + GPIO_NR_PALMTX_SD_DETECT_N, + GPIO_NR_PALMTX_SD_READONLY, + GPIO_NR_PALMTX_SD_POWER, 0); palm27x_pm_init(PALMTX_STR_BASE); palm27x_lcd_init(-1, &palm_320x480_lcd_mode); palm27x_udc_init(GPIO_NR_PALMTX_USB_DETECT_N, diff --git a/arch/arm/mach-pxa/palmz72.c b/arch/arm/mach-pxa/palmz72.c index 4d475f6f4a77..274f691d6864 100644 --- a/arch/arm/mach-pxa/palmz72.c +++ b/arch/arm/mach-pxa/palmz72.c @@ -386,6 +386,17 @@ static void __init palmz72_camera_init(void) static inline void palmz72_camera_init(void) {} #endif +static struct gpiod_lookup_table palmz72_mci_gpio_table = { + .dev_id = "pxa2xx-mci.0", + .table = { + GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMZ72_SD_DETECT_N, + "cd", GPIO_ACTIVE_LOW), + GPIO_LOOKUP("gpio-pxa", GPIO_NR_PALMZ72_SD_RO, + "wp", GPIO_ACTIVE_LOW), + { }, + }, +}; + /****************************************************************************** * Machine init ******************************************************************************/ @@ -396,8 +407,10 @@ static void __init palmz72_init(void) pxa_set_btuart_info(NULL); pxa_set_stuart_info(NULL); - palm27x_mmc_init(GPIO_NR_PALMZ72_SD_DETECT_N, GPIO_NR_PALMZ72_SD_RO, - GPIO_NR_PALMZ72_SD_POWER_N, 1); + palm27x_mmc_init(&palmz72_mci_gpio_table, + GPIO_NR_PALMZ72_SD_DETECT_N, + GPIO_NR_PALMZ72_SD_RO, + GPIO_NR_PALMZ72_SD_POWER_N, 1); palm27x_lcd_init(-1, &palm_320x320_lcd_mode); palm27x_udc_init(GPIO_NR_PALMZ72_USB_DETECT_N, GPIO_NR_PALMZ72_USB_PULLUP, 0);