forked from len0rd/rockbox
Moved unrelated stuff from i2c the driver to appropriate places. Minor optimisation in i2c driver.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@6419 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
f34ce792ec
commit
c42a1a05bb
3 changed files with 19 additions and 17 deletions
|
@ -50,7 +50,7 @@
|
|||
#define SDA_HI or_b(0x80, &PBDRL)
|
||||
#define SDA_INPUT and_b(~0x80, &PBIORL)
|
||||
#define SDA_OUTPUT or_b(0x80, &PBIORL)
|
||||
#define SDA (PBDR & 0x80)
|
||||
#define SDA (PBDRL & 0x80)
|
||||
|
||||
#if CONFIG_I2C == I2C_ONDIO
|
||||
/* Ondio pinout, SCL moved to PB6 */
|
||||
|
@ -58,14 +58,14 @@
|
|||
#define SCL_OUTPUT or_b(0x40, &PBIORL)
|
||||
#define SCL_LO and_b(~0x40, &PBDRL)
|
||||
#define SCL_HI or_b(0x40, &PBDRL)
|
||||
#define SCL (PBDR & 0x0040)
|
||||
#define SCL (PBDRL & 0x40)
|
||||
#else
|
||||
/* "classic" pinout, SCL is PB13 */
|
||||
#define SCL_INPUT and_b(~0x20, &PBIORH)
|
||||
#define SCL_OUTPUT or_b(0x20, &PBIORH)
|
||||
#define SCL_LO and_b(~0x20, &PBDRH)
|
||||
#define SCL_HI or_b(0x20, &PBDRH)
|
||||
#define SCL (PBDR & 0x2000)
|
||||
#define SCL (PBDRH & 0x20)
|
||||
#endif
|
||||
#endif /* ! I2C_GMINI */
|
||||
|
||||
|
@ -109,22 +109,14 @@ void i2c_init(void)
|
|||
#if CONFIG_I2C == I2C_GMINI
|
||||
SCL_INPUT;
|
||||
SDA_INPUT;
|
||||
#else
|
||||
#if CONFIG_I2C == I2C_ONDIO
|
||||
/* make PB5, PB6 & PB7 general I/O */
|
||||
PBCR2 &= ~0xfc00; /* includes PB5, see FIXME below */
|
||||
#elif CONFIG_I2C == I2C_ONDIO
|
||||
/* make PB6 & PB7 general I/O */
|
||||
PBCR2 &= ~0xf000;
|
||||
#else /* not Gmini, not Ondio */
|
||||
/* make PB5, PB7 & PB13 general I/O */
|
||||
/* make PB7 & PB13 general I/O */
|
||||
PBCR1 &= ~0x0c00; /* PB13 */
|
||||
PBCR2 &= ~0xcc00; /* PB5 and PB7, see FIXME below */
|
||||
PBCR2 &= ~0xc000; /* PB7 */
|
||||
#endif
|
||||
|
||||
/* PB5 is "MAS enable" (no I2C signal!). make it output and high */
|
||||
/* FIXME: this is true only for Players, and should go into mas.c */
|
||||
/* for Recorders, it shuts off the charger, for FM/V2 it holds power */
|
||||
or_b(0x20, &PBIORL);
|
||||
or_b(0x20, &PBDRL);
|
||||
#endif /* end of non-Gmini */
|
||||
|
||||
SCL_OUTPUT;
|
||||
SDA_OUTPUT;
|
||||
|
|
|
@ -271,11 +271,15 @@ void mas_reset(void)
|
|||
or_b(0x01, &PAIORH);
|
||||
|
||||
#if CONFIG_HWCODEC == MAS3507D
|
||||
/* PB5 is "MAS enable". make it GPIO output and high */
|
||||
PBCR2 &= ~0x0c00;
|
||||
or_b(0x20, &PBIORL);
|
||||
or_b(0x20, &PBDRL);
|
||||
|
||||
and_b(~0x01, &PADRH);
|
||||
sleep(HZ/100);
|
||||
or_b(0x01, &PADRH);
|
||||
sleep(HZ/5);
|
||||
|
||||
#elif (CONFIG_HWCODEC == MAS3587F) || (CONFIG_HWCODEC == MAS3539F)
|
||||
if(old_recorder)
|
||||
{
|
||||
|
|
|
@ -74,7 +74,13 @@ void power_init(void)
|
|||
spdif_power_enable(false);
|
||||
#endif
|
||||
#else
|
||||
#ifdef HAVE_POWEROFF_ON_PB5
|
||||
PBCR2 &= ~0x0c00; /* GPIO for PB5 */
|
||||
or_b(0x20, &PBIORL);
|
||||
or_b(0x20, &PBDRL); /* hold power */
|
||||
#endif
|
||||
#ifdef HAVE_CHARGE_CTRL
|
||||
PBCR2 &= ~0x0c00; /* GPIO for PB5 */
|
||||
or_b(0x20, &PBIORL); /* Set charging control bit to output */
|
||||
charger_enable(false); /* Default to charger OFF */
|
||||
#endif
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue