summaryrefslogtreecommitdiffstats
path: root/firmware/target/arm
diff options
context:
space:
mode:
authorAmaury Pouly <amaury.pouly@gmail.com>2012-03-15 14:59:20 +0100
committerAmaury Pouly <amaury.pouly@gmail.com>2012-03-15 15:01:11 +0100
commit9caffa8bf7a2f1fc06b70eb0015c4f089a1173af (patch)
treeca143d5b23770d923c407fadaf489e671832ff26 /firmware/target/arm
parenta4fd5bf7cb3d8d071c5fb9d45255c8f85e517b7a (diff)
downloadrockbox-9caffa8bf7a2f1fc06b70eb0015c4f089a1173af.tar.gz
rockbox-9caffa8bf7a2f1fc06b70eb0015c4f089a1173af.tar.bz2
rockbox-9caffa8bf7a2f1fc06b70eb0015c4f089a1173af.zip
imx233/fuze+: rework i2c and fmradio_i2c init
Only enable fmradio_i2c once with _init() called from system. Move actual i2c init to system for consistency. Move tuner power pin setup to power instead of fmradio. Change-Id: Idb56bfba5803f71b5d049f174c48d2afb969a6ea
Diffstat (limited to 'firmware/target/arm')
-rw-r--r--firmware/target/arm/imx233/i2c-imx233.c6
-rw-r--r--firmware/target/arm/imx233/i2c-imx233.h2
-rw-r--r--firmware/target/arm/imx233/power-imx233.c1
-rw-r--r--firmware/target/arm/imx233/sansa-fuzeplus/fmradio-i2c-fuzeplus.c10
-rw-r--r--firmware/target/arm/imx233/sansa-fuzeplus/power-fuzeplus.c2
-rw-r--r--firmware/target/arm/imx233/system-imx233.c5
6 files changed, 15 insertions, 11 deletions
diff --git a/firmware/target/arm/imx233/i2c-imx233.c b/firmware/target/arm/imx233/i2c-imx233.c
index d502d3b2b4..21b66bcde8 100644
--- a/firmware/target/arm/imx233/i2c-imx233.c
+++ b/firmware/target/arm/imx233/i2c-imx233.c
@@ -53,7 +53,7 @@ void INT_I2C_DMA(void)
semaphore_release(&i2c_sema);
}
-void i2c_init(void)
+void imx233_i2c_init(void)
{
imx233_reset_block(&HW_I2C_CTRL0);
/* setup pins (must be done when shutdown) */
@@ -147,6 +147,10 @@ enum imx233_i2c_error_t imx233_i2c_end(unsigned timeout)
return ret;
}
+void i2c_init(void)
+{
+}
+
int i2c_write(int device, const unsigned char* buf, int count)
{
uint8_t addr = device;
diff --git a/firmware/target/arm/imx233/i2c-imx233.h b/firmware/target/arm/imx233/i2c-imx233.h
index de90e168f2..5ee22efd2a 100644
--- a/firmware/target/arm/imx233/i2c-imx233.h
+++ b/firmware/target/arm/imx233/i2c-imx233.h
@@ -126,7 +126,7 @@ enum imx233_i2c_error_t
I2C_SLAVE_NAK = -5
};
-void i2c_init(void);
+void imx233_i2c_init(void);
/* start building a transfer, will acquire an exclusive lock */
void imx233_i2c_begin(void);
/* add stage */
diff --git a/firmware/target/arm/imx233/power-imx233.c b/firmware/target/arm/imx233/power-imx233.c
index 0b395b3246..2ae7ff653c 100644
--- a/firmware/target/arm/imx233/power-imx233.c
+++ b/firmware/target/arm/imx233/power-imx233.c
@@ -27,6 +27,7 @@
#include "system-target.h"
#include "power-imx233.h"
#include "pinctrl-imx233.h"
+#include "fmradio_i2c.h"
struct current_step_bit_t
{
diff --git a/firmware/target/arm/imx233/sansa-fuzeplus/fmradio-i2c-fuzeplus.c b/firmware/target/arm/imx233/sansa-fuzeplus/fmradio-i2c-fuzeplus.c
index d4113332ac..417f70e406 100644
--- a/firmware/target/arm/imx233/sansa-fuzeplus/fmradio-i2c-fuzeplus.c
+++ b/firmware/target/arm/imx233/sansa-fuzeplus/fmradio-i2c-fuzeplus.c
@@ -85,17 +85,11 @@ struct i2c_interface fmradio_i2c =
.delay_thigh = 4
};
-void fmradio_i2c_enable(bool enable)
+void fmradio_i2c_init(void)
{
- if(fmradio_i2c_bus == -1)
- fmradio_i2c_bus = i2c_add_node(&fmradio_i2c);
- imx233_set_pin_function(0, 29, PINCTRL_FUNCTION_GPIO);
imx233_set_pin_function(1, 24, PINCTRL_FUNCTION_GPIO);
imx233_set_pin_function(1, 22, PINCTRL_FUNCTION_GPIO);
- imx233_enable_gpio_output(1, 22, enable);
- imx233_enable_gpio_output(1, 24, enable);
- imx233_set_gpio_output(1, 22, enable);
- imx233_set_gpio_output(1, 24, enable);
+ fmradio_i2c_bus = i2c_add_node(&fmradio_i2c);
}
int fmradio_i2c_write(unsigned char address, const unsigned char* buf, int count)
diff --git a/firmware/target/arm/imx233/sansa-fuzeplus/power-fuzeplus.c b/firmware/target/arm/imx233/sansa-fuzeplus/power-fuzeplus.c
index 63ca90d47f..71c45b0676 100644
--- a/firmware/target/arm/imx233/sansa-fuzeplus/power-fuzeplus.c
+++ b/firmware/target/arm/imx233/sansa-fuzeplus/power-fuzeplus.c
@@ -32,8 +32,8 @@ bool tuner_power(bool enable)
{
if(enable != tuner_enable)
{
- fmradio_i2c_enable(enable);
/* CE is B029 (active high) */
+ imx233_set_pin_function(0, 29, PINCTRL_FUNCTION_GPIO);
imx233_set_pin_drive_strength(0, 29, PINCTRL_DRIVE_4mA);
imx233_enable_gpio_output(0, 29, enable);
imx233_set_gpio_output(0, 29, enable);
diff --git a/firmware/target/arm/imx233/system-imx233.c b/firmware/target/arm/imx233/system-imx233.c
index 36b67674c2..63bd91998d 100644
--- a/firmware/target/arm/imx233/system-imx233.c
+++ b/firmware/target/arm/imx233/system-imx233.c
@@ -34,6 +34,7 @@
#include "lcd.h"
#include "backlight-target.h"
#include "button.h"
+#include "fmradio_i2c.h"
#define default_interrupt(name) \
extern __attribute__((weak, alias("UIRQ"))) void name(void)
@@ -213,6 +214,10 @@ void system_init(void)
imx233_dma_init();
imx233_ssp_init();
imx233_dcp_init();
+ imx233_i2c_init();
+#if defined(SANSA_FUZEPLUS) && !defined(BOOTLOADER)
+ fmradio_i2c_init();
+#endif
}
bool imx233_us_elapsed(uint32_t ref, unsigned us_delay)