use broken-out patches for the coldfire to make it easier to follow differences again...
[librecmc/librecmc.git] / target / linux / coldfire / patches / 036-m5445x_pci.patch
1 From da8e8fe3d6ad5eb9589c8e77e7716e4f7e1a7499 Mon Sep 17 00:00:00 2001
2 From: Kurt Mahan <kmahan@freescale.com>
3 Date: Mon, 10 Dec 2007 03:36:05 -0700
4 Subject: [PATCH] Coldfire M5445x PCI Bits.
5
6 LTIBName: m5445x-pci
7 Signed-off-by: Kurt Mahan <kmahan@freescale.com>
8 ---
9  arch/m68k/Kconfig                     |   12 ++++++++++--
10  arch/m68k/Makefile                    |    4 ++++
11  arch/m68k/coldfire/config.c           |    2 +-
12  arch/m68k/coldfire/iomap.c            |    2 ++
13  arch/m68k/coldfire/mcf5445x-devices.c |    9 +++++++++
14  arch/m68k/coldfire/mcf5445x-pci.c     |    5 +++--
15  arch/m68k/coldfire/pci.c              |    6 +++---
16  arch/m68k/kernel/Makefile             |    2 +-
17  drivers/macintosh/Kconfig             |    1 -
18  drivers/pci/Makefile                  |    1 +
19  include/asm-m68k/io.h                 |   13 ++++++++++++-
20  include/asm-m68k/pci.h                |    2 ++
21  12 files changed, 48 insertions(+), 11 deletions(-)
22
23 --- a/arch/m68k/Kconfig
24 +++ b/arch/m68k/Kconfig
25 @@ -11,6 +11,14 @@ config MMU
26         bool
27         default y
28  
29 +config GENERIC_TIME
30 +        bool
31 +        default n
32 +
33 +config GENERIC_CLOCKEVENTS
34 +        bool
35 +        default n
36 +
37  config RWSEM_GENERIC_SPINLOCK
38         bool
39         default y
40 @@ -48,7 +56,7 @@ config ARCH_MAY_HAVE_PC_FDC
41         default y
42  
43  config NO_IOPORT
44 -       def_bool y
45 +       def_bool !M54455
46  
47  config NO_DMA
48         def_bool SUN3
49 @@ -159,7 +167,7 @@ config HADES
50  
51  config PCI
52         bool
53 -       depends on HADES
54 +       depends on HADES || M54455
55         default y
56         help
57           Find out whether you have a PCI motherboard. PCI is the name of a
58 --- a/arch/m68k/Makefile
59 +++ b/arch/m68k/Makefile
60 @@ -32,6 +32,10 @@ ifdef CONFIG_SUN3
61  LDFLAGS_vmlinux = -N
62  endif
63  
64 +ifdef CONFIG_COLDFIRE
65 +# LDFLAGS_vmlinux = --verbose
66 +endif
67 +
68  CHECKFLAGS += -D__mc68000__
69  
70  # without -fno-strength-reduce the 53c7xx.c driver fails ;-(
71 --- a/arch/m68k/coldfire/config.c
72 +++ b/arch/m68k/coldfire/config.c
73 @@ -252,7 +252,7 @@ void __init coldfire_sched_init(irq_hand
74                      MCF_DTIM_DTMR_FRR  | MCF_DTIM_DTMR_RST_EN, \
75                      MCF_DTIM0_DTMR);
76  
77 -       request_irq(mcf_timervector, handler, SA_INTERRUPT, \
78 +       request_irq(mcf_timervector, handler, IRQF_DISABLED, \
79                     "timer", (void *)MCF_DTIM0_DTMR);
80  
81         settimericr(1, mcf_timerlevel);
82 --- a/arch/m68k/coldfire/iomap.c
83 +++ b/arch/m68k/coldfire/iomap.c
84 @@ -12,6 +12,7 @@
85  #include <linux/pci.h>
86  #include <asm/io.h>
87  
88 +#if 0
89  void __iomem *__attribute__ ((weak))
90  ioport_map(unsigned long port, unsigned int len)
91  {
92 @@ -52,3 +53,4 @@ void pci_iounmap(struct pci_dev *dev, vo
93         /* Nothing .. */
94  }
95  EXPORT_SYMBOL(ioport_unmap);
96 +#endif
97 --- a/arch/m68k/coldfire/mcf5445x-devices.c
98 +++ b/arch/m68k/coldfire/mcf5445x-devices.c
99 @@ -75,10 +75,19 @@ static int ata_get_clk_rate(void)
100         return MCF_BUSCLK;
101  }
102  
103 +/* JKM -- move these to a header file */
104 +#define MCF_IDE_DMA_WATERMARK  32      /* DMA watermark level in bytes */
105 +#define MCF_IDE_DMA_BD_NR      (512/3/4) /* number of BDs per channel */
106 +
107  static struct fsl_ata_platform_data ata_data = {
108         .init             = ata_init,
109         .exit             = ata_exit,
110         .get_clk_rate     = ata_get_clk_rate,
111 +#ifdef CONFIG_PATA_FSL_USE_DMA
112 +        .udma_mask        = 0x0F, /* the board handles up to UDMA3 */
113 +        .fifo_alarm       = MCF_IDE_DMA_WATERMARK / 2,
114 +        .max_sg           = MCF_IDE_DMA_BD_NR,
115 +#endif
116  };
117  
118  static struct resource pata_fsl_resources[] = {
119 --- a/arch/m68k/coldfire/mcf5445x-pci.c
120 +++ b/arch/m68k/coldfire/mcf5445x-pci.c
121 @@ -8,6 +8,7 @@
122   */
123  
124  #include <linux/delay.h>
125 +#include <linux/interrupt.h>
126  #include <linux/pci.h>
127  
128  #include <asm/mcfsim.h>
129 @@ -76,7 +77,7 @@ void mcf5445x_pci_dumpregs(void);
130  #endif
131  
132  /*
133 - * static void mcf5445x_conf_device(struct pci_dev *dev)
134 + * mcf5445x_conf_device(struct pci_dev *dev)
135   *
136   * Machine dependent Configure the given device.
137   *
138 @@ -84,7 +85,7 @@ void mcf5445x_pci_dumpregs(void);
139   *
140   * dev         - the pci device.
141   */
142 -void __init
143 +void
144  mcf5445x_conf_device(struct pci_dev *dev)
145  {
146         set_fpga(FPGA_PCI_IRQ_ENABLE, 0x0f);
147 --- a/arch/m68k/coldfire/pci.c
148 +++ b/arch/m68k/coldfire/pci.c
149 @@ -56,7 +56,7 @@ struct pci_ops pci_root_ops = {
150   *
151   * Initialize the pcibios based on cmd line params.
152   */
153 -char * __init
154 +char *
155  pcibios_setup(char *str)
156  {
157         if (!strcmp(str, "debug")) {
158 @@ -124,7 +124,7 @@ pcibios_map_irq(struct pci_dev *dev, u8 
159   *
160   * Update a PCI interrupt.
161   */
162 -void __init
163 +void
164  pcibios_update_irq(struct pci_dev *dev, int irq)
165  {
166         pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq);
167 @@ -171,7 +171,7 @@ pcibios_enable_device(struct pci_dev *de
168  /*
169   * pcibios_fixup_bus(struct pci_bus *bus)
170   */
171 -void __init
172 +void
173  pcibios_fixup_bus(struct pci_bus *bus)
174  {
175         struct pci_dev *dev = bus->self;
176 --- a/arch/m68k/kernel/Makefile
177 +++ b/arch/m68k/kernel/Makefile
178 @@ -9,6 +9,7 @@ else
179  ifndef CONFIG_COLDFIRE
180    extra-y := head.o vmlinux.lds
181    obj-y := entry.o signal.o traps.o ints.o
182 +  obj-$(CONFIG_PCI) += bios32.o
183  else   # CONFIG_COLDFIRE
184    extra-y := ../coldfire/head.o vmlinux.lds
185  endif
186 @@ -19,7 +20,6 @@ obj-y += process.o ptrace.o module.o \
187  
188  devres-y = ../../../kernel/irq/devres.o
189  
190 -obj-$(CONFIG_PCI)      += bios32.o
191  obj-y$(CONFIG_MMU_SUN3) += dma.o       # no, it's not a typo
192  
193  EXTRA_AFLAGS := -traditional
194 --- a/drivers/macintosh/Kconfig
195 +++ b/drivers/macintosh/Kconfig
196 @@ -118,7 +118,6 @@ config PMAC_SMU
197  
198  config PMAC_APM_EMU
199         tristate "APM emulation"
200 -       select APM_EMULATION
201         depends on ADB_PMU && PM && PPC32
202  
203  config PMAC_MEDIABAY
204 --- a/drivers/pci/Makefile
205 +++ b/drivers/pci/Makefile
206 @@ -39,6 +39,7 @@ obj-$(CONFIG_PPC) += setup-bus.o
207  obj-$(CONFIG_MIPS) += setup-bus.o setup-irq.o
208  obj-$(CONFIG_X86_VISWS) += setup-irq.o
209  obj-$(CONFIG_MN10300) += setup-bus.o
210 +obj-$(CONFIG_M54455) += setup-bus.o setup-irq.o
211  
212  #
213  # ACPI Related PCI FW Functions
214 --- a/include/asm-m68k/io.h
215 +++ b/include/asm-m68k/io.h
216 @@ -306,7 +306,18 @@ static inline void isa_delay(void)
217  #define outw(val,port) out_le16((port),(val))
218  #define inl(port)      in_le32(port)
219  #define outl(val,port) out_le32((port),(val))
220 -
221 +#define insb(port, buf, nr)    \
222 +               raw_insb((u8 *)(port), (u8 *)(buf), (nr))
223 +#define outsb(port, buf, nr)   \
224 +               raw_outsb((u8 *)(port), (u8 *)(buf), (nr))
225 +#define insw(port, buf, nr)    \
226 +               raw_insw_swapw((u16 *)(port), (u16 *)(buf), (nr))
227 +#define outsw(port, buf, nr)   \
228 +               raw_outsw_swapw((u16 *)(port), (u16 *)(buf), (nr))
229 +#define insl(port, buf, nr)    \
230 +               raw_insw_swapw((u16 *)(port), (u16 *)(buf), (nr)<<1)
231 +#define outsl(port, buf, nr)   \
232 +               raw_outsw_swapw((u16 *)(port), (u16 *)(buf), (nr)<<1)
233  #else
234  /*
235   * kernel with both ISA and PCI compiled in, those have
236 --- a/include/asm-m68k/pci.h
237 +++ b/include/asm-m68k/pci.h
238 @@ -42,11 +42,13 @@ pcibios_penalize_isa_irq(int irq, int ac
239         /* no dynamic PCI IRQ allocation */
240  }
241  
242 +#if 0
243  static inline void
244  pcibios_add_platform_entries(struct pci_dev *dev)
245  {
246         /* no special handling */
247  }
248 +#endif
249  
250  static inline void
251  pcibios_resource_to_bus(struct pci_dev *dev, struct pci_bus_region *region,