usb: xhci: tegra: Add Tegra210 support

Parameterize more parts of the driver and add support for Tegra210.

Acked-by: Mathias Nyman <mathias.nyman@linux.intel.com>
Signed-off-by: Thierry Reding <treding@nvidia.com>
This commit is contained in:
Thierry Reding 2016-02-08 19:34:16 +01:00
parent e84fce0f88
commit ab065e9696
1 changed files with 52 additions and 9 deletions

View File

@ -159,6 +159,8 @@ struct tegra_xusb_soc {
unsigned int count; unsigned int count;
} usb2, ulpi, hsic, usb3; } usb2, ulpi, hsic, usb3;
} ports; } ports;
bool scale_ss_clock;
}; };
struct tegra_xusb { struct tegra_xusb {
@ -497,6 +499,7 @@ static void tegra_xusb_mbox_handle(struct tegra_xusb *tegra,
case MBOX_CMD_INC_SSPI_CLOCK: case MBOX_CMD_INC_SSPI_CLOCK:
case MBOX_CMD_DEC_SSPI_CLOCK: case MBOX_CMD_DEC_SSPI_CLOCK:
if (tegra->soc->scale_ss_clock) {
err = tegra_xusb_set_ss_clk(tegra, msg->data * 1000); err = tegra_xusb_set_ss_clk(tegra, msg->data * 1000);
if (err < 0) if (err < 0)
rsp.cmd = MBOX_CMD_NAK; rsp.cmd = MBOX_CMD_NAK;
@ -504,6 +507,11 @@ static void tegra_xusb_mbox_handle(struct tegra_xusb *tegra,
rsp.cmd = MBOX_CMD_ACK; rsp.cmd = MBOX_CMD_ACK;
rsp.data = clk_get_rate(tegra->ss_src_clk) / 1000; rsp.data = clk_get_rate(tegra->ss_src_clk) / 1000;
} else {
rsp.cmd = MBOX_CMD_ACK;
rsp.data = msg->data;
}
break; break;
case MBOX_CMD_SET_BW: case MBOX_CMD_SET_BW:
@ -685,9 +693,11 @@ static int tegra_xusb_clk_enable(struct tegra_xusb *tegra)
if (err < 0) if (err < 0)
goto disable_fs_src; goto disable_fs_src;
if (tegra->soc->scale_ss_clock) {
err = tegra_xusb_set_ss_clk(tegra, TEGRA_XHCI_SS_HIGH_SPEED); err = tegra_xusb_set_ss_clk(tegra, TEGRA_XHCI_SS_HIGH_SPEED);
if (err < 0) if (err < 0)
goto disable_hs_src; goto disable_hs_src;
}
return 0; return 0;
@ -1235,11 +1245,44 @@ static const struct tegra_xusb_soc tegra124_soc = {
.hsic = { .offset = 6, .count = 2, }, .hsic = { .offset = 6, .count = 2, },
.usb3 = { .offset = 0, .count = 2, }, .usb3 = { .offset = 0, .count = 2, },
}, },
.scale_ss_clock = true,
}; };
MODULE_FIRMWARE("nvidia/tegra124/xusb.bin"); 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 = "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[] = { static const struct of_device_id tegra_xusb_of_match[] = {
{ .compatible = "nvidia,tegra124-xusb", .data = &tegra124_soc }, { .compatible = "nvidia,tegra124-xusb", .data = &tegra124_soc },
{ .compatible = "nvidia,tegra210-xusb", .data = &tegra210_soc },
{ }, { },
}; };
MODULE_DEVICE_TABLE(of, tegra_xusb_of_match); MODULE_DEVICE_TABLE(of, tegra_xusb_of_match);