0001
0002
0003
0004
0005
0006
0007
0008
0009
0010 #include <linux/init.h>
0011 #include <linux/kernel.h>
0012 #include <linux/export.h>
0013 #include <linux/platform_device.h>
0014 #include <linux/err.h>
0015 #include <linux/clk.h>
0016
0017 #include <bcm63xx_cpu.h>
0018 #include <bcm63xx_dev_spi.h>
0019 #include <bcm63xx_regs.h>
0020
0021 static struct resource spi_resources[] = {
0022 {
0023 .start = -1,
0024 .end = -1,
0025 .flags = IORESOURCE_MEM,
0026 },
0027 {
0028 .start = -1,
0029 .flags = IORESOURCE_IRQ,
0030 },
0031 };
0032
0033 static struct platform_device bcm63xx_spi_device = {
0034 .id = -1,
0035 .num_resources = ARRAY_SIZE(spi_resources),
0036 .resource = spi_resources,
0037 };
0038
0039 int __init bcm63xx_spi_register(void)
0040 {
0041 if (BCMCPU_IS_6328() || BCMCPU_IS_6345())
0042 return -ENODEV;
0043
0044 spi_resources[0].start = bcm63xx_regset_address(RSET_SPI);
0045 spi_resources[0].end = spi_resources[0].start;
0046 spi_resources[1].start = bcm63xx_get_irq_number(IRQ_SPI);
0047
0048 if (BCMCPU_IS_6338() || BCMCPU_IS_6348()) {
0049 bcm63xx_spi_device.name = "bcm6348-spi",
0050 spi_resources[0].end += BCM_6348_RSET_SPI_SIZE - 1;
0051 }
0052
0053 if (BCMCPU_IS_3368() || BCMCPU_IS_6358() || BCMCPU_IS_6362() ||
0054 BCMCPU_IS_6368()) {
0055 bcm63xx_spi_device.name = "bcm6358-spi",
0056 spi_resources[0].end += BCM_6358_RSET_SPI_SIZE - 1;
0057 }
0058
0059 return platform_device_register(&bcm63xx_spi_device);
0060 }