diff options
author | Olof Johansson <olof@lixom.net> | 2007-12-04 15:44:32 -0500 |
---|---|---|
committer | Olof Johansson <olof@lixom.net> | 2008-01-15 11:26:45 -0500 |
commit | 9cd55be4d22376893d2818ce3c0e5706a3d74121 (patch) | |
tree | a835f728185c09b1dd98b7da44baea3442af7b61 | |
parent | 61f7162117d4767875825abf2f6ed1eeebbcceed (diff) |
[POWERPC] pasemi: Move electra-ide to pata_of_platform
Move electra-ide glue over to the new pata_of_platform framework, and
add the quirks needed to that driver.
Signed-off-by: Olof Johansson <olof@lixom.net>
-rw-r--r-- | arch/powerpc/configs/pasemi_defconfig | 4 | ||||
-rw-r--r-- | arch/powerpc/platforms/pasemi/Kconfig | 9 | ||||
-rw-r--r-- | arch/powerpc/platforms/pasemi/Makefile | 1 | ||||
-rw-r--r-- | arch/powerpc/platforms/pasemi/electra_ide.c | 96 | ||||
-rw-r--r-- | drivers/ata/pata_of_platform.c | 20 |
5 files changed, 17 insertions, 113 deletions
diff --git a/arch/powerpc/configs/pasemi_defconfig b/arch/powerpc/configs/pasemi_defconfig index 9d21b083ae12..797f0dfebde2 100644 --- a/arch/powerpc/configs/pasemi_defconfig +++ b/arch/powerpc/configs/pasemi_defconfig | |||
@@ -1,7 +1,7 @@ | |||
1 | # | 1 | # |
2 | # Automatically generated make config: don't edit | 2 | # Automatically generated make config: don't edit |
3 | # Linux kernel version: 2.6.24-rc6 | 3 | # Linux kernel version: 2.6.24-rc6 |
4 | # Fri Dec 28 11:01:53 2007 | 4 | # Tue Jan 15 10:26:10 2008 |
5 | # | 5 | # |
6 | CONFIG_PPC64=y | 6 | CONFIG_PPC64=y |
7 | 7 | ||
@@ -152,7 +152,6 @@ CONFIG_PPC_PASEMI=y | |||
152 | CONFIG_PPC_PASEMI_IOMMU=y | 152 | CONFIG_PPC_PASEMI_IOMMU=y |
153 | # CONFIG_PPC_PASEMI_IOMMU_DMA_FORCE is not set | 153 | # CONFIG_PPC_PASEMI_IOMMU_DMA_FORCE is not set |
154 | CONFIG_PPC_PASEMI_MDIO=y | 154 | CONFIG_PPC_PASEMI_MDIO=y |
155 | CONFIG_ELECTRA_IDE=y | ||
156 | # CONFIG_PPC_CELLEB is not set | 155 | # CONFIG_PPC_CELLEB is not set |
157 | # CONFIG_PPC_PS3 is not set | 156 | # CONFIG_PPC_PS3 is not set |
158 | # CONFIG_PPC_CELL is not set | 157 | # CONFIG_PPC_CELL is not set |
@@ -663,6 +662,7 @@ CONFIG_PATA_PCMCIA=y | |||
663 | # CONFIG_PATA_VIA is not set | 662 | # CONFIG_PATA_VIA is not set |
664 | # CONFIG_PATA_WINBOND is not set | 663 | # CONFIG_PATA_WINBOND is not set |
665 | CONFIG_PATA_PLATFORM=y | 664 | CONFIG_PATA_PLATFORM=y |
665 | CONFIG_PATA_OF_PLATFORM=y | ||
666 | CONFIG_MD=y | 666 | CONFIG_MD=y |
667 | CONFIG_BLK_DEV_MD=y | 667 | CONFIG_BLK_DEV_MD=y |
668 | CONFIG_MD_LINEAR=y | 668 | CONFIG_MD_LINEAR=y |
diff --git a/arch/powerpc/platforms/pasemi/Kconfig b/arch/powerpc/platforms/pasemi/Kconfig index b3458a181a15..348e0619e3e5 100644 --- a/arch/powerpc/platforms/pasemi/Kconfig +++ b/arch/powerpc/platforms/pasemi/Kconfig | |||
@@ -37,13 +37,4 @@ config PPC_PASEMI_MDIO | |||
37 | help | 37 | help |
38 | Driver for MDIO via GPIO on PWRficient platforms | 38 | Driver for MDIO via GPIO on PWRficient platforms |
39 | 39 | ||
40 | config ELECTRA_IDE | ||
41 | tristate "Electra IDE driver" | ||
42 | default y | ||
43 | depends on PPC_PASEMI && ATA | ||
44 | select PATA_PLATFORM | ||
45 | help | ||
46 | This includes driver support for the Electra on-board IDE | ||
47 | interface. | ||
48 | |||
49 | endmenu | 40 | endmenu |
diff --git a/arch/powerpc/platforms/pasemi/Makefile b/arch/powerpc/platforms/pasemi/Makefile index f47fcac7e581..2cd2a4f26a48 100644 --- a/arch/powerpc/platforms/pasemi/Makefile +++ b/arch/powerpc/platforms/pasemi/Makefile | |||
@@ -1,4 +1,3 @@ | |||
1 | obj-y += setup.o pci.o time.o idle.o powersave.o iommu.o | 1 | obj-y += setup.o pci.o time.o idle.o powersave.o iommu.o |
2 | obj-$(CONFIG_PPC_PASEMI_MDIO) += gpio_mdio.o | 2 | obj-$(CONFIG_PPC_PASEMI_MDIO) += gpio_mdio.o |
3 | obj-$(CONFIG_ELECTRA_IDE) += electra_ide.o | ||
4 | obj-$(CONFIG_PPC_PASEMI_CPUFREQ) += cpufreq.o | 3 | obj-$(CONFIG_PPC_PASEMI_CPUFREQ) += cpufreq.o |
diff --git a/arch/powerpc/platforms/pasemi/electra_ide.c b/arch/powerpc/platforms/pasemi/electra_ide.c deleted file mode 100644 index 12fb0c949263..000000000000 --- a/arch/powerpc/platforms/pasemi/electra_ide.c +++ /dev/null | |||
@@ -1,96 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007 PA Semi, Inc | ||
3 | * | ||
4 | * Maintained by: Olof Johansson <olof@lixom.net> | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | * | ||
10 | * This program is distributed in the hope that it will be useful, | ||
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
13 | * GNU General Public License for more details. | ||
14 | * | ||
15 | * You should have received a copy of the GNU General Public License | ||
16 | * along with this program; if not, write to the Free Software | ||
17 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
18 | */ | ||
19 | |||
20 | #include <linux/platform_device.h> | ||
21 | |||
22 | #include <asm/prom.h> | ||
23 | #include <asm/system.h> | ||
24 | |||
25 | /* The electra IDE interface is incredibly simple: Just a device on the localbus | ||
26 | * with interrupts hooked up to one of the GPIOs. The device tree contains the | ||
27 | * address window and interrupt mappings already, and the pata_platform driver handles | ||
28 | * the rest. We just need to hook the two up. | ||
29 | */ | ||
30 | |||
31 | #define MAX_IFS 4 /* really, we have only one */ | ||
32 | |||
33 | static struct platform_device *pdevs[MAX_IFS]; | ||
34 | |||
35 | static int __devinit electra_ide_init(void) | ||
36 | { | ||
37 | struct device_node *np; | ||
38 | struct resource r[3]; | ||
39 | int ret = 0; | ||
40 | int i; | ||
41 | |||
42 | np = of_find_compatible_node(NULL, "ide", "electra-ide"); | ||
43 | i = 0; | ||
44 | |||
45 | while (np && i < MAX_IFS) { | ||
46 | memset(r, 0, sizeof(r)); | ||
47 | |||
48 | /* pata_platform wants two address ranges: one for the base registers, | ||
49 | * another for the control (altstatus). It's located at offset 0x3f6 in | ||
50 | * the window, but the device tree only has one large register window | ||
51 | * that covers both ranges. So we need to split it up by hand here: | ||
52 | */ | ||
53 | |||
54 | ret = of_address_to_resource(np, 0, &r[0]); | ||
55 | if (ret) | ||
56 | goto out; | ||
57 | ret = of_address_to_resource(np, 0, &r[1]); | ||
58 | if (ret) | ||
59 | goto out; | ||
60 | |||
61 | r[1].start += 0x3f6; | ||
62 | r[0].end = r[1].start-1; | ||
63 | |||
64 | r[2].start = irq_of_parse_and_map(np, 0); | ||
65 | r[2].end = irq_of_parse_and_map(np, 0); | ||
66 | r[2].flags = IORESOURCE_IRQ; | ||
67 | |||
68 | pr_debug("registering platform device at 0x%lx/0x%lx, irq is %ld\n", | ||
69 | r[0].start, r[1].start, r[2].start); | ||
70 | pdevs[i] = platform_device_register_simple("pata_platform", i, r, 3); | ||
71 | if (IS_ERR(pdevs[i])) { | ||
72 | ret = PTR_ERR(pdevs[i]); | ||
73 | pdevs[i] = NULL; | ||
74 | goto out; | ||
75 | } | ||
76 | np = of_find_compatible_node(np, "ide", "electra-ide"); | ||
77 | } | ||
78 | out: | ||
79 | return ret; | ||
80 | } | ||
81 | module_init(electra_ide_init); | ||
82 | |||
83 | static void __devexit electra_ide_exit(void) | ||
84 | { | ||
85 | int i; | ||
86 | |||
87 | for (i = 0; i < MAX_IFS; i++) | ||
88 | if (pdevs[i]) | ||
89 | platform_device_unregister(pdevs[i]); | ||
90 | } | ||
91 | module_exit(electra_ide_exit); | ||
92 | |||
93 | |||
94 | MODULE_LICENSE("GPL"); | ||
95 | MODULE_AUTHOR ("Olof Johansson <olof@lixom.net>"); | ||
96 | MODULE_DESCRIPTION("PA Semi Electra IDE driver"); | ||
diff --git a/drivers/ata/pata_of_platform.c b/drivers/ata/pata_of_platform.c index b7bc4e4a0a26..938f48a807eb 100644 --- a/drivers/ata/pata_of_platform.c +++ b/drivers/ata/pata_of_platform.c | |||
@@ -34,11 +34,20 @@ static int __devinit pata_of_platform_probe(struct of_device *ofdev, | |||
34 | return -EINVAL; | 34 | return -EINVAL; |
35 | } | 35 | } |
36 | 36 | ||
37 | ret = of_address_to_resource(dn, 1, &ctl_res); | 37 | if (of_device_is_compatible(dn, "electra-ide")) { |
38 | if (ret) { | 38 | /* Altstatus is really at offset 0x3f6 from the primary window |
39 | dev_err(&ofdev->dev, "can't get CTL address from " | 39 | * on electra-ide. Adjust ctl_res and io_res accordingly. |
40 | "device tree\n"); | 40 | */ |
41 | return -EINVAL; | 41 | ctl_res = io_res; |
42 | ctl_res.start = ctl_res.start+0x3f6; | ||
43 | io_res.end = ctl_res.start-1; | ||
44 | } else { | ||
45 | ret = of_address_to_resource(dn, 1, &ctl_res); | ||
46 | if (ret) { | ||
47 | dev_err(&ofdev->dev, "can't get CTL address from " | ||
48 | "device tree\n"); | ||
49 | return -EINVAL; | ||
50 | } | ||
42 | } | 51 | } |
43 | 52 | ||
44 | ret = of_irq_to_resource(dn, 0, &irq_res); | 53 | ret = of_irq_to_resource(dn, 0, &irq_res); |
@@ -76,6 +85,7 @@ static int __devexit pata_of_platform_remove(struct of_device *ofdev) | |||
76 | 85 | ||
77 | static struct of_device_id pata_of_platform_match[] = { | 86 | static struct of_device_id pata_of_platform_match[] = { |
78 | { .compatible = "ata-generic", }, | 87 | { .compatible = "ata-generic", }, |
88 | { .compatible = "electra-ide", }, | ||
79 | {}, | 89 | {}, |
80 | }; | 90 | }; |
81 | MODULE_DEVICE_TABLE(of, pata_of_platform_match); | 91 | MODULE_DEVICE_TABLE(of, pata_of_platform_match); |