diff --git a/tools/bccmd.c b/tools/bccmd.c
old mode 100644
new mode 100755
index 6bc28da..1605d1c
--- a/tools/bccmd.c
+++ b/tools/bccmd.c
@@ -636,6 +636,78 @@ static int opt_pskey(int argc, char *argv[], uint16_t *stores, int *reset, int *
 	return optind;
 }
 
+int inline serialize_u32(uint8_t *array, uint32_t val32)
+{
+	if (NULL == array)
+		return -1;
+
+	array[0] = (val32 & 0xff0000) >> 16;
+	array[1] = val32 >> 24;
+	array[2] = val32 & 0xff;
+	array[3] = (val32 & 0xff00) >> 8;
+
+	return 0;
+}
+
+int inline deserialize_u32(uint8_t *array, uint32_t *pval32)
+{
+	if (NULL == array || NULL == pval32)
+		return -1;
+
+	*pval32 = (array[1]<<24)
+				| (array[0]<<16)
+				| (array[3]<<8)
+				| array[2];
+	return 0;
+}
+
+static int setpio32(int transport, uint32_t varID, uint32_t mask, uint32_t bits)
+{
+	uint8_t array[32];
+	uint8_t *ptr = NULL;
+	uint32_t result = 0;
+	int err;
+
+	memset(array, 0, sizeof(array));
+	ptr = array;
+
+	serialize_u32(ptr, mask);
+	ptr += 4;
+
+	serialize_u32(ptr, bits);
+
+	err = transport_write(transport, varID, array, 12);
+	if (err < 0)
+		return err;
+
+	deserialize_u32(&array[8], &result);
+	printf("result: 0x%x\n", result);
+
+	return 0;
+
+}
+
+
+static int cmd_pio32set(int transport, int argc, char *argv[])
+{
+	uint32_t varID;
+	uint32_t mask;
+	uint32_t bits;
+
+	argc--;
+	argv++;
+
+	if (3 != argc)
+		return -1;
+
+	varID = strtol(argv[0] + 2, NULL, 16);
+	mask = strtol(argv[1] + 2, NULL, 16);
+	bits = strtol(argv[2] + 2, NULL, 16);
+
+	return setpio32(transport, varID, mask, bits);
+}
+
+
 #define OPT_PSKEY(min, max, stores, reset, help) \
 		opt_pskey(argc, argv, (stores), (reset), (help)); \
 		argc -= optind; argv += optind; optind = 0; \
@@ -1112,6 +1184,7 @@ static struct {
 	{ "psread",    cmd_psread,    NULL,                  "Read all PS keys"               },
 	{ "psload",    cmd_psload,    "<file>",              "Load all PS keys from PSR file" },
 	{ "pscheck",   cmd_pscheck,   "<file>",              "Check PSR file"                 },
+	{ "pio32set",  cmd_pio32set,  "<VarID> <mask> <bits>","Set value for PIO32 register"   },
 	{ "adc",       cmd_adc,       "<mux>",               "Read ADC value of <mux> input"  },
 	{ NULL }
 };
