summaryrefslogtreecommitdiff
path: root/firmware/target/arm/s5l8702/ipod6g/pmu-ipod6g.c
diff options
context:
space:
mode:
authorCástor Muñoz <cmvidal@gmail.com>2016-02-04 20:12:02 +0100
committerCástor Muñoz <cmvidal@gmail.com>2016-05-15 21:16:54 +0200
commit469d64539007584241ccd475e81038ea4166f17b (patch)
tree2de03ef2c45cfa845afd8015775d7457029404f7 /firmware/target/arm/s5l8702/ipod6g/pmu-ipod6g.c
parent44ce4eebd61302a22cbcc8fdaa0851adc103550f (diff)
downloadrockbox-469d64539007584241ccd475e81038ea4166f17b.tar.gz
rockbox-469d64539007584241ccd475e81038ea4166f17b.zip
iPod Classic: prepare i2c and PMU for bootloader
When the bootloader starts only IRAM is available, the first task is to ask the PMU to verify if the iPod has previously been hibernated by OF. Due to memory limitations, the kernel cannot be used on this stage. This patch modifies I2C and PMU low level functions to not to depend on kernel (removes mutexes, and uses HW timer instead of current_tick), actual kernel functions are modified to be 'mutexed' wrappers of the new functions. Change-Id: I7cef9e95dedaf176dc0659315f3dc33166d5b116
Diffstat (limited to 'firmware/target/arm/s5l8702/ipod6g/pmu-ipod6g.c')
-rw-r--r--firmware/target/arm/s5l8702/ipod6g/pmu-ipod6g.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/firmware/target/arm/s5l8702/ipod6g/pmu-ipod6g.c b/firmware/target/arm/s5l8702/ipod6g/pmu-ipod6g.c
index 946beb1519..2a9236046c 100644
--- a/firmware/target/arm/s5l8702/ipod6g/pmu-ipod6g.c
+++ b/firmware/target/arm/s5l8702/ipod6g/pmu-ipod6g.c
@@ -142,3 +142,27 @@ void pmu_write_rtc(unsigned char* buffer)
142{ 142{
143 pmu_write_multiple(0x59, 7, buffer); 143 pmu_write_multiple(0x59, 7, buffer);
144} 144}
145
146#ifdef BOOTLOADER
147int pmu_rd_multiple(int address, int count, unsigned char* buffer)
148{
149 return i2c_rd(0, 0xe6, address, count, buffer);
150}
151
152int pmu_wr_multiple(int address, int count, unsigned char* buffer)
153{
154 return i2c_wr(0, 0xe6, address, count, buffer);
155}
156
157unsigned char pmu_rd(int address)
158{
159 unsigned char val;
160 pmu_rd_multiple(address, 1, &val);
161 return val;
162}
163
164int pmu_wr(int address, unsigned char val)
165{
166 return pmu_wr_multiple(address, 1, &val);
167}
168#endif /* BOOTLOADER */