Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp848285imm; Wed, 22 Aug 2018 13:46:00 -0700 (PDT) X-Google-Smtp-Source: AA+uWPzbqDCFvEOHM3/cRsEUSVbYUsF/6DUOs1gFjaO+BVWueYuZtv+WM54R3ft29XhG1gvVVOj/ X-Received: by 2002:a62:ac12:: with SMTP id v18-v6mr59386495pfe.126.1534970760655; Wed, 22 Aug 2018 13:46:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1534970760; cv=none; d=google.com; s=arc-20160816; b=KJYkWvdfgqiAuMhlgIiI1/l1Rm2gTGureFPIeuk4IMvOt3S/UHt8UCxdJskrxPlV9Y NI9kF5spRiNAAsmFqmV3T/pnSuSaG2bwBXFHuFCbvxC4vvgqSIDBItiHxM4cXi5PLnby ES8bOHtt6pX5T19r0y13m7tfmL080YF8wI1RmEPTSnJZtXBlnwNID6pleNyf/500yeIr Dv/MEG12gdrKy5kQKvbudBL5zbElYggBrT8+lu4J5ERHljm/bkOUssCtqpdT0k7sygyP hMQ2azPb2sKDSlBLwMwmyo+j5tc6TMLvMXyBiXZwAzxj2utu2UDubyNVP46UcMuev9or Wo0g== 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=7zqY87UjxiFl2Ldz4To9z+jxMZld6NFWRKZKYQfxws4=; b=mM3ms+m9KhmpPg/Tu+cm3ojPPdlV7OauLM3bVZYzM3FTx8oomrgcDdRmvliGEEdHPB UrzQDw1eb5L9C1PJeyqhUt0Yt562OTRQwsnNyV6ct9FPd5UAFL52yO4yIIeFEwdQ+zEI ILF0dXFiPlez8VIpnVBsg/Y2a0Xs8ujKfo+lWPTGuq44niBf0+QtwnGaIFI5cZXHTi78 shE4b7e5bVErnsWzGiigDxHgGZ5DKbPEGllBe+7553mlnRHaa1svGRvzqakwRcd77vIg BXmCr5ezQGeLD9sTvg6sYK/xIMxhLC1Wisvu2nGdV4m85UWshDumzraDSr93EagdIXAD WY0Q== 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 l10-v6si2214765plt.136.2018.08.22.13.45.27; Wed, 22 Aug 2018 13:46:00 -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 S1728682AbeHWAKP (ORCPT + 99 others); Wed, 22 Aug 2018 20:10:15 -0400 Received: from shell.v3.sk ([90.176.6.54]:53360 "EHLO shell.v3.sk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728497AbeHWAKN (ORCPT ); Wed, 22 Aug 2018 20:10:13 -0400 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 Cc: linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Rob Herring , Mark Rutland , Greg Kroah-Hartman , Eric Miao , Haojian Zhuang , Kishon Vijay Abraham I , Alan Stern , Lubomir Rintel 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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, }; -- 2.17.1