uboot-d1: add bootloader for upcoming d1 target
[openwrt/staging/mans0n.git] / package / boot / uboot-d1 / patches / 0086-usb-musb-new-Hack-up-the-driver-for-the-D1.patch
1 From eb0cf5922cf0656a7e9f96d6b83397469a26825a Mon Sep 17 00:00:00 2001
2 From: Samuel Holland <samuel@sholland.org>
3 Date: Sat, 11 Sep 2021 10:12:24 -0500
4 Subject: [PATCH 86/90] usb: musb-new: Hack up the driver for the D1
5
6 Signed-off-by: Samuel Holland <samuel@sholland.org>
7 ---
8 arch/riscv/include/asm/bitops.h | 1 +
9 arch/riscv/include/asm/io.h | 2 +-
10 arch/riscv/include/asm/processor.h | 2 ++
11 drivers/usb/musb-new/musb_io.h | 2 +-
12 drivers/usb/musb-new/sunxi.c | 6 ++++--
13 5 files changed, 9 insertions(+), 4 deletions(-)
14
15 --- a/arch/riscv/include/asm/bitops.h
16 +++ b/arch/riscv/include/asm/bitops.h
17 @@ -78,6 +78,7 @@ static inline int __test_and_set_bit(int
18 return retval;
19 }
20
21 +#define test_and_clear_bit __test_and_clear_bit
22 static inline int __test_and_clear_bit(int nr, void *addr)
23 {
24 int mask, retval;
25 --- a/arch/riscv/include/asm/io.h
26 +++ b/arch/riscv/include/asm/io.h
27 @@ -218,6 +218,7 @@ static inline u64 readq(const volatile v
28 #define insb(p, d, l) readsb(__io(p), d, l)
29 #define insw(p, d, l) readsw(__io(p), d, l)
30 #define insl(p, d, l) readsl(__io(p), d, l)
31 +#endif
32
33 static inline void readsb(unsigned int *addr, void *data, int bytelen)
34 {
35 @@ -308,7 +309,6 @@ static inline void writesl(unsigned int
36 longlen--;
37 }
38 }
39 -#endif
40
41 #define outb_p(val, port) outb((val), (port))
42 #define outw_p(val, port) outw((val), (port))
43 --- a/arch/riscv/include/asm/processor.h
44 +++ b/arch/riscv/include/asm/processor.h
45 @@ -23,4 +23,6 @@
46 * no one uses the macros defined in this head file.
47 **************************************************************/
48
49 +#define cpu_relax() barrier()
50 +
51 #endif /* __ASM_RISCV_PROCESSOR_H */
52 --- a/drivers/usb/musb-new/musb_io.h
53 +++ b/drivers/usb/musb-new/musb_io.h
54 @@ -23,7 +23,7 @@
55 #if !defined(CONFIG_ARM) && !defined(CONFIG_SUPERH) \
56 && !defined(CONFIG_PPC32) \
57 && !defined(CONFIG_PPC64) && !defined(CONFIG_MIPS) \
58 - && !defined(CONFIG_M68K)
59 + && !defined(CONFIG_M68K) && !defined(CONFIG_RISCV)
60 static inline void readsl(const void __iomem *addr, void *buf, int len)
61 { insl((unsigned long)addr, buf, len); }
62 static inline void readsw(const void __iomem *addr, void *buf, int len)
63 --- a/drivers/usb/musb-new/sunxi.c
64 +++ b/drivers/usb/musb-new/sunxi.c
65 @@ -23,8 +23,8 @@
66 #include <malloc.h>
67 #include <phy-sun4i-usb.h>
68 #include <reset.h>
69 -#include <asm/arch/cpu.h>
70 -#include <asm/arch/clock.h>
71 +//#include <asm/arch/cpu.h>
72 +//#include <asm/arch/clock.h>
73 #include <dm/device_compat.h>
74 #include <dm/lists.h>
75 #include <dm/root.h>
76 @@ -174,6 +174,7 @@ static void USBC_ForceVbusValidToHigh(__
77
78 static void USBC_ConfigFIFO_Base(void)
79 {
80 +#if 0
81 u32 reg_value;
82
83 /* config usb fifo, 8kb mode */
84 @@ -181,6 +182,7 @@ static void USBC_ConfigFIFO_Base(void)
85 reg_value &= ~(0x03 << 0);
86 reg_value |= BIT(0);
87 writel(reg_value, SUNXI_SRAMC_BASE + 0x04);
88 +#endif
89 }
90
91 /******************************************************************************