diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/i2c/busses/i2c-bfin-twi.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/i2c/busses/i2c-bfin-twi.c b/drivers/i2c/busses/i2c-bfin-twi.c index f2b558f17ca2..446b4f855b03 100644 --- a/drivers/i2c/busses/i2c-bfin-twi.c +++ b/drivers/i2c/busses/i2c-bfin-twi.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include <linux/platform_device.h> | 34 | #include <linux/platform_device.h> |
35 | 35 | ||
36 | #include <asm/blackfin.h> | 36 | #include <asm/blackfin.h> |
37 | #include <asm/portmux.h> | ||
37 | #include <asm/irq.h> | 38 | #include <asm/irq.h> |
38 | 39 | ||
39 | #define POLL_TIMEOUT (2 * HZ) | 40 | #define POLL_TIMEOUT (2 * HZ) |
@@ -89,6 +90,11 @@ DEFINE_TWI_REG(XMT_DATA16, 0x84) | |||
89 | DEFINE_TWI_REG(RCV_DATA8, 0x88) | 90 | DEFINE_TWI_REG(RCV_DATA8, 0x88) |
90 | DEFINE_TWI_REG(RCV_DATA16, 0x8C) | 91 | DEFINE_TWI_REG(RCV_DATA16, 0x8C) |
91 | 92 | ||
93 | static const u16 pin_req[2][3] = { | ||
94 | {P_TWI0_SCL, P_TWI0_SDA, 0}, | ||
95 | {P_TWI1_SCL, P_TWI1_SDA, 0}, | ||
96 | }; | ||
97 | |||
92 | static void bfin_twi_handle_interrupt(struct bfin_twi_iface *iface) | 98 | static void bfin_twi_handle_interrupt(struct bfin_twi_iface *iface) |
93 | { | 99 | { |
94 | unsigned short twi_int_status = read_INT_STAT(iface); | 100 | unsigned short twi_int_status = read_INT_STAT(iface); |
@@ -653,6 +659,12 @@ static int i2c_bfin_twi_probe(struct platform_device *pdev) | |||
653 | p_adap->class = I2C_CLASS_ALL; | 659 | p_adap->class = I2C_CLASS_ALL; |
654 | p_adap->dev.parent = &pdev->dev; | 660 | p_adap->dev.parent = &pdev->dev; |
655 | 661 | ||
662 | rc = peripheral_request_list(pin_req[pdev->id], "i2c-bfin-twi"); | ||
663 | if (rc) { | ||
664 | dev_err(&pdev->dev, "Can't setup pin mux!\n"); | ||
665 | goto out_error_pin_mux; | ||
666 | } | ||
667 | |||
656 | rc = request_irq(iface->irq, bfin_twi_interrupt_entry, | 668 | rc = request_irq(iface->irq, bfin_twi_interrupt_entry, |
657 | IRQF_DISABLED, pdev->name, iface); | 669 | IRQF_DISABLED, pdev->name, iface); |
658 | if (rc) { | 670 | if (rc) { |
@@ -690,6 +702,8 @@ out_error_add_adapter: | |||
690 | free_irq(iface->irq, iface); | 702 | free_irq(iface->irq, iface); |
691 | out_error_req_irq: | 703 | out_error_req_irq: |
692 | out_error_no_irq: | 704 | out_error_no_irq: |
705 | peripheral_free_list(pin_req[pdev->id]); | ||
706 | out_error_pin_mux: | ||
693 | iounmap(iface->regs_base); | 707 | iounmap(iface->regs_base); |
694 | out_error_ioremap: | 708 | out_error_ioremap: |
695 | out_error_get_res: | 709 | out_error_get_res: |
@@ -706,6 +720,7 @@ static int i2c_bfin_twi_remove(struct platform_device *pdev) | |||
706 | 720 | ||
707 | i2c_del_adapter(&(iface->adap)); | 721 | i2c_del_adapter(&(iface->adap)); |
708 | free_irq(iface->irq, iface); | 722 | free_irq(iface->irq, iface); |
723 | peripheral_free_list(pin_req[pdev->id]); | ||
709 | iounmap(iface->regs_base); | 724 | iounmap(iface->regs_base); |
710 | kfree(iface); | 725 | kfree(iface); |
711 | 726 | ||