ASR_BASE
Change-Id: Icf3719cc0afe3eeb3edc7fa80a2eb5199ca9dda1
diff --git a/marvell/uboot/common/cmd_lcd.c b/marvell/uboot/common/cmd_lcd.c
new file mode 100644
index 0000000..a522a6a
--- /dev/null
+++ b/marvell/uboot/common/cmd_lcd.c
@@ -0,0 +1,94 @@
+/*
+ * Copyright (C) 2015 Marvell International Ltd.
+ * All rights reserved.
+ *
+ * This file is subject to the terms and conditions of the GNU General Public
+ * License. See the file COPYING in the main directory of this archive for
+ * more details.
+ */
+#include <common.h>
+#include <command.h>
+#include <asm/arch/pxa1826fb.h>
+
+enum lcd_cmd {
+ LCD_WRITE,
+ LCD_READ,
+ LCD_ONOFF,
+ LCD_LOGO
+};
+
+static int lcd_io(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[])
+{
+ unsigned int data = 0;
+ unsigned int addr = 0;
+ unsigned int on = 0;
+ enum lcd_cmd sub_cmd;
+ const char *str_cmd;
+ int i = 0;
+
+ str_cmd = argv[1];
+ /* parse the operation */
+ switch (*str_cmd) {
+ case 'w':
+ sub_cmd = LCD_WRITE;
+ break;
+ case 'r':
+ sub_cmd = LCD_READ;
+ break;
+ case 'o':
+ sub_cmd = LCD_ONOFF;
+ break;
+ case 'l':
+ sub_cmd = LCD_LOGO;
+ break;
+ default:
+ return CMD_RET_USAGE;
+ }
+
+ if (sub_cmd == LCD_WRITE) {
+ printf("## LCD write to panel\n");
+ addr = simple_strtoul(argv[2], NULL, 32);
+ printf("cmd: 0x%08X\n", addr);
+ lcd_send_cmd(addr);
+ for (i = 3; i < argc; i++) {
+ data = simple_strtoul(argv[i], NULL, 32);
+ lcd_send_data(data);
+ printf("data: 0x%08X\n", data);
+ }
+ }
+
+ if (sub_cmd == LCD_READ) {
+ printf("## LCD read from panel\n");
+ addr = simple_strtoul(argv[2], NULL, 32);
+ data = (unsigned int)pxa1826fb_read((unsigned short)addr);
+ printf("cmd: 0x%08X\n", addr);
+ printf("data: 0x%08X\n", data);
+ }
+
+ if (sub_cmd == LCD_ONOFF) {
+ printf("## LCD panel on/off\n");
+ on = simple_strtoul(argv[2], NULL, 32);
+ lcd_panel_on(on);
+ }
+
+ if (sub_cmd == LCD_LOGO) {
+ printf("## LCD show logo\n");
+ lcd_show_logo();
+ }
+
+ return 0;
+}
+
+/***************************************************/
+
+U_BOOT_CMD(
+ lcd, CONFIG_SYS_MAXARGS, 1, lcd_io,
+ "pxa1826 lcd operation",
+ "[r/w] [command] [value]\n"
+ " - with <r/w> argument: read/write operation\n"
+ " - with <command> argument: specify the command value\n"
+ " - with <value> argument: specify the data to write to panel\n"
+ " [o] [on/off] turn on/off panel\n"
+ " on_off: 0 -- off 1 -- on\n"
+ " [l] -- display boot up logo\n"
+);