]> Git Repo - J-u-boot.git/blame - cmd/mvebu/comphy_rx_training.c
global: Convert simple_strtoul() with hex to hextoul()
[J-u-boot.git] / cmd / mvebu / comphy_rx_training.c
CommitLineData
e49cdbe1
IL
1// SPDX-License-Identifier: GPL-2.0
2/*
3 * Copyright (C) 2017 Marvell International Ltd.
4 *
5 * SPDX-License-Identifier: GPL-2.0
6 */
7
8#include <common.h>
9#include <command.h>
10#include <console.h>
11#include <dm.h>
12#include <fdtdec.h>
13#include <dm/device-internal.h>
14#include <mvebu/comphy.h>
15
961ab07d
SR
16int mvebu_comphy_rx_training_cmd(struct cmd_tbl *cmdtp, int flag, int argc,
17 char * const argv[])
e49cdbe1
IL
18{
19 struct udevice *dev;
20 struct uclass *uc;
21 int ret, cp_index, comphy_index, i = 0;
22
23 if (argc != 3) {
24 printf("missing arguments\n");
25 return -1;
26 }
27
7e5f460e
SG
28 cp_index = hextoul(argv[1], NULL);
29 comphy_index = hextoul(argv[2], NULL);
e49cdbe1
IL
30
31 ret = uclass_get(UCLASS_MISC, &uc);
32 if (ret) {
33 printf("Couldn't find UCLASS_MISC\n");
34 return ret;
35 }
36
37 uclass_foreach_dev(dev, uc) {
38 if (!(memcmp(dev->name, "comphy", 5))) {
39 if (i == cp_index) {
40 comphy_rx_training(dev, comphy_index);
41 return 0;
42 }
43
44 i++;
45 }
46 }
47
48 printf("Coudn't find comphy %d\n", cp_index);
49
50 return 0;
51}
52
53U_BOOT_CMD(
961ab07d
SR
54 mvebu_comphy_rx_training, 3, 0, mvebu_comphy_rx_training_cmd,
55 "mvebu_comphy_rx_training <cp id> <comphy id>\n",
56 "\n\tRun COMPHY RX training sequence, the user must state CP index (0/1) and comphy ID (0/5)"
e49cdbe1 57);
This page took 0.036869 seconds and 4 git commands to generate.