Commit graph

34 commits

Author SHA1 Message Date
Amaury Pouly
5d2d747247 imx233: update comment about vbusvalid
Change-Id: Ice1ece716657fa7f78f69736e5e733e1b7f67b59
2017-08-27 17:48:39 +02:00
Amaury Pouly
70b4d1a9a6 imx233: fix horrible bug in linreg offset calculation
This was actually harmless because it was only used for the debug screen.

Change-Id: I76e802c947fdefa8df498ecfeb53e4b6ce0e12bb
2017-07-31 01:04:24 +02:00
Amaury Pouly
1c97083ca7 imx233: refactor power off and reboot
There is no reason to use different code paths

Change-Id: I4894c7963c802b56b5d3576909e1008a7c401935
2016-12-12 12:06:42 +01:00
Amaury Pouly
9a6700d52e imx233: fix power off code
There are two very suspicious things in the power off code:
- it does not properly unlock the power register, so it should fail (!)
- it does not disable sw/hw watchdog so if register fails, the device will
  most probably crash horribly because of the watchdog
I don't even understand how it worked before.

Change-Id: I9f3f94bd012e52c3b50cd5b658d68b5eb907f79b
2016-06-08 21:53:36 +02:00
Amaury Pouly
eac1ca22bd imx233: generate register headers using headergen_v2 and update code for it
NOTE: this commit does not introduce any change, ideally even the binary should
be almost the same. I checked the disassembly by hand and there are only a few
differences here and there, mostly the compiler decides to compile very close
expressions slightly differently. I tried to run the new code on several targets
to make sure and saw no difference.

The major syntax changes of the new headers are as follows:
- BF_{WR,SET,CLR} are now superpowerful and allows to set several fileds at once:
  BF_WR(reg, field1(value1), field2(value2), ...)
- BF_CS (use like BF_WR) does a write to reg_CLR and then reg_SET instead of RMW
- there is no more need for macros like BF_{WR_,SET,CLR}_V, since one can simply
  BF_WR with field_V(name)
- the old BF_SETV macro has no trivial equivalent and is replaced with its
  its equivalent for BF_WR(reg_SET, ...)

I also rename the register headers: "regs/regs-x.h" -> "regs/x.h" to avoid the
redundant "regs".

Final note: the registers were generated using the following command:
./headergen_v2 -g imx -o ../../firmware/target/arm/imx233/regs/ desc/regs-stmp3{600,700,780}.xml

Change-Id: I7485e8b4315a0929a8edb63e7fa1edcaa54b1edc
2016-05-28 16:49:22 +02:00
Amaury Pouly
9fe3687923 imx233: fix regulator code on stmp3700
For some reason the power subsystem needs to know the relationship between
the VDD{D,A,IO} and uses a weird register to do so.

Change-Id: I7fcc75f6cc0460b4997914986deda7ca544a4940
2014-03-08 18:51:54 +01:00
Amaury Pouly
68163e8f49 imx233: don"t be smart when waiting for voltage stabilisation
Unfortunately the hardware is not very helpful when changing voltage: in DCDC
mode we have the DC_OK_IRQ but in linear regulator mode, the only available
bit doesn't work when lowering the voltages. At the moment, simply sleep for a
little while before a better solution is found.

Change-Id: I89335873e9e42e5c6e9131f40db7839b008c021c
2014-02-10 23:14:27 +01:00
Lorenzo Miori
1deab73980 Initial commit for the YP-Z5 port
The port uses the imx233 soc, it's a STMP3650 based Samsung player

Change-Id: I50b6d7e77fd292fab5ed26de87853cd5aaf9eaa4
Reviewed-on: http://gerrit.rockbox.org/490
Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
2013-12-02 20:48:21 +01:00
Amaury Pouly
977a6c3ce7 Initial commit for the Creative ZEN V
Change-Id: I3408cfdf742ea5995d5c87bf76653f436e1ec2b0
2013-11-18 21:44:06 +00:00
Amaury Pouly
78c060b09c imx233: rework vdd5v shared irq handling
The previous code disabled the irq when there were fired. This seems
unreliable for some mysterious reason. Instead simply disable them
before enabling the irq.

Change-Id: I7ee1aa25dbc41c7dd53aa7c7744aa5e4d70ff2d8
Reviewed-on: http://gerrit.rockbox.org/640
Reviewed-by: benjamin brown <foolshperson@gmail.com>
Tested-by: benjamin brown <foolshperson@gmail.com>
Reviewed-by: Amaury Pouly <amaury.pouly@gmail.com>
2013-10-23 13:33:02 +02:00
Amaury Pouly
71c5a52add imx233: fix power irq storm
When bootloader is too intelligent, like on Creative devices, it might leave
some unexpected IRQs sources on, this is problematic when those sources share
the same IRQ line.

Change-Id: Ie9333918eb1048b1f2de4ea738cddf556aa75ee2
2013-10-21 01:23:14 +02:00
Amaury Pouly
46416c619d imx233: fix usb_detect() to be consistent with vbus detection
The STMP3700 has unreliable vbusvalid irq so we need to use
vdd5gtvddio. Therefore, using the vbusvalid bit produces
inconsistent results between events and detect. Fix that
by making power handle all the usb detect stuff.

Change-Id: Ic521b2f6677602e184fe46352c5359f4b4ba8d56
2013-10-21 01:23:14 +02:00
Amaury Pouly
96125e84f1 imx233: disable half fets on boot
This might cause freeze if the power supply is not able to cope
with the demand

Change-Id: I231142327fcad2096c18d3c8872ac8b6ee24f69c
2013-08-22 23:43:25 +02:00
Amaury Pouly
3afcb53fb9 imx233: rework power management
The current code was spreaded over power and powermgmt which made
it behave strangely, especially since there are relationships
between power management and frequency scaling. The new code makes
sure power management is initialised before frequency scaling
starts. It also makes sure to start from a known state, thus
fixing potential issue when the bootloader stops in a trickle
state where DCDC is improperly configured.

Change-Id: Ibded2e590e108f6c98daa52d2cf1bd28763c8923
2013-07-07 17:36:21 +02:00
Amaury Pouly
239219ee70 imx233: fix power for stmp3600 and stmp3700
There are many small differences between them. In particular
some regulators are not available on stmp3600. Also the vbusvalid
detect method is not available as an irq on stmp3600 and seems
broken on stmp3700. Finally die temperature is handled by the
power block on stmp3600.

Change-Id: I2c68b418738f15564e445d3a1496018cef97fff7
2013-06-17 00:29:25 +02:00
Amaury Pouly
918a06a12a imx233: normalise pinctrl names
The current pinctrl functions were a mess. Normalise the functions
names to make them shorter and clearer.

Change-Id: Iac6ff84625ef2b7610268e3a5802dc0088de3167
2013-06-17 00:29:24 +02:00
Amaury Pouly
7c5b65b9d2 imx233: rewrite power using new registers
Change-Id: Ifbee91161220419f4d1750672b5c4ae3537cefca
2013-06-16 18:21:43 +02:00
Amaury Pouly
2b1159dda0 imx233: move power init to system init
Do low level power init in system_init(). This can be needed
since imx233 must be able to frequecy scale atfer system_init()
and kernel_init() and this is only possible if power system was
initialised.

Change-Id: I27c66ec0dccd60bda26a45be24683c0bfe72c6da
2012-12-29 01:40:35 +01:00
Amaury Pouly
e2da3f47d3 imx233: fix regulator voltage setting + always enable DCDC mode
Make sure DCDC is running at boot (it is disabled by default when
5V is present and we don't want to rely on the bootloader to
change this).
When changing the voltage on a regulator, it usually takes 2ms for
the voltage to stabilize. In DCDC mode, there is an irq to notify
about the event so use it ! This is especially important when
changing cpu frequency because increasing the cpu freq while the
voltage is rising is unreliable.

Change-Id: Icfe9ef3ee90156d1e17da0820d9041859f7f3bca
2012-12-26 01:17:28 +01:00
Amaury Pouly
7ee1e30609 imx233: add regulator api
Remove the old debug stuff about VDDx and add a clean api to
get/set the regulator (VDDD, VDDA, VDDIO, VDDMEM). This is useful
for proper frequency scaling.

Change-Id: Ia5a1a712fd66652a8ad9601ed00db31aba5a7561
2012-08-30 01:10:36 +02:00
Amaury Pouly
9ced006c06 imx233: move icoll stuff to its own file
The icoll code now has an IRQ storm detection mechanism which
will prevent the device from hard freezing in case it happen.

Change-Id: I9861238dce61d29af1e48f9c534ec63a7f23465c
2012-05-19 16:10:51 +02:00
Amaury Pouly
645680d62b imx233: add pinctrl debug code to track pin uses
Past development has proved that one can mistakely use
the same pin for two uses without noticing. Since this
causes extremely hard to find bugs, the infrastructure
will allow to register pin uses and panic when a conflict
is detected. The pinctrl debug now shows the pin uses
when its support is compiled in.

Change-Id: Idb2d5235ce09207d77aa474d6f158e72b933761a
2012-05-10 00:13:11 +02:00
Amaury Pouly
9caffa8bf7 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
2012-03-15 15:01:11 +01:00
Amaury Pouly
ac4d648958 fuze+: use the si4700 internal oscillator and set a pin on power down (seems important)
Change-Id: If737438ddb726e51e0a725e27bc93950eb3657bd
2012-02-01 17:51:01 +01:00
Amaury Pouly
289440605a imx233/fuze+: set a few recommended power bits by Freescale, remove some uneeded headers, implement audio path selection for playback and radio
Change-Id: If926ead9b776504a58eb102fcc0e9acadf4f7379
2012-02-01 15:02:22 +01:00
Rafaël Carré
84127c9f69 imx233: fix power_input_status()
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31499 a1c6a512-1295-4272-9138-f99709370657
2011-12-31 18:50:03 +00:00
Rafaël Carré
568c441fd8 usb-target.h: remove
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31498 a1c6a512-1295-4272-9138-f99709370657
2011-12-31 18:44:55 +00:00
Rafaël Carré
2115eac7bb usb_plugged() is PP only
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31489 a1c6a512-1295-4272-9138-f99709370657
2011-12-31 18:43:59 +00:00
Amaury Pouly
f7f1f7023f imx233/fuze+: implement power management(battery charger), add powermgmt debug info, add power debug info, move target specific powermgmt code to its own files, remove auto-slow setup which was forgotten for debugging
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31424 a1c6a512-1295-4272-9138-f99709370657
2011-12-24 19:20:12 +00:00
Amaury Pouly
a299212af3 imx233: add power debug screen
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@31100 a1c6a512-1295-4272-9138-f99709370657
2011-11-30 18:47:31 +00:00
Amaury Pouly
0cd832a6d4 imx233: fix comment
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30984 a1c6a512-1295-4272-9138-f99709370657
2011-11-14 21:07:52 +00:00
Amaury Pouly
1852dd89ed imx233/fuze+: add a small delay before powering off to allow the user to release the power button
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30979 a1c6a512-1295-4272-9138-f99709370657
2011-11-14 19:46:13 +00:00
Amaury Pouly
7d4fed53cc imx233:fuze+: major memory and usb rework
- now identity map dram uncached and have a cached and buffered virtual alias
- rework dma to handle virtual to physical pointers conversion
- fix lcd frame pointer
- implement usb detection properly
- implement bootloader usb properly
- allow the bootloader to disable MMC windowing (useful for recovery)

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30432 a1c6a512-1295-4272-9138-f99709370657
2011-09-05 11:29:32 +00:00
Amaury Pouly
eb90d95693 imx233/fuze+: huge rework
- enable MMU
-rework lcd frame buffer
- add rtc/adc/power stubs (or not)
- fix a few MMC related defines (hopefully)
- implement cache handling for DMA
- more SD work
- add keymap (based on clip)
- add virtual buttons
- update linker scripts
- big step toward apps actually compiling

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30200 a1c6a512-1295-4272-9138-f99709370657
2011-07-23 11:45:22 +00:00