summaryrefslogtreecommitdiffstats
path: root/firmware
diff options
context:
space:
mode:
authorMarcin Bukat <marcin.bukat@gmail.com>2010-04-26 21:40:00 +0000
committerMarcin Bukat <marcin.bukat@gmail.com>2010-04-26 21:40:00 +0000
commitb09d3aec392538ca0934644ff6357c41aaa4c323 (patch)
tree0603cf4ef59e84ee4e0c172e3b418d8dccac664c /firmware
parentfa5cd0d3bf744f75be0593a7e2c2083810f16c21 (diff)
downloadrockbox-b09d3aec392538ca0934644ff6357c41aaa4c323.tar.gz
rockbox-b09d3aec392538ca0934644ff6357c41aaa4c323.tar.bz2
rockbox-b09d3aec392538ca0934644ff6357c41aaa4c323.zip
Add MPIO HD200 port - changed files
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25724 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware')
-rw-r--r--firmware/SOURCES24
-rw-r--r--firmware/drivers/audio/wm8751.c25
-rw-r--r--firmware/export/audiohw.h2
-rw-r--r--firmware/export/config.h3
-rw-r--r--firmware/export/wm8751.h9
-rw-r--r--firmware/sound.c11
-rw-r--r--firmware/target/coldfire/crt0.S19
-rw-r--r--firmware/target/coldfire/i2c-coldfire.c4
-rw-r--r--firmware/target/coldfire/pcm-coldfire.c30
-rw-r--r--firmware/target/coldfire/system-coldfire.c5
10 files changed, 122 insertions, 10 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES
index b13f6a0df8..48360d7b45 100644
--- a/firmware/SOURCES
+++ b/firmware/SOURCES
@@ -258,7 +258,8 @@ drivers/mas.c
#if !defined(SIMULATOR) && !defined(BOOTLOADER)
#if defined(HAVE_UDA1380)
drivers/audio/uda1380.c
-#elif defined(HAVE_WM8751)
+#elif defined(HAVE_WM8751) \
+ || defined(HAVE_WM8750)
drivers/audio/wm8751.c
#elif defined(HAVE_WM8978)
drivers/audio/wm8978.c
@@ -1609,3 +1610,24 @@ target/arm/usb-fw-pp502x.c
#endif /* SIMULATOR */
#endif
+#ifdef MPIO_HD200
+#ifndef SIMULATOR
+/* TODO: currently including all files */
+target/coldfire/mpio/hd200/adc-hd200.c
+target/coldfire/mpio/hd200/button-hd200.c
+target/coldfire/mpio/hd200/lcd-hd200.c
+target/coldfire/mpio/hd200/lcd-as-hd200.S
+target/coldfire/mpio/hd200/power-hd200.c
+target/coldfire/mpio/hd200/powermgmt-hd200.c
+target/coldfire/mpio/hd200/backlight-hd200.c
+target/coldfire/mpio/hd200/system-hd200.c
+target/coldfire/mpio/hd200/usb-hd200.c
+target/coldfire/mpio/fmradio_i2c-mpio.c
+target/coldfire/mpio/ata-mpio.c
+target/coldfire/mpio/ata-as-mpio.S
+#ifndef BOOTLOADER
+target/coldfire/mpio/audio-mpio.c
+target/coldfire/wmcodec-coldfire.c
+#endif /* BOOTLOADER */
+#endif /* SIMULATOR */
+#endif
diff --git a/firmware/drivers/audio/wm8751.c b/firmware/drivers/audio/wm8751.c
index b42c4b1041..cdc64fd69b 100644
--- a/firmware/drivers/audio/wm8751.c
+++ b/firmware/drivers/audio/wm8751.c
@@ -116,17 +116,22 @@ void audiohw_preinit(void)
* and Headphone outputs are all OFF (DACMU = 1 Power
* Management registers 1 and 2 are all zeros).
*/
+
wmcodec_write(RESET, RESET_RESET); /*Reset*/
/* 2. Enable Vmid and VREF. */
wmcodec_write(PWRMGMT1, PWRMGMT1_VREF | PWRMGMT1_VMIDSEL_5K);
+#ifdef CODEC_SLAVE
+ wmcodec_write(AINTFCE,AINTFCE_WL_16|AINTFCE_FORMAT_I2S);
+#else
/* BCLKINV=0(Dont invert BCLK) MS=1(Enable Master) LRSWAP=0 LRP=0 */
/* IWL=00(16 bit) FORMAT=10(I2S format) */
wmcodec_write(AINTFCE, AINTFCE_MS | AINTFCE_WL_16 |
AINTFCE_FORMAT_I2S);
-
+#endif
/* Set default samplerate */
+
audiohw_set_frequency(HW_FREQ_DEFAULT);
}
@@ -140,7 +145,7 @@ void audiohw_postinit(void)
wmcodec_write(PWRMGMT2, PWRMGMT2_DACL | PWRMGMT2_DACR);
/* 4. Enable line and / or headphone output buffers as required. */
-#ifdef MROBE_100
+#if defined(MROBE_100) || defined(MPIO_HD200)
wmcodec_write(PWRMGMT2, PWRMGMT2_DACL | PWRMGMT2_DACR |
PWRMGMT2_LOUT1 | PWRMGMT2_ROUT1);
#else
@@ -166,6 +171,19 @@ void audiohw_postinit(void)
#endif
#endif
+#ifdef MPIO_HD200
+ /* Crude fix for high pitch noise at startup
+ * I should find out what realy causes this
+ */
+ wmcodec_write(LOUT1, LOUT1_BITS|0x7f);
+ wmcodec_write(ROUT1, ROUT1_BITS|0x7f);
+ wmcodec_write(LOUT1, LOUT1_BITS);
+ wmcodec_write(ROUT1, ROUT1_BITS);
+#endif
+
+ /* lower power consumption */
+ wmcodec_write(PWRMGMT1, PWRMGMT1_VREF | PWRMGMT1_VMIDSEL_50K);
+
audiohw_mute(false);
#ifdef MROBE_100
@@ -234,6 +252,8 @@ void audiohw_close(void)
void audiohw_set_frequency(int fsel)
{
+ (void)fsel;
+#ifndef CODEC_SLAVE
static const unsigned char srctrl_table[HW_NUM_FREQ] =
{
HW_HAVE_11_([HW_FREQ_11] = CODEC_SRCTRL_11025HZ,)
@@ -246,4 +266,5 @@ void audiohw_set_frequency(int fsel)
fsel = HW_FREQ_DEFAULT;
wmcodec_write(CLOCKING, srctrl_table[fsel]);
+#endif
}
diff --git a/firmware/export/audiohw.h b/firmware/export/audiohw.h
index 781bc12f8e..c00b673a4a 100644
--- a/firmware/export/audiohw.h
+++ b/firmware/export/audiohw.h
@@ -38,7 +38,7 @@
#include "uda1380.h"
#elif defined(HAVE_UDA1341)
#include "uda1341.h"
-#elif defined(HAVE_WM8751)
+#elif defined(HAVE_WM8750) || defined(HAVE_WM8751)
#include "wm8751.h"
#elif defined(HAVE_WM8978)
#include "wm8978.h"
diff --git a/firmware/export/config.h b/firmware/export/config.h
index fb9381e7da..906a3fef1a 100644
--- a/firmware/export/config.h
+++ b/firmware/export/config.h
@@ -117,6 +117,7 @@
#define MINI2440_PAD 41
#define PHILIPS_HDD6330_PAD 42
#define PBELL_VIBE500_PAD 43
+#define MPIO_HD200_PAD 44
/* CONFIG_REMOTE_KEYPAD */
#define H100_REMOTE 1
@@ -412,6 +413,8 @@ Lyre prototype 1 */
#include "config/samsungyps3.h"
#elif defined(PBELL_VIBE500)
#include "config/vibe500.h"
+#elif defined(MPIO_HD200)
+#include "config/mpiohd200.h"
#else
/* no known platform */
#endif
diff --git a/firmware/export/wm8751.h b/firmware/export/wm8751.h
index 15170b76bc..c171642853 100644
--- a/firmware/export/wm8751.h
+++ b/firmware/export/wm8751.h
@@ -98,6 +98,15 @@ extern void audiohw_set_lineout_vol(int vol_l, int vol_r);
#define RESET 0x0f
#define RESET_RESET 0x000
+/* WM8750 only */
+#define ENHANCE_3D 0x10
+#define ENHANCE_3D_3DEN (1 << 0)
+#define ENHANCE_3D_DEPTH(x) (((x) & 0xf) << 1)
+#define ENHANCE_3D_3DLC (1 << 5)
+#define ENHANCE_3D_3DUC (1 << 6)
+#define ENHANCE_3D_MODE3D_PLAYBACK (1 << 7)
+#define ENHANCE_3D_MODE3D_RECORD (0 << 7)
+
#define ADDITIONAL1 0x17
#define ADDITIONAL1_TOEN (1 << 0)
#define ADDITIONAL1_DACINV (1 << 1)
diff --git a/firmware/sound.c b/firmware/sound.c
index d64dfcfdb9..4f95b6ed50 100644
--- a/firmware/sound.c
+++ b/firmware/sound.c
@@ -235,11 +235,12 @@ static void set_prescaled_volume(void)
dac_volume(tenthdb2reg(l), tenthdb2reg(r), false);
#elif defined(HAVE_UDA1380) || defined(HAVE_WM8975) || defined(HAVE_WM8758) \
|| defined(HAVE_WM8711) || defined(HAVE_WM8721) || defined(HAVE_WM8731) \
- || defined(HAVE_WM8751) || defined(HAVE_AS3514) || defined(HAVE_TSC2100) \
- || defined(HAVE_AK4537) || defined(HAVE_UDA1341)
+ || defined(HAVE_WM8750) || defined(HAVE_WM8751) || defined(HAVE_AS3514) \
+ || defined(HAVE_TSC2100) || defined(HAVE_AK4537) || defined(HAVE_UDA1341)
audiohw_set_master_vol(tenthdb2master(l), tenthdb2master(r));
#if defined(HAVE_WM8975) || defined(HAVE_WM8758) \
- || (defined(HAVE_WM8751) && !defined(MROBE_100)) || defined(HAVE_WM8985)
+ || defined(HAVE_WM8750) || (defined(HAVE_WM8751) && !defined(MROBE_100)) \
+ || defined(HAVE_WM8985)
audiohw_set_lineout_vol(tenthdb2master(0), tenthdb2master(0));
#endif
@@ -295,7 +296,7 @@ void sound_set_bass(int value)
return;
#if !defined(AUDIOHW_HAVE_CLIPPING)
-#if defined(HAVE_WM8751)
+#if defined(HAVE_WM8750) || defined(HAVE_WM8751)
current_bass = value;
#else
current_bass = value * 10;
@@ -319,7 +320,7 @@ void sound_set_treble(int value)
return;
#if !defined(AUDIOHW_HAVE_CLIPPING)
-#if defined(HAVE_WM8751)
+#if defined(HAVE_WM8750) || defined(HAVE_WM8751)
current_treble = value;
#else
current_treble = value * 10;
diff --git a/firmware/target/coldfire/crt0.S b/firmware/target/coldfire/crt0.S
index bc8a370823..38365c7d71 100644
--- a/firmware/target/coldfire/crt0.S
+++ b/firmware/target/coldfire/crt0.S
@@ -63,7 +63,16 @@ start:
move.l #0x00000180,%d0 /* CSCR0 - no wait states, 16 bits, no bursts */
move.l %d0,(0x088,%a0)
-#ifndef IAUDIO_M3
+#ifdef MPIO_HD200
+ /* Chip select 3 - LCD controller */
+ /* values taken from original firmware except base address*/
+ move.l #0xf0000000,%d0 /* CSAR3 - Base = 0xf0000000 */
+ move.l %d0,(0x0a4,%a0)
+ moveq.l #0x1,%d0 /* CSMR3 - 64K */
+ move.l %d0,(0x0a8,%a0)
+ move.l #0x00000980,%d0 /* CSCR3 - 1 wait state, 16 bits no bursts */
+ move.l %d0,(0x0ac,%a0)
+#elif !(defined IAUDIO_M3)
/* Chip select 1 - LCD controller */
move.l #0xf0000000,%d0 /* CSAR1 - Base = 0xf0000000 */
move.l %d0,(0x08c,%a0)
@@ -267,6 +276,14 @@ start:
or.l %d0,(0xbc,%a1)
#endif
+#ifdef MPIO_HD200
+ /* Set KEEP_ACT */
+ move.l #0x02200000,%d0
+ or.l %d0,(0xb4,%a1)
+ or.l %d0,(0xb8,%a1)
+ or.l %d0,(0xbc,%a1)
+#endif
+
/* zero out bss */
lea _edata,%a2
lea _end,%a4
diff --git a/firmware/target/coldfire/i2c-coldfire.c b/firmware/target/coldfire/i2c-coldfire.c
index ebfe0a006e..ab3018d713 100644
--- a/firmware/target/coldfire/i2c-coldfire.c
+++ b/firmware/target/coldfire/i2c-coldfire.c
@@ -70,6 +70,10 @@ void i2c_init(void)
#elif defined(IRIVER_H100_SERIES) || defined(IRIVER_H300_SERIES)
MBDR = 0; /* iRiver firmware does this */
MBCR = IEN; /* Enable interface */
+#elif defined(MPIO_HD200)
+ /* second channel */
+ MFDR2 = 0x0d;
+ MBCR2 = IEN;
#endif
}
diff --git a/firmware/target/coldfire/pcm-coldfire.c b/firmware/target/coldfire/pcm-coldfire.c
index 0782b116b4..209d227187 100644
--- a/firmware/target/coldfire/pcm-coldfire.c
+++ b/firmware/target/coldfire/pcm-coldfire.c
@@ -55,6 +55,24 @@
#define FPARM_CLOCKSEL 0
#define FPARM_CLSEL 1
+
+/* SCLK = Fs * bit clocks per word
+ * so SCLK should be Fs * 64
+ *
+ * CLOCKSEL sets SCLK freq based on Audio CLK
+ * 0x0c SCLK = Audio CLK/2 88200 * 64 = 5644800 Hz
+ * 0x06 SCLK = Audio CLK/4 44100 * 64 = 2822400 Hz
+ * 0x04 SCLK = Audio CLK/8 22050 * 64 = 1411200 Hz
+ * 0x02 SCLK = Audio CLK/16 11025 * 64 = 705600 Hz
+ *
+ * CLSEL sets MCLK1/2 DAC freq based on XTAL freq
+ * 0x01 MCLK1/2 = XTAL freq
+ * 0x02 MCLK1/2 = XTAL/2 freq
+ *
+ * Audio CLK can be XTAL freq or XTAL/2 freq (bit22 in PLLCR)
+ * we always set bit22 so Audio CLK is always XTAL freq
+ */
+
#if CONFIG_CPU == MCF5249 && defined(HAVE_UDA1380)
static const unsigned char pcm_freq_parms[HW_NUM_FREQ][2] =
{
@@ -65,6 +83,16 @@ static const unsigned char pcm_freq_parms[HW_NUM_FREQ][2] =
};
#endif
+#if CONFIG_CPU == MCF5249 && defined(HAVE_WM8750)
+static const unsigned char pcm_freq_parms[HW_NUM_FREQ][2] =
+{
+ [HW_FREQ_88] = { 0x0c, 0x01 },
+ [HW_FREQ_44] = { 0x06, 0x01 },
+ [HW_FREQ_22] = { 0x04, 0x01 },
+ [HW_FREQ_11] = { 0x02, 0x01 },
+};
+#endif
+
#if (CONFIG_CPU == MCF5250 || CONFIG_CPU == MCF5249) && defined(HAVE_TLV320)
static const unsigned char pcm_freq_parms[HW_NUM_FREQ][2] =
{
@@ -324,6 +352,7 @@ const void * pcm_play_dma_get_peak_buffer(int *count)
return (void *)((addr + 2) & ~3);
} /* pcm_play_dma_get_peak_buffer */
+#ifdef HAVE_RECORDING
/****************************************************************************
** Recording DMA transfer
**/
@@ -487,3 +516,4 @@ const void * pcm_rec_dma_get_peak_buffer(int *count)
*count = (end >> 2) - addr;
return (void *)(addr << 2);
} /* pcm_rec_dma_get_peak_buffer */
+#endif
diff --git a/firmware/target/coldfire/system-coldfire.c b/firmware/target/coldfire/system-coldfire.c
index a387824526..ba67daa3a6 100644
--- a/firmware/target/coldfire/system-coldfire.c
+++ b/firmware/target/coldfire/system-coldfire.c
@@ -152,6 +152,11 @@ default_interrupt (ADC); /* A/D converter */
#define EXCP_BUTTON_MASK 0x00000202
#define EXCP_BUTTON_VALUE 0x00000200 /* On button and !hold */
#define EXCP_PLLCR 0x10800000
+#elif defined(MPIO_HD200)
+#define EXCP_BUTTON_GPIO_READ GPIO1_READ
+#define EXCP_BUTTON_MASK 0x01000010
+#define EXCP_BUTTON_VALUE 0x01000000 /* Play button and !hold */
+#define EXCP_PLLCR 0x10800000
#else
#define EXCP_BUTTON_GPIO_READ GPIO1_READ
#define EXCP_BUTTON_MASK 0x00000022