# HG changeset patch # User Michael Spacefalcon # Date 1375318669 0 # Node ID fcbe1332b197b9d95f4b78d06ee84906ad00d23b # Parent 07b686248ab7fd67cfc43eb05cb48638897225a7 pirexplore: LCD init and BL control work now diff -r 07b686248ab7 -r fcbe1332b197 target-utils/pirexplore/cmdtab.c --- a/target-utils/pirexplore/cmdtab.c Thu Aug 01 00:26:29 2013 +0000 +++ b/target-utils/pirexplore/cmdtab.c Thu Aug 01 00:57:49 2013 +0000 @@ -3,6 +3,7 @@ extern void cmd_baud_switch(); extern void cmd_dieid(); extern void cmd_jump(); +extern void cmd_lcdinit(); extern void cmd_r8(); extern void cmd_r16(); extern void cmd_r32(); @@ -18,6 +19,7 @@ {"baud", cmd_baud_switch}, {"dieid", cmd_dieid}, {"jump", cmd_jump}, + {"lcdinit", cmd_lcdinit}, {"r8", cmd_r8}, {"r16", cmd_r16}, {"r32", cmd_r32}, diff -r 07b686248ab7 -r fcbe1332b197 target-utils/pirexplore/lcd.c --- a/target-utils/pirexplore/lcd.c Thu Aug 01 00:26:29 2013 +0000 +++ b/target-utils/pirexplore/lcd.c Thu Aug 01 00:57:49 2013 +0000 @@ -57,3 +57,67 @@ fb_spca_write(0x19, 0x08); /* backlight: 0x08 is on, 0x0c is off */ fb_spca_write(0x23, 0x18); } + +enum s6b33b1x_cmdflag { CMD, DATA, END }; + +struct s6b33b1x_cmdlist { + enum s6b33b1x_cmdflag is_cmd:8; /* 1: is a command, 0: is data, 2: end marker! */ + u_char data; /* 8 bit to send to LC display */ +}; + +static const struct s6b33b1x_cmdlist +s6b33b1x_initdata[] = { + { CMD, 0x26 }, /* CMD DCDC and AMP ON/OFF set */ + { DATA, 0x00 }, /* DATA: everything off */ + { CMD, 0x02 }, /* CMD Oscillation Mode Set */ + { DATA, 0x00 }, /* DATA: oscillator off */ + { CMD, 0x2c }, /* CMD Standby Mode off */ + { CMD, 0x50 }, /* CMD Display off */ + { CMD, 0x02 }, /* CMD Oscillation Mode Set */ + { DATA, 0x01 }, /* DATA: oscillator on */ + { CMD, 0x26 }, /* CMD DCDC and AMP ON/OFF set */ + { DATA, 0x01 }, /* DATA: Booster 1 on */ + { CMD, 0x26 }, /* CMD DCDC and AMP ON/OFF set */ + { DATA, 0x09 }, /* DATA: Booster 1 on, OP-AMP on */ + { CMD, 0x26 }, /* CMD DCDC and AMP ON/OFF set */ + { DATA, 0x0b }, /* DATA: Booster 1 + 2 on, OP-AMP on */ + { CMD, 0x26 }, /* CMD DCDC and AMP ON/OFF set */ + { DATA, 0x0f }, /* DATA: Booster 1 + 2 + 3 on, OP-AMP on */ + { CMD, 0x20 }, /* CMD DC-DC Select */ + { DATA, 0x01 }, /* DATA: step up x1.5 */ + { CMD, 0x24 }, /* CMD DCDC Clock Division Set */ + { DATA, 0x0a }, /* DATA: fPCK = fOSC/6 */ + { CMD, 0x2a }, /* CMD Contrast Control */ + { DATA, 0x2d }, /* DATA: default contrast */ + { CMD, 0x30 }, /* CMD Adressing mode set */ + { DATA, 0x0b }, /* DATA: 65536 color mode */ + { CMD, 0x10 }, /* CMD Driver output mode set */ + { DATA, 0x03 }, /* DATA: Display duty: 1/132 */ + { CMD, 0x34 }, /* CMD N-line inversion set */ + { DATA, 0x88 }, /* DATA: inversion on, one frame, every 8 blocks */ + { CMD, 0x40 }, /* CMD Entry mode set */ + { DATA, 0x00 }, /* DATA: Y address counter mode */ + { CMD, 0x28 }, /* CMD Temperature Compensation set */ + { DATA, 0x01 }, /* DATA: slope -0.05%/degC */ + { CMD, 0x32 }, /* CMD ROW vector mode set */ + { DATA, 0x01 }, /* DATA: every 2 subgroup */ + { CMD, 0x51 }, /* CMD Display on */ + { END, 0x00 }, /* MARKER: end of list */ +}; + +static void +fb_s6b33b1x_send_cmdlist(p) + struct s6b33b1x_cmdlist *p; +{ + while(p->is_cmd != END) { + nCS4_ADDR0 = p->data; + p++; + } +} + +void +cmd_lcdinit() +{ + GPIO_OUT_REG |= 0x0080; + fb_s6b33b1x_send_cmdlist(s6b33b1x_initdata); +} diff -r 07b686248ab7 -r fcbe1332b197 target-utils/pirexplore/main.c --- a/target-utils/pirexplore/main.c Thu Aug 01 00:26:29 2013 +0000 +++ b/target-utils/pirexplore/main.c Thu Aug 01 00:57:49 2013 +0000 @@ -25,12 +25,15 @@ * Other register settings replicating what OsmocomBB does * in board/pirelli_dpl10/init.c */ - *(volatile u16 *)0xfffef008 = 0x7080; + *(volatile u16 *)0xfffef008 = 0x7090; *(volatile u16 *)0xfffef00a = 0x021F; *(volatile u16 *)0xfffe4804 = 0xFF6D; *(volatile u16 *)0xfffe4802 = 0x0000; /* nCS4 setup for SPCA552E */ *(volatile u16 *)0xfffffb0a = 0x00A7; + /* initialize PWL registers like OsmocomBB does */ + *(volatile u8 *)0xfffe8000 = 0x32; + *(volatile u8 *)0xfffe8001 = 0x01; for (;;) { putchar('='); if (command_entry())