brcm63xx: add preliminary support for 3.13
[openwrt.git] / target / linux / brcm63xx / patches-3.13 / 418-MIPS-BCM63XX-pass-caldata-info-to-flash.patch
1 From 977f8a30103b9c4992cab8f49357fe0d4274004f Mon Sep 17 00:00:00 2001
2 From: Jonas Gorski <jonas.gorski@gmail.com>
3 Date: Thu, 3 May 2012 14:55:26 +0200
4 Subject: [PATCH 69/80] MIPS: BCM63XX: pass caldata info to flash
5
6 ---
7  arch/mips/bcm63xx/boards/board_bcm963xx.c              |    2 +-
8  arch/mips/bcm63xx/dev-flash.c                          |    9 ++++++++-
9  arch/mips/include/asm/mach-bcm63xx/bcm63xx_dev_flash.h |    4 +++-
10  3 files changed, 12 insertions(+), 3 deletions(-)
11
12 --- a/arch/mips/bcm63xx/boards/board_bcm963xx.c
13 +++ b/arch/mips/bcm63xx/boards/board_bcm963xx.c
14 @@ -1036,7 +1036,7 @@ int __init board_register_devices(void)
15         if (board.num_spis)
16                 spi_register_board_info(board.spis, board.num_spis);
17  
18 -       bcm63xx_flash_register();
19 +       bcm63xx_flash_register(board.has_caldata, board.caldata);
20  
21         /* count number of LEDs defined by this device */
22         while (led_count < ARRAY_SIZE(board.leds) && board.leds[led_count].name)
23 --- a/arch/mips/bcm63xx/dev-flash.c
24 +++ b/arch/mips/bcm63xx/dev-flash.c
25 @@ -35,12 +35,15 @@ static struct mtd_partition mtd_partitio
26         }
27  };
28  
29 +static struct mtd_part_parser_data bcm63xx_parser_data;
30 +
31  static const char *bcm63xx_part_types[] = { "bcm63xxpart", "RedBoot", NULL };
32  
33  static struct physmap_flash_data flash_data = {
34         .width                  = 2,
35         .parts                  = mtd_partitions,
36         .part_probe_types       = bcm63xx_part_types,
37 +       .pp_data                = &bcm63xx_parser_data,
38  };
39  
40  static struct resource mtd_resources[] = {
41 @@ -62,6 +65,7 @@ static struct platform_device mtd_dev =
42  
43  static struct flash_platform_data bcm63xx_flash_data = {
44         .part_probe_types       = bcm63xx_part_types,
45 +       .pp_data                = &bcm63xx_parser_data,
46  };
47  
48  static struct spi_board_info bcm63xx_spi_flash_info[] = {
49 @@ -189,9 +193,13 @@ void __init bcm63xx_flash_detect(void)
50         }
51  }
52  
53 -int __init bcm63xx_flash_register(void)
54 +int __init bcm63xx_flash_register(int num_caldata, struct ath9k_caldata *caldata)
55  {
56         u32 val;
57 +       unsigned int i;
58 +
59 +       for (i = 0; i < num_caldata; i++)
60 +               bcm63xx_parser_data.caldata[i] = caldata[i].caldata_offset;
61  
62         switch (flash_type) {
63         case BCM63XX_FLASH_TYPE_PARALLEL:
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 @@ -1,6 +1,8 @@
67  #ifndef __BCM63XX_FLASH_H
68  #define __BCM63XX_FLASH_H
69  
70 +#include <board_bcm963xx.h>
71 +
72  enum {
73         BCM63XX_FLASH_TYPE_PARALLEL,
74         BCM63XX_FLASH_TYPE_SERIAL,
75 @@ -9,7 +11,7 @@ enum {
76  
77  void bcm63xx_flash_detect(void);
78  
79 -int __init bcm63xx_flash_register(void);
80 +int __init bcm63xx_flash_register(int num_caldata, struct ath9k_caldata *caldata);
81  
82  int bcm63xx_flash_get_type(void);
83