diff options
author | Arnd Bergmann <arnd@arndb.de> | 2012-07-18 12:57:26 -0400 |
---|---|---|
committer | Arnd Bergmann <arnd@arndb.de> | 2012-07-18 12:57:26 -0400 |
commit | 5e7c2c2f9785be62431270d48e2753e580d6a11c (patch) | |
tree | 452c46fda56fa07f6e653e16616a763c14366d83 | |
parent | 77e77e1b61b422698a17da9eaafe6ce89dc242e2 (diff) | |
parent | 762be29733d5b02b4359691f64c0cc968cd23c93 (diff) |
Merge tag 'ep93xx-devel-for-3.6' of git://github.com/RyanMallon/linux-ep93xx into next/soc
From Ryan Mallon <rmallon@gmail.com>:
* tag 'ep93xx-devel-for-3.6' of git://github.com/RyanMallon/linux-ep93xx:
ep93xx: Add IDE support to edb93xx boards
ep93xx: IDE driver platform support code
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
-rw-r--r-- | arch/arm/mach-ep93xx/core.c | 96 | ||||
-rw-r--r-- | arch/arm/mach-ep93xx/edb93xx.c | 24 | ||||
-rw-r--r-- | arch/arm/mach-ep93xx/include/mach/platform.h | 3 | ||||
-rw-r--r-- | arch/arm/mach-ep93xx/soc.h | 1 |
4 files changed, 124 insertions, 0 deletions
diff --git a/arch/arm/mach-ep93xx/core.c b/arch/arm/mach-ep93xx/core.c index 4dd07a0e3604..4afe52aaaff3 100644 --- a/arch/arm/mach-ep93xx/core.c +++ b/arch/arm/mach-ep93xx/core.c | |||
@@ -797,6 +797,102 @@ static struct platform_device ep93xx_wdt_device = { | |||
797 | .resource = ep93xx_wdt_resources, | 797 | .resource = ep93xx_wdt_resources, |
798 | }; | 798 | }; |
799 | 799 | ||
800 | /************************************************************************* | ||
801 | * EP93xx IDE | ||
802 | *************************************************************************/ | ||
803 | static struct resource ep93xx_ide_resources[] = { | ||
804 | DEFINE_RES_MEM(EP93XX_IDE_PHYS_BASE, 0x38), | ||
805 | DEFINE_RES_IRQ(IRQ_EP93XX_EXT3), | ||
806 | }; | ||
807 | |||
808 | static struct platform_device ep93xx_ide_device = { | ||
809 | .name = "ep93xx-ide", | ||
810 | .id = -1, | ||
811 | .dev = { | ||
812 | .dma_mask = &ep93xx_ide_device.dev.coherent_dma_mask, | ||
813 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
814 | }, | ||
815 | .num_resources = ARRAY_SIZE(ep93xx_ide_resources), | ||
816 | .resource = ep93xx_ide_resources, | ||
817 | }; | ||
818 | |||
819 | void __init ep93xx_register_ide(void) | ||
820 | { | ||
821 | platform_device_register(&ep93xx_ide_device); | ||
822 | } | ||
823 | |||
824 | int ep93xx_ide_acquire_gpio(struct platform_device *pdev) | ||
825 | { | ||
826 | int err; | ||
827 | int i; | ||
828 | |||
829 | err = gpio_request(EP93XX_GPIO_LINE_EGPIO2, dev_name(&pdev->dev)); | ||
830 | if (err) | ||
831 | return err; | ||
832 | err = gpio_request(EP93XX_GPIO_LINE_EGPIO15, dev_name(&pdev->dev)); | ||
833 | if (err) | ||
834 | goto fail_egpio15; | ||
835 | for (i = 2; i < 8; i++) { | ||
836 | err = gpio_request(EP93XX_GPIO_LINE_E(i), dev_name(&pdev->dev)); | ||
837 | if (err) | ||
838 | goto fail_gpio_e; | ||
839 | } | ||
840 | for (i = 4; i < 8; i++) { | ||
841 | err = gpio_request(EP93XX_GPIO_LINE_G(i), dev_name(&pdev->dev)); | ||
842 | if (err) | ||
843 | goto fail_gpio_g; | ||
844 | } | ||
845 | for (i = 0; i < 8; i++) { | ||
846 | err = gpio_request(EP93XX_GPIO_LINE_H(i), dev_name(&pdev->dev)); | ||
847 | if (err) | ||
848 | goto fail_gpio_h; | ||
849 | } | ||
850 | |||
851 | /* GPIO ports E[7:2], G[7:4] and H used by IDE */ | ||
852 | ep93xx_devcfg_clear_bits(EP93XX_SYSCON_DEVCFG_EONIDE | | ||
853 | EP93XX_SYSCON_DEVCFG_GONIDE | | ||
854 | EP93XX_SYSCON_DEVCFG_HONIDE); | ||
855 | return 0; | ||
856 | |||
857 | fail_gpio_h: | ||
858 | for (--i; i >= 0; --i) | ||
859 | gpio_free(EP93XX_GPIO_LINE_H(i)); | ||
860 | i = 8; | ||
861 | fail_gpio_g: | ||
862 | for (--i; i >= 4; --i) | ||
863 | gpio_free(EP93XX_GPIO_LINE_G(i)); | ||
864 | i = 8; | ||
865 | fail_gpio_e: | ||
866 | for (--i; i >= 2; --i) | ||
867 | gpio_free(EP93XX_GPIO_LINE_E(i)); | ||
868 | gpio_free(EP93XX_GPIO_LINE_EGPIO15); | ||
869 | fail_egpio15: | ||
870 | gpio_free(EP93XX_GPIO_LINE_EGPIO2); | ||
871 | return err; | ||
872 | } | ||
873 | EXPORT_SYMBOL(ep93xx_ide_acquire_gpio); | ||
874 | |||
875 | void ep93xx_ide_release_gpio(struct platform_device *pdev) | ||
876 | { | ||
877 | int i; | ||
878 | |||
879 | for (i = 2; i < 8; i++) | ||
880 | gpio_free(EP93XX_GPIO_LINE_E(i)); | ||
881 | for (i = 4; i < 8; i++) | ||
882 | gpio_free(EP93XX_GPIO_LINE_G(i)); | ||
883 | for (i = 0; i < 8; i++) | ||
884 | gpio_free(EP93XX_GPIO_LINE_H(i)); | ||
885 | gpio_free(EP93XX_GPIO_LINE_EGPIO15); | ||
886 | gpio_free(EP93XX_GPIO_LINE_EGPIO2); | ||
887 | |||
888 | |||
889 | /* GPIO ports E[7:2], G[7:4] and H used by GPIO */ | ||
890 | ep93xx_devcfg_set_bits(EP93XX_SYSCON_DEVCFG_EONIDE | | ||
891 | EP93XX_SYSCON_DEVCFG_GONIDE | | ||
892 | EP93XX_SYSCON_DEVCFG_HONIDE); | ||
893 | } | ||
894 | EXPORT_SYMBOL(ep93xx_ide_release_gpio); | ||
895 | |||
800 | void __init ep93xx_init_devices(void) | 896 | void __init ep93xx_init_devices(void) |
801 | { | 897 | { |
802 | /* Disallow access to MaverickCrunch initially */ | 898 | /* Disallow access to MaverickCrunch initially */ |
diff --git a/arch/arm/mach-ep93xx/edb93xx.c b/arch/arm/mach-ep93xx/edb93xx.c index d74c5cddb98b..9005ea698f1e 100644 --- a/arch/arm/mach-ep93xx/edb93xx.c +++ b/arch/arm/mach-ep93xx/edb93xx.c | |||
@@ -233,6 +233,29 @@ static void __init edb93xx_register_fb(void) | |||
233 | } | 233 | } |
234 | 234 | ||
235 | 235 | ||
236 | /************************************************************************* | ||
237 | * EDB93xx IDE | ||
238 | *************************************************************************/ | ||
239 | static int __init edb93xx_has_ide(void) | ||
240 | { | ||
241 | /* | ||
242 | * Although EDB9312 and EDB9315 do have IDE capability, they have | ||
243 | * INTRQ line wired as pull-up, which makes using IDE interface | ||
244 | * problematic. | ||
245 | */ | ||
246 | return machine_is_edb9312() || machine_is_edb9315() || | ||
247 | machine_is_edb9315a(); | ||
248 | } | ||
249 | |||
250 | static void __init edb93xx_register_ide(void) | ||
251 | { | ||
252 | if (!edb93xx_has_ide()) | ||
253 | return; | ||
254 | |||
255 | ep93xx_register_ide(); | ||
256 | } | ||
257 | |||
258 | |||
236 | static void __init edb93xx_init_machine(void) | 259 | static void __init edb93xx_init_machine(void) |
237 | { | 260 | { |
238 | ep93xx_init_devices(); | 261 | ep93xx_init_devices(); |
@@ -243,6 +266,7 @@ static void __init edb93xx_init_machine(void) | |||
243 | edb93xx_register_i2s(); | 266 | edb93xx_register_i2s(); |
244 | edb93xx_register_pwm(); | 267 | edb93xx_register_pwm(); |
245 | edb93xx_register_fb(); | 268 | edb93xx_register_fb(); |
269 | edb93xx_register_ide(); | ||
246 | } | 270 | } |
247 | 271 | ||
248 | 272 | ||
diff --git a/arch/arm/mach-ep93xx/include/mach/platform.h b/arch/arm/mach-ep93xx/include/mach/platform.h index 1ecb040d98bf..33a5122c6dc8 100644 --- a/arch/arm/mach-ep93xx/include/mach/platform.h +++ b/arch/arm/mach-ep93xx/include/mach/platform.h | |||
@@ -48,6 +48,9 @@ void ep93xx_register_i2s(void); | |||
48 | int ep93xx_i2s_acquire(void); | 48 | int ep93xx_i2s_acquire(void); |
49 | void ep93xx_i2s_release(void); | 49 | void ep93xx_i2s_release(void); |
50 | void ep93xx_register_ac97(void); | 50 | void ep93xx_register_ac97(void); |
51 | void ep93xx_register_ide(void); | ||
52 | int ep93xx_ide_acquire_gpio(struct platform_device *pdev); | ||
53 | void ep93xx_ide_release_gpio(struct platform_device *pdev); | ||
51 | 54 | ||
52 | void ep93xx_init_devices(void); | 55 | void ep93xx_init_devices(void); |
53 | extern struct sys_timer ep93xx_timer; | 56 | extern struct sys_timer ep93xx_timer; |
diff --git a/arch/arm/mach-ep93xx/soc.h b/arch/arm/mach-ep93xx/soc.h index 979fba722926..7bf7ff8beae7 100644 --- a/arch/arm/mach-ep93xx/soc.h +++ b/arch/arm/mach-ep93xx/soc.h | |||
@@ -69,6 +69,7 @@ | |||
69 | 69 | ||
70 | #define EP93XX_BOOT_ROM_BASE EP93XX_AHB_IOMEM(0x00090000) | 70 | #define EP93XX_BOOT_ROM_BASE EP93XX_AHB_IOMEM(0x00090000) |
71 | 71 | ||
72 | #define EP93XX_IDE_PHYS_BASE EP93XX_AHB_PHYS(0x000a0000) | ||
72 | #define EP93XX_IDE_BASE EP93XX_AHB_IOMEM(0x000a0000) | 73 | #define EP93XX_IDE_BASE EP93XX_AHB_IOMEM(0x000a0000) |
73 | 74 | ||
74 | #define EP93XX_VIC1_BASE EP93XX_AHB_IOMEM(0x000b0000) | 75 | #define EP93XX_VIC1_BASE EP93XX_AHB_IOMEM(0x000b0000) |