diff --git a/arch/arm/mach-msm/smd_tty.c b/arch/arm/mach-msm/smd_tty.c index f994dd96..639989d0 100644 --- a/arch/arm/mach-msm/smd_tty.c +++ b/arch/arm/mach-msm/smd_tty.c @@ -27,6 +27,7 @@ #include #include +#include "board-htcleo.h" #define MAX_SMD_TTYS 32 @@ -205,6 +206,13 @@ static int smd_tty_write(struct tty_struct *tty, struct smd_tty_info *info = tty->driver_data; int avail; int ret; +#ifdef CONFIG_MACH_HTCLEO + static int init=0; + const unsigned char* firstcall ="AT@BRIC=0\r"; + const unsigned char* secondcall="AT+CFUN=0\r"; + const unsigned char* thirdcall ="AT+COPS=2\r"; + unsigned int call_len; +#endif /* if we're writing to a packet channel we will ** never be able to write more data than there @@ -213,10 +221,37 @@ static int smd_tty_write(struct tty_struct *tty, #ifndef CONFIG_MACH_HTCLEO mutex_lock(&smd_tty_lock); #endif + +#ifdef CONFIG_MACH_HTCLEO + if(len>7 && !init && htcleo_is_nand_boot()) { + pr_info("NAND boot, writing additional init commands to /dev/smd0"); + + call_len = strlen(firstcall); + avail = smd_write_avail(info->ch); + if (call_len > avail) + call_len = avail; + ret = smd_write(info->ch, firstcall, call_len); + + call_len = strlen(secondcall); + avail = smd_write_avail(info->ch); + if (call_len > avail) + call_len = avail; + ret = smd_write(info->ch, secondcall, call_len); + + call_len = strlen(thirdcall); + avail = smd_write_avail(info->ch); + if (call_len > avail) + call_len = avail; + ret = smd_write(info->ch, thirdcall, call_len); + + init=1; + } avail = smd_write_avail(info->ch); if (len > avail) len = avail; ret = smd_write(info->ch, buf, len); +#endif + #ifndef CONFIG_MACH_HTCLEO mutex_unlock(&smd_tty_lock); #endif