diff options
author | Philipp Zabel <philipp.zabel@gmail.com> | 2008-04-20 12:39:12 -0400 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-04-21 07:47:47 -0400 |
commit | a1999cd1c1c9230c850379f59525c4a585191ed5 (patch) | |
tree | 31da4556d075478f61a7eee3caed1b5fe4087109 /arch/arm/mach-pxa | |
parent | a393c46b493de18242105c7f7e713822d179a717 (diff) |
[ARM] 5007/1: magician: properly request GPIOs used by the machine code itself
Registers some GPIOs used in magician.c with the GPIO API.
Signed-off-by: Philipp Zabel <philipp.zabel@gmail.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-pxa')
-rw-r--r-- | arch/arm/mach-pxa/magician.c | 51 |
1 files changed, 43 insertions, 8 deletions
diff --git a/arch/arm/mach-pxa/magician.c b/arch/arm/mach-pxa/magician.c index d70be75bd199..e0c7135a1544 100644 --- a/arch/arm/mach-pxa/magician.c +++ b/arch/arm/mach-pxa/magician.c | |||
@@ -543,9 +543,28 @@ static struct platform_device power_supply = { | |||
543 | static int magician_mci_init(struct device *dev, | 543 | static int magician_mci_init(struct device *dev, |
544 | irq_handler_t detect_irq, void *data) | 544 | irq_handler_t detect_irq, void *data) |
545 | { | 545 | { |
546 | return request_irq(IRQ_MAGICIAN_SD, detect_irq, | 546 | int err; |
547 | |||
548 | err = request_irq(IRQ_MAGICIAN_SD, detect_irq, | ||
547 | IRQF_DISABLED | IRQF_SAMPLE_RANDOM, | 549 | IRQF_DISABLED | IRQF_SAMPLE_RANDOM, |
548 | "MMC card detect", data); | 550 | "MMC card detect", data); |
551 | if (err) | ||
552 | goto err_request_irq; | ||
553 | err = gpio_request(EGPIO_MAGICIAN_SD_POWER, "SD_POWER"); | ||
554 | if (err) | ||
555 | goto err_request_power; | ||
556 | err = gpio_request(EGPIO_MAGICIAN_nSD_READONLY, "nSD_READONLY"); | ||
557 | if (err) | ||
558 | goto err_request_readonly; | ||
559 | |||
560 | return 0; | ||
561 | |||
562 | err_request_readonly: | ||
563 | gpio_free(EGPIO_MAGICIAN_SD_POWER); | ||
564 | err_request_power: | ||
565 | free_irq(IRQ_MAGICIAN_SD, data); | ||
566 | err_request_irq: | ||
567 | return err; | ||
549 | } | 568 | } |
550 | 569 | ||
551 | static void magician_mci_setpower(struct device *dev, unsigned int vdd) | 570 | static void magician_mci_setpower(struct device *dev, unsigned int vdd) |
@@ -562,6 +581,8 @@ static int magician_mci_get_ro(struct device *dev) | |||
562 | 581 | ||
563 | static void magician_mci_exit(struct device *dev, void *data) | 582 | static void magician_mci_exit(struct device *dev, void *data) |
564 | { | 583 | { |
584 | gpio_free(EGPIO_MAGICIAN_nSD_READONLY); | ||
585 | gpio_free(EGPIO_MAGICIAN_SD_POWER); | ||
565 | free_irq(IRQ_MAGICIAN_SD, data); | 586 | free_irq(IRQ_MAGICIAN_SD, data); |
566 | } | 587 | } |
567 | 588 | ||
@@ -643,28 +664,42 @@ static void __init magician_init(void) | |||
643 | { | 664 | { |
644 | void __iomem *cpld; | 665 | void __iomem *cpld; |
645 | int lcd_select; | 666 | int lcd_select; |
667 | int err; | ||
668 | |||
669 | gpio_request(GPIO13_MAGICIAN_CPLD_IRQ, "CPLD_IRQ"); | ||
670 | gpio_request(GPIO107_MAGICIAN_DS1WM_IRQ, "DS1WM_IRQ"); | ||
646 | 671 | ||
647 | pxa2xx_mfp_config(ARRAY_AND_SIZE(magician_pin_config)); | 672 | pxa2xx_mfp_config(ARRAY_AND_SIZE(magician_pin_config)); |
648 | 673 | ||
649 | platform_add_devices(devices, ARRAY_SIZE(devices)); | 674 | platform_add_devices(devices, ARRAY_SIZE(devices)); |
675 | |||
676 | err = gpio_request(GPIO83_MAGICIAN_nIR_EN, "nIR_EN"); | ||
677 | if (!err) { | ||
678 | gpio_direction_output(GPIO83_MAGICIAN_nIR_EN, 1); | ||
679 | pxa_set_ficp_info(&magician_ficp_info); | ||
680 | } | ||
650 | pxa_set_i2c_info(NULL); | 681 | pxa_set_i2c_info(NULL); |
651 | pxa_set_mci_info(&magician_mci_info); | 682 | pxa_set_mci_info(&magician_mci_info); |
652 | pxa_set_ohci_info(&magician_ohci_info); | 683 | pxa_set_ohci_info(&magician_ohci_info); |
653 | pxa_set_ficp_info(&magician_ficp_info); | ||
654 | 684 | ||
655 | /* Check LCD type we have */ | 685 | /* Check LCD type we have */ |
656 | cpld = ioremap_nocache(PXA_CS3_PHYS, 0x1000); | 686 | cpld = ioremap_nocache(PXA_CS3_PHYS, 0x1000); |
657 | if (cpld) { | 687 | if (cpld) { |
658 | u8 board_id = __raw_readb(cpld+0x14); | 688 | u8 board_id = __raw_readb(cpld+0x14); |
689 | iounmap(cpld); | ||
659 | system_rev = board_id & 0x7; | 690 | system_rev = board_id & 0x7; |
660 | lcd_select = board_id & 0x8; | 691 | lcd_select = board_id & 0x8; |
661 | iounmap(cpld); | ||
662 | pr_info("LCD type: %s\n", lcd_select ? "Samsung" : "Toppoly"); | 692 | pr_info("LCD type: %s\n", lcd_select ? "Samsung" : "Toppoly"); |
663 | if (lcd_select && (system_rev < 3)) | 693 | if (lcd_select && (system_rev < 3)) { |
664 | pxa_gpio_mode(GPIO75_MAGICIAN_SAMSUNG_POWER_MD); | 694 | gpio_request(GPIO75_MAGICIAN_SAMSUNG_POWER, "SAMSUNG_POWER"); |
665 | pxa_gpio_mode(GPIO104_MAGICIAN_LCD_POWER_1_MD); | 695 | gpio_direction_output(GPIO75_MAGICIAN_SAMSUNG_POWER, 0); |
666 | pxa_gpio_mode(GPIO105_MAGICIAN_LCD_POWER_2_MD); | 696 | } |
667 | pxa_gpio_mode(GPIO106_MAGICIAN_LCD_POWER_3_MD); | 697 | gpio_request(GPIO104_MAGICIAN_LCD_POWER_1, "LCD_POWER_1"); |
698 | gpio_request(GPIO105_MAGICIAN_LCD_POWER_2, "LCD_POWER_2"); | ||
699 | gpio_request(GPIO106_MAGICIAN_LCD_POWER_3, "LCD_POWER_3"); | ||
700 | gpio_direction_output(GPIO104_MAGICIAN_LCD_POWER_1, 0); | ||
701 | gpio_direction_output(GPIO105_MAGICIAN_LCD_POWER_2, 0); | ||
702 | gpio_direction_output(GPIO106_MAGICIAN_LCD_POWER_3, 0); | ||
668 | set_pxa_fb_info(lcd_select ? &samsung_info : &toppoly_info); | 703 | set_pxa_fb_info(lcd_select ? &samsung_info : &toppoly_info); |
669 | } else | 704 | } else |
670 | pr_err("LCD detection: CPLD mapping failed\n"); | 705 | pr_err("LCD detection: CPLD mapping failed\n"); |