firewire: fw-ohci: Apple UniNorth 1st generation support

Mostly copied from ohci1394.c. Necessary for some older Macs, e.g.
PowerBook G3 Pismo and early PowerBook G4 Titanium.

Signed-off-by: Stefan Richter <stefanr@s5r6.in-berlin.de>

+21 -8
+21 -8
drivers/firewire/fw-ohci.c
··· 179 179 int generation; 180 180 int request_generation; 181 181 u32 bus_seconds; 182 + bool old_uninorth; 182 183 183 184 /* 184 185 * Spinlock for accessing fw_ohci data. Never call out of ··· 316 315 return 0; 317 316 } 318 317 318 + #if defined(CONFIG_PPC_PMAC) && defined(CONFIG_PPC32) 319 + #define cond_le32_to_cpu(v) \ 320 + (ohci->old_uninorth ? (__force __u32)(v) : le32_to_cpu(v)) 321 + #else 322 + #define cond_le32_to_cpu(v) le32_to_cpu(v) 323 + #endif 324 + 319 325 static __le32 *handle_ar_packet(struct ar_context *ctx, __le32 *buffer) 320 326 { 321 327 struct fw_ohci *ohci = ctx->ohci; 322 328 struct fw_packet p; 323 329 u32 status, length, tcode; 324 330 325 - p.header[0] = le32_to_cpu(buffer[0]); 326 - p.header[1] = le32_to_cpu(buffer[1]); 327 - p.header[2] = le32_to_cpu(buffer[2]); 331 + p.header[0] = cond_le32_to_cpu(buffer[0]); 332 + p.header[1] = cond_le32_to_cpu(buffer[1]); 333 + p.header[2] = cond_le32_to_cpu(buffer[2]); 328 334 329 335 tcode = (p.header[0] >> 4) & 0x0f; 330 336 switch (tcode) { ··· 343 335 break; 344 336 345 337 case TCODE_READ_BLOCK_REQUEST : 346 - p.header[3] = le32_to_cpu(buffer[3]); 338 + p.header[3] = cond_le32_to_cpu(buffer[3]); 347 339 p.header_length = 16; 348 340 p.payload_length = 0; 349 341 break; ··· 352 344 case TCODE_READ_BLOCK_RESPONSE: 353 345 case TCODE_LOCK_REQUEST: 354 346 case TCODE_LOCK_RESPONSE: 355 - p.header[3] = le32_to_cpu(buffer[3]); 347 + p.header[3] = cond_le32_to_cpu(buffer[3]); 356 348 p.header_length = 16; 357 349 p.payload_length = p.header[3] >> 16; 358 350 break; ··· 369 361 370 362 /* FIXME: What to do about evt_* errors? */ 371 363 length = (p.header_length + p.payload_length + 3) / 4; 372 - status = le32_to_cpu(buffer[length]); 364 + status = cond_le32_to_cpu(buffer[length]); 373 365 374 366 p.ack = ((status >> 16) & 0x1f) - 16; 375 367 p.speed = (status >> 21) & 0x7; ··· 1034 1026 */ 1035 1027 1036 1028 self_id_count = (reg_read(ohci, OHCI1394_SelfIDCount) >> 3) & 0x3ff; 1037 - generation = (le32_to_cpu(ohci->self_id_cpu[0]) >> 16) & 0xff; 1029 + generation = (cond_le32_to_cpu(ohci->self_id_cpu[0]) >> 16) & 0xff; 1038 1030 rmb(); 1039 1031 1040 1032 for (i = 1, j = 0; j < self_id_count; i += 2, j++) { 1041 1033 if (ohci->self_id_cpu[i] != ~ohci->self_id_cpu[i + 1]) 1042 1034 fw_error("inconsistent self IDs\n"); 1043 - ohci->self_id_buffer[j] = le32_to_cpu(ohci->self_id_cpu[i]); 1035 + ohci->self_id_buffer[j] = 1036 + cond_le32_to_cpu(ohci->self_id_cpu[i]); 1044 1037 } 1045 1038 rmb(); 1046 1039 ··· 2091 2082 pci_write_config_dword(dev, OHCI1394_PCI_HCI_Control, 0); 2092 2083 pci_set_drvdata(dev, ohci); 2093 2084 2085 + #if defined(CONFIG_PPC_PMAC) && defined(CONFIG_PPC32) 2086 + ohci->old_uninorth = dev->vendor == PCI_VENDOR_ID_APPLE && 2087 + dev->device == PCI_DEVICE_ID_APPLE_UNI_N_FW; 2088 + #endif 2094 2089 spin_lock_init(&ohci->lock); 2095 2090 2096 2091 tasklet_init(&ohci->bus_reset_tasklet,