diff options
author | Lorenzo Miori <memorys60@gmail.com> | 2013-02-23 16:59:49 +0100 |
---|---|---|
committer | Thomas Martitz <kugel@rockbox.org> | 2013-03-06 00:21:22 +0100 |
commit | 60592165ca998875e4bc46c4396c5a123a7e9dbb (patch) | |
tree | 60b53e6b733fd49bef249761789e97a4bedbef03 /firmware/target/hosted/samsungypr/ypr0/sc900776.h | |
parent | 3e4be68f8b596cf3467f993dc9a210a3d901ca1c (diff) | |
download | rockbox-60592165ca998875e4bc46c4396c5a123a7e9dbb.tar.gz rockbox-60592165ca998875e4bc46c4396c5a123a7e9dbb.zip |
Samsung YP-R0 hosted target code refactoring
As per title this patch aims at splitting common target
code and specific target code in a better way to
support future ports within the same environment
(e.g. Samsung YP-R1 where the Linux and the SoC
are the same, with differences in hardware devices
handling)
Change-Id: I67b4918c46403b184d3d8f42ab5aae7d01037fd0
Reviewed-on: http://gerrit.rockbox.org/409
Reviewed-by: Thomas Martitz <kugel@rockbox.org>
Tested-by: Thomas Martitz <kugel@rockbox.org>
Diffstat (limited to 'firmware/target/hosted/samsungypr/ypr0/sc900776.h')
-rw-r--r-- | firmware/target/hosted/samsungypr/ypr0/sc900776.h | 134 |
1 files changed, 134 insertions, 0 deletions
diff --git a/firmware/target/hosted/samsungypr/ypr0/sc900776.h b/firmware/target/hosted/samsungypr/ypr0/sc900776.h new file mode 100644 index 0000000000..32eb90f797 --- /dev/null +++ b/firmware/target/hosted/samsungypr/ypr0/sc900776.h | |||
@@ -0,0 +1,134 @@ | |||
1 | /* This file originates from the linux kernel provided in Samsung's YP-R0 Open | ||
2 | * Source package. | ||
3 | */ | ||
4 | |||
5 | /* | ||
6 | * Bigbang project | ||
7 | * Copyright (c) 2009 VPS R&D Group, Samsung Electronics, Inc. | ||
8 | * All rights reserved. | ||
9 | */ | ||
10 | |||
11 | /** | ||
12 | * This file defines data structures and APIs for Freescale SC900776 | ||
13 | * | ||
14 | * @name sc900776.h | ||
15 | * @author Eung Chan Kim (eungchan.kim@samsung.com) | ||
16 | * @version 0.1 | ||
17 | * @see | ||
18 | */ | ||
19 | |||
20 | #ifndef __SC900776_H__ | ||
21 | #define __SC900776_H__ | ||
22 | |||
23 | |||
24 | typedef enum | ||
25 | { | ||
26 | SC900776_DEVICE_ID = 0x01, /* 01h R */ | ||
27 | SC900776_CONTROL, /* 02h R/W */ | ||
28 | SC900776_INTERRUPT1, /* 03h R/C */ | ||
29 | SC900776_INTERRUPT2, /* 04h R/C */ | ||
30 | SC900776_INTERRUPT_MASK1, /* 05h R/W */ | ||
31 | SC900776_INTERRUPT_MASK2, /* 06h R/W */ | ||
32 | SC900776_ADC_RESULT, /* 07h R */ | ||
33 | SC900776_TIMING_SET1, /* 08h R/W */ | ||
34 | SC900776_TIMING_SET2, /* 09h R/W */ | ||
35 | SC900776_DEVICE_TYPE1, /* 0Ah R */ | ||
36 | SC900776_DEVICE_TYPE2, /* 0Bh R */ | ||
37 | SC900776_BUTTON1, /* 0Ch R/C */ | ||
38 | SC900776_BUTTON2, /* 0Dh R/C */ | ||
39 | /* 0Eh ~ 12h : reserved */ | ||
40 | SC900776_MANUAL_SWITCH1 = 0x13, /* 13h R/W */ | ||
41 | SC900776_MANUAL_SWITCH2, /* 14h R/W */ | ||
42 | /* 15h ~ 1Fh : reserved */ | ||
43 | SC900776_FSL_STATUS = 0x20, /* 20h R */ | ||
44 | SC900776_FSL_CONTROL, /* 21h R/W */ | ||
45 | SC900776_TIME_DELAY, /* 22h R/W */ | ||
46 | SC900776_DEVICE_MODE, /* 23h R/W */ | ||
47 | |||
48 | SC900776_REG_MAX | ||
49 | } eSc900776_register_t; | ||
50 | |||
51 | typedef enum | ||
52 | { | ||
53 | DEVICETYPE1_UNDEFINED = 0, | ||
54 | DEVICETYPE1_USB, // 0x04 0x00 // normal usb cable & ad200 | ||
55 | DEVICETYPE1_DEDICATED, // 0x40 0x00 // dedicated charger cable | ||
56 | DEVICETYPE2_JIGUARTON, // 0x00 0x08 // Anygate_UART jig | ||
57 | DEVICETYPE2_JIGUSBOFF, // 0x00 0x01 // USB jig(AS center) | ||
58 | DEVICETYPE2_JIGUSBON, // 0x00 0x02 // Anygate_USB jig with boot-on, not tested | ||
59 | } eMinivet_device_t; | ||
60 | |||
61 | /* | ||
62 | * sc900776 register bit definitions | ||
63 | */ | ||
64 | #define MINIVET_DEVICETYPE1_USBOTG 0x80 /* 1: a USBOTG device is attached */ | ||
65 | #define MINIVET_DEVICETYPE1_DEDICATED 0x40 /* 1: a dedicated charger is attached */ | ||
66 | #define MINIVET_DEVICETYPE1_USBCHG 0x20 /* 1: a USB charger is attached */ | ||
67 | #define MINIVET_DEVICETYPE1_5WCHG 0x10 /* 1: a 5-wire charger (type 1 or 2) is attached */ | ||
68 | #define MINIVET_DEVICETYPE1_UART 0x08 /* 1: a UART cable is attached */ | ||
69 | #define MINIVET_DEVICETYPE1_USB 0x04 /* 1: a USB host is attached */ | ||
70 | #define MINIVET_DEVICETYPE1_AUDIO2 0x02 /* 1: an audio accessory type 2 is attached */ | ||
71 | #define MINIVET_DEVICETYPE1_AUDIO1 0x01 /* 1: an audio accessory type 1 is attached */ | ||
72 | |||
73 | #define MINIVET_DEVICETYPE2_AV 0x40 /* 1: an audio/video cable is attached */ | ||
74 | #define MINIVET_DEVICETYPE2_TTY 0x20 /* 1: a TTY converter is attached */ | ||
75 | #define MINIVET_DEVICETYPE2_PPD 0x10 /* 1: a phone powered device is attached */ | ||
76 | #define MINIVET_DEVICETYPE2_JIGUARTON 0x08 /* 1: a UART jig cable with the BOOT-on option is attached */ | ||
77 | #define MINIVET_DEVICETYPE2_JIGUARTOFF 0x04 /* 1: a UART jig cable with the BOOT-off option is attached */ | ||
78 | #define MINIVET_DEVICETYPE2_JIGUSBON 0x02 /* 1: a USB jig cable with the BOOT-on option is attached */ | ||
79 | #define MINIVET_DEVICETYPE2_JIGUSBOFF 0x01 /* 1: a USB jig cable with the BOOT-off option is attached */ | ||
80 | |||
81 | #define MINIVET_FSLSTATUS_FETSTATUS 0x40 /* 1: The on status of the power MOSFET */ | ||
82 | #define MINIVET_FSLSTATUS_IDDETEND 0x20 /* 1: ID resistance detection finished */ | ||
83 | #define MINIVET_FSLSTATUS_VBUSDETEND 0x10 /* 1: VBUS power supply type identification completed */ | ||
84 | #define MINIVET_FSLSTATUS_IDGND 0x08 /* 1: ID pin is shorted to ground */ | ||
85 | #define MINIVET_FSLSTATUS_IDFLOAT 0x04 /* 1: ID line is floating */ | ||
86 | #define MINIVET_FSLSTATUS_VBUSDET 0x02 /* 1: VBUS voltage is higher than the POR */ | ||
87 | #define MINIVET_FSLSTATUS_ADCSTATUS 0x01 /* 1: ADC conversion completed */ | ||
88 | |||
89 | |||
90 | #define SC900776_I2C_SLAVE_ADDR 0x25 | ||
91 | |||
92 | typedef struct { | ||
93 | unsigned char addr; | ||
94 | unsigned char value; | ||
95 | }__attribute__((packed)) sMinivet_t; | ||
96 | |||
97 | |||
98 | #define DRV_IOCTL_MINIVET_MAGIC 'M' | ||
99 | |||
100 | |||
101 | typedef enum | ||
102 | { | ||
103 | E_IOCTL_MINIVET_INIT = 0, | ||
104 | E_IOCTL_MINIVET_WRITE_BYTE, | ||
105 | E_IOCTL_MINIVET_READ_BYTE, | ||
106 | E_IOCTL_MINIVET_DET_VBUS, | ||
107 | E_IOCTL_MINIVET_MANUAL_USB, | ||
108 | E_IOCTL_MINIVET_MANUAL_UART, | ||
109 | |||
110 | E_IOCTL_MINIVET_MAX | ||
111 | } eSc900776_ioctl_t; | ||
112 | |||
113 | #define IOCTL_MINIVET_INIT _IO(DRV_IOCTL_MINIVET_MAGIC, E_IOCTL_MINIVET_INIT) | ||
114 | #define IOCTL_MINIVET_WRITE_BYTE _IOW(DRV_IOCTL_MINIVET_MAGIC, E_IOCTL_MINIVET_WRITE_BYTE, sMinivet_t) | ||
115 | #define IOCTL_MINIVET_READ_BYTE _IOR(DRV_IOCTL_MINIVET_MAGIC, E_IOCTL_MINIVET_READ_BYTE, sMinivet_t) | ||
116 | #define IOCTL_MINIVET_DET_VBUS _IO(DRV_IOCTL_MINIVET_MAGIC, E_IOCTL_MINIVET_DET_VBUS) | ||
117 | #define IOCTL_MINIVET_MANUAL_USB _IO(DRV_IOCTL_MINIVET_MAGIC, E_IOCTL_MINIVET_MANUAL_USB) | ||
118 | #define IOCTL_MINIVET_MANUAL_UART _IO(DRV_IOCTL_MINIVET_MAGIC, E_IOCTL_MINIVET_MANUAL_UART) | ||
119 | |||
120 | |||
121 | #ifndef __MINIVET_ENUM__ | ||
122 | #define __MINIVET_ENUM__ | ||
123 | enum | ||
124 | { | ||
125 | EXT_PWR_UNPLUGGED = 0, | ||
126 | EXT_PWR_PLUGGED, | ||
127 | EXT_PWR_NOT_OVP, | ||
128 | EXT_PWR_OVP, | ||
129 | }; | ||
130 | |||
131 | #endif /* __MINIVET_ENUM__ */ | ||
132 | |||
133 | |||
134 | #endif /* __MINIVET_IOCTL_H__ */ | ||