Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp2365270iob; Sat, 30 Apr 2022 06:43:00 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyIWH439KD8lvtVqrlW5X2Zzo7d4WG39kRUJi6NYXGX/0SHK4nuePhAHui2Qo6vx8P6zls7 X-Received: by 2002:a17:90b:215:b0:1d9:713f:54a5 with SMTP id fy21-20020a17090b021500b001d9713f54a5mr4203174pjb.233.1651326179834; Sat, 30 Apr 2022 06:42:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651326179; cv=none; d=google.com; s=arc-20160816; b=zdB8FjXSSDFxtrYeXDElLN3jNH7R9H8a+p9hpunHmbS2ZHGFFwd/sUvjRh/brap6Gv XMe3/80nOQDRc5IY5/dPthpBHOICSuRW5D1B7Sm2xKYw5DjgxS8LC6UybVt56YNjHO58 HeEgxe4jxuTM/JioesDW84MjSZmPPmVz5dstppqS2Gb46eWP7zoDm5ZoKMSjB6fwS4lL /dQsYuJ9HHjJ7Fg6zI6Hu5CJXb6Kod+i6gtOJvkN4fHNAKl7QSvI2YaYhLHWovJ3L65r NduiqlF81ZU+rImVYgoPysxV1maXSPf5rSFqpN9RvNzUfFEXOeEDBEtYOU5E/tUdT78A E5PQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:subject :from:references:cc:to:content-language:user-agent:mime-version:date :message-id:dkim-signature; bh=XcJewk131Nd463Vs+g3KY8Ye0plJDqJlnu99DciXENY=; b=kRZGJVojqQQLZvXQFOJLXt6MSqxQFCBui9kGi/Darjtnw9uYn1yLxyZohB5IoXkHTs IeS9/1N2Gmb9SC5S4brYltfu3dj47NPi2LS+KKddYUjYFVDwNK2CMxruxOMngXx2UPiA WN6goREZA/+6nvyq+ZC6t83LgO5aWgGaD93IKGhCY15C9x6UoKZRqC4pcVVNrVjpF1ev aKnkC64+/V21aP3yqRy1qLTBhpRycb43fuPRju1YXoyBdoy7vMU7xkxooP+KoPXiSZbX FKue4I5Pqbv9MM1KyCNFBSpjWJT6WJRKvPHX6xBxomoVfsTwT1rRGXiVG6FRCFOyY9RZ Fc3A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Ao2DTWWg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id s1-20020a056a0008c100b00505d4875450si10510444pfu.112.2022.04.30.06.42.43; Sat, 30 Apr 2022 06:42:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=Ao2DTWWg; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380235AbiD2TVD (ORCPT + 99 others); Fri, 29 Apr 2022 15:21:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237522AbiD2TVA (ORCPT ); Fri, 29 Apr 2022 15:21:00 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 73A1041FAD; Fri, 29 Apr 2022 12:17:40 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id x33so15747634lfu.1; Fri, 29 Apr 2022 12:17:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:content-language:to:cc :references:from:subject:in-reply-to:content-transfer-encoding; bh=XcJewk131Nd463Vs+g3KY8Ye0plJDqJlnu99DciXENY=; b=Ao2DTWWgNWhqlZ5g4JZt6z6nIIV3nwRQDJjtKCvXqMM8brGdFiOnzbuG6DE6HD9Q3R shmLGN6pJINTqvRGZnSTBbLCvUvUSCu+GogJKA5IzH4AYL/DmJzETpzz6lRrlfbgBWI0 9JWz3rtqLWQnRDzYg1VXv3ZC67dZqiqL+wMh75I+/Jgg5MiL65p5246FtnBi5RaS5TaJ sp+KGmysK11HzTw3dNTD/PCzqtCO6XgltKvqdQq0JKnIT2BvSOo4uYyj0cHNE5CUxlN8 7qbQKWw+1Us9xaaDm+yiCqT8AGc8rzCkMIgXzttzdmMmHxvPIoeFe4e6iAdNgbqWGST7 qDyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent :content-language:to:cc:references:from:subject:in-reply-to :content-transfer-encoding; bh=XcJewk131Nd463Vs+g3KY8Ye0plJDqJlnu99DciXENY=; b=i70jc/5lIg2Xmq1avdMDNLKp5DBNyq5fBXKQwh6r/Y9Z5IO/GOO2oUio08feap3c7F FfjpTZB7MxioUppFS9YTim0Rn3QaS1/tbVTViDN2o6fmsujEGzZwC2YFrHAp+QraLKMk MtAQYhfzVAKX78TEsc1hGBvkSOLeFICjkVyQLWyCSCUZo30KsW/e8L52bp2n+N6NFniJ u6N6Rr0C74k7S6RzGdT1iTmD0dmb/SV4YCI4vu4SY6F36q8bvfe/dMwjvwtUnxk9qbkx dRhxYcj8u6n51wpj2VHNy00CSbKbE2Tp2d8Y46AWmBJql6yhyy1Kdd1iXCzWq33ykOSH gZSQ== X-Gm-Message-State: AOAM532/7fyVeozQPwEC/1k5V14bBY1kLQBBl2LSd3NLmx2+ausuAVZW tbT9DJqTbRdMJZGiqm8OwBw= X-Received: by 2002:a05:6512:1109:b0:472:25d9:d262 with SMTP id l9-20020a056512110900b0047225d9d262mr538829lfg.128.1651259858641; Fri, 29 Apr 2022 12:17:38 -0700 (PDT) Received: from [10.0.0.42] (91-159-150-230.elisa-laajakaista.fi. [91.159.150.230]) by smtp.gmail.com with ESMTPSA id s3-20020ac25fe3000000b0047255d2111esm3178lfg.77.2022.04.29.12.17.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 29 Apr 2022 12:17:38 -0700 (PDT) Message-ID: Date: Fri, 29 Apr 2022 22:24:19 +0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.8.0 Content-Language: en-US To: Arnd Bergmann , linux-omap@vger.kernel.org, tony@atomide.com, aaro.koskinen@iki.fi, jmkrzyszt@gmail.com Cc: Arnd Bergmann , Russell King , Paul Walmsley , Kevin Hilman , Vinod Koul , Dmitry Torokhov , Ulf Hansson , Dominik Brodowski , Mark Brown , Felipe Balbi , Alan Stern , Lee Jones , Daniel Thompson , Jingoo Han , Helge Deller , Linus Walleij , Krzysztof Kozlowski , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, dmaengine@vger.kernel.org, linux-input@vger.kernel.org, linux-mmc@vger.kernel.org, linux-serial@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-fbdev@vger.kernel.org, alsa-devel@alsa-project.org References: <20220419133723.1394715-1-arnd@kernel.org> <20220419133723.1394715-20-arnd@kernel.org> From: =?UTF-8?Q?P=c3=a9ter_Ujfalusi?= Subject: Re: [PATCH 19/41] ARM: omap: dma: make usb support optional In-Reply-To: <20220419133723.1394715-20-arnd@kernel.org> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-5.0 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 4/19/22 16:37, Arnd Bergmann wrote: > From: Arnd Bergmann > > Most of the plat-omap/dma.c code is specific to the USB > driver. The reason is simple: the omap_udc is the only driver which has not been ported to DMAengine. I had a patch if I recall to convert it, but I don't have a way to test it and the omap_udc sets some funky bits for DMA which we can not figure out on how to handle. > Hide that code when it is not in use, to make it > clearer which parts are actually still required. Reviewed-by: Peter Ujfalusi > Signed-off-by: Arnd Bergmann > --- > arch/arm/plat-omap/dma.c | 45 +++++++++++++++++----------------- > drivers/usb/gadget/udc/Kconfig | 2 +- > include/linux/omap-dma.h | 5 +++- > 3 files changed, 27 insertions(+), 25 deletions(-) > > diff --git a/arch/arm/plat-omap/dma.c b/arch/arm/plat-omap/dma.c > index 700ba9b600e7..b7757864d0aa 100644 > --- a/arch/arm/plat-omap/dma.c > +++ b/arch/arm/plat-omap/dma.c > @@ -66,7 +66,6 @@ enum { DMA_CHAIN_STARTED, DMA_CHAIN_NOTSTARTED }; > > static struct omap_system_dma_plat_info *p; > static struct omap_dma_dev_attr *d; > -static void omap_clear_dma(int lch); > static int enable_1510_mode; > static u32 errata; > > @@ -90,19 +89,16 @@ static int omap_dma_reserve_channels; > static DEFINE_SPINLOCK(dma_chan_lock); > static struct omap_dma_lch *dma_chan; > > -static inline void disable_lnk(int lch); > -static void omap_disable_channel_irq(int lch); > -static inline void omap_enable_channel_irq(int lch); > - > -#ifdef CONFIG_ARCH_OMAP15XX > -/* Returns 1 if the DMA module is in OMAP1510-compatible mode, 0 otherwise */ > -static int omap_dma_in_1510_mode(void) > +static inline void omap_disable_channel_irq(int lch) > { > - return enable_1510_mode; > + /* disable channel interrupts */ > + p->dma_write(0, CICR, lch); > + /* Clear CSR */ > + if (dma_omap1()) > + p->dma_read(CSR, lch); > + else > + p->dma_write(OMAP2_DMA_CSR_CLEAR_MASK, CSR, lch); > } > -#else > -#define omap_dma_in_1510_mode() 0 > -#endif > > #ifdef CONFIG_ARCH_OMAP1 > static inline void set_gdma_dev(int req, int dev) > @@ -169,6 +165,17 @@ void omap_set_dma_priority(int lch, int dst_port, int priority) > #endif > EXPORT_SYMBOL(omap_set_dma_priority); > > +#if IS_ENABLED(CONFIG_USB_OMAP) > +#ifdef CONFIG_ARCH_OMAP15XX > +/* Returns 1 if the DMA module is in OMAP1510-compatible mode, 0 otherwise */ > +static int omap_dma_in_1510_mode(void) > +{ > + return enable_1510_mode; > +} > +#else > +#define omap_dma_in_1510_mode() 0 > +#endif > + > void omap_set_dma_transfer_params(int lch, int data_type, int elem_count, > int frame_count, int sync_mode, > int dma_trigger, int src_or_dst_synch) > @@ -418,17 +425,6 @@ static inline void omap_enable_channel_irq(int lch) > p->dma_write(dma_chan[lch].enabled_irqs, CICR, lch); > } > > -static inline void omap_disable_channel_irq(int lch) > -{ > - /* disable channel interrupts */ > - p->dma_write(0, CICR, lch); > - /* Clear CSR */ > - if (dma_omap1()) > - p->dma_read(CSR, lch); > - else > - p->dma_write(OMAP2_DMA_CSR_CLEAR_MASK, CSR, lch); > -} > - > void omap_disable_dma_irq(int lch, u16 bits) > { > dma_chan[lch].enabled_irqs &= ~bits; > @@ -473,6 +469,7 @@ static inline void disable_lnk(int lch) > p->dma_write(l, CLNK_CTRL, lch); > dma_chan[lch].flags &= ~OMAP_DMA_ACTIVE; > } > +#endif > > int omap_request_dma(int dev_id, const char *dev_name, > void (*callback)(int lch, u16 ch_status, void *data), > @@ -572,6 +569,7 @@ static void omap_clear_dma(int lch) > local_irq_restore(flags); > } > > +#if IS_ENABLED(CONFIG_USB_OMAP) > void omap_start_dma(int lch) > { > u32 l; > @@ -792,6 +790,7 @@ int omap_get_dma_active_status(int lch) > return (p->dma_read(CCR, lch) & OMAP_DMA_CCR_EN) != 0; > } > EXPORT_SYMBOL(omap_get_dma_active_status); > +#endif > > int omap_dma_running(void) > { > diff --git a/drivers/usb/gadget/udc/Kconfig b/drivers/usb/gadget/udc/Kconfig > index cee934dce4f0..69394dc1cdfb 100644 > --- a/drivers/usb/gadget/udc/Kconfig > +++ b/drivers/usb/gadget/udc/Kconfig > @@ -128,7 +128,7 @@ config USB_GR_UDC > > config USB_OMAP > tristate "OMAP USB Device Controller" > - depends on ARCH_OMAP1 || (ARCH_OMAP && COMPILE_TEST) > + depends on ARCH_OMAP1 > depends on ISP1301_OMAP || !(MACH_OMAP_H2 || MACH_OMAP_H3) > help > Many Texas Instruments OMAP processors have flexible full > diff --git a/include/linux/omap-dma.h b/include/linux/omap-dma.h > index 5e228428fda1..07fa58ae9902 100644 > --- a/include/linux/omap-dma.h > +++ b/include/linux/omap-dma.h > @@ -299,8 +299,9 @@ extern void omap_set_dma_priority(int lch, int dst_port, int priority); > extern int omap_request_dma(int dev_id, const char *dev_name, > void (*callback)(int lch, u16 ch_status, void *data), > void *data, int *dma_ch); > -extern void omap_disable_dma_irq(int ch, u16 irq_bits); > extern void omap_free_dma(int ch); > +#if IS_ENABLED(CONFIG_USB_OMAP) > +extern void omap_disable_dma_irq(int ch, u16 irq_bits); > extern void omap_start_dma(int lch); > extern void omap_stop_dma(int lch); > extern void omap_set_dma_transfer_params(int lch, int data_type, > @@ -326,6 +327,8 @@ extern void omap_set_dma_dest_burst_mode(int lch, > extern dma_addr_t omap_get_dma_src_pos(int lch); > extern dma_addr_t omap_get_dma_dst_pos(int lch); > extern int omap_get_dma_active_status(int lch); > +#endif > + > extern int omap_dma_running(void); > > #if IS_ENABLED(CONFIG_FB_OMAP) -- Péter