]> git.ipfire.org Git - people/ms/u-boot.git/blame - common/cmd_softswitch.c
board: ti: beagle_x15: added USB initializtion code
[people/ms/u-boot.git] / common / cmd_softswitch.c
CommitLineData
7d861d95
BL
1/*
2 * cmd_softswitch.c - set the softswitch for bf60x
3 *
4 * Copyright (c) 2012 Analog Devices Inc.
5 *
6 * Licensed under the GPL-2 or later.
7 */
8
9#include <common.h>
10#include <command.h>
11#include <asm/blackfin.h>
12#include <asm/soft_switch.h>
13
14int do_softswitch(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
15{
16 int switchaddr, value, pin, port;
17
18 if (argc != 5)
19 return CMD_RET_USAGE;
20
21 if (strcmp(argv[2], "GPA") == 0)
22 port = IO_PORT_A;
23 else if (strcmp(argv[2], "GPB") == 0)
24 port = IO_PORT_B;
25 else
26 return CMD_RET_USAGE;
27
28 switchaddr = simple_strtoul(argv[1], NULL, 16);
29 pin = simple_strtoul(argv[3], NULL, 16);
30 value = simple_strtoul(argv[4], NULL, 16);
31
32 config_switch_bit(switchaddr, port, (1 << pin), IO_PORT_OUTPUT, value);
33
34 return 0;
35}
36
37U_BOOT_CMD(
38 softswitch_output, 5, 1, do_softswitch,
39 "switchaddr GPA/GPB pin_offset value",
40 ""
41);