diff options
author | Anton Vorontsov <avorontsov@ru.mvista.com> | 2008-05-23 12:38:56 -0400 |
---|---|---|
committer | Kumar Gala <galak@kernel.crashing.org> | 2008-06-10 11:39:13 -0400 |
commit | 5e41486c408eb4206aee09303631427f57771691 (patch) | |
tree | 04198c2fdffdb70816ba141aaa2f2b1d6d8e72aa /include/asm-powerpc/qe.h | |
parent | 83ff9dcf375c418ca3b98eb950711525ca1269e2 (diff) |
powerpc/QE: add support for QE USB clocks routing
This patch adds a function to the qe_lib to setup QE USB clocks routing.
To setup clocks safely, cmxgcr register needs locking, so I just reused
ucc_lock since it was used only to protect cmxgcr.
The idea behind placing clocks routing functions into the qe_lib is that
later we'll hopefully switch to the generic Linux Clock API, thus, for
example, FHCI driver may be used for QE and CPM chips without nasty #ifdefs.
This patch also fixes QE_USB_RESTART_TX command definition in the qe.h.
Signed-off-by: Anton Vorontsov <avorontsov@ru.mvista.com>
Acked-By: Timur Tabi <timur@freescale.com>
Signed-off-by: Kumar Gala <galak@kernel.crashing.org>
Diffstat (limited to 'include/asm-powerpc/qe.h')
-rw-r--r-- | include/asm-powerpc/qe.h | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/include/asm-powerpc/qe.h b/include/asm-powerpc/qe.h index c3be6e2e1490..d217288ec6bf 100644 --- a/include/asm-powerpc/qe.h +++ b/include/asm-powerpc/qe.h | |||
@@ -16,6 +16,7 @@ | |||
16 | #define _ASM_POWERPC_QE_H | 16 | #define _ASM_POWERPC_QE_H |
17 | #ifdef __KERNEL__ | 17 | #ifdef __KERNEL__ |
18 | 18 | ||
19 | #include <linux/spinlock.h> | ||
19 | #include <asm/immap_qe.h> | 20 | #include <asm/immap_qe.h> |
20 | 21 | ||
21 | #define QE_NUM_OF_SNUM 28 | 22 | #define QE_NUM_OF_SNUM 28 |
@@ -74,6 +75,13 @@ enum qe_clock { | |||
74 | QE_CLK_DUMMY | 75 | QE_CLK_DUMMY |
75 | }; | 76 | }; |
76 | 77 | ||
78 | static inline bool qe_clock_is_brg(enum qe_clock clk) | ||
79 | { | ||
80 | return clk >= QE_BRG1 && clk <= QE_BRG16; | ||
81 | } | ||
82 | |||
83 | extern spinlock_t cmxgcr_lock; | ||
84 | |||
77 | /* Export QE common operations */ | 85 | /* Export QE common operations */ |
78 | extern void qe_reset(void); | 86 | extern void qe_reset(void); |
79 | extern int par_io_init(struct device_node *np); | 87 | extern int par_io_init(struct device_node *np); |
@@ -156,6 +164,9 @@ int qe_upload_firmware(const struct qe_firmware *firmware); | |||
156 | /* Obtain information on the uploaded firmware */ | 164 | /* Obtain information on the uploaded firmware */ |
157 | struct qe_firmware_info *qe_get_firmware_info(void); | 165 | struct qe_firmware_info *qe_get_firmware_info(void); |
158 | 166 | ||
167 | /* QE USB */ | ||
168 | int qe_usb_clock_set(enum qe_clock clk, int rate); | ||
169 | |||
159 | /* Buffer descriptors */ | 170 | /* Buffer descriptors */ |
160 | struct qe_bd { | 171 | struct qe_bd { |
161 | __be16 status; | 172 | __be16 status; |
@@ -254,6 +265,16 @@ enum comm_dir { | |||
254 | #define QE_CMXGCR_MII_ENET_MNG 0x00007000 | 265 | #define QE_CMXGCR_MII_ENET_MNG 0x00007000 |
255 | #define QE_CMXGCR_MII_ENET_MNG_SHIFT 12 | 266 | #define QE_CMXGCR_MII_ENET_MNG_SHIFT 12 |
256 | #define QE_CMXGCR_USBCS 0x0000000f | 267 | #define QE_CMXGCR_USBCS 0x0000000f |
268 | #define QE_CMXGCR_USBCS_CLK3 0x1 | ||
269 | #define QE_CMXGCR_USBCS_CLK5 0x2 | ||
270 | #define QE_CMXGCR_USBCS_CLK7 0x3 | ||
271 | #define QE_CMXGCR_USBCS_CLK9 0x4 | ||
272 | #define QE_CMXGCR_USBCS_CLK13 0x5 | ||
273 | #define QE_CMXGCR_USBCS_CLK17 0x6 | ||
274 | #define QE_CMXGCR_USBCS_CLK19 0x7 | ||
275 | #define QE_CMXGCR_USBCS_CLK21 0x8 | ||
276 | #define QE_CMXGCR_USBCS_BRG9 0x9 | ||
277 | #define QE_CMXGCR_USBCS_BRG10 0xa | ||
257 | 278 | ||
258 | /* QE CECR Commands. | 279 | /* QE CECR Commands. |
259 | */ | 280 | */ |
@@ -283,7 +304,7 @@ enum comm_dir { | |||
283 | #define QE_HPAC_START_TX 0x0000060b | 304 | #define QE_HPAC_START_TX 0x0000060b |
284 | #define QE_HPAC_START_RX 0x0000070b | 305 | #define QE_HPAC_START_RX 0x0000070b |
285 | #define QE_USB_STOP_TX 0x0000000a | 306 | #define QE_USB_STOP_TX 0x0000000a |
286 | #define QE_USB_RESTART_TX 0x0000000b | 307 | #define QE_USB_RESTART_TX 0x0000000c |
287 | #define QE_QMC_STOP_TX 0x0000000c | 308 | #define QE_QMC_STOP_TX 0x0000000c |
288 | #define QE_QMC_STOP_RX 0x0000000d | 309 | #define QE_QMC_STOP_RX 0x0000000d |
289 | #define QE_SS7_SU_FIL_RESET 0x0000000e | 310 | #define QE_SS7_SU_FIL_RESET 0x0000000e |