aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSergei Shtylyov <sshtylyov@ru.mvista.com>2008-04-28 11:54:38 -0400
committerRalf Baechle <ralf@linux-mips.org>2008-04-28 12:14:33 -0400
commitfcbd3b4b92efe29b59df16b910138cf43683be88 (patch)
tree2aadd1e40849ea39e08fe41ee8772f38f27e6872
parentdf2700519c84ee8ee1e5ea165725c651f6d4d1a4 (diff)
[MIPS] Pb1200/DBAu1200: move platform code to its proper place
Since both the IDE interface and SMC 91C111 Ethernet chip are on-board devices, not SOC devices, move the platform device registration form the common to the board specific code. While at it, remove semicolon (which didn't break compilation only by chance) from the AU1XXX_ATA_DDMA_REQ macro and do some renaming: - change 'au1200_ide0_' variable name prefix to the mere 'ide_'; - change 'smc91x_' variable name prefix to 'smc91c111_' since that's the name of the chip used on the boards; - drop 'AU1XXX_' prefix from the names of macros describing IDE and Ethernet on-board devices; - change 'SMC91111_' to 'SMC91C111_', change 'IRQ' to 'INT' in the names of the macros describing the Ethernet chip for consistency with the IDE macros; - change 'ATA_' to 'IDE_' and 'OFFSET' to 'SHIFT' (since this value is indeed a shift count) in the names of the macros describing the IDE interface. Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
-rw-r--r--arch/mips/au1000/common/platform.c54
-rw-r--r--arch/mips/au1000/pb1200/Makefile1
-rw-r--r--arch/mips/au1000/pb1200/platform.c84
-rw-r--r--drivers/ide/mips/au1xxx-ide.c8
-rw-r--r--include/asm-mips/mach-db1x00/db1200.h18
-rw-r--r--include/asm-mips/mach-pb1x00/pb1200.h18
6 files changed, 107 insertions, 76 deletions
diff --git a/arch/mips/au1000/common/platform.c b/arch/mips/au1000/common/platform.c
index 83ad422e8aca..31d2a2270878 100644
--- a/arch/mips/au1000/common/platform.c
+++ b/arch/mips/au1000/common/platform.c
@@ -233,19 +233,6 @@ static struct resource au1200_lcd_resources[] = {
233 } 233 }
234}; 234};
235 235
236static struct resource au1200_ide0_resources[] = {
237 [0] = {
238 .start = AU1XXX_ATA_PHYS_ADDR,
239 .end = AU1XXX_ATA_PHYS_ADDR + AU1XXX_ATA_PHYS_LEN - 1,
240 .flags = IORESOURCE_MEM,
241 },
242 [1] = {
243 .start = AU1XXX_ATA_INT,
244 .end = AU1XXX_ATA_INT,
245 .flags = IORESOURCE_IRQ,
246 }
247};
248
249static u64 au1200_lcd_dmamask = ~(u32)0; 236static u64 au1200_lcd_dmamask = ~(u32)0;
250 237
251static struct platform_device au1200_lcd_device = { 238static struct platform_device au1200_lcd_device = {
@@ -259,20 +246,6 @@ static struct platform_device au1200_lcd_device = {
259 .resource = au1200_lcd_resources, 246 .resource = au1200_lcd_resources,
260}; 247};
261 248
262
263static u64 ide0_dmamask = ~(u32)0;
264
265static struct platform_device au1200_ide0_device = {
266 .name = "au1200-ide",
267 .id = 0,
268 .dev = {
269 .dma_mask = &ide0_dmamask,
270 .coherent_dma_mask = 0xffffffff,
271 },
272 .num_resources = ARRAY_SIZE(au1200_ide0_resources),
273 .resource = au1200_ide0_resources,
274};
275
276static u64 au1xxx_mmc_dmamask = ~(u32)0; 249static u64 au1xxx_mmc_dmamask = ~(u32)0;
277 250
278static struct platform_device au1xxx_mmc_device = { 251static struct platform_device au1xxx_mmc_device = {
@@ -292,29 +265,6 @@ static struct platform_device au1x00_pcmcia_device = {
292 .id = 0, 265 .id = 0,
293}; 266};
294 267
295#if defined(CONFIG_MIPS_DB1200) || defined(CONFIG_MIPS_PB1200)
296static struct resource smc91x_resources[] = {
297 [0] = {
298 .name = "smc91x-regs",
299 .start = AU1XXX_SMC91111_PHYS_ADDR,
300 .end = AU1XXX_SMC91111_PHYS_ADDR + 0xf,
301 .flags = IORESOURCE_MEM,
302 },
303 [1] = {
304 .start = AU1XXX_SMC91111_IRQ,
305 .end = AU1XXX_SMC91111_IRQ,
306 .flags = IORESOURCE_IRQ,
307 },
308};
309
310static struct platform_device smc91x_device = {
311 .name = "smc91x",
312 .id = -1,
313 .num_resources = ARRAY_SIZE(smc91x_resources),
314 .resource = smc91x_resources,
315};
316#endif /* defined(CONFIG_MIPS_DB1200) || defined(CONFIG_MIPS_PB1200) */
317
318/* All Alchemy demoboards with I2C have this #define in their headers */ 268/* All Alchemy demoboards with I2C have this #define in their headers */
319#ifdef SMBUS_PSC_BASE 269#ifdef SMBUS_PSC_BASE
320static struct resource pbdb_smbus_resources[] = { 270static struct resource pbdb_smbus_resources[] = {
@@ -345,12 +295,8 @@ static struct platform_device *au1xxx_platform_devices[] __initdata = {
345 &au1xxx_usb_gdt_device, 295 &au1xxx_usb_gdt_device,
346 &au1xxx_usb_otg_device, 296 &au1xxx_usb_otg_device,
347 &au1200_lcd_device, 297 &au1200_lcd_device,
348 &au1200_ide0_device,
349 &au1xxx_mmc_device, 298 &au1xxx_mmc_device,
350#endif 299#endif
351#if defined(CONFIG_MIPS_DB1200) || defined(CONFIG_MIPS_PB1200)
352 &smc91x_device,
353#endif
354#ifdef SMBUS_PSC_BASE 300#ifdef SMBUS_PSC_BASE
355 &pbdb_smbus_device, 301 &pbdb_smbus_device,
356#endif 302#endif
diff --git a/arch/mips/au1000/pb1200/Makefile b/arch/mips/au1000/pb1200/Makefile
index 970b1b1d5cda..4fe02ea65a60 100644
--- a/arch/mips/au1000/pb1200/Makefile
+++ b/arch/mips/au1000/pb1200/Makefile
@@ -3,5 +3,6 @@
3# 3#
4 4
5lib-y := init.o board_setup.o irqmap.o 5lib-y := init.o board_setup.o irqmap.o
6obj-y += platform.o
6 7
7EXTRA_CFLAGS += -Werror 8EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/au1000/pb1200/platform.c b/arch/mips/au1000/pb1200/platform.c
new file mode 100644
index 000000000000..5930110b9b6d
--- /dev/null
+++ b/arch/mips/au1000/pb1200/platform.c
@@ -0,0 +1,84 @@
1/*
2 * Pb1200/DBAu1200 board platform device registration
3 *
4 * Copyright (C) 2008 MontaVista Software Inc. <source@mvista.com>
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 as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
19 */
20
21#include <linux/init.h>
22#include <linux/platform_device.h>
23
24#include <asm/mach-au1x00/au1xxx.h>
25
26static struct resource ide_resources[] = {
27 [0] = {
28 .start = IDE_PHYS_ADDR,
29 .end = IDE_PHYS_ADDR + IDE_PHYS_LEN - 1,
30 .flags = IORESOURCE_MEM
31 },
32 [1] = {
33 .start = IDE_INT,
34 .end = IDE_INT,
35 .flags = IORESOURCE_IRQ
36 }
37};
38
39static u64 ide_dmamask = ~(u32)0;
40
41static struct platform_device ide_device = {
42 .name = "au1200-ide",
43 .id = 0,
44 .dev = {
45 .dma_mask = &ide_dmamask,
46 .coherent_dma_mask = 0xffffffff,
47 },
48 .num_resources = ARRAY_SIZE(ide_resources),
49 .resource = ide_resources
50};
51
52static struct resource smc91c111_resources[] = {
53 [0] = {
54 .name = "smc91x-regs",
55 .start = SMC91C111_PHYS_ADDR,
56 .end = SMC91C111_PHYS_ADDR + 0xf,
57 .flags = IORESOURCE_MEM
58 },
59 [1] = {
60 .start = SMC91C111_INT,
61 .end = SMC91C111_INT,
62 .flags = IORESOURCE_IRQ
63 },
64};
65
66static struct platform_device smc91c111_device = {
67 .name = "smc91x",
68 .id = -1,
69 .num_resources = ARRAY_SIZE(smc91c111_resources),
70 .resource = smc91c111_resources
71};
72
73static struct platform_device *board_platform_devices[] __initdata = {
74 &ide_device,
75 &smc91c111_device
76};
77
78static int __init board_register_devices(void)
79{
80 return platform_add_devices(board_platform_devices,
81 ARRAY_SIZE(board_platform_devices));
82}
83
84arch_initcall(board_register_devices);
diff --git a/drivers/ide/mips/au1xxx-ide.c b/drivers/ide/mips/au1xxx-ide.c
index 296b9c674bae..e0cf5e2dbab7 100644
--- a/drivers/ide/mips/au1xxx-ide.c
+++ b/drivers/ide/mips/au1xxx-ide.c
@@ -359,7 +359,7 @@ static void auide_ddma_rx_callback(int irq, void *param)
359static void auide_init_dbdma_dev(dbdev_tab_t *dev, u32 dev_id, u32 tsize, u32 devwidth, u32 flags) 359static void auide_init_dbdma_dev(dbdev_tab_t *dev, u32 dev_id, u32 tsize, u32 devwidth, u32 flags)
360{ 360{
361 dev->dev_id = dev_id; 361 dev->dev_id = dev_id;
362 dev->dev_physaddr = (u32)AU1XXX_ATA_PHYS_ADDR; 362 dev->dev_physaddr = (u32)IDE_PHYS_ADDR;
363 dev->dev_intlevel = 0; 363 dev->dev_intlevel = 0;
364 dev->dev_intpolarity = 0; 364 dev->dev_intpolarity = 0;
365 dev->dev_tsize = tsize; 365 dev->dev_tsize = tsize;
@@ -397,7 +397,7 @@ static int auide_ddma_init(ide_hwif_t *hwif, const struct ide_port_info *d)
397 dbdev_tab_t source_dev_tab, target_dev_tab; 397 dbdev_tab_t source_dev_tab, target_dev_tab;
398 u32 dev_id, tsize, devwidth, flags; 398 u32 dev_id, tsize, devwidth, flags;
399 399
400 dev_id = AU1XXX_ATA_DDMA_REQ; 400 dev_id = IDE_DDMA_REQ;
401 401
402 tsize = 8; /* 1 */ 402 tsize = 8; /* 1 */
403 devwidth = 32; /* 16 */ 403 devwidth = 32; /* 16 */
@@ -506,10 +506,10 @@ static void auide_setup_ports(hw_regs_t *hw, _auide_hwif *ahwif)
506 506
507 /* FIXME? */ 507 /* FIXME? */
508 for (i = 0; i < 8; i++) 508 for (i = 0; i < 8; i++)
509 *ata_regs++ = ahwif->regbase + (i << AU1XXX_ATA_REG_OFFSET); 509 *ata_regs++ = ahwif->regbase + (i << IDE_REG_SHIFT);
510 510
511 /* set the Alternative Status register */ 511 /* set the Alternative Status register */
512 *ata_regs = ahwif->regbase + (14 << AU1XXX_ATA_REG_OFFSET); 512 *ata_regs = ahwif->regbase + (14 << IDE_REG_SHIFT);
513} 513}
514 514
515static const struct ide_port_ops au1xxx_port_ops = { 515static const struct ide_port_ops au1xxx_port_ops = {
diff --git a/include/asm-mips/mach-db1x00/db1200.h b/include/asm-mips/mach-db1x00/db1200.h
index d2e28e64932e..eedd048a7261 100644
--- a/include/asm-mips/mach-db1x00/db1200.h
+++ b/include/asm-mips/mach-db1x00/db1200.h
@@ -169,15 +169,15 @@ static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
169#define BCSR_INT_SD0INSERT 0x1000 169#define BCSR_INT_SD0INSERT 0x1000
170#define BCSR_INT_SD0EJECT 0x2000 170#define BCSR_INT_SD0EJECT 0x2000
171 171
172#define AU1XXX_SMC91111_PHYS_ADDR (0x19000300) 172#define SMC91C111_PHYS_ADDR 0x19000300
173#define AU1XXX_SMC91111_IRQ DB1200_ETH_INT 173#define SMC91C111_INT DB1200_ETH_INT
174 174
175#define AU1XXX_ATA_PHYS_ADDR (0x18800000) 175#define IDE_PHYS_ADDR 0x18800000
176#define AU1XXX_ATA_REG_OFFSET (5) 176#define IDE_REG_SHIFT 5
177#define AU1XXX_ATA_PHYS_LEN (16 << AU1XXX_ATA_REG_OFFSET) 177#define IDE_PHYS_LEN (16 << IDE_REG_SHIFT)
178#define AU1XXX_ATA_INT DB1200_IDE_INT 178#define IDE_INT DB1200_IDE_INT
179#define AU1XXX_ATA_DDMA_REQ DSCR_CMD0_DMA_REQ1; 179#define IDE_DDMA_REQ DSCR_CMD0_DMA_REQ1
180#define AU1XXX_ATA_RQSIZE 128 180#define IDE_RQSIZE 128
181 181
182#define NAND_PHYS_ADDR 0x20000000 182#define NAND_PHYS_ADDR 0x20000000
183 183
diff --git a/include/asm-mips/mach-pb1x00/pb1200.h b/include/asm-mips/mach-pb1x00/pb1200.h
index edaa489b58f1..e2c6bcac3b42 100644
--- a/include/asm-mips/mach-pb1x00/pb1200.h
+++ b/include/asm-mips/mach-pb1x00/pb1200.h
@@ -182,15 +182,15 @@ static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
182#define SET_VCC_VPP(VCC, VPP, SLOT)\ 182#define SET_VCC_VPP(VCC, VPP, SLOT)\
183 ((((VCC)<<2) | ((VPP)<<0)) << ((SLOT)*8)) 183 ((((VCC)<<2) | ((VPP)<<0)) << ((SLOT)*8))
184 184
185#define AU1XXX_SMC91111_PHYS_ADDR (0x0D000300) 185#define SMC91C111_PHYS_ADDR 0x0D000300
186#define AU1XXX_SMC91111_IRQ PB1200_ETH_INT 186#define SMC91C111_INT PB1200_ETH_INT
187 187
188#define AU1XXX_ATA_PHYS_ADDR (0x0C800000) 188#define IDE_PHYS_ADDR 0x0C800000
189#define AU1XXX_ATA_REG_OFFSET (5) 189#define IDE_REG_SHIFT 5
190#define AU1XXX_ATA_PHYS_LEN (16 << AU1XXX_ATA_REG_OFFSET) 190#define IDE_PHYS_LEN (16 << IDE_REG_SHIFT)
191#define AU1XXX_ATA_INT PB1200_IDE_INT 191#define IDE_INT PB1200_IDE_INT
192#define AU1XXX_ATA_DDMA_REQ DSCR_CMD0_DMA_REQ1; 192#define IDE_DDMA_REQ DSCR_CMD0_DMA_REQ1
193#define AU1XXX_ATA_RQSIZE 128 193#define IDE_RQSIZE 128
194 194
195#define NAND_PHYS_ADDR 0x1C000000 195#define NAND_PHYS_ADDR 0x1C000000
196 196