Received: by 10.213.65.68 with SMTP id h4csp2433385imn; Mon, 2 Apr 2018 07:30:57 -0700 (PDT) X-Google-Smtp-Source: AIpwx485ppQU9jD1iUaKM+cIvDU5HbzBZPKj/YTx2UvuTDZejoEbnoDESeUSoT5AQGYvbw+ERA9t X-Received: by 2002:a17:902:47aa:: with SMTP id r39-v6mr9871513pld.59.1522679457016; Mon, 02 Apr 2018 07:30:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1522679456; cv=none; d=google.com; s=arc-20160816; b=NySTTPHkft6dClzMeQr9ioTgKYtlkkBywCNVau8VZdMKy60OcVTjkCHNIzXpn4eTZr r6oAGlI1ly06Rk3sqnu576cg8ODR+7crmsRObA0VWLfPp6JBwQZ7YAYalHA28v9tc20/ vCTLYkWVUGTmoD9TQFDJpm0L8fT47LJ/+YWigzuDta9Zh7ODhGkZcc0ORlCb7UifN4b6 1GH/UUApxxtStCcryA232rrGDY4qN5B7X7igci17hVvDyKHMHa/I8Xd0wymAd+CzLGwj NakcGd/RRdZGAu//jgp84nuTojv5S00i9JwtmZZjeeFwrlk/bkHzyvW0Z8otBD484+j5 H5rA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=Qr68OPvfz+V3jjRAKMoxOD+4lkdeiE6eJ2F6w9Eiz2c=; b=K1VgOaBQEK0OZFpRcOy2aywUbYnP7NbXWEz9UgO3jFSyap8QToL1afLL/wuEmQuq3Z YvRW3LwPMyPUeaNeUwDVQy/xM47/wiQqIqT4vSCds7m5feebnswaLZJPAEWS8N43khjh CnlGiwfQ1dGwzRzVlsoX8vBfWY4ZVSTnWwkY9gR5N2sm/NObdpVsRzPip2kHnYB90yDy PntD+yEBdjzKTLqkxpqtm95kKx2WBFx1wWGcdcqrR6YTx6BxUx0r90PrOx7Fza9Cu2EL eYLbC5SlSPMlNqJaUjJT3LulYtcTozXDLOR0QFr7c0cQnz2pa9AvAj9ejEn4iBbrfBZJ dyIg== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id x8-v6si407895plv.420.2018.04.02.07.30.42; Mon, 02 Apr 2018 07:30:56 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751573AbeDBO3I (ORCPT + 99 others); Mon, 2 Apr 2018 10:29:08 -0400 Received: from smtp06.smtpout.orange.fr ([80.12.242.128]:33868 "EHLO smtp.smtpout.orange.fr" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752856AbeDBO2h (ORCPT ); Mon, 2 Apr 2018 10:28:37 -0400 Received: from belgarion.home ([86.201.130.131]) by mwinf5d63 with ME id VSSy1x00R2qEl8e03SUZSH; Mon, 02 Apr 2018 16:28:35 +0200 X-ME-Helo: belgarion.home X-ME-Auth: amFyem1pay5yb2JlcnRAb3JhbmdlLmZy X-ME-Date: Mon, 02 Apr 2018 16:28:35 +0200 X-ME-IP: 86.201.130.131 From: Robert Jarzmik To: Daniel Mack , Haojian Zhuang , Robert Jarzmik , Bartlomiej Zolnierkiewicz , Tejun Heo , Vinod Koul , Mauro Carvalho Chehab , Ulf Hansson , Ezequiel Garcia , Boris Brezillon , David Woodhouse , Brian Norris , Marek Vasut , Richard Weinberger , Cyrille Pitchen , Nicolas Pitre , Samuel Ortiz , Greg Kroah-Hartman , Jaroslav Kysela , Takashi Iwai , Liam Girdwood , Mark Brown , Arnd Bergmann , Russell King , Thomas Gleixner , Kate Stewart , Philippe Ombredanne Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-ide@vger.kernel.org, dmaengine@vger.kernel.org, linux-media@vger.kernel.org, linux-mmc@vger.kernel.org, linux-mtd@lists.infradead.org, netdev@vger.kernel.org, devel@driverdev.osuosl.org, alsa-devel@alsa-project.org Subject: [PATCH 14/15] ARM: pxa: change SSP devices allocation Date: Mon, 2 Apr 2018 16:26:55 +0200 Message-Id: <20180402142656.26815-15-robert.jarzmik@free.fr> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180402142656.26815-1-robert.jarzmik@free.fr> References: <20180402142656.26815-1-robert.jarzmik@free.fr> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In order to prepare for the dma_slave_map change for SSP DMA channels allocation, the SSP platform devices will now include a platform data structure which in turn selects which dma channel has to be used for data transfers, especially the PCM ones. Signed-off-by: Robert Jarzmik --- arch/arm/mach-pxa/devices.c | 78 +++++++++++++++++++++++++++++----- arch/arm/mach-pxa/devices.h | 14 ++---- arch/arm/mach-pxa/include/mach/audio.h | 12 ++++++ arch/arm/mach-pxa/pxa25x.c | 4 +- arch/arm/mach-pxa/pxa27x.c | 4 +- arch/arm/mach-pxa/pxa3xx.c | 5 +-- 6 files changed, 86 insertions(+), 31 deletions(-) diff --git a/arch/arm/mach-pxa/devices.c b/arch/arm/mach-pxa/devices.c index c0b3c90fd67f..955d255dc4f4 100644 --- a/arch/arm/mach-pxa/devices.c +++ b/arch/arm/mach-pxa/devices.c @@ -481,6 +481,17 @@ void __init pxa_set_ac97_info(pxa2xx_audio_ops_t *ops) pxa_register_device(&pxa_device_ac97, ops); } +static struct pxa_ssp_info pxa_ssp_infos[] = { + { .dma_chan_rx_name = "ssp1_rx", .dma_chan_tx_name = "ssp1_tx", }, + { .dma_chan_rx_name = "ssp1_rx", .dma_chan_tx_name = "ssp1_tx", }, + { .dma_chan_rx_name = "ssp2_rx", .dma_chan_tx_name = "ssp2_tx", }, + { .dma_chan_rx_name = "ssp2_rx", .dma_chan_tx_name = "ssp2_tx", }, + { .dma_chan_rx_name = "ssp3_rx", .dma_chan_tx_name = "ssp3_tx", }, + { .dma_chan_rx_name = "ssp3_rx", .dma_chan_tx_name = "ssp3_tx", }, + { .dma_chan_rx_name = "ssp4_rx", .dma_chan_tx_name = "ssp4_tx", }, + { .dma_chan_rx_name = "ssp4_rx", .dma_chan_tx_name = "ssp4_tx", }, +}; + #ifdef CONFIG_PXA25x static struct resource pxa25x_resource_pwm0[] = { @@ -528,7 +539,7 @@ static struct resource pxa25x_resource_ssp[] = { }, }; -struct platform_device pxa25x_device_ssp = { +static struct platform_device pxa25x_device_ssp = { .name = "pxa25x-ssp", .id = 0, .dev = { @@ -554,7 +565,7 @@ static struct resource pxa25x_resource_nssp[] = { }, }; -struct platform_device pxa25x_device_nssp = { +static struct platform_device pxa25x_device_nssp = { .name = "pxa25x-nssp", .id = 1, .dev = { @@ -580,7 +591,7 @@ static struct resource pxa25x_resource_assp[] = { }, }; -struct platform_device pxa25x_device_assp = { +static struct platform_device pxa25x_device_assp = { /* ASSP is basically equivalent to NSSP */ .name = "pxa25x-nssp", .id = 2, @@ -591,6 +602,22 @@ struct platform_device pxa25x_device_assp = { .resource = pxa25x_resource_assp, .num_resources = ARRAY_SIZE(pxa25x_resource_assp), }; + +static struct platform_device *pxa25x_device_ssps[] = { + &pxa25x_device_ssp, + &pxa25x_device_nssp, + &pxa25x_device_assp, +}; + +void __init pxa25x_set_ssp_info(void) +{ + int ssp; + + for (ssp = 0; ssp < ARRAY_SIZE(pxa25x_device_ssps); ssp++) + pxa_register_device(pxa25x_device_ssps[ssp], + &pxa_ssp_infos[ssp]); +} + #endif /* CONFIG_PXA25x */ #if defined(CONFIG_PXA27x) || defined(CONFIG_PXA3xx) @@ -698,7 +725,7 @@ static struct resource pxa27x_resource_ssp1[] = { }, }; -struct platform_device pxa27x_device_ssp1 = { +static struct platform_device pxa27x_device_ssp1 = { .name = "pxa27x-ssp", .id = 0, .dev = { @@ -724,7 +751,7 @@ static struct resource pxa27x_resource_ssp2[] = { }, }; -struct platform_device pxa27x_device_ssp2 = { +static struct platform_device pxa27x_device_ssp2 = { .name = "pxa27x-ssp", .id = 1, .dev = { @@ -750,7 +777,7 @@ static struct resource pxa27x_resource_ssp3[] = { }, }; -struct platform_device pxa27x_device_ssp3 = { +static struct platform_device pxa27x_device_ssp3 = { .name = "pxa27x-ssp", .id = 2, .dev = { @@ -761,6 +788,21 @@ struct platform_device pxa27x_device_ssp3 = { .num_resources = ARRAY_SIZE(pxa27x_resource_ssp3), }; +static struct platform_device *pxa27x_device_ssps[] = { + &pxa27x_device_ssp1, + &pxa27x_device_ssp2, + &pxa27x_device_ssp3, +}; + +void __init pxa27x_set_ssp_info(void) +{ + int ssp; + + for (ssp = 0; ssp < ARRAY_SIZE(pxa27x_device_ssps); ssp++) + pxa_register_device(pxa27x_device_ssps[ssp], + &pxa_ssp_infos[ssp]); +} + static struct resource pxa27x_resource_pwm0[] = { [0] = { .start = 0x40b00000, @@ -951,7 +993,7 @@ static struct resource pxa3xx_resource_ssp4[] = { * make the driver set the correct internal type, hence we provide specific * platform_devices for each of them. */ -struct platform_device pxa3xx_device_ssp1 = { +static struct platform_device pxa3xx_device_ssp1 = { .name = "pxa3xx-ssp", .id = 0, .dev = { @@ -962,7 +1004,7 @@ struct platform_device pxa3xx_device_ssp1 = { .num_resources = ARRAY_SIZE(pxa27x_resource_ssp1), }; -struct platform_device pxa3xx_device_ssp2 = { +static struct platform_device pxa3xx_device_ssp2 = { .name = "pxa3xx-ssp", .id = 1, .dev = { @@ -973,7 +1015,7 @@ struct platform_device pxa3xx_device_ssp2 = { .num_resources = ARRAY_SIZE(pxa27x_resource_ssp2), }; -struct platform_device pxa3xx_device_ssp3 = { +static struct platform_device pxa3xx_device_ssp3 = { .name = "pxa3xx-ssp", .id = 2, .dev = { @@ -984,7 +1026,7 @@ struct platform_device pxa3xx_device_ssp3 = { .num_resources = ARRAY_SIZE(pxa27x_resource_ssp3), }; -struct platform_device pxa3xx_device_ssp4 = { +static struct platform_device pxa3xx_device_ssp4 = { .name = "pxa3xx-ssp", .id = 3, .dev = { @@ -994,6 +1036,22 @@ struct platform_device pxa3xx_device_ssp4 = { .resource = pxa3xx_resource_ssp4, .num_resources = ARRAY_SIZE(pxa3xx_resource_ssp4), }; + +static struct platform_device *pxa3xx_device_ssps[] = { + &pxa3xx_device_ssp1, + &pxa3xx_device_ssp2, + &pxa3xx_device_ssp3, + &pxa3xx_device_ssp4, +}; + +void __init pxa3xx_set_ssp_info(void) +{ + int ssp; + + for (ssp = 0; ssp < ARRAY_SIZE(pxa3xx_device_ssps); ssp++) + pxa_register_device(pxa3xx_device_ssps[ssp], + &pxa_ssp_infos[ssp]); +} #endif /* CONFIG_PXA3xx */ struct resource pxa_resource_gpio[] = { diff --git a/arch/arm/mach-pxa/devices.h b/arch/arm/mach-pxa/devices.h index 11263f7c455b..5909805e7d84 100644 --- a/arch/arm/mach-pxa/devices.h +++ b/arch/arm/mach-pxa/devices.h @@ -22,17 +22,6 @@ extern struct platform_device pxa27x_device_i2c_power; extern struct platform_device pxa27x_device_ohci; extern struct platform_device pxa27x_device_keypad; -extern struct platform_device pxa25x_device_ssp; -extern struct platform_device pxa25x_device_nssp; -extern struct platform_device pxa25x_device_assp; -extern struct platform_device pxa27x_device_ssp1; -extern struct platform_device pxa27x_device_ssp2; -extern struct platform_device pxa27x_device_ssp3; -extern struct platform_device pxa3xx_device_ssp1; -extern struct platform_device pxa3xx_device_ssp2; -extern struct platform_device pxa3xx_device_ssp3; -extern struct platform_device pxa3xx_device_ssp4; - extern struct platform_device pxa25x_device_pwm0; extern struct platform_device pxa25x_device_pwm1; extern struct platform_device pxa27x_device_pwm0; @@ -65,3 +54,6 @@ extern void pxa27x_set_i2c_power_info(struct i2c_pxa_platform_data *info); #ifdef CONFIG_PXA3xx extern void pxa3xx_set_i2c_power_info(struct i2c_pxa_platform_data *info); #endif +void pxa25x_set_ssp_info(void); +void pxa27x_set_ssp_info(void); +void pxa3xx_set_ssp_info(void); diff --git a/arch/arm/mach-pxa/include/mach/audio.h b/arch/arm/mach-pxa/include/mach/audio.h index 7beebf7297b5..f1f6bc7673a1 100644 --- a/arch/arm/mach-pxa/include/mach/audio.h +++ b/arch/arm/mach-pxa/include/mach/audio.h @@ -28,4 +28,16 @@ typedef struct { extern void pxa_set_ac97_info(pxa2xx_audio_ops_t *ops); +/* + * struct pxa_ssp_info - platform data for SSP devices + * @dma_chan_rx_name: name of the receive dma channel to query, see + * pxa_slave_map + * @dma_chan_tx_name: name of the transmit dma channel to query, see + * pxa_slave_map + */ +struct pxa_ssp_info { + const char *dma_chan_rx_name; + const char *dma_chan_tx_name; +}; + #endif diff --git a/arch/arm/mach-pxa/pxa25x.c b/arch/arm/mach-pxa/pxa25x.c index ba431fad5c47..74779afbf200 100644 --- a/arch/arm/mach-pxa/pxa25x.c +++ b/arch/arm/mach-pxa/pxa25x.c @@ -193,9 +193,6 @@ static struct platform_device *pxa25x_devices[] __initdata = { &pxa_device_pmu, &pxa_device_i2s, &sa1100_device_rtc, - &pxa25x_device_ssp, - &pxa25x_device_nssp, - &pxa25x_device_assp, &pxa25x_device_pwm0, &pxa25x_device_pwm1, &pxa_device_asoc_platform, @@ -219,6 +216,7 @@ static int __init pxa25x_init(void) pxa_register_device(&pxa25x_device_gpio, &pxa25x_gpio_info); ret = platform_add_devices(pxa25x_devices, ARRAY_SIZE(pxa25x_devices)); + pxa25x_set_ssp_info(); } } diff --git a/arch/arm/mach-pxa/pxa27x.c b/arch/arm/mach-pxa/pxa27x.c index 0c06f383ad52..f3896d164fd3 100644 --- a/arch/arm/mach-pxa/pxa27x.c +++ b/arch/arm/mach-pxa/pxa27x.c @@ -290,9 +290,6 @@ static struct platform_device *devices[] __initdata = { &pxa_device_asoc_ssp3, &pxa_device_asoc_platform, &pxa_device_rtc, - &pxa27x_device_ssp1, - &pxa27x_device_ssp2, - &pxa27x_device_ssp3, &pxa27x_device_pwm0, &pxa27x_device_pwm1, }; @@ -313,6 +310,7 @@ static int __init pxa27x_init(void) if (!of_have_populated_dt()) { pxa_register_device(&pxa27x_device_gpio, &pxa27x_gpio_info); + pxa27x_set_ssp_info(); pxa2xx_set_dmac_info(32, 75); ret = platform_add_devices(devices, ARRAY_SIZE(devices)); diff --git a/arch/arm/mach-pxa/pxa3xx.c b/arch/arm/mach-pxa/pxa3xx.c index 4b8a0df8ea57..2a5044dd463e 100644 --- a/arch/arm/mach-pxa/pxa3xx.c +++ b/arch/arm/mach-pxa/pxa3xx.c @@ -413,10 +413,6 @@ static struct platform_device *devices[] __initdata = { &pxa_device_asoc_ssp4, &pxa_device_asoc_platform, &pxa_device_rtc, - &pxa3xx_device_ssp1, - &pxa3xx_device_ssp2, - &pxa3xx_device_ssp3, - &pxa3xx_device_ssp4, &pxa27x_device_pwm0, &pxa27x_device_pwm1, }; @@ -456,6 +452,7 @@ static int __init pxa3xx_init(void) ret = platform_add_devices(devices, ARRAY_SIZE(devices)); if (ret) return ret; + pxa3xx_set_ssp_info(); if (cpu_is_pxa300() || cpu_is_pxa310() || cpu_is_pxa320()) { platform_device_add_data(&pxa3xx_device_gpio, &pxa3xx_gpio_pdata, -- 2.11.0