diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-24 15:50:56 -0500 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-01-24 15:50:56 -0500 |
commit | e2464688b59c6ae9928f385dabf5355e30cff298 (patch) | |
tree | 1039fa8c818e6ac16d6f1504c28e80bfe902b0f3 /include | |
parent | e1c10879ed59436cde537b723545430b04d4dec0 (diff) | |
parent | 07d17f09691e549fac0101333eebe0161a472b50 (diff) |
Merge branch 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus
Pull MIPS updates from Ralf Baechle:
"This is the main pull request for MIPS for 4.5 plus some 4.4 fixes.
The executive summary:
- ATH79 platform improvments, use DT bindings for the ATH79 USB PHY.
- Avoid useless rebuilds for zboot.
- jz4780: Add NEMC, BCH and NAND device tree nodes
- Initial support for the MicroChip's DT platform. As all the device
drivers are missing this is still of limited use.
- Some Loongson3 cleanups.
- The unavoidable whitespace polishing.
- Reduce clock skew when synchronizing the CPU cycle counters on CPU
startup.
- Add MIPS R6 fixes.
- Lots of cleanups across arch/mips as fallout from KVM.
- Lots of minor fixes and changes for IEEE 754-2008 support to the
FPU emulator / fp-assist software.
- Minor Ralink, BCM47xx and bcm963xx platform support improvments.
- Support SMP on BCM63168"
* 'upstream' of git://git.linux-mips.org/pub/scm/ralf/upstream-linus: (84 commits)
MIPS: zboot: Add support for serial debug using the PROM
MIPS: zboot: Avoid useless rebuilds
MIPS: BMIPS: Enable ARCH_WANT_OPTIONAL_GPIOLIB
MIPS: bcm63xx: nvram: Remove unused bcm63xx_nvram_get_psi_size() function
MIPS: bcm963xx: Update bcm_tag field image_sequence
MIPS: bcm963xx: Move extended flash address to bcm_tag header file
MIPS: bcm963xx: Move Broadcom BCM963xx image tag data structure
MIPS: bcm63xx: nvram: Use nvram structure definition from header file
MIPS: bcm963xx: Add Broadcom BCM963xx board nvram data structure
MAINTAINERS: Add KVM for MIPS entry
MIPS: KVM: Add missing newline to kvm_err()
MIPS: Move KVM specific opcodes into asm/inst.h
MIPS: KVM: Use cacheops.h definitions
MIPS: Break down cacheops.h definitions
MIPS: Use EXCCODE_ constants with set_except_vector()
MIPS: Update trap codes
MIPS: Move Cause.ExcCode trap codes to mipsregs.h
MIPS: KVM: Make kvm_mips_{init,exit}() static
MIPS: KVM: Refactor added offsetof()s
MIPS: KVM: Convert EXPORT_SYMBOL to _GPL
...
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/bcm963xx_nvram.h | 112 | ||||
-rw-r--r-- | include/linux/bcm963xx_tag.h | 102 | ||||
-rw-r--r-- | include/linux/platform_data/sdhci-pic32.h | 22 |
3 files changed, 236 insertions, 0 deletions
diff --git a/include/linux/bcm963xx_nvram.h b/include/linux/bcm963xx_nvram.h new file mode 100644 index 000000000000..290c231b8cf1 --- /dev/null +++ b/include/linux/bcm963xx_nvram.h | |||
@@ -0,0 +1,112 @@ | |||
1 | #ifndef __LINUX_BCM963XX_NVRAM_H__ | ||
2 | #define __LINUX_BCM963XX_NVRAM_H__ | ||
3 | |||
4 | #include <linux/crc32.h> | ||
5 | #include <linux/if_ether.h> | ||
6 | #include <linux/sizes.h> | ||
7 | #include <linux/types.h> | ||
8 | |||
9 | /* | ||
10 | * Broadcom BCM963xx SoC board nvram data structure. | ||
11 | * | ||
12 | * The nvram structure varies in size depending on the SoC board version. Use | ||
13 | * the appropriate minimum BCM963XX_NVRAM_*_SIZE define for the information | ||
14 | * you need instead of sizeof(struct bcm963xx_nvram) as this may change. | ||
15 | */ | ||
16 | |||
17 | #define BCM963XX_NVRAM_V4_SIZE 300 | ||
18 | #define BCM963XX_NVRAM_V5_SIZE (1 * SZ_1K) | ||
19 | |||
20 | #define BCM963XX_DEFAULT_PSI_SIZE 64 | ||
21 | |||
22 | enum bcm963xx_nvram_nand_part { | ||
23 | BCM963XX_NVRAM_NAND_PART_BOOT = 0, | ||
24 | BCM963XX_NVRAM_NAND_PART_ROOTFS_1, | ||
25 | BCM963XX_NVRAM_NAND_PART_ROOTFS_2, | ||
26 | BCM963XX_NVRAM_NAND_PART_DATA, | ||
27 | BCM963XX_NVRAM_NAND_PART_BBT, | ||
28 | |||
29 | __BCM963XX_NVRAM_NAND_NR_PARTS | ||
30 | }; | ||
31 | |||
32 | struct bcm963xx_nvram { | ||
33 | u32 version; | ||
34 | char bootline[256]; | ||
35 | char name[16]; | ||
36 | u32 main_tp_number; | ||
37 | u32 psi_size; | ||
38 | u32 mac_addr_count; | ||
39 | u8 mac_addr_base[ETH_ALEN]; | ||
40 | u8 __reserved1[2]; | ||
41 | u32 checksum_v4; | ||
42 | |||
43 | u8 __reserved2[292]; | ||
44 | u32 nand_part_offset[__BCM963XX_NVRAM_NAND_NR_PARTS]; | ||
45 | u32 nand_part_size[__BCM963XX_NVRAM_NAND_NR_PARTS]; | ||
46 | u8 __reserved3[388]; | ||
47 | u32 checksum_v5; | ||
48 | }; | ||
49 | |||
50 | #define BCM963XX_NVRAM_NAND_PART_OFFSET(nvram, part) \ | ||
51 | bcm963xx_nvram_nand_part_offset(nvram, BCM963XX_NVRAM_NAND_PART_ ##part) | ||
52 | |||
53 | static inline u64 __pure bcm963xx_nvram_nand_part_offset( | ||
54 | const struct bcm963xx_nvram *nvram, | ||
55 | enum bcm963xx_nvram_nand_part part) | ||
56 | { | ||
57 | return nvram->nand_part_offset[part] * SZ_1K; | ||
58 | } | ||
59 | |||
60 | #define BCM963XX_NVRAM_NAND_PART_SIZE(nvram, part) \ | ||
61 | bcm963xx_nvram_nand_part_size(nvram, BCM963XX_NVRAM_NAND_PART_ ##part) | ||
62 | |||
63 | static inline u64 __pure bcm963xx_nvram_nand_part_size( | ||
64 | const struct bcm963xx_nvram *nvram, | ||
65 | enum bcm963xx_nvram_nand_part part) | ||
66 | { | ||
67 | return nvram->nand_part_size[part] * SZ_1K; | ||
68 | } | ||
69 | |||
70 | /* | ||
71 | * bcm963xx_nvram_checksum - Verify nvram checksum | ||
72 | * | ||
73 | * @nvram: pointer to full size nvram data structure | ||
74 | * @expected_out: optional pointer to store expected checksum value | ||
75 | * @actual_out: optional pointer to store actual checksum value | ||
76 | * | ||
77 | * Return: 0 if the checksum is valid, otherwise -EINVAL | ||
78 | */ | ||
79 | static int __maybe_unused bcm963xx_nvram_checksum( | ||
80 | const struct bcm963xx_nvram *nvram, | ||
81 | u32 *expected_out, u32 *actual_out) | ||
82 | { | ||
83 | u32 expected, actual; | ||
84 | size_t len; | ||
85 | |||
86 | if (nvram->version <= 4) { | ||
87 | expected = nvram->checksum_v4; | ||
88 | len = BCM963XX_NVRAM_V4_SIZE - sizeof(u32); | ||
89 | } else { | ||
90 | expected = nvram->checksum_v5; | ||
91 | len = BCM963XX_NVRAM_V5_SIZE - sizeof(u32); | ||
92 | } | ||
93 | |||
94 | /* | ||
95 | * Calculate the CRC32 value for the nvram with a checksum value | ||
96 | * of 0 without modifying or copying the nvram by combining: | ||
97 | * - The CRC32 of the nvram without the checksum value | ||
98 | * - The CRC32 of a zero checksum value (which is also 0) | ||
99 | */ | ||
100 | actual = crc32_le_combine( | ||
101 | crc32_le(~0, (u8 *)nvram, len), 0, sizeof(u32)); | ||
102 | |||
103 | if (expected_out) | ||
104 | *expected_out = expected; | ||
105 | |||
106 | if (actual_out) | ||
107 | *actual_out = actual; | ||
108 | |||
109 | return expected == actual ? 0 : -EINVAL; | ||
110 | }; | ||
111 | |||
112 | #endif /* __LINUX_BCM963XX_NVRAM_H__ */ | ||
diff --git a/include/linux/bcm963xx_tag.h b/include/linux/bcm963xx_tag.h new file mode 100644 index 000000000000..161c7b37a77b --- /dev/null +++ b/include/linux/bcm963xx_tag.h | |||
@@ -0,0 +1,102 @@ | |||
1 | #ifndef __LINUX_BCM963XX_TAG_H__ | ||
2 | #define __LINUX_BCM963XX_TAG_H__ | ||
3 | |||
4 | #include <linux/types.h> | ||
5 | |||
6 | #define TAGVER_LEN 4 /* Length of Tag Version */ | ||
7 | #define TAGLAYOUT_LEN 4 /* Length of FlashLayoutVer */ | ||
8 | #define SIG1_LEN 20 /* Company Signature 1 Length */ | ||
9 | #define SIG2_LEN 14 /* Company Signature 2 Length */ | ||
10 | #define BOARDID_LEN 16 /* Length of BoardId */ | ||
11 | #define ENDIANFLAG_LEN 2 /* Endian Flag Length */ | ||
12 | #define CHIPID_LEN 6 /* Chip Id Length */ | ||
13 | #define IMAGE_LEN 10 /* Length of Length Field */ | ||
14 | #define ADDRESS_LEN 12 /* Length of Address field */ | ||
15 | #define IMAGE_SEQUENCE_LEN 4 /* Image sequence Length */ | ||
16 | #define RSASIG_LEN 20 /* Length of RSA Signature in tag */ | ||
17 | #define TAGINFO1_LEN 30 /* Length of vendor information field1 in tag */ | ||
18 | #define FLASHLAYOUTVER_LEN 4 /* Length of Flash Layout Version String tag */ | ||
19 | #define TAGINFO2_LEN 16 /* Length of vendor information field2 in tag */ | ||
20 | #define ALTTAGINFO_LEN 54 /* Alternate length for vendor information; Pirelli */ | ||
21 | |||
22 | #define NUM_PIRELLI 2 | ||
23 | #define IMAGETAG_CRC_START 0xFFFFFFFF | ||
24 | |||
25 | #define PIRELLI_BOARDS { \ | ||
26 | "AGPF-S0", \ | ||
27 | "DWV-S0", \ | ||
28 | } | ||
29 | |||
30 | /* Extended flash address, needs to be subtracted | ||
31 | * from bcm_tag flash image offsets. | ||
32 | */ | ||
33 | #define BCM963XX_EXTENDED_SIZE 0xBFC00000 | ||
34 | |||
35 | /* | ||
36 | * The broadcom firmware assumes the rootfs starts the image, | ||
37 | * therefore uses the rootfs start (flash_image_address) | ||
38 | * to determine where to flash the image. Since we have the kernel first | ||
39 | * we have to give it the kernel address, but the crc uses the length | ||
40 | * associated with this address (root_length), which is added to the kernel | ||
41 | * length (kernel_length) to determine the length of image to flash and thus | ||
42 | * needs to be rootfs + deadcode (jffs2 EOF marker) | ||
43 | */ | ||
44 | |||
45 | struct bcm_tag { | ||
46 | /* 0-3: Version of the image tag */ | ||
47 | char tag_version[TAGVER_LEN]; | ||
48 | /* 4-23: Company Line 1 */ | ||
49 | char sig_1[SIG1_LEN]; | ||
50 | /* 24-37: Company Line 2 */ | ||
51 | char sig_2[SIG2_LEN]; | ||
52 | /* 38-43: Chip this image is for */ | ||
53 | char chip_id[CHIPID_LEN]; | ||
54 | /* 44-59: Board name */ | ||
55 | char board_id[BOARDID_LEN]; | ||
56 | /* 60-61: Map endianness -- 1 BE 0 LE */ | ||
57 | char big_endian[ENDIANFLAG_LEN]; | ||
58 | /* 62-71: Total length of image */ | ||
59 | char total_length[IMAGE_LEN]; | ||
60 | /* 72-83: Address in memory of CFE */ | ||
61 | char cfe__address[ADDRESS_LEN]; | ||
62 | /* 84-93: Size of CFE */ | ||
63 | char cfe_length[IMAGE_LEN]; | ||
64 | /* 94-105: Address in memory of image start | ||
65 | * (kernel for OpenWRT, rootfs for stock firmware) | ||
66 | */ | ||
67 | char flash_image_start[ADDRESS_LEN]; | ||
68 | /* 106-115: Size of rootfs */ | ||
69 | char root_length[IMAGE_LEN]; | ||
70 | /* 116-127: Address in memory of kernel */ | ||
71 | char kernel_address[ADDRESS_LEN]; | ||
72 | /* 128-137: Size of kernel */ | ||
73 | char kernel_length[IMAGE_LEN]; | ||
74 | /* 138-141: Image sequence number | ||
75 | * (to be incremented when flashed with a new image) | ||
76 | */ | ||
77 | char image_sequence[IMAGE_SEQUENCE_LEN]; | ||
78 | /* 142-161: RSA Signature (not used; some vendors may use this) */ | ||
79 | char rsa_signature[RSASIG_LEN]; | ||
80 | /* 162-191: Compilation and related information (not used in OpenWrt) */ | ||
81 | char information1[TAGINFO1_LEN]; | ||
82 | /* 192-195: Version flash layout */ | ||
83 | char flash_layout_ver[FLASHLAYOUTVER_LEN]; | ||
84 | /* 196-199: kernel+rootfs CRC32 */ | ||
85 | __u32 fskernel_crc; | ||
86 | /* 200-215: Unused except on Alice Gate where is is information */ | ||
87 | char information2[TAGINFO2_LEN]; | ||
88 | /* 216-219: CRC32 of image less imagetag (kernel for Alice Gate) */ | ||
89 | __u32 image_crc; | ||
90 | /* 220-223: CRC32 of rootfs partition */ | ||
91 | __u32 rootfs_crc; | ||
92 | /* 224-227: CRC32 of kernel partition */ | ||
93 | __u32 kernel_crc; | ||
94 | /* 228-235: Unused at present */ | ||
95 | char reserved1[8]; | ||
96 | /* 236-239: CRC32 of header excluding last 20 bytes */ | ||
97 | __u32 header_crc; | ||
98 | /* 240-255: Unused at present */ | ||
99 | char reserved2[16]; | ||
100 | }; | ||
101 | |||
102 | #endif /* __LINUX_BCM63XX_TAG_H__ */ | ||
diff --git a/include/linux/platform_data/sdhci-pic32.h b/include/linux/platform_data/sdhci-pic32.h new file mode 100644 index 000000000000..7e0efe64c8c5 --- /dev/null +++ b/include/linux/platform_data/sdhci-pic32.h | |||
@@ -0,0 +1,22 @@ | |||
1 | /* | ||
2 | * Purna Chandra Mandal, purna.mandal@microchip.com | ||
3 | * Copyright (C) 2015 Microchip Technology Inc. All rights reserved. | ||
4 | * | ||
5 | * This program is free software; you can distribute it and/or modify it | ||
6 | * under the terms of the GNU General Public License (Version 2) as | ||
7 | * published by the Free Software Foundation. | ||
8 | * | ||
9 | * This program is distributed in the hope it will be useful, but WITHOUT | ||
10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
12 | * for more details. | ||
13 | */ | ||
14 | #ifndef __PIC32_SDHCI_PDATA_H__ | ||
15 | #define __PIC32_SDHCI_PDATA_H__ | ||
16 | |||
17 | struct pic32_sdhci_platform_data { | ||
18 | /* read & write fifo threshold */ | ||
19 | int (*setup_dma)(u32 rfifo, u32 wfifo); | ||
20 | }; | ||
21 | |||
22 | #endif | ||