/* Routine implementing u-boot chpart command. Sets new current partition based on the user supplied partition id. For partition id format see find_dev_and_part(). */
static int do_chpart(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
/* Routine implementing u-boot chpart command. Sets new current partition based on the user supplied partition id. For partition id format see find_dev_and_part(). */
static int do_chpart(cmd_tbl_t *cmdtp, int flag, int argc, char *const argv[])
{
	struct mtd_device *dev;
	struct part_info *part;
	u8 pnum;
	if (mtdparts_init() !=0)
		return 1;
	if (argc < 2) {
		printf("no partition id specified\n");
		return 1;
	}
	if (find_dev_and_part(argv[1], &dev, &pnum, &part) != 0)
		return 1;
	current_mtd_dev = dev;
	current_mtd_partnum = pnum;
	current_save();
	printf("partition changed to %s%d,%d\n",
			MTD_DEV_TYPE(dev->id->type), dev->id->num, pnum);
	return 0;
}