diff options
author | Jonas Gorski <jonas.gorski@gmail.com> | 2012-07-24 10:33:11 -0400 |
---|---|---|
committer | Ralf Baechle <ralf@linux-mips.org> | 2012-07-24 10:33:11 -0400 |
commit | 4b897d5483da5c3f3c4d52440a994aad574b62b4 (patch) | |
tree | 1c3b344446d98cf2d774bb58c3f2156f0a2d0bea /arch/mips | |
parent | 553072b27e0990ab1d73d43efb4ab518f953fcc3 (diff) |
MIPS: BCM63XX: Move flash registration out of board_bcm963xx.c
board_bcm963xx.c is already large enough.
Signed-off-by: Jonas Gorski <jonas.gorski@gmail.com>
Cc: linux-mips@linux-mips.org
Cc: Maxime Bizon <mbizon@freebox.fr>
Cc: Florian Fainelli <florian@openwrt.org>
Cc: Kevin Cernekee <cernekee@gmail.com>
Patchwork: https://patchwork.linux-mips.org/patch/3952/
Reviewed-by: Florian Fainelli <florian@openwrt.org>
Signed-off-by: Ralf Baechle <ralf@linux-mips.org>
Diffstat (limited to 'arch/mips')
-rw-r--r-- | arch/mips/bcm63xx/Makefile | 4 | ||||
-rw-r--r-- | arch/mips/bcm63xx/boards/board_bcm963xx.c | 49 | ||||
-rw-r--r-- | arch/mips/bcm63xx/dev-flash.c | 69 | ||||
-rw-r--r-- | arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h | 6 |
4 files changed, 79 insertions, 49 deletions
diff --git a/arch/mips/bcm63xx/Makefile b/arch/mips/bcm63xx/Makefile index 349b2061d2ec..833af72c852a 100644 --- a/arch/mips/bcm63xx/Makefile +++ b/arch/mips/bcm63xx/Makefile | |||
@@ -1,6 +1,6 @@ | |||
1 | obj-y += clk.o cpu.o cs.o gpio.o irq.o prom.o setup.o timer.o \ | 1 | obj-y += clk.o cpu.o cs.o gpio.o irq.o prom.o setup.o timer.o \ |
2 | dev-dsp.o dev-enet.o dev-pcmcia.o dev-rng.o dev-spi.o \ | 2 | dev-dsp.o dev-enet.o dev-flash.o dev-pcmcia.o dev-rng.o \ |
3 | dev-uart.o dev-wdt.o | 3 | dev-spi.o dev-uart.o dev-wdt.o |
4 | obj-$(CONFIG_EARLY_PRINTK) += early_printk.o | 4 | obj-$(CONFIG_EARLY_PRINTK) += early_printk.o |
5 | 5 | ||
6 | obj-y += boards/ | 6 | obj-y += boards/ |
diff --git a/arch/mips/bcm63xx/boards/board_bcm963xx.c b/arch/mips/bcm63xx/boards/board_bcm963xx.c index ea65c0f0903c..bdfbdf95f000 100644 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c | |||
@@ -11,9 +11,6 @@ | |||
11 | #include <linux/kernel.h> | 11 | #include <linux/kernel.h> |
12 | #include <linux/string.h> | 12 | #include <linux/string.h> |
13 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
14 | #include <linux/mtd/mtd.h> | ||
15 | #include <linux/mtd/partitions.h> | ||
16 | #include <linux/mtd/physmap.h> | ||
17 | #include <linux/ssb/ssb.h> | 14 | #include <linux/ssb/ssb.h> |
18 | #include <asm/addrspace.h> | 15 | #include <asm/addrspace.h> |
19 | #include <bcm63xx_board.h> | 16 | #include <bcm63xx_board.h> |
@@ -24,6 +21,7 @@ | |||
24 | #include <bcm63xx_dev_pci.h> | 21 | #include <bcm63xx_dev_pci.h> |
25 | #include <bcm63xx_dev_enet.h> | 22 | #include <bcm63xx_dev_enet.h> |
26 | #include <bcm63xx_dev_dsp.h> | 23 | #include <bcm63xx_dev_dsp.h> |
24 | #include <bcm63xx_dev_flash.h> | ||
27 | #include <bcm63xx_dev_pcmcia.h> | 25 | #include <bcm63xx_dev_pcmcia.h> |
28 | #include <bcm63xx_dev_spi.h> | 26 | #include <bcm63xx_dev_spi.h> |
29 | #include <board_bcm963xx.h> | 27 | #include <board_bcm963xx.h> |
@@ -809,40 +807,6 @@ void __init board_setup(void) | |||
809 | panic("unexpected CPU for bcm963xx board"); | 807 | panic("unexpected CPU for bcm963xx board"); |
810 | } | 808 | } |
811 | 809 | ||
812 | static struct mtd_partition mtd_partitions[] = { | ||
813 | { | ||
814 | .name = "cfe", | ||
815 | .offset = 0x0, | ||
816 | .size = 0x40000, | ||
817 | } | ||
818 | }; | ||
819 | |||
820 | static const char *bcm63xx_part_types[] = { "bcm63xxpart", NULL }; | ||
821 | |||
822 | static struct physmap_flash_data flash_data = { | ||
823 | .width = 2, | ||
824 | .nr_parts = ARRAY_SIZE(mtd_partitions), | ||
825 | .parts = mtd_partitions, | ||
826 | .part_probe_types = bcm63xx_part_types, | ||
827 | }; | ||
828 | |||
829 | static struct resource mtd_resources[] = { | ||
830 | { | ||
831 | .start = 0, /* filled at runtime */ | ||
832 | .end = 0, /* filled at runtime */ | ||
833 | .flags = IORESOURCE_MEM, | ||
834 | } | ||
835 | }; | ||
836 | |||
837 | static struct platform_device mtd_dev = { | ||
838 | .name = "physmap-flash", | ||
839 | .resource = mtd_resources, | ||
840 | .num_resources = ARRAY_SIZE(mtd_resources), | ||
841 | .dev = { | ||
842 | .platform_data = &flash_data, | ||
843 | }, | ||
844 | }; | ||
845 | |||
846 | static struct gpio_led_platform_data bcm63xx_led_data; | 810 | static struct gpio_led_platform_data bcm63xx_led_data; |
847 | 811 | ||
848 | static struct platform_device bcm63xx_gpio_leds = { | 812 | static struct platform_device bcm63xx_gpio_leds = { |
@@ -856,8 +820,6 @@ static struct platform_device bcm63xx_gpio_leds = { | |||
856 | */ | 820 | */ |
857 | int __init board_register_devices(void) | 821 | int __init board_register_devices(void) |
858 | { | 822 | { |
859 | u32 val; | ||
860 | |||
861 | if (board.has_uart0) | 823 | if (board.has_uart0) |
862 | bcm63xx_uart_register(0); | 824 | bcm63xx_uart_register(0); |
863 | 825 | ||
@@ -893,14 +855,7 @@ int __init board_register_devices(void) | |||
893 | 855 | ||
894 | bcm63xx_spi_register(); | 856 | bcm63xx_spi_register(); |
895 | 857 | ||
896 | /* read base address of boot chip select (0) */ | 858 | bcm63xx_flash_register(); |
897 | val = bcm_mpi_readl(MPI_CSBASE_REG(0)); | ||
898 | val &= MPI_CSBASE_BASE_MASK; | ||
899 | |||
900 | mtd_resources[0].start = val; | ||
901 | mtd_resources[0].end = 0x1FFFFFFF; | ||
902 | |||
903 | platform_device_register(&mtd_dev); | ||
904 | 859 | ||
905 | bcm63xx_led_data.num_leds = ARRAY_SIZE(board.leds); | 860 | bcm63xx_led_data.num_leds = ARRAY_SIZE(board.leds); |
906 | bcm63xx_led_data.leds = board.leds; | 861 | bcm63xx_led_data.leds = board.leds; |
diff --git a/arch/mips/bcm63xx/dev-flash.c b/arch/mips/bcm63xx/dev-flash.c new file mode 100644 index 000000000000..af5273868baa --- /dev/null +++ b/arch/mips/bcm63xx/dev-flash.c | |||
@@ -0,0 +1,69 @@ | |||
1 | /* | ||
2 | * Broadcom BCM63xx flash registration | ||
3 | * | ||
4 | * This file is subject to the terms and conditions of the GNU General Public | ||
5 | * License. See the file "COPYING" in the main directory of this archive | ||
6 | * for more details. | ||
7 | * | ||
8 | * Copyright (C) 2008 Maxime Bizon <mbizon@freebox.fr> | ||
9 | * Copyright (C) 2008 Florian Fainelli <florian@openwrt.org> | ||
10 | */ | ||
11 | |||
12 | #include <linux/init.h> | ||
13 | #include <linux/kernel.h> | ||
14 | #include <linux/platform_device.h> | ||
15 | #include <linux/mtd/mtd.h> | ||
16 | #include <linux/mtd/partitions.h> | ||
17 | #include <linux/mtd/physmap.h> | ||
18 | |||
19 | #include <bcm63xx_cpu.h> | ||
20 | #include <bcm63xx_dev_flash.h> | ||
21 | #include <bcm63xx_regs.h> | ||
22 | #include <bcm63xx_io.h> | ||
23 | |||
24 | static struct mtd_partition mtd_partitions[] = { | ||
25 | { | ||
26 | .name = "cfe", | ||
27 | .offset = 0x0, | ||
28 | .size = 0x40000, | ||
29 | } | ||
30 | }; | ||
31 | |||
32 | static const char *bcm63xx_part_types[] = { "bcm63xxpart", NULL }; | ||
33 | |||
34 | static struct physmap_flash_data flash_data = { | ||
35 | .width = 2, | ||
36 | .parts = mtd_partitions, | ||
37 | .part_probe_types = bcm63xx_part_types, | ||
38 | }; | ||
39 | |||
40 | static struct resource mtd_resources[] = { | ||
41 | { | ||
42 | .start = 0, /* filled at runtime */ | ||
43 | .end = 0, /* filled at runtime */ | ||
44 | .flags = IORESOURCE_MEM, | ||
45 | } | ||
46 | }; | ||
47 | |||
48 | static struct platform_device mtd_dev = { | ||
49 | .name = "physmap-flash", | ||
50 | .resource = mtd_resources, | ||
51 | .num_resources = ARRAY_SIZE(mtd_resources), | ||
52 | .dev = { | ||
53 | .platform_data = &flash_data, | ||
54 | }, | ||
55 | }; | ||
56 | |||
57 | int __init bcm63xx_flash_register(void) | ||
58 | { | ||
59 | u32 val; | ||
60 | |||
61 | /* read base address of boot chip select (0) */ | ||
62 | val = bcm_mpi_readl(MPI_CSBASE_REG(0)); | ||
63 | val &= MPI_CSBASE_BASE_MASK; | ||
64 | |||
65 | mtd_resources[0].start = val; | ||
66 | mtd_resources[0].end = 0x1FFFFFFF; | ||
67 | |||
68 | return platform_device_register(&mtd_dev); | ||
69 | } | ||
diff --git a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h new file mode 100644 index 000000000000..8dcb54108c45 --- /dev/null +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h | |||
@@ -0,0 +1,6 @@ | |||
1 | #ifndef __BCM63XX_FLASH_H | ||
2 | #define __BCM63XX_FLASH_H | ||
3 | |||
4 | int __init bcm63xx_flash_register(void); | ||
5 | |||
6 | #endif /* __BCM63XX_FLASH_H */ | ||