18c2ecf20Sopenharmony_ci/* 28c2ecf20Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public 38c2ecf20Sopenharmony_ci * License. See the file "COPYING" in the main directory of this archive 48c2ecf20Sopenharmony_ci * for more details. 58c2ecf20Sopenharmony_ci * 68c2ecf20Sopenharmony_ci * Copyright (C) 2012 Jonas Gorski <jonas.gorski@gmail.com> 78c2ecf20Sopenharmony_ci */ 88c2ecf20Sopenharmony_ci 98c2ecf20Sopenharmony_ci#include <linux/init.h> 108c2ecf20Sopenharmony_ci#include <linux/kernel.h> 118c2ecf20Sopenharmony_ci#include <linux/platform_device.h> 128c2ecf20Sopenharmony_ci 138c2ecf20Sopenharmony_ci#include <bcm63xx_cpu.h> 148c2ecf20Sopenharmony_ci#include <bcm63xx_dev_hsspi.h> 158c2ecf20Sopenharmony_ci#include <bcm63xx_regs.h> 168c2ecf20Sopenharmony_ci 178c2ecf20Sopenharmony_cistatic struct resource spi_resources[] = { 188c2ecf20Sopenharmony_ci { 198c2ecf20Sopenharmony_ci .start = -1, /* filled at runtime */ 208c2ecf20Sopenharmony_ci .end = -1, /* filled at runtime */ 218c2ecf20Sopenharmony_ci .flags = IORESOURCE_MEM, 228c2ecf20Sopenharmony_ci }, 238c2ecf20Sopenharmony_ci { 248c2ecf20Sopenharmony_ci .start = -1, /* filled at runtime */ 258c2ecf20Sopenharmony_ci .flags = IORESOURCE_IRQ, 268c2ecf20Sopenharmony_ci }, 278c2ecf20Sopenharmony_ci}; 288c2ecf20Sopenharmony_ci 298c2ecf20Sopenharmony_cistatic struct platform_device bcm63xx_hsspi_device = { 308c2ecf20Sopenharmony_ci .name = "bcm63xx-hsspi", 318c2ecf20Sopenharmony_ci .id = 0, 328c2ecf20Sopenharmony_ci .num_resources = ARRAY_SIZE(spi_resources), 338c2ecf20Sopenharmony_ci .resource = spi_resources, 348c2ecf20Sopenharmony_ci}; 358c2ecf20Sopenharmony_ci 368c2ecf20Sopenharmony_ciint __init bcm63xx_hsspi_register(void) 378c2ecf20Sopenharmony_ci{ 388c2ecf20Sopenharmony_ci if (!BCMCPU_IS_6328() && !BCMCPU_IS_6362()) 398c2ecf20Sopenharmony_ci return -ENODEV; 408c2ecf20Sopenharmony_ci 418c2ecf20Sopenharmony_ci spi_resources[0].start = bcm63xx_regset_address(RSET_HSSPI); 428c2ecf20Sopenharmony_ci spi_resources[0].end = spi_resources[0].start; 438c2ecf20Sopenharmony_ci spi_resources[0].end += RSET_HSSPI_SIZE - 1; 448c2ecf20Sopenharmony_ci spi_resources[1].start = bcm63xx_get_irq_number(IRQ_HSSPI); 458c2ecf20Sopenharmony_ci 468c2ecf20Sopenharmony_ci return platform_device_register(&bcm63xx_hsspi_device); 478c2ecf20Sopenharmony_ci} 48