diff --git a/common/Makefile b/common/Makefile
index 3d62775..aa09f17 100644
--- a/common/Makefile
+++ b/common/Makefile
@@ -66,6 +66,7 @@ COBJS-$(CONFIG_SOURCE) += cmd_source.o
 COBJS-$(CONFIG_CMD_SOURCE) += cmd_source.o
 COBJS-$(CONFIG_CMD_BDI) += cmd_bdinfo.o
 COBJS-$(CONFIG_CMD_BEDBUG) += bedbug.o cmd_bedbug.o
+COBJS-${CONFIG_DM_BLOCK} += cmd_block.o
 COBJS-$(CONFIG_CMD_BMP) += cmd_bmp.o
 COBJS-$(CONFIG_CMD_BOOTLDR) += cmd_bootldr.o
 COBJS-$(CONFIG_CMD_CACHE) += cmd_cache.o
@@ -163,6 +164,7 @@ COBJS-$(CONFIG_CMD_XIMG) += cmd_ximg.o
 COBJS-$(CONFIG_YAFFS2) += cmd_yaffs2.o
 COBJS-$(CONFIG_CMD_SPL) += cmd_spl.o
 COBJS-$(CONFIG_CMD_ZFS) += cmd_zfs.o
+endif
 
 # others
 ifdef CONFIG_DDR_SPD
diff --git a/common/cmd_block.c b/common/cmd_block.c
new file mode 100644
index 0000000..d7674c3
--- /dev/null
+++ b/common/cmd_block.c
@@ -0,0 +1,139 @@
+/*
+ * (C) Copyright 2012
+ * Pavel Herrmann <morpheus.ibis@gmail.com>
+ *
+ * See file CREDITS for list of people who contributed to this
+ * project.
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; either version 2 of
+ * the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
+ * MA 02111-1307 USA
+ */
+
+#include <common.h>
+#include <command.h>
+#include <dm/blockdev.h>
+#include <dm/blockctrl.h>
+#include <dm/manager.h>
+
+/* based on common/cmd_sata.c */
+
+int do_block(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+	struct instance *dev;
+	struct option op;
+	int devcount;
+	int portcount;
+	int blocksize;
+	int error;
+
+	switch (argc) {
+	case 0:
+	case 1:
+	case 4:
+		return CMD_RET_USAGE;
+	case 2:
+		if (strncmp(argv[1], "init", 4) == 0) {
+			int i, j;
+			devcount = core_get_count(CORE_BLOCKCTRL);
+			for (i = 0; i < devcount; i++) {
+				dev = core_get_child(CORE_BLOCKCTRL, i);
+				portcount = blockctrl_get_port_count(dev);
+				for (j = 0; j < portcount; j++)
+					blockctrl_rescan_port(dev, j);
+			}
+			return 0;
+		} else if (strncmp(argv[1], "info", 4) == 0) {
+			putc('\n');
+			print_blockdev_info_all();
+			return 0;
+		}
+		return CMD_RET_USAGE;
+	case 3:
+		if (strncmp(argv[1], "info", 4) == 0) {
+			putc('\n');
+			dev = get_blockdev_by_name(argv[2]);
+			print_blockdev_info(dev);
+			return 0;
+		}
+		return CMD_RET_USAGE;
+	default: /* at least 5 args */
+		if (strncmp(argv[1], "read", 4) == 0) {
+			ulong addr = simple_strtoul(argv[3], NULL, 16);
+			ulong cnt = simple_strtoul(argv[5], NULL, 16);
+			ulong n;
+			lbaint_t blk = simple_strtoul(argv[4], NULL, 16);
+
+			dev = get_blockdev_by_name(argv[2]);
+			if (!dev) {
+				printf("\nNo such device found: %s\n", argv[2]);
+				return 0;
+			}
+
+			error = blockdev_get_option(dev, BLKD_OPT_BLOCKSIZE,
+					&op);
+			if (error || (OPTION_TYPE(op) != OPTION_TYPE_U)) {
+				printf("\nUnable to get blocksize from device "
+					"%s\n", argv[2]);
+				return 0;
+			}
+			blocksize = op.data.data_u;
+
+			printf("\nblock read: device %s block # %ld, "
+				"count %ld ... ", argv[2], blk, cnt);
+
+			n = blockdev_read(dev, blk, cnt, (u32 *)addr);
+
+			/* flush cache after read */
+			flush_cache(addr, cnt * blocksize);
+
+			printf("%ld blocks read: %s\n",
+				n, (n == cnt) ? "OK" : "ERROR");
+			return (n == cnt) ? 0 : 1;
+		} else if (strncmp(argv[1], "write", 5) == 0) {
+			ulong addr = simple_strtoul(argv[3], NULL, 16);
+			ulong cnt = simple_strtoul(argv[5], NULL, 16);
+			ulong n;
+			lbaint_t blk = simple_strtoul(argv[4], NULL, 16);
+
+			dev = get_blockdev_by_name(argv[2]);
+			if (!dev) {
+				printf("\nNo such device found: %s\n", argv[2]);
+				return 0;
+			}
+
+			printf("\nblock write: device %s block # %ld, "
+				"count %ld ... ", argv[2], blk, cnt);
+
+			n = blockdev_write(dev, blk, cnt, (u32 *)addr);
+
+			printf("%ld blocks written: %s\n",
+				n, (n == cnt) ? "OK" : "ERROR");
+			return (n == cnt) ? 0 : 1;
+		} else {
+			return CMD_RET_USAGE;
+		}
+
+		return 0;
+	}
+}
+
+U_BOOT_CMD(
+	block, 5, 1, do_block,
+	"block sub system",
+	"init\n"
+	"block info - show available block devices\n"
+	"block read devname addr blk# cnt\n"
+	"block write devname addr blk# cnt"
+);
