aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/ieee1394
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/ieee1394')
-rw-r--r--drivers/ieee1394/csr.c6
-rw-r--r--drivers/ieee1394/dv1394.c4
-rw-r--r--drivers/ieee1394/highlevel.c6
-rw-r--r--drivers/ieee1394/ieee1394_core.c4
-rw-r--r--drivers/ieee1394/nodemgr.c6
-rw-r--r--drivers/ieee1394/ohci1394.c229
-rw-r--r--drivers/ieee1394/pcilynx.c15
-rw-r--r--drivers/ieee1394/raw1394.c2
-rw-r--r--drivers/ieee1394/sbp2.c11
-rw-r--r--drivers/ieee1394/video1394.c4
10 files changed, 142 insertions, 145 deletions
diff --git a/drivers/ieee1394/csr.c b/drivers/ieee1394/csr.c
index 52ac83e0ebee..c90be4070e40 100644
--- a/drivers/ieee1394/csr.c
+++ b/drivers/ieee1394/csr.c
@@ -133,8 +133,7 @@ static void host_reset(struct hpsb_host *host)
133 host->csr.state &= ~0x100; 133 host->csr.state &= ~0x100;
134 } 134 }
135 135
136 host->csr.topology_map[1] = 136 be32_add_cpu(&host->csr.topology_map[1], 1);
137 cpu_to_be32(be32_to_cpu(host->csr.topology_map[1]) + 1);
138 host->csr.topology_map[2] = cpu_to_be32(host->node_count << 16 137 host->csr.topology_map[2] = cpu_to_be32(host->node_count << 16
139 | host->selfid_count); 138 | host->selfid_count);
140 host->csr.topology_map[0] = 139 host->csr.topology_map[0] =
@@ -142,8 +141,7 @@ static void host_reset(struct hpsb_host *host)
142 | csr_crc16(host->csr.topology_map + 1, 141 | csr_crc16(host->csr.topology_map + 1,
143 host->selfid_count + 2)); 142 host->selfid_count + 2));
144 143
145 host->csr.speed_map[1] = 144 be32_add_cpu(&host->csr.speed_map[1], 1);
146 cpu_to_be32(be32_to_cpu(host->csr.speed_map[1]) + 1);
147 host->csr.speed_map[0] = cpu_to_be32(0x3f1 << 16 145 host->csr.speed_map[0] = cpu_to_be32(0x3f1 << 16
148 | csr_crc16(host->csr.speed_map+1, 146 | csr_crc16(host->csr.speed_map+1,
149 0x3f1)); 147 0x3f1));
diff --git a/drivers/ieee1394/dv1394.c b/drivers/ieee1394/dv1394.c
index 65722117ab6e..6228fadacd38 100644
--- a/drivers/ieee1394/dv1394.c
+++ b/drivers/ieee1394/dv1394.c
@@ -2179,8 +2179,7 @@ static struct ieee1394_device_id dv1394_id_table[] = {
2179MODULE_DEVICE_TABLE(ieee1394, dv1394_id_table); 2179MODULE_DEVICE_TABLE(ieee1394, dv1394_id_table);
2180 2180
2181static struct hpsb_protocol_driver dv1394_driver = { 2181static struct hpsb_protocol_driver dv1394_driver = {
2182 .name = "dv1394", 2182 .name = "dv1394",
2183 .id_table = dv1394_id_table,
2184}; 2183};
2185 2184
2186 2185
@@ -2568,7 +2567,6 @@ static int __init dv1394_init_module(void)
2568 2567
2569 cdev_init(&dv1394_cdev, &dv1394_fops); 2568 cdev_init(&dv1394_cdev, &dv1394_fops);
2570 dv1394_cdev.owner = THIS_MODULE; 2569 dv1394_cdev.owner = THIS_MODULE;
2571 kobject_set_name(&dv1394_cdev.kobj, "dv1394");
2572 ret = cdev_add(&dv1394_cdev, IEEE1394_DV1394_DEV, 16); 2570 ret = cdev_add(&dv1394_cdev, IEEE1394_DV1394_DEV, 16);
2573 if (ret) { 2571 if (ret) {
2574 printk(KERN_ERR "dv1394: unable to register character device\n"); 2572 printk(KERN_ERR "dv1394: unable to register character device\n");
diff --git a/drivers/ieee1394/highlevel.c b/drivers/ieee1394/highlevel.c
index b6425469b6ee..fa2bfec0fca2 100644
--- a/drivers/ieee1394/highlevel.c
+++ b/drivers/ieee1394/highlevel.c
@@ -339,7 +339,7 @@ u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl,
339 if ((alignment & 3) || (alignment > 0x800000000000ULL) || 339 if ((alignment & 3) || (alignment > 0x800000000000ULL) ||
340 (hweight64(alignment) != 1)) { 340 (hweight64(alignment) != 1)) {
341 HPSB_ERR("%s called with invalid alignment: 0x%048llx", 341 HPSB_ERR("%s called with invalid alignment: 0x%048llx",
342 __FUNCTION__, (unsigned long long)alignment); 342 __func__, (unsigned long long)alignment);
343 return retval; 343 return retval;
344 } 344 }
345 345
@@ -354,7 +354,7 @@ u64 hpsb_allocate_and_register_addrspace(struct hpsb_highlevel *hl,
354 if (((start|end) & ~align_mask) || (start >= end) || 354 if (((start|end) & ~align_mask) || (start >= end) ||
355 (end > CSR1212_ALL_SPACE_END)) { 355 (end > CSR1212_ALL_SPACE_END)) {
356 HPSB_ERR("%s called with invalid addresses " 356 HPSB_ERR("%s called with invalid addresses "
357 "(start = %012Lx end = %012Lx)", __FUNCTION__, 357 "(start = %012Lx end = %012Lx)", __func__,
358 (unsigned long long)start,(unsigned long long)end); 358 (unsigned long long)start,(unsigned long long)end);
359 return retval; 359 return retval;
360 } 360 }
@@ -422,7 +422,7 @@ int hpsb_register_addrspace(struct hpsb_highlevel *hl, struct hpsb_host *host,
422 422
423 if (((start|end) & 3) || (start >= end) || 423 if (((start|end) & 3) || (start >= end) ||
424 (end > CSR1212_ALL_SPACE_END)) { 424 (end > CSR1212_ALL_SPACE_END)) {
425 HPSB_ERR("%s called with invalid addresses", __FUNCTION__); 425 HPSB_ERR("%s called with invalid addresses", __func__);
426 return 0; 426 return 0;
427 } 427 }
428 428
diff --git a/drivers/ieee1394/ieee1394_core.c b/drivers/ieee1394/ieee1394_core.c
index 36c747b277d0..dcdb71a7718d 100644
--- a/drivers/ieee1394/ieee1394_core.c
+++ b/drivers/ieee1394/ieee1394_core.c
@@ -242,7 +242,7 @@ int hpsb_bus_reset(struct hpsb_host *host)
242{ 242{
243 if (host->in_bus_reset) { 243 if (host->in_bus_reset) {
244 HPSB_NOTICE("%s called while bus reset already in progress", 244 HPSB_NOTICE("%s called while bus reset already in progress",
245 __FUNCTION__); 245 __func__);
246 return 1; 246 return 1;
247 } 247 }
248 248
@@ -373,6 +373,8 @@ static void build_speed_map(struct hpsb_host *host, int nodecount)
373 if (sid->port2 == SELFID_PORT_CHILD) cldcnt[n]++; 373 if (sid->port2 == SELFID_PORT_CHILD) cldcnt[n]++;
374 374
375 speedcap[n] = sid->speed; 375 speedcap[n] = sid->speed;
376 if (speedcap[n] > host->csr.lnk_spd)
377 speedcap[n] = host->csr.lnk_spd;
376 n--; 378 n--;
377 } 379 }
378 } 380 }
diff --git a/drivers/ieee1394/nodemgr.c b/drivers/ieee1394/nodemgr.c
index 511e4321c6b6..70afa3786f3f 100644
--- a/drivers/ieee1394/nodemgr.c
+++ b/drivers/ieee1394/nodemgr.c
@@ -701,7 +701,11 @@ static int nodemgr_bus_match(struct device * dev, struct device_driver * drv)
701 return 0; 701 return 0;
702 702
703 driver = container_of(drv, struct hpsb_protocol_driver, driver); 703 driver = container_of(drv, struct hpsb_protocol_driver, driver);
704 for (id = driver->id_table; id->match_flags != 0; id++) { 704 id = driver->id_table;
705 if (!id)
706 return 0;
707
708 for (; id->match_flags != 0; id++) {
705 if ((id->match_flags & IEEE1394_MATCH_VENDOR_ID) && 709 if ((id->match_flags & IEEE1394_MATCH_VENDOR_ID) &&
706 id->vendor_id != ud->vendor_id) 710 id->vendor_id != ud->vendor_id)
707 continue; 711 continue;
diff --git a/drivers/ieee1394/ohci1394.c b/drivers/ieee1394/ohci1394.c
index 969de2a2d633..0690469fcecf 100644
--- a/drivers/ieee1394/ohci1394.c
+++ b/drivers/ieee1394/ohci1394.c
@@ -149,7 +149,7 @@ printk(level "%s: fw-host%d: " fmt "\n" , OHCI1394_DRIVER_NAME, ohci->host->id ,
149/* Module Parameters */ 149/* Module Parameters */
150static int phys_dma = 1; 150static int phys_dma = 1;
151module_param(phys_dma, int, 0444); 151module_param(phys_dma, int, 0444);
152MODULE_PARM_DESC(phys_dma, "Enable physical dma (default = 1)."); 152MODULE_PARM_DESC(phys_dma, "Enable physical DMA (default = 1).");
153 153
154static void dma_trm_tasklet(unsigned long data); 154static void dma_trm_tasklet(unsigned long data);
155static void dma_trm_reset(struct dma_trm_ctx *d); 155static void dma_trm_reset(struct dma_trm_ctx *d);
@@ -708,7 +708,7 @@ static void insert_packet(struct ti_ohci *ohci,
708 /* FIXME: do something about it */ 708 /* FIXME: do something about it */
709 PRINT(KERN_ERR, 709 PRINT(KERN_ERR,
710 "%s: packet data addr: %p size %Zd bytes " 710 "%s: packet data addr: %p size %Zd bytes "
711 "cross page boundary", __FUNCTION__, 711 "cross page boundary", __func__,
712 packet->data, packet->data_size); 712 packet->data, packet->data_size);
713 } 713 }
714#endif 714#endif
@@ -2089,10 +2089,8 @@ static void dma_trm_reset(struct dma_trm_ctx *d)
2089 2089
2090 spin_lock_irqsave(&d->lock, flags); 2090 spin_lock_irqsave(&d->lock, flags);
2091 2091
2092 list_splice(&d->fifo_list, &packet_list); 2092 list_splice_init(&d->fifo_list, &packet_list);
2093 list_splice(&d->pending_list, &packet_list); 2093 list_splice_init(&d->pending_list, &packet_list);
2094 INIT_LIST_HEAD(&d->fifo_list);
2095 INIT_LIST_HEAD(&d->pending_list);
2096 2094
2097 d->branchAddrPtr = NULL; 2095 d->branchAddrPtr = NULL;
2098 d->sent_ind = d->prg_ind; 2096 d->sent_ind = d->prg_ind;
@@ -2787,7 +2785,7 @@ alloc_dma_rcv_ctx(struct ti_ohci *ohci, struct dma_rcv_ctx *d,
2787 d->buf_bus = kzalloc(d->num_desc * sizeof(*d->buf_bus), GFP_ATOMIC); 2785 d->buf_bus = kzalloc(d->num_desc * sizeof(*d->buf_bus), GFP_ATOMIC);
2788 2786
2789 if (d->buf_cpu == NULL || d->buf_bus == NULL) { 2787 if (d->buf_cpu == NULL || d->buf_bus == NULL) {
2790 PRINT(KERN_ERR, "Failed to allocate dma buffer"); 2788 PRINT(KERN_ERR, "Failed to allocate %s", "DMA buffer");
2791 free_dma_rcv_ctx(d); 2789 free_dma_rcv_ctx(d);
2792 return -ENOMEM; 2790 return -ENOMEM;
2793 } 2791 }
@@ -2796,7 +2794,7 @@ alloc_dma_rcv_ctx(struct ti_ohci *ohci, struct dma_rcv_ctx *d,
2796 d->prg_bus = kzalloc(d->num_desc * sizeof(*d->prg_bus), GFP_ATOMIC); 2794 d->prg_bus = kzalloc(d->num_desc * sizeof(*d->prg_bus), GFP_ATOMIC);
2797 2795
2798 if (d->prg_cpu == NULL || d->prg_bus == NULL) { 2796 if (d->prg_cpu == NULL || d->prg_bus == NULL) {
2799 PRINT(KERN_ERR, "Failed to allocate dma prg"); 2797 PRINT(KERN_ERR, "Failed to allocate %s", "DMA prg");
2800 free_dma_rcv_ctx(d); 2798 free_dma_rcv_ctx(d);
2801 return -ENOMEM; 2799 return -ENOMEM;
2802 } 2800 }
@@ -2804,7 +2802,7 @@ alloc_dma_rcv_ctx(struct ti_ohci *ohci, struct dma_rcv_ctx *d,
2804 d->spb = kmalloc(d->split_buf_size, GFP_ATOMIC); 2802 d->spb = kmalloc(d->split_buf_size, GFP_ATOMIC);
2805 2803
2806 if (d->spb == NULL) { 2804 if (d->spb == NULL) {
2807 PRINT(KERN_ERR, "Failed to allocate split buffer"); 2805 PRINT(KERN_ERR, "Failed to allocate %s", "split buffer");
2808 free_dma_rcv_ctx(d); 2806 free_dma_rcv_ctx(d);
2809 return -ENOMEM; 2807 return -ENOMEM;
2810 } 2808 }
@@ -2830,7 +2828,7 @@ alloc_dma_rcv_ctx(struct ti_ohci *ohci, struct dma_rcv_ctx *d,
2830 memset(d->buf_cpu[i], 0, d->buf_size); 2828 memset(d->buf_cpu[i], 0, d->buf_size);
2831 } else { 2829 } else {
2832 PRINT(KERN_ERR, 2830 PRINT(KERN_ERR,
2833 "Failed to allocate dma buffer"); 2831 "Failed to allocate %s", "DMA buffer");
2834 free_dma_rcv_ctx(d); 2832 free_dma_rcv_ctx(d);
2835 return -ENOMEM; 2833 return -ENOMEM;
2836 } 2834 }
@@ -2841,7 +2839,7 @@ alloc_dma_rcv_ctx(struct ti_ohci *ohci, struct dma_rcv_ctx *d,
2841 memset(d->prg_cpu[i], 0, sizeof(struct dma_cmd)); 2839 memset(d->prg_cpu[i], 0, sizeof(struct dma_cmd));
2842 } else { 2840 } else {
2843 PRINT(KERN_ERR, 2841 PRINT(KERN_ERR,
2844 "Failed to allocate dma prg"); 2842 "Failed to allocate %s", "DMA prg");
2845 free_dma_rcv_ctx(d); 2843 free_dma_rcv_ctx(d);
2846 return -ENOMEM; 2844 return -ENOMEM;
2847 } 2845 }
@@ -2902,7 +2900,7 @@ alloc_dma_trm_ctx(struct ti_ohci *ohci, struct dma_trm_ctx *d,
2902 d->prg_bus = kzalloc(d->num_desc * sizeof(*d->prg_bus), GFP_KERNEL); 2900 d->prg_bus = kzalloc(d->num_desc * sizeof(*d->prg_bus), GFP_KERNEL);
2903 2901
2904 if (d->prg_cpu == NULL || d->prg_bus == NULL) { 2902 if (d->prg_cpu == NULL || d->prg_bus == NULL) {
2905 PRINT(KERN_ERR, "Failed to allocate at dma prg"); 2903 PRINT(KERN_ERR, "Failed to allocate %s", "AT DMA prg");
2906 free_dma_trm_ctx(d); 2904 free_dma_trm_ctx(d);
2907 return -ENOMEM; 2905 return -ENOMEM;
2908 } 2906 }
@@ -2925,7 +2923,7 @@ alloc_dma_trm_ctx(struct ti_ohci *ohci, struct dma_trm_ctx *d,
2925 memset(d->prg_cpu[i], 0, sizeof(struct at_dma_prg)); 2923 memset(d->prg_cpu[i], 0, sizeof(struct at_dma_prg));
2926 } else { 2924 } else {
2927 PRINT(KERN_ERR, 2925 PRINT(KERN_ERR,
2928 "Failed to allocate at dma prg"); 2926 "Failed to allocate %s", "AT DMA prg");
2929 free_dma_trm_ctx(d); 2927 free_dma_trm_ctx(d);
2930 return -ENOMEM; 2928 return -ENOMEM;
2931 } 2929 }
@@ -2986,22 +2984,9 @@ static struct hpsb_host_driver ohci1394_driver = {
2986 * PCI Driver Interface functions * 2984 * PCI Driver Interface functions *
2987 ***********************************/ 2985 ***********************************/
2988 2986
2989#define FAIL(err, fmt, args...) \
2990do { \
2991 PRINT_G(KERN_ERR, fmt , ## args); \
2992 ohci1394_pci_remove(dev); \
2993 return err; \
2994} while (0)
2995
2996static int __devinit ohci1394_pci_probe(struct pci_dev *dev,
2997 const struct pci_device_id *ent)
2998{
2999 struct hpsb_host *host;
3000 struct ti_ohci *ohci; /* shortcut to currently handled device */
3001 resource_size_t ohci_base;
3002
3003#ifdef CONFIG_PPC_PMAC 2987#ifdef CONFIG_PPC_PMAC
3004 /* Necessary on some machines if ohci1394 was loaded/ unloaded before */ 2988static void ohci1394_pmac_on(struct pci_dev *dev)
2989{
3005 if (machine_is(powermac)) { 2990 if (machine_is(powermac)) {
3006 struct device_node *ofn = pci_device_to_OF_node(dev); 2991 struct device_node *ofn = pci_device_to_OF_node(dev);
3007 2992
@@ -3010,15 +2995,45 @@ static int __devinit ohci1394_pci_probe(struct pci_dev *dev,
3010 pmac_call_feature(PMAC_FTR_1394_ENABLE, ofn, 0, 1); 2995 pmac_call_feature(PMAC_FTR_1394_ENABLE, ofn, 0, 1);
3011 } 2996 }
3012 } 2997 }
2998}
2999
3000static void ohci1394_pmac_off(struct pci_dev *dev)
3001{
3002 if (machine_is(powermac)) {
3003 struct device_node *ofn = pci_device_to_OF_node(dev);
3004
3005 if (ofn) {
3006 pmac_call_feature(PMAC_FTR_1394_ENABLE, ofn, 0, 0);
3007 pmac_call_feature(PMAC_FTR_1394_CABLE_POWER, ofn, 0, 0);
3008 }
3009 }
3010}
3011#else
3012#define ohci1394_pmac_on(dev)
3013#define ohci1394_pmac_off(dev)
3013#endif /* CONFIG_PPC_PMAC */ 3014#endif /* CONFIG_PPC_PMAC */
3014 3015
3015 if (pci_enable_device(dev)) 3016static int __devinit ohci1394_pci_probe(struct pci_dev *dev,
3016 FAIL(-ENXIO, "Failed to enable OHCI hardware"); 3017 const struct pci_device_id *ent)
3018{
3019 struct hpsb_host *host;
3020 struct ti_ohci *ohci; /* shortcut to currently handled device */
3021 resource_size_t ohci_base;
3022 int err = -ENOMEM;
3023
3024 ohci1394_pmac_on(dev);
3025 if (pci_enable_device(dev)) {
3026 PRINT_G(KERN_ERR, "Failed to enable OHCI hardware");
3027 err = -ENXIO;
3028 goto err;
3029 }
3017 pci_set_master(dev); 3030 pci_set_master(dev);
3018 3031
3019 host = hpsb_alloc_host(&ohci1394_driver, sizeof(struct ti_ohci), &dev->dev); 3032 host = hpsb_alloc_host(&ohci1394_driver, sizeof(struct ti_ohci), &dev->dev);
3020 if (!host) FAIL(-ENOMEM, "Failed to allocate host structure"); 3033 if (!host) {
3021 3034 PRINT_G(KERN_ERR, "Failed to allocate %s", "host structure");
3035 goto err;
3036 }
3022 ohci = host->hostdata; 3037 ohci = host->hostdata;
3023 ohci->dev = dev; 3038 ohci->dev = dev;
3024 ohci->host = host; 3039 ohci->host = host;
@@ -3067,15 +3082,20 @@ static int __devinit ohci1394_pci_probe(struct pci_dev *dev,
3067 (unsigned long long)pci_resource_len(dev, 0)); 3082 (unsigned long long)pci_resource_len(dev, 0));
3068 3083
3069 if (!request_mem_region(ohci_base, OHCI1394_REGISTER_SIZE, 3084 if (!request_mem_region(ohci_base, OHCI1394_REGISTER_SIZE,
3070 OHCI1394_DRIVER_NAME)) 3085 OHCI1394_DRIVER_NAME)) {
3071 FAIL(-ENOMEM, "MMIO resource (0x%llx - 0x%llx) unavailable", 3086 PRINT_G(KERN_ERR, "MMIO resource (0x%llx - 0x%llx) unavailable",
3072 (unsigned long long)ohci_base, 3087 (unsigned long long)ohci_base,
3073 (unsigned long long)ohci_base + OHCI1394_REGISTER_SIZE); 3088 (unsigned long long)ohci_base + OHCI1394_REGISTER_SIZE);
3089 goto err;
3090 }
3074 ohci->init_state = OHCI_INIT_HAVE_MEM_REGION; 3091 ohci->init_state = OHCI_INIT_HAVE_MEM_REGION;
3075 3092
3076 ohci->registers = ioremap(ohci_base, OHCI1394_REGISTER_SIZE); 3093 ohci->registers = ioremap(ohci_base, OHCI1394_REGISTER_SIZE);
3077 if (ohci->registers == NULL) 3094 if (ohci->registers == NULL) {
3078 FAIL(-ENXIO, "Failed to remap registers - card not accessible"); 3095 PRINT_G(KERN_ERR, "Failed to remap registers");
3096 err = -ENXIO;
3097 goto err;
3098 }
3079 ohci->init_state = OHCI_INIT_HAVE_IOMAPPING; 3099 ohci->init_state = OHCI_INIT_HAVE_IOMAPPING;
3080 DBGMSG("Remapped memory spaces reg 0x%p", ohci->registers); 3100 DBGMSG("Remapped memory spaces reg 0x%p", ohci->registers);
3081 3101
@@ -3083,16 +3103,20 @@ static int __devinit ohci1394_pci_probe(struct pci_dev *dev,
3083 ohci->csr_config_rom_cpu = 3103 ohci->csr_config_rom_cpu =
3084 pci_alloc_consistent(ohci->dev, OHCI_CONFIG_ROM_LEN, 3104 pci_alloc_consistent(ohci->dev, OHCI_CONFIG_ROM_LEN,
3085 &ohci->csr_config_rom_bus); 3105 &ohci->csr_config_rom_bus);
3086 if (ohci->csr_config_rom_cpu == NULL) 3106 if (ohci->csr_config_rom_cpu == NULL) {
3087 FAIL(-ENOMEM, "Failed to allocate buffer config rom"); 3107 PRINT_G(KERN_ERR, "Failed to allocate %s", "buffer config rom");
3108 goto err;
3109 }
3088 ohci->init_state = OHCI_INIT_HAVE_CONFIG_ROM_BUFFER; 3110 ohci->init_state = OHCI_INIT_HAVE_CONFIG_ROM_BUFFER;
3089 3111
3090 /* self-id dma buffer allocation */ 3112 /* self-id dma buffer allocation */
3091 ohci->selfid_buf_cpu = 3113 ohci->selfid_buf_cpu =
3092 pci_alloc_consistent(ohci->dev, OHCI1394_SI_DMA_BUF_SIZE, 3114 pci_alloc_consistent(ohci->dev, OHCI1394_SI_DMA_BUF_SIZE,
3093 &ohci->selfid_buf_bus); 3115 &ohci->selfid_buf_bus);
3094 if (ohci->selfid_buf_cpu == NULL) 3116 if (ohci->selfid_buf_cpu == NULL) {
3095 FAIL(-ENOMEM, "Failed to allocate DMA buffer for self-id packets"); 3117 PRINT_G(KERN_ERR, "Failed to allocate %s", "self-ID buffer");
3118 goto err;
3119 }
3096 ohci->init_state = OHCI_INIT_HAVE_SELFID_BUFFER; 3120 ohci->init_state = OHCI_INIT_HAVE_SELFID_BUFFER;
3097 3121
3098 if ((unsigned long)ohci->selfid_buf_cpu & 0x1fff) 3122 if ((unsigned long)ohci->selfid_buf_cpu & 0x1fff)
@@ -3108,28 +3132,32 @@ static int __devinit ohci1394_pci_probe(struct pci_dev *dev,
3108 if (alloc_dma_rcv_ctx(ohci, &ohci->ar_req_context, 3132 if (alloc_dma_rcv_ctx(ohci, &ohci->ar_req_context,
3109 DMA_CTX_ASYNC_REQ, 0, AR_REQ_NUM_DESC, 3133 DMA_CTX_ASYNC_REQ, 0, AR_REQ_NUM_DESC,
3110 AR_REQ_BUF_SIZE, AR_REQ_SPLIT_BUF_SIZE, 3134 AR_REQ_BUF_SIZE, AR_REQ_SPLIT_BUF_SIZE,
3111 OHCI1394_AsReqRcvContextBase) < 0) 3135 OHCI1394_AsReqRcvContextBase) < 0) {
3112 FAIL(-ENOMEM, "Failed to allocate AR Req context"); 3136 PRINT_G(KERN_ERR, "Failed to allocate %s", "AR Req context");
3113 3137 goto err;
3138 }
3114 /* AR DMA response context allocation */ 3139 /* AR DMA response context allocation */
3115 if (alloc_dma_rcv_ctx(ohci, &ohci->ar_resp_context, 3140 if (alloc_dma_rcv_ctx(ohci, &ohci->ar_resp_context,
3116 DMA_CTX_ASYNC_RESP, 0, AR_RESP_NUM_DESC, 3141 DMA_CTX_ASYNC_RESP, 0, AR_RESP_NUM_DESC,
3117 AR_RESP_BUF_SIZE, AR_RESP_SPLIT_BUF_SIZE, 3142 AR_RESP_BUF_SIZE, AR_RESP_SPLIT_BUF_SIZE,
3118 OHCI1394_AsRspRcvContextBase) < 0) 3143 OHCI1394_AsRspRcvContextBase) < 0) {
3119 FAIL(-ENOMEM, "Failed to allocate AR Resp context"); 3144 PRINT_G(KERN_ERR, "Failed to allocate %s", "AR Resp context");
3120 3145 goto err;
3146 }
3121 /* AT DMA request context */ 3147 /* AT DMA request context */
3122 if (alloc_dma_trm_ctx(ohci, &ohci->at_req_context, 3148 if (alloc_dma_trm_ctx(ohci, &ohci->at_req_context,
3123 DMA_CTX_ASYNC_REQ, 0, AT_REQ_NUM_DESC, 3149 DMA_CTX_ASYNC_REQ, 0, AT_REQ_NUM_DESC,
3124 OHCI1394_AsReqTrContextBase) < 0) 3150 OHCI1394_AsReqTrContextBase) < 0) {
3125 FAIL(-ENOMEM, "Failed to allocate AT Req context"); 3151 PRINT_G(KERN_ERR, "Failed to allocate %s", "AT Req context");
3126 3152 goto err;
3153 }
3127 /* AT DMA response context */ 3154 /* AT DMA response context */
3128 if (alloc_dma_trm_ctx(ohci, &ohci->at_resp_context, 3155 if (alloc_dma_trm_ctx(ohci, &ohci->at_resp_context,
3129 DMA_CTX_ASYNC_RESP, 1, AT_RESP_NUM_DESC, 3156 DMA_CTX_ASYNC_RESP, 1, AT_RESP_NUM_DESC,
3130 OHCI1394_AsRspTrContextBase) < 0) 3157 OHCI1394_AsRspTrContextBase) < 0) {
3131 FAIL(-ENOMEM, "Failed to allocate AT Resp context"); 3158 PRINT_G(KERN_ERR, "Failed to allocate %s", "AT Resp context");
3132 3159 goto err;
3160 }
3133 /* Start off with a soft reset, to clear everything to a sane 3161 /* Start off with a soft reset, to clear everything to a sane
3134 * state. */ 3162 * state. */
3135 ohci_soft_reset(ohci); 3163 ohci_soft_reset(ohci);
@@ -3172,9 +3200,10 @@ static int __devinit ohci1394_pci_probe(struct pci_dev *dev,
3172 * by that point. 3200 * by that point.
3173 */ 3201 */
3174 if (request_irq(dev->irq, ohci_irq_handler, IRQF_SHARED, 3202 if (request_irq(dev->irq, ohci_irq_handler, IRQF_SHARED,
3175 OHCI1394_DRIVER_NAME, ohci)) 3203 OHCI1394_DRIVER_NAME, ohci)) {
3176 FAIL(-ENOMEM, "Failed to allocate shared interrupt %d", dev->irq); 3204 PRINT_G(KERN_ERR, "Failed to allocate interrupt %d", dev->irq);
3177 3205 goto err;
3206 }
3178 ohci->init_state = OHCI_INIT_HAVE_IRQ; 3207 ohci->init_state = OHCI_INIT_HAVE_IRQ;
3179 ohci_initialize(ohci); 3208 ohci_initialize(ohci);
3180 3209
@@ -3194,25 +3223,28 @@ static int __devinit ohci1394_pci_probe(struct pci_dev *dev,
3194 host->middle_addr_space = OHCI1394_MIDDLE_ADDRESS_SPACE; 3223 host->middle_addr_space = OHCI1394_MIDDLE_ADDRESS_SPACE;
3195 3224
3196 /* Tell the highlevel this host is ready */ 3225 /* Tell the highlevel this host is ready */
3197 if (hpsb_add_host(host)) 3226 if (hpsb_add_host(host)) {
3198 FAIL(-ENOMEM, "Failed to register host with highlevel"); 3227 PRINT_G(KERN_ERR, "Failed to register host with highlevel");
3199 3228 goto err;
3229 }
3200 ohci->init_state = OHCI_INIT_DONE; 3230 ohci->init_state = OHCI_INIT_DONE;
3201 3231
3202 return 0; 3232 return 0;
3203#undef FAIL 3233err:
3234 ohci1394_pci_remove(dev);
3235 return err;
3204} 3236}
3205 3237
3206static void ohci1394_pci_remove(struct pci_dev *pdev) 3238static void ohci1394_pci_remove(struct pci_dev *dev)
3207{ 3239{
3208 struct ti_ohci *ohci; 3240 struct ti_ohci *ohci;
3209 struct device *dev; 3241 struct device *device;
3210 3242
3211 ohci = pci_get_drvdata(pdev); 3243 ohci = pci_get_drvdata(dev);
3212 if (!ohci) 3244 if (!ohci)
3213 return; 3245 goto out;
3214 3246
3215 dev = get_device(&ohci->host->device); 3247 device = get_device(&ohci->host->device);
3216 3248
3217 switch (ohci->init_state) { 3249 switch (ohci->init_state) {
3218 case OHCI_INIT_DONE: 3250 case OHCI_INIT_DONE:
@@ -3246,7 +3278,7 @@ static void ohci1394_pci_remove(struct pci_dev *pdev)
3246 /* Soft reset before we start - this disables 3278 /* Soft reset before we start - this disables
3247 * interrupts and clears linkEnable and LPS. */ 3279 * interrupts and clears linkEnable and LPS. */
3248 ohci_soft_reset(ohci); 3280 ohci_soft_reset(ohci);
3249 free_irq(ohci->dev->irq, ohci); 3281 free_irq(dev->irq, ohci);
3250 3282
3251 case OHCI_INIT_HAVE_TXRX_BUFFERS__MAYBE: 3283 case OHCI_INIT_HAVE_TXRX_BUFFERS__MAYBE:
3252 /* The ohci_soft_reset() stops all DMA contexts, so we 3284 /* The ohci_soft_reset() stops all DMA contexts, so we
@@ -3257,12 +3289,12 @@ static void ohci1394_pci_remove(struct pci_dev *pdev)
3257 free_dma_trm_ctx(&ohci->at_resp_context); 3289 free_dma_trm_ctx(&ohci->at_resp_context);
3258 3290
3259 case OHCI_INIT_HAVE_SELFID_BUFFER: 3291 case OHCI_INIT_HAVE_SELFID_BUFFER:
3260 pci_free_consistent(ohci->dev, OHCI1394_SI_DMA_BUF_SIZE, 3292 pci_free_consistent(dev, OHCI1394_SI_DMA_BUF_SIZE,
3261 ohci->selfid_buf_cpu, 3293 ohci->selfid_buf_cpu,
3262 ohci->selfid_buf_bus); 3294 ohci->selfid_buf_bus);
3263 3295
3264 case OHCI_INIT_HAVE_CONFIG_ROM_BUFFER: 3296 case OHCI_INIT_HAVE_CONFIG_ROM_BUFFER:
3265 pci_free_consistent(ohci->dev, OHCI_CONFIG_ROM_LEN, 3297 pci_free_consistent(dev, OHCI_CONFIG_ROM_LEN,
3266 ohci->csr_config_rom_cpu, 3298 ohci->csr_config_rom_cpu,
3267 ohci->csr_config_rom_bus); 3299 ohci->csr_config_rom_bus);
3268 3300
@@ -3270,35 +3302,24 @@ static void ohci1394_pci_remove(struct pci_dev *pdev)
3270 iounmap(ohci->registers); 3302 iounmap(ohci->registers);
3271 3303
3272 case OHCI_INIT_HAVE_MEM_REGION: 3304 case OHCI_INIT_HAVE_MEM_REGION:
3273 release_mem_region(pci_resource_start(ohci->dev, 0), 3305 release_mem_region(pci_resource_start(dev, 0),
3274 OHCI1394_REGISTER_SIZE); 3306 OHCI1394_REGISTER_SIZE);
3275 3307
3276#ifdef CONFIG_PPC_PMAC
3277 /* On UniNorth, power down the cable and turn off the chip clock
3278 * to save power on laptops */
3279 if (machine_is(powermac)) {
3280 struct device_node* ofn = pci_device_to_OF_node(ohci->dev);
3281
3282 if (ofn) {
3283 pmac_call_feature(PMAC_FTR_1394_ENABLE, ofn, 0, 0);
3284 pmac_call_feature(PMAC_FTR_1394_CABLE_POWER, ofn, 0, 0);
3285 }
3286 }
3287#endif /* CONFIG_PPC_PMAC */
3288
3289 case OHCI_INIT_ALLOC_HOST: 3308 case OHCI_INIT_ALLOC_HOST:
3290 pci_set_drvdata(ohci->dev, NULL); 3309 pci_set_drvdata(dev, NULL);
3291 } 3310 }
3292 3311
3293 if (dev) 3312 if (device)
3294 put_device(dev); 3313 put_device(device);
3314out:
3315 ohci1394_pmac_off(dev);
3295} 3316}
3296 3317
3297#ifdef CONFIG_PM 3318#ifdef CONFIG_PM
3298static int ohci1394_pci_suspend(struct pci_dev *pdev, pm_message_t state) 3319static int ohci1394_pci_suspend(struct pci_dev *dev, pm_message_t state)
3299{ 3320{
3300 int err; 3321 int err;
3301 struct ti_ohci *ohci = pci_get_drvdata(pdev); 3322 struct ti_ohci *ohci = pci_get_drvdata(dev);
3302 3323
3303 if (!ohci) { 3324 if (!ohci) {
3304 printk(KERN_ERR "%s: tried to suspend nonexisting host\n", 3325 printk(KERN_ERR "%s: tried to suspend nonexisting host\n",
@@ -3326,32 +3347,23 @@ static int ohci1394_pci_suspend(struct pci_dev *pdev, pm_message_t state)
3326 ohci_devctl(ohci->host, RESET_BUS, LONG_RESET_NO_FORCE_ROOT); 3347 ohci_devctl(ohci->host, RESET_BUS, LONG_RESET_NO_FORCE_ROOT);
3327 ohci_soft_reset(ohci); 3348 ohci_soft_reset(ohci);
3328 3349
3329 err = pci_save_state(pdev); 3350 err = pci_save_state(dev);
3330 if (err) { 3351 if (err) {
3331 PRINT(KERN_ERR, "pci_save_state failed with %d", err); 3352 PRINT(KERN_ERR, "pci_save_state failed with %d", err);
3332 return err; 3353 return err;
3333 } 3354 }
3334 err = pci_set_power_state(pdev, pci_choose_state(pdev, state)); 3355 err = pci_set_power_state(dev, pci_choose_state(dev, state));
3335 if (err) 3356 if (err)
3336 DBGMSG("pci_set_power_state failed with %d", err); 3357 DBGMSG("pci_set_power_state failed with %d", err);
3337 3358 ohci1394_pmac_off(dev);
3338/* PowerMac suspend code comes last */
3339#ifdef CONFIG_PPC_PMAC
3340 if (machine_is(powermac)) {
3341 struct device_node *ofn = pci_device_to_OF_node(pdev);
3342
3343 if (ofn)
3344 pmac_call_feature(PMAC_FTR_1394_ENABLE, ofn, 0, 0);
3345 }
3346#endif /* CONFIG_PPC_PMAC */
3347 3359
3348 return 0; 3360 return 0;
3349} 3361}
3350 3362
3351static int ohci1394_pci_resume(struct pci_dev *pdev) 3363static int ohci1394_pci_resume(struct pci_dev *dev)
3352{ 3364{
3353 int err; 3365 int err;
3354 struct ti_ohci *ohci = pci_get_drvdata(pdev); 3366 struct ti_ohci *ohci = pci_get_drvdata(dev);
3355 3367
3356 if (!ohci) { 3368 if (!ohci) {
3357 printk(KERN_ERR "%s: tried to resume nonexisting host\n", 3369 printk(KERN_ERR "%s: tried to resume nonexisting host\n",
@@ -3360,19 +3372,10 @@ static int ohci1394_pci_resume(struct pci_dev *pdev)
3360 } 3372 }
3361 DBGMSG("resume called"); 3373 DBGMSG("resume called");
3362 3374
3363/* PowerMac resume code comes first */ 3375 ohci1394_pmac_on(dev);
3364#ifdef CONFIG_PPC_PMAC 3376 pci_set_power_state(dev, PCI_D0);
3365 if (machine_is(powermac)) { 3377 pci_restore_state(dev);
3366 struct device_node *ofn = pci_device_to_OF_node(pdev); 3378 err = pci_enable_device(dev);
3367
3368 if (ofn)
3369 pmac_call_feature(PMAC_FTR_1394_ENABLE, ofn, 0, 1);
3370 }
3371#endif /* CONFIG_PPC_PMAC */
3372
3373 pci_set_power_state(pdev, PCI_D0);
3374 pci_restore_state(pdev);
3375 err = pci_enable_device(pdev);
3376 if (err) { 3379 if (err) {
3377 PRINT(KERN_ERR, "pci_enable_device failed with %d", err); 3380 PRINT(KERN_ERR, "pci_enable_device failed with %d", err);
3378 return err; 3381 return err;
diff --git a/drivers/ieee1394/pcilynx.c b/drivers/ieee1394/pcilynx.c
index 8af01ab30cc9..7aee1ac97c80 100644
--- a/drivers/ieee1394/pcilynx.c
+++ b/drivers/ieee1394/pcilynx.c
@@ -226,7 +226,7 @@ static int get_phy_reg(struct ti_lynx *lynx, int addr)
226 if (addr > 15) { 226 if (addr > 15) {
227 PRINT(KERN_ERR, lynx->id, 227 PRINT(KERN_ERR, lynx->id,
228 "%s: PHY register address %d out of range", 228 "%s: PHY register address %d out of range",
229 __FUNCTION__, addr); 229 __func__, addr);
230 return -1; 230 return -1;
231 } 231 }
232 232
@@ -238,7 +238,7 @@ static int get_phy_reg(struct ti_lynx *lynx, int addr)
238 238
239 if (i > 10000) { 239 if (i > 10000) {
240 PRINT(KERN_ERR, lynx->id, "%s: runaway loop, aborting", 240 PRINT(KERN_ERR, lynx->id, "%s: runaway loop, aborting",
241 __FUNCTION__); 241 __func__);
242 retval = -1; 242 retval = -1;
243 break; 243 break;
244 } 244 }
@@ -261,13 +261,13 @@ static int set_phy_reg(struct ti_lynx *lynx, int addr, int val)
261 261
262 if (addr > 15) { 262 if (addr > 15) {
263 PRINT(KERN_ERR, lynx->id, 263 PRINT(KERN_ERR, lynx->id,
264 "%s: PHY register address %d out of range", __FUNCTION__, addr); 264 "%s: PHY register address %d out of range", __func__, addr);
265 return -1; 265 return -1;
266 } 266 }
267 267
268 if (val > 0xff) { 268 if (val > 0xff) {
269 PRINT(KERN_ERR, lynx->id, 269 PRINT(KERN_ERR, lynx->id,
270 "%s: PHY register value %d out of range", __FUNCTION__, val); 270 "%s: PHY register value %d out of range", __func__, val);
271 return -1; 271 return -1;
272 } 272 }
273 273
@@ -287,7 +287,7 @@ static int sel_phy_reg_page(struct ti_lynx *lynx, int page)
287 287
288 if (page > 7) { 288 if (page > 7) {
289 PRINT(KERN_ERR, lynx->id, 289 PRINT(KERN_ERR, lynx->id,
290 "%s: PHY page %d out of range", __FUNCTION__, page); 290 "%s: PHY page %d out of range", __func__, page);
291 return -1; 291 return -1;
292 } 292 }
293 293
@@ -309,7 +309,7 @@ static int sel_phy_reg_port(struct ti_lynx *lynx, int port)
309 309
310 if (port > 15) { 310 if (port > 15) {
311 PRINT(KERN_ERR, lynx->id, 311 PRINT(KERN_ERR, lynx->id,
312 "%s: PHY port %d out of range", __FUNCTION__, port); 312 "%s: PHY port %d out of range", __func__, port);
313 return -1; 313 return -1;
314 } 314 }
315 315
@@ -738,8 +738,7 @@ static int lynx_devctl(struct hpsb_host *host, enum devctl_cmd cmd, int arg)
738 spin_lock_irqsave(&lynx->async.queue_lock, flags); 738 spin_lock_irqsave(&lynx->async.queue_lock, flags);
739 739
740 reg_write(lynx, DMA_CHAN_CTRL(CHANNEL_ASYNC_SEND), 0); 740 reg_write(lynx, DMA_CHAN_CTRL(CHANNEL_ASYNC_SEND), 0);
741 list_splice(&lynx->async.queue, &packet_list); 741 list_splice_init(&lynx->async.queue, &packet_list);
742 INIT_LIST_HEAD(&lynx->async.queue);
743 742
744 if (list_empty(&lynx->async.pcl_queue)) { 743 if (list_empty(&lynx->async.pcl_queue)) {
745 spin_unlock_irqrestore(&lynx->async.queue_lock, flags); 744 spin_unlock_irqrestore(&lynx->async.queue_lock, flags);
diff --git a/drivers/ieee1394/raw1394.c b/drivers/ieee1394/raw1394.c
index 37e7e109af38..04e96ba56e09 100644
--- a/drivers/ieee1394/raw1394.c
+++ b/drivers/ieee1394/raw1394.c
@@ -2959,7 +2959,6 @@ MODULE_DEVICE_TABLE(ieee1394, raw1394_id_table);
2959 2959
2960static struct hpsb_protocol_driver raw1394_driver = { 2960static struct hpsb_protocol_driver raw1394_driver = {
2961 .name = "raw1394", 2961 .name = "raw1394",
2962 .id_table = raw1394_id_table,
2963}; 2962};
2964 2963
2965/******************************************************************************/ 2964/******************************************************************************/
@@ -3004,7 +3003,6 @@ static int __init init_raw1394(void)
3004 3003
3005 cdev_init(&raw1394_cdev, &raw1394_fops); 3004 cdev_init(&raw1394_cdev, &raw1394_fops);
3006 raw1394_cdev.owner = THIS_MODULE; 3005 raw1394_cdev.owner = THIS_MODULE;
3007 kobject_set_name(&raw1394_cdev.kobj, RAW1394_DEVICE_NAME);
3008 ret = cdev_add(&raw1394_cdev, IEEE1394_RAW1394_DEV, 1); 3006 ret = cdev_add(&raw1394_cdev, IEEE1394_RAW1394_DEV, 1);
3009 if (ret) { 3007 if (ret) {
3010 HPSB_ERR("raw1394 failed to register minor device block"); 3008 HPSB_ERR("raw1394 failed to register minor device block");
diff --git a/drivers/ieee1394/sbp2.c b/drivers/ieee1394/sbp2.c
index f53f72daae34..16b9d0ad154e 100644
--- a/drivers/ieee1394/sbp2.c
+++ b/drivers/ieee1394/sbp2.c
@@ -615,7 +615,7 @@ static struct sbp2_command_info *sbp2util_allocate_command_orb(
615 cmd->Current_SCpnt = Current_SCpnt; 615 cmd->Current_SCpnt = Current_SCpnt;
616 list_add_tail(&cmd->list, &lu->cmd_orb_inuse); 616 list_add_tail(&cmd->list, &lu->cmd_orb_inuse);
617 } else 617 } else
618 SBP2_ERR("%s: no orbs available", __FUNCTION__); 618 SBP2_ERR("%s: no orbs available", __func__);
619 spin_unlock_irqrestore(&lu->cmd_orb_lock, flags); 619 spin_unlock_irqrestore(&lu->cmd_orb_lock, flags);
620 return cmd; 620 return cmd;
621} 621}
@@ -1294,7 +1294,7 @@ static int sbp2_set_busy_timeout(struct sbp2_lu *lu)
1294 1294
1295 data = cpu_to_be32(SBP2_BUSY_TIMEOUT_VALUE); 1295 data = cpu_to_be32(SBP2_BUSY_TIMEOUT_VALUE);
1296 if (hpsb_node_write(lu->ne, SBP2_BUSY_TIMEOUT_ADDRESS, &data, 4)) 1296 if (hpsb_node_write(lu->ne, SBP2_BUSY_TIMEOUT_ADDRESS, &data, 4))
1297 SBP2_ERR("%s error", __FUNCTION__); 1297 SBP2_ERR("%s error", __func__);
1298 return 0; 1298 return 0;
1299} 1299}
1300 1300
@@ -1985,11 +1985,8 @@ static int sbp2scsi_slave_alloc(struct scsi_device *sdev)
1985 lu->sdev = sdev; 1985 lu->sdev = sdev;
1986 sdev->allow_restart = 1; 1986 sdev->allow_restart = 1;
1987 1987
1988 /* 1988 /* SBP-2 requires quadlet alignment of the data buffers. */
1989 * Update the dma alignment (minimum alignment requirements for 1989 blk_queue_update_dma_alignment(sdev->request_queue, 4 - 1);
1990 * start and end of DMA transfers) to be a sector
1991 */
1992 blk_queue_update_dma_alignment(sdev->request_queue, 511);
1993 1990
1994 if (lu->workarounds & SBP2_WORKAROUND_INQUIRY_36) 1991 if (lu->workarounds & SBP2_WORKAROUND_INQUIRY_36)
1995 sdev->inquiry_len = 36; 1992 sdev->inquiry_len = 36;
diff --git a/drivers/ieee1394/video1394.c b/drivers/ieee1394/video1394.c
index bd28adfd7afc..e03024eeeac1 100644
--- a/drivers/ieee1394/video1394.c
+++ b/drivers/ieee1394/video1394.c
@@ -1315,8 +1315,7 @@ static struct ieee1394_device_id video1394_id_table[] = {
1315MODULE_DEVICE_TABLE(ieee1394, video1394_id_table); 1315MODULE_DEVICE_TABLE(ieee1394, video1394_id_table);
1316 1316
1317static struct hpsb_protocol_driver video1394_driver = { 1317static struct hpsb_protocol_driver video1394_driver = {
1318 .name = VIDEO1394_DRIVER_NAME, 1318 .name = VIDEO1394_DRIVER_NAME,
1319 .id_table = video1394_id_table,
1320}; 1319};
1321 1320
1322 1321
@@ -1504,7 +1503,6 @@ static int __init video1394_init_module (void)
1504 1503
1505 cdev_init(&video1394_cdev, &video1394_fops); 1504 cdev_init(&video1394_cdev, &video1394_fops);
1506 video1394_cdev.owner = THIS_MODULE; 1505 video1394_cdev.owner = THIS_MODULE;
1507 kobject_set_name(&video1394_cdev.kobj, VIDEO1394_DRIVER_NAME);
1508 ret = cdev_add(&video1394_cdev, IEEE1394_VIDEO1394_DEV, 16); 1506 ret = cdev_add(&video1394_cdev, IEEE1394_VIDEO1394_DEV, 16);
1509 if (ret) { 1507 if (ret) {
1510 PRINT_G(KERN_ERR, "video1394: unable to get minor device block"); 1508 PRINT_G(KERN_ERR, "video1394: unable to get minor device block");