From patchwork Thu Aug 6 18:20:25 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 247498 Delivered-To: patch@linaro.org Received: by 2002:a50:110d:0:0:0:0:0 with SMTP id e13csp1484752eck; Thu, 6 Aug 2020 11:28:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxJ4g8N5gLa+3HL0AtczLRZMMmXcXCum7Q1cxfI7ZWrPfgWsGhq3cSJ8F7JJfwRfh0K0tUm X-Received: by 2002:a50:d1d8:: with SMTP id i24mr5442282edg.341.1596738534966; Thu, 06 Aug 2020 11:28:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1596738534; cv=none; d=google.com; s=arc-20160816; b=UDgUiUb3gp8Le42hGqXIHY2E9qd+Sem7anb4ThPBPdgzQ88AJDexfJHHJrqwGdwRk+ BWUZg0jdx6fugKkYfWa9LwjAgI6aCUVlqjJlTgGP7mWtj2Gq3di6MRqpmgRZcbFBkCWa e/apGeJNMbR3FVfzeFvdZqsgLisLrgd8K9kHWpK/SwPFxFZUxVZnTBqeBfcAb04MIdiY 69TaCyPrmpg00JYv4owzlIxQheXZq+/Oi8ZT6LSWL5G7J3Grg4eG1b80ULlMG5gDlVJN UZep9zBhybgg0LHtv9NnB8DssvItqpvQywHYVdrEMjq8pIAhR+Za7CIvv1dWfb/ZofzQ lB7g== 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=r9FI473WT8TWIjyTcOQqjkV7XiVd+Qug4CxZ4hJsP9M=; b=mxQcXSXtyDQWHkkmbfDgGuvnLY7arKrFQS5F9mKBePPHsxOgPQLVw9gFqMqfSLvhOj WGkjQ+evBXQEFGUIo5bFaprUIgJqtohuyjGmOdsUgUNhievkv0T+I9EZGzS8GCgjPrvm 4Crt96oDsMYtORxZFQEvsCsychO8JJX1Oa0JZYMeJ/uroedUhbO6vGecPRibwMlkvMJF LKJD8hfGjzkmhQutLF8ux7sxhCtEonmS+uHtV6gKk8cYeWOMxEpu2ix+whwmiRpkXmcB t4/XYVS2DtpyPx4ZRgusInzGvgsMG8i3rKnM6sMA+I2/4Ic308wVhZQEIfMgvo2r3Qpr NmaA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=br6SESXv; spf=pass (google.com: domain of linux-usb-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id y26si3674197edr.390.2020.08.06.11.28.54; Thu, 06 Aug 2020 11:28:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-usb-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=br6SESXv; spf=pass (google.com: domain of linux-usb-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728022AbgHFS2A (ORCPT + 5 others); Thu, 6 Aug 2020 14:28:00 -0400 Received: from mail.kernel.org ([198.145.29.99]:51158 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728341AbgHFSXc (ORCPT ); Thu, 6 Aug 2020 14:23:32 -0400 Received: from localhost.localdomain (unknown [194.230.155.117]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 5165E22D04; Thu, 6 Aug 2020 18:22:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1596738133; bh=DPZaom5NAT2KivsfSxfg/NbbYwOmpa1upzg9nMe0pn4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=br6SESXvsfakDzF/1hP0mUDf1oXB70eWCEQ3qKKN4rKgzInWtHHsBHxX7FsBumrlM KVyZKT299K/KhuKeLy4D9GiQf3wrSnoelofZuN05GtEz5b2oKezgkhRVlQ9nvg3CUl jO7awguu5PH2xrZFl15Fm8gfnewVTkzd8ShLjiKc= From: Krzysztof Kozlowski To: linux-kernel@vger.kernel.org Cc: Arnd Bergmann , Krzysztof Kozlowski , Russell King , Felipe Balbi , Greg Kroah-Hartman , Kukjin Kim , linux-arm-kernel@lists.infradead.org, linux-usb@vger.kernel.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH v2 08/41] usb: gadget: s3c: use platform resources Date: Thu, 6 Aug 2020 20:20:25 +0200 Message-Id: <20200806182059.2431-8-krzk@kernel.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200806181932.2253-1-krzk@kernel.org> References: <20200806181932.2253-1-krzk@kernel.org> MIME-Version: 1.0 Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org From: Arnd Bergmann The resources are correctly initialized, so just use them instead of relying on hardcoded data from platform headers. Signed-off-by: Arnd Bergmann Signed-off-by: Krzysztof Kozlowski --- drivers/usb/gadget/udc/s3c2410_udc.c | 31 +++++++------------ drivers/usb/gadget/udc/s3c2410_udc.h | 1 + .../usb/gadget/udc/s3c2410_udc_regs.h | 0 3 files changed, 12 insertions(+), 20 deletions(-) rename arch/arm/plat-samsung/include/plat/regs-udc.h => drivers/usb/gadget/udc/s3c2410_udc_regs.h (100%) -- 2.17.1 Acked-by: Felipe Balbi diff --git a/drivers/usb/gadget/udc/s3c2410_udc.c b/drivers/usb/gadget/udc/s3c2410_udc.c index e875a0b967c0..f1ea51476add 100644 --- a/drivers/usb/gadget/udc/s3c2410_udc.c +++ b/drivers/usb/gadget/udc/s3c2410_udc.c @@ -36,15 +36,11 @@ #include #include #include -#include -#include - -#include #include - #include "s3c2410_udc.h" +#include "s3c2410_udc_regs.h" #define DRIVER_DESC "S3C2410 USB Device Controller Gadget" #define DRIVER_AUTHOR "Herbert Pƶtzl , " \ @@ -57,6 +53,7 @@ static struct s3c2410_udc *the_controller; static struct clk *udc_clock; static struct clk *usb_bus_clock; static void __iomem *base_addr; +static int irq_usbd; static u64 rsrc_start; static u64 rsrc_len; static struct dentry *s3c2410_udc_debugfs_root; @@ -835,8 +832,6 @@ static void s3c2410_udc_handle_ep(struct s3c2410_ep *ep) } } -#include - /* * s3c2410_udc_irq - interrupt handler */ @@ -977,7 +972,7 @@ static irqreturn_t s3c2410_udc_irq(int dummy, void *_dev) } } - dprintk(DEBUG_VERBOSE, "irq: %d s3c2410_udc_done.\n", IRQ_USBD); + dprintk(DEBUG_VERBOSE, "irq: %d s3c2410_udc_done.\n", irq_usbd); /* Restore old index */ udc_write(idx, S3C2410_UDC_INDEX_REG); @@ -1777,13 +1772,7 @@ static int s3c2410_udc_probe(struct platform_device *pdev) spin_lock_init(&udc->lock); udc_info = dev_get_platdata(&pdev->dev); - rsrc_start = S3C2410_PA_USBDEV; - rsrc_len = S3C24XX_SZ_USBDEV; - - if (!request_mem_region(rsrc_start, rsrc_len, gadget_name)) - return -EBUSY; - - base_addr = ioremap(rsrc_start, rsrc_len); + base_addr = devm_platform_ioremap_resource(pdev, 0); if (!base_addr) { retval = -ENOMEM; goto err_mem; @@ -1795,17 +1784,19 @@ static int s3c2410_udc_probe(struct platform_device *pdev) s3c2410_udc_disable(udc); s3c2410_udc_reinit(udc); + irq_usbd = platform_get_irq(pdev, 0); + /* irq setup after old hardware state is cleaned up */ - retval = request_irq(IRQ_USBD, s3c2410_udc_irq, + retval = request_irq(irq_usbd, s3c2410_udc_irq, 0, gadget_name, udc); if (retval != 0) { - dev_err(dev, "cannot get irq %i, err %d\n", IRQ_USBD, retval); + dev_err(dev, "cannot get irq %i, err %d\n", irq_usbd, retval); retval = -EBUSY; goto err_map; } - dev_dbg(dev, "got irq %i\n", IRQ_USBD); + dev_dbg(dev, "got irq %i\n", irq_usbd); if (udc_info && udc_info->vbus_pin > 0) { retval = gpio_request(udc_info->vbus_pin, "udc vbus"); @@ -1872,7 +1863,7 @@ static int s3c2410_udc_probe(struct platform_device *pdev) if (udc_info && udc_info->vbus_pin > 0) gpio_free(udc_info->vbus_pin); err_int: - free_irq(IRQ_USBD, udc); + free_irq(irq_usbd, udc); err_map: iounmap(base_addr); err_mem: @@ -1906,7 +1897,7 @@ static int s3c2410_udc_remove(struct platform_device *pdev) free_irq(irq, udc); } - free_irq(IRQ_USBD, udc); + free_irq(irq_usbd, udc); iounmap(base_addr); release_mem_region(rsrc_start, rsrc_len); diff --git a/drivers/usb/gadget/udc/s3c2410_udc.h b/drivers/usb/gadget/udc/s3c2410_udc.h index bdcaa8dd300f..68bdf3e5aac2 100644 --- a/drivers/usb/gadget/udc/s3c2410_udc.h +++ b/drivers/usb/gadget/udc/s3c2410_udc.h @@ -90,6 +90,7 @@ struct s3c2410_udc { unsigned req_pending : 1; u8 vbus; struct dentry *regs_info; + int irq; }; #define to_s3c2410(g) (container_of((g), struct s3c2410_udc, gadget)) diff --git a/arch/arm/plat-samsung/include/plat/regs-udc.h b/drivers/usb/gadget/udc/s3c2410_udc_regs.h similarity index 100% rename from arch/arm/plat-samsung/include/plat/regs-udc.h rename to drivers/usb/gadget/udc/s3c2410_udc_regs.h