diff options
Diffstat (limited to 'Documentation')
-rw-r--r-- | Documentation/ABI/testing/sysfs-c2port | 88 | ||||
-rw-r--r-- | Documentation/c2port.txt | 90 |
2 files changed, 178 insertions, 0 deletions
diff --git a/Documentation/ABI/testing/sysfs-c2port b/Documentation/ABI/testing/sysfs-c2port new file mode 100644 index 000000000000..716cffc457e9 --- /dev/null +++ b/Documentation/ABI/testing/sysfs-c2port | |||
@@ -0,0 +1,88 @@ | |||
1 | What: /sys/class/c2port/ | ||
2 | Date: October 2008 | ||
3 | Contact: Rodolfo Giometti <giometti@linux.it> | ||
4 | Description: | ||
5 | The /sys/class/c2port/ directory will contain files and | ||
6 | directories that will provide a unified interface to | ||
7 | the C2 port interface. | ||
8 | |||
9 | What: /sys/class/c2port/c2portX | ||
10 | Date: October 2008 | ||
11 | Contact: Rodolfo Giometti <giometti@linux.it> | ||
12 | Description: | ||
13 | The /sys/class/c2port/c2portX/ directory is related to X-th | ||
14 | C2 port into the system. Each directory will contain files to | ||
15 | manage and control its C2 port. | ||
16 | |||
17 | What: /sys/class/c2port/c2portX/access | ||
18 | Date: October 2008 | ||
19 | Contact: Rodolfo Giometti <giometti@linux.it> | ||
20 | Description: | ||
21 | The /sys/class/c2port/c2portX/access file enable the access | ||
22 | to the C2 port from the system. No commands can be sent | ||
23 | till this entry is set to 0. | ||
24 | |||
25 | What: /sys/class/c2port/c2portX/dev_id | ||
26 | Date: October 2008 | ||
27 | Contact: Rodolfo Giometti <giometti@linux.it> | ||
28 | Description: | ||
29 | The /sys/class/c2port/c2portX/dev_id file show the device ID | ||
30 | of the connected micro. | ||
31 | |||
32 | What: /sys/class/c2port/c2portX/flash_access | ||
33 | Date: October 2008 | ||
34 | Contact: Rodolfo Giometti <giometti@linux.it> | ||
35 | Description: | ||
36 | The /sys/class/c2port/c2portX/flash_access file enable the | ||
37 | access to the on-board flash of the connected micro. | ||
38 | No commands can be sent till this entry is set to 0. | ||
39 | |||
40 | What: /sys/class/c2port/c2portX/flash_block_size | ||
41 | Date: October 2008 | ||
42 | Contact: Rodolfo Giometti <giometti@linux.it> | ||
43 | Description: | ||
44 | The /sys/class/c2port/c2portX/flash_block_size file show | ||
45 | the on-board flash block size of the connected micro. | ||
46 | |||
47 | What: /sys/class/c2port/c2portX/flash_blocks_num | ||
48 | Date: October 2008 | ||
49 | Contact: Rodolfo Giometti <giometti@linux.it> | ||
50 | Description: | ||
51 | The /sys/class/c2port/c2portX/flash_blocks_num file show | ||
52 | the on-board flash blocks number of the connected micro. | ||
53 | |||
54 | What: /sys/class/c2port/c2portX/flash_data | ||
55 | Date: October 2008 | ||
56 | Contact: Rodolfo Giometti <giometti@linux.it> | ||
57 | Description: | ||
58 | The /sys/class/c2port/c2portX/flash_data file export | ||
59 | the content of the on-board flash of the connected micro. | ||
60 | |||
61 | What: /sys/class/c2port/c2portX/flash_erase | ||
62 | Date: October 2008 | ||
63 | Contact: Rodolfo Giometti <giometti@linux.it> | ||
64 | Description: | ||
65 | The /sys/class/c2port/c2portX/flash_erase file execute | ||
66 | the "erase" command on the on-board flash of the connected | ||
67 | micro. | ||
68 | |||
69 | What: /sys/class/c2port/c2portX/flash_erase | ||
70 | Date: October 2008 | ||
71 | Contact: Rodolfo Giometti <giometti@linux.it> | ||
72 | Description: | ||
73 | The /sys/class/c2port/c2portX/flash_erase file show the | ||
74 | on-board flash size of the connected micro. | ||
75 | |||
76 | What: /sys/class/c2port/c2portX/reset | ||
77 | Date: October 2008 | ||
78 | Contact: Rodolfo Giometti <giometti@linux.it> | ||
79 | Description: | ||
80 | The /sys/class/c2port/c2portX/reset file execute a "reset" | ||
81 | command on the connected micro. | ||
82 | |||
83 | What: /sys/class/c2port/c2portX/rev_id | ||
84 | Date: October 2008 | ||
85 | Contact: Rodolfo Giometti <giometti@linux.it> | ||
86 | Description: | ||
87 | The /sys/class/c2port/c2portX/rev_id file show the revision ID | ||
88 | of the connected micro. | ||
diff --git a/Documentation/c2port.txt b/Documentation/c2port.txt new file mode 100644 index 000000000000..d9bf93ea4398 --- /dev/null +++ b/Documentation/c2port.txt | |||
@@ -0,0 +1,90 @@ | |||
1 | C2 port support | ||
2 | --------------- | ||
3 | |||
4 | (C) Copyright 2007 Rodolfo Giometti <giometti@enneenne.com> | ||
5 | |||
6 | This program is free software; you can redistribute it and/or modify | ||
7 | it under the terms of the GNU General Public License as published by | ||
8 | the Free Software Foundation; either version 2 of the License, or | ||
9 | (at your option) any later version. | ||
10 | |||
11 | This program is distributed in the hope that it will be useful, | ||
12 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | GNU General Public License for more details. | ||
15 | |||
16 | |||
17 | |||
18 | Overview | ||
19 | -------- | ||
20 | |||
21 | This driver implements the support for Linux of Silicon Labs (Silabs) | ||
22 | C2 Interface used for in-system programming of micro controllers. | ||
23 | |||
24 | By using this driver you can reprogram the in-system flash without EC2 | ||
25 | or EC3 debug adapter. This solution is also useful in those systems | ||
26 | where the micro controller is connected via special GPIOs pins. | ||
27 | |||
28 | References | ||
29 | ---------- | ||
30 | |||
31 | The C2 Interface main references are at (http://www.silabs.com) | ||
32 | Silicon Laboratories site], see: | ||
33 | |||
34 | - AN127: FLASH Programming via the C2 Interface at | ||
35 | http://www.silabs.com/public/documents/tpub_doc/anote/Microcontrollers/Small_Form_Factor/en/an127.pdf, and | ||
36 | |||
37 | - C2 Specification at | ||
38 | http://www.silabs.com/public/documents/tpub_doc/spec/Microcontrollers/en/C2spec.pdf, | ||
39 | |||
40 | however it implements a two wire serial communication protocol (bit | ||
41 | banging) designed to enable in-system programming, debugging, and | ||
42 | boundary-scan testing on low pin-count Silicon Labs devices. Currently | ||
43 | this code supports only flash programming but extensions are easy to | ||
44 | add. | ||
45 | |||
46 | Using the driver | ||
47 | ---------------- | ||
48 | |||
49 | Once the driver is loaded you can use sysfs support to get C2port's | ||
50 | info or read/write in-system flash. | ||
51 | |||
52 | # ls /sys/class/c2port/c2port0/ | ||
53 | access flash_block_size flash_erase rev_id | ||
54 | dev_id flash_blocks_num flash_size subsystem/ | ||
55 | flash_access flash_data reset uevent | ||
56 | |||
57 | Initially the C2port access is disabled since you hardware may have | ||
58 | such lines multiplexed with other devices so, to get access to the | ||
59 | C2port, you need the command: | ||
60 | |||
61 | # echo 1 > /sys/class/c2port/c2port0/access | ||
62 | |||
63 | after that you should read the device ID and revision ID of the | ||
64 | connected micro controller: | ||
65 | |||
66 | # cat /sys/class/c2port/c2port0/dev_id | ||
67 | 8 | ||
68 | # cat /sys/class/c2port/c2port0/rev_id | ||
69 | 1 | ||
70 | |||
71 | However, for security reasons, the in-system flash access in not | ||
72 | enabled yet, to do so you need the command: | ||
73 | |||
74 | # echo 1 > /sys/class/c2port/c2port0/flash_access | ||
75 | |||
76 | After that you can read the whole flash: | ||
77 | |||
78 | # cat /sys/class/c2port/c2port0/flash_data > image | ||
79 | |||
80 | erase it: | ||
81 | |||
82 | # echo 1 > /sys/class/c2port/c2port0/flash_erase | ||
83 | |||
84 | and write it: | ||
85 | |||
86 | # cat image > /sys/class/c2port/c2port0/flash_data | ||
87 | |||
88 | after writing you have to reset the device to execute the new code: | ||
89 | |||
90 | # echo 1 > /sys/class/c2port/c2port0/reset | ||