Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S964817AbcCDQU2 (ORCPT ); Fri, 4 Mar 2016 11:20:28 -0500 Received: from mail-pa0-f45.google.com ([209.85.220.45]:35583 "EHLO mail-pa0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S964793AbcCDQUT (ORCPT ); Fri, 4 Mar 2016 11:20:19 -0500 From: Thierry Reding To: Greg Kroah-Hartman , Mathias Nyman Cc: Thierry Reding , Stephen Warren , Alexandre Courbot , Andrew Bresticker , linux-tegra@vger.kernel.org, devicetree@vger.kernel.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v10 9/9] usb: xhci: tegra: Add Tegra210 support Date: Fri, 4 Mar 2016 17:19:39 +0100 Message-Id: <1457108379-20794-9-git-send-email-thierry.reding@gmail.com> X-Mailer: git-send-email 2.7.1 In-Reply-To: <1457108379-20794-1-git-send-email-thierry.reding@gmail.com> References: <1457108379-20794-1-git-send-email-thierry.reding@gmail.com> Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3138 Lines: 111 From: Thierry Reding Parameterize more parts of the driver and add support for Tegra210. Cc: Greg Kroah-Hartman Cc: Mathias Nyman Signed-off-by: Thierry Reding --- drivers/usb/host/xhci-tegra.c | 59 +++++++++++++++++++++++++++++++++++++------ 1 file changed, 51 insertions(+), 8 deletions(-) diff --git a/drivers/usb/host/xhci-tegra.c b/drivers/usb/host/xhci-tegra.c index ab6f9856c5c4..426e8d922cf4 100644 --- a/drivers/usb/host/xhci-tegra.c +++ b/drivers/usb/host/xhci-tegra.c @@ -159,6 +159,8 @@ struct tegra_xusb_soc { unsigned int count; } usb2, ulpi, hsic, usb3; } ports; + + bool scale_ss_clock; }; struct tegra_xusb { @@ -495,13 +497,19 @@ static void tegra_xusb_mbox_handle(struct tegra_xusb *tegra, case MBOX_CMD_INC_SSPI_CLOCK: case MBOX_CMD_DEC_SSPI_CLOCK: - err = tegra_xusb_set_ss_clk(tegra, msg->data * 1000); - if (err < 0) - rsp.cmd = MBOX_CMD_NAK; - else + if (tegra->soc->scale_ss_clock) { + err = tegra_xusb_set_ss_clk(tegra, msg->data * 1000); + if (err < 0) + rsp.cmd = MBOX_CMD_NAK; + else + rsp.cmd = MBOX_CMD_ACK; + + rsp.data = clk_get_rate(tegra->ss_src_clk) / 1000; + } else { rsp.cmd = MBOX_CMD_ACK; + rsp.data = msg->data; + } - rsp.data = clk_get_rate(tegra->ss_src_clk) / 1000; break; case MBOX_CMD_SET_BW: @@ -783,9 +791,11 @@ static int tegra_xusb_clk_enable(struct tegra_xusb *tegra) if (err < 0) goto disable_fs_src; - err = tegra_xusb_set_ss_clk(tegra, TEGRA_XHCI_SS_HIGH_SPEED); - if (err < 0) - goto disable_hs_src; + if (tegra->soc->scale_ss_clock) { + err = tegra_xusb_set_ss_clk(tegra, TEGRA_XHCI_SS_HIGH_SPEED); + if (err < 0) + goto disable_hs_src; + } return 0; @@ -890,11 +900,44 @@ static const struct tegra_xusb_soc tegra124_soc = { .hsic = { .offset = 6, .count = 2, }, .usb3 = { .offset = 0, .count = 2, }, }, + .scale_ss_clock = true, }; MODULE_FIRMWARE("nvidia/tegra124/xusb.bin"); +static const char * const tegra210_supply_names[] = { + "dvddio-pex", + "hvddio-pex", + "avdd-usb", + "avdd-pll-utmip", + "avdd-pll-uerefe", + "dvdd-pex-pll", + "hvdd-pex-pll-e", +}; + +static const struct tegra_xusb_phy_type tegra210_phy_types[] = { + { .name = "usb3", .num = 4, }, + { .name = "usb2", .num = 4, }, + { .name = "hsic", .num = 1, }, +}; + +static const struct tegra_xusb_soc tegra210_soc = { + .firmware_file = "nvidia/tegra210/xusb.bin", + .supply_names = tegra210_supply_names, + .num_supplies = ARRAY_SIZE(tegra210_supply_names), + .phy_types = tegra210_phy_types, + .num_types = ARRAY_SIZE(tegra210_phy_types), + .ports = { + .usb2 = { .offset = 4, .count = 4, }, + .hsic = { .offset = 8, .count = 1, }, + .usb3 = { .offset = 0, .count = 4, }, + }, + .scale_ss_clock = false, +}; +MODULE_FIRMWARE("nvidia/tegra210/xusb.bin"); + static const struct of_device_id tegra_xusb_of_match[] = { { .compatible = "nvidia,tegra124-xusb", .data = &tegra124_soc }, + { .compatible = "nvidia,tegra210-xusb", .data = &tegra210_soc }, { }, }; MODULE_DEVICE_TABLE(of, tegra_xusb_of_match); -- 2.7.1