i2c-powermac.c (f26e8817b235d8764363bffcc9cbfc61867371f2) i2c-powermac.c (453a237ccffad899ce15fb61e871e4784004be17)
1/*
2 i2c Support for Apple SMU Controller
3
4 Copyright (c) 2005 Benjamin Herrenschmidt, IBM Corp.
5 <benh@kernel.crashing.org>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by

--- 220 unchanged lines hidden (view full) ---

229 return (be32_to_cpup(prop) & 0xff) >> 1;
230
231 /* Now handle some devices with missing "reg" properties */
232 if (!strcmp(node->name, "cereal"))
233 return 0x60;
234 else if (!strcmp(node->name, "deq"))
235 return 0x34;
236
1/*
2 i2c Support for Apple SMU Controller
3
4 Copyright (c) 2005 Benjamin Herrenschmidt, IBM Corp.
5 <benh@kernel.crashing.org>
6
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by

--- 220 unchanged lines hidden (view full) ---

229 return (be32_to_cpup(prop) & 0xff) >> 1;
230
231 /* Now handle some devices with missing "reg" properties */
232 if (!strcmp(node->name, "cereal"))
233 return 0x60;
234 else if (!strcmp(node->name, "deq"))
235 return 0x34;
236
237 dev_warn(&adap->dev, "No i2c address for %s\n", node->full_name);
237 dev_warn(&adap->dev, "No i2c address for %pOF\n", node);
238
239 return 0xffffffff;
240}
241
242static void i2c_powermac_create_one(struct i2c_adapter *adap,
243 const char *type,
244 u32 addr)
245{

--- 64 unchanged lines hidden (view full) ---

310 snprintf(type, type_size, "MAC,tas3001");
311 return true;
312 } else if (addr == 0x35) {
313 snprintf(type, type_size, "MAC,tas3004");
314 return true;
315 }
316 }
317
238
239 return 0xffffffff;
240}
241
242static void i2c_powermac_create_one(struct i2c_adapter *adap,
243 const char *type,
244 u32 addr)
245{

--- 64 unchanged lines hidden (view full) ---

310 snprintf(type, type_size, "MAC,tas3001");
311 return true;
312 } else if (addr == 0x35) {
313 snprintf(type, type_size, "MAC,tas3004");
314 return true;
315 }
316 }
317
318 dev_err(&adap->dev, "i2c-powermac: modalias failure"
319 " on %s\n", node->full_name);
318 dev_err(&adap->dev, "i2c-powermac: modalias failure on %pOF\n", node);
320 return false;
321}
322
323static void i2c_powermac_register_devices(struct i2c_adapter *adap,
324 struct pmac_i2c_bus *bus)
325{
326 struct i2c_client *newdev;
327 struct device_node *node;

--- 15 unchanged lines hidden (view full) ---

343 addr = i2c_powermac_get_addr(adap, bus, node);
344 if (addr == 0xffffffff)
345 continue;
346
347 /* Multibus setup, check channel */
348 if (!pmac_i2c_match_adapter(node, adap))
349 continue;
350
319 return false;
320}
321
322static void i2c_powermac_register_devices(struct i2c_adapter *adap,
323 struct pmac_i2c_bus *bus)
324{
325 struct i2c_client *newdev;
326 struct device_node *node;

--- 15 unchanged lines hidden (view full) ---

342 addr = i2c_powermac_get_addr(adap, bus, node);
343 if (addr == 0xffffffff)
344 continue;
345
346 /* Multibus setup, check channel */
347 if (!pmac_i2c_match_adapter(node, adap))
348 continue;
349
351 dev_dbg(&adap->dev, "i2c-powermac: register %s\n",
352 node->full_name);
350 dev_dbg(&adap->dev, "i2c-powermac: register %pOF\n", node);
353
354 /*
355 * Keep track of some device existence to handle
356 * workarounds later.
357 */
358 if (of_device_is_compatible(node, "pcm3052"))
359 found_onyx = true;
360

--- 6 unchanged lines hidden (view full) ---

367 /* Fill out the rest of the info structure */
368 info.addr = addr;
369 info.irq = irq_of_parse_and_map(node, 0);
370 info.of_node = of_node_get(node);
371
372 newdev = i2c_new_device(adap, &info);
373 if (!newdev) {
374 dev_err(&adap->dev, "i2c-powermac: Failure to register"
351
352 /*
353 * Keep track of some device existence to handle
354 * workarounds later.
355 */
356 if (of_device_is_compatible(node, "pcm3052"))
357 found_onyx = true;
358

--- 6 unchanged lines hidden (view full) ---

365 /* Fill out the rest of the info structure */
366 info.addr = addr;
367 info.irq = irq_of_parse_and_map(node, 0);
368 info.of_node = of_node_get(node);
369
370 newdev = i2c_new_device(adap, &info);
371 if (!newdev) {
372 dev_err(&adap->dev, "i2c-powermac: Failure to register"
375 " %s\n", node->full_name);
373 " %pOF\n", node);
376 of_node_put(node);
377 /* We do not dispose of the interrupt mapping on
378 * purpose. It's not necessary (interrupt cannot be
379 * re-used) and somebody else might have grabbed it
380 * via direct DT lookup so let's not bother
381 */
382 continue;
383 }

--- 83 unchanged lines hidden ---
374 of_node_put(node);
375 /* We do not dispose of the interrupt mapping on
376 * purpose. It's not necessary (interrupt cannot be
377 * re-used) and somebody else might have grabbed it
378 * via direct DT lookup so let's not bother
379 */
380 continue;
381 }

--- 83 unchanged lines hidden ---