[Armadeus-commitlog] SF.net SVN: armadeus: [671] trunk/target/linux/modules/isp1761
Brought to you by:
sszy
|
From: <th...@us...> - 2007-11-05 19:38:16
|
Revision: 671
http://armadeus.svn.sourceforge.net/armadeus/?rev=671&view=rev
Author: thom25
Date: 2007-11-05 11:38:07 -0800 (Mon, 05 Nov 2007)
Log Message:
-----------
add ISP176x USB HOST controller
Modified Paths:
--------------
trunk/target/linux/modules/isp1761/apf9328-isp1761.c
trunk/target/linux/modules/isp1761/hal/hal_imx.c
trunk/target/linux/modules/isp1761/hal/hal_intf.h
trunk/target/linux/modules/isp1761/host/itdptd.c
trunk/target/linux/modules/isp1761/host/pehci.c
trunk/target/linux/modules/isp1761/host/qtdptd.c
Modified: trunk/target/linux/modules/isp1761/apf9328-isp1761.c
===================================================================
--- trunk/target/linux/modules/isp1761/apf9328-isp1761.c 2007-11-04 09:10:24 UTC (rev 670)
+++ trunk/target/linux/modules/isp1761/apf9328-isp1761.c 2007-11-05 19:38:07 UTC (rev 671)
@@ -9,20 +9,104 @@
#include <asm/hardware.h>
#include <asm/arch/imx-regs.h>
#include <asm/delay.h>
+#include <linux/usb/isp116x.h>
-//#include <asm/arch/gumstix.h>
+#define ISP1761_BASE IMX_CS3_PHYS
+#define ISP1761_GPIO_IRQ GPIO_PORTC | 10
+#define ISP1761_IRQ IRQ_GPIOC(10)
-#define ISP1761_BASE IMX_CS2_PHYS
-#define ISP1761_GPIO_RESET 52
-#define ISP1761_GPIO_IRQ 11
-#define ISP1761_IRQ IRQ_GPIOD(ISP1761_GPIO_IRQ) // ???
-#define ISP1761_GPIO_CS 666 // ??? GPIO78_nCS_2_MD
+#define CS3U 0x18 /*chip select 3 upper register */
+#define CS3L 0x1C /*chip select 3 lower register */
-//
-// !! A terme ce fichier devra être inclu dans notre apf9328.c mais pour l'instant laisse le là Nico !!
-//
+#define CONFIG_SYS_BUS_FREQ 96 /* 96|48... MHz (BCLOCK and HCLOCK) */
+#define CFG_HCLK_LGTH (1000/CONFIG_SYS_BUS_FREQ) /* ns */
-static struct resource m6_isp1761_resources[] = {
+
+
+/* CS3 configuration for ISP176x USB Host */
+#define CFG_CS3_CHIP_SELECT_ENABLE 1 /* 1 : enable CS0 peripherals */
+#define CFG_CS3_PIN_ASSERT 0 /* chip select pin state when */
+ /* chip select disabled */
+#define CFG_CS3_DATA_PORT_SIZE 0x5 /* 5=16 bits on D[15:0] pins */
+ /* 3=8bits on D[7:0] 6=32 bits..*/
+#define CFG_CS3_SUPERVISOR_PROTECT 0 /* 1 : user mode access prohibited*/
+#define CFG_CS3_WRITE_PROTECT 0 /* 1 : write access prohibited */
+#define CFG_CS3_EB_SIGNAL_CONTROL_WRITE 1 /* 1 when EB is used as write signal*/
+
+#define CFG_CS3_READ_CYC_LGTH 95 /* ns */
+#define CFG_CS3_OE_ASSERT_DLY 35 /* ns */
+#define CFG_CS3_OE_NEG_DLY 30 /* ns */
+
+#define CFG_CS3_CS_NEG_LGTH 30 /* max 30 ns CS HIGH to CS LOW at 100MHz*/
+#define CFG_CS3_XTRA_DEAD_CYC 0 /* ns from CS HIGH to tristate bus */
+
+#define CFG_CS3_WRITE_XTRA_LGTH 0 /* ns */
+#define CFG_CS3_EB_ASSERT_DLY 5 /* ns */
+#define CFG_CS3_EB_NEG_DLY 65 /* ns */
+#define CFG_CS3_CS_ASSERT_NEG_DLY 0 /* ns */
+
+#define CFG_CS3_SYNC_ENABLE 0 /* enable synchronous burst mode*/
+#define CFG_CS3_SYNC_PAGE_MODE_EMUL 0 /* enable page mode emulation */
+#define CFG_CS3_SYNC_PAGE_SIZE 0 /* 4 words page size (8bytes) */
+#define CFG_CS3_SYNC_BURST_CLK_START 0 /* 0 ns burst clock delay */
+#define CFG_CS3_SYNC_BURST_CLK_DIV 0 /* 0 : divider is 1 */
+#define CFG_CS3_SYNC_DAT_OUT_LGTH 0 /* ns */
+
+
+#define CFG_CS3U_VAL\
+ ((((CFG_CS3_XTRA_DEAD_CYC+CFG_HCLK_LGTH-1)/CFG_HCLK_LGTH)&0x0F)\
+ |((((CFG_CS3_WRITE_XTRA_LGTH+CFG_HCLK_LGTH-1)/CFG_HCLK_LGTH)&0x0F)<<4)\
+ |(((((CFG_CS3_READ_CYC_LGTH+CFG_HCLK_LGTH-1)/CFG_HCLK_LGTH)-1)&0x3F)<<8)\
+ |((((CFG_CS3_CS_NEG_LGTH+CFG_HCLK_LGTH-1)/CFG_HCLK_LGTH)&0x03)<<14)\
+ |((((CFG_CS3_SYNC_DAT_OUT_LGTH+CFG_HCLK_LGTH-1)/CFG_HCLK_LGTH)&0x0F)<<16)\
+ |((CFG_CS3_SYNC_ENABLE&0x01)<<20)\
+ |((CFG_CS3_SYNC_PAGE_MODE_EMUL&0x01)<<21)\
+ |((CFG_CS3_SYNC_PAGE_SIZE&0x03)<<22)\
+ |((((CFG_CS3_SYNC_BURST_CLK_START+CFG_HCLK_LGTH-1)/CFG_HCLK_LGTH)&0x0F)<<24)\
+ |((CFG_CS3_SYNC_BURST_CLK_DIV&0x03)<<28))
+
+#define CFG_CS3L_VAL\
+ ((CFG_CS3_CHIP_SELECT_ENABLE&0x01)\
+ |((CFG_CS3_PIN_ASSERT&0x01)<<1)\
+ |((CFG_CS3_WRITE_PROTECT&0x01)<<4)\
+ |((CFG_CS3_SUPERVISOR_PROTECT&0x01)<<6)\
+ |((CFG_CS3_DATA_PORT_SIZE&0x07)<<8)\
+ |((CFG_CS3_EB_SIGNAL_CONTROL_WRITE&0x01)<<11)\
+ |((((CFG_CS3_CS_ASSERT_NEG_DLY+CFG_HCLK_LGTH-1)/CFG_HCLK_LGTH)&0x0F)<<12)\
+ |(((((CFG_CS3_EB_NEG_DLY*2)+CFG_HCLK_LGTH-1)/CFG_HCLK_LGTH)&0x0F)<<16)\
+ |(((((CFG_CS3_EB_ASSERT_DLY*2)+CFG_HCLK_LGTH-1)/CFG_HCLK_LGTH)&0x0F)<<20)\
+ |(((((CFG_CS3_OE_NEG_DLY*2)+CFG_HCLK_LGTH-1)/CFG_HCLK_LGTH)&0x0F)<<24)\
+ |(((((CFG_CS3_OE_ASSERT_DLY*2)+CFG_HCLK_LGTH-1)/CFG_HCLK_LGTH)&0x0F)<<28))
+
+
+
+static void apf_isp116x_delay(struct device *dev, int delay)
+{
+ /* On this platform, we work with 200MHz clock, giving
+ 5 ns per instruction. The cycle below involves 2
+ instructions and we lose 2 more instruction times due
+ to pipeline flush at jump. I.e., we consume 20 ns
+ per cycle.
+ */
+ int cyc = delay / 20;
+
+ __asm__ volatile ("0:\n"
+ " subs %0, %1, #1\n"
+ " bge 0b\n"
+ :"=r" (cyc)
+ :"0"(cyc));
+}
+
+static struct isp116x_platform_data isp116x_pdata = {
+ .sel15Kres = 1,
+ .oc_enable = 1,
+ .int_act_high = 0,
+ .int_edge_triggered = 1,
+ .remote_wakeup_enable = 1,
+ .delay = apf_isp116x_delay,
+};
+
+static struct resource devfull_isp1761_resources[] = {
[0] = {
.name = "isp1761-regs",
.start = ISP1761_BASE + 0x00000000,
@@ -36,45 +120,39 @@
},
};
-static struct platform_device m6_isp1761_device = {
+static struct platform_device devfull_isp1761_device = {
.name = "isp1761",
.id = 0,
- .num_resources = ARRAY_SIZE(m6_isp1761_resources),
- .resource = m6_isp1761_resources,
+ .num_resources = ARRAY_SIZE(devfull_isp1761_resources),
+ .resource = devfull_isp1761_resources,
+ .dev = { .platform_data = &isp116x_pdata, },
};
-static struct platform_device *m6_isp1761_devices[] = {
- &m6_isp1761_device,
+static struct platform_device *devfull_isp1761_devices[] = {
+ &devfull_isp1761_device,
};
-int __init m6_isp1761_init(void)
+int __init devfull_isp1761_init(void)
{
- unsigned int num_devices=ARRAY_SIZE(m6_isp1761_devices);
-
- imx_gpio_mode( GPIO_PORTD | 8 | GPIO_IN | GPIO_GIUS ); /* Set up nPWE */
- imx_gpio_mode( ISP1761_GPIO_CS ); /* Set up chip-select line. */
- imx_gpio_mode( ISP1761_GPIO_RESET | GPIO_OUT ); /* Set up reset line. */
- imx_gpio_mode( ISP1761_GPIO_IRQ | GPIO_IN ); /* Set up IRQ line. */
-
+ unsigned int num_devices=ARRAY_SIZE(devfull_isp1761_devices);
+ /* configure the chip select 3 */
+ __REG(IMX_EIM_BASE + CS3U + IMX_IO_BASE) = CFG_CS3U_VAL; //CSU
+ __REG(IMX_EIM_BASE + CS3L + IMX_IO_BASE) = CFG_CS3L_VAL; //CSL
+ imx_gpio_mode( ISP1761_GPIO_IRQ | GPIO_IN | GPIO_GIUS ); /* Set up IRQ line. */
set_irq_type( ISP1761_IRQ, IRQF_TRIGGER_FALLING );
- /* Reset the chip (hold low for 1ms). */
-// GPCR(ISP1761_GPIO_RESET) = GPIO_bit(ISP1761_GPIO_RESET);
-// udelay(1000);
-// GPSR(ISP1761_GPIO_RESET) = GPIO_bit(ISP1761_GPIO_RESET);
-
- return platform_add_devices(m6_isp1761_devices, num_devices);
+ return platform_add_devices(devfull_isp1761_devices, num_devices);
}
-void __exit m6_isp1761_exit(void)
+void __exit devfull_isp1761_exit(void)
{
- platform_device_unregister(&m6_isp1761_device);
+ platform_device_unregister(&devfull_isp1761_device);
}
-module_init(m6_isp1761_init);
-module_exit(m6_isp1761_exit);
+module_init(devfull_isp1761_init);
+module_exit(devfull_isp1761_exit);
MODULE_LICENSE("GPL");
-MODULE_AUTHOR("JB");
+MODULE_AUTHOR("JB/NC");
MODULE_DESCRIPTION("APF9328 ISP1761 chip initialization driver");
-MODULE_VERSION("0.1");
+MODULE_VERSION("0.2");
Modified: trunk/target/linux/modules/isp1761/hal/hal_imx.c
===================================================================
--- trunk/target/linux/modules/isp1761/hal/hal_imx.c 2007-11-04 09:10:24 UTC (rev 670)
+++ trunk/target/linux/modules/isp1761/hal/hal_imx.c 2007-11-05 19:38:07 UTC (rev 671)
@@ -19,18 +19,17 @@
*
* File Name: hal_x86.c
*
- * Refering linux kernel version 2.6.9
+ * Refering linux kernel version 2.6.23
*
* History:
*
* Date Author Comments
* ---------------------------------------------------------------------
* Nov 29 2005 Prabhakar Kalasani Initial Creation
- *
+ * Nov 04 2007 NC (armadeus) add 2.6.23 compatibility
**********************************************************************
*/
-#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/delay.h>
@@ -59,7 +58,7 @@
#include "hal_x86.h" // We can use the x86 headers for now.
#include "../hal/hal_intf.h"
#include "../hal/isp1761.h"
-
+
/*--------------------------------------------------------------*
* Local variable Definitions
*--------------------------------------------------------------*/
@@ -88,7 +87,7 @@
static int isp1761_pci_suspend (struct pci_dev *dev, __u32 state);
static int isp1761_pci_resume (struct pci_dev *dev);
#endif
-static irqreturn_t isp1761_pci_isr (int irq, void *dev_id, struct pt_regs *regs);
+static irqreturn_t isp1761_pci_isr (int irq, void *dev_id);
/*--------------------------------------------------------------*
@@ -114,7 +113,7 @@
* ISP1761 Interrupt Service Routine
*--------------------------------------------------------------*/
/*Interrupt Service Routine for device controller*/
-irqreturn_t isp1761_pci_dc_isr(int irq, void *data, struct pt_regs *r)
+irqreturn_t isp1761_pci_dc_isr(int irq, void *data)
{
struct isp1761_dev *dev;
dev = &isp1761_loc_dev[ISP1761_DC];
@@ -141,7 +140,7 @@
isp1761_reg_write32(dev, 0x218, dev->int_reg);
dev->int_reg &= 0x03fffdb9;
if(dev->int_reg)
- dev->handler(dev, dev->isr_data,r);
+ dev->handler(dev, dev->isr_data);
hal_entry("%s: Exit\n",__FUNCTION__);
return IRQ_HANDLED;
}
@@ -151,7 +150,7 @@
* Before calling the driver's ISR clears the source of interrupt.
* The drivers can get the source of interrupt from the dev->int_reg field
*/
-irqreturn_t isp1761_pci_isr(int irq, void *__data, struct pt_regs *r)
+irqreturn_t isp1761_pci_isr(int irq, void *__data)
{
__u32 irq_mask = 0;
struct isp1761_dev *dev;
@@ -166,7 +165,7 @@
dev->int_reg &= irq_mask; /*shared irq ??*/
/*call the Host Isr if any valid(minus otg)interrupt is present*/
if(dev->int_reg & ~HC_OTG_INTERRUPT)
- dev->handler(dev,dev->isr_data,r);
+ dev->handler(dev,dev->isr_data);
#ifdef OTG
#ifndef MSEC_INT_BASED
mdelay(1);
@@ -186,7 +185,7 @@
/* Read the source of OTG_INT and clear the
interrupt source */
dev->int_reg = otg_int;
- dev->handler(dev, dev->isr_data,r);
+ dev->handler(dev, dev->isr_data);
}
#endif
hal_entry("%s: Exit\n",__FUNCTION__);
@@ -468,7 +467,7 @@
*
*--------------------------------------------------------------*/
-int isp1761_request_irq(void (*handler)(struct isp1761_dev *, void *, struct pt_regs *),
+int isp1761_request_irq(void (*handler)(struct isp1761_dev *, void *),
struct isp1761_dev *dev, void *isr_data)
{
int result = 0;
@@ -476,12 +475,12 @@
hal_int("isp1761_request_irq: dev->index %x\n",dev->index);
if(dev->index == ISP1761_DC){
result = request_irq(dev->irq, isp1761_pci_dc_isr,
- SA_SHIRQ,
+ IRQF_SHARED,
dev->name,
isr_data);
}else {
result= request_irq(dev->irq,isp1761_pci_isr,
- SA_SHIRQ,
+ IRQF_SHARED,
dev->name,
isr_data);
}
Modified: trunk/target/linux/modules/isp1761/hal/hal_intf.h
===================================================================
--- trunk/target/linux/modules/isp1761/hal/hal_intf.h 2007-11-04 09:10:24 UTC (rev 670)
+++ trunk/target/linux/modules/isp1761/hal/hal_intf.h 2007-11-05 19:38:07 UTC (rev 671)
@@ -24,7 +24,7 @@
* Date Author Comments
* ---------------------------------------------------------------------
* Nov 29 2005 Prabhakar Kalasani Initial Creation
- *
+ * Nov 04 2007 NC (armadeus) Add 2.6.23 compatibility
***********************************************************************/
#ifndef __HAL_INTF_H__
@@ -107,8 +107,7 @@
unsigned char index; /* local controller (HC/DC/OTG) */
unsigned int irq; /*Interrupt Channel allocated for this device */
void (*handler)(struct isp1761_dev *dev,
- void *isr_data,
- struct pt_regs *); /* Interrupt Serrvice Routine */
+ void *isr_data); /* Interrupt Serrvice Routine */
void *isr_data; /* isr data of the driver */
unsigned long int_reg; /* Interrupt register */
unsigned long alt_int_reg; /* Interrupt register 2*/
@@ -153,7 +152,7 @@
int isp1761_register_driver(struct isp1761_driver *drv);
void isp1761_unregister_driver(struct isp1761_driver *drv);
-int isp1761_request_irq(void(*handler)(struct isp1761_dev* dev,void* isr_data,struct pt_regs*),
+int isp1761_request_irq(void(*handler)(struct isp1761_dev* dev,void* isr_data),
struct isp1761_dev* dev, void* isr_data);
void isp1761_free_irq(struct isp1761_dev* dev,void* isr_data);
Modified: trunk/target/linux/modules/isp1761/host/itdptd.c
===================================================================
--- trunk/target/linux/modules/isp1761/host/itdptd.c 2007-11-04 09:10:24 UTC (rev 670)
+++ trunk/target/linux/modules/isp1761/host/itdptd.c 2007-11-05 19:38:07 UTC (rev 671)
@@ -666,7 +666,7 @@
/* Local variable initialization */
high_speed = 0;
periodic_list = &hcd->periodic_list[0];
- dev = (struct hcd_dev *)urb->dev->bus->hcpriv;
+ dev = (struct hcd_dev*) bus_to_hcd(urb->dev->bus);
urb->hcpriv = (void *) 0;
prev_itd = (struct ehci_itd *) 0;
itd = (struct ehci_itd *) 0;
@@ -715,15 +715,12 @@
if(urb->dev->speed == USB_SPEED_FULL)
{
- if(urb->bandwidth == 0)
- {
- bus_time = usb_check_bandwidth(urb->dev, urb);
- if(bus_time < 0)
- {
- usb_dec_dev_use(urb->dev);
- *status = bus_time;
- return *status;
- }
+ bus_time = usb_check_bandwidth(urb->dev, urb);
+ if(bus_time < 0)
+ {
+ usb_dec_dev_use(urb->dev);
+ *status = bus_time;
+ return *status;
}
} /*if(urb->dev->speed == USB_SPEED_FULL) */
else /*HIGH SPEED*/
Modified: trunk/target/linux/modules/isp1761/host/pehci.c
===================================================================
--- trunk/target/linux/modules/isp1761/host/pehci.c 2007-11-04 09:10:24 UTC (rev 670)
+++ trunk/target/linux/modules/isp1761/host/pehci.c 2007-11-05 19:38:07 UTC (rev 671)
@@ -29,11 +29,10 @@
* July 4, 2005 krishan Handling unprotected urbs
* Feb 6, 2006 Grant H. Added ISO support
* April 21, 2006 Grant H. Added bug fixes
- *
+ * Nov 04, 2007 NC (armadeus) Add 2.6.23 compatibility
********************************************************************************
*/
-#include <linux/config.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/delay.h>
@@ -740,7 +739,7 @@
static void
pehci_hcd_urb_complete(phci_hcd *hcd,struct ehci_qh *qh, struct urb *urb,
- td_ptd_map_t *td_ptd_map,struct pt_regs *regs)
+ td_ptd_map_t *td_ptd_map)
{
static u32 remove = 0;
@@ -771,7 +770,7 @@
urb->status = 0;
spin_unlock(&hcd->lock);
- usb_hcd_giveback_urb (&hcd->usb_hcd, urb, regs);
+ usb_hcd_giveback_urb (&hcd->usb_hcd, urb);
spin_lock(&hcd->lock);
/*lets handle to the remove case*/
@@ -829,7 +828,6 @@
* needed by the host controller driver to process data and interact
* with the host controller.
*
- * struct pt_regs *regs
*
* API Description
* This is the ISOCHRONOUS Transfer handler, mainly responsible for:
@@ -841,7 +839,7 @@
* required actions depending on status.
* - Freeing up memory used by an ITDs once it is not needed anymore.
************************************************************************/
-void phcd_iso_handler(phci_hcd *hcd, struct pt_regs *regs)
+void phcd_iso_handler(phci_hcd *hcd)
{
struct _isp1761_isoptd *iso_ptd;
struct isp1761_mem_addr *mem_addr;
@@ -1300,7 +1298,7 @@
spin_unlock(&hcd->lock);
/* Perform URB cleanup */
- usb_hcd_giveback_urb (&hcd->usb_hcd, urb, regs);
+ usb_hcd_giveback_urb (&hcd->usb_hcd, urb);
spin_lock(&hcd->lock);
continue;
@@ -1365,7 +1363,7 @@
6. schedule
*********************************************************/
static void
-pehci_hcd_intl_worker(phci_hcd *hcd,struct pt_regs *regs)
+pehci_hcd_intl_worker(phci_hcd *hcd)
{
int i = 0;
u32 donemap = 0, donetoclear;
@@ -1549,7 +1547,7 @@
}
if(qtd->state & QTD_STATE_LAST){
- pehci_hcd_urb_complete(hcd,qh,urb,td_ptd_map,regs);
+ pehci_hcd_urb_complete(hcd,qh,urb,td_ptd_map);
if(dontschedule){ /*cleanup will start from drivers*/
dontschedule = 0;
continue;
@@ -1605,7 +1603,7 @@
6. schedule
*/
static void
-pehci_hcd_atl_worker(phci_hcd *hcd,struct pt_regs *regs)
+pehci_hcd_atl_worker(phci_hcd *hcd)
{
u32 donemap = 0, donetoclear=0;
u32 pendingmap = 0;
@@ -1969,7 +1967,7 @@
}
if(qtd->state & QTD_STATE_LAST){
- pehci_hcd_urb_complete(hcd,qh,urb,td_ptd_map,regs);
+ pehci_hcd_urb_complete(hcd,qh,urb,td_ptd_map);
if(dontschedule){ /*cleanup will start from drivers*/
dontschedule = 0;
/*so that we can take next one*/
@@ -2281,30 +2279,30 @@
{
phci_hcd *hcd = (phci_hcd *) arg;
#ifdef CONFIG_ISO_SUPPORT
- phcd_iso_handler(hcd, NULL);
+ phcd_iso_handler(hcd);
#endif
- pehci_hcd_atl_worker(hcd,NULL);
- pehci_hcd_intl_worker(hcd,NULL);
+ pehci_hcd_atl_worker(hcd);
+ pehci_hcd_intl_worker(hcd);
return;
}
static void
-pehci_interrupt_handler(phci_hcd *hcd, struct pt_regs *regs)
+pehci_interrupt_handler(phci_hcd *hcd)
{
spin_lock(&hcd->lock);
#ifdef CONFIG_ISO_SUPPORT
- phcd_iso_handler(hcd, regs);
+ phcd_iso_handler(hcd);
#endif
- pehci_hcd_atl_worker(hcd,regs);
- pehci_hcd_intl_worker(hcd,regs);
+ pehci_hcd_atl_worker(hcd);
+ pehci_hcd_intl_worker(hcd);
spin_unlock(&hcd->lock);
return;
}
irqreturn_t
-pehci_hcd_irq1(struct usb_hcd *hcd, struct pt_regs *regs)
+pehci_hcd_irq1(struct usb_hcd *hcd)
{
info("%s: doing nothing\n",__FUNCTION__);
return IRQ_NONE;
@@ -2312,7 +2310,7 @@
/*isr routine*/
irqreturn_t
-pehci_hcd_irq(struct usb_hcd *usb_hcd, struct pt_regs *regs) //struct isp1761_dev *dev, void *__irq_data, struct pt_regs *regs)
+pehci_hcd_irq(struct usb_hcd *usb_hcd) //struct isp1761_dev *dev, void *__irq_data, struct pt_regs *regs)
{
struct isp1761_dev *dev;
int work = 0;
@@ -2341,20 +2339,20 @@
work = 1; /* phci_iso_worker(hcd); */
if(intr & (HC_ATL_INT & INTR_ENABLE_MASK)){
spin_lock(&pehci_hcd->lock);
- pehci_hcd_atl_worker(pehci_hcd, regs);
+ pehci_hcd_atl_worker(pehci_hcd);
spin_unlock(&pehci_hcd->lock);
work = 0; /*phci_atl_worker(hcd); */
}
if(intr & (HC_INTL_INT & INTR_ENABLE_MASK)){
spin_lock(&pehci_hcd->lock);
- pehci_hcd_intl_worker(pehci_hcd, regs);
+ pehci_hcd_intl_worker(pehci_hcd);
spin_unlock(&pehci_hcd->lock);
work = 0; /*phci_intl_worker(hcd); */
}
#endif
if(work)
- pehci_interrupt_handler(pehci_hcd, regs);
+ pehci_interrupt_handler(pehci_hcd);
atomic_dec(&pehci_hcd->nuofsofs);
return IRQ_HANDLED;
@@ -2732,7 +2730,7 @@
urb->transfer_buffer_length, urb->actual_length);
qtd = urb_priv->qtd[urb_priv->length-1];
pehci_check("qtd state is %x\n", qtd->state);
- pehci_hcd_urb_complete(hcd,qh,urb,td_ptd_map,NULL);
+ pehci_hcd_urb_complete(hcd,qh,urb,td_ptd_map);
#if 0 /* Set only for memory leak debugging */
{
@@ -2777,7 +2775,7 @@
isp1761_reg_write32(hcd->dev, hcd->regs.inttdskipmap,
skipmap | td_ptd_map->ptd_bitmap);
qtd_list = &qh->qtd_list;
- pehci_hcd_urb_complete(hcd,qh,urb,td_ptd_map,NULL);
+ pehci_hcd_urb_complete(hcd,qh,urb,td_ptd_map);
if(!list_empty(qtd_list))
{
err("Never Error: List must not be emplyt\n"); /*only one td in my endpoint*/
@@ -3160,7 +3158,7 @@
/*lets keep our host here*/
tmp_1761_dev->driver_data = usb_hcd;
- status = usb_add_hcd(usb_hcd, tmp_1761_dev->irq, SA_INTERRUPT | SA_SHIRQ);
+ status = usb_add_hcd(usb_hcd, tmp_1761_dev->irq, IRQF_DISABLED | IRQF_SHARED);
pehci_entry("-- %s: Exit\n",__FUNCTION__);
return status;
@@ -3174,7 +3172,6 @@
pehci_hcd_remove(struct isp1761_dev *tmp_1761_dev)
{
-
struct usb_hcd *usb_hcd;
phci_hcd *hcd = NULL;
Modified: trunk/target/linux/modules/isp1761/host/qtdptd.c
===================================================================
--- trunk/target/linux/modules/isp1761/host/qtdptd.c 2007-11-04 09:10:24 UTC (rev 670)
+++ trunk/target/linux/modules/isp1761/host/qtdptd.c 2007-11-05 19:38:07 UTC (rev 671)
@@ -19,22 +19,118 @@
*
* File Name: qtdptd.c
*
- * Refering linux kernel version 2.6.9
+ * Refering linux kernel version 2.6.23
*
* History:
*
* Date Author Comments
* --------------------------------------------------------------------
* June 21, 2005 krishan Initial version
- *
+ * Nov 04, 2007 NC (armadeus) Add 2.6.23 compatibility
**********************************************************************
*/
/* Td managenment routines */
#define QUEUE_HEAD_NOT_EMPTY 0x001
+
+/*
+ * usb_check_bandwidth():
+ *
+ * old_alloc is from host_controller->bandwidth_allocated in microseconds;
+ * bustime is from calc_bus_time(), but converted to microseconds.
+ *
+ * returns <bustime in us> if successful,
+ * or -ENOSPC if bandwidth request fails.
+ *
+ * FIXME:
+ * This initial implementation does not use Endpoint.bInterval
+ * in managing bandwidth allocation.
+ * It probably needs to be expanded to use Endpoint.bInterval.
+ * This can be done as a later enhancement (correction).
+ *
+ * This will also probably require some kind of
+ * frame allocation tracking...meaning, for example,
+ * that if multiple drivers request interrupts every 10 USB frames,
+ * they don't all have to be allocated at
+ * frame numbers N, N+10, N+20, etc. Some of them could be at
+ * N+11, N+21, N+31, etc., and others at
+ * N+12, N+22, N+32, etc.
+ *
+ * Similarly for isochronous transfers...
+ *
+ * Individual HCDs can schedule more directly ... this logic
+ * is not correct for high speed transfers.
+ */
+int usb_check_bandwidth (struct usb_device *dev, struct urb *urb)
+{
+ unsigned int pipe = urb->pipe;
+ long bustime;
+ int is_in = usb_pipein (pipe);
+ int is_iso = usb_pipeisoc (pipe);
+ int old_alloc = dev->bus->bandwidth_allocated;
+ int new_alloc;
+
+
+ bustime = NS_TO_US (usb_calc_bus_time (dev->speed, is_in, is_iso,
+ usb_maxpacket (dev, pipe, !is_in)));
+ if (is_iso)
+ bustime /= urb->number_of_packets;
+
+ new_alloc = old_alloc + (int) bustime;
+ if (new_alloc > FRAME_TIME_MAX_USECS_ALLOC) {
+#ifdef DEBUG
+ char *mode =
+#ifdef CONFIG_USB_BANDWIDTH
+ "";
+#else
+ "would have ";
+#endif
+ dev_dbg (&dev->dev, "usb_check_bandwidth %sFAILED: %d + %ld = %d usec\n",
+ mode, old_alloc, bustime, new_alloc);
+#endif
+#ifdef CONFIG_USB_BANDWIDTH
+ bustime = -ENOSPC; /* report error */
+#endif
+ }
+
+ return bustime;
+}
+
+/**
+ * usb_claim_bandwidth - records bandwidth for a periodic transfer
+ * @dev: source/target of request
+ * @urb: request (urb->dev == dev)
+ * @bustime: bandwidth consumed, in (average) microseconds per frame
+ * @isoc: true iff the request is isochronous
+ *
+ * Bus bandwidth reservations are recorded purely for diagnostic purposes.
+ * HCDs are expected not to overcommit periodic bandwidth, and to record such
+ * reservations whenever endpoints are added to the periodic schedule.
+ *
+ * FIXME averaging per-frame is suboptimal. Better to sum over the HCD's
+ * entire periodic schedule ... 32 frames for OHCI, 1024 for UHCI, settable
+ * for EHCI (256/512/1024 frames, default 1024) and have the bus expose how
+ * large its periodic schedule is.
+ */
+void usb_claim_bandwidth (struct usb_device *dev, struct urb *urb, int bustime, int isoc)
+{
+ dev->bus->bandwidth_allocated += bustime;
+ if (isoc)
+ dev->bus->bandwidth_isoc_reqs++;
+ else
+ dev->bus->bandwidth_int_reqs++;
+
+#ifdef USB_BANDWIDTH_MESSAGES
+ dev_dbg (&dev->dev, "bandwidth alloc increased by %d (%s) to %d for %d requesters\n",
+ bustime,
+ isoc ? "ISOC" : "INTR",
+ dev->bus->bandwidth_allocated,
+ dev->bus->bandwidth_int_reqs + dev->bus->bandwidth_isoc_reqs);
+#endif
+}
+
-
/*free the location used by removed urb/endpoint*/
static void
phci_hcd_release_td_ptd_index(struct ehci_qh *qh)
@@ -853,7 +949,7 @@
qtd = list_entry (qtd_list->next, struct ehci_qtd, qtd_list);
- dev = (struct hcd_dev *)urb->dev->bus->hcpriv;
+ dev = (struct hcd_dev*) bus_to_hcd(urb->dev->bus);
epnum = usb_pipeendpoint (urb->pipe);
if (usb_pipein (urb->pipe) && !usb_pipecontrol (urb->pipe))
epnum |= 0x10;
@@ -1022,7 +1118,7 @@
qtd = list_entry (qtd_list->next, struct ehci_qtd, qtd_list);
- dev = (struct hcd_dev *)urb->dev->bus->hcpriv;
+ dev = (struct hcd_dev*) bus_to_hcd(urb->dev->bus);
epnum = ep->desc.bEndpointAddress;
pehci_entry("++ %s, enter\n", __FUNCTION__);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|