aboutsummaryrefslogtreecommitdiff
path: root/cmd/mvebu/rx_training.c
diff options
context:
space:
mode:
authorTom Rini <trini@konsulko.com>2021-04-29 08:21:55 -0400
committerTom Rini <trini@konsulko.com>2021-04-29 08:21:55 -0400
commita26522e77477531fc1025b27cebb45de9fc5a3db (patch)
treefc87c8b76aba917ecd3ce0b31786cbd56c519352 /cmd/mvebu/rx_training.c
parentc306b24948acb23798e2fd80f56ae09363a6f9f7 (diff)
parenteccbd4ad8e4e182638eafbfb87ac139c04f24a01 (diff)
Merge https://source.denx.de/u-boot/custodians/u-boot-marvell
- Add base support for Marvell OcteonTX2 CN9130 CRB (mostly done by Kostya) - Sync Armada 3k/7k/8k SERDES code with Marvell version (misc Marvell authors) - pci-aardvark: Fix processing PIO transfers (Pali)
Diffstat (limited to 'cmd/mvebu/rx_training.c')
-rw-r--r--cmd/mvebu/rx_training.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/cmd/mvebu/rx_training.c b/cmd/mvebu/rx_training.c
new file mode 100644
index 0000000000..4bae7653ac
--- /dev/null
+++ b/cmd/mvebu/rx_training.c
@@ -0,0 +1,57 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Copyright (C) 2017 Marvell International Ltd.
+ *
+ * SPDX-License-Identifier: GPL-2.0
+ */
+
+#include <common.h>
+#include <command.h>
+#include <console.h>
+#include <dm.h>
+#include <fdtdec.h>
+#include <dm/device-internal.h>
+#include <mvebu/comphy.h>
+
+int rx_training_cmd(struct cmd_tbl *cmdtp, int flag, int argc,
+ char * const argv[])
+{
+ struct udevice *dev;
+ struct uclass *uc;
+ int ret, cp_index, comphy_index, i = 0;
+
+ if (argc != 3) {
+ printf("missing arguments\n");
+ return -1;
+ }
+
+ cp_index = simple_strtoul(argv[1], NULL, 16);
+ comphy_index = simple_strtoul(argv[2], NULL, 16);
+
+ ret = uclass_get(UCLASS_MISC, &uc);
+ if (ret) {
+ printf("Couldn't find UCLASS_MISC\n");
+ return ret;
+ }
+
+ uclass_foreach_dev(dev, uc) {
+ if (!(memcmp(dev->name, "comphy", 5))) {
+ if (i == cp_index) {
+ comphy_rx_training(dev, comphy_index);
+ return 0;
+ }
+
+ i++;
+ }
+ }
+
+ printf("Coudn't find comphy %d\n", cp_index);
+
+ return 0;
+}
+
+U_BOOT_CMD(
+ rx_training, 3, 0, rx_training_cmd,
+ "rx_training <cp id> <comphy id>\n",
+ "\n\tRun RX training sequence, the user must state CP index (0/1) and comphy ID (0/5)"
+);