diff options
Diffstat (limited to 'arch/arm/mach-ks8695/pci.c')
-rw-r--r-- | arch/arm/mach-ks8695/pci.c | 77 |
1 files changed, 6 insertions, 71 deletions
diff --git a/arch/arm/mach-ks8695/pci.c b/arch/arm/mach-ks8695/pci.c index bb18193b4bac..c1bc4c3716ed 100644 --- a/arch/arm/mach-ks8695/pci.c +++ b/arch/arm/mach-ks8695/pci.c | |||
@@ -38,8 +38,6 @@ | |||
38 | 38 | ||
39 | 39 | ||
40 | static int pci_dbg; | 40 | static int pci_dbg; |
41 | static int pci_cfg_dbg; | ||
42 | |||
43 | 41 | ||
44 | static void ks8695_pci_setupconfig(unsigned int bus_nr, unsigned int devfn, unsigned int where) | 42 | static void ks8695_pci_setupconfig(unsigned int bus_nr, unsigned int devfn, unsigned int where) |
45 | { | 43 | { |
@@ -59,75 +57,11 @@ static void ks8695_pci_setupconfig(unsigned int bus_nr, unsigned int devfn, unsi | |||
59 | } | 57 | } |
60 | } | 58 | } |
61 | 59 | ||
62 | 60 | static void __iomem *ks8695_pci_map_bus(struct pci_bus *bus, unsigned int devfn, | |
63 | /* | 61 | int where) |
64 | * The KS8695 datasheet prohibits anything other than 32bit accesses | ||
65 | * to the IO registers, so all our configuration must be done with | ||
66 | * 32bit operations, and the correct bit masking and shifting. | ||
67 | */ | ||
68 | |||
69 | static int ks8695_pci_readconfig(struct pci_bus *bus, | ||
70 | unsigned int devfn, int where, int size, u32 *value) | ||
71 | { | ||
72 | ks8695_pci_setupconfig(bus->number, devfn, where); | ||
73 | |||
74 | *value = __raw_readl(KS8695_PCI_VA + KS8695_PBCD); | ||
75 | |||
76 | switch (size) { | ||
77 | case 4: | ||
78 | break; | ||
79 | case 2: | ||
80 | *value = *value >> ((where & 2) * 8); | ||
81 | *value &= 0xffff; | ||
82 | break; | ||
83 | case 1: | ||
84 | *value = *value >> ((where & 3) * 8); | ||
85 | *value &= 0xff; | ||
86 | break; | ||
87 | } | ||
88 | |||
89 | if (pci_cfg_dbg) { | ||
90 | printk("read: %d,%08x,%02x,%d: %08x (%08x)\n", | ||
91 | bus->number, devfn, where, size, *value, | ||
92 | __raw_readl(KS8695_PCI_VA + KS8695_PBCD)); | ||
93 | } | ||
94 | |||
95 | return PCIBIOS_SUCCESSFUL; | ||
96 | } | ||
97 | |||
98 | static int ks8695_pci_writeconfig(struct pci_bus *bus, | ||
99 | unsigned int devfn, int where, int size, u32 value) | ||
100 | { | 62 | { |
101 | unsigned long tmp; | ||
102 | |||
103 | if (pci_cfg_dbg) { | ||
104 | printk("write: %d,%08x,%02x,%d: %08x\n", | ||
105 | bus->number, devfn, where, size, value); | ||
106 | } | ||
107 | |||
108 | ks8695_pci_setupconfig(bus->number, devfn, where); | 63 | ks8695_pci_setupconfig(bus->number, devfn, where); |
109 | 64 | return KS8695_PCI_VA + KS8695_PBCD; | |
110 | switch (size) { | ||
111 | case 4: | ||
112 | __raw_writel(value, KS8695_PCI_VA + KS8695_PBCD); | ||
113 | break; | ||
114 | case 2: | ||
115 | tmp = __raw_readl(KS8695_PCI_VA + KS8695_PBCD); | ||
116 | tmp &= ~(0xffff << ((where & 2) * 8)); | ||
117 | tmp |= value << ((where & 2) * 8); | ||
118 | |||
119 | __raw_writel(tmp, KS8695_PCI_VA + KS8695_PBCD); | ||
120 | break; | ||
121 | case 1: | ||
122 | tmp = __raw_readl(KS8695_PCI_VA + KS8695_PBCD); | ||
123 | tmp &= ~(0xff << ((where & 3) * 8)); | ||
124 | tmp |= value << ((where & 3) * 8); | ||
125 | |||
126 | __raw_writel(tmp, KS8695_PCI_VA + KS8695_PBCD); | ||
127 | break; | ||
128 | } | ||
129 | |||
130 | return PCIBIOS_SUCCESSFUL; | ||
131 | } | 65 | } |
132 | 66 | ||
133 | static void ks8695_local_writeconfig(int where, u32 value) | 67 | static void ks8695_local_writeconfig(int where, u32 value) |
@@ -137,8 +71,9 @@ static void ks8695_local_writeconfig(int where, u32 value) | |||
137 | } | 71 | } |
138 | 72 | ||
139 | static struct pci_ops ks8695_pci_ops = { | 73 | static struct pci_ops ks8695_pci_ops = { |
140 | .read = ks8695_pci_readconfig, | 74 | .map_bus = ks8695_pci_map_bus, |
141 | .write = ks8695_pci_writeconfig, | 75 | .read = pci_generic_config_read32, |
76 | .write = pci_generic_config_write32, | ||
142 | }; | 77 | }; |
143 | 78 | ||
144 | static struct resource pci_mem = { | 79 | static struct resource pci_mem = { |