blob: 666d55305f4448453cdc052d32ea78e391d0da99 [file] [log] [blame]
Viktor Krivak6246fdb2012-08-08 01:42:24 +00001The U-Boot Driver Model Project
2===============================
3POWER analysis
4==============
5Viktor Krivak <viktor.krivak@gmail.com>
62012-03-09
7
8I) Overview
9-----------
10
11 1) Actual state
12 ---------------
13
14 At this moment power doesn't contain API. There are many methods for
15 initialization of some board specific functions but only few does what is
16 expected. Basically only one file contains something meaningful for this
17 driver.
18
19 2) Current implementation
20 -------------------------
21
22 In file twl6030.c are methods twl6030_stop_usb_charging() and
23 twl6030_start_usb_charging() for start and stop charging from USB. There are
24 also methods to get information about battery state and initialization of
25 battery charging. Only these methods are used in converted API.
26
27
28II) Approach
29------------
30
31 1) New API
32 ----------
33
34 New API implements only functions specific for managing power. All board
35 specific init methods are moved to other files. Name of methods are
36 self-explanatory.
37
38 struct ops {
39 void (*start_usb_charging)(struct instance *i);
40 void (*stop_usb_charging)(struct instance *i);
41 int (*get_battery_current)(struct instance *i);
42 int (*get_battery_voltage)(struct instance *i);
43 void (*init_battery_charging)(struct instance *i);
44 }
45
46 2) Conversions of other methods
47 -------------------------------
48
49 Methods that can't be converted to new API are moved to board file or to
50 special file for board hacks.
51
52III) Analysis of in-tree drivers
53--------------------------------
54
Masahiro Yamada566c6e42013-09-24 10:32:04 +090055 ftpmu010.c
56 ----------
Viktor Krivak6246fdb2012-08-08 01:42:24 +000057 All methods of this file are moved to another location.
58 void ftpmu010_32768osc_enable(void): Move to boards hacks
59 void ftpmu010_mfpsr_select_dev(unsigned int dev): Move to board file
Wolfgang Denk93e14592013-10-04 17:43:24 +020060 arch/nds32/lib/board.c
Viktor Krivak6246fdb2012-08-08 01:42:24 +000061 void ftpmu010_mfpsr_diselect_dev(unsigned int dev): Dead code
62 void ftpmu010_dlldis_disable(void): Dead code
63 void ftpmu010_sdram_clk_disable(unsigned int cr0): Move to board file
Wolfgang Denk93e14592013-10-04 17:43:24 +020064 arch/nds32/lib/board.c
Viktor Krivak6246fdb2012-08-08 01:42:24 +000065 void ftpmu010_sdramhtc_set(unsigned int val): Move to board file
Wolfgang Denk93e14592013-10-04 17:43:24 +020066 arch/nds32/lib/board.c
Viktor Krivak6246fdb2012-08-08 01:42:24 +000067
Masahiro Yamada566c6e42013-09-24 10:32:04 +090068 twl4030.c
69 ---------
Viktor Krivak6246fdb2012-08-08 01:42:24 +000070 All methods of this file are moved to another location.
71 void twl4030_power_reset_init(void): Move to board hacks
72 void twl4030_pmrecv_vsel_cfg(u8 vsel_reg, u8 vsel_val, u8 dev_grp,
Wolfgang Denk93e14592013-10-04 17:43:24 +020073 u8 dev_grp_sel): Move to board hacks
Viktor Krivak6246fdb2012-08-08 01:42:24 +000074 void twl4030_power_init(void): Move to board hacks
75 void twl4030_power_mmc_init(void): Move to board hacks
76
Masahiro Yamada566c6e42013-09-24 10:32:04 +090077 twl6030.c
78 ---------
Viktor Krivak6246fdb2012-08-08 01:42:24 +000079 Some methods are converted to new API and rest are moved to another location.
80 void twl6030_stop_usb_charging(void): Convert to new API
81 void twl6030_start_usb_charging(void): Convert to new API
82 int twl6030_get_battery_current(void): Convert to new API
83 int twl6030_get_battery_voltage(void): Convert to new API
84 void twl6030_init_battery_charging(void): Convert to new API
85 void twl6030_power_mmc_init(): Move to board file
Wolfgang Denk93e14592013-10-04 17:43:24 +020086 drivers/mmc/omap_hsmmc.c
Viktor Krivak6246fdb2012-08-08 01:42:24 +000087 void twl6030_usb_device_settings(): Move to board file
Wolfgang Denk93e14592013-10-04 17:43:24 +020088 drivers/usb/musb/omap3.c