aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ieee1394/ohci1394.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ieee1394/ohci1394.c')
-rw-r--r--drivers/ieee1394/ohci1394.c43
1 files changed, 9 insertions, 34 deletions
diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c
index 4cf9b8f3e336..b6b96fa04d62 100644
--- a/drivers/ieee1394/ohci1394.c
+++ b/drivers/ieee1394/ohci1394.c
@@ -161,9 +161,6 @@ printk(level "%s: " fmt "\n" , OHCI1394_DRIVER_NAME , ## args)
161#define PRINT(level, fmt, args...) \ 161#define PRINT(level, fmt, args...) \
162printk(level "%s: fw-host%d: " fmt "\n" , OHCI1394_DRIVER_NAME, ohci->host->id , ## args) 162printk(level "%s: fw-host%d: " fmt "\n" , OHCI1394_DRIVER_NAME, ohci->host->id , ## args)
163 163
164static char version[] __devinitdata =
165 "$Rev: 1313 $ Ben Collins <bcollins@debian.org>";
166
167/* Module Parameters */ 164/* Module Parameters */
168static int phys_dma = 1; 165static int phys_dma = 1;
169module_param(phys_dma, int, 0644); 166module_param(phys_dma, int, 0644);
@@ -587,12 +584,13 @@ static void ohci_initialize(struct ti_ohci *ohci)
587 sprintf (irq_buf, "%s", __irq_itoa(ohci->dev->irq)); 584 sprintf (irq_buf, "%s", __irq_itoa(ohci->dev->irq));
588#endif 585#endif
589 PRINT(KERN_INFO, "OHCI-1394 %d.%d (PCI): IRQ=[%s] " 586 PRINT(KERN_INFO, "OHCI-1394 %d.%d (PCI): IRQ=[%s] "
590 "MMIO=[%lx-%lx] Max Packet=[%d]", 587 "MMIO=[%lx-%lx] Max Packet=[%d] IR/IT contexts=[%d/%d]",
591 ((((buf) >> 16) & 0xf) + (((buf) >> 20) & 0xf) * 10), 588 ((((buf) >> 16) & 0xf) + (((buf) >> 20) & 0xf) * 10),
592 ((((buf) >> 4) & 0xf) + ((buf) & 0xf) * 10), irq_buf, 589 ((((buf) >> 4) & 0xf) + ((buf) & 0xf) * 10), irq_buf,
593 pci_resource_start(ohci->dev, 0), 590 pci_resource_start(ohci->dev, 0),
594 pci_resource_start(ohci->dev, 0) + OHCI1394_REGISTER_SIZE - 1, 591 pci_resource_start(ohci->dev, 0) + OHCI1394_REGISTER_SIZE - 1,
595 ohci->max_packet_size); 592 ohci->max_packet_size,
593 ohci->nb_iso_rcv_ctx, ohci->nb_iso_xmit_ctx);
596 594
597 /* Check all of our ports to make sure that if anything is 595 /* Check all of our ports to make sure that if anything is
598 * connected, we enable that port. */ 596 * connected, we enable that port. */
@@ -2960,28 +2958,23 @@ alloc_dma_rcv_ctx(struct ti_ohci *ohci, struct dma_rcv_ctx *d,
2960 d->ctrlClear = 0; 2958 d->ctrlClear = 0;
2961 d->cmdPtr = 0; 2959 d->cmdPtr = 0;
2962 2960
2963 d->buf_cpu = kmalloc(d->num_desc * sizeof(quadlet_t*), GFP_ATOMIC); 2961 d->buf_cpu = kzalloc(d->num_desc * sizeof(*d->buf_cpu), GFP_ATOMIC);
2964 d->buf_bus = kmalloc(d->num_desc * sizeof(dma_addr_t), GFP_ATOMIC); 2962 d->buf_bus = kzalloc(d->num_desc * sizeof(*d->buf_bus), GFP_ATOMIC);
2965 2963
2966 if (d->buf_cpu == NULL || d->buf_bus == NULL) { 2964 if (d->buf_cpu == NULL || d->buf_bus == NULL) {
2967 PRINT(KERN_ERR, "Failed to allocate dma buffer"); 2965 PRINT(KERN_ERR, "Failed to allocate dma buffer");
2968 free_dma_rcv_ctx(d); 2966 free_dma_rcv_ctx(d);
2969 return -ENOMEM; 2967 return -ENOMEM;
2970 } 2968 }
2971 memset(d->buf_cpu, 0, d->num_desc * sizeof(quadlet_t*));
2972 memset(d->buf_bus, 0, d->num_desc * sizeof(dma_addr_t));
2973 2969
2974 d->prg_cpu = kmalloc(d->num_desc * sizeof(struct dma_cmd*), 2970 d->prg_cpu = kzalloc(d->num_desc * sizeof(*d->prg_cpu), GFP_ATOMIC);
2975 GFP_ATOMIC); 2971 d->prg_bus = kzalloc(d->num_desc * sizeof(*d->prg_bus), GFP_ATOMIC);
2976 d->prg_bus = kmalloc(d->num_desc * sizeof(dma_addr_t), GFP_ATOMIC);
2977 2972
2978 if (d->prg_cpu == NULL || d->prg_bus == NULL) { 2973 if (d->prg_cpu == NULL || d->prg_bus == NULL) {
2979 PRINT(KERN_ERR, "Failed to allocate dma prg"); 2974 PRINT(KERN_ERR, "Failed to allocate dma prg");
2980 free_dma_rcv_ctx(d); 2975 free_dma_rcv_ctx(d);
2981 return -ENOMEM; 2976 return -ENOMEM;
2982 } 2977 }
2983 memset(d->prg_cpu, 0, d->num_desc * sizeof(struct dma_cmd*));
2984 memset(d->prg_bus, 0, d->num_desc * sizeof(dma_addr_t));
2985 2978
2986 d->spb = kmalloc(d->split_buf_size, GFP_ATOMIC); 2979 d->spb = kmalloc(d->split_buf_size, GFP_ATOMIC);
2987 2980
@@ -3093,17 +3086,14 @@ alloc_dma_trm_ctx(struct ti_ohci *ohci, struct dma_trm_ctx *d,
3093 d->ctrlClear = 0; 3086 d->ctrlClear = 0;
3094 d->cmdPtr = 0; 3087 d->cmdPtr = 0;
3095 3088
3096 d->prg_cpu = kmalloc(d->num_desc * sizeof(struct at_dma_prg*), 3089 d->prg_cpu = kzalloc(d->num_desc * sizeof(*d->prg_cpu), GFP_KERNEL);
3097 GFP_KERNEL); 3090 d->prg_bus = kzalloc(d->num_desc * sizeof(*d->prg_bus), GFP_KERNEL);
3098 d->prg_bus = kmalloc(d->num_desc * sizeof(dma_addr_t), GFP_KERNEL);
3099 3091
3100 if (d->prg_cpu == NULL || d->prg_bus == NULL) { 3092 if (d->prg_cpu == NULL || d->prg_bus == NULL) {
3101 PRINT(KERN_ERR, "Failed to allocate at dma prg"); 3093 PRINT(KERN_ERR, "Failed to allocate at dma prg");
3102 free_dma_trm_ctx(d); 3094 free_dma_trm_ctx(d);
3103 return -ENOMEM; 3095 return -ENOMEM;
3104 } 3096 }
3105 memset(d->prg_cpu, 0, d->num_desc * sizeof(struct at_dma_prg*));
3106 memset(d->prg_bus, 0, d->num_desc * sizeof(dma_addr_t));
3107 3097
3108 len = sprintf(pool_name, "ohci1394_trm_prg"); 3098 len = sprintf(pool_name, "ohci1394_trm_prg");
3109 sprintf(pool_name+len, "%d", num_allocs); 3099 sprintf(pool_name+len, "%d", num_allocs);
@@ -3201,8 +3191,6 @@ static struct hpsb_host_driver ohci1394_driver = {
3201 .hw_csr_reg = ohci_hw_csr_reg, 3191 .hw_csr_reg = ohci_hw_csr_reg,
3202}; 3192};
3203 3193
3204
3205
3206/*********************************** 3194/***********************************
3207 * PCI Driver Interface functions * 3195 * PCI Driver Interface functions *
3208 ***********************************/ 3196 ***********************************/
@@ -3217,15 +3205,10 @@ do { \
3217static int __devinit ohci1394_pci_probe(struct pci_dev *dev, 3205static int __devinit ohci1394_pci_probe(struct pci_dev *dev,
3218 const struct pci_device_id *ent) 3206 const struct pci_device_id *ent)
3219{ 3207{
3220 static int version_printed = 0;
3221
3222 struct hpsb_host *host; 3208 struct hpsb_host *host;
3223 struct ti_ohci *ohci; /* shortcut to currently handled device */ 3209 struct ti_ohci *ohci; /* shortcut to currently handled device */
3224 unsigned long ohci_base; 3210 unsigned long ohci_base;
3225 3211
3226 if (version_printed++ == 0)
3227 PRINT_G(KERN_INFO, "%s", version);
3228
3229 if (pci_enable_device(dev)) 3212 if (pci_enable_device(dev))
3230 FAIL(-ENXIO, "Failed to enable OHCI hardware"); 3213 FAIL(-ENXIO, "Failed to enable OHCI hardware");
3231 pci_set_master(dev); 3214 pci_set_master(dev);
@@ -3369,13 +3352,8 @@ static int __devinit ohci1394_pci_probe(struct pci_dev *dev,
3369 /* Determine the number of available IR and IT contexts. */ 3352 /* Determine the number of available IR and IT contexts. */
3370 ohci->nb_iso_rcv_ctx = 3353 ohci->nb_iso_rcv_ctx =
3371 get_nb_iso_ctx(ohci, OHCI1394_IsoRecvIntMaskSet); 3354 get_nb_iso_ctx(ohci, OHCI1394_IsoRecvIntMaskSet);
3372 DBGMSG("%d iso receive contexts available",
3373 ohci->nb_iso_rcv_ctx);
3374
3375 ohci->nb_iso_xmit_ctx = 3355 ohci->nb_iso_xmit_ctx =
3376 get_nb_iso_ctx(ohci, OHCI1394_IsoXmitIntMaskSet); 3356 get_nb_iso_ctx(ohci, OHCI1394_IsoXmitIntMaskSet);
3377 DBGMSG("%d iso transmit contexts available",
3378 ohci->nb_iso_xmit_ctx);
3379 3357
3380 /* Set the usage bits for non-existent contexts so they can't 3358 /* Set the usage bits for non-existent contexts so they can't
3381 * be allocated */ 3359 * be allocated */
@@ -3606,8 +3584,6 @@ static struct pci_driver ohci1394_pci_driver = {
3606 .suspend = ohci1394_pci_suspend, 3584 .suspend = ohci1394_pci_suspend,
3607}; 3585};
3608 3586
3609
3610
3611/*********************************** 3587/***********************************
3612 * OHCI1394 Video Interface * 3588 * OHCI1394 Video Interface *
3613 ***********************************/ 3589 ***********************************/
@@ -3714,7 +3690,6 @@ EXPORT_SYMBOL(ohci1394_init_iso_tasklet);
3714EXPORT_SYMBOL(ohci1394_register_iso_tasklet); 3690EXPORT_SYMBOL(ohci1394_register_iso_tasklet);
3715EXPORT_SYMBOL(ohci1394_unregister_iso_tasklet); 3691EXPORT_SYMBOL(ohci1394_unregister_iso_tasklet);
3716 3692
3717
3718/*********************************** 3693/***********************************
3719 * General module initialization * 3694 * General module initialization *
3720 ***********************************/ 3695 ***********************************/