162306a36Sopenharmony_ci/* 262306a36Sopenharmony_ci * This file is subject to the terms and conditions of the GNU General Public 362306a36Sopenharmony_ci * License. See the file "COPYING" in the main directory of this archive 462306a36Sopenharmony_ci * for more details. 562306a36Sopenharmony_ci * 662306a36Sopenharmony_ci * Copyright (C) 2012 Jonas Gorski <jonas.gorski@gmail.com> 762306a36Sopenharmony_ci */ 862306a36Sopenharmony_ci 962306a36Sopenharmony_ci#include <linux/init.h> 1062306a36Sopenharmony_ci#include <linux/kernel.h> 1162306a36Sopenharmony_ci#include <linux/platform_device.h> 1262306a36Sopenharmony_ci 1362306a36Sopenharmony_ci#include <bcm63xx_cpu.h> 1462306a36Sopenharmony_ci#include <bcm63xx_dev_hsspi.h> 1562306a36Sopenharmony_ci#include <bcm63xx_regs.h> 1662306a36Sopenharmony_ci 1762306a36Sopenharmony_cistatic struct resource spi_resources[] = { 1862306a36Sopenharmony_ci { 1962306a36Sopenharmony_ci .start = -1, /* filled at runtime */ 2062306a36Sopenharmony_ci .end = -1, /* filled at runtime */ 2162306a36Sopenharmony_ci .flags = IORESOURCE_MEM, 2262306a36Sopenharmony_ci }, 2362306a36Sopenharmony_ci { 2462306a36Sopenharmony_ci .start = -1, /* filled at runtime */ 2562306a36Sopenharmony_ci .flags = IORESOURCE_IRQ, 2662306a36Sopenharmony_ci }, 2762306a36Sopenharmony_ci}; 2862306a36Sopenharmony_ci 2962306a36Sopenharmony_cistatic struct platform_device bcm63xx_hsspi_device = { 3062306a36Sopenharmony_ci .name = "bcm63xx-hsspi", 3162306a36Sopenharmony_ci .id = 0, 3262306a36Sopenharmony_ci .num_resources = ARRAY_SIZE(spi_resources), 3362306a36Sopenharmony_ci .resource = spi_resources, 3462306a36Sopenharmony_ci}; 3562306a36Sopenharmony_ci 3662306a36Sopenharmony_ciint __init bcm63xx_hsspi_register(void) 3762306a36Sopenharmony_ci{ 3862306a36Sopenharmony_ci if (!BCMCPU_IS_6328() && !BCMCPU_IS_6362()) 3962306a36Sopenharmony_ci return -ENODEV; 4062306a36Sopenharmony_ci 4162306a36Sopenharmony_ci spi_resources[0].start = bcm63xx_regset_address(RSET_HSSPI); 4262306a36Sopenharmony_ci spi_resources[0].end = spi_resources[0].start; 4362306a36Sopenharmony_ci spi_resources[0].end += RSET_HSSPI_SIZE - 1; 4462306a36Sopenharmony_ci spi_resources[1].start = bcm63xx_get_irq_number(IRQ_HSSPI); 4562306a36Sopenharmony_ci 4662306a36Sopenharmony_ci return platform_device_register(&bcm63xx_hsspi_device); 4762306a36Sopenharmony_ci} 48