Viktor Krivak | cbcc33e | 2012-08-08 01:42:28 +0000 | [diff] [blame] | 1 | The U-Boot Driver Model Project |
| 2 | =============================== |
| 3 | PCMCIA analysis |
| 4 | =============== |
| 5 | Viktor Krivak <viktor.krivak@gmail.com> |
| 6 | 2012-03-17 |
| 7 | |
| 8 | I) Overview |
| 9 | ----------- |
| 10 | |
| 11 | U-boot implements only 2 methods to interoperate with pcmcia. One to turn |
| 12 | device on and other to turn device off. Names of these methods are usually |
| 13 | pcmcia_on() and pcmcia_off() without any parameters. Some files in driver |
| 14 | directory implements only internal API. These methods aren't used outside |
| 15 | driver directory and they are not converted to new driver model. |
| 16 | |
| 17 | II) Approach |
| 18 | ----------- |
| 19 | |
| 20 | 1) New API |
| 21 | ---------- |
| 22 | |
| 23 | Current API is preserved and all internal methods are hiden. |
| 24 | |
| 25 | struct ops { |
| 26 | void (*pcmcia_on)(struct instance *i); |
| 27 | void (*pcmcia_off)(struct instance *i); |
| 28 | } |
| 29 | |
| 30 | 2) Conversion |
| 31 | ------------- |
| 32 | |
| 33 | In header file pcmcia.h are some other variables which are used for |
| 34 | additional configuration. But all have to be moved to platform data or to |
| 35 | specific driver implementation. |
| 36 | |
| 37 | 3) Platform data |
| 38 | ---------------- |
| 39 | |
| 40 | Many boards have custom implementation of internal API. Pointers to these |
| 41 | methods are stored in platform_data. But the most implementations for Intel |
| 42 | 82365 and compatible PC Card controllers and Yenta-compatible |
| 43 | PCI-to-CardBus controllers implement whole API per board. In these cases |
| 44 | pcmcia_on() and pcmcia_off() behave only as wrappers and call specific |
| 45 | board methods. |
| 46 | |
| 47 | III) Analysis of in-tree drivers |
| 48 | -------------------------------- |
| 49 | |
Masahiro Yamada | 566c6e4 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 50 | i82365.c |
| 51 | -------- |
Viktor Krivak | cbcc33e | 2012-08-08 01:42:28 +0000 | [diff] [blame] | 52 | Driver methods have different name i82365_init() and i82365_exit but |
| 53 | all functionality is the same. Board files board/atc/ti113x.c and |
| 54 | board/cpc45/pd67290.c use their own implementation of these method. |
| 55 | In this case all methods in driver behave only as wrappers. |
| 56 | |
Masahiro Yamada | 566c6e4 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 57 | marubun_pcmcia.c |
| 58 | ---------------- |
Viktor Krivak | cbcc33e | 2012-08-08 01:42:28 +0000 | [diff] [blame] | 59 | Meets standard API behaviour. Simple conversion. |
| 60 | |
Masahiro Yamada | 566c6e4 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 61 | mpc8xx_pcmcia.c |
Viktor Krivak | cbcc33e | 2012-08-08 01:42:28 +0000 | [diff] [blame] | 62 | --------------- |
Masahiro Yamada | 566c6e4 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 63 | Meets standard API behaviour. Simple conversion. |
| 64 | |
| 65 | rpx_pcmcia.c |
| 66 | ------------ |
Viktor Krivak | cbcc33e | 2012-08-08 01:42:28 +0000 | [diff] [blame] | 67 | Implements only internal API used in other drivers. Non of methods |
| 68 | implemented here are used outside driver model. |
| 69 | |
Masahiro Yamada | 566c6e4 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 70 | ti_pci1410a.c |
| 71 | ------------- |
Viktor Krivak | cbcc33e | 2012-08-08 01:42:28 +0000 | [diff] [blame] | 72 | Has different API but methods in this file are never called. Probably |
| 73 | dead code. |
| 74 | |
Masahiro Yamada | 566c6e4 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 75 | tqm8xx_pcmcia.c |
| 76 | --------------- |
Viktor Krivak | cbcc33e | 2012-08-08 01:42:28 +0000 | [diff] [blame] | 77 | Implements only internal API used in other drivers. Non of methods |
| 78 | implemented here are used outside driver model. |