Back to home page

OSCL-LXR

 
 

    


0001 /*
0002  * This file is subject to the terms and conditions of the GNU General Public
0003  * License.  See the file "COPYING" in the main directory of this archive
0004  * for more details.
0005  *
0006  * Copyright (C) 2012 Jonas Gorski <jonas.gorski@gmail.com>
0007  */
0008 
0009 #include <linux/init.h>
0010 #include <linux/kernel.h>
0011 #include <linux/platform_device.h>
0012 
0013 #include <bcm63xx_cpu.h>
0014 #include <bcm63xx_dev_hsspi.h>
0015 #include <bcm63xx_regs.h>
0016 
0017 static struct resource spi_resources[] = {
0018     {
0019         .start      = -1, /* filled at runtime */
0020         .end        = -1, /* filled at runtime */
0021         .flags      = IORESOURCE_MEM,
0022     },
0023     {
0024         .start      = -1, /* filled at runtime */
0025         .flags      = IORESOURCE_IRQ,
0026     },
0027 };
0028 
0029 static struct platform_device bcm63xx_hsspi_device = {
0030     .name       = "bcm63xx-hsspi",
0031     .id     = 0,
0032     .num_resources  = ARRAY_SIZE(spi_resources),
0033     .resource   = spi_resources,
0034 };
0035 
0036 int __init bcm63xx_hsspi_register(void)
0037 {
0038     if (!BCMCPU_IS_6328() && !BCMCPU_IS_6362())
0039         return -ENODEV;
0040 
0041     spi_resources[0].start = bcm63xx_regset_address(RSET_HSSPI);
0042     spi_resources[0].end = spi_resources[0].start;
0043     spi_resources[0].end += RSET_HSSPI_SIZE - 1;
0044     spi_resources[1].start = bcm63xx_get_irq_number(IRQ_HSSPI);
0045 
0046     return platform_device_register(&bcm63xx_hsspi_device);
0047 }