From patchwork Tue Sep 18 08:16:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 146884 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp4736177ljw; Tue, 18 Sep 2018 01:17:31 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaLd/DpBuOizjiAQe/Wvz0Md5nJsr+qrdnep32I15BKsiydB+4MxvRC+6OPiIq9y5+UZ9ax X-Received: by 2002:a63:eb0e:: with SMTP id t14-v6mr26827053pgh.198.1537258651792; Tue, 18 Sep 2018 01:17:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537258651; cv=none; d=google.com; s=arc-20160816; b=Cf/luvWc3qEWn6qEBCv+7uKA5SH/9kg44qgXwhtStgdnTzyx24oMbf4oeDdtJjGDQx We8pzp7qABT2jjKjxX6EN9qdSmj+1Em2AILYnIE7ZRiK/dfOJVYf8Mo8COejwXpCZ9S+ hyZqSWebfnH0zRj3V9habDje8c3xdI/Mt+huEvlUusOjBsW11u60Fuz+niovpzeCm/fV Z21DjuuYSNf2jVvHPYI9FlkHMrACC7Rhid8Ivw9X1SpRvSEK5cASFSKh+l7wzKA94bfx puTH+hZLEVT5u2KtZNSNv7BybMJxMk/hC4V6wQgTwaslplxA8V7JT76JjpZPbG2yNSbM qxPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=5nMv7VSQCMHKkca3mIzGPSPq7/SYPfQI4vPGqtpZxu4=; b=Lg06qGxy9UYGnR4uQRRHrkosfT2jtHZdvmvcwz77gWoj3o7W0OJR/4XEnPmZCpBigV 5MpwyLm+AAAunNKv+yUIV/PnnqoPa/dhhPKGN0gcF8AHHVNAfiwztllY7Z8QZkKDttLl 1VL6ICI1jpYQDSVIo5hmehgnhNdCzLkueVU9xDkODRuITpAUMzGoJfoOVtJXiyzBz2R2 seZ5chLmh61UEBhWvFcOFoQ76jjj5pQsCbfSJQtSLnNKfBqspTfERzaFxG0h2P5jljsQ Gq00zJ+TMMqtQNFklkIoj8ZYj8tVHVc3cxJWO3r95/SmdzMNa1ZLZ2Y8NB2atymnGfy9 kEBw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=viDhE7tV; spf=pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y15-v6si18364541pff.117.2018.09.18.01.17.31; Tue, 18 Sep 2018 01:17:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-usb-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=@samsung.com header.s=mail20170921 header.b=viDhE7tV; spf=pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729223AbeIRNs7 (ORCPT + 5 others); Tue, 18 Sep 2018 09:48:59 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:36643 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727846AbeIRNsk (ORCPT ); Tue, 18 Sep 2018 09:48:40 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20180918081708euoutp0291a261658ce6101d3e6b805d170bc38d~VcJPubH0v2970329703euoutp02z; Tue, 18 Sep 2018 08:17:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20180918081708euoutp0291a261658ce6101d3e6b805d170bc38d~VcJPubH0v2970329703euoutp02z DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1537258628; bh=5nMv7VSQCMHKkca3mIzGPSPq7/SYPfQI4vPGqtpZxu4=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=viDhE7tVCwl9vd6X1oBr2QYQTFTFtMoyFq2GqRZ2iXfY6hYLiP06q24ibjlIxxkEV 4MWt08Jn/uOktwmddM1IY2yGU5jSeAu7KffScEkbw7hVaG2JeVhVe14be+1sqFGFPs Hz8VN6YqpHddg6XD7vmIgoedSWNFAA4W3iYmR5fk= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180918081707eucas1p26bc810842f9a959f5e8d4b9a7f673c8e~VcJPKytPG1987119871eucas1p20; Tue, 18 Sep 2018 08:17:07 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 63.4D.04294.384B0AB5; Tue, 18 Sep 2018 09:17:07 +0100 (BST) Received: from eusmgms2.samsung.com (unknown [182.198.249.180]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180918081706eucas1p10c03f027b993178ede5cff6d81bedfed~VcJOVuXzD1590615906eucas1p1_; Tue, 18 Sep 2018 08:17:06 +0000 (GMT) X-AuditID: cbfec7f4-84fff700000010c6-62-5ba0b483a83f Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms2.samsung.com (EUCPMTA) with SMTP id F7.6B.04128.284B0AB5; Tue, 18 Sep 2018 09:17:06 +0100 (BST) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PF800C5KSCD4H70@eusync4.samsung.com>; Tue, 18 Sep 2018 09:17:06 +0100 (BST) From: Marek Szyprowski To: linux-usb@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Greg Kroah-Hartman , Felipe Balbi , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz Subject: [PATCH 1/4] usb: dwc3: exynos: Remove dead code Date: Tue, 18 Sep 2018 10:16:50 +0200 Message-id: <20180918081653.314-2-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20180918081653.314-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrCIsWRmVeSWpSXmKPExsWy7djP87rNWxZEGxz4I2exccZ6VotjbU/Y LZoXr2ezOH9+A7vFjPP7mCwWLWtltlh75C67A7vHplWdbB77565h9+jbsorR4/MmuQCWKC6b lNSczLLUIn27BK6MU/NfMBVcl63oP+rXwPhKoouRk0NCwERi8oWFrF2MXBxCAisYJQ7sP80I 4XxmlDj49iEzTNWJGTdYIBLLGCV+LNgO5TQwSVw88IkJpIpNwFCi620XG4gtIuAgsWTpHTaQ ImaBJ4wSuzd/YQRJCAtYSLxp6AFKcHCwCKhKXPkdDRLmFbCWONq4lBVim7zE6g0HwDZzCthI 7Nz4CGyZhMBfVomXV1ayQxS5SBxvPMcEYQtLvDq+BSouI3F5cjdUQzOjRPuMWewQTg+jxNY5 O9ggqqwlDh+/CLaOWYBPYtK26cwgF0kI8Ep0tAlBmB4Ss34XQHzZzyjRuGYV6wRGyQWMDKsY xVNLi3PTU4uN8lLL9YoTc4tL89L1kvNzNzEC4+70v+NfdjDu+pN0iFGAg1GJh3fBgvnRQqyJ ZcWVuYcYJTiYlUR4OXMWRAvxpiRWVqUW5ccXleakFh9ilOZgURLn5dNKixYSSE8sSc1OTS1I LYLJMnFwSjUwGp12XHgurrDWbG2sRvOqAvf1TN9vL2PXil1yR/H2DS3exFkru8I9TjTp5/0u eCXxh09wbZznXrGA+5/W7d29xvzMas8KhcD1b+12rs9W8H/cdHTJlqURwYYpLe9cndpVOQ46 xFVEuikbcSUE6c6+WrNAzOWX2Wljjrehm5LiZ3MtWnFhOu9VJZbijERDLeai4kQAAnHByrcC AAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpkluLIzCtJLcpLzFFi42I5/e/4Nd2mLQuiDTassrbYOGM9q8Wxtifs Fs2L17NZnD+/gd1ixvl9TBaLlrUyW6w9cpfdgd1j06pONo/9c9ewe/RtWcXo8XmTXABLFJdN SmpOZllqkb5dAlfGqfkvmAquy1b0H/VrYHwl0cXIySEhYCJxYsYNli5GLg4hgSWMEu1b2pkg nCYmif1PZjGCVLEJGEp0ve1iA7FFBBwkliy9wwZSxCzwhFHixpX5YAlhAQuJNw09QDYHB4uA qsSV39EgYV4Ba4mjjUtZIbbJS6zecIAZxOYUsJHYufERC4gtBFSzrO0y6wRGngWMDKsYRVJL i3PTc4uN9IoTc4tL89L1kvNzNzECA2bbsZ9bdjB2vQs+xCjAwajEw/tj0fxoIdbEsuLK3EOM EhzMSiK8nDkLooV4UxIrq1KL8uOLSnNSiw8xSnOwKInznjeojBISSE8sSc1OTS1ILYLJMnFw SjUwWiisUbFu9a5ep3zU9rag/1Ne4wXsb+Ne2Igk62g1zpnOJiw/oXf+sQZl4ePHZBzzCs+f 2+K7f6nlNh7fOz2Sah7zTazezWs66e/Iaxvw7/BTzuAJkYe+2HMWSnlJSvN6B73g61m/ZcZV s6TllRe7/dgmRrVa3tzAsVq865T19fez1WQvT9qnxFKckWioxVxUnAgArsB1CBQCAAA= X-CMS-MailID: 20180918081706eucas1p10c03f027b993178ede5cff6d81bedfed X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180918081706eucas1p10c03f027b993178ede5cff6d81bedfed References: <20180918081653.314-1-m.szyprowski@samsung.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org All supported Exynos variants provide respective generic PHY framework based drivers for controlling USB PHYs, so there is no point creating fake USB PHYs based on platform devices. While removing useless code, remove calls to runtime PM, which have no effect. Signed-off-by: Marek Szyprowski --- drivers/usb/dwc3/dwc3-exynos.c | 75 ---------------------------------- 1 file changed, 75 deletions(-) -- 2.17.1 diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c index a94fb1ba8f2c..0a946c66c3bb 100644 --- a/drivers/usb/dwc3/dwc3-exynos.c +++ b/drivers/usb/dwc3/dwc3-exynos.c @@ -13,15 +13,11 @@ #include #include #include -#include -#include #include #include #include struct dwc3_exynos { - struct platform_device *usb2_phy; - struct platform_device *usb3_phy; struct device *dev; struct clk *clk; @@ -32,61 +28,6 @@ struct dwc3_exynos { struct regulator *vdd10; }; -static int dwc3_exynos_register_phys(struct dwc3_exynos *exynos) -{ - struct usb_phy_generic_platform_data pdata; - struct platform_device *pdev; - int ret; - - memset(&pdata, 0x00, sizeof(pdata)); - - pdev = platform_device_alloc("usb_phy_generic", PLATFORM_DEVID_AUTO); - if (!pdev) - return -ENOMEM; - - exynos->usb2_phy = pdev; - pdata.type = USB_PHY_TYPE_USB2; - pdata.gpio_reset = -1; - - ret = platform_device_add_data(exynos->usb2_phy, &pdata, sizeof(pdata)); - if (ret) - goto err1; - - pdev = platform_device_alloc("usb_phy_generic", PLATFORM_DEVID_AUTO); - if (!pdev) { - ret = -ENOMEM; - goto err1; - } - - exynos->usb3_phy = pdev; - pdata.type = USB_PHY_TYPE_USB3; - - ret = platform_device_add_data(exynos->usb3_phy, &pdata, sizeof(pdata)); - if (ret) - goto err2; - - ret = platform_device_add(exynos->usb2_phy); - if (ret) - goto err2; - - ret = platform_device_add(exynos->usb3_phy); - if (ret) - goto err3; - - return 0; - -err3: - platform_device_del(exynos->usb2_phy); - -err2: - platform_device_put(exynos->usb3_phy); - -err1: - platform_device_put(exynos->usb2_phy); - - return ret; -} - static int dwc3_exynos_remove_child(struct device *dev, void *unused) { struct platform_device *pdev = to_platform_device(dev); @@ -164,12 +105,6 @@ static int dwc3_exynos_probe(struct platform_device *pdev) goto vdd10_err; } - ret = dwc3_exynos_register_phys(exynos); - if (ret) { - dev_err(dev, "couldn't register PHYs\n"); - goto phys_err; - } - if (node) { ret = of_platform_populate(node, NULL, NULL, dev); if (ret) { @@ -185,9 +120,6 @@ static int dwc3_exynos_probe(struct platform_device *pdev) return 0; populate_err: - platform_device_unregister(exynos->usb2_phy); - platform_device_unregister(exynos->usb3_phy); -phys_err: regulator_disable(exynos->vdd10); vdd10_err: regulator_disable(exynos->vdd33); @@ -205,8 +137,6 @@ static int dwc3_exynos_remove(struct platform_device *pdev) struct dwc3_exynos *exynos = platform_get_drvdata(pdev); device_for_each_child(&pdev->dev, NULL, dwc3_exynos_remove_child); - platform_device_unregister(exynos->usb2_phy); - platform_device_unregister(exynos->usb3_phy); clk_disable_unprepare(exynos->axius_clk); clk_disable_unprepare(exynos->susp_clk); @@ -258,11 +188,6 @@ static int dwc3_exynos_resume(struct device *dev) clk_enable(exynos->clk); clk_enable(exynos->axius_clk); - /* runtime set active to reflect active state. */ - pm_runtime_disable(dev); - pm_runtime_set_active(dev); - pm_runtime_enable(dev); - return 0; } From patchwork Tue Sep 18 08:16:51 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Szyprowski X-Patchwork-Id: 146883 Delivered-To: patch@linaro.org Received: by 2002:a2e:1648:0:0:0:0:0 with SMTP id 8-v6csp4736173ljw; Tue, 18 Sep 2018 01:17:31 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaR2+t7ufmvi4nL/F+g7GviK46/Gc3v4mG4a9amQqDyAvGFT8ItBIz7f1K7zVxgx1jJFBqr X-Received: by 2002:a65:5144:: with SMTP id g4-v6mr26260090pgq.21.1537258651515; Tue, 18 Sep 2018 01:17:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537258651; cv=none; d=google.com; s=arc-20160816; b=ij5QLwnF5apIFPPZTN4chGOEohVljAn4UcN2vUORtC6SMZT4Oi5zZSNlHM/OQTlYha xy1ouPAH0P4YQulyI+CY3VstExc32mk6qSEkuESwWnnaybMc4gQdXuxXKpH6EinYqXLC j6CwEvo2Jq9m233e46KK9iHPLpFIGa30Wnq1PW2zY4GmN1utg/g90tZbA7srUyW5WqJ4 pZsE0yOe0oaMNaq47LB+qWq5xfYSMvs26RfLvtuafdGzm1XoKnVP9xhXG8RbanDy6vki Kx7DJ9hLuuejELjJXt15IAEsq+k/cZfs88pVElBnexKCeOOekaPECNWY+TVFmWvyNuTR OnUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:cms-type:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature:dkim-filter; bh=eoR6xCYPgnXFsAtjPHy54Ga2H2OkuXw5dnyP9JlKCFg=; b=tBzapBlXn1/WFg9nsZITzjkQi4/X2EKCR43NSUHIe78AaesFsUy9Sbn3vtZA2shbuS uNhwlv/moqTttQGNnxoUFXyUv0gxwsbX2Oiec+bo/aAiDVoii2EXcyHhatIyAOu4xMwS WS+wkLn+kDJQQH4bw2LeJcDOnqIkKJwQyNliJ1x/6P+e811QU+mEgNruFwZLp+CB9jME abOLJVnDM8pcIaNn3vaNQcKoMioBk7FCr+pjJXwS9oNsKTNzqwu0axoa2LBWUhootwfY yVFoGeNeju8Wg6287kz/6fEP2f+ZZHdBER/m6Jx9qPL1DYlA2EShZkaihrbjhUhVxdT3 y8fw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b=c+MuobOp; spf=pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y15-v6si18364541pff.117.2018.09.18.01.17.30; Tue, 18 Sep 2018 01:17:31 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-usb-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=@samsung.com header.s=mail20170921 header.b=c+MuobOp; spf=pass (google.com: best guess record for domain of linux-usb-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-usb-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729176AbeIRNs6 (ORCPT + 5 others); Tue, 18 Sep 2018 09:48:58 -0400 Received: from mailout2.w1.samsung.com ([210.118.77.12]:36647 "EHLO mailout2.w1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729009AbeIRNsk (ORCPT ); Tue, 18 Sep 2018 09:48:40 -0400 Received: from eucas1p2.samsung.com (unknown [182.198.249.207]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20180918081708euoutp029aeb895dbe99408a755896947c1466ef~VcJQELsVM2950829508euoutp02Q; Tue, 18 Sep 2018 08:17:08 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20180918081708euoutp029aeb895dbe99408a755896947c1466ef~VcJQELsVM2950829508euoutp02Q DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1537258628; bh=eoR6xCYPgnXFsAtjPHy54Ga2H2OkuXw5dnyP9JlKCFg=; h=From:To:Cc:Subject:Date:In-reply-to:References:From; b=c+MuobOpcp9M4wnkLDQrJsRXaS2k0G9I2DY/84N4RoLAx/LlOgnwEoaoWTAZdIsuH aYBhHrJu587968KdRgJW6+FsyTMcT6nWAiEt8u2vWd0lzGITqtf6WHqeJozFTfOos/ XAEhbOQJhSEkDwjnRubIzuDjzN5OjqTTWC9Q+nMo= Received: from eusmges2new.samsung.com (unknown [203.254.199.244]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20180918081708eucas1p2ed1c0e53e42823746289f55cf9e073c0~VcJPgqYUM1987119871eucas1p22; Tue, 18 Sep 2018 08:17:08 +0000 (GMT) Received: from eucas1p2.samsung.com ( [182.198.249.207]) by eusmges2new.samsung.com (EUCPMTA) with SMTP id 34.4D.04294.384B0AB5; Tue, 18 Sep 2018 09:17:07 +0100 (BST) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eucas1p1.samsung.com (KnoxPortal) with ESMTP id 20180918081707eucas1p11cf21da4c14282d927c0c93652af4ce0~VcJOvmN8H2688326883eucas1p1P; Tue, 18 Sep 2018 08:17:07 +0000 (GMT) X-AuditID: cbfec7f4-c77a99c0000010c6-65-5ba0b483ba54 Received: from eusync4.samsung.com ( [203.254.199.214]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 0B.6E.04284.384B0AB5; Tue, 18 Sep 2018 09:17:07 +0100 (BST) Received: from AMDC2765.digital.local ([106.116.147.25]) by eusync4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0PF800C5KSCD4H70@eusync4.samsung.com>; Tue, 18 Sep 2018 09:17:07 +0100 (BST) From: Marek Szyprowski To: linux-usb@vger.kernel.org, linux-samsung-soc@vger.kernel.org Cc: Marek Szyprowski , Greg Kroah-Hartman , Felipe Balbi , Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz Subject: [PATCH 2/4] usb: dwc3: exynos: Rework clock handling and prepare for new variants Date: Tue, 18 Sep 2018 10:16:51 +0200 Message-id: <20180918081653.314-3-m.szyprowski@samsung.com> X-Mailer: git-send-email 2.17.1 In-reply-to: <20180918081653.314-1-m.szyprowski@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFlrOIsWRmVeSWpSXmKPExsWy7djP87rNWxZEG5xrt7TYOGM9q8Wxtifs Fs2L17NZnD+/gd1ixvl9TBaLlrUyW6w9cpfdgd1j06pONo/9c9ewe/RtWcXo8XmTXABLFJdN SmpOZllqkb5dAlfGqS2/GAv2GlUsbLrJ2MB4RbOLkZNDQsBEorF9I3MXIxeHkMAKRomZbe/Y IJzPjBI7f85ihamafmIvC0RiGaPEh9kLoaoamCR2tj1mBKliEzCU6HrbxQZiiwg4SCxZeges iFngCaPE7s1fwIqEBWIkOk5NZwGxWQRUJRqnvAOzeQWsJS5dvAG1Tl5i9YYDzCA2p4CNxM6N j8BWSwg0skms2PyECaLIReJl5zqoBmGJV8e3sEPYMhKdHQeZIBqaGSXaZ8xih3B6GCW2ztnB BlFlLXH4+EWwbmYBPolJ26YDreMAivNKdLQJQZR4SFy9tA/q6X5GiWNXjzNPYJRcwMiwilE8 tbQ4Nz212CgvtVyvODG3uDQvXS85P3cTIzD6Tv87/mUH464/SYcYBTgYlXh4FyyYHy3EmlhW XJl7iFGCg1lJhJczZ0G0EG9KYmVValF+fFFpTmrxIUZpDhYlcV4+rbRoIYH0xJLU7NTUgtQi mCwTB6dUA2PhbcN5a/NK1+r4PJjKq5QS9+UMy6QJ2+b+/zCpSfVfjvuvgP13xLbbrtzwWsVl URHP9lgbhxiT9wUXBXeK2zzcHx28aOWMx4ca6nViTzVGej8p6zup/ezKgc38Rz9eW5M5Z2aS hcYUI7Hn4cuCPty5W1Eac51nmWdAwMLLx95NVJrZrr7Pe2m4EktxRqKhFnNRcSIAX/2tdLoC AAA= X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpkluLIzCtJLcpLzFFi42I5/e/4Nd3mLQuiDaZuELHYOGM9q8Wxtifs Fs2L17NZnD+/gd1ixvl9TBaLlrUyW6w9cpfdgd1j06pONo/9c9ewe/RtWcXo8XmTXABLFJdN SmpOZllqkb5dAlfGqS2/GAv2GlUsbLrJ2MB4RbOLkZNDQsBEYvqJvSxdjFwcQgJLGCW+z3/C BpIQEmhiknhyLxTEZhMwlOh62wUWFxFwkFiy9A4bSAOzwBNGiRtX5gM5HBzCAjESv74Ug9Sw CKhKNE55xwJi8wpYS1y6eIMVYpm8xOoNB5hBbE4BG4mdGx+xQOyylljWdpl1AiPPAkaGVYwi qaXFuem5xYZ6xYm5xaV56XrJ+bmbGIEBs+3Yz807GC9tDD7EKMDBqMTDu2DB/Ggh1sSy4src Q4wSHMxKIrycOQuihXhTEiurUovy44tKc1KLDzFKc7AoifOeN6iMEhJITyxJzU5NLUgtgsky cXBKNTBK1Heaznof3lvWqBS28IjD8vLd90VPsu78vP/3L1dBu8fzL/ectel9mt9wrt9XejXH 0WfzPordu/T8obqjXN9f7fKZxSVBVto3psq/XhlUE+DUl75btdhFQJLjsUN9psDM6UdUxA42 PDi8ueXx4doG76aPlf6/hb0cSvzSXj/81Kr/ROZI1SolluKMREMt5qLiRAA43NM7FAIAAA== X-CMS-MailID: 20180918081707eucas1p11cf21da4c14282d927c0c93652af4ce0 X-Msg-Generator: CA CMS-TYPE: 201P X-CMS-RootMailID: 20180918081707eucas1p11cf21da4c14282d927c0c93652af4ce0 References: <20180918081653.314-1-m.szyprowski@samsung.com> Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Add per-variant list of clocks and manage them all together in the single array. This is a preparation for adding new variants of Exynos SoCs. No functional changes for existing Exynos SoCs. Signed-off-by: Marek Szyprowski --- drivers/usb/dwc3/dwc3-exynos.c | 128 ++++++++++++++++++++------------- 1 file changed, 80 insertions(+), 48 deletions(-) -- 2.17.1 diff --git a/drivers/usb/dwc3/dwc3-exynos.c b/drivers/usb/dwc3/dwc3-exynos.c index 0a946c66c3bb..3f434a53be8e 100644 --- a/drivers/usb/dwc3/dwc3-exynos.c +++ b/drivers/usb/dwc3/dwc3-exynos.c @@ -17,12 +17,21 @@ #include #include +#define DWC3_EXYNOS_MAX_CLOCKS 4 + +struct dwc3_exynos_driverdata { + const char *clk_names[DWC3_EXYNOS_MAX_CLOCKS]; + int num_clks; + int suspend_clk_idx; +}; + struct dwc3_exynos { struct device *dev; - struct clk *clk; - struct clk *susp_clk; - struct clk *axius_clk; + const char **clk_names; + struct clk *clks[DWC3_EXYNOS_MAX_CLOCKS]; + int num_clks; + int suspend_clk_idx; struct regulator *vdd33; struct regulator *vdd10; @@ -42,47 +51,42 @@ static int dwc3_exynos_probe(struct platform_device *pdev) struct dwc3_exynos *exynos; struct device *dev = &pdev->dev; struct device_node *node = dev->of_node; - - int ret; + const struct dwc3_exynos_driverdata *driver_data; + int i, ret; exynos = devm_kzalloc(dev, sizeof(*exynos), GFP_KERNEL); if (!exynos) return -ENOMEM; - platform_set_drvdata(pdev, exynos); + driver_data = of_device_get_match_data(dev); + exynos->dev = dev; + exynos->num_clks = driver_data->num_clks; + exynos->clk_names = (const char **)driver_data->clk_names; + exynos->suspend_clk_idx = driver_data->suspend_clk_idx; - exynos->dev = dev; + platform_set_drvdata(pdev, exynos); - exynos->clk = devm_clk_get(dev, "usbdrd30"); - if (IS_ERR(exynos->clk)) { - dev_err(dev, "couldn't get clock\n"); - return -EINVAL; + for (i = 0; i < exynos->num_clks; i++) { + exynos->clks[i] = devm_clk_get(dev, exynos->clk_names[i]); + if (IS_ERR(exynos->clks[i])) { + dev_err(dev, "failed to get clock: %s\n", + exynos->clk_names[i]); + return PTR_ERR(exynos->clks[i]); + } } - ret = clk_prepare_enable(exynos->clk); - if (ret) - return ret; - exynos->susp_clk = devm_clk_get(dev, "usbdrd30_susp_clk"); - if (IS_ERR(exynos->susp_clk)) - exynos->susp_clk = NULL; - ret = clk_prepare_enable(exynos->susp_clk); - if (ret) - goto susp_clk_err; - - if (of_device_is_compatible(node, "samsung,exynos7-dwusb3")) { - exynos->axius_clk = devm_clk_get(dev, "usbdrd30_axius_clk"); - if (IS_ERR(exynos->axius_clk)) { - dev_err(dev, "no AXI UpScaler clk specified\n"); - ret = -ENODEV; - goto axius_clk_err; + for (i = 0; i < exynos->num_clks; i++) { + ret = clk_prepare_enable(exynos->clks[i]); + if (ret) { + while (--i > 0) + clk_disable_unprepare(exynos->clks[i]); + return ret; } - ret = clk_prepare_enable(exynos->axius_clk); - if (ret) - goto axius_clk_err; - } else { - exynos->axius_clk = NULL; } + if (exynos->suspend_clk_idx >= 0) + clk_prepare_enable(exynos->clks[exynos->suspend_clk_idx]); + exynos->vdd33 = devm_regulator_get(dev, "vdd33"); if (IS_ERR(exynos->vdd33)) { ret = PTR_ERR(exynos->vdd33); @@ -124,23 +128,27 @@ static int dwc3_exynos_probe(struct platform_device *pdev) vdd10_err: regulator_disable(exynos->vdd33); vdd33_err: - clk_disable_unprepare(exynos->axius_clk); -axius_clk_err: - clk_disable_unprepare(exynos->susp_clk); -susp_clk_err: - clk_disable_unprepare(exynos->clk); + for (i = exynos->num_clks - 1; i >= 0; i--) + clk_disable_unprepare(exynos->clks[i]); + + if (exynos->suspend_clk_idx >= 0) + clk_disable_unprepare(exynos->clks[exynos->suspend_clk_idx]); + return ret; } static int dwc3_exynos_remove(struct platform_device *pdev) { struct dwc3_exynos *exynos = platform_get_drvdata(pdev); + int i; device_for_each_child(&pdev->dev, NULL, dwc3_exynos_remove_child); - clk_disable_unprepare(exynos->axius_clk); - clk_disable_unprepare(exynos->susp_clk); - clk_disable_unprepare(exynos->clk); + for (i = exynos->num_clks - 1; i >= 0; i--) + clk_disable_unprepare(exynos->clks[i]); + + if (exynos->suspend_clk_idx >= 0) + clk_disable_unprepare(exynos->clks[exynos->suspend_clk_idx]); regulator_disable(exynos->vdd33); regulator_disable(exynos->vdd10); @@ -148,10 +156,27 @@ static int dwc3_exynos_remove(struct platform_device *pdev) return 0; } +static const struct dwc3_exynos_driverdata exynos5250_drvdata = { + .clk_names = { "usbdrd30" }, + .num_clks = 1, + .suspend_clk_idx = -1, +}; + +static const struct dwc3_exynos_driverdata exynos7_drvdata = { + .clk_names = { "usbdrd30", "usbdrd30_susp_clk", "usbdrd30_axius_clk" }, + .num_clks = 3, + .suspend_clk_idx = 1, +}; + static const struct of_device_id exynos_dwc3_match[] = { - { .compatible = "samsung,exynos5250-dwusb3" }, - { .compatible = "samsung,exynos7-dwusb3" }, - {}, + { + .compatible = "samsung,exynos5250-dwusb3", + .data = &exynos5250_drvdata, + }, { + .compatible = "samsung,exynos7-dwusb3", + .data = &exynos7_drvdata, + }, { + } }; MODULE_DEVICE_TABLE(of, exynos_dwc3_match); @@ -159,9 +184,10 @@ MODULE_DEVICE_TABLE(of, exynos_dwc3_match); static int dwc3_exynos_suspend(struct device *dev) { struct dwc3_exynos *exynos = dev_get_drvdata(dev); + int i; - clk_disable(exynos->axius_clk); - clk_disable(exynos->clk); + for (i = exynos->num_clks - 1; i >= 0; i--) + clk_disable_unprepare(exynos->clks[i]); regulator_disable(exynos->vdd33); regulator_disable(exynos->vdd10); @@ -172,7 +198,7 @@ static int dwc3_exynos_suspend(struct device *dev) static int dwc3_exynos_resume(struct device *dev) { struct dwc3_exynos *exynos = dev_get_drvdata(dev); - int ret; + int i, ret; ret = regulator_enable(exynos->vdd33); if (ret) { @@ -185,8 +211,14 @@ static int dwc3_exynos_resume(struct device *dev) return ret; } - clk_enable(exynos->clk); - clk_enable(exynos->axius_clk); + for (i = 0; i < exynos->num_clks; i++) { + ret = clk_prepare_enable(exynos->clks[i]); + if (ret) { + while (--i > 0) + clk_disable_unprepare(exynos->clks[i]); + return ret; + } + } return 0; }