diff options
Diffstat (limited to 'drivers/i2c')
-rw-r--r-- | drivers/i2c/busses/i2c-cpm.c | 30 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-ibm_iic.c | 11 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-mpc.c | 25 | ||||
-rw-r--r-- | drivers/i2c/i2c-core.c | 3 |
4 files changed, 38 insertions, 31 deletions
diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c index 16948db38973..b02b4533651d 100644 --- a/drivers/i2c/busses/i2c-cpm.c +++ b/drivers/i2c/busses/i2c-cpm.c | |||
@@ -440,7 +440,7 @@ static int __devinit cpm_i2c_setup(struct cpm_i2c *cpm) | |||
440 | 440 | ||
441 | init_waitqueue_head(&cpm->i2c_wait); | 441 | init_waitqueue_head(&cpm->i2c_wait); |
442 | 442 | ||
443 | cpm->irq = of_irq_to_resource(ofdev->node, 0, NULL); | 443 | cpm->irq = of_irq_to_resource(ofdev->dev.of_node, 0, NULL); |
444 | if (!cpm->irq) | 444 | if (!cpm->irq) |
445 | return -EINVAL; | 445 | return -EINVAL; |
446 | 446 | ||
@@ -451,13 +451,13 @@ static int __devinit cpm_i2c_setup(struct cpm_i2c *cpm) | |||
451 | return ret; | 451 | return ret; |
452 | 452 | ||
453 | /* I2C parameter RAM */ | 453 | /* I2C parameter RAM */ |
454 | i2c_base = of_iomap(ofdev->node, 1); | 454 | i2c_base = of_iomap(ofdev->dev.of_node, 1); |
455 | if (i2c_base == NULL) { | 455 | if (i2c_base == NULL) { |
456 | ret = -EINVAL; | 456 | ret = -EINVAL; |
457 | goto out_irq; | 457 | goto out_irq; |
458 | } | 458 | } |
459 | 459 | ||
460 | if (of_device_is_compatible(ofdev->node, "fsl,cpm1-i2c")) { | 460 | if (of_device_is_compatible(ofdev->dev.of_node, "fsl,cpm1-i2c")) { |
461 | 461 | ||
462 | /* Check for and use a microcode relocation patch. */ | 462 | /* Check for and use a microcode relocation patch. */ |
463 | cpm->i2c_ram = i2c_base; | 463 | cpm->i2c_ram = i2c_base; |
@@ -474,7 +474,7 @@ static int __devinit cpm_i2c_setup(struct cpm_i2c *cpm) | |||
474 | 474 | ||
475 | cpm->version = 1; | 475 | cpm->version = 1; |
476 | 476 | ||
477 | } else if (of_device_is_compatible(ofdev->node, "fsl,cpm2-i2c")) { | 477 | } else if (of_device_is_compatible(ofdev->dev.of_node, "fsl,cpm2-i2c")) { |
478 | cpm->i2c_addr = cpm_muram_alloc(sizeof(struct i2c_ram), 64); | 478 | cpm->i2c_addr = cpm_muram_alloc(sizeof(struct i2c_ram), 64); |
479 | cpm->i2c_ram = cpm_muram_addr(cpm->i2c_addr); | 479 | cpm->i2c_ram = cpm_muram_addr(cpm->i2c_addr); |
480 | out_be16(i2c_base, cpm->i2c_addr); | 480 | out_be16(i2c_base, cpm->i2c_addr); |
@@ -489,24 +489,24 @@ static int __devinit cpm_i2c_setup(struct cpm_i2c *cpm) | |||
489 | } | 489 | } |
490 | 490 | ||
491 | /* I2C control/status registers */ | 491 | /* I2C control/status registers */ |
492 | cpm->i2c_reg = of_iomap(ofdev->node, 0); | 492 | cpm->i2c_reg = of_iomap(ofdev->dev.of_node, 0); |
493 | if (cpm->i2c_reg == NULL) { | 493 | if (cpm->i2c_reg == NULL) { |
494 | ret = -EINVAL; | 494 | ret = -EINVAL; |
495 | goto out_ram; | 495 | goto out_ram; |
496 | } | 496 | } |
497 | 497 | ||
498 | data = of_get_property(ofdev->node, "fsl,cpm-command", &len); | 498 | data = of_get_property(ofdev->dev.of_node, "fsl,cpm-command", &len); |
499 | if (!data || len != 4) { | 499 | if (!data || len != 4) { |
500 | ret = -EINVAL; | 500 | ret = -EINVAL; |
501 | goto out_reg; | 501 | goto out_reg; |
502 | } | 502 | } |
503 | cpm->cp_command = *data; | 503 | cpm->cp_command = *data; |
504 | 504 | ||
505 | data = of_get_property(ofdev->node, "linux,i2c-class", &len); | 505 | data = of_get_property(ofdev->dev.of_node, "linux,i2c-class", &len); |
506 | if (data && len == 4) | 506 | if (data && len == 4) |
507 | cpm->adap.class = *data; | 507 | cpm->adap.class = *data; |
508 | 508 | ||
509 | data = of_get_property(ofdev->node, "clock-frequency", &len); | 509 | data = of_get_property(ofdev->dev.of_node, "clock-frequency", &len); |
510 | if (data && len == 4) | 510 | if (data && len == 4) |
511 | cpm->freq = *data; | 511 | cpm->freq = *data; |
512 | else | 512 | else |
@@ -661,7 +661,7 @@ static int __devinit cpm_i2c_probe(struct of_device *ofdev, | |||
661 | 661 | ||
662 | /* register new adapter to i2c module... */ | 662 | /* register new adapter to i2c module... */ |
663 | 663 | ||
664 | data = of_get_property(ofdev->node, "linux,i2c-index", &len); | 664 | data = of_get_property(ofdev->dev.of_node, "linux,i2c-index", &len); |
665 | if (data && len == 4) { | 665 | if (data && len == 4) { |
666 | cpm->adap.nr = *data; | 666 | cpm->adap.nr = *data; |
667 | result = i2c_add_numbered_adapter(&cpm->adap); | 667 | result = i2c_add_numbered_adapter(&cpm->adap); |
@@ -679,7 +679,7 @@ static int __devinit cpm_i2c_probe(struct of_device *ofdev, | |||
679 | /* | 679 | /* |
680 | * register OF I2C devices | 680 | * register OF I2C devices |
681 | */ | 681 | */ |
682 | of_register_i2c_devices(&cpm->adap, ofdev->node); | 682 | of_register_i2c_devices(&cpm->adap, ofdev->dev.of_node); |
683 | 683 | ||
684 | return 0; | 684 | return 0; |
685 | out_shut: | 685 | out_shut: |
@@ -718,13 +718,13 @@ static const struct of_device_id cpm_i2c_match[] = { | |||
718 | MODULE_DEVICE_TABLE(of, cpm_i2c_match); | 718 | MODULE_DEVICE_TABLE(of, cpm_i2c_match); |
719 | 719 | ||
720 | static struct of_platform_driver cpm_i2c_driver = { | 720 | static struct of_platform_driver cpm_i2c_driver = { |
721 | .match_table = cpm_i2c_match, | ||
722 | .probe = cpm_i2c_probe, | 721 | .probe = cpm_i2c_probe, |
723 | .remove = __devexit_p(cpm_i2c_remove), | 722 | .remove = __devexit_p(cpm_i2c_remove), |
724 | .driver = { | 723 | .driver = { |
725 | .name = "fsl-i2c-cpm", | 724 | .name = "fsl-i2c-cpm", |
726 | .owner = THIS_MODULE, | 725 | .owner = THIS_MODULE, |
727 | } | 726 | .of_match_table = cpm_i2c_match, |
727 | }, | ||
728 | }; | 728 | }; |
729 | 729 | ||
730 | static int __init cpm_i2c_init(void) | 730 | static int __init cpm_i2c_init(void) |
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c index f8ccc0fe95a8..bf344135647a 100644 --- a/drivers/i2c/busses/i2c-ibm_iic.c +++ b/drivers/i2c/busses/i2c-ibm_iic.c | |||
@@ -664,7 +664,7 @@ static inline u8 iic_clckdiv(unsigned int opb) | |||
664 | static int __devinit iic_request_irq(struct of_device *ofdev, | 664 | static int __devinit iic_request_irq(struct of_device *ofdev, |
665 | struct ibm_iic_private *dev) | 665 | struct ibm_iic_private *dev) |
666 | { | 666 | { |
667 | struct device_node *np = ofdev->node; | 667 | struct device_node *np = ofdev->dev.of_node; |
668 | int irq; | 668 | int irq; |
669 | 669 | ||
670 | if (iic_force_poll) | 670 | if (iic_force_poll) |
@@ -695,7 +695,7 @@ static int __devinit iic_request_irq(struct of_device *ofdev, | |||
695 | static int __devinit iic_probe(struct of_device *ofdev, | 695 | static int __devinit iic_probe(struct of_device *ofdev, |
696 | const struct of_device_id *match) | 696 | const struct of_device_id *match) |
697 | { | 697 | { |
698 | struct device_node *np = ofdev->node; | 698 | struct device_node *np = ofdev->dev.of_node; |
699 | struct ibm_iic_private *dev; | 699 | struct ibm_iic_private *dev; |
700 | struct i2c_adapter *adap; | 700 | struct i2c_adapter *adap; |
701 | const u32 *freq; | 701 | const u32 *freq; |
@@ -807,8 +807,11 @@ static const struct of_device_id ibm_iic_match[] = { | |||
807 | }; | 807 | }; |
808 | 808 | ||
809 | static struct of_platform_driver ibm_iic_driver = { | 809 | static struct of_platform_driver ibm_iic_driver = { |
810 | .name = "ibm-iic", | 810 | .driver = { |
811 | .match_table = ibm_iic_match, | 811 | .name = "ibm-iic", |
812 | .owner = THIS_MODULE, | ||
813 | .of_match_table = ibm_iic_match, | ||
814 | }, | ||
812 | .probe = iic_probe, | 815 | .probe = iic_probe, |
813 | .remove = __devexit_p(iic_remove), | 816 | .remove = __devexit_p(iic_remove), |
814 | }; | 817 | }; |
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c index e86cef300c7d..df00eb1f11f9 100644 --- a/drivers/i2c/busses/i2c-mpc.c +++ b/drivers/i2c/busses/i2c-mpc.c | |||
@@ -560,14 +560,14 @@ static int __devinit fsl_i2c_probe(struct of_device *op, | |||
560 | 560 | ||
561 | init_waitqueue_head(&i2c->queue); | 561 | init_waitqueue_head(&i2c->queue); |
562 | 562 | ||
563 | i2c->base = of_iomap(op->node, 0); | 563 | i2c->base = of_iomap(op->dev.of_node, 0); |
564 | if (!i2c->base) { | 564 | if (!i2c->base) { |
565 | dev_err(i2c->dev, "failed to map controller\n"); | 565 | dev_err(i2c->dev, "failed to map controller\n"); |
566 | result = -ENOMEM; | 566 | result = -ENOMEM; |
567 | goto fail_map; | 567 | goto fail_map; |
568 | } | 568 | } |
569 | 569 | ||
570 | i2c->irq = irq_of_parse_and_map(op->node, 0); | 570 | i2c->irq = irq_of_parse_and_map(op->dev.of_node, 0); |
571 | if (i2c->irq) { /* no i2c->irq implies polling */ | 571 | if (i2c->irq) { /* no i2c->irq implies polling */ |
572 | result = request_irq(i2c->irq, mpc_i2c_isr, | 572 | result = request_irq(i2c->irq, mpc_i2c_isr, |
573 | IRQF_SHARED, "i2c-mpc", i2c); | 573 | IRQF_SHARED, "i2c-mpc", i2c); |
@@ -577,21 +577,22 @@ static int __devinit fsl_i2c_probe(struct of_device *op, | |||
577 | } | 577 | } |
578 | } | 578 | } |
579 | 579 | ||
580 | if (of_get_property(op->node, "fsl,preserve-clocking", NULL)) { | 580 | if (of_get_property(op->dev.of_node, "fsl,preserve-clocking", NULL)) { |
581 | clock = MPC_I2C_CLOCK_PRESERVE; | 581 | clock = MPC_I2C_CLOCK_PRESERVE; |
582 | } else { | 582 | } else { |
583 | prop = of_get_property(op->node, "clock-frequency", &plen); | 583 | prop = of_get_property(op->dev.of_node, "clock-frequency", |
584 | &plen); | ||
584 | if (prop && plen == sizeof(u32)) | 585 | if (prop && plen == sizeof(u32)) |
585 | clock = *prop; | 586 | clock = *prop; |
586 | } | 587 | } |
587 | 588 | ||
588 | if (match->data) { | 589 | if (match->data) { |
589 | struct mpc_i2c_data *data = match->data; | 590 | struct mpc_i2c_data *data = match->data; |
590 | data->setup(op->node, i2c, clock, data->prescaler); | 591 | data->setup(op->dev.of_node, i2c, clock, data->prescaler); |
591 | } else { | 592 | } else { |
592 | /* Backwards compatibility */ | 593 | /* Backwards compatibility */ |
593 | if (of_get_property(op->node, "dfsrr", NULL)) | 594 | if (of_get_property(op->dev.of_node, "dfsrr", NULL)) |
594 | mpc_i2c_setup_8xxx(op->node, i2c, clock, 0); | 595 | mpc_i2c_setup_8xxx(op->dev.of_node, i2c, clock, 0); |
595 | } | 596 | } |
596 | 597 | ||
597 | dev_set_drvdata(&op->dev, i2c); | 598 | dev_set_drvdata(&op->dev, i2c); |
@@ -605,7 +606,7 @@ static int __devinit fsl_i2c_probe(struct of_device *op, | |||
605 | dev_err(i2c->dev, "failed to add adapter\n"); | 606 | dev_err(i2c->dev, "failed to add adapter\n"); |
606 | goto fail_add; | 607 | goto fail_add; |
607 | } | 608 | } |
608 | of_register_i2c_devices(&i2c->adap, op->node); | 609 | of_register_i2c_devices(&i2c->adap, op->dev.of_node); |
609 | 610 | ||
610 | return result; | 611 | return result; |
611 | 612 | ||
@@ -674,12 +675,12 @@ MODULE_DEVICE_TABLE(of, mpc_i2c_of_match); | |||
674 | 675 | ||
675 | /* Structure for a device driver */ | 676 | /* Structure for a device driver */ |
676 | static struct of_platform_driver mpc_i2c_driver = { | 677 | static struct of_platform_driver mpc_i2c_driver = { |
677 | .match_table = mpc_i2c_of_match, | ||
678 | .probe = fsl_i2c_probe, | 678 | .probe = fsl_i2c_probe, |
679 | .remove = __devexit_p(fsl_i2c_remove), | 679 | .remove = __devexit_p(fsl_i2c_remove), |
680 | .driver = { | 680 | .driver = { |
681 | .owner = THIS_MODULE, | 681 | .owner = THIS_MODULE, |
682 | .name = DRV_NAME, | 682 | .name = DRV_NAME, |
683 | .of_match_table = mpc_i2c_of_match, | ||
683 | }, | 684 | }, |
684 | }; | 685 | }; |
685 | 686 | ||
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index db3c9f3a7647..e0f833cca3f1 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -418,6 +418,9 @@ i2c_new_device(struct i2c_adapter *adap, struct i2c_board_info const *info) | |||
418 | client->dev.parent = &client->adapter->dev; | 418 | client->dev.parent = &client->adapter->dev; |
419 | client->dev.bus = &i2c_bus_type; | 419 | client->dev.bus = &i2c_bus_type; |
420 | client->dev.type = &i2c_client_type; | 420 | client->dev.type = &i2c_client_type; |
421 | #ifdef CONFIG_OF | ||
422 | client->dev.of_node = info->of_node; | ||
423 | #endif | ||
421 | 424 | ||
422 | dev_set_name(&client->dev, "%d-%04x", i2c_adapter_id(adap), | 425 | dev_set_name(&client->dev, "%d-%04x", i2c_adapter_id(adap), |
423 | client->addr); | 426 | client->addr); |