Tomáš Hlaváček | bfae89a | 2012-08-08 13:42:30 +0200 | [diff] [blame] | 1 | ================================== |
| 2 | TWserial device subsystem analysis |
| 3 | ================================== |
| 4 | |
| 5 | Tomas Hlavacek<tmshlvck@gmail.com> |
| 6 | 2012-03-21 |
| 7 | |
| 8 | I) Overview |
| 9 | ----------- |
| 10 | |
| 11 | U-Boot currently implements one common API for TWSerial devices. The interface |
| 12 | is defined in include/tws.h and comprises of functions: |
| 13 | |
| 14 | int tws_read(uchar *buffer, int len); |
| 15 | int tws_write(uchar *buffer, int len); |
| 16 | |
| 17 | The functions are implemented by a proper device driver in drivers/twserial |
| 18 | directory and the driver to be compiled in is selected in a Makefile. There is |
| 19 | only one driver present now. |
| 20 | |
| 21 | The driver depends on ad-hoc code in board specific data, namely functions: |
| 22 | |
| 23 | void tws_ce(unsigned bit); |
| 24 | void tws_wr(unsigned bit); |
| 25 | void tws_clk(unsigned bit); |
| 26 | void tws_data(unsigned bit); |
| 27 | unsigned tws_data_read(void); |
| 28 | void tws_data_config_output(unsigned output); |
| 29 | |
| 30 | implemented in include/configs/inka4x0.h . |
| 31 | |
| 32 | II) Approach |
| 33 | ------------ |
| 34 | |
| 35 | U-Boot TWserial drivers exports two simple functions and therefore the conversion |
| 36 | of the driver and creating a core for it is not needed. It should be consolidated |
| 37 | with include/configs/inka4x0.h and taken to the misc/ dir. |
| 38 | |
| 39 | |
| 40 | III) Analysis of in-tree drivers |
| 41 | -------------------------------- |
| 42 | |
Masahiro Yamada | 566c6e4 | 2013-09-24 10:32:04 +0900 | [diff] [blame] | 43 | drivers/twserial/soft_tws.c |
| 44 | --------------------------- |
Tomáš Hlaváček | bfae89a | 2012-08-08 13:42:30 +0200 | [diff] [blame] | 45 | The driver is the only TWserial driver. The ad-hoc part in |
| 46 | include/configs/inka4x0.h and the core soft_tws driver should be consolidated |
| 47 | to one compact driver and moved to misc/ . |