1 From ad04c99347cf9e583457f7258e97f0be22fad2ec Mon Sep 17 00:00:00 2001
2 From: Jonas Gorski <jogo@openwrt.org>
3 Date: Sat, 12 Nov 2011 12:18:26 +0100
4 Subject: [PATCH 4/5] MIPS: BCM63XX: add HSSPI platform device and register it
6 Signed-off-by: Jonas Gorski <jogo@openwrt.org>
8 arch/mips/bcm63xx/Makefile | 4 +-
9 arch/mips/bcm63xx/boards/board_bcm963xx.c | 3 ++
10 arch/mips/bcm63xx/dev-hsspi.c | 47 ++++++++++++++++++++++
11 .../include/asm/mach-bcm63xx/bcm63xx_dev_hsspi.h | 8 ++++
12 4 files changed, 60 insertions(+), 2 deletions(-)
13 create mode 100644 arch/mips/bcm63xx/dev-hsspi.c
14 create mode 100644 arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_hsspi.h
16 --- a/arch/mips/bcm63xx/Makefile
17 +++ b/arch/mips/bcm63xx/Makefile
19 obj-y += clk.o cpu.o cs.o gpio.o irq.o nvram.o prom.o reset.o \
20 setup.o timer.o dev-dsp.o dev-enet.o dev-flash.o \
21 - dev-pcmcia.o dev-rng.o dev-spi.o dev-uart.o dev-wdt.o \
23 + dev-pcmcia.o dev-rng.o dev-spi.o dev-hsspi.o dev-uart.o \
24 + dev-wdt.o dev-usb-usbd.o
25 obj-$(CONFIG_EARLY_PRINTK) += early_printk.o
28 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
29 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
31 #include <bcm63xx_dev_enet.h>
32 #include <bcm63xx_dev_dsp.h>
33 #include <bcm63xx_dev_flash.h>
34 +#include <bcm63xx_dev_hsspi.h>
35 #include <bcm63xx_dev_pcmcia.h>
36 #include <bcm63xx_dev_spi.h>
37 #include <bcm63xx_dev_usb_usbd.h>
38 @@ -915,6 +916,8 @@ int __init board_register_devices(void)
40 bcm63xx_spi_register();
42 + bcm63xx_hsspi_register();
44 bcm63xx_flash_register();
46 bcm63xx_led_data.num_leds = ARRAY_SIZE(board.leds);
48 +++ b/arch/mips/bcm63xx/dev-hsspi.c
51 + * This file is subject to the terms and conditions of the GNU General Public
52 + * License. See the file "COPYING" in the main directory of this archive
55 + * Copyright (C) 2012 Jonas Gorski <jonas.gorski@gmail.com>
58 +#include <linux/init.h>
59 +#include <linux/kernel.h>
60 +#include <linux/platform_device.h>
62 +#include <bcm63xx_cpu.h>
63 +#include <bcm63xx_dev_hsspi.h>
64 +#include <bcm63xx_regs.h>
66 +static struct resource spi_resources[] = {
68 + .start = -1, /* filled at runtime */
69 + .end = -1, /* filled at runtime */
70 + .flags = IORESOURCE_MEM,
73 + .start = -1, /* filled at runtime */
74 + .flags = IORESOURCE_IRQ,
78 +static struct platform_device bcm63xx_hsspi_device = {
79 + .name = "bcm63xx-hsspi",
81 + .num_resources = ARRAY_SIZE(spi_resources),
82 + .resource = spi_resources,
85 +int __init bcm63xx_hsspi_register(void)
87 + if (!BCMCPU_IS_6328() && !BCMCPU_IS_6362())
90 + spi_resources[0].start = bcm63xx_regset_address(RSET_HSSPI);
91 + spi_resources[0].end = spi_resources[0].start;
92 + spi_resources[0].end += RSET_HSSPI_SIZE - 1;
93 + spi_resources[1].start = bcm63xx_get_irq_number(IRQ_HSSPI);
95 + return platform_device_register(&bcm63xx_hsspi_device);
98 +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_hsspi.h
100 +#ifndef BCM63XX_DEV_HSSPI_H
101 +#define BCM63XX_DEV_HSSPI_H
103 +#include <linux/types.h>
105 +int bcm63xx_hsspi_register(void);
107 +#endif /* BCM63XX_DEV_HSSPI_H */