History

MIPS: copy pic32.h header file from asm/mach-pic32/ to include/platform-data/

There are currently some pic32 MIPS drivers that are in tree, and are only configured to be compiled on the pic32 platform. There's a risk of breaking some of these drivers when migrating drivers away from legacy APIs. It happened to me with a pic32 clk driver. Let's go ahead and copy the MIPS pic32.h header to include/linux/platform_data/, and make a minor update to allow compiling this on other architectures. This will make it easier, and cleaner to enable COMPILE_TEST for some of these pic32 drivers. The asm variant of the header file will be dropped once all drivers have been updated.

Brian Masney committed 10 months ago

Commit d095d2d1 parent 3391d091 file · +39 −0Browse files

Showing the changes to include/linux/platform_data (1 of 1 file). Show all

Unified · Split

include/linux/platform_data/pic32.h+39−0
@@ -0,0 +1,39 @@
1+/* SPDX-License-Identifier: GPL-2.0-only */
2+/*
3+ * Joshua Henderson <joshua.henderson@microchip.com>
4+ * Copyright (C) 2015 Microchip Technology Inc. All rights reserved.
5+ */
6+#ifndef __LINUX_PLATFORM_DATA_PIC32_H
7+#define __LINUX_PLATFORM_DATA_PIC32_H
8+
9+#include <linux/types.h>
10+
11+/*
12+ * PIC32 register offsets for SET/CLR/INV where supported.
13+ */
14+#define PIC32_CLR(_reg) ((_reg) + 0x04)
15+#define PIC32_SET(_reg) ((_reg) + 0x08)
16+#define PIC32_INV(_reg) ((_reg) + 0x0C)
17+
18+/*
19+ * PIC32 Base Register Offsets
20+ */
21+#define PIC32_BASE_CONFIG 0x1f800000
22+#define PIC32_BASE_OSC 0x1f801200
23+#define PIC32_BASE_RESET 0x1f801240
24+#define PIC32_BASE_PPS 0x1f801400
25+#define PIC32_BASE_UART 0x1f822000
26+#define PIC32_BASE_PORT 0x1f860000
27+#define PIC32_BASE_DEVCFG2 0x1fc4ff44
28+
29+#if defined(CONFIG_MACH_PIC32)
30+/* Register unlock sequence required for some register access. */
31+void pic32_syskey_unlock_debug(const char *fn, const ulong ln);
32+#define pic32_syskey_unlock() \
33+ pic32_syskey_unlock_debug(__func__, __LINE__)
34+#else
35+/* COMPILE_TEST on all other architectures */
36+#define pic32_syskey_unlock()
37+#endif
38+
39+#endif /* __LINUX_PLATFORM_DATA_PIC32_H */