Skip to content

Commit ab065e9

Browse files
committed
usb: xhci: tegra: Add Tegra210 support
Parameterize more parts of the driver and add support for Tegra210. Acked-by: Mathias Nyman <[email protected]> Signed-off-by: Thierry Reding <[email protected]>
1 parent e84fce0 commit ab065e9

File tree

1 file changed

+51
-8
lines changed

1 file changed

+51
-8
lines changed

drivers/usb/host/xhci-tegra.c

Lines changed: 51 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,8 @@ struct tegra_xusb_soc {
159159
unsigned int count;
160160
} usb2, ulpi, hsic, usb3;
161161
} ports;
162+
163+
bool scale_ss_clock;
162164
};
163165

164166
struct tegra_xusb {
@@ -497,13 +499,19 @@ static void tegra_xusb_mbox_handle(struct tegra_xusb *tegra,
497499

498500
case MBOX_CMD_INC_SSPI_CLOCK:
499501
case MBOX_CMD_DEC_SSPI_CLOCK:
500-
err = tegra_xusb_set_ss_clk(tegra, msg->data * 1000);
501-
if (err < 0)
502-
rsp.cmd = MBOX_CMD_NAK;
503-
else
502+
if (tegra->soc->scale_ss_clock) {
503+
err = tegra_xusb_set_ss_clk(tegra, msg->data * 1000);
504+
if (err < 0)
505+
rsp.cmd = MBOX_CMD_NAK;
506+
else
507+
rsp.cmd = MBOX_CMD_ACK;
508+
509+
rsp.data = clk_get_rate(tegra->ss_src_clk) / 1000;
510+
} else {
504511
rsp.cmd = MBOX_CMD_ACK;
512+
rsp.data = msg->data;
513+
}
505514

506-
rsp.data = clk_get_rate(tegra->ss_src_clk) / 1000;
507515
break;
508516

509517
case MBOX_CMD_SET_BW:
@@ -685,9 +693,11 @@ static int tegra_xusb_clk_enable(struct tegra_xusb *tegra)
685693
if (err < 0)
686694
goto disable_fs_src;
687695

688-
err = tegra_xusb_set_ss_clk(tegra, TEGRA_XHCI_SS_HIGH_SPEED);
689-
if (err < 0)
690-
goto disable_hs_src;
696+
if (tegra->soc->scale_ss_clock) {
697+
err = tegra_xusb_set_ss_clk(tegra, TEGRA_XHCI_SS_HIGH_SPEED);
698+
if (err < 0)
699+
goto disable_hs_src;
700+
}
691701

692702
return 0;
693703

@@ -1235,11 +1245,44 @@ static const struct tegra_xusb_soc tegra124_soc = {
12351245
.hsic = { .offset = 6, .count = 2, },
12361246
.usb3 = { .offset = 0, .count = 2, },
12371247
},
1248+
.scale_ss_clock = true,
12381249
};
12391250
MODULE_FIRMWARE("nvidia/tegra124/xusb.bin");
12401251

1252+
static const char * const tegra210_supply_names[] = {
1253+
"dvddio-pex",
1254+
"hvddio-pex",
1255+
"avdd-usb",
1256+
"avdd-pll-utmip",
1257+
"avdd-pll-uerefe",
1258+
"dvdd-pex-pll",
1259+
"hvdd-pex-pll-e",
1260+
};
1261+
1262+
static const struct tegra_xusb_phy_type tegra210_phy_types[] = {
1263+
{ .name = "usb3", .num = 4, },
1264+
{ .name = "usb2", .num = 4, },
1265+
{ .name = "hsic", .num = 1, },
1266+
};
1267+
1268+
static const struct tegra_xusb_soc tegra210_soc = {
1269+
.firmware = "nvidia/tegra210/xusb.bin",
1270+
.supply_names = tegra210_supply_names,
1271+
.num_supplies = ARRAY_SIZE(tegra210_supply_names),
1272+
.phy_types = tegra210_phy_types,
1273+
.num_types = ARRAY_SIZE(tegra210_phy_types),
1274+
.ports = {
1275+
.usb2 = { .offset = 4, .count = 4, },
1276+
.hsic = { .offset = 8, .count = 1, },
1277+
.usb3 = { .offset = 0, .count = 4, },
1278+
},
1279+
.scale_ss_clock = false,
1280+
};
1281+
MODULE_FIRMWARE("nvidia/tegra210/xusb.bin");
1282+
12411283
static const struct of_device_id tegra_xusb_of_match[] = {
12421284
{ .compatible = "nvidia,tegra124-xusb", .data = &tegra124_soc },
1285+
{ .compatible = "nvidia,tegra210-xusb", .data = &tegra210_soc },
12431286
{ },
12441287
};
12451288
MODULE_DEVICE_TABLE(of, tegra_xusb_of_match);

0 commit comments

Comments
 (0)