diff options
author | Jonas Gorski <jogo@openwrt.org> | 2013-11-30 06:42:05 -0500 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2014-01-22 14:18:50 -0500 |
commit | 83bb90fa1bb52adc4983ddc8c34ac56f0b0fcc3c (patch) | |
tree | c2ea2a65d9fbe4d8cb3d65f44767cbb29d095d9b /arch/mips/bcm63xx | |
parent | fd034a1aaebbe3e9d2328526a56d5735a6157a8f (diff) |
MIPS: BCM63XX: add HSSPI platform device and register it
Signed-off-by: Jonas Gorski <jogo@openwrt.org>
Signed-off-by: John Crispin <blogic@openwrt.org>
Patchwork: http://patchwork.linux-mips.org/patch/6180/
Diffstat (limited to 'arch/mips/bcm63xx')
-rw-r--r-- | arch/mips/bcm63xx/Makefile | 4 | ||||
-rw-r--r-- | arch/mips/bcm63xx/boards/board_bcm963xx.c | 3 | ||||
-rw-r--r-- | arch/mips/bcm63xx/dev-hsspi.c | 47 |
3 files changed, 52 insertions, 2 deletions
diff --git a/arch/mips/bcm63xx/Makefile b/arch/mips/bcm63xx/Makefile index ac2807397c1c..9019f54aee69 100644 --- a/arch/mips/bcm63xx/Makefile +++ b/arch/mips/bcm63xx/Makefile | |||
@@ -1,7 +1,7 @@ | |||
1 | obj-y += clk.o cpu.o cs.o gpio.o irq.o nvram.o prom.o reset.o \ | 1 | obj-y += clk.o cpu.o cs.o gpio.o irq.o nvram.o prom.o reset.o \ |
2 | setup.o timer.o dev-dsp.o dev-enet.o dev-flash.o \ | 2 | setup.o timer.o dev-dsp.o dev-enet.o dev-flash.o \ |
3 | dev-pcmcia.o dev-rng.o dev-spi.o dev-uart.o dev-wdt.o \ | 3 | dev-pcmcia.o dev-rng.o dev-spi.o dev-hsspi.o dev-uart.o \ |
4 | dev-usb-usbd.o | 4 | dev-wdt.o dev-usb-usbd.o |
5 | obj-$(CONFIG_EARLY_PRINTK) += early_printk.o | 5 | obj-$(CONFIG_EARLY_PRINTK) += early_printk.o |
6 | 6 | ||
7 | obj-y += boards/ | 7 | obj-y += boards/ |
diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c index 5b974eb125fc..33727e7f0c79 100644 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <bcm63xx_dev_enet.h> | 23 | #include <bcm63xx_dev_enet.h> |
24 | #include <bcm63xx_dev_dsp.h> | 24 | #include <bcm63xx_dev_dsp.h> |
25 | #include <bcm63xx_dev_flash.h> | 25 | #include <bcm63xx_dev_flash.h> |
26 | #include <bcm63xx_dev_hsspi.h> | ||
26 | #include <bcm63xx_dev_pcmcia.h> | 27 | #include <bcm63xx_dev_pcmcia.h> |
27 | #include <bcm63xx_dev_spi.h> | 28 | #include <bcm63xx_dev_spi.h> |
28 | #include <bcm63xx_dev_usb_usbd.h> | 29 | #include <bcm63xx_dev_usb_usbd.h> |
@@ -915,6 +916,8 @@ int __init board_register_devices(void) | |||
915 | 916 | ||
916 | bcm63xx_spi_register(); | 917 | bcm63xx_spi_register(); |
917 | 918 | ||
919 | bcm63xx_hsspi_register(); | ||
920 | |||
918 | bcm63xx_flash_register(); | 921 | bcm63xx_flash_register(); |
919 | 922 | ||
920 | bcm63xx_led_data.num_leds = ARRAY_SIZE(board.leds); | 923 | bcm63xx_led_data.num_leds = ARRAY_SIZE(board.leds); |
diff --git a/arch/mips/bcm63xx/dev-hsspi.c b/arch/mips/bcm63xx/dev-hsspi.c new file mode 100644 index 000000000000..696abc48e3c8 --- /dev/null +++ b/arch/mips/bcm63xx/dev-hsspi.c | |||
@@ -0,0 +1,47 @@ | |||
1 | /* | ||
2 | * This file is subject to the terms and conditions of the GNU General Public | ||
3 | * License. See the file "COPYING" in the main directory of this archive | ||
4 | * for more details. | ||
5 | * | ||
6 | * Copyright (C) 2012 Jonas Gorski <jonas.gorski@gmail.com> | ||
7 | */ | ||
8 | |||
9 | #include <linux/init.h> | ||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/platform_device.h> | ||
12 | |||
13 | #include <bcm63xx_cpu.h> | ||
14 | #include <bcm63xx_dev_hsspi.h> | ||
15 | #include <bcm63xx_regs.h> | ||
16 | |||
17 | static struct resource spi_resources[] = { | ||
18 | { | ||
19 | .start = -1, /* filled at runtime */ | ||
20 | .end = -1, /* filled at runtime */ | ||
21 | .flags = IORESOURCE_MEM, | ||
22 | }, | ||
23 | { | ||
24 | .start = -1, /* filled at runtime */ | ||
25 | .flags = IORESOURCE_IRQ, | ||
26 | }, | ||
27 | }; | ||
28 | |||
29 | static struct platform_device bcm63xx_hsspi_device = { | ||
30 | .name = "bcm63xx-hsspi", | ||
31 | .id = 0, | ||
32 | .num_resources = ARRAY_SIZE(spi_resources), | ||
33 | .resource = spi_resources, | ||
34 | }; | ||
35 | |||
36 | int __init bcm63xx_hsspi_register(void) | ||
37 | { | ||
38 | if (!BCMCPU_IS_6328() && !BCMCPU_IS_6362()) | ||
39 | return -ENODEV; | ||
40 | |||
41 | spi_resources[0].start = bcm63xx_regset_address(RSET_HSSPI); | ||
42 | spi_resources[0].end = spi_resources[0].start; | ||
43 | spi_resources[0].end += RSET_HSSPI_SIZE - 1; | ||
44 | spi_resources[1].start = bcm63xx_get_irq_number(IRQ_HSSPI); | ||
45 | |||
46 | return platform_device_register(&bcm63xx_hsspi_device); | ||
47 | } | ||