From patchwork Wed Aug 22 20:43:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lubomir Rintel X-Patchwork-Id: 10573277 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 036E913B6 for ; Wed, 22 Aug 2018 21:53:37 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E64522B5C8 for ; Wed, 22 Aug 2018 21:53:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DA1862BCF4; Wed, 22 Aug 2018 21:53:36 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI,RCVD_IN_DNSWL_NONE autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 8AFBA2B5C8 for ; Wed, 22 Aug 2018 21:53:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=RXva/JMzzimfUdcpWeHQCE09fBQEi4U0FoDEMNaMZ7Y=; b=kBNkAKXPCVNj8GBCCsqyTKtUxo n/oAzir5QvdQyy/0au6AeUqnEpQEreYVm09RGi6ZdyPrttaXCognVc9/1lHjGbIobTKVKqS5PSATh yVmZvKwZlYMyatxw9WYApjUt4HL5eZ+rnPq4FzrQbjfuy0sntpf9Oc7n1s+JMjZ8WOYHQ7Ma//TqX 2Zmco95QKcT4BRrMZHHv1w6WN8fyw8UMM+VGil4fpYI/6RrVaXAvBqyagxJ18tCvoSxzv98tU/Zj/ 7SbK3grSX6khBbToW2+iyyfjnhaTiDJyyZPUttAYtR4gDaxyfjSbkBb3vskdp0Bgx6+Ggxb+FSJaK JFhibhRw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fsb4J-0001s6-8z; Wed, 22 Aug 2018 21:53:35 +0000 Received: from merlin.infradead.org ([2001:8b0:10b:1231::1]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fsb40-0001Oj-3J for linux-arm-kernel@bombadil.infradead.org; Wed, 22 Aug 2018 21:53:16 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=merlin.20170209; h=References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Sender:Reply-To:MIME-Version:Content-Type: Content-Transfer-Encoding:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id: List-Help:List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=7zqY87UjxiFl2Ldz4To9z+jxMZld6NFWRKZKYQfxws4=; b=bONNP/WbVQN+OsrddaCP3fC3P pZyeLmeuaMmWUJSgIzHYfD1OjCzV90l5xF52Jp9igNkYA980+XeHhFFJok+edyFVWHJzMBxbfKFuD f1ssHOVjHPDxc6vtj1dPcpzAv0cQQe5kAgCGAXkaaeqv1s2GDnMID65wbH6bhXDJb4+Qoz3IaiKWJ PC5a/qYYL9ISNla1ljaHY18PDlYyknKFPiF+Hw77vvQKFH8jkQ+4jcZFDsAm8aoD34uGHwZkGbOY2 686IbQl5wsUw2a1/CJlWfT9cPDlr4vGaUZMyoBxfyb2LjHuLqyGE1azUvpq17IAM6BnVCf1hZCGKB 29Wp2HbRA==; Received: from shell.v3.sk ([90.176.6.54]) by merlin.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fsZz7-0003DP-8k for linux-arm-kernel@lists.infradead.org; Wed, 22 Aug 2018 20:44:10 +0000 Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 3809FB5B97; Wed, 22 Aug 2018 22:43:46 +0200 (CEST) Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id ZKJfPONjqW_S; Wed, 22 Aug 2018 22:43:32 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id B7415B5B9F; Wed, 22 Aug 2018 22:43:18 +0200 (CEST) X-Virus-Scanned: amavisd-new at zimbra.v3.sk Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id KafwWKzl1TPP; Wed, 22 Aug 2018 22:43:16 +0200 (CEST) Received: from odvarok.lan (ip-89-102-31-34.net.upcbroadband.cz [89.102.31.34]) by zimbra.v3.sk (Postfix) with ESMTPSA id 4B0BAB5B97; Wed, 22 Aug 2018 22:43:14 +0200 (CEST) From: Lubomir Rintel To: linux-kernel@vger.kernel.org Subject: [PATCH 11/14] USB: EHCI: ehci-mv: add DT support Date: Wed, 22 Aug 2018 22:43:04 +0200 Message-Id: <20180822204307.13251-12-lkundrak@v3.sk> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180822204307.13251-1-lkundrak@v3.sk> References: <20180822204307.13251-1-lkundrak@v3.sk> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180822_164409_698399_CB7D7A42 X-CRM114-Status: GOOD ( 15.16 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , Eric Miao , Greg Kroah-Hartman , linux-usb@vger.kernel.org, Haojian Zhuang , Kishon Vijay Abraham I , Lubomir Rintel , Rob Herring , Alan Stern , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Add Device tree support. Signed-off-by: Lubomir Rintel --- drivers/usb/host/ehci-mv.c | 41 +++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/drivers/usb/host/ehci-mv.c b/drivers/usb/host/ehci-mv.c index 43b300c90875..f26109eafdbf 100644 --- a/drivers/usb/host/ehci-mv.c +++ b/drivers/usb/host/ehci-mv.c @@ -34,11 +34,11 @@ struct ehci_hcd_mv { void __iomem *op_regs; struct usb_phy *otg; + struct clk *clk; - struct mv_usb_platform_data *pdata; struct phy *phy; - struct clk *clk; + int (*set_vbus)(unsigned int vbus); }; static void ehci_clock_enable(struct ehci_hcd_mv *ehci_mv) @@ -100,11 +100,6 @@ static int mv_ehci_probe(struct platform_device *pdev) int retval = -ENODEV; u32 offset; - if (!pdata) { - dev_err(&pdev->dev, "missing platform_data\n"); - return -ENODEV; - } - if (usb_disabled()) return -ENODEV; @@ -114,7 +109,12 @@ static int mv_ehci_probe(struct platform_device *pdev) platform_set_drvdata(pdev, hcd); ehci_mv = hcd_to_ehci_hcd_mv(hcd); - ehci_mv->pdata = pdata; + + ehci_mv->mode = MV_USB_MODE_HOST; + if (pdata) { + ehci_mv->mode = pdata->mode; + ehci_mv->set_vbus = pdata->set_vbus; + } ehci_mv->phy = devm_phy_get(&pdev->dev, "usb"); if (IS_ERR(ehci_mv->phy)) { @@ -166,7 +166,6 @@ static int mv_ehci_probe(struct platform_device *pdev) ehci = hcd_to_ehci(hcd); ehci->caps = (struct ehci_caps *) ehci_mv->cap_regs; - ehci_mv->mode = pdata->mode; if (ehci_mv->mode == MV_USB_MODE_OTG) { ehci_mv->otg = devm_usb_get_phy(&pdev->dev, USB_PHY_TYPE_USB2); if (IS_ERR(ehci_mv->otg)) { @@ -191,8 +190,8 @@ static int mv_ehci_probe(struct platform_device *pdev) /* otg will enable clock before use as host */ mv_ehci_disable(ehci_mv); } else { - if (pdata->set_vbus) - pdata->set_vbus(1); + if (ehci_mv->set_vbus) + ehci_mv->set_vbus(1); retval = usb_add_hcd(hcd, hcd->irq, IRQF_SHARED); if (retval) { @@ -211,8 +210,8 @@ static int mv_ehci_probe(struct platform_device *pdev) return 0; err_set_vbus: - if (pdata->set_vbus) - pdata->set_vbus(0); + if (ehci_mv->set_vbus) + ehci_mv->set_vbus(0); err_disable_clk: mv_ehci_disable(ehci_mv); err_put_hcd: @@ -233,8 +232,8 @@ static int mv_ehci_remove(struct platform_device *pdev) otg_set_host(ehci_mv->otg->otg, NULL); if (ehci_mv->mode == MV_USB_MODE_HOST) { - if (ehci_mv->pdata->set_vbus) - ehci_mv->pdata->set_vbus(0); + if (ehci_mv->set_vbus) + ehci_mv->set_vbus(0); mv_ehci_disable(ehci_mv); } @@ -265,14 +264,20 @@ static void mv_ehci_shutdown(struct platform_device *pdev) hcd->driver->shutdown(hcd); } +static const struct of_device_id ehci_mv_dt_ids[] = { + { .compatible = "marvell,pxau2o-ehci", }, + {}, +}; + static struct platform_driver ehci_mv_driver = { .probe = mv_ehci_probe, .remove = mv_ehci_remove, .shutdown = mv_ehci_shutdown, .driver = { - .name = "mv-ehci", - .bus = &platform_bus_type, - }, + .name = "mv-ehci", + .bus = &platform_bus_type, + .of_match_table = ehci_mv_dt_ids, + }, .id_table = ehci_id_table, };