Sansa Connect: Fix GIO initialization and screen wakeup.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31119 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Tomasz Moń 2011-12-03 15:03:44 +00:00
parent 488ee77ea2
commit 5e805f2041
4 changed files with 28 additions and 25 deletions

View file

@ -214,22 +214,6 @@ static void parse_button_state(unsigned char *buf)
#endif
}
/* HID Slave Select - GIO14 */
#define HID_SS (1<<14)
static inline void select_hid(bool on)
{
if (on == true)
{
/* SS is active low */
IO_GIO_BITCLR0 = HID_SS;
}
else
{
IO_GIO_BITSET0 = HID_SS;
}
}
static void spi_txrx(unsigned char *buf_tx, unsigned char *buf_rx, int n)
{
int i;
@ -239,7 +223,6 @@ static void spi_txrx(unsigned char *buf_tx, unsigned char *buf_rx, int n)
bitset16(&IO_CLK_MOD2, CLK_MOD2_SIF1);
IO_SERIAL1_TX_ENABLE = 0x0001;
select_hid(true);
for (i = 0; i<n; i++)
{
@ -254,10 +237,10 @@ static void spi_txrx(unsigned char *buf_tx, unsigned char *buf_rx, int n)
if (buf_rx != NULL)
buf_rx[i] = rxdata & 0xFF;
udelay(100);
/* seems to be unneccessary */
//udelay(100);
}
select_hid(false);
IO_SERIAL1_TX_ENABLE = 0;
bitclr16(&IO_CLK_MOD2, CLK_MOD2_SIF1);
@ -280,14 +263,16 @@ void avr_hid_init(void)
{
/*
setup alternate GIO functions:
GIO29 - SIF1 Enable
GIO29 - SIF1 Enable (Directly connected to AVR's SS)
GIO30 - SIF1 Clock
GIO31 - SIF1 Data In
GIO32 - SIF1 Data Out
*/
IO_GIO_FSEL2 = (IO_GIO_FSEL2 & 0x00FF) | 0xAA00;
bitclr16(&IO_GIO_DIR0, HID_SS); /* set GIO14 as output */
/* GIO29, GIO30 - outputs, GIO31 - input */
IO_GIO_DIR1 = (IO_GIO_DIR1 & ~((1 << 13) | (1 << 14))) | (1 << 15);
/* GIO32 - output */
bitclr16(&IO_GIO_DIR2, (1 << 0));
/* RATE = 219 (0xDB) -> 200 kHz */
IO_SERIAL1_MODE = 0x6DB;

View file

@ -53,6 +53,13 @@ static void _backlight_write_brightness(int brightness)
void _backlight_on(void)
{
#ifdef HAVE_LCD_SLEEP
if (!lcd_active())
{
lcd_awake();
lcd_update();
}
#endif
/* set GIO34 as PWM1 */
IO_GIO_FSEL3 = (IO_GIO_FSEL3 & 0xFFF3) | (1 << 2);

View file

@ -40,6 +40,14 @@ int usb_detect(void)
void usb_init_device(void)
{
/* set TNETV USB nreset high */
IO_GIO_DIR0 &= ~(1 << 7);
IO_GIO_BITSET0 = (1 << 7);
/* set VLYNQ port functions */
IO_GIO_FSEL1 = 0xAAAA;
IO_GIO_FSEL2 = (IO_GIO_FSEL2 & 0xFFF0) | 0xA;
return;
}

View file

@ -344,7 +344,10 @@ void system_init(void)
IO_TIMER2_TMMD = CONFIG_TIMER2_TMMD_STOP;
IO_TIMER3_TMMD = CONFIG_TIMER3_TMMD_STOP;
#ifndef SANSA_CONNECT
/* UART1 is not used on Sansa Connect - don't power it up */
uart_init();
#endif
spi_init();
#ifdef MROBE_500
@ -359,9 +362,9 @@ void system_init(void)
#endif
#ifdef SANSA_CONNECT
/* keep WIFI CS low to save power */
IO_GIO_DIR0 &= ~(1 << 4);
IO_GIO_BITCLR0 = (1 << 4);
/* keep WIFI CS and reset high to save power */
IO_GIO_DIR0 &= ~((1 << 4) /* CS */ | (1 << 3) /* reset */);
IO_GIO_BITSET0 = (1 << 4) | (1 << 3);
i2c_init();
avr_hid_init();