diff options
author | Stefan Roese <sr@denx.de> | 2008-07-14 16:38:30 -0400 |
---|---|---|
committer | Jean Delvare <khali@mahadeva.delvare> | 2008-07-14 16:38:30 -0400 |
commit | e6c3de6c146d2513332c581433caca6e5cae62bf (patch) | |
tree | 17011570980ddc19527e065edbca0f9404b5c8c6 | |
parent | e0457442fd522107204da14a2dc2cbbb5dcac5f6 (diff) |
i2c-ibm_iic: Remove deprecated OCP style part
The deprecated OCP style driver part is used by the "old" arch/ppc
platform. This platform is scheduled for removal in June/July this year.
This patch now removes the OCP driver part from the IBM I2C driver.
Signed-off-by: Stefan Roese <sr@denx.de>
Signed-off-by: Jean Delvare <khali@linux-fr.org>
-rw-r--r-- | drivers/i2c/busses/i2c-ibm_iic.c | 181 |
1 files changed, 0 insertions, 181 deletions
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c index 6f7bfdec3c69..d8a19c110564 100644 --- a/drivers/i2c/busses/i2c-ibm_iic.c +++ b/drivers/i2c/busses/i2c-ibm_iic.c | |||
@@ -42,13 +42,7 @@ | |||
42 | #include <asm/io.h> | 42 | #include <asm/io.h> |
43 | #include <linux/i2c.h> | 43 | #include <linux/i2c.h> |
44 | #include <linux/i2c-id.h> | 44 | #include <linux/i2c-id.h> |
45 | |||
46 | #ifdef CONFIG_IBM_OCP | ||
47 | #include <asm/ocp.h> | ||
48 | #include <asm/ibm4xx.h> | ||
49 | #else | ||
50 | #include <linux/of_platform.h> | 45 | #include <linux/of_platform.h> |
51 | #endif | ||
52 | 46 | ||
53 | #include "i2c-ibm_iic.h" | 47 | #include "i2c-ibm_iic.h" |
54 | 48 | ||
@@ -665,180 +659,6 @@ static inline u8 iic_clckdiv(unsigned int opb) | |||
665 | return (u8)((opb + 9) / 10 - 1); | 659 | return (u8)((opb + 9) / 10 - 1); |
666 | } | 660 | } |
667 | 661 | ||
668 | #ifdef CONFIG_IBM_OCP | ||
669 | /* | ||
670 | * Register single IIC interface | ||
671 | */ | ||
672 | static int __devinit iic_probe(struct ocp_device *ocp){ | ||
673 | |||
674 | struct ibm_iic_private* dev; | ||
675 | struct i2c_adapter* adap; | ||
676 | struct ocp_func_iic_data* iic_data = ocp->def->additions; | ||
677 | int ret; | ||
678 | |||
679 | if (!iic_data) | ||
680 | printk(KERN_WARNING"ibm-iic%d: missing additional data!\n", | ||
681 | ocp->def->index); | ||
682 | |||
683 | if (!(dev = kzalloc(sizeof(*dev), GFP_KERNEL))) { | ||
684 | printk(KERN_ERR "ibm-iic%d: failed to allocate device data\n", | ||
685 | ocp->def->index); | ||
686 | return -ENOMEM; | ||
687 | } | ||
688 | |||
689 | dev->idx = ocp->def->index; | ||
690 | ocp_set_drvdata(ocp, dev); | ||
691 | |||
692 | if (!request_mem_region(ocp->def->paddr, sizeof(struct iic_regs), | ||
693 | "ibm_iic")) { | ||
694 | ret = -EBUSY; | ||
695 | goto fail1; | ||
696 | } | ||
697 | |||
698 | if (!(dev->vaddr = ioremap(ocp->def->paddr, sizeof(struct iic_regs)))){ | ||
699 | printk(KERN_ERR "ibm-iic%d: failed to ioremap device registers\n", | ||
700 | dev->idx); | ||
701 | ret = -ENXIO; | ||
702 | goto fail2; | ||
703 | } | ||
704 | |||
705 | init_waitqueue_head(&dev->wq); | ||
706 | |||
707 | dev->irq = iic_force_poll ? -1 : ocp->def->irq; | ||
708 | if (dev->irq >= 0){ | ||
709 | /* Disable interrupts until we finish initialization, | ||
710 | assumes level-sensitive IRQ setup... | ||
711 | */ | ||
712 | iic_interrupt_mode(dev, 0); | ||
713 | if (request_irq(dev->irq, iic_handler, 0, "IBM IIC", dev)){ | ||
714 | printk(KERN_ERR "ibm-iic%d: request_irq %d failed\n", | ||
715 | dev->idx, dev->irq); | ||
716 | /* Fallback to the polling mode */ | ||
717 | dev->irq = -1; | ||
718 | } | ||
719 | } | ||
720 | |||
721 | if (dev->irq < 0) | ||
722 | printk(KERN_WARNING "ibm-iic%d: using polling mode\n", | ||
723 | dev->idx); | ||
724 | |||
725 | /* Board specific settings */ | ||
726 | dev->fast_mode = iic_force_fast ? 1 : (iic_data ? iic_data->fast_mode : 0); | ||
727 | |||
728 | /* clckdiv is the same for *all* IIC interfaces, | ||
729 | * but I'd rather make a copy than introduce another global. --ebs | ||
730 | */ | ||
731 | dev->clckdiv = iic_clckdiv(ocp_sys_info.opb_bus_freq); | ||
732 | DBG("%d: clckdiv = %d\n", dev->idx, dev->clckdiv); | ||
733 | |||
734 | /* Initialize IIC interface */ | ||
735 | iic_dev_init(dev); | ||
736 | |||
737 | /* Register it with i2c layer */ | ||
738 | adap = &dev->adap; | ||
739 | adap->dev.parent = &ocp->dev; | ||
740 | strcpy(adap->name, "IBM IIC"); | ||
741 | i2c_set_adapdata(adap, dev); | ||
742 | adap->id = I2C_HW_OCP; | ||
743 | adap->class = I2C_CLASS_HWMON | I2C_CLASS_SPD; | ||
744 | adap->algo = &iic_algo; | ||
745 | adap->client_register = NULL; | ||
746 | adap->client_unregister = NULL; | ||
747 | adap->timeout = 1; | ||
748 | |||
749 | /* | ||
750 | * If "dev->idx" is negative we consider it as zero. | ||
751 | * The reason to do so is to avoid sysfs names that only make | ||
752 | * sense when there are multiple adapters. | ||
753 | */ | ||
754 | adap->nr = dev->idx >= 0 ? dev->idx : 0; | ||
755 | |||
756 | if ((ret = i2c_add_numbered_adapter(adap)) < 0) { | ||
757 | printk(KERN_ERR "ibm-iic%d: failed to register i2c adapter\n", | ||
758 | dev->idx); | ||
759 | goto fail; | ||
760 | } | ||
761 | |||
762 | printk(KERN_INFO "ibm-iic%d: using %s mode\n", dev->idx, | ||
763 | dev->fast_mode ? "fast (400 kHz)" : "standard (100 kHz)"); | ||
764 | |||
765 | return 0; | ||
766 | |||
767 | fail: | ||
768 | if (dev->irq >= 0){ | ||
769 | iic_interrupt_mode(dev, 0); | ||
770 | free_irq(dev->irq, dev); | ||
771 | } | ||
772 | |||
773 | iounmap(dev->vaddr); | ||
774 | fail2: | ||
775 | release_mem_region(ocp->def->paddr, sizeof(struct iic_regs)); | ||
776 | fail1: | ||
777 | ocp_set_drvdata(ocp, NULL); | ||
778 | kfree(dev); | ||
779 | return ret; | ||
780 | } | ||
781 | |||
782 | /* | ||
783 | * Cleanup initialized IIC interface | ||
784 | */ | ||
785 | static void __devexit iic_remove(struct ocp_device *ocp) | ||
786 | { | ||
787 | struct ibm_iic_private* dev = (struct ibm_iic_private*)ocp_get_drvdata(ocp); | ||
788 | BUG_ON(dev == NULL); | ||
789 | if (i2c_del_adapter(&dev->adap)){ | ||
790 | printk(KERN_ERR "ibm-iic%d: failed to delete i2c adapter :(\n", | ||
791 | dev->idx); | ||
792 | /* That's *very* bad, just shutdown IRQ ... */ | ||
793 | if (dev->irq >= 0){ | ||
794 | iic_interrupt_mode(dev, 0); | ||
795 | free_irq(dev->irq, dev); | ||
796 | dev->irq = -1; | ||
797 | } | ||
798 | } else { | ||
799 | if (dev->irq >= 0){ | ||
800 | iic_interrupt_mode(dev, 0); | ||
801 | free_irq(dev->irq, dev); | ||
802 | } | ||
803 | iounmap(dev->vaddr); | ||
804 | release_mem_region(ocp->def->paddr, sizeof(struct iic_regs)); | ||
805 | kfree(dev); | ||
806 | } | ||
807 | } | ||
808 | |||
809 | static struct ocp_device_id ibm_iic_ids[] __devinitdata = | ||
810 | { | ||
811 | { .vendor = OCP_VENDOR_IBM, .function = OCP_FUNC_IIC }, | ||
812 | { .vendor = OCP_VENDOR_INVALID } | ||
813 | }; | ||
814 | |||
815 | MODULE_DEVICE_TABLE(ocp, ibm_iic_ids); | ||
816 | |||
817 | static struct ocp_driver ibm_iic_driver = | ||
818 | { | ||
819 | .name = "iic", | ||
820 | .id_table = ibm_iic_ids, | ||
821 | .probe = iic_probe, | ||
822 | .remove = __devexit_p(iic_remove), | ||
823 | #if defined(CONFIG_PM) | ||
824 | .suspend = NULL, | ||
825 | .resume = NULL, | ||
826 | #endif | ||
827 | }; | ||
828 | |||
829 | static int __init iic_init(void) | ||
830 | { | ||
831 | printk(KERN_INFO "IBM IIC driver v" DRIVER_VERSION "\n"); | ||
832 | return ocp_register_driver(&ibm_iic_driver); | ||
833 | } | ||
834 | |||
835 | static void __exit iic_exit(void) | ||
836 | { | ||
837 | ocp_unregister_driver(&ibm_iic_driver); | ||
838 | } | ||
839 | |||
840 | #else /* !CONFIG_IBM_OCP */ | ||
841 | |||
842 | static int __devinit iic_request_irq(struct of_device *ofdev, | 662 | static int __devinit iic_request_irq(struct of_device *ofdev, |
843 | struct ibm_iic_private *dev) | 663 | struct ibm_iic_private *dev) |
844 | { | 664 | { |
@@ -1011,7 +831,6 @@ static void __exit iic_exit(void) | |||
1011 | { | 831 | { |
1012 | of_unregister_platform_driver(&ibm_iic_driver); | 832 | of_unregister_platform_driver(&ibm_iic_driver); |
1013 | } | 833 | } |
1014 | #endif /* CONFIG_IBM_OCP */ | ||
1015 | 834 | ||
1016 | module_init(iic_init); | 835 | module_init(iic_init); |
1017 | module_exit(iic_exit); | 836 | module_exit(iic_exit); |