drivers: musb-new: fix compilation error for MIPS.
PATCH v2 1/4 drivers: musb-new: fix compilation error for MIPS.
MIPS arch implements writes{b,w,l,q}, reads{b,w,l,q} whereas other archs implement __raw version of them. So defining macro writes{bwlq}() to __raw_writes{bwlq}() (and similarly for reads{bwlq}) is not necessary for MIPS.
---
Changes in v2: None
drivers/usb/musb-new/linux-compat.h | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/musb-new/linux-compat.h +2 -0
@@ -13,12 +13,14 @@ printf(fmt, ##args); \ ret_warn; }) +#if !defined(CONFIG_MIPS )#define writesl (a, d, s) __raw_writesl((unsigned long)a, d, s)#define readsl (a, d, s) __raw_readsl((unsigned long)a, d, s)#define writesw (a, d, s) __raw_writesw((unsigned long)a, d, s)#define readsw (a, d, s) __raw_readsw((unsigned long)a, d, s)#define writesb (a, d, s) __raw_writesb((unsigned long)a, d, s)#define readsb (a, d, s) __raw_readsb((unsigned long)a, d, s) +#endif #define device_init_wakeup (dev, a) do {} while (0)
Signature · 1 line
1.8.3.1
PATCH v2 2/4 gadget: f_mass_storge: fix compilation error for MIPS.
Compiling USB mass storage gadget for MIPS reports redefinition error.
------------------drivers/usb/gadget/f_mass_storage.c:286:13: error: redefinition of 'set_bit'
inline void set_bit(int nr, volatile void *addr)
^
In file included from include/linux/bitops.h:123:0,
from include/common.h:20,
from drivers/usb/gadget/f_mass_storage.c:245:./arch/mips/include/asm/bitops.h:328:24: note: previous definition of 'set_bit' was here
static __inline__ void set_bit(int nr, volatile void * addr)
^
drivers/usb/gadget/f_mass_storage.c:296:13: error: redefinition of 'clear_bit'
inline void clear_bit(int nr, volatile void *addr)
^In file included from include/linux/bitops.h:123:0,
from include/common.h:20,
from drivers/usb/gadget/f_mass_storage.c:245:./arch/mips/include/asm/bitops.h:370:24: note: previous definition of 'clear_bit' was here
static __inline__ void clear_bit(int nr, volatile void * addr)
-------------
Fixed it by allowing default implementation of set_bit(), clear_bit()
for non MIPS.
---
Changes in v2: None
drivers/usb/gadget/f_mass_storage.c | 2 ++ 1 file changed, 2 insertions(+)
drivers/usb/gadget/f_mass_storage.c +2 -0
@@ -283,6 +283,7 @@ static const char fsg_string_interface[] = "Mass Storage";struct kref {int x; };struct completion {int x; }; +#if !defined(CONFIG_MIPS )inline void set_bit (int nr,volatile void *addr) {int mask;
@@ -302,6 +303,7 @@ inline void clear_bit(int nr, volatile void *addr) mask =1 << (nr &0x1f ); *a &= ~mask; } +#endif struct fsg_dev ;struct fsg_common ;
Signature · 1 line
1.8.3.1
PATCH v2 2/4 gadget: f_mass_storge: fix compilation error for MIPS.
Hi Purna,
Quoted 14 lines
Compiling USB mass storage gadget for MIPS reports redefinition error.
------------------drivers/usb/gadget/f_mass_storage.c:286:13: error: redefinition of 'set_bit' inline voidset_bit(int nr, volatile void *addr)^In file included from
include/linux/bitops.h:123:0,
frominclude/common.h:20,
fromdrivers/usb/gadget/f_mass_storage.c:245:./arch/mips/include/asm/bitops.h:328:24: note: previous definition of 'set_bit' was here static__inline__voidset_bit(int nr, volatile void * addr)^drivers/usb/gadget/f_mass_storage.c:296:13: error: redefinition of 'clear_bit' inline voidclear_bit(int nr, volatile void *addr)^
Quoted 8 lines
In file included from
include/linux/bitops.h:123:0,
frominclude/common.h:20,
fromdrivers/usb/gadget/f_mass_storage.c:245:./arch/mips/include/asm/bitops.h:370:24: note: previous definition of 'clear_bit' was here static__inline__voidclear_bit(int nr, volatile void * addr)-------------
Fixed it by allowing default implementation ofset_bit(),clear_bit()for non MIPS.
I seems like MIPS (and few other architectures) is providing implementation for {set|clear}_bit.
For ARM, those are declared as externs
at ./arch/arm/include/asm/bitops.h
I wonder why it is like that ...
Nonetheless, since I do not know how to fix this issue on ARM:
Quoted 29 lines
Signed-off-by Purna Chandra Mandal <[email protected]>---
Changes in v2: None
drivers/usb/gadget/f_mass_storage.c | 2 ++ 1 file changed, 2 insertions(+)(quoted diff) +0
-0
b/drivers/usb/gadget/f_mass_storage.cindex 1ecb92a..8ca02f2 100644drivers/usb/gadget/f_mass_storage.c +2
-0@@ -283,6 +283,7 @@ static const char fsg_string_interface[] = "Mass Storage"; struct kref {int x; }; struct completion {int x; }; +#if !defined(CONFIG_MIPS )inline void set_bit (int nr,volatile void *addr) {int mask;@@ -302,6 +303,7 @@ inline void clear_bit(int nr, volatile void *addr) mask =1 << (nr &0x1f ); *a &= ~mask; } +#endif struct fsg_dev ;struct fsg_common ;
Signature · 5 lines
Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
PATCH v2 2/4 gadget: f_mass_storge: fix compilation error for MIPS.
2016-03-07 15:33 GMT+01:00 Lukasz Majewski <[email protected]>:
Quoted 28 lines
Hi Purna,
Quoted 14 lines
Compiling USB mass storage gadget for MIPS reports redefinition error.
------------------drivers/usb/gadget/f_mass_storage.c:286:13: error: redefinition of 'set_bit' inline voidset_bit(int nr, volatile void *addr)^In file included from
include/linux/bitops.h:123:0,
frominclude/common.h:20,
fromdrivers/usb/gadget/f_mass_storage.c:245:./arch/mips/include/asm/bitops.h:328:24: note: previous definition of 'set_bit' was here static__inline__voidset_bit(int nr, volatile void * addr)^drivers/usb/gadget/f_mass_storage.c:296:13: error: redefinition of 'clear_bit' inline voidclear_bit(int nr, volatile void *addr)^Quoted 8 lines
In file included from
include/linux/bitops.h:123:0,
frominclude/common.h:20,
fromdrivers/usb/gadget/f_mass_storage.c:245:./arch/mips/include/asm/bitops.h:370:24: note: previous definition of 'clear_bit' was here static__inline__voidclear_bit(int nr, volatile void * addr)-------------
Fixed it by allowing default implementation ofset_bit(),clear_bit()for non MIPS.I seems like MIPS (and few other architectures) is providing implementation for {set|clear}_bit.
Quoted 6 lines
For ARM, those are declared as externs
at./arch/arm/include/asm/bitops.hI wonder why it is like that ...
Nonetheless, since I do not know how to fix this issue on ARM:
can't we simply remove those functions? Then the ones from include/linux/bitops.h respectively the arch-specific ones should be automatically used.
Quoted 41 lines
Acked-by Lukasz Majewski <[email protected]>Quoted 22 lines
Signed-off-by Purna Chandra Mandal <[email protected]>---
Changes in v2: None
drivers/usb/gadget/f_mass_storage.c | 2 ++ 1 file changed, 2 insertions(+)(quoted diff) +0
-0
b/drivers/usb/gadget/f_mass_storage.cindex 1ecb92a..8ca02f2 100644drivers/usb/gadget/f_mass_storage.c +1
-0@@ -283,6 +283,7 @@ static const char fsg_string_interface[] = "Mass Storage"; struct kref {int x; }; struct completion {int x; }; +#if !defined(CONFIG_MIPS )inline void set_bit (int nr,volatile void *addr) {int mask;drivers/usb/gadget/f_mass_storage.c inline void clear_bit(int nr, volatile void *addr) · line 309
Quoted 7 lines
drivers/usb/gadget/f_mass_storage.c +1
-0@@ -302,6 +303,7 @@ inline void clear_bit(int nr, volatile void *addr) mask =1 << (nr &0x1f ); *a &= ~mask; } +#endif struct fsg_dev ;struct fsg_common ;--
Best regards,Lukasz Majewski
Samsung R&D Institute Poland (SRPOL) | Linux Platform Group
Signature · 1 line
- Daniel
PATCH v2 3/4 drivers: musb-new: Add USB DRC driver for Microchip PIC32 OTG controller.
In reply to Purna Chandra MandalThis driver adds support of PIC32 MUSB OTG controller as dual role device. It implements platform specific glue to reuse musb core.
---
Changes in v2: None
drivers/usb/musb-new/Kconfig | 7 + drivers/usb/musb-new/Makefile | 1 + drivers/usb/musb-new/musb_core.c | 2 +- drivers/usb/musb-new/pic32.c | 294 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 303 insertions(+), 1 deletion(-) create mode 100644 drivers/usb/musb-new/pic32.c
drivers/usb/musb-new/Kconfig +7 -0
@@ -15,6 +15,13 @@ config USB_MUSB_GADGET if USB_MUSB_HOST || USB_MUSB_GADGET +config USB_MUSB_PIC32 + bool "Enable Microchip PIC32 DRC USB controller" + depends on DM_USB && MACH_PIC32 + help + Say y to enable PIC32 USB DRC controller support + if it is available on your Microchip PIC32 platform. + config USB_MUSB_SUNXI bool "Enable sunxi OTG / DRC USB controller" depends on ARCH_SUNXI
drivers/usb/musb-new/Makefile +1 -0
@@ -10,6 +10,7 @@ obj-$(CONFIG_USB_MUSB_HOST) += musb_host.o musb_core.o musb_uboot.o obj-$(CONFIG_USB_MUSB_DSPS) += musb_dsps.o obj-$(CONFIG_USB_MUSB_AM35X) += am35x.o obj-$(CONFIG_USB_MUSB_OMAP2PLUS) += omap2430.o +obj-$(CONFIG_USB_MUSB_PIC32) += pic32.o obj-$(CONFIG_USB_MUSB_SUNXI) += sunxi.o ccflags-y := $(call cc-option,-Wno-unused-variable) \
drivers/usb/musb-new/musb_core.c +1 -1
@@ -259,7 +259,7 @@ void musb_write_fifo(struct musb_hw_ep *hw_ep, u16 len, const u8 *src) } } -#if !defined(CONFIG_USB_MUSB_AM35X ) +#if !defined(CONFIG_USB_MUSB_AM35X ) && !defined(CONFIG_USB_MUSB_PIC32 )/* * Unload an endpoint's FIFO */
drivers/usb/musb-new/pic32.c new file +294 -0
294 lines not on this page · raw message
Signature · 1 line
1.8.3.1
PATCH v2 4/4 board: pic32mzda: enable USB-host, USB-storage support.
In reply to Purna Chandra MandalEnable MUSB host and USB storage support for Microchip PIC32MZ[DA] Starter Kit.
---
Changes in v2:
- compilation fix in drivers/usb/musb-new/linux-compat.h seperated
- compilation fix in drivers/gadget/f_mass_storage.c seperated
arch/mips/dts/pic32mzda.dtsi | 10 ++++++++++ arch/mips/dts/pic32mzda_sk.dts | 4 ++++ configs/pic32mzdask_defconfig | 6 +++++- include/configs/pic32mzdask.h | 7 +++++++ 4 files changed, 26 insertions(+), 1 deletion(-)
arch/mips/dts/pic32mzda.dtsi +10 -0
@@ -171,4 +171,14 @@ #address-cells = <1>; #size-cells = <0>; }; + + usb: musb at 1f8e3000 { + compatible = "microchip,pic32mzda-usb"; + reg = <0x1f8e3000 0x1000>, + <0x1f884000 0x1000>; + reg-names = "mc", "control"; + interrupts = <132 IRQ_TYPE_EDGE_RISING>, + <133 IRQ_TYPE_LEVEL_HIGH>; + status = "disabled"; + }; };
arch/mips/dts/pic32mzda_sk.dts +4 -0
@@ -52,4 +52,8 @@ ethernet_phy: lan8740_phy at 0 { reg = <0>; }; +}; + +&usb { + status = "okay"; };
configs/pic32mzdask_defconfig +5 -1
@@ -12,6 +12,7 @@ CONFIG_SYS_PROMPT="dask # " CONFIG_LOOPW=y CONFIG_CMD_MEMTEST=y CONFIG_CMD_MEMINFO=y +CONFIG_CMD_USB=y # CONFIG_CMD_FPGA is not set CONFIG_CMD_GPIO=y CONFIG_CMD_RARP=y
@@ -28,6 +29,9 @@ CONFIG_DM_ETH=y CONFIG_PIC32_ETH=y CONFIG_PINCTRL=y # CONFIG_PINCTRL_FULL is not set -CONFIG_SYS_VSNPRINTF=y +CONFIG_USB=y +CONFIG_DM_USB=y +CONFIG_USB_MUSB_HOST=y +CONFIG_USB_STORAGE=y CONFIG_USE_TINY_PRINTF=y CONFIG_CMD_DHRYSTONE=y
include/configs/pic32mzdask.h +7 -0
@@ -117,6 +117,12 @@#define CONFIG_GENERIC_MMC #define CONFIG_CMD_MMC +/*-------------------------------------------------- +* USB Configuration +*/ +#define CONFIG_USB_MUSB_PIO_ONLY +#define CONFIG_SYS_CACHELINE_SIZE 16 +/*----------------------------------------------------------------------- * File System Configuration */
@@ -167,6 +173,7 @@#define BOOT_TARGET_DEVICES (func) \ func(MMC, mmc, 0) \ + func(USB, usb, 0) \ func(DHCP, dhcp, na)#include <config_distro_bootcmd.h>
Signature · 1 line
1.8.3.1
PATCH v2 1/4 drivers: musb-new: fix compilation error for MIPS.
In reply to Purna Chandra Mandal2016-03-07 14:19 GMT+01:00 Purna Chandra Mandal <[email protected]>:
Quoted 19 lines
MIPS arch implements writes{b,w,l,q}, reads{b,w,l,q} whereas other archs implement
__rawversion of them. So defining macro writes{bwlq}() to __raw_writes{bwlq}() (and similarly for reads{bwlq}) is not necessary for MIPS.Signed-off-by Purna Chandra Mandal <[email protected]>---
Changes in v2: None
drivers/usb/musb-new/linux-compat.h | 2 ++ 1 file changed, 2 insertions(+)drivers/usb/musb-new/linux-compat.h +0
-0@@ -13,12 +13,14 @@ printf(fmt, ##args); \
drivers/usb/musb-new/linux-compat.h line 23
Quoted 10 lines
drivers/usb/musb-new/linux-compat.h +2
-0ret_warn; }) +#if !defined(CONFIG_MIPS )#define writesl (a, d, s) __raw_writesl((unsigned long)a, d, s)#define readsl (a, d, s) __raw_readsl((unsigned long)a, d, s)#define writesw (a, d, s) __raw_writesw((unsigned long)a, d, s)#define readsw (a, d, s) __raw_readsw((unsigned long)a, d, s)#define writesb (a, d, s) __raw_writesb((unsigned long)a, d, s)#define readsb (a, d, s) __raw_readsb((unsigned long)a, d, s) +#endif
I guess the current musb-new users are ARM boards only. Thus this should be moved to arch/arm/asm/io.h. Adding I/O primitives to a architecture-independent linux-compat.h was wrong from the beginning.
Quoted 6 lines
drivers/usb/musb-new/linux-compat.h +0
-1#define device_init_wakeup (dev, a) do {} while (0) --1.8.3.1
Signature · 1 line
- Daniel
PATCH v2 1/4 drivers: musb-new: fix compilation error for MIPS.
Quoted 22 lines · Daniel Schwierzeck
2016-03-07 14:19 GMT+01:00 Purna Chandra Mandal <[email protected]>:
Quoted 21 lines
MIPS arch implements writes{b,w,l,q}, reads{b,w,l,q} whereas other archs implement
__rawversion of them. So defining macro writes{bwlq}() to __raw_writes{bwlq}() (and similarly for reads{bwlq}) is not necessary for MIPS.Signed-off-by Purna Chandra Mandal <[email protected]>---
Changes in v2: None
drivers/usb/musb-new/linux-compat.h | 2 ++ 1 file changed, 2 insertions(+)drivers/usb/musb-new/linux-compat.h +0
-0@@ -13,12 +13,14 @@ printf(fmt, ##args); \ ret_warn; })
Quoted 11 lines
drivers/usb/musb-new/linux-compat.h line 23
Quoted 8 lines
drivers/usb/musb-new/linux-compat.h +2
-0+#if !defined(CONFIG_MIPS )#define writesl (a, d, s) __raw_writesl((unsigned long)a, d, s)#define readsl (a, d, s) __raw_readsl((unsigned long)a, d, s)#define writesw (a, d, s) __raw_writesw((unsigned long)a, d, s)#define readsw (a, d, s) __raw_readsw((unsigned long)a, d, s)#define writesb (a, d, s) __raw_writesb((unsigned long)a, d, s)#define readsb (a, d, s) __raw_readsb((unsigned long)a, d, s) +#endif I guess the current musb-new users are ARM boards only. Thus this should be moved to
arch/arm/asm/io.h. Adding I/O primitives to a architecture-independentlinux-compat.hwas wrong from the beginning.
Makes sense! ARM Linux also defines readsl(or similar) to their __raw version in arch/arm/include/asm/io.h file.
Quoted 6 lines
Quoted 5 lines
drivers/usb/musb-new/linux-compat.h +0
-1#define device_init_wakeup (dev, a) do {} while (0) --1.8.3.1