brcm63xx: add preliminary support for 3.13
[openwrt.git] / target / linux / brcm63xx / patches-3.13 / 344-MIPS-BCM63XX-detect-flash-type-early-and-store-the-r.patch
1 From 9a97177b907330971aa7bf41855fafc2602e1c18 Mon Sep 17 00:00:00 2001
2 From: Jonas Gorski <jogo@openwrt.org>
3 Date: Sun, 22 Dec 2013 12:26:57 +0100
4 Subject: [PATCH 51/56] MIPS: BCM63XX: detect flash type early and store the
5  result
6
7 Signed-off-by: Jonas Gorski <jogo@openwrt.org>
8 ---
9  arch/mips/bcm63xx/dev-flash.c                          | 10 +++++++---
10  arch/mips/bcm63xx/prom.c                               |  4 ++++
11  arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h |  2 ++
12  3 files changed, 13 insertions(+), 3 deletions(-)
13
14 --- a/arch/mips/bcm63xx/dev-flash.c
15 +++ b/arch/mips/bcm63xx/dev-flash.c
16 @@ -22,6 +22,8 @@
17  #include <bcm63xx_regs.h>
18  #include <bcm63xx_io.h>
19  
20 +static int flash_type;
21 +
22  static struct mtd_partition mtd_partitions[] = {
23         {
24                 .name           = "cfe",
25 @@ -108,13 +110,15 @@ static int __init bcm63xx_detect_flash_t
26         }
27  }
28  
29 +void __init bcm63xx_flash_detect(void)
30 +{
31 +       flash_type = bcm63xx_detect_flash_type();
32 +}
33 +
34  int __init bcm63xx_flash_register(void)
35  {
36 -       int flash_type;
37         u32 val;
38  
39 -       flash_type = bcm63xx_detect_flash_type();
40 -
41         switch (flash_type) {
42         case BCM63XX_FLASH_TYPE_PARALLEL:
43                 /* read base address of boot chip select (0) */
44 --- a/arch/mips/bcm63xx/prom.c
45 +++ b/arch/mips/bcm63xx/prom.c
46 @@ -18,6 +18,7 @@
47  #include <bcm63xx_io.h>
48  #include <bcm63xx_regs.h>
49  #include <bcm63xx_gpio.h>
50 +#include <bcm63xx_dev_flash.h>
51  
52  void __init prom_init(void)
53  {
54 @@ -56,6 +57,9 @@ void __init prom_init(void)
55         /* register gpiochip */
56         bcm63xx_gpio_init();
57  
58 +       /* detect and setup flash access */
59 +       bcm63xx_flash_detect();
60 +
61         /* do low level board init */
62         board_prom_init();
63  
64 --- a/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h
65 +++ b/arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h
66 @@ -7,6 +7,8 @@ enum {
67         BCM63XX_FLASH_TYPE_NAND,
68  };
69  
70 +void bcm63xx_flash_detect(void);
71 +
72  int __init bcm63xx_flash_register(void);
73  
74  #endif /* __BCM63XX_FLASH_H */