Beispiel #1
0
static int do_clko(struct command *cmdtp, int argc, char *argv[])
{
	int opt, div = 0, src = -2, ret;

	while((opt = getopt(argc, argv, "d:s:")) > 0) {
		switch(opt) {
		case 'd':
			div = simple_strtoul(optarg, NULL, 0);
			break;
		case 's':
			src = simple_strtoul(optarg, NULL, 0);
			break;
		}
	}

	if (div == 0 && src == -2)
		return COMMAND_ERROR_USAGE;

	if (src == -1) {
		imx_clko_set_src(-1);
		return 0;
	}

	if (src != -2)
		imx_clko_set_src(src);

	if (div != 0) {
		ret = imx_clko_set_div(div);
		if (ret != div)
			printf("limited divider to %d\n", ret);
	}

	return 0;
}
Beispiel #2
0
static int do_clko(int argc, char *argv[])
{
	int opt, div = 0, src = -2, num = 1, ret;

	while((opt = getopt(argc, argv, "n:d:s:")) > 0) {
		switch(opt) {
		case 'n':
			num = simple_strtoul(optarg, NULL, 0);
			break;
		case 'd':
			div = simple_strtoul(optarg, NULL, 0);
			break;
		case 's':
			src = simple_strtol(optarg, NULL, 0);
			break;
		}
	}

	if (div == 0 && src == -2)
		return COMMAND_ERROR_USAGE;

	if (src == -1) {
		imx_clko_set_src(num, -1);
		return 0;
	}

	if (src != -2)
		imx_clko_set_src(num, src);

	if (div != 0) {
		ret = imx_clko_set_div(num, div);
		if (ret < 0)
			printf("CLKO-line %i not supported.\n", num);
		else if (ret != div)
			printf("Divider limited to %d.\n", ret);
	}

	return 0;
}