From: Björn Lundberg <bjorn.lundberg@inu.se>
To: Dan Malek <dan@netx4.com>
Cc: Steve Calfee <calfee@kerbango.com>,
"linuxppc-embedded@lists.linuxppc.org"
<linuxppc-embedded@lists.linuxppc.org>,
"Brad Parker (USB850)" <brad@parker.boston.ma.us>
Subject: Re: USB driver for MPC850/823
Date: Thu, 09 Mar 2000 13:30:13 +0100 [thread overview]
Message-ID: <38C79955.9D538D7D@inu.se> (raw)
In-Reply-To: 38C7368A.7B28E61E@netx4.com
[-- Attachment #1: Type: text/plain, Size: 604 bytes --]
The simple reason (makes me blush) why buffers in SDRAM didn't work was
beacuse I omitted to flush the cache. (Thanks Brad and Malek)
I did a quick change and an even quicker test.
Patch attached.
Cheers
Bjorn
Dan Malek wrote:
>
snip
>
> When using the CPM on the 8xx, you have to be careful about the cache
> attributes on the pages as the 8xx doesn't have bus snooping to ensure
> coherency. I use a couple of different methods to get memory allocated
> in the kernel for the CPM, sometimes they are cached and require software
> management, other times not cached. Depends upon how it is used.
>
[-- Attachment #2: patch-8xxhci.c-SDRAM.diff --]
[-- Type: text/plain, Size: 3249 bytes --]
--- ../usb.8xx_io/8xxhci.c Tue Mar 7 13:31:50 2000
+++ 8xxhci.c Thu Mar 9 13:06:43 2000
@@ -55,8 +55,10 @@
#ifdef BUF_IN_DPRAM
#define BD_BUFADDR(bdp) ((unsigned char*)((bdp)->cbd_bufaddr))
+#define BD_RELEASE(bdpbuf)
#else /* buffs in sdram */
#define BD_BUFADDR(bdp) ((unsigned char*)__va((bdp)->cbd_bufaddr))
+#define BD_RELEASE(bdpbuf) flush_dcache_range((int)bdpbuf, (int)bdpbuf + PKT_BUF_SIZE)
#endif
#define MY_USMOD (USMOD_HOST | USMOD_EN) /* | USMOD_TEST) */
@@ -314,6 +316,7 @@
return 0;
}
+#if NOT_USED
/*
* Lets define a set of functions that can help us terminate messages
* that are put here for periodic (rescheduled) transfer
@@ -346,6 +349,7 @@
remove_wait_queue(&terminate_wakeup, &wait);
}
+#endif
/*
* Called from outside to stop an interrupt message
@@ -353,9 +357,8 @@
int cpm_hci_release_irq(struct usb_device *usb_dev, void *_irp)
{
struct cpm_hci_irp *irp = (struct cpm_hci_irp*)_irp;
- struct cpm_hci *cpm_hci = irp->dev->cpm_hci;
struct cpm_hci_device *dev = usb_to_cpm_hci(usb_dev);
- unsigned long flags;
+ // unsigned long flags;
if (!irp)
return USB_ST_INTERNALERROR;
@@ -602,8 +605,7 @@
{
struct cpm_hci_irp *irp = (struct cpm_hci_irp*)_irp;
struct cpm_hci_device *dev = usb_to_cpm_hci(usb_dev);
- struct cpm_hci *cpm_hci = irp->dev->cpm_hci;
- unsigned long flags;
+ // unsigned long flags;
if (!irp) {
printk("USB: cpm_hci_terminate_bulk irp == NULL\n");
@@ -846,6 +848,7 @@
bdpbuf[0] = tok;
bdpbuf[1] = (__u8)(tok_data & 0x00ff);
bdpbuf[2] = (__u8)(tok_data >> 8);
+ BD_RELEASE(bdpbuf);
bdp->cbd_datlen = 3;
bdp->cbd_sc &= BD_USB_TX_WRAP; /* clear all but wrap-bit */
bdp->cbd_sc |= (BD_USB_TX_LAST); /* this is the last buffer in msg */
@@ -872,6 +875,7 @@
bdpbuf[0] = PID_SOF;
bdpbuf[1] = (__u8)(tok_data & 0x00ff);
bdpbuf[2] = (__u8)(tok_data >> 8);
+ BD_RELEASE(bdpbuf);
bdp->cbd_datlen = 3;
bdp->cbd_sc &= BD_USB_TX_WRAP; /* clear all but wrap-bit */
bdp->cbd_sc |= (BD_USB_TX_LAST); /* this is the last buffer in msg */
@@ -894,6 +898,7 @@
bdp->cbd_datlen = n;
memcpy(BD_BUFADDR(bdp), irp->data + irp->datadone, n);
+ BD_RELEASE(BD_BUFADDR(bdp));
bdp->cbd_sc &= BD_USB_TX_WRAP; /* clear all but wrap-bit */
bdp->cbd_sc |= (BD_USB_TX_LAST); /* this is the last buffer in msg */
bdp->cbd_sc |= (BD_USB_TX_INTR); /* generate interrupt */
@@ -1063,6 +1068,7 @@
pr_debug("cpm_hci_do_resend: memcpy( %p, %p, %d)\n",
BD_BUFADDR(bdp), BD_BUFADDR(bdp_failed), bdp_failed->cbd_datlen);
memcpy(BD_BUFADDR(bdp), BD_BUFADDR(bdp_failed), bdp_failed->cbd_datlen);
+ BD_RELEASE(BD_BUFADDR(bdp));
bdp->cbd_datlen = bdp_failed->cbd_datlen;
/* get all but wrap- and status-bits
@@ -1160,6 +1166,7 @@
// pr_debug("cpm_hci_do_resend: memcpy( %p, %p, %d)\n",
// BD_BUFADDR(bdp), irp->bdp[i].buf, irp->bdp[i].datlen);
memcpy(BD_BUFADDR(bdp), irp->bdp[i].buf, irp->bdp[i].datlen);
+ BD_RELEASE(BD_BUFADDR(bdp));
bdp->cbd_datlen = irp->bdp[i].datlen;
@@ -1204,6 +1211,7 @@
bdp = next_tx_bd(bdp, cpm_hci);
bdp->cbd_datlen = irp->cmdlen;
memcpy(BD_BUFADDR(bdp), &irp->cmd, irp->cmdlen);
+ BD_RELEASE(BD_BUFADDR(bdp));
/*
* We'll use the tx irq the wakeupcall
*/
next prev parent reply other threads:[~2000-03-09 12:30 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2000-03-08 9:35 USB driver for MPC850/823 Bjvrn Lundberg
2000-03-08 23:53 ` Steve Calfee
2000-03-09 5:28 ` Dan Malek
2000-03-09 12:30 ` Björn Lundberg [this message]
2000-03-09 15:34 ` Richard Hendricks
2000-03-09 16:30 ` Dan Malek
2000-03-09 17:14 ` Richard Hendricks
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=38C79955.9D538D7D@inu.se \
--to=bjorn.lundberg@inu.se \
--cc=brad@parker.boston.ma.us \
--cc=calfee@kerbango.com \
--cc=dan@netx4.com \
--cc=linuxppc-embedded@lists.linuxppc.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).