[brcm63xx] backport an upstream fix: We're not disabling IRQ, so we must call the...
[openwrt.git] / target / linux / brcm63xx / files / arch / mips / bcm63xx / dev-spi.c
1 /*
2 * This file is subject to the terms and conditions of the GNU General Public
3 * License. See the file "COPYING" in the main directory of this archive
4 * for more details.
5 *
6 * Copyright (C) 2009 Florian Fainelli <florian@openwrt.org>
7 */
8
9 #include <linux/init.h>
10 #include <linux/kernel.h>
11 #include <linux/platform_device.h>
12
13 #include <bcm63xx_cpu.h>
14 #include <bcm63xx_dev_spi.h>
15 #include <bcm63xx_regs.h>
16
17 static struct resource spi_resources[] = {
18 {
19 .start = -1, /* filled at runtime */
20 .end = -1, /* filled at runtime */
21 .flags = IORESOURCE_MEM,
22 },
23 {
24 .start = -1, /* filled at runtime */
25 .flags = IORESOURCE_IRQ,
26 },
27 };
28
29 static struct bcm63xx_spi_pdata spi_pdata = {
30 .bus_num = 0,
31 .num_chipselect = 4,
32 .speed_hz = 50000000, /* Fclk */
33 };
34
35 static struct platform_device bcm63xx_spi_device = {
36 .name = "bcm63xx-spi",
37 .id = 0,
38 .num_resources = ARRAY_SIZE(spi_resources),
39 .resource = spi_resources,
40 .dev = {
41 .platform_data = &spi_pdata,
42 },
43 };
44
45 int __init bcm63xx_spi_register(void)
46 {
47 spi_resources[0].start = bcm63xx_regset_address(RSET_SPI);
48 spi_resources[0].end = spi_resources[0].start;
49 spi_resources[0].end += RSET_SPI_SIZE - 1;
50 spi_resources[1].start = bcm63xx_get_irq_number(IRQ_SPI);
51
52 /* Fill in platform data */
53 if (BCMCPU_IS_6338() || BCMCPU_IS_6348())
54 spi_pdata.fifo_size = SPI_BCM_6338_SPI_MSG_DATA_SIZE;
55
56 if (BCMCPU_IS_6358())
57 spi_pdata.fifo_size = SPI_BCM_6358_SPI_MSG_DATA_SIZE;
58
59 return platform_device_register(&bcm63xx_spi_device);
60 }
This page took 0.041085 seconds and 5 git commands to generate.