Skip to content

Commit fcbd3b4

Browse files
Sergei Shtylyovralfbaechle
authored andcommitted
[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 <[email protected]> Signed-off-by: Ralf Baechle <[email protected]>
1 parent df27005 commit fcbd3b4

File tree

6 files changed

+107
-76
lines changed

6 files changed

+107
-76
lines changed

arch/mips/au1000/common/platform.c

Lines changed: 0 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -233,19 +233,6 @@ static struct resource au1200_lcd_resources[] = {
233233
}
234234
};
235235

236-
static 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-
249236
static u64 au1200_lcd_dmamask = ~(u32)0;
250237

251238
static struct platform_device au1200_lcd_device = {
@@ -259,20 +246,6 @@ static struct platform_device au1200_lcd_device = {
259246
.resource = au1200_lcd_resources,
260247
};
261248

262-
263-
static u64 ide0_dmamask = ~(u32)0;
264-
265-
static 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-
276249
static u64 au1xxx_mmc_dmamask = ~(u32)0;
277250

278251
static struct platform_device au1xxx_mmc_device = {
@@ -292,29 +265,6 @@ static struct platform_device au1x00_pcmcia_device = {
292265
.id = 0,
293266
};
294267

295-
#if defined(CONFIG_MIPS_DB1200) || defined(CONFIG_MIPS_PB1200)
296-
static 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-
310-
static 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-
318268
/* All Alchemy demoboards with I2C have this #define in their headers */
319269
#ifdef SMBUS_PSC_BASE
320270
static struct resource pbdb_smbus_resources[] = {
@@ -345,12 +295,8 @@ static struct platform_device *au1xxx_platform_devices[] __initdata = {
345295
&au1xxx_usb_gdt_device,
346296
&au1xxx_usb_otg_device,
347297
&au1200_lcd_device,
348-
&au1200_ide0_device,
349298
&au1xxx_mmc_device,
350299
#endif
351-
#if defined(CONFIG_MIPS_DB1200) || defined(CONFIG_MIPS_PB1200)
352-
&smc91x_device,
353-
#endif
354300
#ifdef SMBUS_PSC_BASE
355301
&pbdb_smbus_device,
356302
#endif

arch/mips/au1000/pb1200/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
#
44

55
lib-y := init.o board_setup.o irqmap.o
6+
obj-y += platform.o
67

78
EXTRA_CFLAGS += -Werror

arch/mips/au1000/pb1200/platform.c

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
/*
2+
* Pb1200/DBAu1200 board platform device registration
3+
*
4+
* Copyright (C) 2008 MontaVista Software Inc. <[email protected]>
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+
26+
static 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+
39+
static u64 ide_dmamask = ~(u32)0;
40+
41+
static 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+
52+
static 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+
66+
static struct platform_device smc91c111_device = {
67+
.name = "smc91x",
68+
.id = -1,
69+
.num_resources = ARRAY_SIZE(smc91c111_resources),
70+
.resource = smc91c111_resources
71+
};
72+
73+
static struct platform_device *board_platform_devices[] __initdata = {
74+
&ide_device,
75+
&smc91c111_device
76+
};
77+
78+
static int __init board_register_devices(void)
79+
{
80+
return platform_add_devices(board_platform_devices,
81+
ARRAY_SIZE(board_platform_devices));
82+
}
83+
84+
arch_initcall(board_register_devices);

drivers/ide/mips/au1xxx-ide.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -359,7 +359,7 @@ static void auide_ddma_rx_callback(int irq, void *param)
359359
static void auide_init_dbdma_dev(dbdev_tab_t *dev, u32 dev_id, u32 tsize, u32 devwidth, u32 flags)
360360
{
361361
dev->dev_id = dev_id;
362-
dev->dev_physaddr = (u32)AU1XXX_ATA_PHYS_ADDR;
362+
dev->dev_physaddr = (u32)IDE_PHYS_ADDR;
363363
dev->dev_intlevel = 0;
364364
dev->dev_intpolarity = 0;
365365
dev->dev_tsize = tsize;
@@ -397,7 +397,7 @@ static int auide_ddma_init(ide_hwif_t *hwif, const struct ide_port_info *d)
397397
dbdev_tab_t source_dev_tab, target_dev_tab;
398398
u32 dev_id, tsize, devwidth, flags;
399399

400-
dev_id = AU1XXX_ATA_DDMA_REQ;
400+
dev_id = IDE_DDMA_REQ;
401401

402402
tsize = 8; /* 1 */
403403
devwidth = 32; /* 16 */
@@ -506,10 +506,10 @@ static void auide_setup_ports(hw_regs_t *hw, _auide_hwif *ahwif)
506506

507507
/* FIXME? */
508508
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);
510510

511511
/* set the Alternative Status register */
512-
*ata_regs = ahwif->regbase + (14 << AU1XXX_ATA_REG_OFFSET);
512+
*ata_regs = ahwif->regbase + (14 << IDE_REG_SHIFT);
513513
}
514514

515515
static const struct ide_port_ops au1xxx_port_ops = {

include/asm-mips/mach-db1x00/db1200.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -169,15 +169,15 @@ static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
169169
#define BCSR_INT_SD0INSERT 0x1000
170170
#define BCSR_INT_SD0EJECT 0x2000
171171

172-
#define AU1XXX_SMC91111_PHYS_ADDR (0x19000300)
173-
#define AU1XXX_SMC91111_IRQ DB1200_ETH_INT
174-
175-
#define AU1XXX_ATA_PHYS_ADDR (0x18800000)
176-
#define AU1XXX_ATA_REG_OFFSET (5)
177-
#define AU1XXX_ATA_PHYS_LEN (16 << AU1XXX_ATA_REG_OFFSET)
178-
#define AU1XXX_ATA_INT DB1200_IDE_INT
179-
#define AU1XXX_ATA_DDMA_REQ DSCR_CMD0_DMA_REQ1;
180-
#define AU1XXX_ATA_RQSIZE 128
172+
#define SMC91C111_PHYS_ADDR 0x19000300
173+
#define SMC91C111_INT DB1200_ETH_INT
174+
175+
#define IDE_PHYS_ADDR 0x18800000
176+
#define IDE_REG_SHIFT 5
177+
#define IDE_PHYS_LEN (16 << IDE_REG_SHIFT)
178+
#define IDE_INT DB1200_IDE_INT
179+
#define IDE_DDMA_REQ DSCR_CMD0_DMA_REQ1
180+
#define IDE_RQSIZE 128
181181

182182
#define NAND_PHYS_ADDR 0x20000000
183183

include/asm-mips/mach-pb1x00/pb1200.h

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -182,15 +182,15 @@ static BCSR * const bcsr = (BCSR *)BCSR_KSEG1_ADDR;
182182
#define SET_VCC_VPP(VCC, VPP, SLOT)\
183183
((((VCC)<<2) | ((VPP)<<0)) << ((SLOT)*8))
184184

185-
#define AU1XXX_SMC91111_PHYS_ADDR (0x0D000300)
186-
#define AU1XXX_SMC91111_IRQ PB1200_ETH_INT
187-
188-
#define AU1XXX_ATA_PHYS_ADDR (0x0C800000)
189-
#define AU1XXX_ATA_REG_OFFSET (5)
190-
#define AU1XXX_ATA_PHYS_LEN (16 << AU1XXX_ATA_REG_OFFSET)
191-
#define AU1XXX_ATA_INT PB1200_IDE_INT
192-
#define AU1XXX_ATA_DDMA_REQ DSCR_CMD0_DMA_REQ1;
193-
#define AU1XXX_ATA_RQSIZE 128
185+
#define SMC91C111_PHYS_ADDR 0x0D000300
186+
#define SMC91C111_INT PB1200_ETH_INT
187+
188+
#define IDE_PHYS_ADDR 0x0C800000
189+
#define IDE_REG_SHIFT 5
190+
#define IDE_PHYS_LEN (16 << IDE_REG_SHIFT)
191+
#define IDE_INT PB1200_IDE_INT
192+
#define IDE_DDMA_REQ DSCR_CMD0_DMA_REQ1
193+
#define IDE_RQSIZE 128
194194

195195
#define NAND_PHYS_ADDR 0x1C000000
196196

0 commit comments

Comments
 (0)