Re: [PATCH v2 09/11] usb: musb: re-introduce musb-port_mode
Daniel == Daniel Mack zon...@gmail.com writes: Daniel Define MUSB_PORT_MODE_{HOST,GADGET,DUAL_ROLE} and store the Daniel platform-specified value in struct musb. Daniel Note that MUSB_PORT_MODE_HOST has to be set to 1 in order to Daniel match existing device tree bindings which are already Daniel documented but in fact unusued. Daniel Signed-off-by: Daniel Mack zon...@gmail.com It would have been nice to add an explicit reference to am33xx-usb.txt / omap-usb.txt for the bindings, but that's minor (should those files be combined?) Acked-by: Peter Korsgaard jac...@sunsite.dk Daniel --- Daniel drivers/usb/musb/musb_core.c | 1 + Daniel drivers/usb/musb/musb_core.h | 7 +++ Daniel 2 files changed, 8 insertions(+) Daniel diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c Daniel index fbcf5cb..2640d25 100644 Daniel --- a/drivers/usb/musb/musb_core.c Daniel +++ b/drivers/usb/musb/musb_core.c Daniel @@ -1821,6 +1821,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) musb- board_set_power = plat-set_power; musb- min_power = plat-min_power; musb- ops = plat-platform_ops; Daniel + musb-port_mode = plat-mode; Daniel/* The musb_platform_init() call: Daniel * - adjusts musb-mregs Daniel diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h Daniel index 6b65847..174c097 100644 Daniel --- a/drivers/usb/musb/musb_core.h Daniel +++ b/drivers/usb/musb/musb_core.h Daniel @@ -77,6 +77,12 @@ struct musb_ep; Daniel #define is_peripheral_active(m) (!(m)-is_host) Daniel #define is_host_active(m) ((m)-is_host) Daniel +enum { Daniel + MUSB_PORT_MODE_HOST = 1, Daniel + MUSB_PORT_MODE_GADGET, Daniel + MUSB_PORT_MODE_DUAL_ROLE, Daniel +}; Daniel + Daniel #ifdef CONFIG_PROC_FS Daniel #include linux/fs.h Daniel #define MUSB_CONFIG_PROC_FS Daniel @@ -356,6 +362,7 @@ struct musb { Danielu8 min_power; /* vbus for periph, in mA/2 */ Daniel + int port_mode; /* MUSB_PORT_MODE_* */ Danielboolis_host; Danielint a_wait_bcon;/* VBUS timeout in msecs */ Daniel -- Daniel 1.8.1.4 -- Bye, Peter Korsgaard -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH v2 09/11] usb: musb: re-introduce musb-port_mode
Daniel Subject: [PATCH v2 09/11] usb: musb: re-introduce musb-port_mode Define MUSB_PORT_MODE_{HOST,GADGET,DUAL_ROLE} and store the platform-specified value in struct musb. Note that MUSB_PORT_MODE_HOST has to be set to 1 in order to match existing device tree bindings which are already documented but in fact unusued. Signed-off-by: Daniel Mack zon...@gmail.com --- drivers/usb/musb/musb_core.c | 1 + drivers/usb/musb/musb_core.h | 7 +++ 2 files changed, 8 insertions(+) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index fbcf5cb..2640d25 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -1821,6 +1821,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) musb-board_set_power = plat-set_power; musb-min_power = plat-min_power; musb-ops = plat-platform_ops; + musb-port_mode = plat-mode; I assume plat-mode is fetched from DT. You may need to over-ride mode field from DT for host-only or gadget-only configuration through menuconfig. Some thing like or better than this +#ifdef CONFIG_MUSB_DUAL_ROLE + Musb-port_mode = plat-mode; +#else Force it to host or gadget only configuration #endif /* The musb_platform_init() call: * - adjusts musb-mregs diff --git a/drivers/usb/musb/musb_core.h b/drivers/usb/musb/musb_core.h index 6b65847..174c097 100644 --- a/drivers/usb/musb/musb_core.h +++ b/drivers/usb/musb/musb_core.h @@ -77,6 +77,12 @@ struct musb_ep; #define is_peripheral_active(m) (!(m)-is_host) #define is_host_active(m)((m)-is_host) +enum { + MUSB_PORT_MODE_HOST = 1, + MUSB_PORT_MODE_GADGET, + MUSB_PORT_MODE_DUAL_ROLE, +}; + #ifdef CONFIG_PROC_FS #include linux/fs.h #define MUSB_CONFIG_PROC_FS @@ -356,6 +362,7 @@ struct musb { u8 min_power; /* vbus for periph, in mA/2 */ + int port_mode; /* MUSB_PORT_MODE_* */ boolis_host; int a_wait_bcon;/* VBUS timeout in msecs */ -- 1.8.1.4 -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 09/11] usb: musb: re-introduce musb-port_mode
On 08.04.2013 12:39, B, Ravi wrote: Subject: [PATCH v2 09/11] usb: musb: re-introduce musb-port_mode Define MUSB_PORT_MODE_{HOST,GADGET,DUAL_ROLE} and store the platform-specified value in struct musb. Note that MUSB_PORT_MODE_HOST has to be set to 1 in order to match existing device tree bindings which are already documented but in fact unusued. Signed-off-by: Daniel Mack zon...@gmail.com --- drivers/usb/musb/musb_core.c | 1 + drivers/usb/musb/musb_core.h | 7 +++ 2 files changed, 8 insertions(+) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index fbcf5cb..2640d25 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -1821,6 +1821,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) musb-board_set_power = plat-set_power; musb-min_power = plat-min_power; musb-ops = plat-platform_ops; +musb-port_mode = plat-mode; I assume plat-mode is fetched from DT. Yes, that's already done in the current mainline. The problem is that this value is not used anywhere, though. You may need to over-ride mode field from DT for host-only or gadget-only configuration through menuconfig. As stated in the other mail, I don't think this is a good idea at all. The config chooses which parts of the kernel you want to build in, the runtime config lets you select the actual mode. Mixing them up just makes it much harder for people to understand what's going on. Daniel -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
RE: [PATCH v2 09/11] usb: musb: re-introduce musb-port_mode
Daniel On 08.04.2013 12:39, B, Ravi wrote: Subject: [PATCH v2 09/11] usb: musb: re-introduce musb-port_mode Define MUSB_PORT_MODE_{HOST,GADGET,DUAL_ROLE} and store the platform-specified value in struct musb. Note that MUSB_PORT_MODE_HOST has to be set to 1 in order to match existing device tree bindings which are already documented but in fact unusued. Signed-off-by: Daniel Mack zon...@gmail.com --- drivers/usb/musb/musb_core.c | 1 + drivers/usb/musb/musb_core.h | 7 +++ 2 files changed, 8 insertions(+) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index fbcf5cb..2640d25 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -1821,6 +1821,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) musb-board_set_power = plat-set_power; musb-min_power = plat-min_power; musb-ops = plat-platform_ops; + musb-port_mode = plat-mode; I assume plat-mode is fetched from DT. Yes, that's already done in the current mainline. The problem is that this value is not used anywhere, though. You may need to over-ride mode field from DT for host-only or gadget- only configuration through menuconfig. As stated in the other mail, I don't think this is a good idea at all. The config chooses which parts of the kernel you want to build in, the runtime config lets you select the actual mode. Mixing them up just makes it much harder for people to understand what's going on. My concern is , what if user selects HOST only mode thru menu config and provide DT port-mode bindings wrongly. -- Ravi B -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH v2 09/11] usb: musb: re-introduce musb-port_mode
On 08.04.2013 14:55, B, Ravi wrote: Daniel On 08.04.2013 12:39, B, Ravi wrote: Subject: [PATCH v2 09/11] usb: musb: re-introduce musb-port_mode Define MUSB_PORT_MODE_{HOST,GADGET,DUAL_ROLE} and store the platform-specified value in struct musb. Note that MUSB_PORT_MODE_HOST has to be set to 1 in order to match existing device tree bindings which are already documented but in fact unusued. Signed-off-by: Daniel Mack zon...@gmail.com --- drivers/usb/musb/musb_core.c | 1 + drivers/usb/musb/musb_core.h | 7 +++ 2 files changed, 8 insertions(+) diff --git a/drivers/usb/musb/musb_core.c b/drivers/usb/musb/musb_core.c index fbcf5cb..2640d25 100644 --- a/drivers/usb/musb/musb_core.c +++ b/drivers/usb/musb/musb_core.c @@ -1821,6 +1821,7 @@ musb_init_controller(struct device *dev, int nIrq, void __iomem *ctrl) musb-board_set_power = plat-set_power; musb-min_power = plat-min_power; musb-ops = plat-platform_ops; + musb-port_mode = plat-mode; I assume plat-mode is fetched from DT. Yes, that's already done in the current mainline. The problem is that this value is not used anywhere, though. You may need to over-ride mode field from DT for host-only or gadget- only configuration through menuconfig. As stated in the other mail, I don't think this is a good idea at all. The config chooses which parts of the kernel you want to build in, the runtime config lets you select the actual mode. Mixing them up just makes it much harder for people to understand what's going on. My concern is , what if user selects HOST only mode thru menu config and provide DT port-mode bindings wrongly. As I said - this is the same as disabling a driver but referencing it from DT. After all, we're not dealing with end-users here but with people who integrate the kernel for a special kind of device. I'd say we can expect them to provide the correct data in their DT. Fixing it up is not the job of the driver IMO. Daniel -- To unsubscribe from this list: send the line unsubscribe linux-usb in the body of a message to majord...@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html