2 * URB OHCI HCD (Host Controller Driver) for USB on the S3C2400.
5 * Gary Jennejohn, DENX Software Engineering <garyj@denx.de>
7 * Note: Much of this code has been derived from Linux 2.4
8 * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at>
9 * (C) Copyright 2000-2002 David Brownell
11 * SPDX-License-Identifier: GPL-2.0+
15 * 1 - this driver is intended for use with USB Mass Storage Devices
16 * (BBB) ONLY. There is NO support for Interrupt or Isochronous pipes!
20 /* #include <pci.h> no PCI on the S3C24X0 */
22 #if defined(CONFIG_USB_OHCI) && defined(CONFIG_S3C24X0)
24 #include <asm/arch/s3c24x0_cpu.h>
28 #include "ohci-s3c24xx.h"
30 #define OHCI_USE_NPS /* force NoPowerSwitching mode */
31 #undef OHCI_VERBOSE_DEBUG /* not always helpful */
34 /* For initializing controller (mask in an HCFS mode too) */
35 #define OHCI_CONTROL_INIT \
36 (OHCI_CTRL_CBSR & 0x3) | OHCI_CTRL_IE | OHCI_CTRL_PLE
38 #define min_t(type, x, y) \
39 ({ type __x = (x); type __y = (y); __x < __y ? __x : __y; })
43 #define dbg(format, arg...) printf("DEBUG: " format "\n", ## arg)
45 #define dbg(format, arg...) do {} while(0)
47 #define err(format, arg...) printf("ERROR: " format "\n", ## arg)
50 #define info(format, arg...) printf("INFO: " format "\n", ## arg)
52 #define info(format, arg...) do {} while(0)
55 #define m16_swap(x) swap_16(x)
56 #define m32_swap(x) swap_32(x)
58 /* global struct ohci */
59 static struct ohci gohci;
60 /* this must be aligned to a 256 byte boundary */
61 struct ohci_hcca ghcca[1];
62 /* a pointer to the aligned storage */
63 struct ohci_hcca *phcca;
64 /* this allocates EDs for all possible endpoints */
65 struct ohci_device ohci_dev;
67 struct urb_priv urb_priv;
70 /* device which was disconnected */
71 struct usb_device *devgone;
72 /* flag guarding URB transation */
75 /*-------------------------------------------------------------------------*/
77 /* AMD-756 (D2 rev) reports corrupt register contents in some cases.
78 * The erratum (#4) description is incorrect. AMD's workaround waits
79 * till some bits (mostly reserved) are clear; ok for all revs.
81 #define OHCI_QUIRK_AMD756 0xabcd
82 #define read_roothub(hc, register, mask) ({ \
83 u32 temp = readl (&hc->regs->roothub.register); \
84 if (hc->flags & OHCI_QUIRK_AMD756) \
86 temp = readl (&hc->regs->roothub.register); \
89 static u32 roothub_a(struct ohci *hc)
91 return read_roothub(hc, a, 0xfc0fe000);
93 static inline u32 roothub_b(struct ohci *hc)
95 return readl(&hc->regs->roothub.b);
97 static inline u32 roothub_status(struct ohci *hc)
99 return readl(&hc->regs->roothub.status);
101 static u32 roothub_portstatus(struct ohci *hc, int i)
103 return read_roothub(hc, portstatus[i], 0xffe0fce0);
106 /* forward declaration */
107 static int hc_interrupt(void);
108 static void td_submit_job(struct usb_device *dev, unsigned long pipe,
109 void *buffer, int transfer_len,
110 struct devrequest *setup, struct urb_priv *urb,
113 /*-------------------------------------------------------------------------*
114 * URB support functions
115 *-------------------------------------------------------------------------*/
117 /* free HCD-private data associated with this URB */
119 static void urb_free_priv(struct urb_priv *urb)
125 last = urb->length - 1;
127 for (i = 0; i <= last; i++) {
137 /*-------------------------------------------------------------------------*/
140 static int sohci_get_current_frame_number(struct usb_device *dev);
142 /* debug| print the main components of an URB
143 * small: 0) header + data packets 1) just header */
145 static void pkt_print(struct usb_device *dev, unsigned long pipe, void *buffer,
146 int transfer_len, struct devrequest *setup, char *str,
149 struct urb_priv *purb = &urb_priv;
151 dbg("%s URB:[%4x] dev:%2d,ep:%2d-%c,type:%s,len:%d/%d stat:%#lx",
153 sohci_get_current_frame_number(dev),
154 usb_pipedevice(pipe),
155 usb_pipeendpoint(pipe),
156 usb_pipeout(pipe) ? 'O' : 'I',
157 usb_pipetype(pipe) < 2 ?
158 (usb_pipeint(pipe) ? "INTR" : "ISOC") :
159 (usb_pipecontrol(pipe) ? "CTRL" : "BULK"),
160 purb->actual_length, transfer_len, dev->status);
161 #ifdef OHCI_VERBOSE_DEBUG
165 if (usb_pipecontrol(pipe)) {
166 printf(__FILE__ ": cmd(8):");
167 for (i = 0; i < 8; i++)
168 printf(" %02x", ((__u8 *) setup)[i]);
171 if (transfer_len > 0 && buffer) {
172 printf(__FILE__ ": data(%d/%d):",
173 purb->actual_length, transfer_len);
174 len = usb_pipeout(pipe) ?
175 transfer_len : purb->actual_length;
176 for (i = 0; i < 16 && i < len; i++)
177 printf(" %02x", ((__u8 *) buffer)[i]);
178 printf("%s\n", i < len ? "..." : "");
184 /* just for debugging; prints non-empty branches of the
185 int ed tree inclusive iso eds*/
186 void ep_print_int_eds(struct ohci *ohci, char *str)
190 for (i = 0; i < 32; i++) {
192 ed_p = &(ohci->hcca->int_table[i]);
195 printf(__FILE__ ": %s branch int %2d(%2x):", str, i, i);
196 while (*ed_p != 0 && j--) {
197 struct ed *ed = (struct ed *) m32_swap(ed_p);
198 printf(" ed: %4x;", ed->hwINFO);
199 ed_p = &ed->hwNextED;
205 static void ohci_dump_intr_mask(char *label, __u32 mask)
207 dbg("%s: 0x%08x%s%s%s%s%s%s%s%s%s",
210 (mask & OHCI_INTR_MIE) ? " MIE" : "",
211 (mask & OHCI_INTR_OC) ? " OC" : "",
212 (mask & OHCI_INTR_RHSC) ? " RHSC" : "",
213 (mask & OHCI_INTR_FNO) ? " FNO" : "",
214 (mask & OHCI_INTR_UE) ? " UE" : "",
215 (mask & OHCI_INTR_RD) ? " RD" : "",
216 (mask & OHCI_INTR_SF) ? " SF" : "",
217 (mask & OHCI_INTR_WDH) ? " WDH" : "",
218 (mask & OHCI_INTR_SO) ? " SO" : "");
221 static void maybe_print_eds(char *label, __u32 value)
223 struct ed *edp = (struct ed *) value;
226 dbg("%s %08x", label, value);
227 dbg("%08x", edp->hwINFO);
228 dbg("%08x", edp->hwTailP);
229 dbg("%08x", edp->hwHeadP);
230 dbg("%08x", edp->hwNextED);
234 static char *hcfs2string(int state)
239 case OHCI_USB_RESUME:
242 return "operational";
243 case OHCI_USB_SUSPEND:
249 /* dump control and status registers */
250 static void ohci_dump_status(struct ohci *controller)
252 struct ohci_regs *regs = controller->regs;
255 temp = readl(®s->revision) & 0xff;
257 dbg("spec %d.%d", (temp >> 4), (temp & 0x0f));
259 temp = readl(®s->control);
260 dbg("control: 0x%08x%s%s%s HCFS=%s%s%s%s%s CBSR=%d", temp,
261 (temp & OHCI_CTRL_RWE) ? " RWE" : "",
262 (temp & OHCI_CTRL_RWC) ? " RWC" : "",
263 (temp & OHCI_CTRL_IR) ? " IR" : "",
264 hcfs2string(temp & OHCI_CTRL_HCFS),
265 (temp & OHCI_CTRL_BLE) ? " BLE" : "",
266 (temp & OHCI_CTRL_CLE) ? " CLE" : "",
267 (temp & OHCI_CTRL_IE) ? " IE" : "",
268 (temp & OHCI_CTRL_PLE) ? " PLE" : "", temp & OHCI_CTRL_CBSR);
270 temp = readl(®s->cmdstatus);
271 dbg("cmdstatus: 0x%08x SOC=%d%s%s%s%s", temp,
272 (temp & OHCI_SOC) >> 16,
273 (temp & OHCI_OCR) ? " OCR" : "",
274 (temp & OHCI_BLF) ? " BLF" : "",
275 (temp & OHCI_CLF) ? " CLF" : "", (temp & OHCI_HCR) ? " HCR" : "");
277 ohci_dump_intr_mask("intrstatus", readl(®s->intrstatus));
278 ohci_dump_intr_mask("intrenable", readl(®s->intrenable));
280 maybe_print_eds("ed_periodcurrent", readl(®s->ed_periodcurrent));
282 maybe_print_eds("ed_controlhead", readl(®s->ed_controlhead));
283 maybe_print_eds("ed_controlcurrent", readl(®s->ed_controlcurrent));
285 maybe_print_eds("ed_bulkhead", readl(®s->ed_bulkhead));
286 maybe_print_eds("ed_bulkcurrent", readl(®s->ed_bulkcurrent));
288 maybe_print_eds("donehead", readl(®s->donehead));
291 static void ohci_dump_roothub(struct ohci *controller, int verbose)
295 temp = roothub_a(controller);
296 ndp = (temp & RH_A_NDP);
299 dbg("roothub.a: %08x POTPGT=%d%s%s%s%s%s NDP=%d", temp,
300 ((temp & RH_A_POTPGT) >> 24) & 0xff,
301 (temp & RH_A_NOCP) ? " NOCP" : "",
302 (temp & RH_A_OCPM) ? " OCPM" : "",
303 (temp & RH_A_DT) ? " DT" : "",
304 (temp & RH_A_NPS) ? " NPS" : "",
305 (temp & RH_A_PSM) ? " PSM" : "", ndp);
306 temp = roothub_b(controller);
307 dbg("roothub.b: %08x PPCM=%04x DR=%04x",
308 temp, (temp & RH_B_PPCM) >> 16, (temp & RH_B_DR)
310 temp = roothub_status(controller);
311 dbg("roothub.status: %08x%s%s%s%s%s%s",
313 (temp & RH_HS_CRWE) ? " CRWE" : "",
314 (temp & RH_HS_OCIC) ? " OCIC" : "",
315 (temp & RH_HS_LPSC) ? " LPSC" : "",
316 (temp & RH_HS_DRWE) ? " DRWE" : "",
317 (temp & RH_HS_OCI) ? " OCI" : "",
318 (temp & RH_HS_LPS) ? " LPS" : "");
321 for (i = 0; i < ndp; i++) {
322 temp = roothub_portstatus(controller, i);
323 dbg("roothub.portstatus [%d] = 0x%08x%s%s%s%s%s%s%s%s%s%s%s%s",
326 (temp & RH_PS_PRSC) ? " PRSC" : "",
327 (temp & RH_PS_OCIC) ? " OCIC" : "",
328 (temp & RH_PS_PSSC) ? " PSSC" : "",
329 (temp & RH_PS_PESC) ? " PESC" : "",
330 (temp & RH_PS_CSC) ? " CSC" : "",
331 (temp & RH_PS_LSDA) ? " LSDA" : "",
332 (temp & RH_PS_PPS) ? " PPS" : "",
333 (temp & RH_PS_PRS) ? " PRS" : "",
334 (temp & RH_PS_POCI) ? " POCI" : "",
335 (temp & RH_PS_PSS) ? " PSS" : "",
336 (temp & RH_PS_PES) ? " PES" : "",
337 (temp & RH_PS_CCS) ? " CCS" : "");
341 static void ohci_dump(struct ohci *controller, int verbose)
343 dbg("OHCI controller usb-%s state", controller->slot_name);
345 /* dumps some of the state we know about */
346 ohci_dump_status(controller);
348 ep_print_int_eds(controller, "hcca");
349 dbg("hcca frame #%04x", controller->hcca->frame_no);
350 ohci_dump_roothub(controller, 1);
355 /*-------------------------------------------------------------------------*
356 * Interface functions (URB)
357 *-------------------------------------------------------------------------*/
359 /* get a transfer request */
361 int sohci_submit_job(struct usb_device *dev, unsigned long pipe, void *buffer,
362 int transfer_len, struct devrequest *setup, int interval)
366 struct urb_priv *purb_priv;
371 /* when controller's hung, permit only roothub cleanup attempts
372 * such as powering down ports */
373 if (ohci->disabled) {
374 err("sohci_submit_job: EPIPE");
378 /* if we have an unfinished URB from previous transaction let's
379 * fail and scream as quickly as possible so as not to corrupt
380 * further communication */
382 err("sohci_submit_job: URB NOT FINISHED");
385 /* we're about to begin a new transaction here
386 so mark the URB unfinished */
389 /* every endpoint has a ed, locate and fill it */
390 ed = ep_add_ed(dev, pipe);
392 err("sohci_submit_job: ENOMEM");
396 /* for the private part of the URB we need the number of TDs (size) */
397 switch (usb_pipetype(pipe)) {
399 /* one TD for every 4096 Byte */
400 size = (transfer_len - 1) / 4096 + 1;
403 /* 1 TD for setup, 1 for ACK and 1 for every 4096 B */
404 size = (transfer_len == 0) ? 2 : (transfer_len - 1) / 4096 + 3;
408 if (size >= (N_URB_TD - 1)) {
409 err("need %d TDs, only have %d", size, N_URB_TD);
412 purb_priv = &urb_priv;
413 purb_priv->pipe = pipe;
415 /* fill the private part of the URB */
416 purb_priv->length = size;
418 purb_priv->actual_length = 0;
420 /* allocate the TDs */
421 /* note that td[0] was allocated in ep_add_ed */
422 for (i = 0; i < size; i++) {
423 purb_priv->td[i] = td_alloc(dev);
424 if (!purb_priv->td[i]) {
425 purb_priv->length = i;
426 urb_free_priv(purb_priv);
427 err("sohci_submit_job: ENOMEM");
432 if (ed->state == ED_NEW || (ed->state & ED_DEL)) {
433 urb_free_priv(purb_priv);
434 err("sohci_submit_job: EINVAL");
438 /* link the ed into a chain if is not already */
439 if (ed->state != ED_OPER)
442 /* fill the TDs and link it to the ed */
443 td_submit_job(dev, pipe, buffer, transfer_len, setup, purb_priv,
449 /*-------------------------------------------------------------------------*/
452 /* tell us the current USB frame number */
454 static int sohci_get_current_frame_number(struct usb_device *usb_dev)
456 struct ohci *ohci = &gohci;
458 return m16_swap(ohci->hcca->frame_no);
462 /*-------------------------------------------------------------------------*
463 * ED handling functions
464 *-------------------------------------------------------------------------*/
466 /* link an ed into one of the HC chains */
468 static int ep_link(struct ohci *ohci, struct ed *edi)
477 if (ohci->ed_controltail == NULL) {
478 writel((u32)ed, &ohci->regs->ed_controlhead);
480 ohci->ed_controltail->hwNextED = (__u32) m32_swap(ed);
482 ed->ed_prev = ohci->ed_controltail;
483 if (!ohci->ed_controltail && !ohci->ed_rm_list[0] &&
484 !ohci->ed_rm_list[1] && !ohci->sleeping) {
485 ohci->hc_control |= OHCI_CTRL_CLE;
486 writel(ohci->hc_control, &ohci->regs->control);
488 ohci->ed_controltail = edi;
493 if (ohci->ed_bulktail == NULL) {
494 writel((u32)ed, &ohci->regs->ed_bulkhead);
496 ohci->ed_bulktail->hwNextED = (__u32) m32_swap(ed);
498 ed->ed_prev = ohci->ed_bulktail;
499 if (!ohci->ed_bulktail && !ohci->ed_rm_list[0] &&
500 !ohci->ed_rm_list[1] && !ohci->sleeping) {
501 ohci->hc_control |= OHCI_CTRL_BLE;
502 writel(ohci->hc_control, &ohci->regs->control);
504 ohci->ed_bulktail = edi;
510 /*-------------------------------------------------------------------------*/
512 /* unlink an ed from one of the HC chains.
513 * just the link to the ed is unlinked.
514 * the link from the ed still points to another operational ed or 0
515 * so the HC can eventually finish the processing of the unlinked ed */
517 static int ep_unlink(struct ohci *ohci, struct ed *ed)
520 ed->hwINFO |= m32_swap(OHCI_ED_SKIP);
524 if (ed->ed_prev == NULL) {
526 ohci->hc_control &= ~OHCI_CTRL_CLE;
527 writel(ohci->hc_control, &ohci->regs->control);
529 writel(m32_swap(*((__u32 *) &ed->hwNextED)),
530 &ohci->regs->ed_controlhead);
532 ed->ed_prev->hwNextED = ed->hwNextED;
534 if (ohci->ed_controltail == ed) {
535 ohci->ed_controltail = ed->ed_prev;
537 next = (struct ed *)m32_swap(*((__u32 *)&ed->hwNextED));
538 next->ed_prev = ed->ed_prev;
543 if (ed->ed_prev == NULL) {
545 ohci->hc_control &= ~OHCI_CTRL_BLE;
546 writel(ohci->hc_control, &ohci->regs->control);
548 writel(m32_swap(*((__u32 *) &ed->hwNextED)),
549 &ohci->regs->ed_bulkhead);
551 ed->ed_prev->hwNextED = ed->hwNextED;
553 if (ohci->ed_bulktail == ed) {
554 ohci->ed_bulktail = ed->ed_prev;
556 next = (struct ed *)m32_swap(*((__u32 *)&ed->hwNextED));
557 next->ed_prev = ed->ed_prev;
561 ed->state = ED_UNLINK;
565 /*-------------------------------------------------------------------------*/
567 /* add/reinit an endpoint; this should be done once at the usb_set_configuration
568 * command, but the USB stack is a little bit stateless so we do it at every
569 * transaction. If the state of the ed is ED_NEW then a dummy td is added and
570 * the state is changed to ED_UNLINK. In all other cases the state is left
571 * unchanged. The ed info fields are setted anyway even though most of them
572 * should not change */
574 static struct ed *ep_add_ed(struct usb_device *usb_dev, unsigned long pipe)
580 ed = ed_ret = &ohci_dev.ed[(usb_pipeendpoint(pipe) << 1) |
581 (usb_pipecontrol(pipe) ? 0 :
584 if ((ed->state & ED_DEL) || (ed->state & ED_URB_DEL)) {
585 err("ep_add_ed: pending delete");
586 /* pending delete request */
590 if (ed->state == ED_NEW) {
591 ed->hwINFO = m32_swap(OHCI_ED_SKIP); /* skip ed */
592 /* dummy td; end of td list for ed */
593 td = td_alloc(usb_dev);
594 ed->hwTailP = (__u32) m32_swap(td);
595 ed->hwHeadP = ed->hwTailP;
596 ed->state = ED_UNLINK;
597 ed->type = usb_pipetype(pipe);
601 ed->hwINFO = m32_swap(usb_pipedevice(pipe)
602 | usb_pipeendpoint(pipe) << 7
603 | (usb_pipeisoc(pipe) ? 0x8000 : 0)
604 | (usb_pipecontrol(pipe) ? 0 :
605 (usb_pipeout(pipe) ? 0x800 : 0x1000))
606 | (usb_dev->speed == USB_SPEED_LOW) << 13 |
607 usb_maxpacket(usb_dev, pipe) << 16);
612 /*-------------------------------------------------------------------------*
613 * TD handling functions
614 *-------------------------------------------------------------------------*/
616 /* enqueue next TD for this URB (OHCI spec 5.2.8.2) */
618 static void td_fill(struct ohci *ohci, unsigned int info, void *data, int len,
619 struct usb_device *dev, int index,
620 struct urb_priv *urb_priv)
622 struct td *td, *td_pt;
623 #ifdef OHCI_FILL_TRACE
627 if (index > urb_priv->length) {
628 err("index > length");
631 /* use this td as the next dummy */
632 td_pt = urb_priv->td[index];
635 /* fill the old dummy TD */
636 td = urb_priv->td[index] =
637 (struct td *) (m32_swap(urb_priv->ed->hwTailP) & ~0xf);
639 td->ed = urb_priv->ed;
640 td->next_dl_td = NULL;
642 td->data = (__u32) data;
643 #ifdef OHCI_FILL_TRACE
644 if (usb_pipebulk(urb_priv->pipe) && usb_pipeout(urb_priv->pipe)) {
645 for (i = 0; i < len; i++)
646 printf("td->data[%d] %#2x ", i,
647 ((unsigned char *)td->data)[i]);
654 td->hwINFO = (__u32) m32_swap(info);
655 td->hwCBP = (__u32) m32_swap(data);
657 td->hwBE = (__u32) m32_swap(data + len - 1);
660 td->hwNextTD = (__u32) m32_swap(td_pt);
662 /* append to queue */
663 td->ed->hwTailP = td->hwNextTD;
666 /*-------------------------------------------------------------------------*/
668 /* prepare all TDs of a transfer */
670 static void td_submit_job(struct usb_device *dev, unsigned long pipe,
671 void *buffer, int transfer_len,
672 struct devrequest *setup, struct urb_priv *urb,
675 struct ohci *ohci = &gohci;
676 int data_len = transfer_len;
680 unsigned int toggle = 0;
682 /* OHCI handles the DATA-toggles itself, we just
683 use the USB-toggle bits for reseting */
684 if (usb_gettoggle(dev, usb_pipeendpoint(pipe), usb_pipeout(pipe))) {
685 toggle = TD_T_TOGGLE;
688 usb_settoggle(dev, usb_pipeendpoint(pipe), usb_pipeout(pipe),
697 switch (usb_pipetype(pipe)) {
699 info = usb_pipeout(pipe) ? TD_CC | TD_DP_OUT : TD_CC | TD_DP_IN;
700 while (data_len > 4096) {
701 td_fill(ohci, info | (cnt ? TD_T_TOGGLE : toggle), data,
702 4096, dev, cnt, urb);
707 info = usb_pipeout(pipe) ?
709 TD_CC | TD_R | TD_DP_IN;
710 td_fill(ohci, info | (cnt ? TD_T_TOGGLE : toggle), data,
711 data_len, dev, cnt, urb);
715 /* start bulk list */
716 writel(OHCI_BLF, &ohci->regs->cmdstatus);
720 info = TD_CC | TD_DP_SETUP | TD_T_DATA0;
721 td_fill(ohci, info, setup, 8, dev, cnt++, urb);
723 info = usb_pipeout(pipe) ?
724 TD_CC | TD_R | TD_DP_OUT | TD_T_DATA1 :
725 TD_CC | TD_R | TD_DP_IN | TD_T_DATA1;
726 /* NOTE: mishandles transfers >8K, some >4K */
727 td_fill(ohci, info, data, data_len, dev, cnt++, urb);
729 info = usb_pipeout(pipe) ?
730 TD_CC | TD_DP_IN | TD_T_DATA1 :
731 TD_CC | TD_DP_OUT | TD_T_DATA1;
732 td_fill(ohci, info, data, 0, dev, cnt++, urb);
734 /* start Control list */
735 writel(OHCI_CLF, &ohci->regs->cmdstatus);
738 if (urb->length != cnt)
739 dbg("TD LENGTH %d != CNT %d", urb->length, cnt);
742 /*-------------------------------------------------------------------------*
743 * Done List handling functions
744 *-------------------------------------------------------------------------*/
747 /* calculate the transfer length and update the urb */
749 static void dl_transfer_length(struct td *td)
752 struct urb_priv *lurb_priv = &urb_priv;
754 tdBE = m32_swap(td->hwBE);
755 tdCBP = m32_swap(td->hwCBP);
757 if (!(usb_pipecontrol(lurb_priv->pipe) &&
758 ((td->index == 0) || (td->index == lurb_priv->length - 1)))) {
761 lurb_priv->actual_length += tdBE - td->data + 1;
763 lurb_priv->actual_length += tdCBP - td->data;
768 /*-------------------------------------------------------------------------*/
770 /* replies to the request have to be on a FIFO basis so
771 * we reverse the reversed done-list */
773 static struct td *dl_reverse_done_list(struct ohci *ohci)
777 struct td *td_rev = NULL;
778 struct td *td_list = NULL;
779 struct urb_priv *lurb_priv = NULL;
781 td_list_hc = m32_swap(ohci->hcca->done_head) & 0xfffffff0;
782 ohci->hcca->done_head = 0;
785 td_list = (struct td *) td_list_hc;
787 if (TD_CC_GET(m32_swap(td_list->hwINFO))) {
788 lurb_priv = &urb_priv;
789 dbg(" USB-error/status: %x : %p",
790 TD_CC_GET(m32_swap(td_list->hwINFO)), td_list);
791 if (td_list->ed->hwHeadP & m32_swap(0x1)) {
793 ((td_list->index+1) < lurb_priv->length)) {
794 tmp = lurb_priv->length - 1;
795 td_list->ed->hwHeadP =
796 (lurb_priv->td[tmp]->hwNextTD &
797 m32_swap(0xfffffff0)) |
798 (td_list->ed->hwHeadP &
800 lurb_priv->td_cnt += lurb_priv->length -
803 td_list->ed->hwHeadP &=
804 m32_swap(0xfffffff2);
808 td_list->next_dl_td = td_rev;
810 td_list_hc = m32_swap(td_list->hwNextTD) & 0xfffffff0;
816 /*-------------------------------------------------------------------------*/
819 static int dl_done_list(struct ohci *ohci, struct td *td_list)
821 struct td *td_list_next = NULL;
826 struct urb_priv *lurb_priv;
827 __u32 tdINFO, edHeadP, edTailP;
830 td_list_next = td_list->next_dl_td;
832 lurb_priv = &urb_priv;
833 tdINFO = m32_swap(td_list->hwINFO);
837 dl_transfer_length(td_list);
839 /* error code of transfer */
840 cc = TD_CC_GET(tdINFO);
842 dbg("ConditionCode %#x", cc);
843 stat = cc_to_error[cc];
846 /* see if this done list makes for all TD's of current URB,
847 * and mark the URB finished if so */
848 if (++(lurb_priv->td_cnt) == lurb_priv->length) {
849 if ((ed->state & (ED_OPER | ED_UNLINK)))
852 dbg("dl_done_list: strange.., ED state %x, "
855 dbg("dl_done_list: processing TD %x, len %x\n",
856 lurb_priv->td_cnt, lurb_priv->length);
858 if (ed->state != ED_NEW) {
859 edHeadP = m32_swap(ed->hwHeadP) & 0xfffffff0;
860 edTailP = m32_swap(ed->hwTailP);
862 /* unlink eds if they are not busy */
863 if ((edHeadP == edTailP) && (ed->state == ED_OPER))
867 td_list = td_list_next;
872 /*-------------------------------------------------------------------------*
874 *-------------------------------------------------------------------------*/
876 #include <usbroothubdes.h>
878 /* Hub class-specific descriptor is constructed dynamically */
881 /*-------------------------------------------------------------------------*/
883 #define OK(x) len = (x); break
885 #define WR_RH_STAT(x) \
887 info("WR:status %#8x", (x)); \
888 writel((x), &gohci.regs->roothub.status); \
890 #define WR_RH_PORTSTAT(x) \
892 info("WR:portstatus[%d] %#8x", wIndex-1, (x)); \
893 writel((x), &gohci.regs->roothub.portstatus[wIndex-1]); \
896 #define WR_RH_STAT(x) \
897 writel((x), &gohci.regs->roothub.status)
898 #define WR_RH_PORTSTAT(x)\
899 writel((x), &gohci.regs->roothub.portstatus[wIndex-1])
901 #define RD_RH_STAT roothub_status(&gohci)
902 #define RD_RH_PORTSTAT roothub_portstatus(&gohci, wIndex-1)
904 /* request to virtual root hub */
906 int rh_check_port_status(struct ohci *controller)
912 temp = roothub_a(controller);
913 ndp = (temp & RH_A_NDP);
914 for (i = 0; i < ndp; i++) {
915 temp = roothub_portstatus(controller, i);
916 /* check for a device disconnect */
917 if (((temp & (RH_PS_PESC | RH_PS_CSC)) ==
918 (RH_PS_PESC | RH_PS_CSC)) && ((temp & RH_PS_CCS) == 0)) {
926 static int ohci_submit_rh_msg(struct usb_device *dev, unsigned long pipe,
927 void *buffer, int transfer_len,
928 struct devrequest *cmd)
931 int leni = transfer_len;
939 __u8 *data_buf = datab.byte;
946 urb_priv.actual_length = 0;
947 pkt_print(dev, pipe, buffer, transfer_len, cmd, "SUB(rh)",
952 if (usb_pipeint(pipe)) {
953 info("Root-Hub submit IRQ: NOT implemented");
957 bmRType_bReq = cmd->requesttype | (cmd->request << 8);
958 wValue = m16_swap(cmd->value);
959 wIndex = m16_swap(cmd->index);
960 wLength = m16_swap(cmd->length);
962 info("Root-Hub: adr: %2x cmd(%1x): %08x %04x %04x %04x",
963 dev->devnum, 8, bmRType_bReq, wValue, wIndex, wLength);
965 switch (bmRType_bReq) {
966 /* Request Destination:
967 without flags: Device,
968 RH_INTERFACE: interface,
969 RH_ENDPOINT: endpoint,
970 RH_CLASS means HUB here,
971 RH_OTHER | RH_CLASS almost ever means HUB_PORT here
975 datab.hword[0] = m16_swap(1);
977 case RH_GET_STATUS | RH_INTERFACE:
978 datab.hword[0] = m16_swap(0);
980 case RH_GET_STATUS | RH_ENDPOINT:
981 datab.hword[0] = m16_swap(0);
983 case RH_GET_STATUS | RH_CLASS:
985 m32_swap(RD_RH_STAT & ~(RH_HS_CRWE | RH_HS_DRWE));
987 case RH_GET_STATUS | RH_OTHER | RH_CLASS:
988 datab.word[0] = m32_swap(RD_RH_PORTSTAT);
991 case RH_CLEAR_FEATURE | RH_ENDPOINT:
993 case (RH_ENDPOINT_STALL):
998 case RH_CLEAR_FEATURE | RH_CLASS:
1000 case RH_C_HUB_LOCAL_POWER:
1002 case (RH_C_HUB_OVER_CURRENT):
1003 WR_RH_STAT(RH_HS_OCIC);
1008 case RH_CLEAR_FEATURE | RH_OTHER | RH_CLASS:
1010 case (RH_PORT_ENABLE):
1011 WR_RH_PORTSTAT(RH_PS_CCS);
1013 case (RH_PORT_SUSPEND):
1014 WR_RH_PORTSTAT(RH_PS_POCI);
1016 case (RH_PORT_POWER):
1017 WR_RH_PORTSTAT(RH_PS_LSDA);
1019 case (RH_C_PORT_CONNECTION):
1020 WR_RH_PORTSTAT(RH_PS_CSC);
1022 case (RH_C_PORT_ENABLE):
1023 WR_RH_PORTSTAT(RH_PS_PESC);
1025 case (RH_C_PORT_SUSPEND):
1026 WR_RH_PORTSTAT(RH_PS_PSSC);
1028 case (RH_C_PORT_OVER_CURRENT):
1029 WR_RH_PORTSTAT(RH_PS_OCIC);
1031 case (RH_C_PORT_RESET):
1032 WR_RH_PORTSTAT(RH_PS_PRSC);
1037 case RH_SET_FEATURE | RH_OTHER | RH_CLASS:
1039 case (RH_PORT_SUSPEND):
1040 WR_RH_PORTSTAT(RH_PS_PSS);
1042 case (RH_PORT_RESET): /* BUG IN HUP CODE ******** */
1043 if (RD_RH_PORTSTAT & RH_PS_CCS)
1044 WR_RH_PORTSTAT(RH_PS_PRS);
1046 case (RH_PORT_POWER):
1047 WR_RH_PORTSTAT(RH_PS_PPS);
1049 case (RH_PORT_ENABLE): /* BUG IN HUP CODE ******** */
1050 if (RD_RH_PORTSTAT & RH_PS_CCS)
1051 WR_RH_PORTSTAT(RH_PS_PES);
1056 case RH_SET_ADDRESS:
1057 gohci.rh.devnum = wValue;
1060 case RH_GET_DESCRIPTOR:
1061 switch ((wValue & 0xff00) >> 8) {
1062 case (0x01): /* device descriptor */
1063 len = min_t(unsigned int,
1066 sizeof(root_hub_dev_des), wLength));
1067 data_buf = root_hub_dev_des;
1069 case (0x02): /* configuration descriptor */
1070 len = min_t(unsigned int,
1073 sizeof(root_hub_config_des),
1075 data_buf = root_hub_config_des;
1077 case (0x03): /* string descriptors */
1078 if (wValue == 0x0300) {
1079 len = min_t(unsigned int,
1082 sizeof(root_hub_str_index0),
1084 data_buf = root_hub_str_index0;
1087 if (wValue == 0x0301) {
1088 len = min_t(unsigned int,
1091 sizeof(root_hub_str_index1),
1093 data_buf = root_hub_str_index1;
1097 stat = USB_ST_STALLED;
1101 case RH_GET_DESCRIPTOR | RH_CLASS:
1103 __u32 temp = roothub_a(&gohci);
1105 data_buf[0] = 9; /* min length; */
1107 data_buf[2] = temp & RH_A_NDP;
1109 if (temp & RH_A_PSM)
1110 /* per-port power switching? */
1112 if (temp & RH_A_NOCP)
1113 /* no overcurrent reporting? */
1114 data_buf[3] |= 0x10;
1115 else if (temp & RH_A_OCPM)
1116 /* per-port overcurrent reporting? */
1119 /* corresponds to data_buf[4-7] */
1121 data_buf[5] = (temp & RH_A_POTPGT) >> 24;
1122 temp = roothub_b(&gohci);
1123 data_buf[7] = temp & RH_B_DR;
1124 if (data_buf[2] < 7) {
1128 data_buf[8] = (temp & RH_B_DR) >> 8;
1129 data_buf[10] = data_buf[9] = 0xff;
1132 len = min_t(unsigned int, leni,
1133 min_t(unsigned int, data_buf[0], wLength));
1137 case RH_GET_CONFIGURATION:
1138 *(__u8 *) data_buf = 0x01;
1141 case RH_SET_CONFIGURATION:
1142 WR_RH_STAT(0x10000);
1146 dbg("unsupported root hub command");
1147 stat = USB_ST_STALLED;
1151 ohci_dump_roothub(&gohci, 1);
1156 len = min_t(int, len, leni);
1157 if (data != data_buf)
1158 memcpy(data, data_buf, len);
1164 urb_priv.actual_length = transfer_len;
1165 pkt_print(dev, pipe, buffer, transfer_len, cmd, "RET(rh)",
1166 0 /*usb_pipein(pipe) */);
1174 /*-------------------------------------------------------------------------*/
1176 /* common code for handling submit messages - used for all but root hub */
1178 int submit_common_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
1179 int transfer_len, struct devrequest *setup, int interval)
1182 int maxsize = usb_maxpacket(dev, pipe);
1185 /* device pulled? Shortcut the action. */
1186 if (devgone == dev) {
1187 dev->status = USB_ST_CRC_ERR;
1191 urb_priv.actual_length = 0;
1192 pkt_print(dev, pipe, buffer, transfer_len, setup, "SUB",
1198 err("submit_common_message: pipesize for pipe %lx is zero",
1203 if (sohci_submit_job(dev, pipe, buffer, transfer_len, setup, interval) <
1205 err("sohci_submit_job failed");
1210 /* ohci_dump_status(&gohci); */
1212 /* allow more time for a BULK device to react - some are slow */
1213 #define BULK_TO 5000 /* timeout in milliseconds */
1214 if (usb_pipebulk(pipe))
1219 /* wait for it to complete */
1221 /* check whether the controller is done */
1222 stat = hc_interrupt();
1225 stat = USB_ST_CRC_ERR;
1229 /* NOTE: since we are not interrupt driven in U-Boot and always
1230 * handle only one URB at a time, we cannot assume the
1231 * transaction finished on the first successful return from
1232 * hc_interrupt().. unless the flag for current URB is set,
1233 * meaning that all TD's to/from device got actually
1234 * transferred and processed. If the current URB is not
1235 * finished we need to re-iterate this loop so as
1236 * hc_interrupt() gets called again as there needs to be some
1237 * more TD's to process still */
1238 if ((stat >= 0) && (stat != 0xff) && (urb_finished)) {
1239 /* 0xff is returned for an SF-interrupt */
1249 err("CTL:TIMEOUT ");
1250 dbg("submit_common_msg: TO status %x\n", stat);
1251 stat = USB_ST_CRC_ERR;
1258 /* we got an Root Hub Status Change interrupt */
1261 ohci_dump_roothub(&gohci, 1);
1265 timeout = rh_check_port_status(&gohci);
1267 #if 0 /* this does nothing useful, but leave it here
1268 in case that changes */
1269 /* the called routine adds 1 to the passed value */
1270 usb_hub_port_connect_change(gohci.rh.dev, timeout - 1);
1274 * This is potentially dangerous because it assumes
1275 * that only one device is ever plugged in!
1283 dev->act_len = transfer_len;
1286 pkt_print(dev, pipe, buffer, transfer_len, setup, "RET(ctlr)",
1292 /* free TDs in urb_priv */
1293 urb_free_priv(&urb_priv);
1297 /* submit routines called from usb.c */
1298 int submit_bulk_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
1301 info("submit_bulk_msg");
1302 return submit_common_msg(dev, pipe, buffer, transfer_len, NULL, 0);
1305 int submit_control_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
1306 int transfer_len, struct devrequest *setup)
1308 int maxsize = usb_maxpacket(dev, pipe);
1310 info("submit_control_msg");
1312 urb_priv.actual_length = 0;
1313 pkt_print(dev, pipe, buffer, transfer_len, setup, "SUB",
1319 err("submit_control_message: pipesize for pipe %lx is zero",
1323 if (((pipe >> 8) & 0x7f) == gohci.rh.devnum) {
1325 /* root hub - redirect */
1326 return ohci_submit_rh_msg(dev, pipe, buffer, transfer_len,
1330 return submit_common_msg(dev, pipe, buffer, transfer_len, setup, 0);
1333 int submit_int_msg(struct usb_device *dev, unsigned long pipe, void *buffer,
1334 int transfer_len, int interval)
1336 info("submit_int_msg");
1340 /*-------------------------------------------------------------------------*
1342 *-------------------------------------------------------------------------*/
1344 /* reset the HC and BUS */
1346 static int hc_reset(struct ohci *ohci)
1349 int smm_timeout = 50; /* 0,5 sec */
1351 if (readl(&ohci->regs->control) & OHCI_CTRL_IR) {
1352 /* SMM owns the HC - request ownership */
1353 writel(OHCI_OCR, &ohci->regs->cmdstatus);
1354 info("USB HC TakeOver from SMM");
1355 while (readl(&ohci->regs->control) & OHCI_CTRL_IR) {
1357 if (--smm_timeout == 0) {
1358 err("USB HC TakeOver failed!");
1364 /* Disable HC interrupts */
1365 writel(OHCI_INTR_MIE, &ohci->regs->intrdisable);
1367 dbg("USB HC reset_hc usb-%s: ctrl = 0x%X ;",
1368 ohci->slot_name, readl(&ohci->regs->control));
1370 /* Reset USB (needed by some controllers) */
1371 writel(0, &ohci->regs->control);
1373 /* HC Reset requires max 10 us delay */
1374 writel(OHCI_HCR, &ohci->regs->cmdstatus);
1375 while ((readl(&ohci->regs->cmdstatus) & OHCI_HCR) != 0) {
1376 if (--timeout == 0) {
1377 err("USB HC reset timed out!");
1385 /*-------------------------------------------------------------------------*/
1387 /* Start an OHCI controller, set the BUS operational
1389 * connect the virtual root hub */
1391 static int hc_start(struct ohci *ohci)
1394 unsigned int fminterval;
1398 /* Tell the controller where the control and bulk lists are
1399 * The lists are empty now. */
1401 writel(0, &ohci->regs->ed_controlhead);
1402 writel(0, &ohci->regs->ed_bulkhead);
1404 /* a reset clears this */
1405 writel((__u32) ohci->hcca, &ohci->regs->hcca);
1407 fminterval = 0x2edf;
1408 writel((fminterval * 9) / 10, &ohci->regs->periodicstart);
1409 fminterval |= ((((fminterval - 210) * 6) / 7) << 16);
1410 writel(fminterval, &ohci->regs->fminterval);
1411 writel(0x628, &ohci->regs->lsthresh);
1413 /* start controller operations */
1414 ohci->hc_control = OHCI_CONTROL_INIT | OHCI_USB_OPER;
1416 writel(ohci->hc_control, &ohci->regs->control);
1418 /* disable all interrupts */
1419 mask = (OHCI_INTR_SO | OHCI_INTR_WDH | OHCI_INTR_SF | OHCI_INTR_RD |
1420 OHCI_INTR_UE | OHCI_INTR_FNO | OHCI_INTR_RHSC |
1421 OHCI_INTR_OC | OHCI_INTR_MIE);
1422 writel(mask, &ohci->regs->intrdisable);
1423 /* clear all interrupts */
1424 mask &= ~OHCI_INTR_MIE;
1425 writel(mask, &ohci->regs->intrstatus);
1426 /* Choose the interrupts we care about now - but w/o MIE */
1427 mask = OHCI_INTR_RHSC | OHCI_INTR_UE | OHCI_INTR_WDH | OHCI_INTR_SO;
1428 writel(mask, &ohci->regs->intrenable);
1431 /* required for AMD-756 and some Mac platforms */
1432 writel((roothub_a(ohci) | RH_A_NPS) & ~RH_A_PSM,
1433 &ohci->regs->roothub.a);
1434 writel(RH_HS_LPSC, &ohci->regs->roothub.status);
1435 #endif /* OHCI_USE_NPS */
1437 /* POTPGT delay is bits 24-31, in 2 ms units. */
1438 mdelay((roothub_a(ohci) >> 23) & 0x1fe);
1440 /* connect the virtual root hub */
1441 ohci->rh.devnum = 0;
1446 /*-------------------------------------------------------------------------*/
1448 /* an interrupt happens */
1450 static int hc_interrupt(void)
1452 struct ohci *ohci = &gohci;
1453 struct ohci_regs *regs = ohci->regs;
1457 if ((ohci->hcca->done_head != 0) &&
1458 !(m32_swap(ohci->hcca->done_head) & 0x01)) {
1460 ints = OHCI_INTR_WDH;
1463 ints = readl(®s->intrstatus);
1464 if (ints == ~(u32) 0) {
1466 err("%s device removed!", ohci->slot_name);
1469 ints &= readl(®s->intrenable);
1471 dbg("hc_interrupt: returning..\n");
1476 /* dbg("Interrupt: %x frame: %x", ints,
1477 le16_to_cpu(ohci->hcca->frame_no)); */
1479 if (ints & OHCI_INTR_RHSC) {
1484 if (ints & OHCI_INTR_UE) {
1486 err("OHCI Unrecoverable Error, controller usb-%s disabled",
1488 /* e.g. due to PCI Master/Target Abort */
1495 /* FIXME: be optimistic, hope that bug won't repeat often. */
1496 /* Make some non-interrupt context restart the controller. */
1497 /* Count and limit the retries though; either hardware or */
1498 /* software errors can go forever... */
1503 if (ints & OHCI_INTR_WDH) {
1506 writel(OHCI_INTR_WDH, ®s->intrdisable);
1507 stat = dl_done_list(&gohci, dl_reverse_done_list(&gohci));
1508 writel(OHCI_INTR_WDH, ®s->intrenable);
1511 if (ints & OHCI_INTR_SO) {
1512 dbg("USB Schedule overrun\n");
1513 writel(OHCI_INTR_SO, ®s->intrenable);
1517 /* FIXME: this assumes SOF (1/ms) interrupts don't get lost... */
1518 if (ints & OHCI_INTR_SF) {
1519 unsigned int frame = m16_swap(ohci->hcca->frame_no) & 1;
1521 writel(OHCI_INTR_SF, ®s->intrdisable);
1522 if (ohci->ed_rm_list[frame] != NULL)
1523 writel(OHCI_INTR_SF, ®s->intrenable);
1527 writel(ints, ®s->intrstatus);
1531 /*-------------------------------------------------------------------------*/
1533 /*-------------------------------------------------------------------------*/
1535 /* De-allocate all resources.. */
1537 static void hc_release_ohci(struct ohci *ohci)
1539 dbg("USB HC release ohci usb-%s", ohci->slot_name);
1541 if (!ohci->disabled)
1545 /*-------------------------------------------------------------------------*/
1548 * low level initalisation routine, called from usb.c
1550 static char ohci_inited = 0;
1552 int usb_lowlevel_init(int index, enum usb_init_type init, void **controller)
1554 struct s3c24x0_clock_power *clk_power = s3c24x0_get_base_clock_power();
1555 struct s3c24x0_gpio *gpio = s3c24x0_get_base_gpio();
1558 * Set the 48 MHz UPLL clocking. Values are taken from
1559 * "PLL value selection guide", 6-23, s3c2400_UM.pdf.
1561 clk_power->upllcon = ((40 << 12) + (1 << 4) + 2);
1562 gpio->misccr |= 0x8; /* 1 = use pads related USB for USB host */
1565 * Enable USB host clock.
1567 clk_power->clkcon |= (1 << 4);
1569 memset(&gohci, 0, sizeof(struct ohci));
1570 memset(&urb_priv, 0, sizeof(struct urb_priv));
1572 /* align the storage */
1573 if ((__u32) &ghcca[0] & 0xff) {
1574 err("HCCA not aligned!!");
1578 info("aligned ghcca %p", phcca);
1579 memset(&ohci_dev, 0, sizeof(struct ohci_device));
1580 if ((__u32) &ohci_dev.ed[0] & 0x7) {
1581 err("EDs not aligned!!");
1584 memset(gtd, 0, sizeof(struct td) * (NUM_TD + 1));
1585 if ((__u32) gtd & 0x7) {
1586 err("TDs not aligned!!");
1591 memset(phcca, 0, sizeof(struct ohci_hcca));
1596 gohci.regs = (struct ohci_regs *)S3C24X0_USB_HOST_BASE;
1599 gohci.slot_name = "s3c2400";
1601 if (hc_reset(&gohci) < 0) {
1602 hc_release_ohci(&gohci);
1603 /* Initialization failed */
1604 clk_power->clkcon &= ~(1 << 4);
1608 /* FIXME this is a second HC reset; why?? */
1609 gohci.hc_control = OHCI_USB_RESET;
1610 writel(gohci.hc_control, &gohci.regs->control);
1613 if (hc_start(&gohci) < 0) {
1614 err("can't start usb-%s", gohci.slot_name);
1615 hc_release_ohci(&gohci);
1616 /* Initialization failed */
1617 clk_power->clkcon &= ~(1 << 4);
1621 ohci_dump(&gohci, 1);
1631 int usb_lowlevel_stop(int index)
1633 struct s3c24x0_clock_power *clk_power = s3c24x0_get_base_clock_power();
1635 /* this gets called really early - before the controller has */
1636 /* even been initialized! */
1639 /* TODO release any interrupts, etc. */
1640 /* call hc_release_ohci() here ? */
1642 /* may not want to do this */
1643 clk_power->clkcon &= ~(1 << 4);
1647 #endif /* defined(CONFIG_USB_OHCI) && defined(CONFIG_S3C24X0) */
1649 #if defined(CONFIG_USB_OHCI_NEW) && \
1650 defined(CONFIG_SYS_USB_OHCI_CPU_INIT) && \
1651 defined(CONFIG_S3C24X0)
1653 int usb_cpu_init(void)
1655 struct s3c24x0_clock_power *clk_power = s3c24x0_get_base_clock_power();
1656 struct s3c24x0_gpio *gpio = s3c24x0_get_base_gpio();
1659 * Set the 48 MHz UPLL clocking. Values are taken from
1660 * "PLL value selection guide", 6-23, s3c2400_UM.pdf.
1662 writel((40 << 12) + (1 << 4) + 2, &clk_power->upllcon);
1663 /* 1 = use pads related USB for USB host */
1664 writel(readl(&gpio->misccr) | 0x8, &gpio->misccr);
1667 * Enable USB host clock.
1669 writel(readl(&clk_power->clkcon) | (1 << 4), &clk_power->clkcon);
1674 int usb_cpu_stop(void)
1676 struct s3c24x0_clock_power *clk_power = s3c24x0_get_base_clock_power();
1677 /* may not want to do this */
1678 writel(readl(&clk_power->clkcon) & ~(1 << 4), &clk_power->clkcon);
1682 int usb_cpu_init_fail(void)
1684 struct s3c24x0_clock_power *clk_power = s3c24x0_get_base_clock_power();
1685 writel(readl(&clk_power->clkcon) & ~(1 << 4), &clk_power->clkcon);
1689 #endif /* defined(CONFIG_USB_OHCI_NEW) && \
1690 defined(CONFIG_SYS_USB_OHCI_CPU_INIT) && \
1691 defined(CONFIG_S3C24X0) */